@@ -1,1 +1,1 | |||||
1 |
src/basic_parameters = https:// |
|
1 | src/basic_parameters = https://hephaistos.lpp.polytechnique.fr/rhodecode/HG_REPOSITORIES/LPP/INSTRUMENTATION/SOLO_LFR/LFR_basic-parameters |
@@ -1,253 +1,253 | |||||
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: |
|
3 | # Generated by qmake (2.01a) (Qt 4.8.5) on: Tue Mar 4 09:15:37 2014 | |
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=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=2 -DPRINT_MESSAGES_ON_CONSOLE |
|
13 | DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=2 -DPRINT_MESSAGES_ON_CONSOLE -DDEBUG_MESSAGES | |
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 -I../../LFR_basic-parameters |
|
16 | INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header -I../../LFR_basic-parameters | |
17 | LINK = sparc-rtems-g++ |
|
17 | LINK = sparc-rtems-g++ | |
18 | LFLAGS = |
|
18 | LFLAGS = | |
19 | LIBS = $(SUBLIBS) |
|
19 | LIBS = $(SUBLIBS) | |
20 | AR = sparc-rtems-ar rcs |
|
20 | AR = sparc-rtems-ar rcs | |
21 | RANLIB = |
|
21 | RANLIB = | |
22 | QMAKE = /usr/bin/qmake-qt4 |
|
22 | QMAKE = /usr/bin/qmake-qt4 | |
23 | TAR = tar -cf |
|
23 | TAR = tar -cf | |
24 | COMPRESS = gzip -9f |
|
24 | COMPRESS = gzip -9f | |
25 | COPY = cp -f |
|
25 | COPY = cp -f | |
26 | SED = sed |
|
26 | SED = sed | |
27 | COPY_FILE = $(COPY) |
|
27 | COPY_FILE = $(COPY) | |
28 | COPY_DIR = $(COPY) -r |
|
28 | COPY_DIR = $(COPY) -r | |
29 | STRIP = sparc-rtems-strip |
|
29 | STRIP = sparc-rtems-strip | |
30 | INSTALL_FILE = install -m 644 -p |
|
30 | INSTALL_FILE = install -m 644 -p | |
31 | INSTALL_DIR = $(COPY_DIR) |
|
31 | INSTALL_DIR = $(COPY_DIR) | |
32 | INSTALL_PROGRAM = install -m 755 -p |
|
32 | INSTALL_PROGRAM = install -m 755 -p | |
33 | DEL_FILE = rm -f |
|
33 | DEL_FILE = rm -f | |
34 | SYMLINK = ln -f -s |
|
34 | SYMLINK = ln -f -s | |
35 | DEL_DIR = rmdir |
|
35 | DEL_DIR = rmdir | |
36 | MOVE = mv -f |
|
36 | MOVE = mv -f | |
37 | CHK_DIR_EXISTS= test -d |
|
37 | CHK_DIR_EXISTS= test -d | |
38 | MKDIR = mkdir -p |
|
38 | MKDIR = mkdir -p | |
39 |
|
39 | |||
40 | ####### Output directory |
|
40 | ####### Output directory | |
41 |
|
41 | |||
42 | OBJECTS_DIR = obj/ |
|
42 | OBJECTS_DIR = obj/ | |
43 |
|
43 | |||
44 | ####### Files |
|
44 | ####### Files | |
45 |
|
45 | |||
46 | SOURCES = ../src/wf_handler.c \ |
|
46 | SOURCES = ../src/wf_handler.c \ | |
47 | ../src/tc_handler.c \ |
|
47 | ../src/tc_handler.c \ | |
48 | ../src/fsw_processing.c \ |
|
48 | ../src/fsw_processing.c \ | |
49 | ../src/fsw_misc.c \ |
|
49 | ../src/fsw_misc.c \ | |
50 | ../src/fsw_init.c \ |
|
50 | ../src/fsw_init.c \ | |
51 | ../src/fsw_globals.c \ |
|
51 | ../src/fsw_globals.c \ | |
52 | ../src/fsw_spacewire.c \ |
|
52 | ../src/fsw_spacewire.c \ | |
53 | ../src/tc_load_dump_parameters.c \ |
|
53 | ../src/tc_load_dump_parameters.c \ | |
54 | ../src/tm_lfr_tc_exe.c \ |
|
54 | ../src/tm_lfr_tc_exe.c \ | |
55 | ../src/tc_acceptance.c \ |
|
55 | ../src/tc_acceptance.c \ | |
56 | ../../LFR_basic-parameters/basic_parameters.c |
|
56 | ../../LFR_basic-parameters/basic_parameters.c | |
57 | OBJECTS = obj/wf_handler.o \ |
|
57 | OBJECTS = obj/wf_handler.o \ | |
58 | obj/tc_handler.o \ |
|
58 | obj/tc_handler.o \ | |
59 | obj/fsw_processing.o \ |
|
59 | obj/fsw_processing.o \ | |
60 | obj/fsw_misc.o \ |
|
60 | obj/fsw_misc.o \ | |
61 | obj/fsw_init.o \ |
|
61 | obj/fsw_init.o \ | |
62 | obj/fsw_globals.o \ |
|
62 | obj/fsw_globals.o \ | |
63 | obj/fsw_spacewire.o \ |
|
63 | obj/fsw_spacewire.o \ | |
64 | obj/tc_load_dump_parameters.o \ |
|
64 | obj/tc_load_dump_parameters.o \ | |
65 | obj/tm_lfr_tc_exe.o \ |
|
65 | obj/tm_lfr_tc_exe.o \ | |
66 | obj/tc_acceptance.o \ |
|
66 | obj/tc_acceptance.o \ | |
67 | obj/basic_parameters.o |
|
67 | obj/basic_parameters.o | |
68 | DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \ |
|
68 | DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \ | |
69 | /usr/lib64/qt4/mkspecs/common/linux.conf \ |
|
69 | /usr/lib64/qt4/mkspecs/common/linux.conf \ | |
70 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ |
|
70 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ | |
71 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ |
|
71 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ | |
72 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ |
|
72 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ | |
73 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ |
|
73 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ | |
74 | /usr/lib64/qt4/mkspecs/qconfig.pri \ |
|
74 | /usr/lib64/qt4/mkspecs/qconfig.pri \ | |
75 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ |
|
75 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ | |
76 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ |
|
76 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ | |
77 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ |
|
77 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ | |
78 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ |
|
78 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ | |
79 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ |
|
79 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ | |
80 | sparc.pri \ |
|
80 | sparc.pri \ | |
81 | /usr/lib64/qt4/mkspecs/features/release.prf \ |
|
81 | /usr/lib64/qt4/mkspecs/features/release.prf \ | |
82 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ |
|
82 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ | |
83 | /usr/lib64/qt4/mkspecs/features/shared.prf \ |
|
83 | /usr/lib64/qt4/mkspecs/features/shared.prf \ | |
84 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ |
|
84 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ | |
85 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ |
|
85 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ | |
86 | /usr/lib64/qt4/mkspecs/features/resources.prf \ |
|
86 | /usr/lib64/qt4/mkspecs/features/resources.prf \ | |
87 | /usr/lib64/qt4/mkspecs/features/uic.prf \ |
|
87 | /usr/lib64/qt4/mkspecs/features/uic.prf \ | |
88 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ |
|
88 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ | |
89 | /usr/lib64/qt4/mkspecs/features/lex.prf \ |
|
89 | /usr/lib64/qt4/mkspecs/features/lex.prf \ | |
90 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \ |
|
90 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \ | |
91 | fsw-qt.pro |
|
91 | fsw-qt.pro | |
92 | QMAKE_TARGET = fsw |
|
92 | QMAKE_TARGET = fsw | |
93 | DESTDIR = bin/ |
|
93 | DESTDIR = bin/ | |
94 | TARGET = bin/fsw |
|
94 | TARGET = bin/fsw | |
95 |
|
95 | |||
96 | first: all |
|
96 | first: all | |
97 | ####### Implicit rules |
|
97 | ####### Implicit rules | |
98 |
|
98 | |||
99 | .SUFFIXES: .o .c .cpp .cc .cxx .C |
|
99 | .SUFFIXES: .o .c .cpp .cc .cxx .C | |
100 |
|
100 | |||
101 | .cpp.o: |
|
101 | .cpp.o: | |
102 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
102 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" | |
103 |
|
103 | |||
104 | .cc.o: |
|
104 | .cc.o: | |
105 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
105 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" | |
106 |
|
106 | |||
107 | .cxx.o: |
|
107 | .cxx.o: | |
108 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
108 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" | |
109 |
|
109 | |||
110 | .C.o: |
|
110 | .C.o: | |
111 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
111 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" | |
112 |
|
112 | |||
113 | .c.o: |
|
113 | .c.o: | |
114 | $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<" |
|
114 | $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<" | |
115 |
|
115 | |||
116 | ####### Build rules |
|
116 | ####### Build rules | |
117 |
|
117 | |||
118 | all: Makefile $(TARGET) |
|
118 | all: Makefile $(TARGET) | |
119 |
|
119 | |||
120 | $(TARGET): $(OBJECTS) |
|
120 | $(TARGET): $(OBJECTS) | |
121 | @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/ |
|
121 | @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/ | |
122 | $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) |
|
122 | $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) | |
123 |
|
123 | |||
124 | Makefile: fsw-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \ |
|
124 | Makefile: fsw-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \ | |
125 | /usr/lib64/qt4/mkspecs/common/linux.conf \ |
|
125 | /usr/lib64/qt4/mkspecs/common/linux.conf \ | |
126 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ |
|
126 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ | |
127 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ |
|
127 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ | |
128 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ |
|
128 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ | |
129 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ |
|
129 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ | |
130 | /usr/lib64/qt4/mkspecs/qconfig.pri \ |
|
130 | /usr/lib64/qt4/mkspecs/qconfig.pri \ | |
131 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ |
|
131 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ | |
132 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ |
|
132 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ | |
133 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ |
|
133 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ | |
134 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ |
|
134 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ | |
135 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ |
|
135 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ | |
136 | sparc.pri \ |
|
136 | sparc.pri \ | |
137 | /usr/lib64/qt4/mkspecs/features/release.prf \ |
|
137 | /usr/lib64/qt4/mkspecs/features/release.prf \ | |
138 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ |
|
138 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ | |
139 | /usr/lib64/qt4/mkspecs/features/shared.prf \ |
|
139 | /usr/lib64/qt4/mkspecs/features/shared.prf \ | |
140 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ |
|
140 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ | |
141 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ |
|
141 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ | |
142 | /usr/lib64/qt4/mkspecs/features/resources.prf \ |
|
142 | /usr/lib64/qt4/mkspecs/features/resources.prf \ | |
143 | /usr/lib64/qt4/mkspecs/features/uic.prf \ |
|
143 | /usr/lib64/qt4/mkspecs/features/uic.prf \ | |
144 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ |
|
144 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ | |
145 | /usr/lib64/qt4/mkspecs/features/lex.prf \ |
|
145 | /usr/lib64/qt4/mkspecs/features/lex.prf \ | |
146 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf |
|
146 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf | |
147 | $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro |
|
147 | $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro | |
148 | /usr/lib64/qt4/mkspecs/common/unix.conf: |
|
148 | /usr/lib64/qt4/mkspecs/common/unix.conf: | |
149 | /usr/lib64/qt4/mkspecs/common/linux.conf: |
|
149 | /usr/lib64/qt4/mkspecs/common/linux.conf: | |
150 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf: |
|
150 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf: | |
151 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf: |
|
151 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf: | |
152 | /usr/lib64/qt4/mkspecs/common/g++-base.conf: |
|
152 | /usr/lib64/qt4/mkspecs/common/g++-base.conf: | |
153 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf: |
|
153 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf: | |
154 | /usr/lib64/qt4/mkspecs/qconfig.pri: |
|
154 | /usr/lib64/qt4/mkspecs/qconfig.pri: | |
155 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri: |
|
155 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri: | |
156 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf: |
|
156 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf: | |
157 | /usr/lib64/qt4/mkspecs/features/qt_config.prf: |
|
157 | /usr/lib64/qt4/mkspecs/features/qt_config.prf: | |
158 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf: |
|
158 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf: | |
159 | /usr/lib64/qt4/mkspecs/features/default_pre.prf: |
|
159 | /usr/lib64/qt4/mkspecs/features/default_pre.prf: | |
160 | sparc.pri: |
|
160 | sparc.pri: | |
161 | /usr/lib64/qt4/mkspecs/features/release.prf: |
|
161 | /usr/lib64/qt4/mkspecs/features/release.prf: | |
162 | /usr/lib64/qt4/mkspecs/features/default_post.prf: |
|
162 | /usr/lib64/qt4/mkspecs/features/default_post.prf: | |
163 | /usr/lib64/qt4/mkspecs/features/shared.prf: |
|
163 | /usr/lib64/qt4/mkspecs/features/shared.prf: | |
164 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf: |
|
164 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf: | |
165 | /usr/lib64/qt4/mkspecs/features/warn_on.prf: |
|
165 | /usr/lib64/qt4/mkspecs/features/warn_on.prf: | |
166 | /usr/lib64/qt4/mkspecs/features/resources.prf: |
|
166 | /usr/lib64/qt4/mkspecs/features/resources.prf: | |
167 | /usr/lib64/qt4/mkspecs/features/uic.prf: |
|
167 | /usr/lib64/qt4/mkspecs/features/uic.prf: | |
168 | /usr/lib64/qt4/mkspecs/features/yacc.prf: |
|
168 | /usr/lib64/qt4/mkspecs/features/yacc.prf: | |
169 | /usr/lib64/qt4/mkspecs/features/lex.prf: |
|
169 | /usr/lib64/qt4/mkspecs/features/lex.prf: | |
170 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf: |
|
170 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf: | |
171 | qmake: FORCE |
|
171 | qmake: FORCE | |
172 | @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro |
|
172 | @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro | |
173 |
|
173 | |||
174 | dist: |
|
174 | dist: | |
175 | @$(CHK_DIR_EXISTS) obj/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0 |
|
175 | @$(CHK_DIR_EXISTS) obj/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0 | |
176 | $(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 |
|
176 | $(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 | |
177 |
|
177 | |||
178 |
|
178 | |||
179 | clean:compiler_clean |
|
179 | clean:compiler_clean | |
180 | -$(DEL_FILE) $(OBJECTS) |
|
180 | -$(DEL_FILE) $(OBJECTS) | |
181 | -$(DEL_FILE) *~ core *.core |
|
181 | -$(DEL_FILE) *~ core *.core | |
182 |
|
182 | |||
183 |
|
183 | |||
184 | ####### Sub-libraries |
|
184 | ####### Sub-libraries | |
185 |
|
185 | |||
186 | distclean: clean |
|
186 | distclean: clean | |
187 | -$(DEL_FILE) $(TARGET) |
|
187 | -$(DEL_FILE) $(TARGET) | |
188 | -$(DEL_FILE) Makefile |
|
188 | -$(DEL_FILE) Makefile | |
189 |
|
189 | |||
190 |
|
190 | |||
191 | grmon: |
|
191 | grmon: | |
192 | cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u |
|
192 | cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u | |
193 |
|
193 | |||
194 | check: first |
|
194 | check: first | |
195 |
|
195 | |||
196 | compiler_rcc_make_all: |
|
196 | compiler_rcc_make_all: | |
197 | compiler_rcc_clean: |
|
197 | compiler_rcc_clean: | |
198 | compiler_uic_make_all: |
|
198 | compiler_uic_make_all: | |
199 | compiler_uic_clean: |
|
199 | compiler_uic_clean: | |
200 | compiler_image_collection_make_all: qmake_image_collection.cpp |
|
200 | compiler_image_collection_make_all: qmake_image_collection.cpp | |
201 | compiler_image_collection_clean: |
|
201 | compiler_image_collection_clean: | |
202 | -$(DEL_FILE) qmake_image_collection.cpp |
|
202 | -$(DEL_FILE) qmake_image_collection.cpp | |
203 | compiler_yacc_decl_make_all: |
|
203 | compiler_yacc_decl_make_all: | |
204 | compiler_yacc_decl_clean: |
|
204 | compiler_yacc_decl_clean: | |
205 | compiler_yacc_impl_make_all: |
|
205 | compiler_yacc_impl_make_all: | |
206 | compiler_yacc_impl_clean: |
|
206 | compiler_yacc_impl_clean: | |
207 | compiler_lex_make_all: |
|
207 | compiler_lex_make_all: | |
208 | compiler_lex_clean: |
|
208 | compiler_lex_clean: | |
209 | compiler_clean: |
|
209 | compiler_clean: | |
210 |
|
210 | |||
211 | ####### Compile |
|
211 | ####### Compile | |
212 |
|
212 | |||
213 | obj/wf_handler.o: ../src/wf_handler.c |
|
213 | obj/wf_handler.o: ../src/wf_handler.c | |
214 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/wf_handler.o ../src/wf_handler.c |
|
214 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/wf_handler.o ../src/wf_handler.c | |
215 |
|
215 | |||
216 | obj/tc_handler.o: ../src/tc_handler.c |
|
216 | obj/tc_handler.o: ../src/tc_handler.c | |
217 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o ../src/tc_handler.c |
|
217 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o ../src/tc_handler.c | |
218 |
|
218 | |||
219 | obj/fsw_processing.o: ../src/fsw_processing.c ../src/fsw_processing_globals.c |
|
219 | obj/fsw_processing.o: ../src/fsw_processing.c ../src/fsw_processing_globals.c | |
220 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/fsw_processing.c |
|
220 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/fsw_processing.c | |
221 |
|
221 | |||
222 | obj/fsw_misc.o: ../src/fsw_misc.c |
|
222 | obj/fsw_misc.o: ../src/fsw_misc.c | |
223 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c |
|
223 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c | |
224 |
|
224 | |||
225 | obj/fsw_init.o: ../src/fsw_init.c ../src/fsw_config.c |
|
225 | obj/fsw_init.o: ../src/fsw_init.c ../src/fsw_config.c | |
226 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o ../src/fsw_init.c |
|
226 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o ../src/fsw_init.c | |
227 |
|
227 | |||
228 | obj/fsw_globals.o: ../src/fsw_globals.c |
|
228 | obj/fsw_globals.o: ../src/fsw_globals.c | |
229 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c |
|
229 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c | |
230 |
|
230 | |||
231 | obj/fsw_spacewire.o: ../src/fsw_spacewire.c |
|
231 | obj/fsw_spacewire.o: ../src/fsw_spacewire.c | |
232 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spacewire.o ../src/fsw_spacewire.c |
|
232 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spacewire.o ../src/fsw_spacewire.c | |
233 |
|
233 | |||
234 | obj/tc_load_dump_parameters.o: ../src/tc_load_dump_parameters.c |
|
234 | obj/tc_load_dump_parameters.o: ../src/tc_load_dump_parameters.c | |
235 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_load_dump_parameters.o ../src/tc_load_dump_parameters.c |
|
235 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_load_dump_parameters.o ../src/tc_load_dump_parameters.c | |
236 |
|
236 | |||
237 | obj/tm_lfr_tc_exe.o: ../src/tm_lfr_tc_exe.c |
|
237 | obj/tm_lfr_tc_exe.o: ../src/tm_lfr_tc_exe.c | |
238 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tm_lfr_tc_exe.o ../src/tm_lfr_tc_exe.c |
|
238 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tm_lfr_tc_exe.o ../src/tm_lfr_tc_exe.c | |
239 |
|
239 | |||
240 | obj/tc_acceptance.o: ../src/tc_acceptance.c |
|
240 | obj/tc_acceptance.o: ../src/tc_acceptance.c | |
241 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_acceptance.o ../src/tc_acceptance.c |
|
241 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_acceptance.o ../src/tc_acceptance.c | |
242 |
|
242 | |||
243 | obj/basic_parameters.o: ../../LFR_basic-parameters/basic_parameters.c ../../LFR_basic-parameters/basic_parameters.h |
|
243 | obj/basic_parameters.o: ../../LFR_basic-parameters/basic_parameters.c ../../LFR_basic-parameters/basic_parameters.h | |
244 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/basic_parameters.o ../../LFR_basic-parameters/basic_parameters.c |
|
244 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/basic_parameters.o ../../LFR_basic-parameters/basic_parameters.c | |
245 |
|
245 | |||
246 | ####### Install |
|
246 | ####### Install | |
247 |
|
247 | |||
248 | install: FORCE |
|
248 | install: FORCE | |
249 |
|
249 | |||
250 | uninstall: FORCE |
|
250 | uninstall: FORCE | |
251 |
|
251 | |||
252 | FORCE: |
|
252 | FORCE: | |
253 |
|
253 |
@@ -1,78 +1,77 | |||||
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 |
|
3 | # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report | |
4 | CONFIG += console verbose |
|
4 | CONFIG += console verbose debug_messages | |
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=-1-0 |
|
10 | SWVERSION=-1-0 | |
11 | DEFINES += SW_VERSION_N1=1 # major |
|
11 | DEFINES += SW_VERSION_N1=1 # major | |
12 | DEFINES += SW_VERSION_N2=0 # minor |
|
12 | DEFINES += SW_VERSION_N2=0 # minor | |
13 | DEFINES += SW_VERSION_N3=0 # patch |
|
13 | DEFINES += SW_VERSION_N3=0 # patch | |
14 | DEFINES += SW_VERSION_N4=2 # internal |
|
14 | DEFINES += SW_VERSION_N4=2 # internal | |
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, debug_messages ) { |
|
20 | contains( CONFIG, debug_messages ) { | |
21 | DEFINES += DEBUG_MESSAGES |
|
21 | DEFINES += DEBUG_MESSAGES | |
22 | } |
|
22 | } | |
23 |
|
23 | |||
24 | contains( CONFIG, cpu_usage_report ) { |
|
24 | contains( CONFIG, cpu_usage_report ) { | |
25 | DEFINES += PRINT_TASK_STATISTICS |
|
25 | DEFINES += PRINT_TASK_STATISTICS | |
26 | } |
|
26 | } | |
27 |
|
27 | |||
28 | contains( CONFIG, stack_report ) { |
|
28 | contains( CONFIG, stack_report ) { | |
29 | DEFINES += PRINT_STACK_REPORT |
|
29 | DEFINES += PRINT_STACK_REPORT | |
30 | } |
|
30 | } | |
31 |
|
31 | |||
32 | contains( CONFIG, boot_messages ) { |
|
32 | contains( CONFIG, boot_messages ) { | |
33 | DEFINES += BOOT_MESSAGES |
|
33 | DEFINES += BOOT_MESSAGES | |
34 | } |
|
34 | } | |
35 |
|
35 | |||
36 | #doxygen.target = doxygen |
|
36 | #doxygen.target = doxygen | |
37 | #doxygen.commands = doxygen ../doc/Doxyfile |
|
37 | #doxygen.commands = doxygen ../doc/Doxyfile | |
38 | #QMAKE_EXTRA_TARGETS += doxygen |
|
38 | #QMAKE_EXTRA_TARGETS += doxygen | |
39 |
|
39 | |||
40 | TARGET = fsw |
|
40 | TARGET = fsw | |
41 |
|
41 | |||
42 | INCLUDEPATH += \ |
|
42 | INCLUDEPATH += \ | |
43 | ../src \ |
|
43 | ../src \ | |
44 | ../header \ |
|
44 | ../header \ | |
45 | ../../LFR_basic-parameters |
|
45 | ../../LFR_basic-parameters | |
46 |
|
46 | |||
47 | SOURCES += \ |
|
47 | SOURCES += \ | |
48 | ../src/wf_handler.c \ |
|
48 | ../src/wf_handler.c \ | |
49 | ../src/tc_handler.c \ |
|
49 | ../src/tc_handler.c \ | |
50 | ../src/fsw_processing.c \ |
|
50 | ../src/fsw_processing.c \ | |
51 | ../src/fsw_misc.c \ |
|
51 | ../src/fsw_misc.c \ | |
52 | ../src/fsw_init.c \ |
|
52 | ../src/fsw_init.c \ | |
53 | ../src/fsw_globals.c \ |
|
53 | ../src/fsw_globals.c \ | |
54 | ../src/fsw_spacewire.c \ |
|
54 | ../src/fsw_spacewire.c \ | |
55 | ../src/tc_load_dump_parameters.c \ |
|
55 | ../src/tc_load_dump_parameters.c \ | |
56 | ../src/tm_lfr_tc_exe.c \ |
|
56 | ../src/tm_lfr_tc_exe.c \ | |
57 | ../src/tc_acceptance.c \ |
|
57 | ../src/tc_acceptance.c \ | |
58 | ../../LFR_basic-parameters/basic_parameters.c |
|
58 | ../../LFR_basic-parameters/basic_parameters.c | |
59 |
|
59 | |||
60 |
|
60 | |||
61 | HEADERS += \ |
|
61 | HEADERS += \ | |
62 | ../header/wf_handler.h \ |
|
62 | ../header/wf_handler.h \ | |
63 | ../header/tc_handler.h \ |
|
63 | ../header/tc_handler.h \ | |
64 | ../header/grlib_regs.h \ |
|
64 | ../header/grlib_regs.h \ | |
65 | ../header/fsw_processing.h \ |
|
65 | ../header/fsw_processing.h \ | |
66 | ../header/fsw_params.h \ |
|
66 | ../header/fsw_params.h \ | |
67 | ../header/fsw_misc.h \ |
|
67 | ../header/fsw_misc.h \ | |
68 | ../header/fsw_init.h \ |
|
68 | ../header/fsw_init.h \ | |
69 | ../header/ccsds_types.h \ |
|
69 | ../header/ccsds_types.h \ | |
70 | ../header/fsw_params_processing.h \ |
|
70 | ../header/fsw_params_processing.h \ | |
71 | ../header/fsw_spacewire.h \ |
|
71 | ../header/fsw_spacewire.h \ | |
72 | ../header/tm_byte_positions.h \ |
|
|||
73 | ../header/tc_load_dump_parameters.h \ |
|
72 | ../header/tc_load_dump_parameters.h \ | |
74 | ../header/tm_lfr_tc_exe.h \ |
|
73 | ../header/tm_lfr_tc_exe.h \ | |
75 | ../header/tc_acceptance.h \ |
|
74 | ../header/tc_acceptance.h \ | |
76 | ../header/fsw_params_nb_bytes.h \ |
|
75 | ../header/fsw_params_nb_bytes.h \ | |
77 | ../../LFR_basic-parameters/basic_parameters.h |
|
76 | ../../LFR_basic-parameters/basic_parameters.h | |
78 |
|
77 |
@@ -1,339 +1,339 | |||||
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 3.0.0, 2014-03-0 |
|
3 | <!-- Written by QtCreator 3.0.0, 2014-03-04T07:03:18. --> | |
4 | <qtcreator> |
|
4 | <qtcreator> | |
5 | <data> |
|
5 | <data> | |
6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
|
6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> | |
7 | <value type="int">1</value> |
|
7 | <value type="int">1</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="QByteArray" key="CurrentPreferences">CppGlobal</value> |
|
18 | <value type="QByteArray" 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="QByteArray" key="CurrentPreferences">QmlJSGlobal</value> |
|
24 | <value type="QByteArray" 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">UTF-8</value> |
|
28 | <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</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</value> |
|
54 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value> | |
55 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value> |
|
55 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value> | |
56 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{e04e3924-0bd8-4708-be18-f1474e45608e}</value> |
|
56 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{e04e3924-0bd8-4708-be18-f1474e45608e}</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 | <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory"></value> |
|
61 | <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory"></value> | |
62 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|
62 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> | |
63 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
63 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> | |
64 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
64 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> | |
65 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> |
|
65 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> | |
66 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
66 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
67 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> |
|
67 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> | |
68 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> |
|
68 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> | |
69 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value> |
|
69 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value> | |
70 | <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> |
|
70 | <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> | |
71 | <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> |
|
71 | <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> | |
72 | </valuemap> |
|
72 | </valuemap> | |
73 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> |
|
73 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> | |
74 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
74 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> | |
75 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
75 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> | |
76 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
76 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
77 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
77 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> | |
78 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
78 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> | |
79 | <value type="QString">-w</value> |
|
79 | <value type="QString">-w</value> | |
80 | <value type="QString">-r</value> |
|
80 | <value type="QString">-r</value> | |
81 | </valuelist> |
|
81 | </valuelist> | |
82 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> |
|
82 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> | |
83 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> |
|
83 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> | |
84 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
84 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> | |
85 | </valuemap> |
|
85 | </valuemap> | |
86 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> |
|
86 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> | |
87 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> |
|
87 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> | |
88 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
88 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
89 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> |
|
89 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> | |
90 | </valuemap> |
|
90 | </valuemap> | |
91 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> |
|
91 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> | |
92 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
92 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> | |
93 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
93 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> | |
94 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
94 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> | |
95 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
95 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
96 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
96 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> | |
97 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
97 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> | |
98 | <value type="QString">-w</value> |
|
98 | <value type="QString">-w</value> | |
99 | <value type="QString">-r</value> |
|
99 | <value type="QString">-r</value> | |
100 | </valuelist> |
|
100 | </valuelist> | |
101 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> |
|
101 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> | |
102 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> |
|
102 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> | |
103 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
103 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> | |
104 | </valuemap> |
|
104 | </valuemap> | |
105 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> |
|
105 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> | |
106 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> |
|
106 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> | |
107 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
107 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
108 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> |
|
108 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> | |
109 | </valuemap> |
|
109 | </valuemap> | |
110 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> |
|
110 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> | |
111 | <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> |
|
111 | <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> | |
112 | <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> |
|
112 | <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> | |
113 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value> |
|
113 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value> | |
114 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
114 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
115 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> |
|
115 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> | |
116 | <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> |
|
116 | <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> | |
117 | <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> |
|
117 | <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> | |
118 | </valuemap> |
|
118 | </valuemap> | |
119 | <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value> |
|
119 | <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value> | |
120 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0"> |
|
120 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0"> | |
121 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|
121 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> | |
122 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value> |
|
122 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value> | |
123 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value> |
|
123 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</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">ProjectExplorer.BuildSteps.Deploy</value> |
|
125 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value> | |
126 | </valuemap> |
|
126 | </valuemap> | |
127 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value> |
|
127 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value> | |
128 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value> |
|
128 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value> | |
129 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
129 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
130 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value> |
|
130 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value> | |
131 | </valuemap> |
|
131 | </valuemap> | |
132 | <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> |
|
132 | <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> | |
133 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/> |
|
133 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/> | |
134 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> |
|
134 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> | |
135 | <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> |
|
135 | <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> | |
136 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> |
|
136 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> | |
137 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> |
|
137 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> | |
138 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> |
|
138 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> | |
139 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> |
|
139 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> | |
140 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> |
|
140 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> | |
141 | <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> |
|
141 | <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> | |
142 | <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> |
|
142 | <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> | |
143 | <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> |
|
143 | <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> | |
144 | <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value> |
|
144 | <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value> | |
145 | <value type="int" key="Analyzer.Valgrind.NumCallers">25</value> |
|
145 | <value type="int" key="Analyzer.Valgrind.NumCallers">25</value> | |
146 | <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> |
|
146 | <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> | |
147 | <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value> |
|
147 | <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value> | |
148 | <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value> |
|
148 | <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value> | |
149 | <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value> |
|
149 | <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value> | |
150 | <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> |
|
150 | <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> | |
151 | <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> |
|
151 | <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> | |
152 | <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> |
|
152 | <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> | |
153 | <value type="int">0</value> |
|
153 | <value type="int">0</value> | |
154 | <value type="int">1</value> |
|
154 | <value type="int">1</value> | |
155 | <value type="int">2</value> |
|
155 | <value type="int">2</value> | |
156 | <value type="int">3</value> |
|
156 | <value type="int">3</value> | |
157 | <value type="int">4</value> |
|
157 | <value type="int">4</value> | |
158 | <value type="int">5</value> |
|
158 | <value type="int">5</value> | |
159 | <value type="int">6</value> |
|
159 | <value type="int">6</value> | |
160 | <value type="int">7</value> |
|
160 | <value type="int">7</value> | |
161 | <value type="int">8</value> |
|
161 | <value type="int">8</value> | |
162 | <value type="int">9</value> |
|
162 | <value type="int">9</value> | |
163 | <value type="int">10</value> |
|
163 | <value type="int">10</value> | |
164 | <value type="int">11</value> |
|
164 | <value type="int">11</value> | |
165 | <value type="int">12</value> |
|
165 | <value type="int">12</value> | |
166 | <value type="int">13</value> |
|
166 | <value type="int">13</value> | |
167 | <value type="int">14</value> |
|
167 | <value type="int">14</value> | |
168 | </valuelist> |
|
168 | </valuelist> | |
169 | <value type="int" key="PE.EnvironmentAspect.Base">2</value> |
|
169 | <value type="int" key="PE.EnvironmentAspect.Base">2</value> | |
170 | <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> |
|
170 | <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> | |
171 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value> |
|
171 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</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.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value> |
|
173 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value> | |
174 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value> |
|
174 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value> | |
175 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value> |
|
175 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value> | |
176 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value> |
|
176 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value> | |
177 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value> |
|
177 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value> | |
178 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value> |
|
178 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value> | |
179 | <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> |
|
179 | <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> | |
180 | <value type="bool" key="RunConfiguration.UseCppDebugger">false</value> |
|
180 | <value type="bool" key="RunConfiguration.UseCppDebugger">false</value> | |
181 | <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value> |
|
181 | <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value> | |
182 | <value type="bool" key="RunConfiguration.UseMultiProcess">false</value> |
|
182 | <value type="bool" key="RunConfiguration.UseMultiProcess">false</value> | |
183 | <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> |
|
183 | <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> | |
184 | <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> |
|
184 | <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> | |
185 | </valuemap> |
|
185 | </valuemap> | |
186 | <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value> |
|
186 | <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value> | |
187 | </valuemap> |
|
187 | </valuemap> | |
188 | </data> |
|
188 | </data> | |
189 | <data> |
|
189 | <data> | |
190 | <variable>ProjectExplorer.Project.Target.1</variable> |
|
190 | <variable>ProjectExplorer.Project.Target.1</variable> | |
191 | <valuemap type="QVariantMap"> |
|
191 | <valuemap type="QVariantMap"> | |
192 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.2 in PATH (System)</value> |
|
192 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.2 in PATH (System)</value> | |
193 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.2 in PATH (System)</value> |
|
193 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.2 in PATH (System)</value> | |
194 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{5289e843-9ef2-45ce-88c6-ad27d8e08def}</value> |
|
194 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{5289e843-9ef2-45ce-88c6-ad27d8e08def}</value> | |
195 | <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value> |
|
195 | <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value> | |
196 | <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> |
|
196 | <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> | |
197 | <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> |
|
197 | <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> | |
198 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> |
|
198 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> | |
199 | <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory"></value> |
|
199 | <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory"></value> | |
200 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|
200 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> | |
201 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
201 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> | |
202 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
202 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> | |
203 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> |
|
203 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> | |
204 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
204 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
205 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> |
|
205 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> | |
206 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> |
|
206 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> | |
207 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value> |
|
207 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value> | |
208 | <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> |
|
208 | <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> | |
209 | <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> |
|
209 | <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> | |
210 | </valuemap> |
|
210 | </valuemap> | |
211 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> |
|
211 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> | |
212 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
212 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> | |
213 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
213 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> | |
214 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
214 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
215 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
215 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> | |
216 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
216 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> | |
217 | <value type="QString">-w</value> |
|
217 | <value type="QString">-w</value> | |
218 | <value type="QString">-r</value> |
|
218 | <value type="QString">-r</value> | |
219 | </valuelist> |
|
219 | </valuelist> | |
220 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> |
|
220 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> | |
221 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> |
|
221 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> | |
222 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
222 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> | |
223 | </valuemap> |
|
223 | </valuemap> | |
224 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> |
|
224 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> | |
225 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> |
|
225 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> | |
226 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
226 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
227 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> |
|
227 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> | |
228 | </valuemap> |
|
228 | </valuemap> | |
229 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> |
|
229 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> | |
230 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
230 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> | |
231 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
231 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> | |
232 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
232 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> | |
233 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
233 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
234 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
234 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> | |
235 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
235 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> | |
236 | <value type="QString">-w</value> |
|
236 | <value type="QString">-w</value> | |
237 | <value type="QString">-r</value> |
|
237 | <value type="QString">-r</value> | |
238 | </valuelist> |
|
238 | </valuelist> | |
239 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> |
|
239 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> | |
240 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> |
|
240 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> | |
241 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
241 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> | |
242 | </valuemap> |
|
242 | </valuemap> | |
243 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> |
|
243 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> | |
244 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> |
|
244 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> | |
245 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
245 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
246 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> |
|
246 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> | |
247 | </valuemap> |
|
247 | </valuemap> | |
248 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> |
|
248 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> | |
249 | <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> |
|
249 | <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> | |
250 | <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> |
|
250 | <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> | |
251 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value> |
|
251 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value> | |
252 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
252 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
253 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> |
|
253 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> | |
254 | <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> |
|
254 | <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> | |
255 | <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> |
|
255 | <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> | |
256 | </valuemap> |
|
256 | </valuemap> | |
257 | <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value> |
|
257 | <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value> | |
258 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0"> |
|
258 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0"> | |
259 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|
259 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> | |
260 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value> |
|
260 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value> | |
261 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value> |
|
261 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value> | |
262 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
262 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
263 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value> |
|
263 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value> | |
264 | </valuemap> |
|
264 | </valuemap> | |
265 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value> |
|
265 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value> | |
266 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value> |
|
266 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value> | |
267 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
267 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
268 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value> |
|
268 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value> | |
269 | </valuemap> |
|
269 | </valuemap> | |
270 | <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> |
|
270 | <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> | |
271 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/> |
|
271 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/> | |
272 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> |
|
272 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> | |
273 | <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> |
|
273 | <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> | |
274 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> |
|
274 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> | |
275 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> |
|
275 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> | |
276 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> |
|
276 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> | |
277 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> |
|
277 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> | |
278 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> |
|
278 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> | |
279 | <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> |
|
279 | <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> | |
280 | <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> |
|
280 | <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> | |
281 | <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> |
|
281 | <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> | |
282 | <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value> |
|
282 | <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value> | |
283 | <value type="int" key="Analyzer.Valgrind.NumCallers">25</value> |
|
283 | <value type="int" key="Analyzer.Valgrind.NumCallers">25</value> | |
284 | <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> |
|
284 | <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> | |
285 | <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value> |
|
285 | <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value> | |
286 | <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value> |
|
286 | <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value> | |
287 | <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value> |
|
287 | <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value> | |
288 | <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> |
|
288 | <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> | |
289 | <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> |
|
289 | <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> | |
290 | <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> |
|
290 | <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> | |
291 | <value type="int">0</value> |
|
291 | <value type="int">0</value> | |
292 | <value type="int">1</value> |
|
292 | <value type="int">1</value> | |
293 | <value type="int">2</value> |
|
293 | <value type="int">2</value> | |
294 | <value type="int">3</value> |
|
294 | <value type="int">3</value> | |
295 | <value type="int">4</value> |
|
295 | <value type="int">4</value> | |
296 | <value type="int">5</value> |
|
296 | <value type="int">5</value> | |
297 | <value type="int">6</value> |
|
297 | <value type="int">6</value> | |
298 | <value type="int">7</value> |
|
298 | <value type="int">7</value> | |
299 | <value type="int">8</value> |
|
299 | <value type="int">8</value> | |
300 | <value type="int">9</value> |
|
300 | <value type="int">9</value> | |
301 | <value type="int">10</value> |
|
301 | <value type="int">10</value> | |
302 | <value type="int">11</value> |
|
302 | <value type="int">11</value> | |
303 | <value type="int">12</value> |
|
303 | <value type="int">12</value> | |
304 | <value type="int">13</value> |
|
304 | <value type="int">13</value> | |
305 | <value type="int">14</value> |
|
305 | <value type="int">14</value> | |
306 | </valuelist> |
|
306 | </valuelist> | |
307 | <value type="int" key="PE.EnvironmentAspect.Base">2</value> |
|
307 | <value type="int" key="PE.EnvironmentAspect.Base">2</value> | |
308 | <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> |
|
308 | <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> | |
309 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value> |
|
309 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value> | |
310 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
310 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
311 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value> |
|
311 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value> | |
312 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value> |
|
312 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value> | |
313 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value> |
|
313 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value> | |
314 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value> |
|
314 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value> | |
315 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value> |
|
315 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value> | |
316 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value> |
|
316 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value> | |
317 | <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> |
|
317 | <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> | |
318 | <value type="bool" key="RunConfiguration.UseCppDebugger">true</value> |
|
318 | <value type="bool" key="RunConfiguration.UseCppDebugger">true</value> | |
319 | <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value> |
|
319 | <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value> | |
320 | <value type="bool" key="RunConfiguration.UseMultiProcess">false</value> |
|
320 | <value type="bool" key="RunConfiguration.UseMultiProcess">false</value> | |
321 | <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> |
|
321 | <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> | |
322 | <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> |
|
322 | <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> | |
323 | </valuemap> |
|
323 | </valuemap> | |
324 | <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value> |
|
324 | <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value> | |
325 | </valuemap> |
|
325 | </valuemap> | |
326 | </data> |
|
326 | </data> | |
327 | <data> |
|
327 | <data> | |
328 | <variable>ProjectExplorer.Project.TargetCount</variable> |
|
328 | <variable>ProjectExplorer.Project.TargetCount</variable> | |
329 | <value type="int">2</value> |
|
329 | <value type="int">2</value> | |
330 | </data> |
|
330 | </data> | |
331 | <data> |
|
331 | <data> | |
332 | <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable> |
|
332 | <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable> | |
333 | <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value> |
|
333 | <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value> | |
334 | </data> |
|
334 | </data> | |
335 | <data> |
|
335 | <data> | |
336 | <variable>ProjectExplorer.Project.Updater.FileVersion</variable> |
|
336 | <variable>ProjectExplorer.Project.Updater.FileVersion</variable> | |
337 | <value type="int">15</value> |
|
337 | <value type="int">15</value> | |
338 | </data> |
|
338 | </data> | |
339 | </qtcreator> |
|
339 | </qtcreator> |
@@ -1,609 +1,609 | |||||
1 | #ifndef CCSDS_TYPES_H_INCLUDED |
|
1 | #ifndef CCSDS_TYPES_H_INCLUDED | |
2 | #define CCSDS_TYPES_H_INCLUDED |
|
2 | #define CCSDS_TYPES_H_INCLUDED | |
3 |
|
3 | |||
4 | #include "fsw_params_processing.h" |
|
4 | #include "fsw_params_processing.h" | |
5 |
|
5 | |||
6 | #define CCSDS_PROTOCOLE_EXTRA_BYTES 4 |
|
6 | #define CCSDS_PROTOCOLE_EXTRA_BYTES 4 | |
7 | #define CCSDS_TELEMETRY_HEADER_LENGTH 16+4 |
|
7 | #define CCSDS_TELEMETRY_HEADER_LENGTH 16+4 | |
8 | #define CCSDS_TM_PKT_MAX_SIZE 4412 |
|
8 | #define CCSDS_TM_PKT_MAX_SIZE 4412 | |
9 | #define CCSDS_TELECOMMAND_HEADER_LENGTH 10+4 |
|
9 | #define CCSDS_TELECOMMAND_HEADER_LENGTH 10+4 | |
10 | #define CCSDS_TC_PKT_MAX_SIZE 256 |
|
10 | #define CCSDS_TC_PKT_MAX_SIZE 256 | |
11 | #define CCSDS_TC_PKT_MIN_SIZE 16 |
|
11 | #define CCSDS_TC_PKT_MIN_SIZE 16 | |
12 | #define CCSDS_TC_TM_PACKET_OFFSET 7 |
|
12 | #define CCSDS_TC_TM_PACKET_OFFSET 7 | |
13 | #define CCSDS_PROCESS_ID 76 |
|
13 | #define CCSDS_PROCESS_ID 76 | |
14 | #define CCSDS_PACKET_CATEGORY 12 |
|
14 | #define CCSDS_PACKET_CATEGORY 12 | |
15 | #define CCSDS_NODE_ADDRESS 0xfe |
|
15 | #define CCSDS_NODE_ADDRESS 0xfe | |
16 | #define CCSDS_USER_APP 0x00 |
|
16 | #define CCSDS_USER_APP 0x00 | |
17 |
|
17 | |||
18 | #define DEFAULT_SPARE1_PUSVERSION_SPARE2 0x10 |
|
18 | #define DEFAULT_SPARE1_PUSVERSION_SPARE2 0x10 | |
19 | #define DEFAULT_RESERVED 0x00 |
|
19 | #define DEFAULT_RESERVED 0x00 | |
20 | #define DEFAULT_HKBIA 0x1e // 0001 1110 |
|
20 | #define DEFAULT_HKBIA 0x1e // 0001 1110 | |
21 |
|
21 | |||
22 | // PACKET ID |
|
22 | // PACKET ID | |
23 | #define TM_PACKET_ID_TC_EXE 0x0cc1 // PID 76 CAT 1 |
|
23 | #define TM_PACKET_ID_TC_EXE 0x0cc1 // PID 76 CAT 1 | |
24 | #define TM_PACKET_ID_HK 0x0cc4 // PID 76 CAT 4 |
|
24 | #define TM_PACKET_ID_HK 0x0cc4 // PID 76 CAT 4 | |
25 | #define TM_PACKET_ID_PARAMETER_DUMP 0x0cc9 // PID 76 CAT 9 |
|
25 | #define TM_PACKET_ID_PARAMETER_DUMP 0x0cc9 // PID 76 CAT 9 | |
26 | #define TM_PACKET_ID_SCIENCE_NORMAL_BURST 0x0ccc // PID 76 CAT 12 |
|
26 | #define TM_PACKET_ID_SCIENCE_NORMAL_BURST 0x0ccc // PID 76 CAT 12 | |
27 | #define TM_PACKET_ID_SCIENCE_SBM1_SBM2 0x0cfc // PID 79 CAT 12 |
|
27 | #define TM_PACKET_ID_SCIENCE_SBM1_SBM2 0x0cfc // PID 79 CAT 12 | |
28 | #define TM_PACKET_PID_DEFAULT 76 |
|
28 | #define TM_PACKET_PID_DEFAULT 76 | |
29 | #define TM_PACKET_PID_BURST_SBM1_SBM2 79 |
|
29 | #define TM_PACKET_PID_BURST_SBM1_SBM2 79 | |
30 | #define TM_PACKET_CAT_TC_EXE 1 |
|
30 | #define TM_PACKET_CAT_TC_EXE 1 | |
31 | #define TM_PACKET_CAT_HK 4 |
|
31 | #define TM_PACKET_CAT_HK 4 | |
32 | #define TM_PACKET_CAT_PARAMETER_DUMP 9 |
|
32 | #define TM_PACKET_CAT_PARAMETER_DUMP 9 | |
33 | #define TM_PACKET_CAT_SCIENCE 12 |
|
33 | #define TM_PACKET_CAT_SCIENCE 12 | |
34 |
|
34 | |||
35 | // PACKET SEQUENCE CONTROL |
|
35 | // PACKET SEQUENCE CONTROL | |
36 | #define TM_PACKET_SEQ_CTRL_CONTINUATION 0x00 // [0000 0000] |
|
36 | #define TM_PACKET_SEQ_CTRL_CONTINUATION 0x00 // [0000 0000] | |
37 | #define TM_PACKET_SEQ_CTRL_FIRST 0x40 // [0100 0000] |
|
37 | #define TM_PACKET_SEQ_CTRL_FIRST 0x40 // [0100 0000] | |
38 | #define TM_PACKET_SEQ_CTRL_LAST 0x80 // [1000 0000] |
|
38 | #define TM_PACKET_SEQ_CTRL_LAST 0x80 // [1000 0000] | |
39 | #define TM_PACKET_SEQ_CTRL_STANDALONE 0xc0 // [1100 0000] |
|
39 | #define TM_PACKET_SEQ_CTRL_STANDALONE 0xc0 // [1100 0000] | |
40 | #define TM_PACKET_SEQ_CNT_DEFAULT 0x00 // [0000 0000] |
|
40 | #define TM_PACKET_SEQ_CNT_DEFAULT 0x00 // [0000 0000] | |
41 |
|
41 | |||
42 | // DESTINATION ID |
|
42 | // DESTINATION ID | |
43 | #define TM_DESTINATION_ID_GROUND 0 |
|
43 | #define TM_DESTINATION_ID_GROUND 0 | |
44 | #define TM_DESTINATION_ID_MISSION_TIMELINE 110 |
|
44 | #define TM_DESTINATION_ID_MISSION_TIMELINE 110 | |
45 | #define TM_DESTINATION_ID_TC_SEQUENCES 111 |
|
45 | #define TM_DESTINATION_ID_TC_SEQUENCES 111 | |
46 | #define TM_DESTINATION_ID_RECOVERY_ACTION_COMMAND 112 |
|
46 | #define TM_DESTINATION_ID_RECOVERY_ACTION_COMMAND 112 | |
47 | #define TM_DESTINATION_ID_BACKUP_MISSION_TIMELINE 113 |
|
47 | #define TM_DESTINATION_ID_BACKUP_MISSION_TIMELINE 113 | |
48 | #define TM_DESTINATION_ID_DIRECT_CMD 120 |
|
48 | #define TM_DESTINATION_ID_DIRECT_CMD 120 | |
49 | #define TM_DESTINATION_ID_SPARE_GRD_SRC1 121 |
|
49 | #define TM_DESTINATION_ID_SPARE_GRD_SRC1 121 | |
50 | #define TM_DESTINATION_ID_SPARE_GRD_SRC2 122 |
|
50 | #define TM_DESTINATION_ID_SPARE_GRD_SRC2 122 | |
51 | #define TM_DESTINATION_ID_OBCP 15 |
|
51 | #define TM_DESTINATION_ID_OBCP 15 | |
52 | #define TM_DESTINATION_ID_SYSTEM_CONTROL 14 |
|
52 | #define TM_DESTINATION_ID_SYSTEM_CONTROL 14 | |
53 | #define TM_DESTINATION_ID_AOCS 11 |
|
53 | #define TM_DESTINATION_ID_AOCS 11 | |
54 |
|
54 | |||
55 | #define CCSDS_DESTINATION_ID 0x01 |
|
55 | #define CCSDS_DESTINATION_ID 0x01 | |
56 | #define CCSDS_PROTOCOLE_ID 0x02 |
|
56 | #define CCSDS_PROTOCOLE_ID 0x02 | |
57 | #define CCSDS_RESERVED 0x00 |
|
57 | #define CCSDS_RESERVED 0x00 | |
58 | #define CCSDS_USER_APP 0x00 |
|
58 | #define CCSDS_USER_APP 0x00 | |
59 |
|
59 | |||
60 | #define SIZE_TM_LFR_TC_EXE_NOT_IMPLEMENTED 24 |
|
60 | #define SIZE_TM_LFR_TC_EXE_NOT_IMPLEMENTED 24 | |
61 | #define SIZE_TM_LFR_TC_EXE_CORRUPTED 32 |
|
61 | #define SIZE_TM_LFR_TC_EXE_CORRUPTED 32 | |
62 | #define SIZE_HK_PARAMETERS 112 |
|
62 | #define SIZE_HK_PARAMETERS 112 | |
63 |
|
63 | |||
64 | // TC TYPES |
|
64 | // TC TYPES | |
65 | #define TC_TYPE_GEN 181 |
|
65 | #define TC_TYPE_GEN 181 | |
66 | #define TC_TYPE_TIME 9 |
|
66 | #define TC_TYPE_TIME 9 | |
67 |
|
67 | |||
68 | // TC SUBTYPES |
|
68 | // TC SUBTYPES | |
69 | #define TC_SUBTYPE_RESET 1 |
|
69 | #define TC_SUBTYPE_RESET 1 | |
70 | #define TC_SUBTYPE_LOAD_COMM 11 |
|
70 | #define TC_SUBTYPE_LOAD_COMM 11 | |
71 | #define TC_SUBTYPE_LOAD_NORM 13 |
|
71 | #define TC_SUBTYPE_LOAD_NORM 13 | |
72 | #define TC_SUBTYPE_LOAD_BURST 19 |
|
72 | #define TC_SUBTYPE_LOAD_BURST 19 | |
73 | #define TC_SUBTYPE_LOAD_SBM1 25 |
|
73 | #define TC_SUBTYPE_LOAD_SBM1 25 | |
74 | #define TC_SUBTYPE_LOAD_SBM2 27 |
|
74 | #define TC_SUBTYPE_LOAD_SBM2 27 | |
75 | #define TC_SUBTYPE_DUMP 31 |
|
75 | #define TC_SUBTYPE_DUMP 31 | |
76 | #define TC_SUBTYPE_ENTER 41 |
|
76 | #define TC_SUBTYPE_ENTER 41 | |
77 | #define TC_SUBTYPE_UPDT_INFO 51 |
|
77 | #define TC_SUBTYPE_UPDT_INFO 51 | |
78 | #define TC_SUBTYPE_EN_CAL 61 |
|
78 | #define TC_SUBTYPE_EN_CAL 61 | |
79 | #define TC_SUBTYPE_DIS_CAL 63 |
|
79 | #define TC_SUBTYPE_DIS_CAL 63 | |
80 | #define TC_SUBTYPE_UPDT_TIME 129 |
|
80 | #define TC_SUBTYPE_UPDT_TIME 129 | |
81 |
|
81 | |||
82 | // TC LEN |
|
82 | // TC LEN | |
83 | #define TC_LEN_RESET 12 |
|
83 | #define TC_LEN_RESET 12 | |
84 | #define TC_LEN_LOAD_COMM 14 |
|
84 | #define TC_LEN_LOAD_COMM 14 | |
85 | #define TC_LEN_LOAD_NORM 22 |
|
85 | #define TC_LEN_LOAD_NORM 22 | |
86 | #define TC_LEN_LOAD_BURST 14 |
|
86 | #define TC_LEN_LOAD_BURST 14 | |
87 | #define TC_LEN_LOAD_SBM1 14 |
|
87 | #define TC_LEN_LOAD_SBM1 14 | |
88 | #define TC_LEN_LOAD_SBM2 14 |
|
88 | #define TC_LEN_LOAD_SBM2 14 | |
89 | #define TC_LEN_DUMP 12 |
|
89 | #define TC_LEN_DUMP 12 | |
90 | #define TC_LEN_ENTER 20 |
|
90 | #define TC_LEN_ENTER 20 | |
91 | #define TC_LEN_UPDT_INFO 46 |
|
91 | #define TC_LEN_UPDT_INFO 46 | |
92 | #define TC_LEN_EN_CAL 12 |
|
92 | #define TC_LEN_EN_CAL 12 | |
93 | #define TC_LEN_DIS_CAL 12 |
|
93 | #define TC_LEN_DIS_CAL 12 | |
94 | #define TC_LEN_UPDT_TIME 18 |
|
94 | #define TC_LEN_UPDT_TIME 18 | |
95 |
|
95 | |||
96 | // TM TYPES |
|
96 | // TM TYPES | |
97 | #define TM_TYPE_TC_EXE 1 |
|
97 | #define TM_TYPE_TC_EXE 1 | |
98 | #define TM_TYPE_HK 3 |
|
98 | #define TM_TYPE_HK 3 | |
99 | #define TM_TYPE_PARAMETER_DUMP 3 |
|
99 | #define TM_TYPE_PARAMETER_DUMP 3 | |
100 | #define TM_TYPE_LFR_SCIENCE 21 |
|
100 | #define TM_TYPE_LFR_SCIENCE 21 | |
101 |
|
101 | |||
102 | // TM SUBTYPES |
|
102 | // TM SUBTYPES | |
103 | #define TM_SUBTYPE_EXE_OK 7 |
|
103 | #define TM_SUBTYPE_EXE_OK 7 | |
104 | #define TM_SUBTYPE_EXE_NOK 8 |
|
104 | #define TM_SUBTYPE_EXE_NOK 8 | |
105 | #define TM_SUBTYPE_HK 25 |
|
105 | #define TM_SUBTYPE_HK 25 | |
106 | #define TM_SUBTYPE_PARAMETER_DUMP 25 |
|
106 | #define TM_SUBTYPE_PARAMETER_DUMP 25 | |
107 | #define TM_SUBTYPE_SCIENCE 3 |
|
107 | #define TM_SUBTYPE_SCIENCE 3 | |
108 | #define TM_SUBTYPE_LFR_SCIENCE 3 |
|
108 | #define TM_SUBTYPE_LFR_SCIENCE 3 | |
109 |
|
109 | |||
110 | // FAILURE CODES |
|
110 | // FAILURE CODES | |
111 | #define ILLEGAL_APID 0 |
|
111 | #define ILLEGAL_APID 0 | |
112 | #define WRONG_LEN_PKT 1 |
|
112 | #define WRONG_LEN_PKT 1 | |
113 | #define INCOR_CHECKSUM 2 |
|
113 | #define INCOR_CHECKSUM 2 | |
114 | #define ILL_TYPE 3 |
|
114 | #define ILL_TYPE 3 | |
115 | #define ILL_SUBTYPE 4 |
|
115 | #define ILL_SUBTYPE 4 | |
116 | #define WRONG_APP_DATA 5 // 0x00 0x05 |
|
116 | #define WRONG_APP_DATA 5 // 0x00 0x05 | |
117 | #define TC_NOT_EXE 42000 // 0xa4 0x10 |
|
117 | #define TC_NOT_EXE 42000 // 0xa4 0x10 | |
118 | #define WRONG_SRC_ID 42001 // 0xa4 0x11 |
|
118 | #define WRONG_SRC_ID 42001 // 0xa4 0x11 | |
119 | #define FUNCT_NOT_IMPL 42002 // 0xa4 0x12 |
|
119 | #define FUNCT_NOT_IMPL 42002 // 0xa4 0x12 | |
120 | #define FAIL_DETECTED 42003 // 0xa4 0x13 |
|
120 | #define FAIL_DETECTED 42003 // 0xa4 0x13 | |
121 | #define NOT_ALLOWED 42004 // 0xa4 0x14 |
|
121 | #define NOT_ALLOWED 42004 // 0xa4 0x14 | |
122 | #define CORRUPTED 42005 // 0xa4 0x15 |
|
122 | #define CORRUPTED 42005 // 0xa4 0x15 | |
123 | #define CCSDS_TM_VALID 7 |
|
123 | #define CCSDS_TM_VALID 7 | |
124 |
|
124 | |||
125 | // TC SID |
|
125 | // TC SID | |
126 | #define SID_TC_GROUND 0 |
|
126 | #define SID_TC_GROUND 0 | |
127 | #define SID_TC_MISSION_TIMELINE 110 |
|
127 | #define SID_TC_MISSION_TIMELINE 110 | |
128 | #define SID_TC_TC_SEQUENCES 111 |
|
128 | #define SID_TC_TC_SEQUENCES 111 | |
129 | #define SID_TC_RECOVERY_ACTION_CMD 112 |
|
129 | #define SID_TC_RECOVERY_ACTION_CMD 112 | |
130 | #define SID_TC_BACKUP_MISSION_TIMELINE 113 |
|
130 | #define SID_TC_BACKUP_MISSION_TIMELINE 113 | |
131 | #define SID_TC_DIRECT_CMD 120 |
|
131 | #define SID_TC_DIRECT_CMD 120 | |
132 | #define SID_TC_SPARE_GRD_SRC1 121 |
|
132 | #define SID_TC_SPARE_GRD_SRC1 121 | |
133 | #define SID_TC_SPARE_GRD_SRC2 122 |
|
133 | #define SID_TC_SPARE_GRD_SRC2 122 | |
134 | #define SID_TC_OBCP 15 |
|
134 | #define SID_TC_OBCP 15 | |
135 | #define SID_TC_SYSTEM_CONTROL 14 |
|
135 | #define SID_TC_SYSTEM_CONTROL 14 | |
136 | #define SID_TC_AOCS 11 |
|
136 | #define SID_TC_AOCS 11 | |
137 | #define SID_TC_RPW_INTERNAL 254 |
|
137 | #define SID_TC_RPW_INTERNAL 254 | |
138 |
|
138 | |||
139 | enum apid_destid{ |
|
139 | enum apid_destid{ | |
140 | GROUND, |
|
140 | GROUND, | |
141 | MISSION_TIMELINE, |
|
141 | MISSION_TIMELINE, | |
142 | TC_SEQUENCES, |
|
142 | TC_SEQUENCES, | |
143 | RECOVERY_ACTION_CMD, |
|
143 | RECOVERY_ACTION_CMD, | |
144 | BACKUP_MISSION_TIMELINE, |
|
144 | BACKUP_MISSION_TIMELINE, | |
145 | DIRECT_CMD, |
|
145 | DIRECT_CMD, | |
146 | SPARE_GRD_SRC1, |
|
146 | SPARE_GRD_SRC1, | |
147 | SPARE_GRD_SRC2, |
|
147 | SPARE_GRD_SRC2, | |
148 | OBCP, |
|
148 | OBCP, | |
149 | SYSTEM_CONTROL, |
|
149 | SYSTEM_CONTROL, | |
150 | AOCS, |
|
150 | AOCS, | |
151 | RPW_INTERNAL |
|
151 | RPW_INTERNAL | |
152 | }; |
|
152 | }; | |
153 | // SEQUENCE COUNTERS |
|
153 | // SEQUENCE COUNTERS | |
154 | #define SEQ_CNT_MAX 16383 |
|
154 | #define SEQ_CNT_MAX 16383 | |
155 | #define SEQ_CNT_NB_DEST_ID 12 |
|
155 | #define SEQ_CNT_NB_DEST_ID 12 | |
156 |
|
156 | |||
157 | // TM SID |
|
157 | // TM SID | |
158 | #define SID_HK 1 |
|
158 | #define SID_HK 1 | |
159 | #define SID_PARAMETER_DUMP 10 |
|
159 | #define SID_PARAMETER_DUMP 10 | |
160 |
|
160 | |||
161 | #define SID_NORM_SWF_F0 3 |
|
161 | #define SID_NORM_SWF_F0 3 | |
162 | #define SID_NORM_SWF_F1 4 |
|
162 | #define SID_NORM_SWF_F1 4 | |
163 | #define SID_NORM_SWF_F2 5 |
|
163 | #define SID_NORM_SWF_F2 5 | |
164 | #define SID_NORM_CWF_F3 1 |
|
164 | #define SID_NORM_CWF_F3 1 | |
165 | #define SID_BURST_CWF_F2 2 |
|
165 | #define SID_BURST_CWF_F2 2 | |
166 | #define SID_SBM1_CWF_F1 24 |
|
166 | #define SID_SBM1_CWF_F1 24 | |
167 | #define SID_SBM2_CWF_F2 25 |
|
167 | #define SID_SBM2_CWF_F2 25 | |
168 | #define SID_NORM_ASM_F0 11 |
|
168 | #define SID_NORM_ASM_F0 11 | |
169 | #define SID_NORM_ASM_F1 12 |
|
169 | #define SID_NORM_ASM_F1 12 | |
170 | #define SID_NORM_ASM_F2 13 |
|
170 | #define SID_NORM_ASM_F2 13 | |
171 | #define SID_NORM_BP1_F0 14 |
|
171 | #define SID_NORM_BP1_F0 14 | |
172 | #define SID_NORM_BP1_F1 15 |
|
172 | #define SID_NORM_BP1_F1 15 | |
173 | #define SID_NORM_BP1_F2 16 |
|
173 | #define SID_NORM_BP1_F2 16 | |
174 | #define SID_NORM_BP2_F0 19 |
|
174 | #define SID_NORM_BP2_F0 19 | |
175 | #define SID_NORM_BP2_F1 20 |
|
175 | #define SID_NORM_BP2_F1 20 | |
176 | #define SID_NORM_BP2_F2 21 |
|
176 | #define SID_NORM_BP2_F2 21 | |
177 | #define SID_BURST_BP1_F0 17 |
|
177 | #define SID_BURST_BP1_F0 17 | |
178 | #define SID_BURST_BP2_F0 22 |
|
178 | #define SID_BURST_BP2_F0 22 | |
179 | #define SID_BURST_BP1_F1 18 |
|
179 | #define SID_BURST_BP1_F1 18 | |
180 | #define SID_BURST_BP2_F1 23 |
|
180 | #define SID_BURST_BP2_F1 23 | |
181 | #define SID_SBM1_BP1_F0 28 |
|
181 | #define SID_SBM1_BP1_F0 28 | |
182 | #define SID_SBM1_BP2_F0 31 |
|
182 | #define SID_SBM1_BP2_F0 31 | |
183 | #define SID_SBM2_BP1_F0 29 |
|
183 | #define SID_SBM2_BP1_F0 29 | |
184 | #define SID_SBM2_BP2_F0 32 |
|
184 | #define SID_SBM2_BP2_F0 32 | |
185 | #define SID_SBM2_BP1_F1 30 |
|
185 | #define SID_SBM2_BP1_F1 30 | |
186 | #define SID_SBM2_BP2_F1 33 |
|
186 | #define SID_SBM2_BP2_F1 33 | |
187 | #define SID_NORM_CWF_LONG_F3 34 |
|
187 | #define SID_NORM_CWF_LONG_F3 34 | |
188 |
|
188 | |||
189 | // LENGTH (BYTES) |
|
189 | // LENGTH (BYTES) | |
190 | #define LENGTH_TM_LFR_TC_EXE_MAX 32 |
|
190 | #define LENGTH_TM_LFR_TC_EXE_MAX 32 | |
191 | #define LENGTH_TM_LFR_HK 126 |
|
191 | #define LENGTH_TM_LFR_HK 126 | |
192 |
|
192 | |||
193 | // HEADER_LENGTH |
|
193 | // HEADER_LENGTH | |
194 | #define TM_HEADER_LEN 16 |
|
194 | #define TM_HEADER_LEN 16 | |
195 | #define HEADER_LENGTH_TM_LFR_SCIENCE_ASM 28 |
|
195 | #define HEADER_LENGTH_TM_LFR_SCIENCE_ASM 28 | |
196 | // PACKET_LENGTH |
|
196 | // PACKET_LENGTH | |
197 | #define PACKET_LENGTH_TC_EXE_SUCCESS (20 - CCSDS_TC_TM_PACKET_OFFSET) |
|
197 | #define PACKET_LENGTH_TC_EXE_SUCCESS (20 - CCSDS_TC_TM_PACKET_OFFSET) | |
198 | #define PACKET_LENGTH_TC_EXE_INCONSISTENT (26 - CCSDS_TC_TM_PACKET_OFFSET) |
|
198 | #define PACKET_LENGTH_TC_EXE_INCONSISTENT (26 - CCSDS_TC_TM_PACKET_OFFSET) | |
199 | #define PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE (26 - CCSDS_TC_TM_PACKET_OFFSET) |
|
199 | #define PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE (26 - CCSDS_TC_TM_PACKET_OFFSET) | |
200 | #define PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED (24 - CCSDS_TC_TM_PACKET_OFFSET) |
|
200 | #define PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED (24 - CCSDS_TC_TM_PACKET_OFFSET) | |
201 | #define PACKET_LENGTH_TC_EXE_ERROR (24 - CCSDS_TC_TM_PACKET_OFFSET) |
|
201 | #define PACKET_LENGTH_TC_EXE_ERROR (24 - CCSDS_TC_TM_PACKET_OFFSET) | |
202 | #define PACKET_LENGTH_TC_EXE_CORRUPTED (32 - CCSDS_TC_TM_PACKET_OFFSET) |
|
202 | #define PACKET_LENGTH_TC_EXE_CORRUPTED (32 - CCSDS_TC_TM_PACKET_OFFSET) | |
203 | #define PACKET_LENGTH_HK (124 - CCSDS_TC_TM_PACKET_OFFSET) |
|
203 | #define PACKET_LENGTH_HK (124 - CCSDS_TC_TM_PACKET_OFFSET) | |
204 | #define PACKET_LENGTH_PARAMETER_DUMP (36 - CCSDS_TC_TM_PACKET_OFFSET) |
|
204 | #define PACKET_LENGTH_PARAMETER_DUMP (36 - CCSDS_TC_TM_PACKET_OFFSET) | |
205 | #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0 2221 // 44 * 25 * 2 + 28 - 7 |
|
205 | #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0 2221 // 44 * 25 * 2 + 28 - 7 | |
206 | #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F1 2621 // 52 * 25 * 2 + 28 - 7 |
|
206 | #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F1 2621 // 52 * 25 * 2 + 28 - 7 | |
207 | #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F2 2421 // 48 * 25 * 2 + 28 - 7 |
|
207 | #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F2 2421 // 48 * 25 * 2 + 28 - 7 | |
208 |
|
208 | |||
209 | #define SPARE1_PUSVERSION_SPARE2 0x10 |
|
209 | #define SPARE1_PUSVERSION_SPARE2 0x10 | |
210 |
|
210 | |||
211 | // R1 |
|
211 | // R1 | |
212 | #define TM_LEN_SCI_SWF_340 4101 // 340 * 12 + 10 + 12 - 1 |
|
212 | #define TM_LEN_SCI_SWF_340 4101 // 340 * 12 + 10 + 12 - 1 | |
213 | #define TM_LEN_SCI_SWF_8 117 // 8 * 12 + 10 + 12 - 1 |
|
213 | #define TM_LEN_SCI_SWF_8 117 // 8 * 12 + 10 + 12 - 1 | |
214 | #define TM_LEN_SCI_CWF_340 4099 // 340 * 12 + 10 + 10 - 1 |
|
214 | #define TM_LEN_SCI_CWF_340 4099 // 340 * 12 + 10 + 10 - 1 | |
215 | #define TM_LEN_SCI_CWF_8 115 // 8 * 12 + 10 + 10 - 1 |
|
215 | #define TM_LEN_SCI_CWF_8 115 // 8 * 12 + 10 + 10 - 1 | |
216 | #define TM_LEN_SCI_CWF3_LIGHT_340 2059 // 340 * 6 + 10 + 10 - 1 |
|
216 | #define TM_LEN_SCI_CWF3_LIGHT_340 2059 // 340 * 6 + 10 + 10 - 1 | |
217 | #define TM_LEN_SCI_CWF3_LIGHT_8 67 // 8 * 6 + 10 + 10 - 1 |
|
217 | #define TM_LEN_SCI_CWF3_LIGHT_8 67 // 8 * 6 + 10 + 10 - 1 | |
218 | // R2 |
|
218 | // R2 | |
219 | #define TM_LEN_SCI_SWF_304 3669 // 304 * 12 + 10 + 12 - 1 |
|
219 | #define TM_LEN_SCI_SWF_304 3669 // 304 * 12 + 10 + 12 - 1 | |
220 | #define TM_LEN_SCI_SWF_224 2709 // 224 * 12 + 10 + 12 - 1 |
|
220 | #define TM_LEN_SCI_SWF_224 2709 // 224 * 12 + 10 + 12 - 1 | |
221 | #define TM_LEN_SCI_CWF_336 4051 // 336 * 12 + 10 + 10 - 1 |
|
221 | #define TM_LEN_SCI_CWF_336 4051 // 336 * 12 + 10 + 10 - 1 | |
222 | #define TM_LEN_SCI_CWF_672 4051 // 672 * 6 + 10 + 10 - 1 |
|
222 | #define TM_LEN_SCI_CWF_672 4051 // 672 * 6 + 10 + 10 - 1 | |
223 | // |
|
223 | // | |
224 | #define DEFAULT_PKTCNT 0x07 |
|
224 | #define DEFAULT_PKTCNT 0x07 | |
225 | #define BLK_NR_304 0x0130 |
|
225 | #define BLK_NR_304 0x0130 | |
226 | #define BLK_NR_224 0x00e0 |
|
226 | #define BLK_NR_224 0x00e0 | |
227 | #define BLK_NR_CWF 0x0150 // 336 |
|
227 | #define BLK_NR_CWF 0x0150 // 336 | |
228 | #define BLK_NR_CWF_SHORT_F3 0x02a0 // 672 |
|
228 | #define BLK_NR_CWF_SHORT_F3 0x02a0 // 672 | |
229 |
|
229 | |||
230 | enum TM_TYPE{ |
|
230 | enum TM_TYPE{ | |
231 | TM_LFR_TC_EXE_OK, |
|
231 | TM_LFR_TC_EXE_OK, | |
232 | TM_LFR_TC_EXE_ERR, |
|
232 | TM_LFR_TC_EXE_ERR, | |
233 | TM_LFR_HK, |
|
233 | TM_LFR_HK, | |
234 | TM_LFR_SCI, |
|
234 | TM_LFR_SCI, | |
235 | TM_LFR_SCI_SBM, |
|
235 | TM_LFR_SCI_SBM, | |
236 | TM_LFR_PAR_DUMP |
|
236 | TM_LFR_PAR_DUMP | |
237 | }; |
|
237 | }; | |
238 |
|
238 | |||
239 | typedef struct { |
|
239 | typedef struct { | |
240 | unsigned char targetLogicalAddress; |
|
240 | unsigned char targetLogicalAddress; | |
241 | unsigned char protocolIdentifier; |
|
241 | unsigned char protocolIdentifier; | |
242 | unsigned char reserved; |
|
242 | unsigned char reserved; | |
243 | unsigned char userApplication; |
|
243 | unsigned char userApplication; | |
244 | // PACKET HEADER |
|
244 | // PACKET HEADER | |
245 | unsigned char packetID[2]; |
|
245 | unsigned char packetID[2]; | |
246 | unsigned char packetSequenceControl[2]; |
|
246 | unsigned char packetSequenceControl[2]; | |
247 | unsigned char packetLength[2]; |
|
247 | unsigned char packetLength[2]; | |
248 | // DATA FIELD HEADER |
|
248 | // DATA FIELD HEADER | |
249 | unsigned char spare1_pusVersion_spare2; |
|
249 | unsigned char spare1_pusVersion_spare2; | |
250 | unsigned char serviceType; |
|
250 | unsigned char serviceType; | |
251 | unsigned char serviceSubType; |
|
251 | unsigned char serviceSubType; | |
252 | unsigned char destinationID; |
|
252 | unsigned char destinationID; | |
253 | unsigned char time[6]; |
|
253 | unsigned char time[6]; | |
254 | // |
|
254 | // | |
255 | unsigned char telecommand_pkt_id[2]; |
|
255 | unsigned char telecommand_pkt_id[2]; | |
256 | unsigned char pkt_seq_control[2]; |
|
256 | unsigned char pkt_seq_control[2]; | |
257 | } Packet_TM_LFR_TC_EXE_SUCCESS_t; |
|
257 | } Packet_TM_LFR_TC_EXE_SUCCESS_t; | |
258 |
|
258 | |||
259 | typedef struct { |
|
259 | typedef struct { | |
260 | unsigned char targetLogicalAddress; |
|
260 | unsigned char targetLogicalAddress; | |
261 | unsigned char protocolIdentifier; |
|
261 | unsigned char protocolIdentifier; | |
262 | unsigned char reserved; |
|
262 | unsigned char reserved; | |
263 | unsigned char userApplication; |
|
263 | unsigned char userApplication; | |
264 | // PACKET HEADER |
|
264 | // PACKET HEADER | |
265 | unsigned char packetID[2]; |
|
265 | unsigned char packetID[2]; | |
266 | unsigned char packetSequenceControl[2]; |
|
266 | unsigned char packetSequenceControl[2]; | |
267 | unsigned char packetLength[2]; |
|
267 | unsigned char packetLength[2]; | |
268 | // DATA FIELD HEADER |
|
268 | // DATA FIELD HEADER | |
269 | unsigned char spare1_pusVersion_spare2; |
|
269 | unsigned char spare1_pusVersion_spare2; | |
270 | unsigned char serviceType; |
|
270 | unsigned char serviceType; | |
271 | unsigned char serviceSubType; |
|
271 | unsigned char serviceSubType; | |
272 | unsigned char destinationID; |
|
272 | unsigned char destinationID; | |
273 | unsigned char time[6]; |
|
273 | unsigned char time[6]; | |
274 | // |
|
274 | // | |
275 | unsigned char tc_failure_code[2]; |
|
275 | unsigned char tc_failure_code[2]; | |
276 | unsigned char telecommand_pkt_id[2]; |
|
276 | unsigned char telecommand_pkt_id[2]; | |
277 | unsigned char pkt_seq_control[2]; |
|
277 | unsigned char pkt_seq_control[2]; | |
278 | unsigned char tc_service; |
|
278 | unsigned char tc_service; | |
279 | unsigned char tc_subtype; |
|
279 | unsigned char tc_subtype; | |
280 | unsigned char byte_position; |
|
280 | unsigned char byte_position; | |
281 | unsigned char rcv_value; |
|
281 | unsigned char rcv_value; | |
282 | } Packet_TM_LFR_TC_EXE_INCONSISTENT_t; |
|
282 | } Packet_TM_LFR_TC_EXE_INCONSISTENT_t; | |
283 |
|
283 | |||
284 | typedef struct { |
|
284 | typedef struct { | |
285 | unsigned char targetLogicalAddress; |
|
285 | unsigned char targetLogicalAddress; | |
286 | unsigned char protocolIdentifier; |
|
286 | unsigned char protocolIdentifier; | |
287 | unsigned char reserved; |
|
287 | unsigned char reserved; | |
288 | unsigned char userApplication; |
|
288 | unsigned char userApplication; | |
289 | // PACKET HEADER |
|
289 | // PACKET HEADER | |
290 | unsigned char packetID[2]; |
|
290 | unsigned char packetID[2]; | |
291 | unsigned char packetSequenceControl[2]; |
|
291 | unsigned char packetSequenceControl[2]; | |
292 | unsigned char packetLength[2]; |
|
292 | unsigned char packetLength[2]; | |
293 | // DATA FIELD HEADER |
|
293 | // DATA FIELD HEADER | |
294 | unsigned char spare1_pusVersion_spare2; |
|
294 | unsigned char spare1_pusVersion_spare2; | |
295 | unsigned char serviceType; |
|
295 | unsigned char serviceType; | |
296 | unsigned char serviceSubType; |
|
296 | unsigned char serviceSubType; | |
297 | unsigned char destinationID; |
|
297 | unsigned char destinationID; | |
298 | unsigned char time[6]; |
|
298 | unsigned char time[6]; | |
299 | // |
|
299 | // | |
300 | unsigned char tc_failure_code[2]; |
|
300 | unsigned char tc_failure_code[2]; | |
301 | unsigned char telecommand_pkt_id[2]; |
|
301 | unsigned char telecommand_pkt_id[2]; | |
302 | unsigned char pkt_seq_control[2]; |
|
302 | unsigned char pkt_seq_control[2]; | |
303 | unsigned char tc_service; |
|
303 | unsigned char tc_service; | |
304 | unsigned char tc_subtype; |
|
304 | unsigned char tc_subtype; | |
305 | unsigned char lfr_status_word[2]; |
|
305 | unsigned char lfr_status_word[2]; | |
306 | } Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t; |
|
306 | } Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t; | |
307 |
|
307 | |||
308 | typedef struct { |
|
308 | typedef struct { | |
309 | unsigned char targetLogicalAddress; |
|
309 | unsigned char targetLogicalAddress; | |
310 | unsigned char protocolIdentifier; |
|
310 | unsigned char protocolIdentifier; | |
311 | unsigned char reserved; |
|
311 | unsigned char reserved; | |
312 | unsigned char userApplication; |
|
312 | unsigned char userApplication; | |
313 | // PACKET HEADER |
|
313 | // PACKET HEADER | |
314 | unsigned char packetID[2]; |
|
314 | unsigned char packetID[2]; | |
315 | unsigned char packetSequenceControl[2]; |
|
315 | unsigned char packetSequenceControl[2]; | |
316 | unsigned char packetLength[2]; |
|
316 | unsigned char packetLength[2]; | |
317 | // DATA FIELD HEADER |
|
317 | // DATA FIELD HEADER | |
318 | unsigned char spare1_pusVersion_spare2; |
|
318 | unsigned char spare1_pusVersion_spare2; | |
319 | unsigned char serviceType; |
|
319 | unsigned char serviceType; | |
320 | unsigned char serviceSubType; |
|
320 | unsigned char serviceSubType; | |
321 | unsigned char destinationID; |
|
321 | unsigned char destinationID; | |
322 | unsigned char time[6]; |
|
322 | unsigned char time[6]; | |
323 | // |
|
323 | // | |
324 | unsigned char tc_failure_code[2]; |
|
324 | unsigned char tc_failure_code[2]; | |
325 | unsigned char telecommand_pkt_id[2]; |
|
325 | unsigned char telecommand_pkt_id[2]; | |
326 | unsigned char pkt_seq_control[2]; |
|
326 | unsigned char pkt_seq_control[2]; | |
327 | unsigned char tc_service; |
|
327 | unsigned char tc_service; | |
328 | unsigned char tc_subtype; |
|
328 | unsigned char tc_subtype; | |
329 | } Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t; |
|
329 | } Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t; | |
330 |
|
330 | |||
331 | typedef struct { |
|
331 | typedef struct { | |
332 | unsigned char targetLogicalAddress; |
|
332 | unsigned char targetLogicalAddress; | |
333 | unsigned char protocolIdentifier; |
|
333 | unsigned char protocolIdentifier; | |
334 | unsigned char reserved; |
|
334 | unsigned char reserved; | |
335 | unsigned char userApplication; |
|
335 | unsigned char userApplication; | |
336 | // PACKET HEADER |
|
336 | // PACKET HEADER | |
337 | unsigned char packetID[2]; |
|
337 | unsigned char packetID[2]; | |
338 | unsigned char packetSequenceControl[2]; |
|
338 | unsigned char packetSequenceControl[2]; | |
339 | unsigned char packetLength[2]; |
|
339 | unsigned char packetLength[2]; | |
340 | // DATA FIELD HEADER |
|
340 | // DATA FIELD HEADER | |
341 | unsigned char spare1_pusVersion_spare2; |
|
341 | unsigned char spare1_pusVersion_spare2; | |
342 | unsigned char serviceType; |
|
342 | unsigned char serviceType; | |
343 | unsigned char serviceSubType; |
|
343 | unsigned char serviceSubType; | |
344 | unsigned char destinationID; |
|
344 | unsigned char destinationID; | |
345 | unsigned char time[6]; |
|
345 | unsigned char time[6]; | |
346 | // |
|
346 | // | |
347 | unsigned char tc_failure_code[2]; |
|
347 | unsigned char tc_failure_code[2]; | |
348 | unsigned char telecommand_pkt_id[2]; |
|
348 | unsigned char telecommand_pkt_id[2]; | |
349 | unsigned char pkt_seq_control[2]; |
|
349 | unsigned char pkt_seq_control[2]; | |
350 | unsigned char tc_service; |
|
350 | unsigned char tc_service; | |
351 | unsigned char tc_subtype; |
|
351 | unsigned char tc_subtype; | |
352 | } Packet_TM_LFR_TC_EXE_ERROR_t; |
|
352 | } Packet_TM_LFR_TC_EXE_ERROR_t; | |
353 |
|
353 | |||
354 | typedef struct { |
|
354 | typedef struct { | |
355 | unsigned char targetLogicalAddress; |
|
355 | unsigned char targetLogicalAddress; | |
356 | unsigned char protocolIdentifier; |
|
356 | unsigned char protocolIdentifier; | |
357 | unsigned char reserved; |
|
357 | unsigned char reserved; | |
358 | unsigned char userApplication; |
|
358 | unsigned char userApplication; | |
359 | // PACKET HEADER |
|
359 | // PACKET HEADER | |
360 | unsigned char packetID[2]; |
|
360 | unsigned char packetID[2]; | |
361 | unsigned char packetSequenceControl[2]; |
|
361 | unsigned char packetSequenceControl[2]; | |
362 | unsigned char packetLength[2]; |
|
362 | unsigned char packetLength[2]; | |
363 | // DATA FIELD HEADER |
|
363 | // DATA FIELD HEADER | |
364 | unsigned char spare1_pusVersion_spare2; |
|
364 | unsigned char spare1_pusVersion_spare2; | |
365 | unsigned char serviceType; |
|
365 | unsigned char serviceType; | |
366 | unsigned char serviceSubType; |
|
366 | unsigned char serviceSubType; | |
367 | unsigned char destinationID; |
|
367 | unsigned char destinationID; | |
368 | unsigned char time[6]; |
|
368 | unsigned char time[6]; | |
369 | // |
|
369 | // | |
370 | unsigned char tc_failure_code[2]; |
|
370 | unsigned char tc_failure_code[2]; | |
371 | unsigned char telecommand_pkt_id[2]; |
|
371 | unsigned char telecommand_pkt_id[2]; | |
372 | unsigned char pkt_seq_control[2]; |
|
372 | unsigned char pkt_seq_control[2]; | |
373 | unsigned char tc_service; |
|
373 | unsigned char tc_service; | |
374 | unsigned char tc_subtype; |
|
374 | unsigned char tc_subtype; | |
375 | unsigned char pkt_len_rcv_value[2]; |
|
375 | unsigned char pkt_len_rcv_value[2]; | |
376 | unsigned char pkt_datafieldsize_cnt[2]; |
|
376 | unsigned char pkt_datafieldsize_cnt[2]; | |
377 | unsigned char rcv_crc[2]; |
|
377 | unsigned char rcv_crc[2]; | |
378 | unsigned char computed_crc[2]; |
|
378 | unsigned char computed_crc[2]; | |
379 | } Packet_TM_LFR_TC_EXE_CORRUPTED_t; |
|
379 | } Packet_TM_LFR_TC_EXE_CORRUPTED_t; | |
380 |
|
380 | |||
381 | typedef struct { |
|
381 | typedef struct { | |
382 | unsigned char targetLogicalAddress; |
|
382 | unsigned char targetLogicalAddress; | |
383 | unsigned char protocolIdentifier; |
|
383 | unsigned char protocolIdentifier; | |
384 | unsigned char reserved; |
|
384 | unsigned char reserved; | |
385 | unsigned char userApplication; |
|
385 | unsigned char userApplication; | |
386 | unsigned char packetID[2]; |
|
386 | unsigned char packetID[2]; | |
387 | unsigned char packetSequenceControl[2]; |
|
387 | unsigned char packetSequenceControl[2]; | |
388 | unsigned char packetLength[2]; |
|
388 | unsigned char packetLength[2]; | |
389 | // DATA FIELD HEADER |
|
389 | // DATA FIELD HEADER | |
390 | unsigned char spare1_pusVersion_spare2; |
|
390 | unsigned char spare1_pusVersion_spare2; | |
391 | unsigned char serviceType; |
|
391 | unsigned char serviceType; | |
392 | unsigned char serviceSubType; |
|
392 | unsigned char serviceSubType; | |
393 | unsigned char destinationID; |
|
393 | unsigned char destinationID; | |
394 | unsigned char time[6]; |
|
394 | unsigned char time[6]; | |
395 | // AUXILIARY HEADER |
|
395 | // AUXILIARY HEADER | |
396 | unsigned char sid; |
|
396 | unsigned char sid; | |
397 | unsigned char hkBIA; |
|
397 | unsigned char hkBIA; | |
398 | unsigned char pktCnt; |
|
398 | unsigned char pktCnt; | |
399 | unsigned char pktNr; |
|
399 | unsigned char pktNr; | |
400 | unsigned char acquisitionTime[6]; |
|
400 | unsigned char acquisitionTime[6]; | |
401 | unsigned char blkNr[2]; |
|
401 | unsigned char blkNr[2]; | |
402 | } Header_TM_LFR_SCIENCE_SWF_t; |
|
402 | } Header_TM_LFR_SCIENCE_SWF_t; | |
403 |
|
403 | |||
404 | typedef struct { |
|
404 | typedef struct { | |
405 | unsigned char targetLogicalAddress; |
|
405 | unsigned char targetLogicalAddress; | |
406 | unsigned char protocolIdentifier; |
|
406 | unsigned char protocolIdentifier; | |
407 | unsigned char reserved; |
|
407 | unsigned char reserved; | |
408 | unsigned char userApplication; |
|
408 | unsigned char userApplication; | |
409 | unsigned char packetID[2]; |
|
409 | unsigned char packetID[2]; | |
410 | unsigned char packetSequenceControl[2]; |
|
410 | unsigned char packetSequenceControl[2]; | |
411 | unsigned char packetLength[2]; |
|
411 | unsigned char packetLength[2]; | |
412 | // DATA FIELD HEADER |
|
412 | // DATA FIELD HEADER | |
413 | unsigned char spare1_pusVersion_spare2; |
|
413 | unsigned char spare1_pusVersion_spare2; | |
414 | unsigned char serviceType; |
|
414 | unsigned char serviceType; | |
415 | unsigned char serviceSubType; |
|
415 | unsigned char serviceSubType; | |
416 | unsigned char destinationID; |
|
416 | unsigned char destinationID; | |
417 | unsigned char time[6]; |
|
417 | unsigned char time[6]; | |
418 | // AUXILIARY DATA HEADER |
|
418 | // AUXILIARY DATA HEADER | |
419 | unsigned char sid; |
|
419 | unsigned char sid; | |
420 | unsigned char hkBIA; |
|
420 | unsigned char hkBIA; | |
421 | unsigned char acquisitionTime[6]; |
|
421 | unsigned char acquisitionTime[6]; | |
422 | unsigned char blkNr[2]; |
|
422 | unsigned char blkNr[2]; | |
423 | } Header_TM_LFR_SCIENCE_CWF_t; |
|
423 | } Header_TM_LFR_SCIENCE_CWF_t; | |
424 |
|
424 | |||
425 | typedef struct { |
|
425 | typedef struct { | |
426 | unsigned char targetLogicalAddress; |
|
426 | unsigned char targetLogicalAddress; | |
427 | unsigned char protocolIdentifier; |
|
427 | unsigned char protocolIdentifier; | |
428 | unsigned char reserved; |
|
428 | unsigned char reserved; | |
429 | unsigned char userApplication; |
|
429 | unsigned char userApplication; | |
430 | unsigned char packetID[2]; |
|
430 | unsigned char packetID[2]; | |
431 | unsigned char packetSequenceControl[2]; |
|
431 | unsigned char packetSequenceControl[2]; | |
432 | unsigned char packetLength[2]; |
|
432 | unsigned char packetLength[2]; | |
433 | // DATA FIELD HEADER |
|
433 | // DATA FIELD HEADER | |
434 | unsigned char spare1_pusVersion_spare2; |
|
434 | unsigned char spare1_pusVersion_spare2; | |
435 | unsigned char serviceType; |
|
435 | unsigned char serviceType; | |
436 | unsigned char serviceSubType; |
|
436 | unsigned char serviceSubType; | |
437 | unsigned char destinationID; |
|
437 | unsigned char destinationID; | |
438 | unsigned char time[6]; |
|
438 | unsigned char time[6]; | |
439 | // AUXILIARY HEADER |
|
439 | // AUXILIARY HEADER | |
440 | unsigned char sid; |
|
440 | unsigned char sid; | |
441 | unsigned char biaStatusInfo; |
|
441 | unsigned char biaStatusInfo; | |
442 | unsigned char pa_lfr_pkt_cnt_asm; |
|
442 | unsigned char pa_lfr_pkt_cnt_asm; | |
443 | unsigned char pa_lfr_pkt_nr_asm; |
|
443 | unsigned char pa_lfr_pkt_nr_asm; | |
444 | unsigned char acquisitionTime[6]; |
|
444 | unsigned char acquisitionTime[6]; | |
445 | unsigned char pa_lfr_asm_blk_nr[2]; |
|
445 | unsigned char pa_lfr_asm_blk_nr[2]; | |
446 | } Header_TM_LFR_SCIENCE_ASM_t; |
|
446 | } Header_TM_LFR_SCIENCE_ASM_t; | |
447 |
|
447 | |||
448 | typedef struct { |
|
448 | typedef struct { | |
449 | //targetLogicalAddress is removed by the grspw module |
|
449 | //targetLogicalAddress is removed by the grspw module | |
450 | unsigned char protocolIdentifier; |
|
450 | unsigned char protocolIdentifier; | |
451 | unsigned char reserved; |
|
451 | unsigned char reserved; | |
452 | unsigned char userApplication; |
|
452 | unsigned char userApplication; | |
453 | unsigned char packetID[2]; |
|
453 | unsigned char packetID[2]; | |
454 | unsigned char packetSequenceControl[2]; |
|
454 | unsigned char packetSequenceControl[2]; | |
455 | unsigned char packetLength[2]; |
|
455 | unsigned char packetLength[2]; | |
456 | // DATA FIELD HEADER |
|
456 | // DATA FIELD HEADER | |
457 | unsigned char headerFlag_pusVersion_Ack; |
|
457 | unsigned char headerFlag_pusVersion_Ack; | |
458 | unsigned char serviceType; |
|
458 | unsigned char serviceType; | |
459 | unsigned char serviceSubType; |
|
459 | unsigned char serviceSubType; | |
460 | unsigned char sourceID; |
|
460 | unsigned char sourceID; | |
461 | unsigned char dataAndCRC[CCSDS_TC_PKT_MAX_SIZE-10]; |
|
461 | unsigned char dataAndCRC[CCSDS_TC_PKT_MAX_SIZE-10]; | |
462 | } ccsdsTelecommandPacket_t; |
|
462 | } ccsdsTelecommandPacket_t; | |
463 |
|
463 | |||
464 | typedef struct { |
|
464 | typedef struct { | |
465 | unsigned char targetLogicalAddress; |
|
465 | unsigned char targetLogicalAddress; | |
466 | unsigned char protocolIdentifier; |
|
466 | unsigned char protocolIdentifier; | |
467 | unsigned char reserved; |
|
467 | unsigned char reserved; | |
468 | unsigned char userApplication; |
|
468 | unsigned char userApplication; | |
469 | unsigned char packetID[2]; |
|
469 | unsigned char packetID[2]; | |
470 | unsigned char packetSequenceControl[2]; |
|
470 | unsigned char packetSequenceControl[2]; | |
471 | unsigned char packetLength[2]; |
|
471 | unsigned char packetLength[2]; | |
472 | unsigned char spare1_pusVersion_spare2; |
|
472 | unsigned char spare1_pusVersion_spare2; | |
473 | unsigned char serviceType; |
|
473 | unsigned char serviceType; | |
474 | unsigned char serviceSubType; |
|
474 | unsigned char serviceSubType; | |
475 | unsigned char destinationID; |
|
475 | unsigned char destinationID; | |
476 | unsigned char time[6]; |
|
476 | unsigned char time[6]; | |
477 | unsigned char sid; |
|
477 | unsigned char sid; | |
478 |
|
478 | |||
479 | //************** |
|
479 | //************** | |
480 | // HK PARAMETERS |
|
480 | // HK PARAMETERS | |
481 | unsigned char lfr_status_word[2]; |
|
481 | unsigned char lfr_status_word[2]; | |
482 | unsigned char lfr_sw_version[4]; |
|
482 | unsigned char lfr_sw_version[4]; | |
483 | unsigned char lfr_fpga_version[3]; |
|
483 | unsigned char lfr_fpga_version[3]; | |
484 | // ressource statistics |
|
484 | // ressource statistics | |
485 | unsigned char hk_lfr_cpu_load; |
|
485 | unsigned char hk_lfr_cpu_load; | |
486 | unsigned char hk_lfr_load_max; |
|
486 | unsigned char hk_lfr_load_max; | |
487 | unsigned char hk_lfr_load_aver; |
|
487 | unsigned char hk_lfr_load_aver; | |
488 | // tc statistics |
|
488 | // tc statistics | |
489 | unsigned char hk_lfr_update_info_tc_cnt[2]; |
|
489 | unsigned char hk_lfr_update_info_tc_cnt[2]; | |
490 | unsigned char hk_lfr_update_time_tc_cnt[2]; |
|
490 | unsigned char hk_lfr_update_time_tc_cnt[2]; | |
491 | unsigned char hk_lfr_exe_tc_cnt[2]; |
|
491 | unsigned char hk_lfr_exe_tc_cnt[2]; | |
492 | unsigned char hk_lfr_rej_tc_cnt[2]; |
|
492 | unsigned char hk_lfr_rej_tc_cnt[2]; | |
493 | unsigned char hk_lfr_last_exe_tc_id[2]; |
|
493 | unsigned char hk_lfr_last_exe_tc_id[2]; | |
494 | unsigned char hk_lfr_last_exe_tc_type[2]; |
|
494 | unsigned char hk_lfr_last_exe_tc_type[2]; | |
495 | unsigned char hk_lfr_last_exe_tc_subtype[2]; |
|
495 | unsigned char hk_lfr_last_exe_tc_subtype[2]; | |
496 | unsigned char hk_lfr_last_exe_tc_time[6]; |
|
496 | unsigned char hk_lfr_last_exe_tc_time[6]; | |
497 | unsigned char hk_lfr_last_rej_tc_id[2]; |
|
497 | unsigned char hk_lfr_last_rej_tc_id[2]; | |
498 | unsigned char hk_lfr_last_rej_tc_type[2]; |
|
498 | unsigned char hk_lfr_last_rej_tc_type[2]; | |
499 | unsigned char hk_lfr_last_rej_tc_subtype[2]; |
|
499 | unsigned char hk_lfr_last_rej_tc_subtype[2]; | |
500 | unsigned char hk_lfr_last_rej_tc_time[6]; |
|
500 | unsigned char hk_lfr_last_rej_tc_time[6]; | |
501 | // anomaly statistics |
|
501 | // anomaly statistics | |
502 | unsigned char hk_lfr_le_cnt[2]; |
|
502 | unsigned char hk_lfr_le_cnt[2]; | |
503 | unsigned char hk_lfr_me_cnt[2]; |
|
503 | unsigned char hk_lfr_me_cnt[2]; | |
504 | unsigned char hk_lfr_he_cnt[2]; |
|
504 | unsigned char hk_lfr_he_cnt[2]; | |
505 | unsigned char hk_lfr_last_er_rid[2]; |
|
505 | unsigned char hk_lfr_last_er_rid[2]; | |
506 | unsigned char hk_lfr_last_er_code; |
|
506 | unsigned char hk_lfr_last_er_code; | |
507 | unsigned char hk_lfr_last_er_time[6]; |
|
507 | unsigned char hk_lfr_last_er_time[6]; | |
508 | // vhdl_blk_status |
|
508 | // vhdl_blk_status | |
509 | unsigned char hk_lfr_vhdl_aa_sm; |
|
509 | unsigned char hk_lfr_vhdl_aa_sm; | |
510 | unsigned char hk_lfr_vhdl_fft_sr; |
|
510 | unsigned char hk_lfr_vhdl_fft_sr; | |
511 | unsigned char hk_lfr_vhdl_cic_hk; |
|
511 | unsigned char hk_lfr_vhdl_cic_hk; | |
512 | unsigned char hk_lfr_vhdl_iir_cal; |
|
512 | unsigned char hk_lfr_vhdl_iir_cal; | |
513 | // spacewire_if_statistics |
|
513 | // spacewire_if_statistics | |
514 | unsigned char hk_lfr_dpu_spw_pkt_rcv_cnt[2]; |
|
514 | unsigned char hk_lfr_dpu_spw_pkt_rcv_cnt[2]; | |
515 | unsigned char hk_lfr_dpu_spw_pkt_sent_cnt[2]; |
|
515 | unsigned char hk_lfr_dpu_spw_pkt_sent_cnt[2]; | |
516 | unsigned char hk_lfr_dpu_spw_tick_out_cnt; |
|
516 | unsigned char hk_lfr_dpu_spw_tick_out_cnt; | |
517 | unsigned char hk_lfr_dpu_spw_last_timc; |
|
517 | unsigned char hk_lfr_dpu_spw_last_timc; | |
518 | // ahb error statistics |
|
518 | // ahb error statistics | |
519 | unsigned int hk_lfr_last_fail_addr; |
|
519 | unsigned int hk_lfr_last_fail_addr; | |
520 | // temperatures |
|
520 | // temperatures | |
521 | unsigned char hk_lfr_temp_scm[2]; |
|
521 | unsigned char hk_lfr_temp_scm[2]; | |
522 | unsigned char hk_lfr_temp_pcb[2]; |
|
522 | unsigned char hk_lfr_temp_pcb[2]; | |
523 | unsigned char hk_lfr_temp_fpga[2]; |
|
523 | unsigned char hk_lfr_temp_fpga[2]; | |
524 | // spacecraft potential |
|
524 | // spacecraft potential | |
525 | unsigned char hk_lfr_sc_v_f3[2]; |
|
525 | unsigned char hk_lfr_sc_v_f3[2]; | |
526 | unsigned char hk_lfr_sc_e1_f3[2]; |
|
526 | unsigned char hk_lfr_sc_e1_f3[2]; | |
527 | unsigned char hk_lfr_sc_e2_f3[2]; |
|
527 | unsigned char hk_lfr_sc_e2_f3[2]; | |
528 | // error counters |
|
528 | // error counters | |
529 | unsigned char hk_lfr_dpu_spw_parity; |
|
529 | unsigned char hk_lfr_dpu_spw_parity; | |
530 | unsigned char hk_lfr_dpu_spw_disconnect; |
|
530 | unsigned char hk_lfr_dpu_spw_disconnect; | |
531 | unsigned char hk_lfr_dpu_spw_escape; |
|
531 | unsigned char hk_lfr_dpu_spw_escape; | |
532 | unsigned char hk_lfr_dpu_spw_credit; |
|
532 | unsigned char hk_lfr_dpu_spw_credit; | |
533 | unsigned char hk_lfr_dpu_spw_write_sync; |
|
533 | unsigned char hk_lfr_dpu_spw_write_sync; | |
534 | unsigned char hk_lfr_dpu_spw_rx_ahb; |
|
534 | unsigned char hk_lfr_dpu_spw_rx_ahb; | |
535 | unsigned char hk_lfr_dpu_spw_tx_ahb; |
|
535 | unsigned char hk_lfr_dpu_spw_tx_ahb; | |
536 | unsigned char hk_lfr_dpu_spw_early_eop; |
|
536 | unsigned char hk_lfr_dpu_spw_early_eop; | |
537 | unsigned char hk_lfr_dpu_spw_invalid_addr; |
|
537 | unsigned char hk_lfr_dpu_spw_invalid_addr; | |
538 | unsigned char hk_lfr_dpu_spw_eep; |
|
538 | unsigned char hk_lfr_dpu_spw_eep; | |
539 | unsigned char hk_lfr_dpu_spw_rx_too_big; |
|
539 | unsigned char hk_lfr_dpu_spw_rx_too_big; | |
540 | // timecode |
|
540 | // timecode | |
541 | unsigned char hk_lfr_timecode_erroneous; |
|
541 | unsigned char hk_lfr_timecode_erroneous; | |
542 | unsigned char hk_lfr_timecode_missing; |
|
542 | unsigned char hk_lfr_timecode_missing; | |
543 | unsigned char hk_lfr_timecode_invalid; |
|
543 | unsigned char hk_lfr_timecode_invalid; | |
544 | // time |
|
544 | // time | |
545 | unsigned char hk_lfr_time_timecode_it; |
|
545 | unsigned char hk_lfr_time_timecode_it; | |
546 | unsigned char hk_lfr_time_not_synchro; |
|
546 | unsigned char hk_lfr_time_not_synchro; | |
547 | unsigned char hk_lfr_time_timecode_ctr; |
|
547 | unsigned char hk_lfr_time_timecode_ctr; | |
548 | // hk_lfr_buffer_dpu_ |
|
548 | // hk_lfr_buffer_dpu_ | |
549 | unsigned char hk_lfr_buffer_dpu_tc_fifo; |
|
549 | unsigned char hk_lfr_buffer_dpu_tc_fifo; | |
550 | unsigned char hk_lfr_buffer_dpu_tm_fifo; |
|
550 | unsigned char hk_lfr_buffer_dpu_tm_fifo; | |
551 | // hk_lfr_ahb_ |
|
551 | // hk_lfr_ahb_ | |
552 | unsigned char hk_lfr_ahb_correctable; |
|
552 | unsigned char hk_lfr_ahb_correctable; | |
553 | unsigned char hk_lfr_ahb_uncorrectable; |
|
553 | unsigned char hk_lfr_ahb_uncorrectable; | |
554 | // spare |
|
554 | // spare | |
555 | unsigned char parameters_spare; |
|
555 | unsigned char parameters_spare; | |
556 | } Packet_TM_LFR_HK_t; |
|
556 | } Packet_TM_LFR_HK_t; | |
557 |
|
557 | |||
558 | typedef struct { |
|
558 | typedef struct { | |
559 | unsigned char targetLogicalAddress; |
|
559 | unsigned char targetLogicalAddress; | |
560 | unsigned char protocolIdentifier; |
|
560 | unsigned char protocolIdentifier; | |
561 | unsigned char reserved; |
|
561 | unsigned char reserved; | |
562 | unsigned char userApplication; |
|
562 | unsigned char userApplication; | |
563 | unsigned char packetID[2]; |
|
563 | unsigned char packetID[2]; | |
564 | unsigned char packetSequenceControl[2]; |
|
564 | unsigned char packetSequenceControl[2]; | |
565 | unsigned char packetLength[2]; |
|
565 | unsigned char packetLength[2]; | |
566 | // DATA FIELD HEADER |
|
566 | // DATA FIELD HEADER | |
567 | unsigned char spare1_pusVersion_spare2; |
|
567 | unsigned char spare1_pusVersion_spare2; | |
568 | unsigned char serviceType; |
|
568 | unsigned char serviceType; | |
569 | unsigned char serviceSubType; |
|
569 | unsigned char serviceSubType; | |
570 | unsigned char destinationID; |
|
570 | unsigned char destinationID; | |
571 | unsigned char time[6]; |
|
571 | unsigned char time[6]; | |
572 | unsigned char sid; |
|
572 | unsigned char sid; | |
573 |
|
573 | |||
574 | //****************** |
|
574 | //****************** | |
575 | // COMMON PARAMETERS |
|
575 | // COMMON PARAMETERS | |
576 | unsigned char unused0; |
|
576 | unsigned char unused0; | |
577 | unsigned char bw_sp0_sp1_r0_r1; |
|
577 | unsigned char bw_sp0_sp1_r0_r1; | |
578 |
|
578 | |||
579 | //****************** |
|
579 | //****************** | |
580 | // NORMAL PARAMETERS |
|
580 | // NORMAL PARAMETERS | |
581 | unsigned char sy_lfr_n_swf_l[2]; |
|
581 | unsigned char sy_lfr_n_swf_l[2]; | |
582 | unsigned char sy_lfr_n_swf_p[2]; |
|
582 | unsigned char sy_lfr_n_swf_p[2]; | |
583 | unsigned char sy_lfr_n_asm_p[2]; |
|
583 | unsigned char sy_lfr_n_asm_p[2]; | |
584 | unsigned char sy_lfr_n_bp_p0; |
|
584 | unsigned char sy_lfr_n_bp_p0; | |
585 | unsigned char sy_lfr_n_bp_p1; |
|
585 | unsigned char sy_lfr_n_bp_p1; | |
586 | unsigned char sy_lfr_n_cwf_long_f3; |
|
586 | unsigned char sy_lfr_n_cwf_long_f3; | |
587 | unsigned char lfr_normal_parameters_spare; |
|
587 | unsigned char lfr_normal_parameters_spare; | |
588 |
|
588 | |||
589 | //***************** |
|
589 | //***************** | |
590 | // BURST PARAMETERS |
|
590 | // BURST PARAMETERS | |
591 | unsigned char sy_lfr_b_bp_p0; |
|
591 | unsigned char sy_lfr_b_bp_p0; | |
592 | unsigned char sy_lfr_b_bp_p1; |
|
592 | unsigned char sy_lfr_b_bp_p1; | |
593 |
|
593 | |||
594 | //**************** |
|
594 | //**************** | |
595 | // SBM1 PARAMETERS |
|
595 | // SBM1 PARAMETERS | |
596 | unsigned char sy_lfr_s1_bp_p0; |
|
596 | unsigned char sy_lfr_s1_bp_p0; | |
597 | unsigned char sy_lfr_s1_bp_p1; |
|
597 | unsigned char sy_lfr_s1_bp_p1; | |
598 |
|
598 | |||
599 | //**************** |
|
599 | //**************** | |
600 | // SBM2 PARAMETERS |
|
600 | // SBM2 PARAMETERS | |
601 | unsigned char sy_lfr_s2_bp_p0; |
|
601 | unsigned char sy_lfr_s2_bp_p0; | |
602 | unsigned char sy_lfr_s2_bp_p1; |
|
602 | unsigned char sy_lfr_s2_bp_p1; | |
603 |
|
603 | |||
604 | // SPARE |
|
604 | // SPARE | |
605 | unsigned char source_data_spare; |
|
605 | unsigned char source_data_spare; | |
606 | } Packet_TM_LFR_PARAMETER_DUMP_t; |
|
606 | } Packet_TM_LFR_PARAMETER_DUMP_t; | |
607 |
|
607 | |||
608 |
|
608 | |||
609 | #endif // CCSDS_TYPES_H_INCLUDED |
|
609 | #endif // CCSDS_TYPES_H_INCLUDED |
@@ -1,40 +1,41 | |||||
1 | #ifndef FSW_INIT_H_INCLUDED |
|
1 | #ifndef FSW_INIT_H_INCLUDED | |
2 | #define FSW_INIT_H_INCLUDED |
|
2 | #define FSW_INIT_H_INCLUDED | |
3 |
|
3 | |||
4 | #include <rtems.h> |
|
4 | #include <rtems.h> | |
5 | #include <leon.h> |
|
5 | #include <leon.h> | |
6 |
|
6 | |||
7 | #include "fsw_params.h" |
|
7 | #include "fsw_params.h" | |
8 | #include "fsw_misc.h" |
|
8 | #include "fsw_misc.h" | |
9 | #include "fsw_processing.h" |
|
9 | #include "fsw_processing.h" | |
10 | #include "tc_handler.h" |
|
10 | #include "tc_handler.h" | |
11 | #include "wf_handler.h" |
|
11 | #include "wf_handler.h" | |
12 |
|
12 | |||
13 | #include "fsw_spacewire.h" |
|
13 | #include "fsw_spacewire.h" | |
14 |
|
14 | |||
15 | extern rtems_name Task_name[20]; /* array of task names */ |
|
15 | extern rtems_name Task_name[20]; /* array of task names */ | |
16 | extern rtems_id Task_id[20]; /* array of task ids */ |
|
16 | extern rtems_id Task_id[20]; /* array of task ids */ | |
17 |
|
17 | |||
18 | // RTEMS TASKS |
|
18 | // RTEMS TASKS | |
19 | rtems_task Init( rtems_task_argument argument); |
|
19 | rtems_task Init( rtems_task_argument argument); | |
20 |
|
20 | |||
21 | // OTHER functions |
|
21 | // OTHER functions | |
22 | void create_names( void ); |
|
22 | void create_names( void ); | |
23 | int create_all_tasks( void ); |
|
23 | int create_all_tasks( void ); | |
24 | int start_all_tasks( void ); |
|
24 | int start_all_tasks( void ); | |
25 | // |
|
25 | // | |
26 | rtems_status_code create_message_queues( void ); |
|
26 | rtems_status_code create_message_queues( void ); | |
27 | rtems_status_code get_message_queue_id_send( rtems_id *queue_id ); |
|
27 | rtems_status_code get_message_queue_id_send( rtems_id *queue_id ); | |
28 | rtems_status_code get_message_queue_id_recv( rtems_id *queue_id ); |
|
28 | rtems_status_code get_message_queue_id_recv( rtems_id *queue_id ); | |
29 | // |
|
29 | // | |
30 | int start_recv_send_tasks( void ); |
|
30 | int start_recv_send_tasks( void ); | |
31 | // |
|
31 | // | |
32 | void init_local_mode_parameters( void ); |
|
32 | void init_local_mode_parameters( void ); | |
|
33 | void reset_local_time( void ); | |||
33 |
|
34 | |||
34 | extern int rtems_cpu_usage_report( void ); |
|
35 | extern int rtems_cpu_usage_report( void ); | |
35 | extern int rtems_cpu_usage_reset( void ); |
|
36 | extern int rtems_cpu_usage_reset( void ); | |
36 | extern void rtems_stack_checker_report_usage( void ); |
|
37 | extern void rtems_stack_checker_report_usage( void ); | |
37 |
|
38 | |||
38 | extern int sched_yield( void ); |
|
39 | extern int sched_yield( void ); | |
39 |
|
40 | |||
40 | #endif // FSW_INIT_H_INCLUDED |
|
41 | #endif // FSW_INIT_H_INCLUDED |
@@ -1,212 +1,225 | |||||
1 | #ifndef FSW_PARAMS_H_INCLUDED |
|
1 | #ifndef FSW_PARAMS_H_INCLUDED | |
2 | #define FSW_PARAMS_H_INCLUDED |
|
2 | #define FSW_PARAMS_H_INCLUDED | |
3 |
|
3 | |||
4 | #include "grlib_regs.h" |
|
4 | #include "grlib_regs.h" | |
5 | #include "fsw_params_processing.h" |
|
5 | #include "fsw_params_processing.h" | |
|
6 | #include "fsw_params_nb_bytes.h" | |||
6 | #include "tm_byte_positions.h" |
|
7 | #include "tm_byte_positions.h" | |
7 | #include "ccsds_types.h" |
|
8 | #include "ccsds_types.h" | |
8 |
|
9 | |||
9 | #define GRSPW_DEVICE_NAME "/dev/grspw0" |
|
10 | #define GRSPW_DEVICE_NAME "/dev/grspw0" | |
10 | #define UART_DEVICE_NAME "/dev/console" |
|
11 | #define UART_DEVICE_NAME "/dev/console" | |
11 |
|
12 | |||
12 | typedef struct ring_node |
|
13 | typedef struct ring_node | |
13 | { |
|
14 | { | |
14 | struct ring_node *previous; |
|
15 | struct ring_node *previous; | |
15 | int buffer_address; |
|
16 | int buffer_address; | |
16 | struct ring_node *next; |
|
17 | struct ring_node *next; | |
17 | unsigned int status; |
|
18 | unsigned int status; | |
18 | } ring_node; |
|
19 | } ring_node; | |
19 |
|
20 | |||
20 | //************************ |
|
21 | //************************ | |
21 | // flight software version |
|
22 | // flight software version | |
22 | // this parameters is handled by the Qt project options |
|
23 | // this parameters is handled by the Qt project options | |
23 |
|
24 | |||
24 | #define NB_PACKETS_PER_GROUP_OF_CWF 8 // 8 packets containing 336 blk |
|
25 | #define NB_PACKETS_PER_GROUP_OF_CWF 8 // 8 packets containing 336 blk | |
25 | #define NB_PACKETS_PER_GROUP_OF_CWF_LIGHT 4 // 4 packets containing 672 blk |
|
26 | #define NB_PACKETS_PER_GROUP_OF_CWF_LIGHT 4 // 4 packets containing 672 blk | |
26 | #define NB_SAMPLES_PER_SNAPSHOT 2688 // 336 * 8 = 672 * 4 = 2688 |
|
27 | #define NB_SAMPLES_PER_SNAPSHOT 2688 // 336 * 8 = 672 * 4 = 2688 | |
27 | #define TIME_OFFSET 2 |
|
28 | #define TIME_OFFSET 2 | |
28 | #define TIME_OFFSET_IN_BYTES 8 |
|
29 | #define TIME_OFFSET_IN_BYTES 8 | |
29 | #define WAVEFORM_EXTENDED_HEADER_OFFSET 22 |
|
30 | #define WAVEFORM_EXTENDED_HEADER_OFFSET 22 | |
30 | #define NB_BYTES_SWF_BLK (2 * 6) |
|
31 | #define NB_BYTES_SWF_BLK (2 * 6) | |
31 | #define NB_WORDS_SWF_BLK 3 |
|
32 | #define NB_WORDS_SWF_BLK 3 | |
32 | #define NB_BYTES_CWF3_LIGHT_BLK 6 |
|
33 | #define NB_BYTES_CWF3_LIGHT_BLK 6 | |
33 | #define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8 |
|
34 | #define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8 | |
34 | #define NB_RING_NODES_F0 3 // AT LEAST 3 |
|
35 | #define NB_RING_NODES_F0 3 // AT LEAST 3 | |
35 | #define NB_RING_NODES_F1 5 // AT LEAST 3 |
|
36 | #define NB_RING_NODES_F1 5 // AT LEAST 3 | |
36 | #define NB_RING_NODES_F2 5 // AT LEAST 3 |
|
37 | #define NB_RING_NODES_F2 5 // AT LEAST 3 | |
37 | #define NB_RING_NODES_ASM_F0 12 // AT LEAST 3 |
|
38 | #define NB_RING_NODES_ASM_F0 12 // AT LEAST 3 | |
38 | #define NB_RING_NODES_ASM_F1 2 // AT LEAST 3 |
|
39 | #define NB_RING_NODES_ASM_F1 2 // AT LEAST 3 | |
39 | #define NB_RING_NODES_ASM_F2 2 // AT LEAST 3 |
|
40 | #define NB_RING_NODES_ASM_F2 2 // AT LEAST 3 | |
40 |
|
41 | |||
41 | //********** |
|
42 | //********** | |
42 | // LFR MODES |
|
43 | // LFR MODES | |
43 | #define LFR_MODE_STANDBY 0 |
|
44 | #define LFR_MODE_STANDBY 0 | |
44 | #define LFR_MODE_NORMAL 1 |
|
45 | #define LFR_MODE_NORMAL 1 | |
45 | #define LFR_MODE_BURST 2 |
|
46 | #define LFR_MODE_BURST 2 | |
46 | #define LFR_MODE_SBM1 3 |
|
47 | #define LFR_MODE_SBM1 3 | |
47 | #define LFR_MODE_SBM2 4 |
|
48 | #define LFR_MODE_SBM2 4 | |
48 | #define LFR_MODE_NORMAL_CWF_F3 5 |
|
49 | ||
|
50 | #define TDS_MODE_LFM 5 | |||
|
51 | #define TDS_MODE_STANDBY 0 | |||
|
52 | #define TDS_MODE_NORMAL 1 | |||
|
53 | #define TDS_MODE_BURST 2 | |||
|
54 | #define TDS_MODE_SBM1 3 | |||
|
55 | #define TDS_MODE_SBM2 4 | |||
|
56 | ||||
|
57 | #define THR_MODE_STANDBY 0 | |||
|
58 | #define THR_MODE_NORMAL 1 | |||
|
59 | #define THR_MODE_BURST 2 | |||
49 |
|
60 | |||
50 | #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0 |
|
61 | #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0 | |
51 | #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1 |
|
62 | #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1 | |
52 | #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2 |
|
63 | #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2 | |
53 | #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3 |
|
64 | #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3 | |
54 | #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4 |
|
65 | #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4 | |
55 | #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5 |
|
66 | #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5 | |
56 | #define RTEMS_EVENT_MODE_NORMAL_SWF_F0 RTEMS_EVENT_6 |
|
67 | #define RTEMS_EVENT_MODE_NORMAL_SWF_F0 RTEMS_EVENT_6 | |
57 | #define RTEMS_EVENT_MODE_NORMAL_SWF_F1 RTEMS_EVENT_7 |
|
68 | #define RTEMS_EVENT_MODE_NORMAL_SWF_F1 RTEMS_EVENT_7 | |
58 | #define RTEMS_EVENT_MODE_NORMAL_SWF_F2 RTEMS_EVENT_8 |
|
69 | #define RTEMS_EVENT_MODE_NORMAL_SWF_F2 RTEMS_EVENT_8 | |
59 |
|
70 | |||
60 | //**************************** |
|
71 | //**************************** | |
61 | // LFR DEFAULT MODE PARAMETERS |
|
72 | // LFR DEFAULT MODE PARAMETERS | |
62 | // COMMON |
|
73 | // COMMON | |
63 | #define DEFAULT_SY_LFR_COMMON0 0x00 |
|
74 | #define DEFAULT_SY_LFR_COMMON0 0x00 | |
64 | #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0 |
|
75 | #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0 | |
65 | // NORM |
|
76 | // NORM | |
66 | #define SY_LFR_N_SWF_L 2048 // nb sample |
|
77 | #define SY_LFR_N_SWF_L 2048 // nb sample | |
67 | #define SY_LFR_N_SWF_P 300 // sec |
|
78 | #define SY_LFR_N_SWF_P 300 // sec | |
68 | #define SY_LFR_N_ASM_P 3600 // sec |
|
79 | #define SY_LFR_N_ASM_P 3600 // sec | |
69 | #define SY_LFR_N_BP_P0 4 // sec |
|
80 | #define SY_LFR_N_BP_P0 4 // sec | |
70 | #define SY_LFR_N_BP_P1 20 // sec |
|
81 | #define SY_LFR_N_BP_P1 20 // sec | |
71 | #define SY_LFR_N_CWF_LONG_F3 0 // 0 => production of light continuous waveforms at f3 |
|
82 | #define SY_LFR_N_CWF_LONG_F3 0 // 0 => production of light continuous waveforms at f3 | |
72 | #define MIN_DELTA_SNAPSHOT 16 // sec |
|
83 | #define MIN_DELTA_SNAPSHOT 16 // sec | |
73 | // BURST |
|
84 | // BURST | |
74 | #define DEFAULT_SY_LFR_B_BP_P0 1 // sec |
|
85 | #define DEFAULT_SY_LFR_B_BP_P0 1 // sec | |
75 | #define DEFAULT_SY_LFR_B_BP_P1 5 // sec |
|
86 | #define DEFAULT_SY_LFR_B_BP_P1 5 // sec | |
76 | // SBM1 |
|
87 | // SBM1 | |
77 | #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec |
|
88 | #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec | |
78 | #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec |
|
89 | #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec | |
79 | // SBM2 |
|
90 | // SBM2 | |
80 | #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec |
|
91 | #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec | |
81 | #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec |
|
92 | #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec | |
82 | // ADDITIONAL PARAMETERS |
|
93 | // ADDITIONAL PARAMETERS | |
83 | #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms |
|
94 | #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms | |
84 | #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s |
|
95 | #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s | |
85 | // STATUS WORD |
|
96 | // STATUS WORD | |
86 | #define DEFAULT_STATUS_WORD_BYTE0 0x0d // [0000] [1] [101] mode 4 bits / SPW enabled 1 bit / state is run 3 bits |
|
97 | #define DEFAULT_STATUS_WORD_BYTE0 0x0d // [0000] [1] [101] mode 4 bits / SPW enabled 1 bit / state is run 3 bits | |
87 | #define DEFAULT_STATUS_WORD_BYTE1 0x00 |
|
98 | #define DEFAULT_STATUS_WORD_BYTE1 0x00 | |
88 | // |
|
99 | // | |
89 | #define SY_LFR_DPU_CONNECT_TIMEOUT 100 // 100 * 10 ms = 1 s |
|
100 | #define SY_LFR_DPU_CONNECT_TIMEOUT 100 // 100 * 10 ms = 1 s | |
90 | #define SY_LFR_DPU_CONNECT_ATTEMPT 3 |
|
101 | #define SY_LFR_DPU_CONNECT_ATTEMPT 3 | |
91 | //**************************** |
|
102 | //**************************** | |
92 |
|
103 | |||
93 | //***************************** |
|
104 | //***************************** | |
94 | // APB REGISTERS BASE ADDRESSES |
|
105 | // APB REGISTERS BASE ADDRESSES | |
95 | #define REGS_ADDR_APBUART 0x80000100 |
|
106 | #define REGS_ADDR_APBUART 0x80000100 | |
96 | #define REGS_ADDR_GPTIMER 0x80000300 |
|
107 | #define REGS_ADDR_GPTIMER 0x80000300 | |
97 | #define REGS_ADDR_GRSPW 0x80000500 |
|
108 | #define REGS_ADDR_GRSPW 0x80000500 | |
98 | #define REGS_ADDR_TIME_MANAGEMENT 0x80000600 |
|
109 | #define REGS_ADDR_TIME_MANAGEMENT 0x80000600 | |
99 | #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00 |
|
110 | #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00 | |
100 | #define REGS_ADDR_WAVEFORM_PICKER 0x80000f20 |
|
111 | #define REGS_ADDR_WAVEFORM_PICKER 0x80000f20 | |
101 |
|
112 | |||
102 | #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff |
|
113 | #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff | |
103 | #define APBUART_CTRL_REG_MASK_TE 0x00000002 |
|
114 | #define APBUART_CTRL_REG_MASK_TE 0x00000002 | |
104 | #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50) |
|
115 | #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50) | |
105 |
|
116 | |||
106 | //********** |
|
117 | //********** | |
107 | // IRQ LINES |
|
118 | // IRQ LINES | |
108 | #define IRQ_SM_SIMULATOR 9 |
|
119 | #define IRQ_SM_SIMULATOR 9 | |
109 | #define IRQ_SPARC_SM_SIMULATOR 0x19 // see sparcv8.pdf p.76 for interrupt levels |
|
120 | #define IRQ_SPARC_SM_SIMULATOR 0x19 // see sparcv8.pdf p.76 for interrupt levels | |
110 | #define IRQ_WAVEFORM_PICKER 14 |
|
121 | #define IRQ_WAVEFORM_PICKER 14 | |
111 | #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels |
|
122 | #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels | |
112 | #define IRQ_SPECTRAL_MATRIX 6 |
|
123 | #define IRQ_SPECTRAL_MATRIX 6 | |
113 | #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels |
|
124 | #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels | |
114 |
|
125 | |||
115 | //***** |
|
126 | //***** | |
116 | // TIME |
|
127 | // TIME | |
117 | #define CLKDIV_SM_SIMULATOR (10000 - 1) // 10 ms |
|
128 | #define CLKDIV_SM_SIMULATOR (10000 - 1) // 10 ms | |
118 | #define TIMER_SM_SIMULATOR 1 |
|
129 | #define TIMER_SM_SIMULATOR 1 | |
119 |
#define HK_PERIOD 100 // 100 * 10ms => 1s |
|
130 | #define HK_PERIOD 100 // 100 * 10ms => 1s | |
|
131 | #define SY_LFR_TIME_SYN_TIMEOUT_in_ms 2000 | |||
|
132 | #define SY_LFR_TIME_SYN_TIMEOUT_in_ticks 200 // 200 * 10 ms = 2 s | |||
120 |
|
133 | |||
121 | //********** |
|
134 | //********** | |
122 | // LPP CODES |
|
135 | // LPP CODES | |
123 | #define LFR_SUCCESSFUL 0 |
|
136 | #define LFR_SUCCESSFUL 0 | |
124 | #define LFR_DEFAULT 1 |
|
137 | #define LFR_DEFAULT 1 | |
125 |
|
138 | |||
126 | //****** |
|
139 | //****** | |
127 | // RTEMS |
|
140 | // RTEMS | |
128 | #define TASKID_RECV 1 |
|
141 | #define TASKID_RECV 1 | |
129 | #define TASKID_ACTN 2 |
|
142 | #define TASKID_ACTN 2 | |
130 | #define TASKID_SPIQ 3 |
|
143 | #define TASKID_SPIQ 3 | |
131 | #define TASKID_SMIQ 4 |
|
144 | #define TASKID_SMIQ 4 | |
132 | #define TASKID_STAT 5 |
|
145 | #define TASKID_STAT 5 | |
133 | #define TASKID_AVF0 6 |
|
146 | #define TASKID_AVF0 6 | |
134 | //#define TASKID_BPF0 7 |
|
147 | //#define TASKID_BPF0 7 | |
135 | #define TASKID_WFRM 8 |
|
148 | #define TASKID_WFRM 8 | |
136 | #define TASKID_DUMB 9 |
|
149 | #define TASKID_DUMB 9 | |
137 | #define TASKID_HOUS 10 |
|
150 | #define TASKID_HOUS 10 | |
138 | #define TASKID_MATR 11 |
|
151 | #define TASKID_MATR 11 | |
139 | #define TASKID_CWF3 12 |
|
152 | #define TASKID_CWF3 12 | |
140 | #define TASKID_CWF2 13 |
|
153 | #define TASKID_CWF2 13 | |
141 | #define TASKID_CWF1 14 |
|
154 | #define TASKID_CWF1 14 | |
142 | #define TASKID_SEND 15 |
|
155 | #define TASKID_SEND 15 | |
143 | #define TASKID_WTDG 16 |
|
156 | #define TASKID_WTDG 16 | |
144 |
|
157 | |||
145 | #define TASK_PRIORITY_SPIQ 5 |
|
158 | #define TASK_PRIORITY_SPIQ 5 | |
146 | #define TASK_PRIORITY_SMIQ 10 |
|
159 | #define TASK_PRIORITY_SMIQ 10 | |
147 | #define TASK_PRIORITY_WTDG 20 |
|
160 | #define TASK_PRIORITY_WTDG 20 | |
148 | #define TASK_PRIORITY_HOUS 30 |
|
161 | #define TASK_PRIORITY_HOUS 30 | |
149 | #define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together |
|
162 | #define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together | |
150 | #define TASK_PRIORITY_CWF2 35 // |
|
163 | #define TASK_PRIORITY_CWF2 35 // | |
151 | #define TASK_PRIORITY_WFRM 40 |
|
164 | #define TASK_PRIORITY_WFRM 40 | |
152 | #define TASK_PRIORITY_CWF3 40 // there is a printf in this function, be careful with its priority wrt CWF1 |
|
165 | #define TASK_PRIORITY_CWF3 40 // there is a printf in this function, be careful with its priority wrt CWF1 | |
153 | #define TASK_PRIORITY_SEND 45 |
|
166 | #define TASK_PRIORITY_SEND 45 | |
154 | #define TASK_PRIORITY_RECV 50 |
|
167 | #define TASK_PRIORITY_RECV 50 | |
155 | #define TASK_PRIORITY_ACTN 50 |
|
168 | #define TASK_PRIORITY_ACTN 50 | |
156 | #define TASK_PRIORITY_AVF0 60 |
|
169 | #define TASK_PRIORITY_AVF0 60 | |
157 | #define TASK_PRIORITY_BPF0 60 |
|
170 | #define TASK_PRIORITY_BPF0 60 | |
158 | #define TASK_PRIORITY_MATR 100 |
|
171 | #define TASK_PRIORITY_MATR 100 | |
159 | #define TASK_PRIORITY_STAT 200 |
|
172 | #define TASK_PRIORITY_STAT 200 | |
160 | #define TASK_PRIORITY_DUMB 200 |
|
173 | #define TASK_PRIORITY_DUMB 200 | |
161 |
|
174 | |||
162 | #define ACTION_MSG_QUEUE_COUNT 10 |
|
175 | #define ACTION_MSG_QUEUE_COUNT 10 | |
163 | #define ACTION_MSG_PKTS_COUNT 50 |
|
176 | #define ACTION_MSG_PKTS_COUNT 50 | |
164 | #define ACTION_MSG_PKTS_MAX_SIZE (PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES) |
|
177 | #define ACTION_MSG_PKTS_MAX_SIZE (PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES) | |
165 | #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options |
|
178 | #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options | |
166 |
|
179 | |||
167 | #define QUEUE_RECV 0 |
|
180 | #define QUEUE_RECV 0 | |
168 | #define QUEUE_SEND 1 |
|
181 | #define QUEUE_SEND 1 | |
169 |
|
182 | |||
170 | //******* |
|
183 | //******* | |
171 | // MACROS |
|
184 | // MACROS | |
172 | #ifdef PRINT_MESSAGES_ON_CONSOLE |
|
185 | #ifdef PRINT_MESSAGES_ON_CONSOLE | |
173 | #define PRINTF(x) printf(x); |
|
186 | #define PRINTF(x) printf(x); | |
174 | #define PRINTF1(x,y) printf(x,y); |
|
187 | #define PRINTF1(x,y) printf(x,y); | |
175 | #define PRINTF2(x,y,z) printf(x,y,z); |
|
188 | #define PRINTF2(x,y,z) printf(x,y,z); | |
176 | #else |
|
189 | #else | |
177 | #define PRINTF(x) ; |
|
190 | #define PRINTF(x) ; | |
178 | #define PRINTF1(x,y) ; |
|
191 | #define PRINTF1(x,y) ; | |
179 | #define PRINTF2(x,y,z) ; |
|
192 | #define PRINTF2(x,y,z) ; | |
180 | #endif |
|
193 | #endif | |
181 |
|
194 | |||
182 | #ifdef BOOT_MESSAGES |
|
195 | #ifdef BOOT_MESSAGES | |
183 | #define BOOT_PRINTF(x) printf(x); |
|
196 | #define BOOT_PRINTF(x) printf(x); | |
184 | #define BOOT_PRINTF1(x,y) printf(x,y); |
|
197 | #define BOOT_PRINTF1(x,y) printf(x,y); | |
185 | #define BOOT_PRINTF2(x,y,z) printf(x,y,z); |
|
198 | #define BOOT_PRINTF2(x,y,z) printf(x,y,z); | |
186 | #else |
|
199 | #else | |
187 | #define BOOT_PRINTF(x) ; |
|
200 | #define BOOT_PRINTF(x) ; | |
188 | #define BOOT_PRINTF1(x,y) ; |
|
201 | #define BOOT_PRINTF1(x,y) ; | |
189 | #define BOOT_PRINTF2(x,y,z) ; |
|
202 | #define BOOT_PRINTF2(x,y,z) ; | |
190 | #endif |
|
203 | #endif | |
191 |
|
204 | |||
192 | #ifdef DEBUG_MESSAGES |
|
205 | #ifdef DEBUG_MESSAGES | |
193 | #define DEBUG_PRINTF(x) printf(x); |
|
206 | #define DEBUG_PRINTF(x) printf(x); | |
194 | #define DEBUG_PRINTF1(x,y) printf(x,y); |
|
207 | #define DEBUG_PRINTF1(x,y) printf(x,y); | |
195 | #define DEBUG_PRINTF2(x,y,z) printf(x,y,z); |
|
208 | #define DEBUG_PRINTF2(x,y,z) printf(x,y,z); | |
196 | #else |
|
209 | #else | |
197 | #define DEBUG_PRINTF(x) ; |
|
210 | #define DEBUG_PRINTF(x) ; | |
198 | #define DEBUG_PRINTF1(x,y) ; |
|
211 | #define DEBUG_PRINTF1(x,y) ; | |
199 | #define DEBUG_PRINTF2(x,y,z) ; |
|
212 | #define DEBUG_PRINTF2(x,y,z) ; | |
200 | #endif |
|
213 | #endif | |
201 |
|
214 | |||
202 | #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period |
|
215 | #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period | |
203 |
|
216 | |||
204 | struct param_local_str{ |
|
217 | struct param_local_str{ | |
205 | unsigned int local_sbm1_nb_cwf_sent; |
|
218 | unsigned int local_sbm1_nb_cwf_sent; | |
206 | unsigned int local_sbm1_nb_cwf_max; |
|
219 | unsigned int local_sbm1_nb_cwf_max; | |
207 | unsigned int local_sbm2_nb_cwf_sent; |
|
220 | unsigned int local_sbm2_nb_cwf_sent; | |
208 | unsigned int local_sbm2_nb_cwf_max; |
|
221 | unsigned int local_sbm2_nb_cwf_max; | |
209 | unsigned int local_nb_interrupt_f0_MAX; |
|
222 | unsigned int local_nb_interrupt_f0_MAX; | |
210 | }; |
|
223 | }; | |
211 |
|
224 | |||
212 | #endif // FSW_PARAMS_H_INCLUDED |
|
225 | #endif // FSW_PARAMS_H_INCLUDED |
@@ -1,22 +1,26 | |||||
1 | #ifndef TM_BYTE_POSITIONS_H |
|
1 | #ifndef TM_BYTE_POSITIONS_H | |
2 | #define TM_BYTE_POSITIONS_H |
|
2 | #define TM_BYTE_POSITIONS_H | |
3 |
|
3 | |||
4 | #define BYTE_POS_CP_LFR_MODE 11 |
|
4 | #define BYTE_POS_CP_LFR_MODE 11 | |
5 |
|
5 | |||
6 | // TC_LFR_LOAD_COMMON_PAR |
|
6 | // TC_LFR_LOAD_COMMON_PAR | |
7 |
|
7 | |||
8 | // TC_LFR_LOAD_NORMAL_PAR |
|
8 | // TC_LFR_LOAD_NORMAL_PAR | |
9 | #define BYTE_POS_SY_LFR_N_SWF_L 0 |
|
9 | #define BYTE_POS_SY_LFR_N_SWF_L 0 | |
10 | #define BYTE_POS_SY_LFR_N_SWF_P 2 |
|
10 | #define BYTE_POS_SY_LFR_N_SWF_P 2 | |
11 | #define BYTE_POS_SY_LFR_N_ASM_P 4 |
|
11 | #define BYTE_POS_SY_LFR_N_ASM_P 4 | |
12 | #define BYTE_POS_SY_LFR_N_BP_P0 6 |
|
12 | #define BYTE_POS_SY_LFR_N_BP_P0 6 | |
13 | #define BYTE_POS_SY_LFR_N_BP_P1 7 |
|
13 | #define BYTE_POS_SY_LFR_N_BP_P1 7 | |
|
14 | #define BYTE_POS_SY_LFR_N_CWF_LONG_F3 8 | |||
14 |
|
15 | |||
15 | // TC_LFR_LOAD_BURST_PAR |
|
16 | // TC_LFR_LOAD_BURST_PAR | |
16 |
|
17 | |||
17 | // TC_LFR_LOAD_SBM1_PAR |
|
18 | // TC_LFR_LOAD_SBM1_PAR | |
18 |
|
19 | |||
19 | // TC_LFR_LOAD_SBM2_PAR |
|
20 | // TC_LFR_LOAD_SBM2_PAR | |
20 |
|
21 | |||
|
22 | // TC_LFR_UPDATE_INFO | |||
|
23 | #define BYTE_POS_HK_UPDATE_INFO_PAR_SET5 24 // 34 - 10 | |||
|
24 | #define BYTE_POS_HK_UPDATE_INFO_PAR_SET6 25 // 35 - 10 | |||
21 |
|
25 | |||
22 | #endif // TM_BYTE_POSITIONS_H |
|
26 | #endif // TM_BYTE_POSITIONS_H |
@@ -1,25 +1,25 | |||||
1 | #ifndef TC_ACCEPTANCE_H_INCLUDED |
|
1 | #ifndef TC_ACCEPTANCE_H_INCLUDED | |
2 | #define TC_ACCEPTANCE_H_INCLUDED |
|
2 | #define TC_ACCEPTANCE_H_INCLUDED | |
3 |
|
3 | |||
4 | //#include "tm_lfr_tc_exe.h" |
|
4 | //#include "tm_lfr_tc_exe.h" | |
5 | #include "fsw_params.h" |
|
5 | #include "fsw_params.h" | |
6 |
|
6 | |||
7 | //********************** |
|
7 | //********************** | |
8 | // GENERAL USE FUNCTIONS |
|
8 | // GENERAL USE FUNCTIONS | |
9 | unsigned int Crc_opt( unsigned char D, unsigned int Chk); |
|
9 | unsigned int Crc_opt( unsigned char D, unsigned int Chk); | |
10 | void initLookUpTableForCRC( void ); |
|
10 | void initLookUpTableForCRC( void ); | |
11 | void GetCRCAsTwoBytes(unsigned char* data, unsigned char* crcAsTwoBytes, unsigned int sizeOfData); |
|
11 | void GetCRCAsTwoBytes(unsigned char* data, unsigned char* crcAsTwoBytes, unsigned int sizeOfData); | |
12 |
|
12 | |||
13 | //********************* |
|
13 | //********************* | |
14 | // ACCEPTANCE FUNCTIONS |
|
14 | // ACCEPTANCE FUNCTIONS | |
15 | int tc_parser(ccsdsTelecommandPacket_t * TCPacket, unsigned int TC_LEN_RCV, unsigned char *computed_CRC); |
|
15 | int tc_parser(ccsdsTelecommandPacket_t * TCPacket, unsigned int TC_LEN_RCV, unsigned char *computed_CRC); | |
16 | int tc_check_type( unsigned char packetType ); |
|
16 | int tc_check_type( unsigned char packetType ); | |
17 | int tc_check_subtype( unsigned char packetType ); |
|
17 | int tc_check_type_subtype( unsigned char packetType, unsigned char packetSubType ); | |
18 | int tc_check_sid( unsigned char sid ); |
|
18 | int tc_check_sid( unsigned char sid ); | |
19 | int tc_check_length( unsigned char packetType, unsigned int length ); |
|
19 | int tc_check_length( unsigned char packetType, unsigned int length ); | |
20 | int tc_check_crc(ccsdsTelecommandPacket_t * TCPacket, unsigned int length , unsigned char *computed_CRC); |
|
20 | int tc_check_crc(ccsdsTelecommandPacket_t * TCPacket, unsigned int length , unsigned char *computed_CRC); | |
21 |
|
21 | |||
22 | #endif // TC_ACCEPTANCE_H_INCLUDED |
|
22 | #endif // TC_ACCEPTANCE_H_INCLUDED | |
23 |
|
23 | |||
24 |
|
24 | |||
25 |
|
25 |
@@ -1,58 +1,58 | |||||
1 | #ifndef TC_HANDLER_H_INCLUDED |
|
1 | #ifndef TC_HANDLER_H_INCLUDED | |
2 | #define TC_HANDLER_H_INCLUDED |
|
2 | #define TC_HANDLER_H_INCLUDED | |
3 |
|
3 | |||
4 | #include <rtems.h> |
|
4 | #include <rtems.h> | |
5 | #include <leon.h> |
|
5 | #include <leon.h> | |
6 |
|
6 | |||
7 | #include "tc_load_dump_parameters.h" |
|
7 | #include "tc_load_dump_parameters.h" | |
8 | #include "tc_acceptance.h" |
|
8 | #include "tc_acceptance.h" | |
9 | #include "tm_lfr_tc_exe.h" |
|
9 | #include "tm_lfr_tc_exe.h" | |
10 | #include "wf_handler.h" |
|
10 | #include "wf_handler.h" | |
11 | #include "fsw_processing.h" |
|
11 | #include "fsw_processing.h" | |
12 |
|
12 | |||
13 | // MODE PARAMETERS |
|
13 | // MODE PARAMETERS | |
14 | extern unsigned int maxCount; |
|
14 | extern unsigned int maxCount; | |
15 |
|
15 | |||
16 | //**** |
|
16 | //**** | |
17 | // ISR |
|
17 | // ISR | |
18 | rtems_isr commutation_isr1( rtems_vector_number vector ); |
|
18 | rtems_isr commutation_isr1( rtems_vector_number vector ); | |
19 | rtems_isr commutation_isr2( rtems_vector_number vector ); |
|
19 | rtems_isr commutation_isr2( rtems_vector_number vector ); | |
20 |
|
20 | |||
21 | //*********** |
|
21 | //*********** | |
22 | // RTEMS TASK |
|
22 | // RTEMS TASK | |
23 | rtems_task actn_task( rtems_task_argument unused ); |
|
23 | rtems_task actn_task( rtems_task_argument unused ); | |
24 |
|
24 | |||
25 | //*********** |
|
25 | //*********** | |
26 | // TC ACTIONS |
|
26 | // TC ACTIONS | |
27 | int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); |
|
27 | int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); | |
28 | int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); |
|
28 | int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); | |
29 | int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); |
|
29 | int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); | |
30 | int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); |
|
30 | int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); | |
31 | int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); |
|
31 | int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); | |
32 | int action_update_time(ccsdsTelecommandPacket_t *TC); |
|
32 | int action_update_time(ccsdsTelecommandPacket_t *TC); | |
33 |
|
33 | |||
34 | // mode transition |
|
34 | // mode transition | |
35 | int transition_validation(unsigned char requestedMode); |
|
35 | int transition_validation(unsigned char requestedMode); | |
36 | int stop_current_mode( void ); |
|
36 | int stop_current_mode( void ); | |
37 | int enter_mode(unsigned char mode); |
|
37 | int enter_mode(unsigned char mode); | |
38 | int restart_science_tasks(); |
|
38 | int restart_science_tasks(); | |
39 | int suspend_science_tasks(); |
|
39 | int suspend_science_tasks(); | |
40 | void launch_waveform_picker( unsigned char mode ); |
|
40 | void launch_waveform_picker( unsigned char mode ); | |
41 | void launch_spectral_matrix( unsigned char mode ); |
|
41 | void launch_spectral_matrix( unsigned char mode ); | |
42 | void enable_irq_on_new_ready_matrix( void ); |
|
42 | void enable_irq_on_new_ready_matrix( void ); | |
43 | void disable_irq_on_new_ready_matrix( void ); |
|
43 | void disable_irq_on_new_ready_matrix( void ); | |
44 | void launch_spectral_matrix_simu( unsigned char mode ); |
|
44 | void launch_spectral_matrix_simu( unsigned char mode ); | |
45 |
|
45 | |||
46 | // other functions |
|
46 | // other functions | |
47 | void updateLFRCurrentMode(); |
|
47 | void updateLFRCurrentMode(); | |
48 |
void update_last_TC_exe(ccsdsTelecommandPacket_t *TC |
|
48 | void update_last_TC_exe(ccsdsTelecommandPacket_t *TC ); | |
49 |
void update_last_TC_rej(ccsdsTelecommandPacket_t *TC |
|
49 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC ); | |
50 |
void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id |
|
50 | void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id ); | |
51 |
|
51 | |||
52 | extern rtems_status_code get_message_queue_id_send( rtems_id *queue_id ); |
|
52 | extern rtems_status_code get_message_queue_id_send( rtems_id *queue_id ); | |
53 | extern rtems_status_code get_message_queue_id_recv( rtems_id *queue_id ); |
|
53 | extern rtems_status_code get_message_queue_id_recv( rtems_id *queue_id ); | |
54 |
|
54 | |||
55 | #endif // TC_HANDLER_H_INCLUDED |
|
55 | #endif // TC_HANDLER_H_INCLUDED | |
56 |
|
56 | |||
57 |
|
57 | |||
58 |
|
58 |
@@ -1,28 +1,33 | |||||
1 | #ifndef TC_LOAD_DUMP_PARAMETERS_H |
|
1 | #ifndef TC_LOAD_DUMP_PARAMETERS_H | |
2 | #define TC_LOAD_DUMP_PARAMETERS_H |
|
2 | #define TC_LOAD_DUMP_PARAMETERS_H | |
3 |
|
3 | |||
4 | #include <rtems.h> |
|
4 | #include <rtems.h> | |
5 | #include <stdio.h> |
|
5 | #include <stdio.h> | |
6 |
|
6 | |||
7 | #include "fsw_params.h" |
|
7 | #include "fsw_params.h" | |
8 | #include "wf_handler.h" |
|
8 | #include "wf_handler.h" | |
9 | #include "tm_lfr_tc_exe.h" |
|
9 | #include "tm_lfr_tc_exe.h" | |
10 | #include "fsw_misc.h" |
|
10 | #include "fsw_misc.h" | |
11 |
|
11 | |||
12 | int action_load_common_par( ccsdsTelecommandPacket_t *TC ); |
|
12 | int action_load_common_par( ccsdsTelecommandPacket_t *TC ); | |
13 | int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time); |
|
13 | int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time); | |
14 | int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time); |
|
14 | int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time); | |
15 | int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time); |
|
15 | int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time); | |
16 | int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time); |
|
16 | int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time); | |
17 | int action_dump_par(rtems_id queue_id ); |
|
17 | int action_dump_par(rtems_id queue_id ); | |
18 |
|
18 | |||
19 | int set_sy_lfr_n_swf_l(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time); |
|
19 | int set_sy_lfr_n_swf_l(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time); | |
20 | int set_sy_lfr_n_swf_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time ); |
|
20 | int set_sy_lfr_n_swf_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time ); | |
21 | int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); |
|
21 | int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); | |
22 | int set_sy_lfr_n_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); |
|
22 | int set_sy_lfr_n_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); | |
23 | int set_sy_lfr_n_bp_p1( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); |
|
23 | int set_sy_lfr_n_bp_p1( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); | |
24 | int set_sy_lfr_n_cwf_long_f3(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); |
|
24 | int set_sy_lfr_n_cwf_long_f3(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); | |
25 |
|
25 | |||
|
26 | // TC_LFR_UPDATE_INFO | |||
|
27 | unsigned int check_update_info_hk_lfr_mode( unsigned char mode ); | |||
|
28 | unsigned int check_update_info_hk_tds_mode( unsigned char mode ); | |||
|
29 | unsigned int check_update_info_hk_thr_mode( unsigned char mode ); | |||
|
30 | ||||
26 | void init_parameter_dump( void ); |
|
31 | void init_parameter_dump( void ); | |
27 |
|
32 | |||
28 | #endif // TC_LOAD_DUMP_PARAMETERS_H |
|
33 | #endif // TC_LOAD_DUMP_PARAMETERS_H |
@@ -1,26 +1,26 | |||||
1 | #ifndef TM_LFR_TC_EXE_H_INCLUDED |
|
1 | #ifndef TM_LFR_TC_EXE_H_INCLUDED | |
2 | #define TM_LFR_TC_EXE_H_INCLUDED |
|
2 | #define TM_LFR_TC_EXE_H_INCLUDED | |
3 |
|
3 | |||
4 | #include <rtems.h> |
|
4 | #include <rtems.h> | |
5 | #include <stdio.h> |
|
5 | #include <stdio.h> | |
6 |
|
6 | |||
7 | #include "fsw_params.h" |
|
7 | #include "fsw_params.h" | |
8 | #include "fsw_spacewire.h" |
|
8 | #include "fsw_spacewire.h" | |
9 |
|
9 | |||
10 | extern unsigned short sequenceCounters_TC_EXE[]; |
|
10 | extern unsigned short sequenceCounters_TC_EXE[]; | |
11 |
|
11 | |||
12 |
int send_tm_lfr_tc_exe_success(ccsdsTelecommandPacket_t *TC, rtems_id queue_id |
|
12 | int send_tm_lfr_tc_exe_success( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); | |
13 | int send_tm_lfr_tc_exe_inconsistent(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, |
|
13 | int send_tm_lfr_tc_exe_inconsistent( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, | |
14 |
unsigned char byte_position, unsigned char rcv_value |
|
14 | unsigned char byte_position, unsigned char rcv_value ); | |
15 |
int send_tm_lfr_tc_exe_not_executable(ccsdsTelecommandPacket_t *TC, rtems_id queue_id |
|
15 | int send_tm_lfr_tc_exe_not_executable( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); | |
16 | int send_tm_lfr_tc_exe_not_implemented(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); |
|
16 | int send_tm_lfr_tc_exe_not_implemented( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time ); | |
17 | int send_tm_lfr_tc_exe_error(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); |
|
17 | int send_tm_lfr_tc_exe_error( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time ); | |
18 | int send_tm_lfr_tc_exe_corrupted(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, |
|
18 | int send_tm_lfr_tc_exe_corrupted( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, | |
19 |
unsigned char *computed_CRC, unsigned char *currentTC_LEN_RCV, unsigned char destinationID |
|
19 | unsigned char *computed_CRC, unsigned char *currentTC_LEN_RCV, unsigned char destinationID ); | |
20 |
|
20 | |||
21 | void increment_seq_counter_destination_id( unsigned char *packet_sequence_control, unsigned char destination_id ); |
|
21 | void increment_seq_counter_destination_id( unsigned char *packet_sequence_control, unsigned char destination_id ); | |
22 |
|
22 | |||
23 | #endif // TM_LFR_TC_EXE_H_INCLUDED |
|
23 | #endif // TM_LFR_TC_EXE_H_INCLUDED | |
24 |
|
24 | |||
25 |
|
25 | |||
26 |
|
26 |
@@ -1,598 +1,604 | |||||
1 | /** This is the RTEMS initialization module. |
|
1 | /** This is the RTEMS initialization module. | |
2 | * |
|
2 | * | |
3 | * @file |
|
3 | * @file | |
4 | * @author P. LEROY |
|
4 | * @author P. LEROY | |
5 | * |
|
5 | * | |
6 | * This module contains two very different information: |
|
6 | * This module contains two very different information: | |
7 | * - specific instructions to configure the compilation of the RTEMS executive |
|
7 | * - specific instructions to configure the compilation of the RTEMS executive | |
8 | * - functions related to the fligth softwre initialization, especially the INIT RTEMS task |
|
8 | * - functions related to the fligth softwre initialization, especially the INIT RTEMS task | |
9 | * |
|
9 | * | |
10 | */ |
|
10 | */ | |
11 |
|
11 | |||
12 | //************************* |
|
12 | //************************* | |
13 | // GPL reminder to be added |
|
13 | // GPL reminder to be added | |
14 | //************************* |
|
14 | //************************* | |
15 |
|
15 | |||
16 | #include <rtems.h> |
|
16 | #include <rtems.h> | |
17 |
|
17 | |||
18 | /* configuration information */ |
|
18 | /* configuration information */ | |
19 |
|
19 | |||
20 | #define CONFIGURE_INIT |
|
20 | #define CONFIGURE_INIT | |
21 |
|
21 | |||
22 | #include <bsp.h> /* for device driver prototypes */ |
|
22 | #include <bsp.h> /* for device driver prototypes */ | |
23 |
|
23 | |||
24 | /* configuration information */ |
|
24 | /* configuration information */ | |
25 |
|
25 | |||
26 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
|
26 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER | |
27 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
|
27 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER | |
28 |
|
28 | |||
29 | #define CONFIGURE_MAXIMUM_TASKS 20 |
|
29 | #define CONFIGURE_MAXIMUM_TASKS 20 | |
30 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
|
30 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE | |
31 | #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE) |
|
31 | #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE) | |
32 | #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32 |
|
32 | #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32 | |
33 | #define CONFIGURE_INIT_TASK_PRIORITY 1 // instead of 100 |
|
33 | #define CONFIGURE_INIT_TASK_PRIORITY 1 // instead of 100 | |
34 | #define CONFIGURE_INIT_TASK_MODE (RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT) |
|
34 | #define CONFIGURE_INIT_TASK_MODE (RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT) | |
35 | #define CONFIGURE_MAXIMUM_DRIVERS 16 |
|
35 | #define CONFIGURE_MAXIMUM_DRIVERS 16 | |
36 | #define CONFIGURE_MAXIMUM_PERIODS 5 |
|
36 | #define CONFIGURE_MAXIMUM_PERIODS 5 | |
37 | #define CONFIGURE_MAXIMUM_TIMERS 5 // STAT (1s), send SWF (0.3s), send CWF3 (1s) |
|
37 | #define CONFIGURE_MAXIMUM_TIMERS 5 // STAT (1s), send SWF (0.3s), send CWF3 (1s) | |
38 | #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 2 |
|
38 | #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 2 | |
39 | #ifdef PRINT_STACK_REPORT |
|
39 | #ifdef PRINT_STACK_REPORT | |
40 | #define CONFIGURE_STACK_CHECKER_ENABLED |
|
40 | #define CONFIGURE_STACK_CHECKER_ENABLED | |
41 | #endif |
|
41 | #endif | |
42 |
|
42 | |||
43 | #include <rtems/confdefs.h> |
|
43 | #include <rtems/confdefs.h> | |
44 |
|
44 | |||
45 | /* If --drvmgr was enabled during the configuration of the RTEMS kernel */ |
|
45 | /* If --drvmgr was enabled during the configuration of the RTEMS kernel */ | |
46 | #ifdef RTEMS_DRVMGR_STARTUP |
|
46 | #ifdef RTEMS_DRVMGR_STARTUP | |
47 | #ifdef LEON3 |
|
47 | #ifdef LEON3 | |
48 | /* Add Timer and UART Driver */ |
|
48 | /* Add Timer and UART Driver */ | |
49 | #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
|
49 | #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER | |
50 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER |
|
50 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER | |
51 | #endif |
|
51 | #endif | |
52 | #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
|
52 | #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER | |
53 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART |
|
53 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART | |
54 | #endif |
|
54 | #endif | |
55 | #endif |
|
55 | #endif | |
56 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */ |
|
56 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */ | |
57 | #include <drvmgr/drvmgr_confdefs.h> |
|
57 | #include <drvmgr/drvmgr_confdefs.h> | |
58 | #endif |
|
58 | #endif | |
59 |
|
59 | |||
60 | #include "fsw_init.h" |
|
60 | #include "fsw_init.h" | |
61 | #include "fsw_config.c" |
|
61 | #include "fsw_config.c" | |
62 |
|
62 | |||
63 | rtems_task Init( rtems_task_argument ignored ) |
|
63 | rtems_task Init( rtems_task_argument ignored ) | |
64 | { |
|
64 | { | |
65 | /** This is the RTEMS INIT taks, it the first task launched by the system. |
|
65 | /** This is the RTEMS INIT taks, it the first task launched by the system. | |
66 | * |
|
66 | * | |
67 | * @param unused is the starting argument of the RTEMS task |
|
67 | * @param unused is the starting argument of the RTEMS task | |
68 | * |
|
68 | * | |
69 | * The INIT task create and run all other RTEMS tasks. |
|
69 | * The INIT task create and run all other RTEMS tasks. | |
70 | * |
|
70 | * | |
71 | */ |
|
71 | */ | |
72 |
|
72 | |||
|
73 | reset_local_time(); | |||
73 |
|
74 | |||
74 | rtems_status_code status; |
|
75 | rtems_status_code status; | |
75 | rtems_status_code status_spw; |
|
76 | rtems_status_code status_spw; | |
76 | rtems_isr_entry old_isr_handler; |
|
77 | rtems_isr_entry old_isr_handler; | |
77 |
|
78 | |||
78 | // UART settings |
|
79 | // UART settings | |
79 | send_console_outputs_on_apbuart_port(); |
|
80 | send_console_outputs_on_apbuart_port(); | |
80 | set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE); |
|
81 | set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE); | |
81 | enable_apbuart_transmitter(); |
|
82 | enable_apbuart_transmitter(); | |
82 | DEBUG_PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n") |
|
83 | DEBUG_PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n") | |
83 |
|
84 | |||
84 | PRINTF("\n\n\n\n\n") |
|
85 | PRINTF("\n\n\n\n\n") | |
85 | PRINTF("*************************\n") |
|
86 | PRINTF("*************************\n") | |
86 | PRINTF("** LFR Flight Software **\n") |
|
87 | PRINTF("** LFR Flight Software **\n") | |
87 | PRINTF1("** %d.", SW_VERSION_N1) |
|
88 | PRINTF1("** %d.", SW_VERSION_N1) | |
88 | PRINTF1("%d.", SW_VERSION_N2) |
|
89 | PRINTF1("%d.", SW_VERSION_N2) | |
89 | PRINTF1("%d.", SW_VERSION_N3) |
|
90 | PRINTF1("%d.", SW_VERSION_N3) | |
90 | PRINTF1("%d **\n", SW_VERSION_N4) |
|
91 | PRINTF1("%d **\n", SW_VERSION_N4) | |
91 | PRINTF("*************************\n") |
|
92 | PRINTF("*************************\n") | |
92 | PRINTF("\n\n") |
|
93 | PRINTF("\n\n") | |
93 |
|
94 | |||
94 | reset_wfp_burst_enable(); // stop the waveform picker if it was running |
|
95 | reset_wfp_burst_enable(); // stop the waveform picker if it was running | |
95 | init_waveform_rings(); // initialize the waveform rings |
|
96 | init_waveform_rings(); // initialize the waveform rings | |
96 | init_sm_rings(); |
|
97 | init_sm_rings(); | |
97 |
|
98 | |||
98 | init_parameter_dump(); |
|
99 | init_parameter_dump(); | |
99 | init_local_mode_parameters(); |
|
100 | init_local_mode_parameters(); | |
100 | init_housekeeping_parameters(); |
|
101 | init_housekeeping_parameters(); | |
101 |
|
102 | |||
102 | updateLFRCurrentMode(); |
|
103 | updateLFRCurrentMode(); | |
103 |
|
104 | |||
104 | BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode) |
|
105 | BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode) | |
105 |
|
106 | |||
106 | create_names(); // create all names |
|
107 | create_names(); // create all names | |
107 |
|
108 | |||
108 | status = create_message_queues(); // create message queues |
|
109 | status = create_message_queues(); // create message queues | |
109 | if (status != RTEMS_SUCCESSFUL) |
|
110 | if (status != RTEMS_SUCCESSFUL) | |
110 | { |
|
111 | { | |
111 | PRINTF1("in INIT *** ERR in create_message_queues, code %d", status) |
|
112 | PRINTF1("in INIT *** ERR in create_message_queues, code %d", status) | |
112 | } |
|
113 | } | |
113 |
|
114 | |||
114 | status = create_all_tasks(); // create all tasks |
|
115 | status = create_all_tasks(); // create all tasks | |
115 | if (status != RTEMS_SUCCESSFUL) |
|
116 | if (status != RTEMS_SUCCESSFUL) | |
116 | { |
|
117 | { | |
117 | PRINTF1("in INIT *** ERR in create_all_tasks, code %d", status) |
|
118 | PRINTF1("in INIT *** ERR in create_all_tasks, code %d", status) | |
118 | } |
|
119 | } | |
119 |
|
120 | |||
120 | // ************************** |
|
121 | // ************************** | |
121 | // <SPACEWIRE INITIALIZATION> |
|
122 | // <SPACEWIRE INITIALIZATION> | |
122 | grspw_timecode_callback = &timecode_irq_handler; |
|
123 | grspw_timecode_callback = &timecode_irq_handler; | |
123 |
|
124 | |||
124 | status_spw = spacewire_open_link(); // (1) open the link |
|
125 | status_spw = spacewire_open_link(); // (1) open the link | |
125 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
126 | if ( status_spw != RTEMS_SUCCESSFUL ) | |
126 | { |
|
127 | { | |
127 | PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw ) |
|
128 | PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw ) | |
128 | } |
|
129 | } | |
129 |
|
130 | |||
130 | if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link |
|
131 | if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link | |
131 | { |
|
132 | { | |
132 | status_spw = spacewire_configure_link( fdSPW ); |
|
133 | status_spw = spacewire_configure_link( fdSPW ); | |
133 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
134 | if ( status_spw != RTEMS_SUCCESSFUL ) | |
134 | { |
|
135 | { | |
135 | PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw ) |
|
136 | PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw ) | |
136 | } |
|
137 | } | |
137 | } |
|
138 | } | |
138 |
|
139 | |||
139 | if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link |
|
140 | if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link | |
140 | { |
|
141 | { | |
141 | status_spw = spacewire_start_link( fdSPW ); |
|
142 | status_spw = spacewire_start_link( fdSPW ); | |
142 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
143 | if ( status_spw != RTEMS_SUCCESSFUL ) | |
143 | { |
|
144 | { | |
144 | PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw ) |
|
145 | PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw ) | |
145 | } |
|
146 | } | |
146 | } |
|
147 | } | |
147 | // </SPACEWIRE INITIALIZATION> |
|
148 | // </SPACEWIRE INITIALIZATION> | |
148 | // *************************** |
|
149 | // *************************** | |
149 |
|
150 | |||
150 | status = start_all_tasks(); // start all tasks |
|
151 | status = start_all_tasks(); // start all tasks | |
151 | if (status != RTEMS_SUCCESSFUL) |
|
152 | if (status != RTEMS_SUCCESSFUL) | |
152 | { |
|
153 | { | |
153 | PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status) |
|
154 | PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status) | |
154 | } |
|
155 | } | |
155 |
|
156 | |||
156 | // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization |
|
157 | // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization | |
157 | status = start_recv_send_tasks(); |
|
158 | status = start_recv_send_tasks(); | |
158 | if ( status != RTEMS_SUCCESSFUL ) |
|
159 | if ( status != RTEMS_SUCCESSFUL ) | |
159 | { |
|
160 | { | |
160 | PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status ) |
|
161 | PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status ) | |
161 | } |
|
162 | } | |
162 |
|
163 | |||
163 | // suspend science tasks. they will be restarted later depending on the mode |
|
164 | // suspend science tasks. they will be restarted later depending on the mode | |
164 | status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY) |
|
165 | status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY) | |
165 | if (status != RTEMS_SUCCESSFUL) |
|
166 | if (status != RTEMS_SUCCESSFUL) | |
166 | { |
|
167 | { | |
167 | PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status) |
|
168 | PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status) | |
168 | } |
|
169 | } | |
169 |
|
170 | |||
170 | //****************************** |
|
171 | //****************************** | |
171 | // <SPECTRAL MATRICES SIMULATOR> |
|
172 | // <SPECTRAL MATRICES SIMULATOR> | |
172 | LEON_Mask_interrupt( IRQ_SM_SIMULATOR ); |
|
173 | LEON_Mask_interrupt( IRQ_SM_SIMULATOR ); | |
173 | configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR, |
|
174 | configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR, | |
174 | IRQ_SPARC_SM_SIMULATOR, spectral_matrices_isr_simu ); |
|
175 | IRQ_SPARC_SM_SIMULATOR, spectral_matrices_isr_simu ); | |
175 | // </SPECTRAL MATRICES SIMULATOR> |
|
176 | // </SPECTRAL MATRICES SIMULATOR> | |
176 | //******************************* |
|
177 | //******************************* | |
177 |
|
178 | |||
178 | // configure IRQ handling for the waveform picker unit |
|
179 | // configure IRQ handling for the waveform picker unit | |
179 | status = rtems_interrupt_catch( waveforms_isr, |
|
180 | status = rtems_interrupt_catch( waveforms_isr, | |
180 | IRQ_SPARC_WAVEFORM_PICKER, |
|
181 | IRQ_SPARC_WAVEFORM_PICKER, | |
181 | &old_isr_handler) ; |
|
182 | &old_isr_handler) ; | |
182 | // configure IRQ handling for the spectral matrices unit |
|
183 | // configure IRQ handling for the spectral matrices unit | |
183 | status = rtems_interrupt_catch( spectral_matrices_isr, |
|
184 | status = rtems_interrupt_catch( spectral_matrices_isr, | |
184 | IRQ_SPARC_SPECTRAL_MATRIX, |
|
185 | IRQ_SPARC_SPECTRAL_MATRIX, | |
185 | &old_isr_handler) ; |
|
186 | &old_isr_handler) ; | |
186 |
|
187 | |||
187 | // if the spacewire link is not up then send an event to the SPIQ task for link recovery |
|
188 | // if the spacewire link is not up then send an event to the SPIQ task for link recovery | |
188 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
189 | if ( status_spw != RTEMS_SUCCESSFUL ) | |
189 | { |
|
190 | { | |
190 | status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT ); |
|
191 | status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT ); | |
191 | if ( status != RTEMS_SUCCESSFUL ) { |
|
192 | if ( status != RTEMS_SUCCESSFUL ) { | |
192 | PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status ) |
|
193 | PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status ) | |
193 | } |
|
194 | } | |
194 | } |
|
195 | } | |
195 |
|
196 | |||
196 | BOOT_PRINTF("delete INIT\n") |
|
197 | BOOT_PRINTF("delete INIT\n") | |
197 |
|
198 | |||
198 | status = rtems_task_delete(RTEMS_SELF); |
|
199 | status = rtems_task_delete(RTEMS_SELF); | |
199 |
|
200 | |||
200 | } |
|
201 | } | |
201 |
|
202 | |||
202 | void init_local_mode_parameters( void ) |
|
203 | void init_local_mode_parameters( void ) | |
203 | { |
|
204 | { | |
204 | /** This function initialize the param_local global variable with default values. |
|
205 | /** This function initialize the param_local global variable with default values. | |
205 | * |
|
206 | * | |
206 | */ |
|
207 | */ | |
207 |
|
208 | |||
208 | unsigned int i; |
|
209 | unsigned int i; | |
209 |
|
210 | |||
210 | // LOCAL PARAMETERS |
|
211 | // LOCAL PARAMETERS | |
211 | set_local_nb_interrupt_f0_MAX(); |
|
212 | set_local_nb_interrupt_f0_MAX(); | |
212 |
|
213 | |||
213 | BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max) |
|
214 | BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max) | |
214 | BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max) |
|
215 | BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max) | |
215 | BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX) |
|
216 | BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX) | |
216 |
|
217 | |||
217 | // init sequence counters |
|
218 | // init sequence counters | |
218 |
|
219 | |||
219 | for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++) |
|
220 | for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++) | |
220 | { |
|
221 | { | |
221 | sequenceCounters_TC_EXE[i] = 0x00; |
|
222 | sequenceCounters_TC_EXE[i] = 0x00; | |
222 | } |
|
223 | } | |
223 | sequenceCounters_SCIENCE_NORMAL_BURST = 0x00; |
|
224 | sequenceCounters_SCIENCE_NORMAL_BURST = 0x00; | |
224 | sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00; |
|
225 | sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00; | |
225 | } |
|
226 | } | |
226 |
|
227 | |||
|
228 | void reset_local_time( void ) | |||
|
229 | { | |||
|
230 | ||||
|
231 | } | |||
|
232 | ||||
227 | void create_names( void ) // create all names for tasks and queues |
|
233 | void create_names( void ) // create all names for tasks and queues | |
228 | { |
|
234 | { | |
229 | /** This function creates all RTEMS names used in the software for tasks and queues. |
|
235 | /** This function creates all RTEMS names used in the software for tasks and queues. | |
230 | * |
|
236 | * | |
231 | * @return RTEMS directive status codes: |
|
237 | * @return RTEMS directive status codes: | |
232 | * - RTEMS_SUCCESSFUL - successful completion |
|
238 | * - RTEMS_SUCCESSFUL - successful completion | |
233 | * |
|
239 | * | |
234 | */ |
|
240 | */ | |
235 |
|
241 | |||
236 | // task names |
|
242 | // task names | |
237 | Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' ); |
|
243 | Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' ); | |
238 | Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' ); |
|
244 | Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' ); | |
239 | Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' ); |
|
245 | Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' ); | |
240 | Task_name[TASKID_SMIQ] = rtems_build_name( 'S', 'M', 'I', 'Q' ); |
|
246 | Task_name[TASKID_SMIQ] = rtems_build_name( 'S', 'M', 'I', 'Q' ); | |
241 | Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' ); |
|
247 | Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' ); | |
242 | Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' ); |
|
248 | Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' ); | |
243 | // Task_name[TASKID_BPF0] = rtems_build_name( 'B', 'P', 'F', '0' ); |
|
249 | // Task_name[TASKID_BPF0] = rtems_build_name( 'B', 'P', 'F', '0' ); | |
244 | Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' ); |
|
250 | Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' ); | |
245 | Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' ); |
|
251 | Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' ); | |
246 | Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' ); |
|
252 | Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' ); | |
247 | Task_name[TASKID_MATR] = rtems_build_name( 'M', 'A', 'T', 'R' ); |
|
253 | Task_name[TASKID_MATR] = rtems_build_name( 'M', 'A', 'T', 'R' ); | |
248 | Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' ); |
|
254 | Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' ); | |
249 | Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' ); |
|
255 | Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' ); | |
250 | Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' ); |
|
256 | Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' ); | |
251 | Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' ); |
|
257 | Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' ); | |
252 | Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' ); |
|
258 | Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' ); | |
253 |
|
259 | |||
254 | // rate monotonic period names |
|
260 | // rate monotonic period names | |
255 | name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' ); |
|
261 | name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' ); | |
256 |
|
262 | |||
257 | misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' ); |
|
263 | misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' ); | |
258 | misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' ); |
|
264 | misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' ); | |
259 | } |
|
265 | } | |
260 |
|
266 | |||
261 | int create_all_tasks( void ) // create all tasks which run in the software |
|
267 | int create_all_tasks( void ) // create all tasks which run in the software | |
262 | { |
|
268 | { | |
263 | /** This function creates all RTEMS tasks used in the software. |
|
269 | /** This function creates all RTEMS tasks used in the software. | |
264 | * |
|
270 | * | |
265 | * @return RTEMS directive status codes: |
|
271 | * @return RTEMS directive status codes: | |
266 | * - RTEMS_SUCCESSFUL - task created successfully |
|
272 | * - RTEMS_SUCCESSFUL - task created successfully | |
267 | * - RTEMS_INVALID_ADDRESS - id is NULL |
|
273 | * - RTEMS_INVALID_ADDRESS - id is NULL | |
268 | * - RTEMS_INVALID_NAME - invalid task name |
|
274 | * - RTEMS_INVALID_NAME - invalid task name | |
269 | * - RTEMS_INVALID_PRIORITY - invalid task priority |
|
275 | * - RTEMS_INVALID_PRIORITY - invalid task priority | |
270 | * - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured |
|
276 | * - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured | |
271 | * - RTEMS_TOO_MANY - too many tasks created |
|
277 | * - RTEMS_TOO_MANY - too many tasks created | |
272 | * - RTEMS_UNSATISFIED - not enough memory for stack/FP context |
|
278 | * - RTEMS_UNSATISFIED - not enough memory for stack/FP context | |
273 | * - RTEMS_TOO_MANY - too many global objects |
|
279 | * - RTEMS_TOO_MANY - too many global objects | |
274 | * |
|
280 | * | |
275 | */ |
|
281 | */ | |
276 |
|
282 | |||
277 | rtems_status_code status; |
|
283 | rtems_status_code status; | |
278 |
|
284 | |||
279 | // RECV |
|
285 | // RECV | |
280 | status = rtems_task_create( |
|
286 | status = rtems_task_create( | |
281 | Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE, |
|
287 | Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE, | |
282 | RTEMS_DEFAULT_MODES, |
|
288 | RTEMS_DEFAULT_MODES, | |
283 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV] |
|
289 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV] | |
284 | ); |
|
290 | ); | |
285 |
|
291 | |||
286 | if (status == RTEMS_SUCCESSFUL) // ACTN |
|
292 | if (status == RTEMS_SUCCESSFUL) // ACTN | |
287 | { |
|
293 | { | |
288 | status = rtems_task_create( |
|
294 | status = rtems_task_create( | |
289 | Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE, |
|
295 | Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE, | |
290 | RTEMS_DEFAULT_MODES, |
|
296 | RTEMS_DEFAULT_MODES, | |
291 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN] |
|
297 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN] | |
292 | ); |
|
298 | ); | |
293 | } |
|
299 | } | |
294 | if (status == RTEMS_SUCCESSFUL) // SPIQ |
|
300 | if (status == RTEMS_SUCCESSFUL) // SPIQ | |
295 | { |
|
301 | { | |
296 | status = rtems_task_create( |
|
302 | status = rtems_task_create( | |
297 | Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE, |
|
303 | Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE, | |
298 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
304 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, | |
299 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ] |
|
305 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ] | |
300 | ); |
|
306 | ); | |
301 | } |
|
307 | } | |
302 | if (status == RTEMS_SUCCESSFUL) // SMIQ |
|
308 | if (status == RTEMS_SUCCESSFUL) // SMIQ | |
303 | { |
|
309 | { | |
304 | status = rtems_task_create( |
|
310 | status = rtems_task_create( | |
305 | Task_name[TASKID_SMIQ], TASK_PRIORITY_SMIQ, RTEMS_MINIMUM_STACK_SIZE, |
|
311 | Task_name[TASKID_SMIQ], TASK_PRIORITY_SMIQ, RTEMS_MINIMUM_STACK_SIZE, | |
306 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
312 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, | |
307 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SMIQ] |
|
313 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SMIQ] | |
308 | ); |
|
314 | ); | |
309 | } |
|
315 | } | |
310 | if (status == RTEMS_SUCCESSFUL) // STAT |
|
316 | if (status == RTEMS_SUCCESSFUL) // STAT | |
311 | { |
|
317 | { | |
312 | status = rtems_task_create( |
|
318 | status = rtems_task_create( | |
313 | Task_name[TASKID_STAT], TASK_PRIORITY_STAT, RTEMS_MINIMUM_STACK_SIZE, |
|
319 | Task_name[TASKID_STAT], TASK_PRIORITY_STAT, RTEMS_MINIMUM_STACK_SIZE, | |
314 | RTEMS_DEFAULT_MODES, |
|
320 | RTEMS_DEFAULT_MODES, | |
315 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT] |
|
321 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT] | |
316 | ); |
|
322 | ); | |
317 | } |
|
323 | } | |
318 | if (status == RTEMS_SUCCESSFUL) // AVF0 |
|
324 | if (status == RTEMS_SUCCESSFUL) // AVF0 | |
319 | { |
|
325 | { | |
320 | status = rtems_task_create( |
|
326 | status = rtems_task_create( | |
321 | Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE, |
|
327 | Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE, | |
322 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
328 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, | |
323 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0] |
|
329 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0] | |
324 | ); |
|
330 | ); | |
325 | } |
|
331 | } | |
326 | if (status == RTEMS_SUCCESSFUL) // WFRM |
|
332 | if (status == RTEMS_SUCCESSFUL) // WFRM | |
327 | { |
|
333 | { | |
328 | status = rtems_task_create( |
|
334 | status = rtems_task_create( | |
329 | Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE, |
|
335 | Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE, | |
330 | RTEMS_DEFAULT_MODES, |
|
336 | RTEMS_DEFAULT_MODES, | |
331 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM] |
|
337 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM] | |
332 | ); |
|
338 | ); | |
333 | } |
|
339 | } | |
334 | if (status == RTEMS_SUCCESSFUL) // DUMB |
|
340 | if (status == RTEMS_SUCCESSFUL) // DUMB | |
335 | { |
|
341 | { | |
336 | status = rtems_task_create( |
|
342 | status = rtems_task_create( | |
337 | Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE, |
|
343 | Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE, | |
338 | RTEMS_DEFAULT_MODES, |
|
344 | RTEMS_DEFAULT_MODES, | |
339 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB] |
|
345 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB] | |
340 | ); |
|
346 | ); | |
341 | } |
|
347 | } | |
342 | if (status == RTEMS_SUCCESSFUL) // HOUS |
|
348 | if (status == RTEMS_SUCCESSFUL) // HOUS | |
343 | { |
|
349 | { | |
344 | status = rtems_task_create( |
|
350 | status = rtems_task_create( | |
345 | Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE, |
|
351 | Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE, | |
346 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
352 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, | |
347 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS] |
|
353 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS] | |
348 | ); |
|
354 | ); | |
349 | } |
|
355 | } | |
350 | if (status == RTEMS_SUCCESSFUL) // MATR |
|
356 | if (status == RTEMS_SUCCESSFUL) // MATR | |
351 | { |
|
357 | { | |
352 | status = rtems_task_create( |
|
358 | status = rtems_task_create( | |
353 | Task_name[TASKID_MATR], TASK_PRIORITY_MATR, RTEMS_MINIMUM_STACK_SIZE, |
|
359 | Task_name[TASKID_MATR], TASK_PRIORITY_MATR, RTEMS_MINIMUM_STACK_SIZE, | |
354 | RTEMS_DEFAULT_MODES, |
|
360 | RTEMS_DEFAULT_MODES, | |
355 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_MATR] |
|
361 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_MATR] | |
356 | ); |
|
362 | ); | |
357 | } |
|
363 | } | |
358 | if (status == RTEMS_SUCCESSFUL) // CWF3 |
|
364 | if (status == RTEMS_SUCCESSFUL) // CWF3 | |
359 | { |
|
365 | { | |
360 | status = rtems_task_create( |
|
366 | status = rtems_task_create( | |
361 | Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE, |
|
367 | Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE, | |
362 | RTEMS_DEFAULT_MODES, |
|
368 | RTEMS_DEFAULT_MODES, | |
363 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF3] |
|
369 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF3] | |
364 | ); |
|
370 | ); | |
365 | } |
|
371 | } | |
366 | if (status == RTEMS_SUCCESSFUL) // CWF2 |
|
372 | if (status == RTEMS_SUCCESSFUL) // CWF2 | |
367 | { |
|
373 | { | |
368 | status = rtems_task_create( |
|
374 | status = rtems_task_create( | |
369 | Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE, |
|
375 | Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE, | |
370 | RTEMS_DEFAULT_MODES, |
|
376 | RTEMS_DEFAULT_MODES, | |
371 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF2] |
|
377 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF2] | |
372 | ); |
|
378 | ); | |
373 | } |
|
379 | } | |
374 | if (status == RTEMS_SUCCESSFUL) // CWF1 |
|
380 | if (status == RTEMS_SUCCESSFUL) // CWF1 | |
375 | { |
|
381 | { | |
376 | status = rtems_task_create( |
|
382 | status = rtems_task_create( | |
377 | Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE, |
|
383 | Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE, | |
378 | RTEMS_DEFAULT_MODES, |
|
384 | RTEMS_DEFAULT_MODES, | |
379 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF1] |
|
385 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF1] | |
380 | ); |
|
386 | ); | |
381 | } |
|
387 | } | |
382 | if (status == RTEMS_SUCCESSFUL) // SEND |
|
388 | if (status == RTEMS_SUCCESSFUL) // SEND | |
383 | { |
|
389 | { | |
384 | status = rtems_task_create( |
|
390 | status = rtems_task_create( | |
385 | Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE, |
|
391 | Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE, | |
386 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
392 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, | |
387 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SEND] |
|
393 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SEND] | |
388 | ); |
|
394 | ); | |
389 | } |
|
395 | } | |
390 | if (status == RTEMS_SUCCESSFUL) // WTDG |
|
396 | if (status == RTEMS_SUCCESSFUL) // WTDG | |
391 | { |
|
397 | { | |
392 | status = rtems_task_create( |
|
398 | status = rtems_task_create( | |
393 | Task_name[TASKID_WTDG], TASK_PRIORITY_WTDG, RTEMS_MINIMUM_STACK_SIZE, |
|
399 | Task_name[TASKID_WTDG], TASK_PRIORITY_WTDG, RTEMS_MINIMUM_STACK_SIZE, | |
394 | RTEMS_DEFAULT_MODES, |
|
400 | RTEMS_DEFAULT_MODES, | |
395 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_WTDG] |
|
401 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_WTDG] | |
396 | ); |
|
402 | ); | |
397 | } |
|
403 | } | |
398 |
|
404 | |||
399 | return status; |
|
405 | return status; | |
400 | } |
|
406 | } | |
401 |
|
407 | |||
402 | int start_recv_send_tasks( void ) |
|
408 | int start_recv_send_tasks( void ) | |
403 | { |
|
409 | { | |
404 | rtems_status_code status; |
|
410 | rtems_status_code status; | |
405 |
|
411 | |||
406 | status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 ); |
|
412 | status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 ); | |
407 | if (status!=RTEMS_SUCCESSFUL) { |
|
413 | if (status!=RTEMS_SUCCESSFUL) { | |
408 | BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n") |
|
414 | BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n") | |
409 | } |
|
415 | } | |
410 |
|
416 | |||
411 | if (status == RTEMS_SUCCESSFUL) // SEND |
|
417 | if (status == RTEMS_SUCCESSFUL) // SEND | |
412 | { |
|
418 | { | |
413 | status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 ); |
|
419 | status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 ); | |
414 | if (status!=RTEMS_SUCCESSFUL) { |
|
420 | if (status!=RTEMS_SUCCESSFUL) { | |
415 | BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n") |
|
421 | BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n") | |
416 | } |
|
422 | } | |
417 | } |
|
423 | } | |
418 |
|
424 | |||
419 | return status; |
|
425 | return status; | |
420 | } |
|
426 | } | |
421 |
|
427 | |||
422 | int start_all_tasks( void ) // start all tasks except SEND RECV and HOUS |
|
428 | int start_all_tasks( void ) // start all tasks except SEND RECV and HOUS | |
423 | { |
|
429 | { | |
424 | /** This function starts all RTEMS tasks used in the software. |
|
430 | /** This function starts all RTEMS tasks used in the software. | |
425 | * |
|
431 | * | |
426 | * @return RTEMS directive status codes: |
|
432 | * @return RTEMS directive status codes: | |
427 | * - RTEMS_SUCCESSFUL - ask started successfully |
|
433 | * - RTEMS_SUCCESSFUL - ask started successfully | |
428 | * - RTEMS_INVALID_ADDRESS - invalid task entry point |
|
434 | * - RTEMS_INVALID_ADDRESS - invalid task entry point | |
429 | * - RTEMS_INVALID_ID - invalid task id |
|
435 | * - RTEMS_INVALID_ID - invalid task id | |
430 | * - RTEMS_INCORRECT_STATE - task not in the dormant state |
|
436 | * - RTEMS_INCORRECT_STATE - task not in the dormant state | |
431 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot start remote task |
|
437 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot start remote task | |
432 | * |
|
438 | * | |
433 | */ |
|
439 | */ | |
434 | // starts all the tasks fot eh flight software |
|
440 | // starts all the tasks fot eh flight software | |
435 |
|
441 | |||
436 | rtems_status_code status; |
|
442 | rtems_status_code status; | |
437 |
|
443 | |||
438 | status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 ); |
|
444 | status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 ); | |
439 | if (status!=RTEMS_SUCCESSFUL) { |
|
445 | if (status!=RTEMS_SUCCESSFUL) { | |
440 | BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n") |
|
446 | BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n") | |
441 | } |
|
447 | } | |
442 |
|
448 | |||
443 | if (status == RTEMS_SUCCESSFUL) // WTDG |
|
449 | if (status == RTEMS_SUCCESSFUL) // WTDG | |
444 | { |
|
450 | { | |
445 | status = rtems_task_start( Task_id[TASKID_WTDG], wtdg_task, 1 ); |
|
451 | status = rtems_task_start( Task_id[TASKID_WTDG], wtdg_task, 1 ); | |
446 | if (status!=RTEMS_SUCCESSFUL) { |
|
452 | if (status!=RTEMS_SUCCESSFUL) { | |
447 | BOOT_PRINTF("in INIT *** Error starting TASK_WTDG\n") |
|
453 | BOOT_PRINTF("in INIT *** Error starting TASK_WTDG\n") | |
448 | } |
|
454 | } | |
449 | } |
|
455 | } | |
450 |
|
456 | |||
451 | if (status == RTEMS_SUCCESSFUL) // SMIQ |
|
457 | if (status == RTEMS_SUCCESSFUL) // SMIQ | |
452 | { |
|
458 | { | |
453 | status = rtems_task_start( Task_id[TASKID_SMIQ], smiq_task, 1 ); |
|
459 | status = rtems_task_start( Task_id[TASKID_SMIQ], smiq_task, 1 ); | |
454 | if (status!=RTEMS_SUCCESSFUL) { |
|
460 | if (status!=RTEMS_SUCCESSFUL) { | |
455 | BOOT_PRINTF("in INIT *** Error starting TASK_BPPR\n") |
|
461 | BOOT_PRINTF("in INIT *** Error starting TASK_BPPR\n") | |
456 | } |
|
462 | } | |
457 | } |
|
463 | } | |
458 |
|
464 | |||
459 | if (status == RTEMS_SUCCESSFUL) // ACTN |
|
465 | if (status == RTEMS_SUCCESSFUL) // ACTN | |
460 | { |
|
466 | { | |
461 | status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 ); |
|
467 | status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 ); | |
462 | if (status!=RTEMS_SUCCESSFUL) { |
|
468 | if (status!=RTEMS_SUCCESSFUL) { | |
463 | BOOT_PRINTF("in INIT *** Error starting TASK_ACTN\n") |
|
469 | BOOT_PRINTF("in INIT *** Error starting TASK_ACTN\n") | |
464 | } |
|
470 | } | |
465 | } |
|
471 | } | |
466 |
|
472 | |||
467 | if (status == RTEMS_SUCCESSFUL) // STAT |
|
473 | if (status == RTEMS_SUCCESSFUL) // STAT | |
468 | { |
|
474 | { | |
469 | status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 ); |
|
475 | status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 ); | |
470 | if (status!=RTEMS_SUCCESSFUL) { |
|
476 | if (status!=RTEMS_SUCCESSFUL) { | |
471 | BOOT_PRINTF("in INIT *** Error starting TASK_STAT\n") |
|
477 | BOOT_PRINTF("in INIT *** Error starting TASK_STAT\n") | |
472 | } |
|
478 | } | |
473 | } |
|
479 | } | |
474 |
|
480 | |||
475 | if (status == RTEMS_SUCCESSFUL) // AVF0 |
|
481 | if (status == RTEMS_SUCCESSFUL) // AVF0 | |
476 | { |
|
482 | { | |
477 | status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, 1 ); |
|
483 | status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, 1 ); | |
478 | if (status!=RTEMS_SUCCESSFUL) { |
|
484 | if (status!=RTEMS_SUCCESSFUL) { | |
479 | BOOT_PRINTF("in INIT *** Error starting TASK_AVF0\n") |
|
485 | BOOT_PRINTF("in INIT *** Error starting TASK_AVF0\n") | |
480 | } |
|
486 | } | |
481 | } |
|
487 | } | |
482 |
|
488 | |||
483 | if (status == RTEMS_SUCCESSFUL) // WFRM |
|
489 | if (status == RTEMS_SUCCESSFUL) // WFRM | |
484 | { |
|
490 | { | |
485 | status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 ); |
|
491 | status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 ); | |
486 | if (status!=RTEMS_SUCCESSFUL) { |
|
492 | if (status!=RTEMS_SUCCESSFUL) { | |
487 | BOOT_PRINTF("in INIT *** Error starting TASK_WFRM\n") |
|
493 | BOOT_PRINTF("in INIT *** Error starting TASK_WFRM\n") | |
488 | } |
|
494 | } | |
489 | } |
|
495 | } | |
490 |
|
496 | |||
491 | if (status == RTEMS_SUCCESSFUL) // DUMB |
|
497 | if (status == RTEMS_SUCCESSFUL) // DUMB | |
492 | { |
|
498 | { | |
493 | status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 ); |
|
499 | status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 ); | |
494 | if (status!=RTEMS_SUCCESSFUL) { |
|
500 | if (status!=RTEMS_SUCCESSFUL) { | |
495 | BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n") |
|
501 | BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n") | |
496 | } |
|
502 | } | |
497 | } |
|
503 | } | |
498 |
|
504 | |||
499 | if (status == RTEMS_SUCCESSFUL) // HOUS |
|
505 | if (status == RTEMS_SUCCESSFUL) // HOUS | |
500 | { |
|
506 | { | |
501 | status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 ); |
|
507 | status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 ); | |
502 | if (status!=RTEMS_SUCCESSFUL) { |
|
508 | if (status!=RTEMS_SUCCESSFUL) { | |
503 | BOOT_PRINTF("in INIT *** Error starting TASK_HOUS\n") |
|
509 | BOOT_PRINTF("in INIT *** Error starting TASK_HOUS\n") | |
504 | } |
|
510 | } | |
505 | } |
|
511 | } | |
506 |
|
512 | |||
507 | if (status == RTEMS_SUCCESSFUL) // MATR |
|
513 | if (status == RTEMS_SUCCESSFUL) // MATR | |
508 | { |
|
514 | { | |
509 | status = rtems_task_start( Task_id[TASKID_MATR], matr_task, 1 ); |
|
515 | status = rtems_task_start( Task_id[TASKID_MATR], matr_task, 1 ); | |
510 | if (status!=RTEMS_SUCCESSFUL) { |
|
516 | if (status!=RTEMS_SUCCESSFUL) { | |
511 | BOOT_PRINTF("in INIT *** Error starting TASK_MATR\n") |
|
517 | BOOT_PRINTF("in INIT *** Error starting TASK_MATR\n") | |
512 | } |
|
518 | } | |
513 | } |
|
519 | } | |
514 |
|
520 | |||
515 | if (status == RTEMS_SUCCESSFUL) // CWF3 |
|
521 | if (status == RTEMS_SUCCESSFUL) // CWF3 | |
516 | { |
|
522 | { | |
517 | status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 ); |
|
523 | status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 ); | |
518 | if (status!=RTEMS_SUCCESSFUL) { |
|
524 | if (status!=RTEMS_SUCCESSFUL) { | |
519 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF3\n") |
|
525 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF3\n") | |
520 | } |
|
526 | } | |
521 | } |
|
527 | } | |
522 |
|
528 | |||
523 | if (status == RTEMS_SUCCESSFUL) // CWF2 |
|
529 | if (status == RTEMS_SUCCESSFUL) // CWF2 | |
524 | { |
|
530 | { | |
525 | status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 ); |
|
531 | status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 ); | |
526 | if (status!=RTEMS_SUCCESSFUL) { |
|
532 | if (status!=RTEMS_SUCCESSFUL) { | |
527 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF2\n") |
|
533 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF2\n") | |
528 | } |
|
534 | } | |
529 | } |
|
535 | } | |
530 |
|
536 | |||
531 | if (status == RTEMS_SUCCESSFUL) // CWF1 |
|
537 | if (status == RTEMS_SUCCESSFUL) // CWF1 | |
532 | { |
|
538 | { | |
533 | status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 ); |
|
539 | status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 ); | |
534 | if (status!=RTEMS_SUCCESSFUL) { |
|
540 | if (status!=RTEMS_SUCCESSFUL) { | |
535 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF1\n") |
|
541 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF1\n") | |
536 | } |
|
542 | } | |
537 | } |
|
543 | } | |
538 | return status; |
|
544 | return status; | |
539 | } |
|
545 | } | |
540 |
|
546 | |||
541 | rtems_status_code create_message_queues( void ) // create the two message queues used in the software |
|
547 | rtems_status_code create_message_queues( void ) // create the two message queues used in the software | |
542 | { |
|
548 | { | |
543 | rtems_status_code status_recv; |
|
549 | rtems_status_code status_recv; | |
544 | rtems_status_code status_send; |
|
550 | rtems_status_code status_send; | |
545 | rtems_status_code ret; |
|
551 | rtems_status_code ret; | |
546 | rtems_id queue_id; |
|
552 | rtems_id queue_id; | |
547 |
|
553 | |||
548 | // create the queue for handling valid TCs |
|
554 | // create the queue for handling valid TCs | |
549 | status_recv = rtems_message_queue_create( misc_name[QUEUE_RECV], |
|
555 | status_recv = rtems_message_queue_create( misc_name[QUEUE_RECV], | |
550 | ACTION_MSG_QUEUE_COUNT, CCSDS_TC_PKT_MAX_SIZE, |
|
556 | ACTION_MSG_QUEUE_COUNT, CCSDS_TC_PKT_MAX_SIZE, | |
551 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); |
|
557 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); | |
552 | if ( status_recv != RTEMS_SUCCESSFUL ) { |
|
558 | if ( status_recv != RTEMS_SUCCESSFUL ) { | |
553 | PRINTF1("in create_message_queues *** ERR creating QUEU queue, %d\n", status_recv) |
|
559 | PRINTF1("in create_message_queues *** ERR creating QUEU queue, %d\n", status_recv) | |
554 | } |
|
560 | } | |
555 |
|
561 | |||
556 | // create the queue for handling TM packet sending |
|
562 | // create the queue for handling TM packet sending | |
557 | status_send = rtems_message_queue_create( misc_name[QUEUE_SEND], |
|
563 | status_send = rtems_message_queue_create( misc_name[QUEUE_SEND], | |
558 | ACTION_MSG_PKTS_COUNT, ACTION_MSG_PKTS_MAX_SIZE, |
|
564 | ACTION_MSG_PKTS_COUNT, ACTION_MSG_PKTS_MAX_SIZE, | |
559 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); |
|
565 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); | |
560 | if ( status_send != RTEMS_SUCCESSFUL ) { |
|
566 | if ( status_send != RTEMS_SUCCESSFUL ) { | |
561 | PRINTF1("in create_message_queues *** ERR creating PKTS queue, %d\n", status_send) |
|
567 | PRINTF1("in create_message_queues *** ERR creating PKTS queue, %d\n", status_send) | |
562 | } |
|
568 | } | |
563 |
|
569 | |||
564 | if ( status_recv != RTEMS_SUCCESSFUL ) |
|
570 | if ( status_recv != RTEMS_SUCCESSFUL ) | |
565 | { |
|
571 | { | |
566 | ret = status_recv; |
|
572 | ret = status_recv; | |
567 | } |
|
573 | } | |
568 | else |
|
574 | else | |
569 | { |
|
575 | { | |
570 | ret = status_send; |
|
576 | ret = status_send; | |
571 | } |
|
577 | } | |
572 |
|
578 | |||
573 | return ret; |
|
579 | return ret; | |
574 | } |
|
580 | } | |
575 |
|
581 | |||
576 | rtems_status_code get_message_queue_id_send( rtems_id *queue_id ) |
|
582 | rtems_status_code get_message_queue_id_send( rtems_id *queue_id ) | |
577 | { |
|
583 | { | |
578 | rtems_status_code status; |
|
584 | rtems_status_code status; | |
579 | rtems_name queue_name; |
|
585 | rtems_name queue_name; | |
580 |
|
586 | |||
581 | queue_name = rtems_build_name( 'Q', '_', 'S', 'D' ); |
|
587 | queue_name = rtems_build_name( 'Q', '_', 'S', 'D' ); | |
582 |
|
588 | |||
583 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); |
|
589 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); | |
584 |
|
590 | |||
585 | return status; |
|
591 | return status; | |
586 | } |
|
592 | } | |
587 |
|
593 | |||
588 | rtems_status_code get_message_queue_id_recv( rtems_id *queue_id ) |
|
594 | rtems_status_code get_message_queue_id_recv( rtems_id *queue_id ) | |
589 | { |
|
595 | { | |
590 | rtems_status_code status; |
|
596 | rtems_status_code status; | |
591 | rtems_name queue_name; |
|
597 | rtems_name queue_name; | |
592 |
|
598 | |||
593 | queue_name = rtems_build_name( 'Q', '_', 'R', 'V' ); |
|
599 | queue_name = rtems_build_name( 'Q', '_', 'R', 'V' ); | |
594 |
|
600 | |||
595 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); |
|
601 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); | |
596 |
|
602 | |||
597 | return status; |
|
603 | return status; | |
598 | } |
|
604 | } |
@@ -1,344 +1,364 | |||||
1 | /** General usage functions and RTEMS tasks. |
|
1 | /** General usage functions and RTEMS tasks. | |
2 | * |
|
2 | * | |
3 | * @file |
|
3 | * @file | |
4 | * @author P. LEROY |
|
4 | * @author P. LEROY | |
5 | * |
|
5 | * | |
6 | */ |
|
6 | */ | |
7 |
|
7 | |||
8 | #include "fsw_misc.h" |
|
8 | #include "fsw_misc.h" | |
9 |
|
9 | |||
10 | void configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider, |
|
10 | void configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider, | |
11 | unsigned char interrupt_level, rtems_isr (*timer_isr)() ) |
|
11 | unsigned char interrupt_level, rtems_isr (*timer_isr)() ) | |
12 | { |
|
12 | { | |
13 | /** This function configures a GPTIMER timer instantiated in the VHDL design. |
|
13 | /** This function configures a GPTIMER timer instantiated in the VHDL design. | |
14 | * |
|
14 | * | |
15 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. |
|
15 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. | |
16 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). |
|
16 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). | |
17 | * @param clock_divider is the divider of the 1 MHz clock that will be configured. |
|
17 | * @param clock_divider is the divider of the 1 MHz clock that will be configured. | |
18 | * @param interrupt_level is the interrupt level that the timer drives. |
|
18 | * @param interrupt_level is the interrupt level that the timer drives. | |
19 | * @param timer_isr is the interrupt subroutine that will be attached to the IRQ driven by the timer. |
|
19 | * @param timer_isr is the interrupt subroutine that will be attached to the IRQ driven by the timer. | |
20 | * |
|
20 | * | |
21 | * Interrupt levels are described in the SPARC documentation sparcv8.pdf p.76 |
|
21 | * Interrupt levels are described in the SPARC documentation sparcv8.pdf p.76 | |
22 | * |
|
22 | * | |
23 | */ |
|
23 | */ | |
24 |
|
24 | |||
25 | rtems_status_code status; |
|
25 | rtems_status_code status; | |
26 | rtems_isr_entry old_isr_handler; |
|
26 | rtems_isr_entry old_isr_handler; | |
27 |
|
27 | |||
28 | gptimer_regs->timer[timer].ctrl = 0x00; // reset the control register |
|
28 | gptimer_regs->timer[timer].ctrl = 0x00; // reset the control register | |
29 |
|
29 | |||
30 | status = rtems_interrupt_catch( timer_isr, interrupt_level, &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels |
|
30 | status = rtems_interrupt_catch( timer_isr, interrupt_level, &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels | |
31 | if (status!=RTEMS_SUCCESSFUL) |
|
31 | if (status!=RTEMS_SUCCESSFUL) | |
32 | { |
|
32 | { | |
33 | PRINTF("in configure_timer *** ERR rtems_interrupt_catch\n") |
|
33 | PRINTF("in configure_timer *** ERR rtems_interrupt_catch\n") | |
34 | } |
|
34 | } | |
35 |
|
35 | |||
36 | timer_set_clock_divider( gptimer_regs, timer, clock_divider); |
|
36 | timer_set_clock_divider( gptimer_regs, timer, clock_divider); | |
37 | } |
|
37 | } | |
38 |
|
38 | |||
39 | void timer_start(gptimer_regs_t *gptimer_regs, unsigned char timer) |
|
39 | void timer_start(gptimer_regs_t *gptimer_regs, unsigned char timer) | |
40 | { |
|
40 | { | |
41 | /** This function starts a GPTIMER timer. |
|
41 | /** This function starts a GPTIMER timer. | |
42 | * |
|
42 | * | |
43 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. |
|
43 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. | |
44 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). |
|
44 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). | |
45 | * |
|
45 | * | |
46 | */ |
|
46 | */ | |
47 |
|
47 | |||
48 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any |
|
48 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any | |
49 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000004; // LD load value from the reload register |
|
49 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000004; // LD load value from the reload register | |
50 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000001; // EN enable the timer |
|
50 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000001; // EN enable the timer | |
51 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000002; // RS restart |
|
51 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000002; // RS restart | |
52 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000008; // IE interrupt enable |
|
52 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000008; // IE interrupt enable | |
53 | } |
|
53 | } | |
54 |
|
54 | |||
55 | void timer_stop(gptimer_regs_t *gptimer_regs, unsigned char timer) |
|
55 | void timer_stop(gptimer_regs_t *gptimer_regs, unsigned char timer) | |
56 | { |
|
56 | { | |
57 | /** This function stops a GPTIMER timer. |
|
57 | /** This function stops a GPTIMER timer. | |
58 | * |
|
58 | * | |
59 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. |
|
59 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. | |
60 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). |
|
60 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). | |
61 | * |
|
61 | * | |
62 | */ |
|
62 | */ | |
63 |
|
63 | |||
64 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xfffffffe; // EN enable the timer |
|
64 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xfffffffe; // EN enable the timer | |
65 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xffffffef; // IE interrupt enable |
|
65 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xffffffef; // IE interrupt enable | |
66 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any |
|
66 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any | |
67 | } |
|
67 | } | |
68 |
|
68 | |||
69 | void timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider) |
|
69 | void timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider) | |
70 | { |
|
70 | { | |
71 | /** This function sets the clock divider of a GPTIMER timer. |
|
71 | /** This function sets the clock divider of a GPTIMER timer. | |
72 | * |
|
72 | * | |
73 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. |
|
73 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. | |
74 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). |
|
74 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). | |
75 | * @param clock_divider is the divider of the 1 MHz clock that will be configured. |
|
75 | * @param clock_divider is the divider of the 1 MHz clock that will be configured. | |
76 | * |
|
76 | * | |
77 | */ |
|
77 | */ | |
78 |
|
78 | |||
79 | gptimer_regs->timer[timer].reload = clock_divider; // base clock frequency is 1 MHz |
|
79 | gptimer_regs->timer[timer].reload = clock_divider; // base clock frequency is 1 MHz | |
80 | } |
|
80 | } | |
81 |
|
81 | |||
82 | int send_console_outputs_on_apbuart_port( void ) // Send the console outputs on the apbuart port |
|
82 | int send_console_outputs_on_apbuart_port( void ) // Send the console outputs on the apbuart port | |
83 | { |
|
83 | { | |
84 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART; |
|
84 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART; | |
85 |
|
85 | |||
86 | apbuart_regs->ctrl = APBUART_CTRL_REG_MASK_TE; |
|
86 | apbuart_regs->ctrl = APBUART_CTRL_REG_MASK_TE; | |
87 |
|
87 | |||
88 | return 0; |
|
88 | return 0; | |
89 | } |
|
89 | } | |
90 |
|
90 | |||
91 | int enable_apbuart_transmitter( void ) // set the bit 1, TE Transmitter Enable to 1 in the APBUART control register |
|
91 | int enable_apbuart_transmitter( void ) // set the bit 1, TE Transmitter Enable to 1 in the APBUART control register | |
92 | { |
|
92 | { | |
93 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART; |
|
93 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART; | |
94 |
|
94 | |||
95 | apbuart_regs->ctrl = apbuart_regs->ctrl | APBUART_CTRL_REG_MASK_TE; |
|
95 | apbuart_regs->ctrl = apbuart_regs->ctrl | APBUART_CTRL_REG_MASK_TE; | |
96 |
|
96 | |||
97 | return 0; |
|
97 | return 0; | |
98 | } |
|
98 | } | |
99 |
|
99 | |||
100 | void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value) |
|
100 | void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value) | |
101 | { |
|
101 | { | |
102 | /** This function sets the scaler reload register of the apbuart module |
|
102 | /** This function sets the scaler reload register of the apbuart module | |
103 | * |
|
103 | * | |
104 | * @param regs is the address of the apbuart registers in memory |
|
104 | * @param regs is the address of the apbuart registers in memory | |
105 | * @param value is the value that will be stored in the scaler register |
|
105 | * @param value is the value that will be stored in the scaler register | |
106 | * |
|
106 | * | |
107 | * The value shall be set by the software to get data on the serial interface. |
|
107 | * The value shall be set by the software to get data on the serial interface. | |
108 | * |
|
108 | * | |
109 | */ |
|
109 | */ | |
110 |
|
110 | |||
111 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) regs; |
|
111 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) regs; | |
112 |
|
112 | |||
113 | apbuart_regs->scaler = value; |
|
113 | apbuart_regs->scaler = value; | |
114 | BOOT_PRINTF1("OK *** apbuart port scaler reload register set to 0x%x\n", value) |
|
114 | BOOT_PRINTF1("OK *** apbuart port scaler reload register set to 0x%x\n", value) | |
115 | } |
|
115 | } | |
116 |
|
116 | |||
117 | //************ |
|
117 | //************ | |
118 | // RTEMS TASKS |
|
118 | // RTEMS TASKS | |
119 |
|
119 | |||
120 | rtems_task stat_task(rtems_task_argument argument) |
|
120 | rtems_task stat_task(rtems_task_argument argument) | |
121 | { |
|
121 | { | |
122 | int i; |
|
122 | int i; | |
123 | int j; |
|
123 | int j; | |
124 | i = 0; |
|
124 | i = 0; | |
125 | j = 0; |
|
125 | j = 0; | |
126 | BOOT_PRINTF("in STAT *** \n") |
|
126 | BOOT_PRINTF("in STAT *** \n") | |
127 | while(1){ |
|
127 | while(1){ | |
128 | rtems_task_wake_after(1000); |
|
128 | rtems_task_wake_after(1000); | |
129 | PRINTF1("%d\n", j) |
|
129 | PRINTF1("%d\n", j) | |
130 | if (i == CPU_USAGE_REPORT_PERIOD) { |
|
130 | if (i == CPU_USAGE_REPORT_PERIOD) { | |
131 | // #ifdef PRINT_TASK_STATISTICS |
|
131 | // #ifdef PRINT_TASK_STATISTICS | |
132 | // rtems_cpu_usage_report(); |
|
132 | // rtems_cpu_usage_report(); | |
133 | // rtems_cpu_usage_reset(); |
|
133 | // rtems_cpu_usage_reset(); | |
134 | // #endif |
|
134 | // #endif | |
135 | i = 0; |
|
135 | i = 0; | |
136 | } |
|
136 | } | |
137 | else i++; |
|
137 | else i++; | |
138 | j++; |
|
138 | j++; | |
139 | } |
|
139 | } | |
140 | } |
|
140 | } | |
141 |
|
141 | |||
142 | rtems_task hous_task(rtems_task_argument argument) |
|
142 | rtems_task hous_task(rtems_task_argument argument) | |
143 | { |
|
143 | { | |
144 | rtems_status_code status; |
|
144 | rtems_status_code status; | |
145 | rtems_id queue_id; |
|
145 | rtems_id queue_id; | |
|
146 | rtems_rate_monotonic_period_status period_status; | |||
146 |
|
147 | |||
147 | status = get_message_queue_id_send( &queue_id ); |
|
148 | status = get_message_queue_id_send( &queue_id ); | |
148 | if (status != RTEMS_SUCCESSFUL) |
|
149 | if (status != RTEMS_SUCCESSFUL) | |
149 | { |
|
150 | { | |
150 | PRINTF1("in HOUS *** ERR get_message_queue_id_send %d\n", status) |
|
151 | PRINTF1("in HOUS *** ERR get_message_queue_id_send %d\n", status) | |
151 | } |
|
152 | } | |
152 |
|
153 | |||
153 | BOOT_PRINTF("in HOUS ***\n") |
|
154 | BOOT_PRINTF("in HOUS ***\n") | |
154 |
|
155 | |||
155 | if (rtems_rate_monotonic_ident( name_hk_rate_monotonic, &HK_id) != RTEMS_SUCCESSFUL) { |
|
156 | if (rtems_rate_monotonic_ident( name_hk_rate_monotonic, &HK_id) != RTEMS_SUCCESSFUL) { | |
156 | status = rtems_rate_monotonic_create( name_hk_rate_monotonic, &HK_id ); |
|
157 | status = rtems_rate_monotonic_create( name_hk_rate_monotonic, &HK_id ); | |
157 | if( status != RTEMS_SUCCESSFUL ) { |
|
158 | if( status != RTEMS_SUCCESSFUL ) { | |
158 | PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status ) |
|
159 | PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status ) | |
159 | } |
|
160 | } | |
160 | } |
|
161 | } | |
161 |
|
162 | |||
162 | housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
163 | housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; | |
163 | housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
164 | housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
164 | housekeeping_packet.reserved = DEFAULT_RESERVED; |
|
165 | housekeeping_packet.reserved = DEFAULT_RESERVED; | |
165 | housekeeping_packet.userApplication = CCSDS_USER_APP; |
|
166 | housekeeping_packet.userApplication = CCSDS_USER_APP; | |
166 | housekeeping_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_HK >> 8); |
|
167 | housekeeping_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_HK >> 8); | |
167 | housekeeping_packet.packetID[1] = (unsigned char) (TM_PACKET_ID_HK); |
|
168 | housekeeping_packet.packetID[1] = (unsigned char) (TM_PACKET_ID_HK); | |
168 | housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
169 | housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
169 | housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
170 | housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
170 | housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8); |
|
171 | housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8); | |
171 | housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK ); |
|
172 | housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK ); | |
172 | housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
173 | housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
173 | housekeeping_packet.serviceType = TM_TYPE_HK; |
|
174 | housekeeping_packet.serviceType = TM_TYPE_HK; | |
174 | housekeeping_packet.serviceSubType = TM_SUBTYPE_HK; |
|
175 | housekeeping_packet.serviceSubType = TM_SUBTYPE_HK; | |
175 | housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND; |
|
176 | housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND; | |
176 | housekeeping_packet.sid = SID_HK; |
|
177 | housekeeping_packet.sid = SID_HK; | |
177 |
|
178 | |||
178 | status = rtems_rate_monotonic_cancel(HK_id); |
|
179 | status = rtems_rate_monotonic_cancel(HK_id); | |
179 | if( status != RTEMS_SUCCESSFUL ) { |
|
180 | if( status != RTEMS_SUCCESSFUL ) { | |
180 | PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status ) |
|
181 | PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status ) | |
181 | } |
|
182 | } | |
182 | else { |
|
183 | else { | |
183 | DEBUG_PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n") |
|
184 | DEBUG_PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n") | |
184 | } |
|
185 | } | |
185 |
|
186 | |||
|
187 | // startup phase | |||
|
188 | status = rtems_rate_monotonic_period( HK_id, SY_LFR_TIME_SYN_TIMEOUT_in_ticks ); | |||
|
189 | status = rtems_rate_monotonic_get_status( HK_id, &period_status ); | |||
|
190 | DEBUG_PRINTF1("startup HK, HK_id status = %d\n", period_status.state) | |||
|
191 | while(period_status.state != RATE_MONOTONIC_EXPIRED ) // after SY_LFR_TIME_SYN_TIMEOUT ms, starts HK anyway | |||
|
192 | { | |||
|
193 | if ((time_management_regs->coarse_time & 0x80000000) == 0x00000000) // check time synchronization | |||
|
194 | { | |||
|
195 | break; // break if LFR is synchronized | |||
|
196 | } | |||
|
197 | else | |||
|
198 | { | |||
|
199 | status = rtems_rate_monotonic_get_status( HK_id, &period_status ); | |||
|
200 | sched_yield(); | |||
|
201 | } | |||
|
202 | } | |||
|
203 | status = rtems_rate_monotonic_cancel(HK_id); | |||
|
204 | DEBUG_PRINTF1("startup HK, HK_id status = %d\n", period_status.state) | |||
|
205 | ||||
186 | while(1){ // launch the rate monotonic task |
|
206 | while(1){ // launch the rate monotonic task | |
187 | status = rtems_rate_monotonic_period( HK_id, HK_PERIOD ); |
|
207 | status = rtems_rate_monotonic_period( HK_id, HK_PERIOD ); | |
188 | if ( status != RTEMS_SUCCESSFUL ) { |
|
208 | if ( status != RTEMS_SUCCESSFUL ) { | |
189 | PRINTF1( "in HOUS *** ERR period: %d\n", status); |
|
209 | PRINTF1( "in HOUS *** ERR period: %d\n", status); | |
190 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_6 ); |
|
210 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_6 ); | |
191 | } |
|
211 | } | |
192 | else { |
|
212 | else { | |
193 | increment_seq_counter( housekeeping_packet.packetSequenceControl ); |
|
213 | increment_seq_counter( housekeeping_packet.packetSequenceControl ); | |
194 | housekeeping_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
214 | housekeeping_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
195 | housekeeping_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
215 | housekeeping_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
196 | housekeeping_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
216 | housekeeping_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
197 | housekeeping_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
217 | housekeeping_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); | |
198 | housekeeping_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
218 | housekeeping_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
199 | housekeeping_packet.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
219 | housekeeping_packet.time[5] = (unsigned char) (time_management_regs->fine_time); | |
200 |
|
220 | |||
201 | spacewire_update_statistics(); |
|
221 | spacewire_update_statistics(); | |
202 |
|
222 | |||
203 | // SEND PACKET |
|
223 | // SEND PACKET | |
204 | status = rtems_message_queue_send( queue_id, &housekeeping_packet, |
|
224 | status = rtems_message_queue_send( queue_id, &housekeeping_packet, | |
205 | PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES); |
|
225 | PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES); | |
206 | if (status != RTEMS_SUCCESSFUL) { |
|
226 | if (status != RTEMS_SUCCESSFUL) { | |
207 | PRINTF1("in HOUS *** ERR send: %d\n", status) |
|
227 | PRINTF1("in HOUS *** ERR send: %d\n", status) | |
208 | } |
|
228 | } | |
209 | } |
|
229 | } | |
210 | } |
|
230 | } | |
211 |
|
231 | |||
212 | PRINTF("in HOUS *** deleting task\n") |
|
232 | PRINTF("in HOUS *** deleting task\n") | |
213 |
|
233 | |||
214 | status = rtems_task_delete( RTEMS_SELF ); // should not return |
|
234 | status = rtems_task_delete( RTEMS_SELF ); // should not return | |
215 | printf( "rtems_task_delete returned with status of %d.\n", status ); |
|
235 | printf( "rtems_task_delete returned with status of %d.\n", status ); | |
216 | return; |
|
236 | return; | |
217 | } |
|
237 | } | |
218 |
|
238 | |||
219 | rtems_task dumb_task( rtems_task_argument unused ) |
|
239 | rtems_task dumb_task( rtems_task_argument unused ) | |
220 | { |
|
240 | { | |
221 | /** This RTEMS taks is used to print messages without affecting the general behaviour of the software. |
|
241 | /** This RTEMS taks is used to print messages without affecting the general behaviour of the software. | |
222 | * |
|
242 | * | |
223 | * @param unused is the starting argument of the RTEMS task |
|
243 | * @param unused is the starting argument of the RTEMS task | |
224 | * |
|
244 | * | |
225 | * The DUMB taks waits for RTEMS events and print messages depending on the incoming events. |
|
245 | * The DUMB taks waits for RTEMS events and print messages depending on the incoming events. | |
226 | * |
|
246 | * | |
227 | */ |
|
247 | */ | |
228 |
|
248 | |||
229 | unsigned int i; |
|
249 | unsigned int i; | |
230 | unsigned int intEventOut; |
|
250 | unsigned int intEventOut; | |
231 | unsigned int coarse_time = 0; |
|
251 | unsigned int coarse_time = 0; | |
232 | unsigned int fine_time = 0; |
|
252 | unsigned int fine_time = 0; | |
233 | rtems_event_set event_out; |
|
253 | rtems_event_set event_out; | |
234 |
|
254 | |||
235 | char *DumbMessages[9] = {"in DUMB *** default", // RTEMS_EVENT_0 |
|
255 | char *DumbMessages[9] = {"in DUMB *** default", // RTEMS_EVENT_0 | |
236 | "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1 |
|
256 | "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1 | |
237 | "in DUMB *** waveforms_isr", // RTEMS_EVENT_2 |
|
257 | "in DUMB *** waveforms_isr", // RTEMS_EVENT_2 | |
238 | "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3 |
|
258 | "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3 | |
239 | "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4 |
|
259 | "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4 | |
240 | "in DUMB *** waveforms_simulator_isr", // RTEMS_EVENT_5 |
|
260 | "in DUMB *** waveforms_simulator_isr", // RTEMS_EVENT_5 | |
241 | "ERR HK", // RTEMS_EVENT_6 |
|
261 | "ERR HK", // RTEMS_EVENT_6 | |
242 | "ready for dump", // RTEMS_EVENT_7 |
|
262 | "ready for dump", // RTEMS_EVENT_7 | |
243 | "in DUMB *** spectral_matrices_isr" // RTEMS_EVENT_8 |
|
263 | "in DUMB *** spectral_matrices_isr" // RTEMS_EVENT_8 | |
244 | }; |
|
264 | }; | |
245 |
|
265 | |||
246 | BOOT_PRINTF("in DUMB *** \n") |
|
266 | BOOT_PRINTF("in DUMB *** \n") | |
247 |
|
267 | |||
248 | while(1){ |
|
268 | while(1){ | |
249 | rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3 |
|
269 | rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3 | |
250 | | RTEMS_EVENT_4 | RTEMS_EVENT_5 | RTEMS_EVENT_6 | RTEMS_EVENT_7 |
|
270 | | RTEMS_EVENT_4 | RTEMS_EVENT_5 | RTEMS_EVENT_6 | RTEMS_EVENT_7 | |
251 | | RTEMS_EVENT_8, |
|
271 | | RTEMS_EVENT_8, | |
252 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT |
|
272 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT | |
253 | intEventOut = (unsigned int) event_out; |
|
273 | intEventOut = (unsigned int) event_out; | |
254 | for ( i=0; i<32; i++) |
|
274 | for ( i=0; i<32; i++) | |
255 | { |
|
275 | { | |
256 | if ( ((intEventOut >> i) & 0x0001) != 0) |
|
276 | if ( ((intEventOut >> i) & 0x0001) != 0) | |
257 | { |
|
277 | { | |
258 | coarse_time = time_management_regs->coarse_time; |
|
278 | coarse_time = time_management_regs->coarse_time; | |
259 | fine_time = time_management_regs->fine_time; |
|
279 | fine_time = time_management_regs->fine_time; | |
260 | printf("in DUMB *** coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]); |
|
280 | printf("in DUMB *** coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]); | |
261 | } |
|
281 | } | |
262 | } |
|
282 | } | |
263 | } |
|
283 | } | |
264 | } |
|
284 | } | |
265 |
|
285 | |||
266 | //***************************** |
|
286 | //***************************** | |
267 | // init housekeeping parameters |
|
287 | // init housekeeping parameters | |
268 |
|
288 | |||
269 | void init_housekeeping_parameters( void ) |
|
289 | void init_housekeeping_parameters( void ) | |
270 | { |
|
290 | { | |
271 | /** This function initialize the housekeeping_packet global variable with default values. |
|
291 | /** This function initialize the housekeeping_packet global variable with default values. | |
272 | * |
|
292 | * | |
273 | */ |
|
293 | */ | |
274 |
|
294 | |||
275 | unsigned int i = 0; |
|
295 | unsigned int i = 0; | |
276 | unsigned char *parameters; |
|
296 | unsigned char *parameters; | |
277 |
|
297 | |||
278 | parameters = (unsigned char*) &housekeeping_packet.lfr_status_word; |
|
298 | parameters = (unsigned char*) &housekeeping_packet.lfr_status_word; | |
279 | for(i = 0; i< SIZE_HK_PARAMETERS; i++) |
|
299 | for(i = 0; i< SIZE_HK_PARAMETERS; i++) | |
280 | { |
|
300 | { | |
281 | parameters[i] = 0x00; |
|
301 | parameters[i] = 0x00; | |
282 | } |
|
302 | } | |
283 | // init status word |
|
303 | // init status word | |
284 | housekeeping_packet.lfr_status_word[0] = DEFAULT_STATUS_WORD_BYTE0; |
|
304 | housekeeping_packet.lfr_status_word[0] = DEFAULT_STATUS_WORD_BYTE0; | |
285 | housekeeping_packet.lfr_status_word[1] = DEFAULT_STATUS_WORD_BYTE1; |
|
305 | housekeeping_packet.lfr_status_word[1] = DEFAULT_STATUS_WORD_BYTE1; | |
286 | // init software version |
|
306 | // init software version | |
287 | housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1; |
|
307 | housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1; | |
288 | housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2; |
|
308 | housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2; | |
289 | housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3; |
|
309 | housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3; | |
290 | housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4; |
|
310 | housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4; | |
291 | // init fpga version |
|
311 | // init fpga version | |
292 | parameters = (unsigned char *) (REGS_ADDR_WAVEFORM_PICKER + 0xd0); |
|
312 | parameters = (unsigned char *) (REGS_ADDR_WAVEFORM_PICKER + 0xd0); | |
293 | housekeeping_packet.lfr_fpga_version[0] = parameters[1]; // n1 |
|
313 | housekeeping_packet.lfr_fpga_version[0] = parameters[1]; // n1 | |
294 | housekeeping_packet.lfr_fpga_version[1] = parameters[2]; // n2 |
|
314 | housekeeping_packet.lfr_fpga_version[1] = parameters[2]; // n2 | |
295 | housekeeping_packet.lfr_fpga_version[2] = parameters[3]; // n3 |
|
315 | housekeeping_packet.lfr_fpga_version[2] = parameters[3]; // n3 | |
296 | } |
|
316 | } | |
297 |
|
317 | |||
298 | void increment_seq_counter( unsigned char *packet_sequence_control) |
|
318 | void increment_seq_counter( unsigned char *packet_sequence_control) | |
299 | { |
|
319 | { | |
300 | /** This function increment the sequence counter psased in argument. |
|
320 | /** This function increment the sequence counter psased in argument. | |
301 | * |
|
321 | * | |
302 | * The increment does not affect the grouping flag. In case of an overflow, the counter is reset to 0. |
|
322 | * The increment does not affect the grouping flag. In case of an overflow, the counter is reset to 0. | |
303 | * |
|
323 | * | |
304 | */ |
|
324 | */ | |
305 |
|
325 | |||
306 | unsigned short sequence_cnt; |
|
326 | unsigned short sequence_cnt; | |
307 | unsigned short segmentation_grouping_flag; |
|
327 | unsigned short segmentation_grouping_flag; | |
308 | unsigned short new_packet_sequence_control; |
|
328 | unsigned short new_packet_sequence_control; | |
309 |
|
329 | |||
310 | segmentation_grouping_flag = (unsigned short) ( (packet_sequence_control[0] & 0xc0) << 8 ); // keep bits 7 downto 6 |
|
330 | segmentation_grouping_flag = (unsigned short) ( (packet_sequence_control[0] & 0xc0) << 8 ); // keep bits 7 downto 6 | |
311 | sequence_cnt = (unsigned short) ( |
|
331 | sequence_cnt = (unsigned short) ( | |
312 | ( (packet_sequence_control[0] & 0x3f) << 8 ) // keep bits 5 downto 0 |
|
332 | ( (packet_sequence_control[0] & 0x3f) << 8 ) // keep bits 5 downto 0 | |
313 | + packet_sequence_control[1] |
|
333 | + packet_sequence_control[1] | |
314 | ); |
|
334 | ); | |
315 |
|
335 | |||
316 | if ( sequence_cnt < SEQ_CNT_MAX) |
|
336 | if ( sequence_cnt < SEQ_CNT_MAX) | |
317 | { |
|
337 | { | |
318 | sequence_cnt = sequence_cnt + 1; |
|
338 | sequence_cnt = sequence_cnt + 1; | |
319 | } |
|
339 | } | |
320 | else |
|
340 | else | |
321 | { |
|
341 | { | |
322 | sequence_cnt = 0; |
|
342 | sequence_cnt = 0; | |
323 | } |
|
343 | } | |
324 |
|
344 | |||
325 | new_packet_sequence_control = segmentation_grouping_flag | sequence_cnt ; |
|
345 | new_packet_sequence_control = segmentation_grouping_flag | sequence_cnt ; | |
326 |
|
346 | |||
327 | packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8); |
|
347 | packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8); | |
328 | packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control ); |
|
348 | packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control ); | |
329 | } |
|
349 | } | |
330 |
|
350 | |||
331 | void getTime( unsigned char *time) |
|
351 | void getTime( unsigned char *time) | |
332 | { |
|
352 | { | |
333 | /** This function write the current local time in the time buffer passed in argument. |
|
353 | /** This function write the current local time in the time buffer passed in argument. | |
334 | * |
|
354 | * | |
335 | */ |
|
355 | */ | |
336 |
|
356 | |||
337 | time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
357 | time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
338 | time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
358 | time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
339 | time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
359 | time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
340 | time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
360 | time[3] = (unsigned char) (time_management_regs->coarse_time); | |
341 | time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
361 | time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
342 | time[5] = (unsigned char) (time_management_regs->fine_time); |
|
362 | time[5] = (unsigned char) (time_management_regs->fine_time); | |
343 | } |
|
363 | } | |
344 |
|
364 |
@@ -1,736 +1,739 | |||||
1 | /** Functions related to data processing. |
|
1 | /** Functions related to data processing. | |
2 | * |
|
2 | * | |
3 | * @file |
|
3 | * @file | |
4 | * @author P. LEROY |
|
4 | * @author P. LEROY | |
5 | * |
|
5 | * | |
6 | * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation. |
|
6 | * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation. | |
7 | * |
|
7 | * | |
8 | */ |
|
8 | */ | |
9 |
|
9 | |||
10 | #include <fsw_processing.h> |
|
10 | #include <fsw_processing.h> | |
11 |
|
11 | |||
12 | #include "fsw_processing_globals.c" |
|
12 | #include "fsw_processing_globals.c" | |
13 |
|
13 | |||
14 | //************************ |
|
14 | //************************ | |
15 | // spectral matrices rings |
|
15 | // spectral matrices rings | |
16 | ring_node sm_ring_f0[NB_RING_NODES_ASM_F0]; |
|
16 | ring_node sm_ring_f0[NB_RING_NODES_ASM_F0]; | |
17 | ring_node sm_ring_f1[NB_RING_NODES_ASM_F1]; |
|
17 | ring_node sm_ring_f1[NB_RING_NODES_ASM_F1]; | |
18 | ring_node sm_ring_f2[NB_RING_NODES_ASM_F2]; |
|
18 | ring_node sm_ring_f2[NB_RING_NODES_ASM_F2]; | |
19 | ring_node *current_ring_node_sm_f0; |
|
19 | ring_node *current_ring_node_sm_f0; | |
20 | ring_node *ring_node_for_averaging_sm_f0; |
|
20 | ring_node *ring_node_for_averaging_sm_f0; | |
21 | ring_node *current_ring_node_sm_f1; |
|
21 | ring_node *current_ring_node_sm_f1; | |
22 | ring_node *current_ring_node_sm_f2; |
|
22 | ring_node *current_ring_node_sm_f2; | |
23 |
|
23 | |||
24 | BP1_t data_BP1[ NB_BINS_COMPRESSED_SM_F0 ]; |
|
24 | BP1_t data_BP1[ NB_BINS_COMPRESSED_SM_F0 ]; | |
25 | float averaged_sm_f0 [ TIME_OFFSET + TOTAL_SIZE_SM ]; |
|
25 | float averaged_sm_f0 [ TIME_OFFSET + TOTAL_SIZE_SM ]; | |
26 | float averaged_sm_f0_reorganized[ TIME_OFFSET + TOTAL_SIZE_SM ]; |
|
26 | float averaged_sm_f0_reorganized[ TIME_OFFSET + TOTAL_SIZE_SM ]; | |
27 | char averaged_sm_f0_char [ TIME_OFFSET_IN_BYTES + TOTAL_SIZE_SM * 2 ]; |
|
27 | char averaged_sm_f0_char [ TIME_OFFSET_IN_BYTES + TOTAL_SIZE_SM * 2 ]; | |
28 | float compressed_sm_f0 [ TOTAL_SIZE_COMPRESSED_ASM_F0 ]; |
|
28 | float compressed_sm_f0 [ TOTAL_SIZE_COMPRESSED_ASM_F0 ]; | |
29 |
|
29 | |||
30 | unsigned int nb_sm_f0; |
|
30 | unsigned int nb_sm_f0; | |
31 |
|
31 | |||
32 | void init_sm_rings( void ) |
|
32 | void init_sm_rings( void ) | |
33 | { |
|
33 | { | |
34 | unsigned char i; |
|
34 | unsigned char i; | |
35 |
|
35 | |||
36 | // F0 RING |
|
36 | // F0 RING | |
37 | sm_ring_f0[0].next = (ring_node*) &sm_ring_f0[1]; |
|
37 | sm_ring_f0[0].next = (ring_node*) &sm_ring_f0[1]; | |
38 | sm_ring_f0[0].previous = (ring_node*) &sm_ring_f0[NB_RING_NODES_ASM_F0-1]; |
|
38 | sm_ring_f0[0].previous = (ring_node*) &sm_ring_f0[NB_RING_NODES_ASM_F0-1]; | |
39 | sm_ring_f0[0].buffer_address = (int) &sm_f0[0][0]; |
|
39 | sm_ring_f0[0].buffer_address = (int) &sm_f0[0][0]; | |
40 |
|
40 | |||
41 | sm_ring_f0[NB_RING_NODES_ASM_F0-1].next = (ring_node*) &sm_ring_f0[0]; |
|
41 | sm_ring_f0[NB_RING_NODES_ASM_F0-1].next = (ring_node*) &sm_ring_f0[0]; | |
42 | sm_ring_f0[NB_RING_NODES_ASM_F0-1].previous = (ring_node*) &sm_ring_f0[NB_RING_NODES_ASM_F0-2]; |
|
42 | sm_ring_f0[NB_RING_NODES_ASM_F0-1].previous = (ring_node*) &sm_ring_f0[NB_RING_NODES_ASM_F0-2]; | |
43 | sm_ring_f0[NB_RING_NODES_ASM_F0-1].buffer_address = (int) &sm_f0[NB_RING_NODES_ASM_F0-1][0]; |
|
43 | sm_ring_f0[NB_RING_NODES_ASM_F0-1].buffer_address = (int) &sm_f0[NB_RING_NODES_ASM_F0-1][0]; | |
44 |
|
44 | |||
45 | for(i=1; i<NB_RING_NODES_ASM_F0-1; i++) |
|
45 | for(i=1; i<NB_RING_NODES_ASM_F0-1; i++) | |
46 | { |
|
46 | { | |
47 | sm_ring_f0[i].next = (ring_node*) &sm_ring_f0[i+1]; |
|
47 | sm_ring_f0[i].next = (ring_node*) &sm_ring_f0[i+1]; | |
48 | sm_ring_f0[i].previous = (ring_node*) &sm_ring_f0[i-1]; |
|
48 | sm_ring_f0[i].previous = (ring_node*) &sm_ring_f0[i-1]; | |
49 | sm_ring_f0[i].buffer_address = (int) &sm_f0[i][0]; |
|
49 | sm_ring_f0[i].buffer_address = (int) &sm_f0[i][0]; | |
50 | } |
|
50 | } | |
51 |
|
51 | |||
52 | DEBUG_PRINTF1("asm_ring_f0 @%x\n", (unsigned int) sm_ring_f0) |
|
52 | DEBUG_PRINTF1("asm_ring_f0 @%x\n", (unsigned int) sm_ring_f0) | |
53 |
|
53 | |||
54 | spectral_matrix_regs->matrixF0_Address0 = sm_ring_f0[0].buffer_address; |
|
54 | spectral_matrix_regs->matrixF0_Address0 = sm_ring_f0[0].buffer_address; | |
55 | DEBUG_PRINTF1("spectral_matrix_regs->matrixF0_Address0 @%x\n", spectral_matrix_regs->matrixF0_Address0) |
|
55 | DEBUG_PRINTF1("spectral_matrix_regs->matrixF0_Address0 @%x\n", spectral_matrix_regs->matrixF0_Address0) | |
56 | } |
|
56 | } | |
57 |
|
57 | |||
58 | void reset_current_sm_ring_nodes( void ) |
|
58 | void reset_current_sm_ring_nodes( void ) | |
59 | { |
|
59 | { | |
60 | current_ring_node_sm_f0 = sm_ring_f0; |
|
60 | current_ring_node_sm_f0 = sm_ring_f0; | |
61 | ring_node_for_averaging_sm_f0 = sm_ring_f0; |
|
61 | ring_node_for_averaging_sm_f0 = sm_ring_f0; | |
62 | } |
|
62 | } | |
63 |
|
63 | |||
64 | //*********************************************************** |
|
64 | //*********************************************************** | |
65 | // Interrupt Service Routine for spectral matrices processing |
|
65 | // Interrupt Service Routine for spectral matrices processing | |
66 | void reset_nb_sm_f0( void ) |
|
66 | void reset_nb_sm_f0( void ) | |
67 | { |
|
67 | { | |
68 | nb_sm_f0 = 0; |
|
68 | nb_sm_f0 = 0; | |
69 | } |
|
69 | } | |
70 |
|
70 | |||
71 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ) |
|
71 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ) | |
72 | { |
|
72 | { | |
73 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); |
|
73 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); | |
74 |
|
74 | |||
75 | if ( (spectral_matrix_regs->status & 0x1) == 0x01) |
|
75 | if ( (spectral_matrix_regs->status & 0x1) == 0x01) | |
76 | { |
|
76 | { | |
77 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; |
|
77 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; | |
78 | spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address; |
|
78 | spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address; | |
79 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe; // 1110 |
|
79 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe; // 1110 | |
80 | nb_sm_f0 = nb_sm_f0 + 1; |
|
80 | nb_sm_f0 = nb_sm_f0 + 1; | |
81 | } |
|
81 | } | |
82 | else if ( (spectral_matrix_regs->status & 0x2) == 0x02) |
|
82 | else if ( (spectral_matrix_regs->status & 0x2) == 0x02) | |
83 | { |
|
83 | { | |
84 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; |
|
84 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; | |
85 | spectral_matrix_regs->matrixFO_Address1 = current_ring_node_sm_f0->buffer_address; |
|
85 | spectral_matrix_regs->matrixFO_Address1 = current_ring_node_sm_f0->buffer_address; | |
86 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd; // 1101 |
|
86 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd; // 1101 | |
87 | nb_sm_f0 = nb_sm_f0 + 1; |
|
87 | nb_sm_f0 = nb_sm_f0 + 1; | |
88 | } |
|
88 | } | |
89 |
|
89 | |||
90 | if ( (spectral_matrix_regs->status & 0x30) != 0x00) |
|
90 | if ( (spectral_matrix_regs->status & 0x30) != 0x00) | |
91 | { |
|
91 | { | |
92 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); |
|
92 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); | |
93 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xffffffcf; // 1100 1111 |
|
93 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xffffffcf; // 1100 1111 | |
94 | } |
|
94 | } | |
95 |
|
95 | |||
96 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff3; // 0011 |
|
96 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff3; // 0011 | |
97 |
|
97 | |||
98 | if (nb_sm_f0 == (NB_SM_TO_RECEIVE_BEFORE_AVF0-1) ) |
|
98 | if (nb_sm_f0 == (NB_SM_TO_RECEIVE_BEFORE_AVF0-1) ) | |
99 | { |
|
99 | { | |
100 | ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0; |
|
100 | ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0; | |
101 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
101 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |
102 | { |
|
102 | { | |
103 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
103 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |
104 | } |
|
104 | } | |
105 | nb_sm_f0 = 0; |
|
105 | nb_sm_f0 = 0; | |
106 | } |
|
106 | } | |
107 | else |
|
107 | else | |
108 | { |
|
108 | { | |
109 | nb_sm_f0 = nb_sm_f0 + 1; |
|
109 | nb_sm_f0 = nb_sm_f0 + 1; | |
110 | } |
|
110 | } | |
111 | } |
|
111 | } | |
112 |
|
112 | |||
113 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ) |
|
113 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ) | |
114 | { |
|
114 | { | |
115 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); |
|
115 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); | |
116 |
|
116 | |||
117 | if ( (spectral_matrix_regs->status & 0x1) == 0x01) |
|
117 | if ( (spectral_matrix_regs->status & 0x1) == 0x01) | |
118 | { |
|
118 | { | |
119 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; |
|
119 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; | |
120 | spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address; |
|
120 | spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address; | |
121 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe; // 1110 |
|
121 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe; // 1110 | |
122 | nb_sm_f0 = nb_sm_f0 + 1; |
|
122 | nb_sm_f0 = nb_sm_f0 + 1; | |
123 | } |
|
123 | } | |
124 | else if ( (spectral_matrix_regs->status & 0x2) == 0x02) |
|
124 | else if ( (spectral_matrix_regs->status & 0x2) == 0x02) | |
125 | { |
|
125 | { | |
126 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; |
|
126 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; | |
127 | spectral_matrix_regs->matrixFO_Address1 = current_ring_node_sm_f0->buffer_address; |
|
127 | spectral_matrix_regs->matrixFO_Address1 = current_ring_node_sm_f0->buffer_address; | |
128 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd; // 1101 |
|
128 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd; // 1101 | |
129 | nb_sm_f0 = nb_sm_f0 + 1; |
|
129 | nb_sm_f0 = nb_sm_f0 + 1; | |
130 | } |
|
130 | } | |
131 |
|
131 | |||
132 | if ( (spectral_matrix_regs->status & 0x30) != 0x00) |
|
132 | if ( (spectral_matrix_regs->status & 0x30) != 0x00) | |
133 | { |
|
133 | { | |
134 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); |
|
134 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); | |
135 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xffffffcf; // 1100 1111 |
|
135 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xffffffcf; // 1100 1111 | |
136 | } |
|
136 | } | |
137 |
|
137 | |||
138 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff3; // 0011 |
|
138 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff3; // 0011 | |
139 |
|
139 | |||
140 | if (nb_sm_f0 == (NB_SM_TO_RECEIVE_BEFORE_AVF0-1) ) |
|
140 | if (nb_sm_f0 == (NB_SM_TO_RECEIVE_BEFORE_AVF0-1) ) | |
141 | { |
|
141 | { | |
142 | ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0; |
|
142 | ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0; | |
143 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
143 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |
144 | { |
|
144 | { | |
145 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
145 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |
146 | } |
|
146 | } | |
147 | nb_sm_f0 = 0; |
|
147 | nb_sm_f0 = 0; | |
148 | } |
|
148 | } | |
149 | else |
|
149 | else | |
150 | { |
|
150 | { | |
151 | nb_sm_f0 = nb_sm_f0 + 1; |
|
151 | nb_sm_f0 = nb_sm_f0 + 1; | |
152 | } |
|
152 | } | |
153 | } |
|
153 | } | |
154 |
|
154 | |||
155 | //************ |
|
155 | //************ | |
156 | // RTEMS TASKS |
|
156 | // RTEMS TASKS | |
157 |
|
157 | |||
158 | rtems_task smiq_task(rtems_task_argument argument) // process the Spectral Matrices IRQ |
|
158 | rtems_task smiq_task(rtems_task_argument argument) // process the Spectral Matrices IRQ | |
159 | { |
|
159 | { | |
160 | rtems_event_set event_out; |
|
160 | rtems_event_set event_out; | |
161 |
|
161 | |||
162 | BOOT_PRINTF("in SMIQ *** \n") |
|
162 | BOOT_PRINTF("in SMIQ *** \n") | |
163 |
|
163 | |||
164 | while(1){ |
|
164 | while(1){ | |
165 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
165 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 | |
166 | } |
|
166 | } | |
167 | } |
|
167 | } | |
168 |
|
168 | |||
169 | rtems_task avf0_task(rtems_task_argument argument) |
|
169 | rtems_task avf0_task(rtems_task_argument argument) | |
170 | { |
|
170 | { | |
171 | int i; |
|
171 | int i; | |
172 | static int nb_average; |
|
172 | static int nb_average; | |
173 | rtems_event_set event_out; |
|
173 | rtems_event_set event_out; | |
174 | rtems_status_code status; |
|
174 | rtems_status_code status; | |
175 | ring_node *ring_node_tab[8]; |
|
175 | ring_node *ring_node_tab[8]; | |
176 |
|
176 | |||
177 | nb_average = 0; |
|
177 | nb_average = 0; | |
178 |
|
178 | |||
179 | BOOT_PRINTF("in AVFO *** \n") |
|
179 | BOOT_PRINTF("in AVFO *** \n") | |
180 |
|
180 | |||
181 | while(1){ |
|
181 | while(1){ | |
182 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
182 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 | |
183 | ring_node_tab[NB_SM_TO_RECEIVE_BEFORE_AVF0-1] = ring_node_for_averaging_sm_f0; |
|
183 | ring_node_tab[NB_SM_TO_RECEIVE_BEFORE_AVF0-1] = ring_node_for_averaging_sm_f0; | |
184 | for (i=2; i<NB_SM_TO_RECEIVE_BEFORE_AVF0+1; i++) |
|
184 | for (i=2; i<NB_SM_TO_RECEIVE_BEFORE_AVF0+1; i++) | |
185 | { |
|
185 | { | |
186 | ring_node_for_averaging_sm_f0 = ring_node_for_averaging_sm_f0->previous; |
|
186 | ring_node_for_averaging_sm_f0 = ring_node_for_averaging_sm_f0->previous; | |
187 | ring_node_tab[NB_SM_TO_RECEIVE_BEFORE_AVF0-i] = ring_node_for_averaging_sm_f0; |
|
187 | ring_node_tab[NB_SM_TO_RECEIVE_BEFORE_AVF0-i] = ring_node_for_averaging_sm_f0; | |
188 | } |
|
188 | } | |
|
189 | ||||
|
190 | averaged_sm_f0[0] = ( (int *) (ring_node_tab[7]->buffer_address) ) [0]; | |||
|
191 | averaged_sm_f0[1] = ( (int *) (ring_node_tab[7]->buffer_address) ) [1]; | |||
189 | for(i=0; i<TOTAL_SIZE_SM; i++) |
|
192 | for(i=0; i<TOTAL_SIZE_SM; i++) | |
190 | { |
|
193 | { | |
191 | averaged_sm_f0[i] = ( (int *) (ring_node_tab[0]->buffer_address) ) [i + TIME_OFFSET] |
|
194 | averaged_sm_f0[i] = ( (int *) (ring_node_tab[0]->buffer_address) ) [i + TIME_OFFSET] | |
192 | + ( (int *) (ring_node_tab[1]->buffer_address) ) [i + TIME_OFFSET] |
|
195 | + ( (int *) (ring_node_tab[1]->buffer_address) ) [i + TIME_OFFSET] | |
193 | + ( (int *) (ring_node_tab[2]->buffer_address) ) [i + TIME_OFFSET] |
|
196 | + ( (int *) (ring_node_tab[2]->buffer_address) ) [i + TIME_OFFSET] | |
194 | + ( (int *) (ring_node_tab[3]->buffer_address) ) [i + TIME_OFFSET] |
|
197 | + ( (int *) (ring_node_tab[3]->buffer_address) ) [i + TIME_OFFSET] | |
195 | + ( (int *) (ring_node_tab[4]->buffer_address) ) [i + TIME_OFFSET] |
|
198 | + ( (int *) (ring_node_tab[4]->buffer_address) ) [i + TIME_OFFSET] | |
196 | + ( (int *) (ring_node_tab[5]->buffer_address) ) [i + TIME_OFFSET] |
|
199 | + ( (int *) (ring_node_tab[5]->buffer_address) ) [i + TIME_OFFSET] | |
197 | + ( (int *) (ring_node_tab[6]->buffer_address) ) [i + TIME_OFFSET] |
|
200 | + ( (int *) (ring_node_tab[6]->buffer_address) ) [i + TIME_OFFSET] | |
198 | + ( (int *) (ring_node_tab[7]->buffer_address) ) [i + TIME_OFFSET]; |
|
201 | + ( (int *) (ring_node_tab[7]->buffer_address) ) [i + TIME_OFFSET]; | |
199 | } |
|
202 | } | |
200 |
|
203 | |||
201 | nb_average = nb_average + NB_SM_TO_RECEIVE_BEFORE_AVF0; |
|
204 | nb_average = nb_average + NB_SM_TO_RECEIVE_BEFORE_AVF0; | |
202 | if (nb_average == NB_AVERAGE_NORMAL_f0) { |
|
205 | if (nb_average == NB_AVERAGE_NORMAL_f0) { | |
203 | nb_average = 0; |
|
206 | nb_average = 0; | |
204 | status = rtems_event_send( Task_id[TASKID_MATR], RTEMS_EVENT_0 ); // sending an event to the task 7, BPF0 |
|
207 | status = rtems_event_send( Task_id[TASKID_MATR], RTEMS_EVENT_0 ); // sending an event to the task 7, BPF0 | |
205 | if (status != RTEMS_SUCCESSFUL) { |
|
208 | if (status != RTEMS_SUCCESSFUL) { | |
206 | printf("in AVF0 *** Error sending RTEMS_EVENT_0, code %d\n", status); |
|
209 | printf("in AVF0 *** Error sending RTEMS_EVENT_0, code %d\n", status); | |
207 | } |
|
210 | } | |
208 | } |
|
211 | } | |
209 | } |
|
212 | } | |
210 | } |
|
213 | } | |
211 |
|
214 | |||
212 | rtems_task matr_task(rtems_task_argument argument) |
|
215 | rtems_task matr_task(rtems_task_argument argument) | |
213 | { |
|
216 | { | |
214 | spw_ioctl_pkt_send spw_ioctl_send_ASM; |
|
217 | spw_ioctl_pkt_send spw_ioctl_send_ASM; | |
215 | rtems_event_set event_out; |
|
218 | rtems_event_set event_out; | |
216 | rtems_status_code status; |
|
219 | rtems_status_code status; | |
217 | rtems_id queue_id; |
|
220 | rtems_id queue_id; | |
218 | Header_TM_LFR_SCIENCE_ASM_t headerASM; |
|
221 | Header_TM_LFR_SCIENCE_ASM_t headerASM; | |
219 |
|
222 | |||
220 | init_header_asm( &headerASM ); |
|
223 | init_header_asm( &headerASM ); | |
221 |
|
224 | |||
222 | status = get_message_queue_id_send( &queue_id ); |
|
225 | status = get_message_queue_id_send( &queue_id ); | |
223 | if (status != RTEMS_SUCCESSFUL) |
|
226 | if (status != RTEMS_SUCCESSFUL) | |
224 | { |
|
227 | { | |
225 | PRINTF1("in MATR *** ERR get_message_queue_id_send %d\n", status) |
|
228 | PRINTF1("in MATR *** ERR get_message_queue_id_send %d\n", status) | |
226 | } |
|
229 | } | |
227 |
|
230 | |||
228 | BOOT_PRINTF("in MATR *** \n") |
|
231 | BOOT_PRINTF("in MATR *** \n") | |
229 |
|
232 | |||
230 | fill_averaged_spectral_matrix( ); |
|
233 | fill_averaged_spectral_matrix( ); | |
231 |
|
234 | |||
232 | while(1){ |
|
235 | while(1){ | |
233 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
236 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 | |
234 | // 1) compress the matrix for Basic Parameters calculation |
|
237 | // 1) compress the matrix for Basic Parameters calculation | |
235 | ASM_compress( averaged_sm_f0, 0, compressed_sm_f0 ); |
|
238 | ASM_compress( averaged_sm_f0, 0, compressed_sm_f0 ); | |
236 | // 2) |
|
239 | // 2) | |
237 | //BP1_set(compressed_sm_f0, NB_BINS_COMPRESSED_SM_F0, LFR_BP1_F0); |
|
240 | //BP1_set(compressed_sm_f0, NB_BINS_COMPRESSED_SM_F0, LFR_BP1_F0); | |
238 | // 3) convert the float array in a char array |
|
241 | // 3) convert the float array in a char array | |
239 | ASM_reorganize( averaged_sm_f0, averaged_sm_f0_reorganized ); |
|
242 | ASM_reorganize( averaged_sm_f0, averaged_sm_f0_reorganized ); | |
240 | ASM_convert( averaged_sm_f0_reorganized, averaged_sm_f0_char); |
|
243 | ASM_convert( averaged_sm_f0_reorganized, averaged_sm_f0_char); | |
241 | // 4) send the spectral matrix packets |
|
244 | // 4) send the spectral matrix packets | |
242 | ASM_send( &headerASM, averaged_sm_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id); |
|
245 | ASM_send( &headerASM, averaged_sm_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id); | |
243 | } |
|
246 | } | |
244 | } |
|
247 | } | |
245 |
|
248 | |||
246 | //***************************** |
|
249 | //***************************** | |
247 | // Spectral matrices processing |
|
250 | // Spectral matrices processing | |
248 |
|
251 | |||
249 | void matrix_reset(volatile float *averaged_spec_mat) |
|
252 | void matrix_reset(volatile float *averaged_spec_mat) | |
250 | { |
|
253 | { | |
251 | int i; |
|
254 | int i; | |
252 | for(i=0; i<TOTAL_SIZE_SM; i++){ |
|
255 | for(i=0; i<TOTAL_SIZE_SM; i++){ | |
253 | averaged_spec_mat[i] = 0; |
|
256 | averaged_spec_mat[i] = 0; | |
254 | } |
|
257 | } | |
255 | } |
|
258 | } | |
256 |
|
259 | |||
257 | void ASM_reorganize( float *averaged_spec_mat, float *averaged_spec_mat_reorganized ) |
|
260 | void ASM_reorganize( float *averaged_spec_mat, float *averaged_spec_mat_reorganized ) | |
258 | { |
|
261 | { | |
259 | int frequencyBin; |
|
262 | int frequencyBin; | |
260 | int asmComponent; |
|
263 | int asmComponent; | |
261 |
|
264 | |||
262 | // copy the time information |
|
265 | // copy the time information | |
263 | averaged_spec_mat_reorganized[ 0 ] = averaged_spec_mat[ 0 ]; |
|
266 | averaged_spec_mat_reorganized[ 0 ] = averaged_spec_mat[ 0 ]; | |
264 | averaged_spec_mat_reorganized[ 1 ] = averaged_spec_mat[ 1 ]; |
|
267 | averaged_spec_mat_reorganized[ 1 ] = averaged_spec_mat[ 1 ]; | |
265 |
|
268 | |||
266 | for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++) |
|
269 | for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++) | |
267 | { |
|
270 | { | |
268 | for( frequencyBin = 0; frequencyBin < NB_BINS_PER_SM; frequencyBin++ ) |
|
271 | for( frequencyBin = 0; frequencyBin < NB_BINS_PER_SM; frequencyBin++ ) | |
269 | { |
|
272 | { | |
270 | averaged_spec_mat_reorganized[ frequencyBin * NB_VALUES_PER_SM + asmComponent + TIME_OFFSET ] = |
|
273 | averaged_spec_mat_reorganized[ frequencyBin * NB_VALUES_PER_SM + asmComponent + TIME_OFFSET ] = | |
271 | averaged_spec_mat[ asmComponent * NB_BINS_PER_SM + frequencyBin + TIME_OFFSET]; |
|
274 | averaged_spec_mat[ asmComponent * NB_BINS_PER_SM + frequencyBin + TIME_OFFSET]; | |
272 | } |
|
275 | } | |
273 | } |
|
276 | } | |
274 | } |
|
277 | } | |
275 |
|
278 | |||
276 | void ASM_compress( float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat ) |
|
279 | void ASM_compress( float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat ) | |
277 | { |
|
280 | { | |
278 | int frequencyBin; |
|
281 | int frequencyBin; | |
279 | int asmComponent; |
|
282 | int asmComponent; | |
280 | int offsetASM; |
|
283 | int offsetASM; | |
281 | int offsetCompressed; |
|
284 | int offsetCompressed; | |
282 | int k; |
|
285 | int k; | |
283 |
|
286 | |||
284 | switch (fChannel){ |
|
287 | switch (fChannel){ | |
285 | case 0: |
|
288 | case 0: | |
286 | for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++) |
|
289 | for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++) | |
287 | { |
|
290 | { | |
288 | for( frequencyBin = 0; frequencyBin < NB_BINS_COMPRESSED_SM_F0; frequencyBin++ ) |
|
291 | for( frequencyBin = 0; frequencyBin < NB_BINS_COMPRESSED_SM_F0; frequencyBin++ ) | |
289 | { |
|
292 | { | |
290 | offsetASM = asmComponent * NB_BINS_PER_SM |
|
293 | offsetASM = asmComponent * NB_BINS_PER_SM | |
291 | + ASM_F0_INDICE_START |
|
294 | + ASM_F0_INDICE_START | |
292 | + frequencyBin * NB_BINS_TO_AVERAGE_ASM_F0; |
|
295 | + frequencyBin * NB_BINS_TO_AVERAGE_ASM_F0; | |
293 | offsetCompressed = frequencyBin * NB_VALUES_PER_SM |
|
296 | offsetCompressed = frequencyBin * NB_VALUES_PER_SM | |
294 | + asmComponent; |
|
297 | + asmComponent; | |
295 | compressed_spec_mat[ offsetCompressed ] = 0; |
|
298 | compressed_spec_mat[ offsetCompressed ] = 0; | |
296 | for ( k = 0; k < NB_BINS_TO_AVERAGE_ASM_F0; k++ ) |
|
299 | for ( k = 0; k < NB_BINS_TO_AVERAGE_ASM_F0; k++ ) | |
297 | { |
|
300 | { | |
298 | compressed_spec_mat[offsetCompressed ] = |
|
301 | compressed_spec_mat[offsetCompressed ] = | |
299 | compressed_spec_mat[ offsetCompressed ] |
|
302 | compressed_spec_mat[ offsetCompressed ] | |
300 | + averaged_spec_mat[ offsetASM + k ]; |
|
303 | + averaged_spec_mat[ offsetASM + k ]; | |
301 | } |
|
304 | } | |
302 | } |
|
305 | } | |
303 | } |
|
306 | } | |
304 | break; |
|
307 | break; | |
305 |
|
308 | |||
306 | case 1: |
|
309 | case 1: | |
307 | // case fChannel = f1 to be completed later |
|
310 | // case fChannel = f1 to be completed later | |
308 | break; |
|
311 | break; | |
309 |
|
312 | |||
310 | case 2: |
|
313 | case 2: | |
311 | // case fChannel = f1 to be completed later |
|
314 | // case fChannel = f1 to be completed later | |
312 | break; |
|
315 | break; | |
313 |
|
316 | |||
314 | default: |
|
317 | default: | |
315 | break; |
|
318 | break; | |
316 | } |
|
319 | } | |
317 | } |
|
320 | } | |
318 |
|
321 | |||
319 | void ASM_convert( volatile float *input_matrix, char *output_matrix) |
|
322 | void ASM_convert( volatile float *input_matrix, char *output_matrix) | |
320 | { |
|
323 | { | |
321 | unsigned int i; |
|
324 | unsigned int i; | |
322 | unsigned int frequencyBin; |
|
325 | unsigned int frequencyBin; | |
323 | unsigned int asmComponent; |
|
326 | unsigned int asmComponent; | |
324 | char * pt_char_input; |
|
327 | char * pt_char_input; | |
325 | char * pt_char_output; |
|
328 | char * pt_char_output; | |
326 |
|
329 | |||
327 | pt_char_input = (char*) &input_matrix; |
|
330 | pt_char_input = (char*) &input_matrix; | |
328 | pt_char_output = (char*) &output_matrix; |
|
331 | pt_char_output = (char*) &output_matrix; | |
329 |
|
332 | |||
330 | // copy the time information |
|
333 | // copy the time information | |
331 | for (i=0; i<TIME_OFFSET_IN_BYTES; i++) |
|
334 | for (i=0; i<TIME_OFFSET_IN_BYTES; i++) | |
332 | { |
|
335 | { | |
333 | pt_char_output[ i ] = pt_char_output[ i ]; |
|
336 | pt_char_output[ i ] = pt_char_output[ i ]; | |
334 | } |
|
337 | } | |
335 |
|
338 | |||
336 | // convert all other data |
|
339 | // convert all other data | |
337 | for( frequencyBin=0; frequencyBin<NB_BINS_PER_SM; frequencyBin++) |
|
340 | for( frequencyBin=0; frequencyBin<NB_BINS_PER_SM; frequencyBin++) | |
338 | { |
|
341 | { | |
339 | for ( asmComponent=0; asmComponent<NB_VALUES_PER_SM; asmComponent++) |
|
342 | for ( asmComponent=0; asmComponent<NB_VALUES_PER_SM; asmComponent++) | |
340 | { |
|
343 | { | |
341 | pt_char_input = (char*) &input_matrix [ (frequencyBin*NB_VALUES_PER_SM) + asmComponent + TIME_OFFSET ]; |
|
344 | pt_char_input = (char*) &input_matrix [ (frequencyBin*NB_VALUES_PER_SM) + asmComponent + TIME_OFFSET ]; | |
342 | pt_char_output = (char*) &output_matrix[ 2 * ( (frequencyBin*NB_VALUES_PER_SM) + asmComponent ) + TIME_OFFSET_IN_BYTES ]; |
|
345 | pt_char_output = (char*) &output_matrix[ 2 * ( (frequencyBin*NB_VALUES_PER_SM) + asmComponent ) + TIME_OFFSET_IN_BYTES ]; | |
343 | pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float |
|
346 | pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float | |
344 | pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float |
|
347 | pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float | |
345 | } |
|
348 | } | |
346 | } |
|
349 | } | |
347 | } |
|
350 | } | |
348 |
|
351 | |||
349 | void ASM_send(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, |
|
352 | void ASM_send(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, | |
350 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id) |
|
353 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id) | |
351 | { |
|
354 | { | |
352 | unsigned int i; |
|
355 | unsigned int i; | |
353 | unsigned int length = 0; |
|
356 | unsigned int length = 0; | |
354 | rtems_status_code status; |
|
357 | rtems_status_code status; | |
355 |
|
358 | |||
356 | for (i=0; i<2; i++) |
|
359 | for (i=0; i<2; i++) | |
357 | { |
|
360 | { | |
358 | // (1) BUILD THE DATA |
|
361 | // (1) BUILD THE DATA | |
359 | switch(sid) |
|
362 | switch(sid) | |
360 | { |
|
363 | { | |
361 | case SID_NORM_ASM_F0: |
|
364 | case SID_NORM_ASM_F0: | |
362 | spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F0_IN_BYTES / 2; |
|
365 | spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F0_IN_BYTES / 2; | |
363 | spw_ioctl_send->data = &spectral_matrix[ |
|
366 | spw_ioctl_send->data = &spectral_matrix[ | |
364 | ( (ASM_F0_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F0) ) * NB_VALUES_PER_SM ) * 2 |
|
367 | ( (ASM_F0_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F0) ) * NB_VALUES_PER_SM ) * 2 | |
365 | + TIME_OFFSET_IN_BYTES |
|
368 | + TIME_OFFSET_IN_BYTES | |
366 | ]; |
|
369 | ]; | |
367 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0; |
|
370 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0; | |
368 | header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F0) >> 8 ); // BLK_NR MSB |
|
371 | header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F0) >> 8 ); // BLK_NR MSB | |
369 | header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F0); // BLK_NR LSB |
|
372 | header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F0); // BLK_NR LSB | |
370 | break; |
|
373 | break; | |
371 | case SID_NORM_ASM_F1: |
|
374 | case SID_NORM_ASM_F1: | |
372 | break; |
|
375 | break; | |
373 | case SID_NORM_ASM_F2: |
|
376 | case SID_NORM_ASM_F2: | |
374 | break; |
|
377 | break; | |
375 | default: |
|
378 | default: | |
376 | PRINTF1("ERR *** in ASM_send *** unexpected sid %d\n", sid) |
|
379 | PRINTF1("ERR *** in ASM_send *** unexpected sid %d\n", sid) | |
377 | break; |
|
380 | break; | |
378 | } |
|
381 | } | |
379 | spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
382 | spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES; | |
380 | spw_ioctl_send->hdr = (char *) header; |
|
383 | spw_ioctl_send->hdr = (char *) header; | |
381 | spw_ioctl_send->options = 0; |
|
384 | spw_ioctl_send->options = 0; | |
382 |
|
385 | |||
383 | // (2) BUILD THE HEADER |
|
386 | // (2) BUILD THE HEADER | |
384 | header->packetLength[0] = (unsigned char) (length>>8); |
|
387 | header->packetLength[0] = (unsigned char) (length>>8); | |
385 | header->packetLength[1] = (unsigned char) (length); |
|
388 | header->packetLength[1] = (unsigned char) (length); | |
386 | header->sid = (unsigned char) sid; // SID |
|
389 | header->sid = (unsigned char) sid; // SID | |
387 | header->pa_lfr_pkt_cnt_asm = 2; |
|
390 | header->pa_lfr_pkt_cnt_asm = 2; | |
388 | header->pa_lfr_pkt_nr_asm = (unsigned char) (i+1); |
|
391 | header->pa_lfr_pkt_nr_asm = (unsigned char) (i+1); | |
389 |
|
392 | |||
390 | // (3) SET PACKET TIME |
|
393 | // (3) SET PACKET TIME | |
391 | header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
394 | header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
392 | header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
395 | header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
393 | header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
396 | header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
394 | header->time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
397 | header->time[3] = (unsigned char) (time_management_regs->coarse_time); | |
395 | header->time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
398 | header->time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
396 | header->time[5] = (unsigned char) (time_management_regs->fine_time); |
|
399 | header->time[5] = (unsigned char) (time_management_regs->fine_time); | |
397 | // |
|
400 | // | |
398 | header->acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
401 | header->acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
399 | header->acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
402 | header->acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
400 | header->acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
403 | header->acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
401 | header->acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time); |
|
404 | header->acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time); | |
402 | header->acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
405 | header->acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
403 | header->acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time); |
|
406 | header->acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time); | |
404 |
|
407 | |||
405 | // (4) SEND PACKET |
|
408 | // (4) SEND PACKET | |
406 | status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE); |
|
409 | status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE); | |
407 | if (status != RTEMS_SUCCESSFUL) { |
|
410 | if (status != RTEMS_SUCCESSFUL) { | |
408 | printf("in ASM_send *** ERR %d\n", (int) status); |
|
411 | printf("in ASM_send *** ERR %d\n", (int) status); | |
409 | } |
|
412 | } | |
410 | } |
|
413 | } | |
411 | } |
|
414 | } | |
412 |
|
415 | |||
413 | void BP1_set_old(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1){ |
|
416 | void BP1_set_old(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1){ | |
414 | int i; |
|
417 | int i; | |
415 | int j; |
|
418 | int j; | |
416 | unsigned char tmp_u_char; |
|
419 | unsigned char tmp_u_char; | |
417 | unsigned char * pt_char = NULL; |
|
420 | unsigned char * pt_char = NULL; | |
418 | float PSDB, PSDE; |
|
421 | float PSDB, PSDE; | |
419 | float NVEC_V0; |
|
422 | float NVEC_V0; | |
420 | float NVEC_V1; |
|
423 | float NVEC_V1; | |
421 | float NVEC_V2; |
|
424 | float NVEC_V2; | |
422 | //float significand; |
|
425 | //float significand; | |
423 | //int exponent; |
|
426 | //int exponent; | |
424 | float aux; |
|
427 | float aux; | |
425 | float tr_SB_SB; |
|
428 | float tr_SB_SB; | |
426 | float tmp; |
|
429 | float tmp; | |
427 | float sx_re; |
|
430 | float sx_re; | |
428 | float sx_im; |
|
431 | float sx_im; | |
429 | float nebx_re = 0; |
|
432 | float nebx_re = 0; | |
430 | float nebx_im = 0; |
|
433 | float nebx_im = 0; | |
431 | float ny = 0; |
|
434 | float ny = 0; | |
432 | float nz = 0; |
|
435 | float nz = 0; | |
433 | float bx_bx_star = 0; |
|
436 | float bx_bx_star = 0; | |
434 | for(i=0; i<nb_bins_compressed_spec_mat; i++){ |
|
437 | for(i=0; i<nb_bins_compressed_spec_mat; i++){ | |
435 | //============================================== |
|
438 | //============================================== | |
436 | // BP1 PSD == B PAR_LFR_SC_BP1_PE_FL0 == 16 bits |
|
439 | // BP1 PSD == B PAR_LFR_SC_BP1_PE_FL0 == 16 bits | |
437 | PSDB = compressed_spec_mat[i*30] // S11 |
|
440 | PSDB = compressed_spec_mat[i*30] // S11 | |
438 | + compressed_spec_mat[(i*30) + 10] // S22 |
|
441 | + compressed_spec_mat[(i*30) + 10] // S22 | |
439 | + compressed_spec_mat[(i*30) + 18]; // S33 |
|
442 | + compressed_spec_mat[(i*30) + 18]; // S33 | |
440 | //significand = frexp(PSDB, &exponent); |
|
443 | //significand = frexp(PSDB, &exponent); | |
441 | pt_char = (unsigned char*) &PSDB; |
|
444 | pt_char = (unsigned char*) &PSDB; | |
442 | LFR_BP1[(i*9) + 2] = pt_char[0]; // bits 31 downto 24 of the float |
|
445 | LFR_BP1[(i*9) + 2] = pt_char[0]; // bits 31 downto 24 of the float | |
443 | LFR_BP1[(i*9) + 3] = pt_char[1]; // bits 23 downto 16 of the float |
|
446 | LFR_BP1[(i*9) + 3] = pt_char[1]; // bits 23 downto 16 of the float | |
444 | //============================================== |
|
447 | //============================================== | |
445 | // BP1 PSD == E PAR_LFR_SC_BP1_PB_FL0 == 16 bits |
|
448 | // BP1 PSD == E PAR_LFR_SC_BP1_PB_FL0 == 16 bits | |
446 | PSDE = compressed_spec_mat[(i*30) + 24] * K44_pe // S44 |
|
449 | PSDE = compressed_spec_mat[(i*30) + 24] * K44_pe // S44 | |
447 | + compressed_spec_mat[(i*30) + 28] * K55_pe // S55 |
|
450 | + compressed_spec_mat[(i*30) + 28] * K55_pe // S55 | |
448 | + compressed_spec_mat[(i*30) + 26] * K45_pe_re // S45 |
|
451 | + compressed_spec_mat[(i*30) + 26] * K45_pe_re // S45 | |
449 | - compressed_spec_mat[(i*30) + 27] * K45_pe_im; // S45 |
|
452 | - compressed_spec_mat[(i*30) + 27] * K45_pe_im; // S45 | |
450 | pt_char = (unsigned char*) &PSDE; |
|
453 | pt_char = (unsigned char*) &PSDE; | |
451 | LFR_BP1[(i*9) + 0] = pt_char[0]; // bits 31 downto 24 of the float |
|
454 | LFR_BP1[(i*9) + 0] = pt_char[0]; // bits 31 downto 24 of the float | |
452 | LFR_BP1[(i*9) + 1] = pt_char[1]; // bits 23 downto 16 of the float |
|
455 | LFR_BP1[(i*9) + 1] = pt_char[1]; // bits 23 downto 16 of the float | |
453 | //============================================================================== |
|
456 | //============================================================================== | |
454 | // BP1 normal wave vector == PAR_LFR_SC_BP1_NVEC_V0_F0 == 8 bits |
|
457 | // BP1 normal wave vector == PAR_LFR_SC_BP1_NVEC_V0_F0 == 8 bits | |
455 | // == PAR_LFR_SC_BP1_NVEC_V1_F0 == 8 bits |
|
458 | // == PAR_LFR_SC_BP1_NVEC_V1_F0 == 8 bits | |
456 | // == PAR_LFR_SC_BP1_NVEC_V2_F0 == 1 bits |
|
459 | // == PAR_LFR_SC_BP1_NVEC_V2_F0 == 1 bits | |
457 | tmp = sqrt( |
|
460 | tmp = sqrt( | |
458 | compressed_spec_mat[(i*30) + 3]*compressed_spec_mat[(i*30) + 3] //Im S12 |
|
461 | compressed_spec_mat[(i*30) + 3]*compressed_spec_mat[(i*30) + 3] //Im S12 | |
459 | +compressed_spec_mat[(i*30) + 5]*compressed_spec_mat[(i*30) + 5] //Im S13 |
|
462 | +compressed_spec_mat[(i*30) + 5]*compressed_spec_mat[(i*30) + 5] //Im S13 | |
460 | +compressed_spec_mat[(i*30) + 13]*compressed_spec_mat[(i*30) + 13] //Im S23 |
|
463 | +compressed_spec_mat[(i*30) + 13]*compressed_spec_mat[(i*30) + 13] //Im S23 | |
461 | ); |
|
464 | ); | |
462 | NVEC_V0 = compressed_spec_mat[(i*30) + 13] / tmp; // Im S23 |
|
465 | NVEC_V0 = compressed_spec_mat[(i*30) + 13] / tmp; // Im S23 | |
463 | NVEC_V1 = -compressed_spec_mat[(i*30) + 5] / tmp; // Im S13 |
|
466 | NVEC_V1 = -compressed_spec_mat[(i*30) + 5] / tmp; // Im S13 | |
464 | NVEC_V2 = compressed_spec_mat[(i*30) + 3] / tmp; // Im S12 |
|
467 | NVEC_V2 = compressed_spec_mat[(i*30) + 3] / tmp; // Im S12 | |
465 | LFR_BP1[(i*9) + 4] = (char) (NVEC_V0*127); |
|
468 | LFR_BP1[(i*9) + 4] = (char) (NVEC_V0*127); | |
466 | LFR_BP1[(i*9) + 5] = (char) (NVEC_V1*127); |
|
469 | LFR_BP1[(i*9) + 5] = (char) (NVEC_V1*127); | |
467 | pt_char = (unsigned char*) &NVEC_V2; |
|
470 | pt_char = (unsigned char*) &NVEC_V2; | |
468 | LFR_BP1[(i*9) + 6] = pt_char[0] & 0x80; // extract the sign of NVEC_V2 |
|
471 | LFR_BP1[(i*9) + 6] = pt_char[0] & 0x80; // extract the sign of NVEC_V2 | |
469 | //======================================================= |
|
472 | //======================================================= | |
470 | // BP1 ellipticity == PAR_LFR_SC_BP1_ELLIP_F0 == 4 bits |
|
473 | // BP1 ellipticity == PAR_LFR_SC_BP1_ELLIP_F0 == 4 bits | |
471 | aux = 2*tmp / PSDB; // compute the ellipticity |
|
474 | aux = 2*tmp / PSDB; // compute the ellipticity | |
472 | tmp_u_char = (unsigned char) (aux*(16-1)); // convert the ellipticity |
|
475 | tmp_u_char = (unsigned char) (aux*(16-1)); // convert the ellipticity | |
473 | LFR_BP1[i*9+6] = LFR_BP1[i*9+6] | ((tmp_u_char&0x0f)<<3); // keeps 4 bits of the resulting unsigned char |
|
476 | LFR_BP1[i*9+6] = LFR_BP1[i*9+6] | ((tmp_u_char&0x0f)<<3); // keeps 4 bits of the resulting unsigned char | |
474 | //============================================================== |
|
477 | //============================================================== | |
475 | // BP1 degree of polarization == PAR_LFR_SC_BP1_DOP_F0 == 3 bits |
|
478 | // BP1 degree of polarization == PAR_LFR_SC_BP1_DOP_F0 == 3 bits | |
476 | for(j = 0; j<NB_VALUES_PER_SM;j++){ |
|
479 | for(j = 0; j<NB_VALUES_PER_SM;j++){ | |
477 | tr_SB_SB = compressed_spec_mat[i*30] * compressed_spec_mat[i*30] |
|
480 | tr_SB_SB = compressed_spec_mat[i*30] * compressed_spec_mat[i*30] | |
478 | + compressed_spec_mat[(i*30) + 10] * compressed_spec_mat[(i*30) + 10] |
|
481 | + compressed_spec_mat[(i*30) + 10] * compressed_spec_mat[(i*30) + 10] | |
479 | + compressed_spec_mat[(i*30) + 18] * compressed_spec_mat[(i*30) + 18] |
|
482 | + compressed_spec_mat[(i*30) + 18] * compressed_spec_mat[(i*30) + 18] | |
480 | + 2 * compressed_spec_mat[(i*30) + 2] * compressed_spec_mat[(i*30) + 2] |
|
483 | + 2 * compressed_spec_mat[(i*30) + 2] * compressed_spec_mat[(i*30) + 2] | |
481 | + 2 * compressed_spec_mat[(i*30) + 3] * compressed_spec_mat[(i*30) + 3] |
|
484 | + 2 * compressed_spec_mat[(i*30) + 3] * compressed_spec_mat[(i*30) + 3] | |
482 | + 2 * compressed_spec_mat[(i*30) + 4] * compressed_spec_mat[(i*30) + 4] |
|
485 | + 2 * compressed_spec_mat[(i*30) + 4] * compressed_spec_mat[(i*30) + 4] | |
483 | + 2 * compressed_spec_mat[(i*30) + 5] * compressed_spec_mat[(i*30) + 5] |
|
486 | + 2 * compressed_spec_mat[(i*30) + 5] * compressed_spec_mat[(i*30) + 5] | |
484 | + 2 * compressed_spec_mat[(i*30) + 12] * compressed_spec_mat[(i*30) + 12] |
|
487 | + 2 * compressed_spec_mat[(i*30) + 12] * compressed_spec_mat[(i*30) + 12] | |
485 | + 2 * compressed_spec_mat[(i*30) + 13] * compressed_spec_mat[(i*30) + 13]; |
|
488 | + 2 * compressed_spec_mat[(i*30) + 13] * compressed_spec_mat[(i*30) + 13]; | |
486 | } |
|
489 | } | |
487 | aux = PSDB*PSDB; |
|
490 | aux = PSDB*PSDB; | |
488 | tmp = sqrt( abs( ( 3*tr_SB_SB - aux ) / ( 2 * aux ) ) ); |
|
491 | tmp = sqrt( abs( ( 3*tr_SB_SB - aux ) / ( 2 * aux ) ) ); | |
489 | tmp_u_char = (unsigned char) (NVEC_V0*(8-1)); |
|
492 | tmp_u_char = (unsigned char) (NVEC_V0*(8-1)); | |
490 | LFR_BP1[(i*9) + 6] = LFR_BP1[(i*9) + 6] | (tmp_u_char & 0x07); // keeps 3 bits of the resulting unsigned char |
|
493 | LFR_BP1[(i*9) + 6] = LFR_BP1[(i*9) + 6] | (tmp_u_char & 0x07); // keeps 3 bits of the resulting unsigned char | |
491 | //======================================================================================= |
|
494 | //======================================================================================= | |
492 | // BP1 x-component of the normalized Poynting flux == PAR_LFR_SC_BP1_SZ_F0 == 8 bits (7+1) |
|
495 | // BP1 x-component of the normalized Poynting flux == PAR_LFR_SC_BP1_SZ_F0 == 8 bits (7+1) | |
493 | sx_re = compressed_spec_mat[(i*30) + 20] * K34_sx_re |
|
496 | sx_re = compressed_spec_mat[(i*30) + 20] * K34_sx_re | |
494 | + compressed_spec_mat[(i*30) + 6] * K14_sx_re |
|
497 | + compressed_spec_mat[(i*30) + 6] * K14_sx_re | |
495 | + compressed_spec_mat[(i*30) + 8] * K15_sx_re |
|
498 | + compressed_spec_mat[(i*30) + 8] * K15_sx_re | |
496 | + compressed_spec_mat[(i*30) + 14] * K24_sx_re |
|
499 | + compressed_spec_mat[(i*30) + 14] * K24_sx_re | |
497 | + compressed_spec_mat[(i*30) + 16] * K25_sx_re |
|
500 | + compressed_spec_mat[(i*30) + 16] * K25_sx_re | |
498 | + compressed_spec_mat[(i*30) + 22] * K35_sx_re; |
|
501 | + compressed_spec_mat[(i*30) + 22] * K35_sx_re; | |
499 | sx_im = compressed_spec_mat[(i*30) + 21] * K34_sx_im |
|
502 | sx_im = compressed_spec_mat[(i*30) + 21] * K34_sx_im | |
500 | + compressed_spec_mat[(i*30) + 7] * K14_sx_im |
|
503 | + compressed_spec_mat[(i*30) + 7] * K14_sx_im | |
501 | + compressed_spec_mat[(i*30) + 9] * K15_sx_im |
|
504 | + compressed_spec_mat[(i*30) + 9] * K15_sx_im | |
502 | + compressed_spec_mat[(i*30) + 15] * K24_sx_im |
|
505 | + compressed_spec_mat[(i*30) + 15] * K24_sx_im | |
503 | + compressed_spec_mat[(i*30) + 17] * K25_sx_im |
|
506 | + compressed_spec_mat[(i*30) + 17] * K25_sx_im | |
504 | + compressed_spec_mat[(i*30) + 23] * K35_sx_im; |
|
507 | + compressed_spec_mat[(i*30) + 23] * K35_sx_im; | |
505 | LFR_BP1[(i*9) + 7] = ((unsigned char) (sx_re * 128)) & 0x7f; // cf DOC for the compression |
|
508 | LFR_BP1[(i*9) + 7] = ((unsigned char) (sx_re * 128)) & 0x7f; // cf DOC for the compression | |
506 | if ( abs(sx_re) > abs(sx_im) ) { |
|
509 | if ( abs(sx_re) > abs(sx_im) ) { | |
507 | LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] | (0x80); // extract the sector of sx |
|
510 | LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] | (0x80); // extract the sector of sx | |
508 | } |
|
511 | } | |
509 | else { |
|
512 | else { | |
510 | LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] & (0x7f); // extract the sector of sx |
|
513 | LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] & (0x7f); // extract the sector of sx | |
511 | } |
|
514 | } | |
512 | //====================================================================== |
|
515 | //====================================================================== | |
513 | // BP1 phase velocity estimator == PAR_LFR_SC_BP1_VPHI_F0 == 8 bits (7+1) |
|
516 | // BP1 phase velocity estimator == PAR_LFR_SC_BP1_VPHI_F0 == 8 bits (7+1) | |
514 | ny = sin(Alpha_M)*NVEC_V1 + cos(Alpha_M)*NVEC_V2; |
|
517 | ny = sin(Alpha_M)*NVEC_V1 + cos(Alpha_M)*NVEC_V2; | |
515 | nz = NVEC_V0; |
|
518 | nz = NVEC_V0; | |
516 | bx_bx_star = cos(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+10] // re S22 |
|
519 | bx_bx_star = cos(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+10] // re S22 | |
517 | + sin(Alpha_M) * sin(Alpha_M) * compressed_spec_mat[i*30+18] // re S33 |
|
520 | + sin(Alpha_M) * sin(Alpha_M) * compressed_spec_mat[i*30+18] // re S33 | |
518 | - 2 * sin(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+12]; // re S23 |
|
521 | - 2 * sin(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+12]; // re S23 | |
519 | nebx_re = ny * (compressed_spec_mat[(i*30) + 14] * K24_ny_re |
|
522 | nebx_re = ny * (compressed_spec_mat[(i*30) + 14] * K24_ny_re | |
520 | +compressed_spec_mat[(i*30) + 16] * K25_ny_re |
|
523 | +compressed_spec_mat[(i*30) + 16] * K25_ny_re | |
521 | +compressed_spec_mat[(i*30) + 20] * K34_ny_re |
|
524 | +compressed_spec_mat[(i*30) + 20] * K34_ny_re | |
522 | +compressed_spec_mat[(i*30) + 22] * K35_ny_re) |
|
525 | +compressed_spec_mat[(i*30) + 22] * K35_ny_re) | |
523 | + nz * (compressed_spec_mat[(i*30) + 14] * K24_nz_re |
|
526 | + nz * (compressed_spec_mat[(i*30) + 14] * K24_nz_re | |
524 | +compressed_spec_mat[(i*30) + 16] * K25_nz_re |
|
527 | +compressed_spec_mat[(i*30) + 16] * K25_nz_re | |
525 | +compressed_spec_mat[(i*30) + 20] * K34_nz_re |
|
528 | +compressed_spec_mat[(i*30) + 20] * K34_nz_re | |
526 | +compressed_spec_mat[(i*30) + 22] * K35_nz_re); |
|
529 | +compressed_spec_mat[(i*30) + 22] * K35_nz_re); | |
527 | nebx_im = ny * (compressed_spec_mat[(i*30) + 15]*K24_ny_re |
|
530 | nebx_im = ny * (compressed_spec_mat[(i*30) + 15]*K24_ny_re | |
528 | +compressed_spec_mat[(i*30) + 17] * K25_ny_re |
|
531 | +compressed_spec_mat[(i*30) + 17] * K25_ny_re | |
529 | +compressed_spec_mat[(i*30) + 21] * K34_ny_re |
|
532 | +compressed_spec_mat[(i*30) + 21] * K34_ny_re | |
530 | +compressed_spec_mat[(i*30) + 23] * K35_ny_re) |
|
533 | +compressed_spec_mat[(i*30) + 23] * K35_ny_re) | |
531 | + nz * (compressed_spec_mat[(i*30) + 15] * K24_nz_im |
|
534 | + nz * (compressed_spec_mat[(i*30) + 15] * K24_nz_im | |
532 | +compressed_spec_mat[(i*30) + 17] * K25_nz_im |
|
535 | +compressed_spec_mat[(i*30) + 17] * K25_nz_im | |
533 | +compressed_spec_mat[(i*30) + 21] * K34_nz_im |
|
536 | +compressed_spec_mat[(i*30) + 21] * K34_nz_im | |
534 | +compressed_spec_mat[(i*30) + 23] * K35_nz_im); |
|
537 | +compressed_spec_mat[(i*30) + 23] * K35_nz_im); | |
535 | tmp = nebx_re / bx_bx_star; |
|
538 | tmp = nebx_re / bx_bx_star; | |
536 | LFR_BP1[(i*9) + 8] = ((unsigned char) (tmp * 128)) & 0x7f; // cf DOC for the compression |
|
539 | LFR_BP1[(i*9) + 8] = ((unsigned char) (tmp * 128)) & 0x7f; // cf DOC for the compression | |
537 | if ( abs(nebx_re) > abs(nebx_im) ) { |
|
540 | if ( abs(nebx_re) > abs(nebx_im) ) { | |
538 | LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] | (0x80); // extract the sector of nebx |
|
541 | LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] | (0x80); // extract the sector of nebx | |
539 | } |
|
542 | } | |
540 | else { |
|
543 | else { | |
541 | LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] & (0x7f); // extract the sector of nebx |
|
544 | LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] & (0x7f); // extract the sector of nebx | |
542 | } |
|
545 | } | |
543 | } |
|
546 | } | |
544 |
|
547 | |||
545 | } |
|
548 | } | |
546 |
|
549 | |||
547 | void BP2_set_old(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat){ |
|
550 | void BP2_set_old(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat){ | |
548 | // BP2 autocorrelation |
|
551 | // BP2 autocorrelation | |
549 | int i; |
|
552 | int i; | |
550 | int aux = 0; |
|
553 | int aux = 0; | |
551 |
|
554 | |||
552 | for(i = 0; i<nb_bins_compressed_spec_mat; i++){ |
|
555 | for(i = 0; i<nb_bins_compressed_spec_mat; i++){ | |
553 | // S12 |
|
556 | // S12 | |
554 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 10]); |
|
557 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 10]); | |
555 | compressed_spec_mat[(i*30) + 2] = compressed_spec_mat[(i*30) + 2] / aux; |
|
558 | compressed_spec_mat[(i*30) + 2] = compressed_spec_mat[(i*30) + 2] / aux; | |
556 | compressed_spec_mat[(i*30) + 3] = compressed_spec_mat[(i*30) + 3] / aux; |
|
559 | compressed_spec_mat[(i*30) + 3] = compressed_spec_mat[(i*30) + 3] / aux; | |
557 | // S13 |
|
560 | // S13 | |
558 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 18]); |
|
561 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 18]); | |
559 | compressed_spec_mat[(i*30) + 4] = compressed_spec_mat[(i*30) + 4] / aux; |
|
562 | compressed_spec_mat[(i*30) + 4] = compressed_spec_mat[(i*30) + 4] / aux; | |
560 | compressed_spec_mat[(i*30) + 5] = compressed_spec_mat[(i*30) + 5] / aux; |
|
563 | compressed_spec_mat[(i*30) + 5] = compressed_spec_mat[(i*30) + 5] / aux; | |
561 | // S23 |
|
564 | // S23 | |
562 | aux = sqrt(compressed_spec_mat[i*30+12]*compressed_spec_mat[(i*30) + 18]); |
|
565 | aux = sqrt(compressed_spec_mat[i*30+12]*compressed_spec_mat[(i*30) + 18]); | |
563 | compressed_spec_mat[(i*30) + 12] = compressed_spec_mat[(i*30) + 12] / aux; |
|
566 | compressed_spec_mat[(i*30) + 12] = compressed_spec_mat[(i*30) + 12] / aux; | |
564 | compressed_spec_mat[(i*30) + 13] = compressed_spec_mat[(i*30) + 13] / aux; |
|
567 | compressed_spec_mat[(i*30) + 13] = compressed_spec_mat[(i*30) + 13] / aux; | |
565 | // S45 |
|
568 | // S45 | |
566 | aux = sqrt(compressed_spec_mat[i*30+24]*compressed_spec_mat[(i*30) + 28]); |
|
569 | aux = sqrt(compressed_spec_mat[i*30+24]*compressed_spec_mat[(i*30) + 28]); | |
567 | compressed_spec_mat[(i*30) + 26] = compressed_spec_mat[(i*30) + 26] / aux; |
|
570 | compressed_spec_mat[(i*30) + 26] = compressed_spec_mat[(i*30) + 26] / aux; | |
568 | compressed_spec_mat[(i*30) + 27] = compressed_spec_mat[(i*30) + 27] / aux; |
|
571 | compressed_spec_mat[(i*30) + 27] = compressed_spec_mat[(i*30) + 27] / aux; | |
569 | // S14 |
|
572 | // S14 | |
570 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) +24]); |
|
573 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) +24]); | |
571 | compressed_spec_mat[(i*30) + 6] = compressed_spec_mat[(i*30) + 6] / aux; |
|
574 | compressed_spec_mat[(i*30) + 6] = compressed_spec_mat[(i*30) + 6] / aux; | |
572 | compressed_spec_mat[(i*30) + 7] = compressed_spec_mat[(i*30) + 7] / aux; |
|
575 | compressed_spec_mat[(i*30) + 7] = compressed_spec_mat[(i*30) + 7] / aux; | |
573 | // S15 |
|
576 | // S15 | |
574 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 28]); |
|
577 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 28]); | |
575 | compressed_spec_mat[(i*30) + 8] = compressed_spec_mat[(i*30) + 8] / aux; |
|
578 | compressed_spec_mat[(i*30) + 8] = compressed_spec_mat[(i*30) + 8] / aux; | |
576 | compressed_spec_mat[(i*30) + 9] = compressed_spec_mat[(i*30) + 9] / aux; |
|
579 | compressed_spec_mat[(i*30) + 9] = compressed_spec_mat[(i*30) + 9] / aux; | |
577 | // S24 |
|
580 | // S24 | |
578 | aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 24]); |
|
581 | aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 24]); | |
579 | compressed_spec_mat[(i*30) + 14] = compressed_spec_mat[(i*30) + 14] / aux; |
|
582 | compressed_spec_mat[(i*30) + 14] = compressed_spec_mat[(i*30) + 14] / aux; | |
580 | compressed_spec_mat[(i*30) + 15] = compressed_spec_mat[(i*30) + 15] / aux; |
|
583 | compressed_spec_mat[(i*30) + 15] = compressed_spec_mat[(i*30) + 15] / aux; | |
581 | // S25 |
|
584 | // S25 | |
582 | aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 28]); |
|
585 | aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 28]); | |
583 | compressed_spec_mat[(i*30) + 16] = compressed_spec_mat[(i*30) + 16] / aux; |
|
586 | compressed_spec_mat[(i*30) + 16] = compressed_spec_mat[(i*30) + 16] / aux; | |
584 | compressed_spec_mat[(i*30) + 17] = compressed_spec_mat[(i*30) + 17] / aux; |
|
587 | compressed_spec_mat[(i*30) + 17] = compressed_spec_mat[(i*30) + 17] / aux; | |
585 | // S34 |
|
588 | // S34 | |
586 | aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 24]); |
|
589 | aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 24]); | |
587 | compressed_spec_mat[(i*30) + 20] = compressed_spec_mat[(i*30) + 20] / aux; |
|
590 | compressed_spec_mat[(i*30) + 20] = compressed_spec_mat[(i*30) + 20] / aux; | |
588 | compressed_spec_mat[(i*30) + 21] = compressed_spec_mat[(i*30) + 21] / aux; |
|
591 | compressed_spec_mat[(i*30) + 21] = compressed_spec_mat[(i*30) + 21] / aux; | |
589 | // S35 |
|
592 | // S35 | |
590 | aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 28]); |
|
593 | aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 28]); | |
591 | compressed_spec_mat[(i*30) + 22] = compressed_spec_mat[(i*30) + 22] / aux; |
|
594 | compressed_spec_mat[(i*30) + 22] = compressed_spec_mat[(i*30) + 22] / aux; | |
592 | compressed_spec_mat[(i*30) + 23] = compressed_spec_mat[(i*30) + 23] / aux; |
|
595 | compressed_spec_mat[(i*30) + 23] = compressed_spec_mat[(i*30) + 23] / aux; | |
593 | } |
|
596 | } | |
594 | } |
|
597 | } | |
595 |
|
598 | |||
596 | void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header) |
|
599 | void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header) | |
597 | { |
|
600 | { | |
598 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
601 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; | |
599 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
602 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
600 | header->reserved = 0x00; |
|
603 | header->reserved = 0x00; | |
601 | header->userApplication = CCSDS_USER_APP; |
|
604 | header->userApplication = CCSDS_USER_APP; | |
602 | header->packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); |
|
605 | header->packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); | |
603 | header->packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); |
|
606 | header->packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); | |
604 | header->packetSequenceControl[0] = 0xc0; |
|
607 | header->packetSequenceControl[0] = 0xc0; | |
605 | header->packetSequenceControl[1] = 0x00; |
|
608 | header->packetSequenceControl[1] = 0x00; | |
606 | header->packetLength[0] = 0x00; |
|
609 | header->packetLength[0] = 0x00; | |
607 | header->packetLength[1] = 0x00; |
|
610 | header->packetLength[1] = 0x00; | |
608 | // DATA FIELD HEADER |
|
611 | // DATA FIELD HEADER | |
609 | header->spare1_pusVersion_spare2 = 0x10; |
|
612 | header->spare1_pusVersion_spare2 = 0x10; | |
610 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
613 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
611 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
614 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
612 | header->destinationID = TM_DESTINATION_ID_GROUND; |
|
615 | header->destinationID = TM_DESTINATION_ID_GROUND; | |
613 | // AUXILIARY DATA HEADER |
|
616 | // AUXILIARY DATA HEADER | |
614 | header->sid = 0x00; |
|
617 | header->sid = 0x00; | |
615 | header->biaStatusInfo = 0x00; |
|
618 | header->biaStatusInfo = 0x00; | |
616 | header->pa_lfr_pkt_cnt_asm = 0x00; |
|
619 | header->pa_lfr_pkt_cnt_asm = 0x00; | |
617 | header->pa_lfr_pkt_nr_asm = 0x00; |
|
620 | header->pa_lfr_pkt_nr_asm = 0x00; | |
618 | header->time[0] = 0x00; |
|
621 | header->time[0] = 0x00; | |
619 | header->time[0] = 0x00; |
|
622 | header->time[0] = 0x00; | |
620 | header->time[0] = 0x00; |
|
623 | header->time[0] = 0x00; | |
621 | header->time[0] = 0x00; |
|
624 | header->time[0] = 0x00; | |
622 | header->time[0] = 0x00; |
|
625 | header->time[0] = 0x00; | |
623 | header->time[0] = 0x00; |
|
626 | header->time[0] = 0x00; | |
624 | header->pa_lfr_asm_blk_nr[0] = 0x00; // BLK_NR MSB |
|
627 | header->pa_lfr_asm_blk_nr[0] = 0x00; // BLK_NR MSB | |
625 | header->pa_lfr_asm_blk_nr[1] = 0x00; // BLK_NR LSB |
|
628 | header->pa_lfr_asm_blk_nr[1] = 0x00; // BLK_NR LSB | |
626 | } |
|
629 | } | |
627 |
|
630 | |||
628 | void fill_averaged_spectral_matrix(void) |
|
631 | void fill_averaged_spectral_matrix(void) | |
629 | { |
|
632 | { | |
630 | /** This function fills spectral matrices related buffers with arbitrary data. |
|
633 | /** This function fills spectral matrices related buffers with arbitrary data. | |
631 | * |
|
634 | * | |
632 | * This function is for testing purpose only. |
|
635 | * This function is for testing purpose only. | |
633 | * |
|
636 | * | |
634 | */ |
|
637 | */ | |
635 |
|
638 | |||
636 | float offset; |
|
639 | float offset; | |
637 | float coeff; |
|
640 | float coeff; | |
638 |
|
641 | |||
639 | offset = 10.; |
|
642 | offset = 10.; | |
640 | coeff = 100000.; |
|
643 | coeff = 100000.; | |
641 | averaged_sm_f0[ 0 + 25 * 0 ] = 0. + offset; |
|
644 | averaged_sm_f0[ 0 + 25 * 0 ] = 0. + offset; | |
642 | averaged_sm_f0[ 0 + 25 * 1 ] = 1. + offset; |
|
645 | averaged_sm_f0[ 0 + 25 * 1 ] = 1. + offset; | |
643 | averaged_sm_f0[ 0 + 25 * 2 ] = 2. + offset; |
|
646 | averaged_sm_f0[ 0 + 25 * 2 ] = 2. + offset; | |
644 | averaged_sm_f0[ 0 + 25 * 3 ] = 3. + offset; |
|
647 | averaged_sm_f0[ 0 + 25 * 3 ] = 3. + offset; | |
645 | averaged_sm_f0[ 0 + 25 * 4 ] = 4. + offset; |
|
648 | averaged_sm_f0[ 0 + 25 * 4 ] = 4. + offset; | |
646 | averaged_sm_f0[ 0 + 25 * 5 ] = 5. + offset; |
|
649 | averaged_sm_f0[ 0 + 25 * 5 ] = 5. + offset; | |
647 | averaged_sm_f0[ 0 + 25 * 6 ] = 6. + offset; |
|
650 | averaged_sm_f0[ 0 + 25 * 6 ] = 6. + offset; | |
648 | averaged_sm_f0[ 0 + 25 * 7 ] = 7. + offset; |
|
651 | averaged_sm_f0[ 0 + 25 * 7 ] = 7. + offset; | |
649 | averaged_sm_f0[ 0 + 25 * 8 ] = 8. + offset; |
|
652 | averaged_sm_f0[ 0 + 25 * 8 ] = 8. + offset; | |
650 | averaged_sm_f0[ 0 + 25 * 9 ] = 9. + offset; |
|
653 | averaged_sm_f0[ 0 + 25 * 9 ] = 9. + offset; | |
651 | averaged_sm_f0[ 0 + 25 * 10 ] = 10. + offset; |
|
654 | averaged_sm_f0[ 0 + 25 * 10 ] = 10. + offset; | |
652 | averaged_sm_f0[ 0 + 25 * 11 ] = 11. + offset; |
|
655 | averaged_sm_f0[ 0 + 25 * 11 ] = 11. + offset; | |
653 | averaged_sm_f0[ 0 + 25 * 12 ] = 12. + offset; |
|
656 | averaged_sm_f0[ 0 + 25 * 12 ] = 12. + offset; | |
654 | averaged_sm_f0[ 0 + 25 * 13 ] = 13. + offset; |
|
657 | averaged_sm_f0[ 0 + 25 * 13 ] = 13. + offset; | |
655 | averaged_sm_f0[ 0 + 25 * 14 ] = 14. + offset; |
|
658 | averaged_sm_f0[ 0 + 25 * 14 ] = 14. + offset; | |
656 | averaged_sm_f0[ 9 + 25 * 0 ] = -(0. + offset)* coeff; |
|
659 | averaged_sm_f0[ 9 + 25 * 0 ] = -(0. + offset)* coeff; | |
657 | averaged_sm_f0[ 9 + 25 * 1 ] = -(1. + offset)* coeff; |
|
660 | averaged_sm_f0[ 9 + 25 * 1 ] = -(1. + offset)* coeff; | |
658 | averaged_sm_f0[ 9 + 25 * 2 ] = -(2. + offset)* coeff; |
|
661 | averaged_sm_f0[ 9 + 25 * 2 ] = -(2. + offset)* coeff; | |
659 | averaged_sm_f0[ 9 + 25 * 3 ] = -(3. + offset)* coeff; |
|
662 | averaged_sm_f0[ 9 + 25 * 3 ] = -(3. + offset)* coeff; | |
660 | averaged_sm_f0[ 9 + 25 * 4 ] = -(4. + offset)* coeff; |
|
663 | averaged_sm_f0[ 9 + 25 * 4 ] = -(4. + offset)* coeff; | |
661 | averaged_sm_f0[ 9 + 25 * 5 ] = -(5. + offset)* coeff; |
|
664 | averaged_sm_f0[ 9 + 25 * 5 ] = -(5. + offset)* coeff; | |
662 | averaged_sm_f0[ 9 + 25 * 6 ] = -(6. + offset)* coeff; |
|
665 | averaged_sm_f0[ 9 + 25 * 6 ] = -(6. + offset)* coeff; | |
663 | averaged_sm_f0[ 9 + 25 * 7 ] = -(7. + offset)* coeff; |
|
666 | averaged_sm_f0[ 9 + 25 * 7 ] = -(7. + offset)* coeff; | |
664 | averaged_sm_f0[ 9 + 25 * 8 ] = -(8. + offset)* coeff; |
|
667 | averaged_sm_f0[ 9 + 25 * 8 ] = -(8. + offset)* coeff; | |
665 | averaged_sm_f0[ 9 + 25 * 9 ] = -(9. + offset)* coeff; |
|
668 | averaged_sm_f0[ 9 + 25 * 9 ] = -(9. + offset)* coeff; | |
666 | averaged_sm_f0[ 9 + 25 * 10 ] = -(10. + offset)* coeff; |
|
669 | averaged_sm_f0[ 9 + 25 * 10 ] = -(10. + offset)* coeff; | |
667 | averaged_sm_f0[ 9 + 25 * 11 ] = -(11. + offset)* coeff; |
|
670 | averaged_sm_f0[ 9 + 25 * 11 ] = -(11. + offset)* coeff; | |
668 | averaged_sm_f0[ 9 + 25 * 12 ] = -(12. + offset)* coeff; |
|
671 | averaged_sm_f0[ 9 + 25 * 12 ] = -(12. + offset)* coeff; | |
669 | averaged_sm_f0[ 9 + 25 * 13 ] = -(13. + offset)* coeff; |
|
672 | averaged_sm_f0[ 9 + 25 * 13 ] = -(13. + offset)* coeff; | |
670 | averaged_sm_f0[ 9 + 25 * 14 ] = -(14. + offset)* coeff; |
|
673 | averaged_sm_f0[ 9 + 25 * 14 ] = -(14. + offset)* coeff; | |
671 |
|
674 | |||
672 | offset = 10000000; |
|
675 | offset = 10000000; | |
673 | averaged_sm_f0[ 16 + 25 * 0 ] = (0. + offset)* coeff; |
|
676 | averaged_sm_f0[ 16 + 25 * 0 ] = (0. + offset)* coeff; | |
674 | averaged_sm_f0[ 16 + 25 * 1 ] = (1. + offset)* coeff; |
|
677 | averaged_sm_f0[ 16 + 25 * 1 ] = (1. + offset)* coeff; | |
675 | averaged_sm_f0[ 16 + 25 * 2 ] = (2. + offset)* coeff; |
|
678 | averaged_sm_f0[ 16 + 25 * 2 ] = (2. + offset)* coeff; | |
676 | averaged_sm_f0[ 16 + 25 * 3 ] = (3. + offset)* coeff; |
|
679 | averaged_sm_f0[ 16 + 25 * 3 ] = (3. + offset)* coeff; | |
677 | averaged_sm_f0[ 16 + 25 * 4 ] = (4. + offset)* coeff; |
|
680 | averaged_sm_f0[ 16 + 25 * 4 ] = (4. + offset)* coeff; | |
678 | averaged_sm_f0[ 16 + 25 * 5 ] = (5. + offset)* coeff; |
|
681 | averaged_sm_f0[ 16 + 25 * 5 ] = (5. + offset)* coeff; | |
679 | averaged_sm_f0[ 16 + 25 * 6 ] = (6. + offset)* coeff; |
|
682 | averaged_sm_f0[ 16 + 25 * 6 ] = (6. + offset)* coeff; | |
680 | averaged_sm_f0[ 16 + 25 * 7 ] = (7. + offset)* coeff; |
|
683 | averaged_sm_f0[ 16 + 25 * 7 ] = (7. + offset)* coeff; | |
681 | averaged_sm_f0[ 16 + 25 * 8 ] = (8. + offset)* coeff; |
|
684 | averaged_sm_f0[ 16 + 25 * 8 ] = (8. + offset)* coeff; | |
682 | averaged_sm_f0[ 16 + 25 * 9 ] = (9. + offset)* coeff; |
|
685 | averaged_sm_f0[ 16 + 25 * 9 ] = (9. + offset)* coeff; | |
683 | averaged_sm_f0[ 16 + 25 * 10 ] = (10. + offset)* coeff; |
|
686 | averaged_sm_f0[ 16 + 25 * 10 ] = (10. + offset)* coeff; | |
684 | averaged_sm_f0[ 16 + 25 * 11 ] = (11. + offset)* coeff; |
|
687 | averaged_sm_f0[ 16 + 25 * 11 ] = (11. + offset)* coeff; | |
685 | averaged_sm_f0[ 16 + 25 * 12 ] = (12. + offset)* coeff; |
|
688 | averaged_sm_f0[ 16 + 25 * 12 ] = (12. + offset)* coeff; | |
686 | averaged_sm_f0[ 16 + 25 * 13 ] = (13. + offset)* coeff; |
|
689 | averaged_sm_f0[ 16 + 25 * 13 ] = (13. + offset)* coeff; | |
687 | averaged_sm_f0[ 16 + 25 * 14 ] = (14. + offset)* coeff; |
|
690 | averaged_sm_f0[ 16 + 25 * 14 ] = (14. + offset)* coeff; | |
688 |
|
691 | |||
689 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 0 ] = averaged_sm_f0[ 0 ]; |
|
692 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 0 ] = averaged_sm_f0[ 0 ]; | |
690 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 1 ] = averaged_sm_f0[ 1 ]; |
|
693 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 1 ] = averaged_sm_f0[ 1 ]; | |
691 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 2 ] = averaged_sm_f0[ 2 ]; |
|
694 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 2 ] = averaged_sm_f0[ 2 ]; | |
692 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 3 ] = averaged_sm_f0[ 3 ]; |
|
695 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 3 ] = averaged_sm_f0[ 3 ]; | |
693 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 4 ] = averaged_sm_f0[ 4 ]; |
|
696 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 4 ] = averaged_sm_f0[ 4 ]; | |
694 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 5 ] = averaged_sm_f0[ 5 ]; |
|
697 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 5 ] = averaged_sm_f0[ 5 ]; | |
695 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 6 ] = averaged_sm_f0[ 6 ]; |
|
698 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 6 ] = averaged_sm_f0[ 6 ]; | |
696 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 7 ] = averaged_sm_f0[ 7 ]; |
|
699 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 7 ] = averaged_sm_f0[ 7 ]; | |
697 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 8 ] = averaged_sm_f0[ 8 ]; |
|
700 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 8 ] = averaged_sm_f0[ 8 ]; | |
698 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 9 ] = averaged_sm_f0[ 9 ]; |
|
701 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 9 ] = averaged_sm_f0[ 9 ]; | |
699 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 10 ] = averaged_sm_f0[ 10 ]; |
|
702 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 10 ] = averaged_sm_f0[ 10 ]; | |
700 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 11 ] = averaged_sm_f0[ 11 ]; |
|
703 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 11 ] = averaged_sm_f0[ 11 ]; | |
701 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 12 ] = averaged_sm_f0[ 12 ]; |
|
704 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 12 ] = averaged_sm_f0[ 12 ]; | |
702 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 13 ] = averaged_sm_f0[ 13 ]; |
|
705 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 13 ] = averaged_sm_f0[ 13 ]; | |
703 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 14 ] = averaged_sm_f0[ 14 ]; |
|
706 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 14 ] = averaged_sm_f0[ 14 ]; | |
704 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 15 ] = averaged_sm_f0[ 15 ]; |
|
707 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 15 ] = averaged_sm_f0[ 15 ]; | |
705 | } |
|
708 | } | |
706 |
|
709 | |||
707 | void reset_spectral_matrix_regs() |
|
710 | void reset_spectral_matrix_regs() | |
708 | { |
|
711 | { | |
709 | /** This function resets the spectral matrices module registers. |
|
712 | /** This function resets the spectral matrices module registers. | |
710 | * |
|
713 | * | |
711 | * The registers affected by this function are located at the following offset addresses: |
|
714 | * The registers affected by this function are located at the following offset addresses: | |
712 | * |
|
715 | * | |
713 | * - 0x00 config |
|
716 | * - 0x00 config | |
714 | * - 0x04 status |
|
717 | * - 0x04 status | |
715 | * - 0x08 matrixF0_Address0 |
|
718 | * - 0x08 matrixF0_Address0 | |
716 | * - 0x10 matrixFO_Address1 |
|
719 | * - 0x10 matrixFO_Address1 | |
717 | * - 0x14 matrixF1_Address |
|
720 | * - 0x14 matrixF1_Address | |
718 | * - 0x18 matrixF2_Address |
|
721 | * - 0x18 matrixF2_Address | |
719 | * |
|
722 | * | |
720 | */ |
|
723 | */ | |
721 |
|
724 | |||
722 | spectral_matrix_regs->config = 0x00; |
|
725 | spectral_matrix_regs->config = 0x00; | |
723 | spectral_matrix_regs->status = 0x00; |
|
726 | spectral_matrix_regs->status = 0x00; | |
724 |
|
727 | |||
725 | spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address; |
|
728 | spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address; | |
726 | spectral_matrix_regs->matrixFO_Address1 = current_ring_node_sm_f0->buffer_address; |
|
729 | spectral_matrix_regs->matrixFO_Address1 = current_ring_node_sm_f0->buffer_address; | |
727 | spectral_matrix_regs->matrixF1_Address = current_ring_node_sm_f1->buffer_address; |
|
730 | spectral_matrix_regs->matrixF1_Address = current_ring_node_sm_f1->buffer_address; | |
728 | spectral_matrix_regs->matrixF2_Address = current_ring_node_sm_f2->buffer_address; |
|
731 | spectral_matrix_regs->matrixF2_Address = current_ring_node_sm_f2->buffer_address; | |
729 | } |
|
732 | } | |
730 |
|
733 | |||
731 | //****************** |
|
734 | //****************** | |
732 | // general functions |
|
735 | // general functions | |
733 |
|
736 | |||
734 |
|
737 | |||
735 |
|
738 | |||
736 |
|
739 |
@@ -1,601 +1,601 | |||||
1 | /** Functions related to the SpaceWire interface. |
|
1 | /** Functions related to the SpaceWire interface. | |
2 | * |
|
2 | * | |
3 | * @file |
|
3 | * @file | |
4 | * @author P. LEROY |
|
4 | * @author P. LEROY | |
5 | * |
|
5 | * | |
6 | * A group of functions to handle SpaceWire transmissions: |
|
6 | * A group of functions to handle SpaceWire transmissions: | |
7 | * - configuration of the SpaceWire link |
|
7 | * - configuration of the SpaceWire link | |
8 | * - SpaceWire related interruption requests processing |
|
8 | * - SpaceWire related interruption requests processing | |
9 | * - transmission of TeleMetry packets by a dedicated RTEMS task |
|
9 | * - transmission of TeleMetry packets by a dedicated RTEMS task | |
10 | * - reception of TeleCommands by a dedicated RTEMS task |
|
10 | * - reception of TeleCommands by a dedicated RTEMS task | |
11 | * |
|
11 | * | |
12 | */ |
|
12 | */ | |
13 |
|
13 | |||
14 | #include "fsw_spacewire.h" |
|
14 | #include "fsw_spacewire.h" | |
15 |
|
15 | |||
16 | rtems_name semq_name; |
|
16 | rtems_name semq_name; | |
17 | rtems_id semq_id; |
|
17 | rtems_id semq_id; | |
18 |
|
18 | |||
19 | //*********** |
|
19 | //*********** | |
20 | // RTEMS TASK |
|
20 | // RTEMS TASK | |
21 | rtems_task spiq_task(rtems_task_argument unused) |
|
21 | rtems_task spiq_task(rtems_task_argument unused) | |
22 | { |
|
22 | { | |
23 | /** This RTEMS task is awaken by an rtems_event sent by the interruption subroutine of the SpaceWire driver. |
|
23 | /** This RTEMS task is awaken by an rtems_event sent by the interruption subroutine of the SpaceWire driver. | |
24 | * |
|
24 | * | |
25 | * @param unused is the starting argument of the RTEMS task |
|
25 | * @param unused is the starting argument of the RTEMS task | |
26 | * |
|
26 | * | |
27 | */ |
|
27 | */ | |
28 |
|
28 | |||
29 | rtems_event_set event_out; |
|
29 | rtems_event_set event_out; | |
30 | rtems_status_code status; |
|
30 | rtems_status_code status; | |
31 | int linkStatus; |
|
31 | int linkStatus; | |
32 |
|
32 | |||
33 | BOOT_PRINTF("in SPIQ *** \n") |
|
33 | BOOT_PRINTF("in SPIQ *** \n") | |
34 |
|
34 | |||
35 | while(true){ |
|
35 | while(true){ | |
36 | rtems_event_receive(SPW_LINKERR_EVENT, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an SPW_LINKERR_EVENT |
|
36 | rtems_event_receive(SPW_LINKERR_EVENT, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an SPW_LINKERR_EVENT | |
37 | PRINTF("in SPIQ *** got SPW_LINKERR_EVENT\n") |
|
37 | PRINTF("in SPIQ *** got SPW_LINKERR_EVENT\n") | |
38 |
|
38 | |||
39 | // [0] SUSPEND RECV AND SEND TASKS |
|
39 | // [0] SUSPEND RECV AND SEND TASKS | |
40 | status = rtems_task_suspend( Task_id[ TASKID_RECV ] ); |
|
40 | status = rtems_task_suspend( Task_id[ TASKID_RECV ] ); | |
41 | if ( status != RTEMS_SUCCESSFUL ) { |
|
41 | if ( status != RTEMS_SUCCESSFUL ) { | |
42 | PRINTF("in SPIQ *** ERR suspending RECV Task\n") |
|
42 | PRINTF("in SPIQ *** ERR suspending RECV Task\n") | |
43 | } |
|
43 | } | |
44 | status = rtems_task_suspend( Task_id[ TASKID_SEND ] ); |
|
44 | status = rtems_task_suspend( Task_id[ TASKID_SEND ] ); | |
45 | if ( status != RTEMS_SUCCESSFUL ) { |
|
45 | if ( status != RTEMS_SUCCESSFUL ) { | |
46 | PRINTF("in SPIQ *** ERR suspending SEND Task\n") |
|
46 | PRINTF("in SPIQ *** ERR suspending SEND Task\n") | |
47 | } |
|
47 | } | |
48 |
|
48 | |||
49 | // [1] CHECK THE LINK |
|
49 | // [1] CHECK THE LINK | |
50 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status (1) |
|
50 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status (1) | |
51 | if ( linkStatus != 5) { |
|
51 | if ( linkStatus != 5) { | |
52 | PRINTF1("in SPIQ *** linkStatus %d, wait...\n", linkStatus) |
|
52 | PRINTF1("in SPIQ *** linkStatus %d, wait...\n", linkStatus) | |
53 | status = rtems_task_wake_after( SY_LFR_DPU_CONNECT_TIMEOUT ); // wait SY_LFR_DPU_CONNECT_TIMEOUT 1000 ms |
|
53 | status = rtems_task_wake_after( SY_LFR_DPU_CONNECT_TIMEOUT ); // wait SY_LFR_DPU_CONNECT_TIMEOUT 1000 ms | |
54 | } |
|
54 | } | |
55 |
|
55 | |||
56 | // [2] RECHECK THE LINK AFTER SY_LFR_DPU_CONNECT_TIMEOUT |
|
56 | // [2] RECHECK THE LINK AFTER SY_LFR_DPU_CONNECT_TIMEOUT | |
57 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status (2) |
|
57 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status (2) | |
58 | if ( linkStatus != 5 ) // [2.a] not in run state, reset the link |
|
58 | if ( linkStatus != 5 ) // [2.a] not in run state, reset the link | |
59 | { |
|
59 | { | |
60 | spacewire_compute_stats_offsets(); |
|
60 | spacewire_compute_stats_offsets(); | |
61 | status = spacewire_reset_link( ); |
|
61 | status = spacewire_reset_link( ); | |
62 | } |
|
62 | } | |
63 | else // [2.b] in run state, start the link |
|
63 | else // [2.b] in run state, start the link | |
64 | { |
|
64 | { | |
65 | status = spacewire_stop_start_link( fdSPW ); // start the link |
|
65 | status = spacewire_stop_start_link( fdSPW ); // start the link | |
66 | if ( status != RTEMS_SUCCESSFUL) |
|
66 | if ( status != RTEMS_SUCCESSFUL) | |
67 | { |
|
67 | { | |
68 | PRINTF1("in SPIQ *** ERR spacewire_start_link %d\n", status) |
|
68 | PRINTF1("in SPIQ *** ERR spacewire_start_link %d\n", status) | |
69 | } |
|
69 | } | |
70 | } |
|
70 | } | |
71 |
|
71 | |||
72 | // [3] COMPLETE RECOVERY ACTION AFTER SY_LFR_DPU_CONNECT_ATTEMPTS |
|
72 | // [3] COMPLETE RECOVERY ACTION AFTER SY_LFR_DPU_CONNECT_ATTEMPTS | |
73 | if ( status == RTEMS_SUCCESSFUL ) // [3.a] the link is in run state and has been started successfully |
|
73 | if ( status == RTEMS_SUCCESSFUL ) // [3.a] the link is in run state and has been started successfully | |
74 | { |
|
74 | { | |
75 | status = rtems_task_restart( Task_id[ TASKID_SEND ], 1 ); |
|
75 | status = rtems_task_restart( Task_id[ TASKID_SEND ], 1 ); | |
76 | if ( status != RTEMS_SUCCESSFUL ) { |
|
76 | if ( status != RTEMS_SUCCESSFUL ) { | |
77 | PRINTF("in SPIQ *** ERR resuming SEND Task\n") |
|
77 | PRINTF("in SPIQ *** ERR resuming SEND Task\n") | |
78 | } |
|
78 | } | |
79 | status = rtems_task_restart( Task_id[ TASKID_RECV ], 1 ); |
|
79 | status = rtems_task_restart( Task_id[ TASKID_RECV ], 1 ); | |
80 | if ( status != RTEMS_SUCCESSFUL ) { |
|
80 | if ( status != RTEMS_SUCCESSFUL ) { | |
81 | PRINTF("in SPIQ *** ERR resuming RECV Task\n") |
|
81 | PRINTF("in SPIQ *** ERR resuming RECV Task\n") | |
82 | } |
|
82 | } | |
83 | } |
|
83 | } | |
84 | else // [3.b] the link is not in run state, go in STANDBY mode |
|
84 | else // [3.b] the link is not in run state, go in STANDBY mode | |
85 | { |
|
85 | { | |
86 | status = stop_current_mode(); |
|
86 | status = stop_current_mode(); | |
87 | if ( status != RTEMS_SUCCESSFUL ) { |
|
87 | if ( status != RTEMS_SUCCESSFUL ) { | |
88 | PRINTF1("in SPIQ *** ERR stop_current_mode *** code %d\n", status) |
|
88 | PRINTF1("in SPIQ *** ERR stop_current_mode *** code %d\n", status) | |
89 | } |
|
89 | } | |
90 | status = enter_mode( LFR_MODE_STANDBY ); |
|
90 | status = enter_mode( LFR_MODE_STANDBY ); | |
91 | if ( status != RTEMS_SUCCESSFUL ) { |
|
91 | if ( status != RTEMS_SUCCESSFUL ) { | |
92 | PRINTF1("in SPIQ *** ERR enter_standby_mode *** code %d\n", status) |
|
92 | PRINTF1("in SPIQ *** ERR enter_standby_mode *** code %d\n", status) | |
93 | } |
|
93 | } | |
94 | // wake the WTDG task up to wait for the link recovery |
|
94 | // wake the WTDG task up to wait for the link recovery | |
95 | status = rtems_event_send ( Task_id[TASKID_WTDG], RTEMS_EVENT_0 ); |
|
95 | status = rtems_event_send ( Task_id[TASKID_WTDG], RTEMS_EVENT_0 ); | |
96 | status = rtems_task_suspend( RTEMS_SELF ); |
|
96 | status = rtems_task_suspend( RTEMS_SELF ); | |
97 | } |
|
97 | } | |
98 | } |
|
98 | } | |
99 | } |
|
99 | } | |
100 |
|
100 | |||
101 | rtems_task recv_task( rtems_task_argument unused ) |
|
101 | rtems_task recv_task( rtems_task_argument unused ) | |
102 | { |
|
102 | { | |
103 | /** This RTEMS task is dedicated to the reception of incoming TeleCommands. |
|
103 | /** This RTEMS task is dedicated to the reception of incoming TeleCommands. | |
104 | * |
|
104 | * | |
105 | * @param unused is the starting argument of the RTEMS task |
|
105 | * @param unused is the starting argument of the RTEMS task | |
106 | * |
|
106 | * | |
107 | * The RECV task blocks on a call to the read system call, waiting for incoming SpaceWire data. When unblocked: |
|
107 | * The RECV task blocks on a call to the read system call, waiting for incoming SpaceWire data. When unblocked: | |
108 | * 1. It reads the incoming data. |
|
108 | * 1. It reads the incoming data. | |
109 | * 2. Launches the acceptance procedure. |
|
109 | * 2. Launches the acceptance procedure. | |
110 | * 3. If the Telecommand is valid, sends it to a dedicated RTEMS message queue. |
|
110 | * 3. If the Telecommand is valid, sends it to a dedicated RTEMS message queue. | |
111 | * |
|
111 | * | |
112 | */ |
|
112 | */ | |
113 |
|
113 | |||
114 | int len; |
|
114 | int len; | |
115 | ccsdsTelecommandPacket_t currentTC; |
|
115 | ccsdsTelecommandPacket_t currentTC; | |
116 | unsigned char computed_CRC[ 2 ]; |
|
116 | unsigned char computed_CRC[ 2 ]; | |
117 | unsigned char currentTC_LEN_RCV[ 2 ]; |
|
117 | unsigned char currentTC_LEN_RCV[ 2 ]; | |
118 | unsigned char destinationID; |
|
118 | unsigned char destinationID; | |
119 | unsigned int currentTC_LEN_RCV_AsUnsignedInt; |
|
119 | unsigned int currentTC_LEN_RCV_AsUnsignedInt; | |
120 | unsigned int parserCode; |
|
120 | unsigned int parserCode; | |
121 | unsigned char time[6]; |
|
121 | unsigned char time[6]; | |
122 | rtems_status_code status; |
|
122 | rtems_status_code status; | |
123 | rtems_id queue_recv_id; |
|
123 | rtems_id queue_recv_id; | |
124 | rtems_id queue_send_id; |
|
124 | rtems_id queue_send_id; | |
125 |
|
125 | |||
126 | initLookUpTableForCRC(); // the table is used to compute Cyclic Redundancy Codes |
|
126 | initLookUpTableForCRC(); // the table is used to compute Cyclic Redundancy Codes | |
127 |
|
127 | |||
128 | status = get_message_queue_id_recv( &queue_recv_id ); |
|
128 | status = get_message_queue_id_recv( &queue_recv_id ); | |
129 | if (status != RTEMS_SUCCESSFUL) |
|
129 | if (status != RTEMS_SUCCESSFUL) | |
130 | { |
|
130 | { | |
131 | PRINTF1("in RECV *** ERR get_message_queue_id_recv %d\n", status) |
|
131 | PRINTF1("in RECV *** ERR get_message_queue_id_recv %d\n", status) | |
132 | } |
|
132 | } | |
133 |
|
133 | |||
134 | status = get_message_queue_id_send( &queue_send_id ); |
|
134 | status = get_message_queue_id_send( &queue_send_id ); | |
135 | if (status != RTEMS_SUCCESSFUL) |
|
135 | if (status != RTEMS_SUCCESSFUL) | |
136 | { |
|
136 | { | |
137 | PRINTF1("in RECV *** ERR get_message_queue_id_send %d\n", status) |
|
137 | PRINTF1("in RECV *** ERR get_message_queue_id_send %d\n", status) | |
138 | } |
|
138 | } | |
139 |
|
139 | |||
140 | BOOT_PRINTF("in RECV *** \n") |
|
140 | BOOT_PRINTF("in RECV *** \n") | |
141 |
|
141 | |||
142 | while(1) |
|
142 | while(1) | |
143 | { |
|
143 | { | |
144 | len = read( fdSPW, (char*) ¤tTC, CCSDS_TC_PKT_MAX_SIZE ); // the call to read is blocking |
|
144 | len = read( fdSPW, (char*) ¤tTC, CCSDS_TC_PKT_MAX_SIZE ); // the call to read is blocking | |
145 | if (len == -1){ // error during the read call |
|
145 | if (len == -1){ // error during the read call | |
146 | PRINTF1("in RECV *** last read call returned -1, ERRNO %d\n", errno) |
|
146 | PRINTF1("in RECV *** last read call returned -1, ERRNO %d\n", errno) | |
147 | } |
|
147 | } | |
148 | else { |
|
148 | else { | |
149 | if ( (len+1) < CCSDS_TC_PKT_MIN_SIZE ) { |
|
149 | if ( (len+1) < CCSDS_TC_PKT_MIN_SIZE ) { | |
150 | PRINTF("in RECV *** packet lenght too short\n") |
|
150 | PRINTF("in RECV *** packet lenght too short\n") | |
151 | } |
|
151 | } | |
152 | else { |
|
152 | else { | |
153 | currentTC_LEN_RCV_AsUnsignedInt = (unsigned int) (len - CCSDS_TC_TM_PACKET_OFFSET - 3); // => -3 is for Prot ID, Reserved and User App bytes |
|
153 | currentTC_LEN_RCV_AsUnsignedInt = (unsigned int) (len - CCSDS_TC_TM_PACKET_OFFSET - 3); // => -3 is for Prot ID, Reserved and User App bytes | |
154 | currentTC_LEN_RCV[ 0 ] = (unsigned char) (currentTC_LEN_RCV_AsUnsignedInt >> 8); |
|
154 | currentTC_LEN_RCV[ 0 ] = (unsigned char) (currentTC_LEN_RCV_AsUnsignedInt >> 8); | |
155 | currentTC_LEN_RCV[ 1 ] = (unsigned char) (currentTC_LEN_RCV_AsUnsignedInt ); |
|
155 | currentTC_LEN_RCV[ 1 ] = (unsigned char) (currentTC_LEN_RCV_AsUnsignedInt ); | |
156 | // CHECK THE TC |
|
156 | // CHECK THE TC | |
157 | parserCode = tc_parser( ¤tTC, currentTC_LEN_RCV_AsUnsignedInt, computed_CRC ) ; |
|
157 | parserCode = tc_parser( ¤tTC, currentTC_LEN_RCV_AsUnsignedInt, computed_CRC ) ; | |
158 | if ( (parserCode == ILLEGAL_APID) || (parserCode == WRONG_LEN_PKT) |
|
158 | if ( (parserCode == ILLEGAL_APID) || (parserCode == WRONG_LEN_PKT) | |
159 | || (parserCode == INCOR_CHECKSUM) || (parserCode == ILL_TYPE) |
|
159 | || (parserCode == INCOR_CHECKSUM) || (parserCode == ILL_TYPE) | |
160 | || (parserCode == ILL_SUBTYPE) || (parserCode == WRONG_APP_DATA) |
|
160 | || (parserCode == ILL_SUBTYPE) || (parserCode == WRONG_APP_DATA) | |
161 | || (parserCode == WRONG_SRC_ID) ) |
|
161 | || (parserCode == WRONG_SRC_ID) ) | |
162 | { // send TM_LFR_TC_EXE_CORRUPTED |
|
162 | { // send TM_LFR_TC_EXE_CORRUPTED | |
163 | if ( !( (currentTC.serviceType==TC_TYPE_TIME) && (currentTC.serviceSubType==TC_SUBTYPE_UPDT_TIME) ) |
|
163 | if ( !( (currentTC.serviceType==TC_TYPE_TIME) && (currentTC.serviceSubType==TC_SUBTYPE_UPDT_TIME) ) | |
164 | && |
|
164 | && | |
165 | !( (currentTC.serviceType==TC_TYPE_GEN) && (currentTC.serviceSubType==TC_SUBTYPE_UPDT_INFO)) |
|
165 | !( (currentTC.serviceType==TC_TYPE_GEN) && (currentTC.serviceSubType==TC_SUBTYPE_UPDT_INFO)) | |
166 | ) |
|
166 | ) | |
167 | { |
|
167 | { | |
168 | if ( parserCode == WRONG_SRC_ID ) |
|
168 | if ( parserCode == WRONG_SRC_ID ) | |
169 | { |
|
169 | { | |
170 | destinationID = SID_TC_GROUND; |
|
170 | destinationID = SID_TC_GROUND; | |
171 | } |
|
171 | } | |
172 | else |
|
172 | else | |
173 | { |
|
173 | { | |
174 | destinationID = currentTC.sourceID; |
|
174 | destinationID = currentTC.sourceID; | |
175 | } |
|
175 | } | |
176 | getTime( time ); |
|
176 | getTime( time ); | |
177 |
close_action( ¤tTC, LFR_DEFAULT, queue_send_id |
|
177 | close_action( ¤tTC, LFR_DEFAULT, queue_send_id ); | |
178 | send_tm_lfr_tc_exe_corrupted( ¤tTC, queue_send_id, |
|
178 | send_tm_lfr_tc_exe_corrupted( ¤tTC, queue_send_id, | |
179 | computed_CRC, currentTC_LEN_RCV, |
|
179 | computed_CRC, currentTC_LEN_RCV, | |
180 |
destinationID |
|
180 | destinationID ); | |
181 | } |
|
181 | } | |
182 | } |
|
182 | } | |
183 | else |
|
183 | else | |
184 | { // send valid TC to the action launcher |
|
184 | { // send valid TC to the action launcher | |
185 | status = rtems_message_queue_send( queue_recv_id, ¤tTC, |
|
185 | status = rtems_message_queue_send( queue_recv_id, ¤tTC, | |
186 | currentTC_LEN_RCV_AsUnsignedInt + CCSDS_TC_TM_PACKET_OFFSET + 3); |
|
186 | currentTC_LEN_RCV_AsUnsignedInt + CCSDS_TC_TM_PACKET_OFFSET + 3); | |
187 | } |
|
187 | } | |
188 | } |
|
188 | } | |
189 | } |
|
189 | } | |
190 | } |
|
190 | } | |
191 | } |
|
191 | } | |
192 |
|
192 | |||
193 | rtems_task send_task( rtems_task_argument argument) |
|
193 | rtems_task send_task( rtems_task_argument argument) | |
194 | { |
|
194 | { | |
195 | /** This RTEMS task is dedicated to the transmission of TeleMetry packets. |
|
195 | /** This RTEMS task is dedicated to the transmission of TeleMetry packets. | |
196 | * |
|
196 | * | |
197 | * @param unused is the starting argument of the RTEMS task |
|
197 | * @param unused is the starting argument of the RTEMS task | |
198 | * |
|
198 | * | |
199 | * The SEND task waits for a message to become available in the dedicated RTEMS queue. When a message arrives: |
|
199 | * The SEND task waits for a message to become available in the dedicated RTEMS queue. When a message arrives: | |
200 | * - if the first byte is equal to CCSDS_DESTINATION_ID, the message is sent as is using the write system call. |
|
200 | * - if the first byte is equal to CCSDS_DESTINATION_ID, the message is sent as is using the write system call. | |
201 | * - if the first byte is not equal to CCSDS_DESTINATION_ID, the message is handled as a spw_ioctl_pkt_send. After |
|
201 | * - if the first byte is not equal to CCSDS_DESTINATION_ID, the message is handled as a spw_ioctl_pkt_send. After | |
202 | * analyzis, the packet is sent either using the write system call or using the ioctl call SPACEWIRE_IOCTRL_SEND, depending on the |
|
202 | * analyzis, the packet is sent either using the write system call or using the ioctl call SPACEWIRE_IOCTRL_SEND, depending on the | |
203 | * data it contains. |
|
203 | * data it contains. | |
204 | * |
|
204 | * | |
205 | */ |
|
205 | */ | |
206 |
|
206 | |||
207 | rtems_status_code status; // RTEMS status code |
|
207 | rtems_status_code status; // RTEMS status code | |
208 | char incomingData[ACTION_MSG_PKTS_MAX_SIZE]; // incoming data buffer |
|
208 | char incomingData[ACTION_MSG_PKTS_MAX_SIZE]; // incoming data buffer | |
209 | spw_ioctl_pkt_send *spw_ioctl_send; |
|
209 | spw_ioctl_pkt_send *spw_ioctl_send; | |
210 | size_t size; // size of the incoming TC packet |
|
210 | size_t size; // size of the incoming TC packet | |
211 | u_int32_t count; |
|
211 | u_int32_t count; | |
212 | rtems_id queue_id; |
|
212 | rtems_id queue_id; | |
213 |
|
213 | |||
214 | status = get_message_queue_id_send( &queue_id ); |
|
214 | status = get_message_queue_id_send( &queue_id ); | |
215 | if (status != RTEMS_SUCCESSFUL) |
|
215 | if (status != RTEMS_SUCCESSFUL) | |
216 | { |
|
216 | { | |
217 | PRINTF1("in HOUS *** ERR get_message_queue_id_send %d\n", status) |
|
217 | PRINTF1("in HOUS *** ERR get_message_queue_id_send %d\n", status) | |
218 | } |
|
218 | } | |
219 |
|
219 | |||
220 | BOOT_PRINTF("in SEND *** \n") |
|
220 | BOOT_PRINTF("in SEND *** \n") | |
221 |
|
221 | |||
222 | while(1) |
|
222 | while(1) | |
223 | { |
|
223 | { | |
224 | status = rtems_message_queue_receive( queue_id, incomingData, &size, |
|
224 | status = rtems_message_queue_receive( queue_id, incomingData, &size, | |
225 | RTEMS_WAIT, RTEMS_NO_TIMEOUT ); |
|
225 | RTEMS_WAIT, RTEMS_NO_TIMEOUT ); | |
226 |
|
226 | |||
227 | if (status!=RTEMS_SUCCESSFUL) |
|
227 | if (status!=RTEMS_SUCCESSFUL) | |
228 | { |
|
228 | { | |
229 | PRINTF1("in SEND *** (1) ERR = %d\n", status) |
|
229 | PRINTF1("in SEND *** (1) ERR = %d\n", status) | |
230 | } |
|
230 | } | |
231 | else |
|
231 | else | |
232 | { |
|
232 | { | |
233 | if ( incomingData[0] == CCSDS_DESTINATION_ID) // the incoming message is a ccsds packet |
|
233 | if ( incomingData[0] == CCSDS_DESTINATION_ID) // the incoming message is a ccsds packet | |
234 | { |
|
234 | { | |
235 | status = write( fdSPW, incomingData, size ); |
|
235 | status = write( fdSPW, incomingData, size ); | |
236 | if (status == -1){ |
|
236 | if (status == -1){ | |
237 | PRINTF2("in SEND *** (2.a) ERRNO = %d, size = %d\n", errno, size) |
|
237 | PRINTF2("in SEND *** (2.a) ERRNO = %d, size = %d\n", errno, size) | |
238 | } |
|
238 | } | |
239 | } |
|
239 | } | |
240 | else // the incoming message is a spw_ioctl_pkt_send structure |
|
240 | else // the incoming message is a spw_ioctl_pkt_send structure | |
241 | { |
|
241 | { | |
242 | spw_ioctl_send = (spw_ioctl_pkt_send*) incomingData; |
|
242 | spw_ioctl_send = (spw_ioctl_pkt_send*) incomingData; | |
243 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, spw_ioctl_send ); |
|
243 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, spw_ioctl_send ); | |
244 | if (status == -1){ |
|
244 | if (status == -1){ | |
245 | PRINTF2("in SEND *** (2.b) ERRNO = %d, RTEMS = %d\n", errno, status) |
|
245 | PRINTF2("in SEND *** (2.b) ERRNO = %d, RTEMS = %d\n", errno, status) | |
246 | } |
|
246 | } | |
247 | } |
|
247 | } | |
248 | } |
|
248 | } | |
249 |
|
249 | |||
250 | status = rtems_message_queue_get_number_pending( queue_id, &count ); |
|
250 | status = rtems_message_queue_get_number_pending( queue_id, &count ); | |
251 | if (status != RTEMS_SUCCESSFUL) |
|
251 | if (status != RTEMS_SUCCESSFUL) | |
252 | { |
|
252 | { | |
253 | PRINTF1("in SEND *** (3) ERR = %d\n", status) |
|
253 | PRINTF1("in SEND *** (3) ERR = %d\n", status) | |
254 | } |
|
254 | } | |
255 | else |
|
255 | else | |
256 | { |
|
256 | { | |
257 | if (count > maxCount) |
|
257 | if (count > maxCount) | |
258 | { |
|
258 | { | |
259 | maxCount = count; |
|
259 | maxCount = count; | |
260 | } |
|
260 | } | |
261 | } |
|
261 | } | |
262 | } |
|
262 | } | |
263 | } |
|
263 | } | |
264 |
|
264 | |||
265 | rtems_task wtdg_task( rtems_task_argument argument ) |
|
265 | rtems_task wtdg_task( rtems_task_argument argument ) | |
266 | { |
|
266 | { | |
267 | rtems_event_set event_out; |
|
267 | rtems_event_set event_out; | |
268 | rtems_status_code status; |
|
268 | rtems_status_code status; | |
269 | int linkStatus; |
|
269 | int linkStatus; | |
270 |
|
270 | |||
271 | BOOT_PRINTF("in WTDG ***\n") |
|
271 | BOOT_PRINTF("in WTDG ***\n") | |
272 |
|
272 | |||
273 | while(1) |
|
273 | while(1) | |
274 | { |
|
274 | { | |
275 | // wait for an RTEMS_EVENT |
|
275 | // wait for an RTEMS_EVENT | |
276 | rtems_event_receive( RTEMS_EVENT_0, |
|
276 | rtems_event_receive( RTEMS_EVENT_0, | |
277 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
277 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
278 | PRINTF("in WTDG *** wait for the link\n") |
|
278 | PRINTF("in WTDG *** wait for the link\n") | |
279 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status |
|
279 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status | |
280 | while( linkStatus != 5) // wait for the link |
|
280 | while( linkStatus != 5) // wait for the link | |
281 | { |
|
281 | { | |
282 | rtems_task_wake_after( 10 ); |
|
282 | rtems_task_wake_after( 10 ); | |
283 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status |
|
283 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status | |
284 | } |
|
284 | } | |
285 |
|
285 | |||
286 | status = spacewire_stop_start_link( fdSPW ); |
|
286 | status = spacewire_stop_start_link( fdSPW ); | |
287 |
|
287 | |||
288 | if (status != RTEMS_SUCCESSFUL) |
|
288 | if (status != RTEMS_SUCCESSFUL) | |
289 | { |
|
289 | { | |
290 | PRINTF1("in WTDG *** ERR link not started %d\n", status) |
|
290 | PRINTF1("in WTDG *** ERR link not started %d\n", status) | |
291 | } |
|
291 | } | |
292 | else |
|
292 | else | |
293 | { |
|
293 | { | |
294 | PRINTF("in WTDG *** OK link started\n") |
|
294 | PRINTF("in WTDG *** OK link started\n") | |
295 | } |
|
295 | } | |
296 |
|
296 | |||
297 | // restart the SPIQ task |
|
297 | // restart the SPIQ task | |
298 | status = rtems_task_restart( Task_id[TASKID_SPIQ], 1 ); |
|
298 | status = rtems_task_restart( Task_id[TASKID_SPIQ], 1 ); | |
299 | if ( status != RTEMS_SUCCESSFUL ) { |
|
299 | if ( status != RTEMS_SUCCESSFUL ) { | |
300 | PRINTF("in SPIQ *** ERR restarting SPIQ Task\n") |
|
300 | PRINTF("in SPIQ *** ERR restarting SPIQ Task\n") | |
301 | } |
|
301 | } | |
302 |
|
302 | |||
303 | // restart RECV and SEND |
|
303 | // restart RECV and SEND | |
304 | status = rtems_task_restart( Task_id[ TASKID_SEND ], 1 ); |
|
304 | status = rtems_task_restart( Task_id[ TASKID_SEND ], 1 ); | |
305 | if ( status != RTEMS_SUCCESSFUL ) { |
|
305 | if ( status != RTEMS_SUCCESSFUL ) { | |
306 | PRINTF("in SPIQ *** ERR restarting SEND Task\n") |
|
306 | PRINTF("in SPIQ *** ERR restarting SEND Task\n") | |
307 | } |
|
307 | } | |
308 | status = rtems_task_restart( Task_id[ TASKID_RECV ], 1 ); |
|
308 | status = rtems_task_restart( Task_id[ TASKID_RECV ], 1 ); | |
309 | if ( status != RTEMS_SUCCESSFUL ) { |
|
309 | if ( status != RTEMS_SUCCESSFUL ) { | |
310 | PRINTF("in SPIQ *** ERR restarting RECV Task\n") |
|
310 | PRINTF("in SPIQ *** ERR restarting RECV Task\n") | |
311 | } |
|
311 | } | |
312 | } |
|
312 | } | |
313 | } |
|
313 | } | |
314 |
|
314 | |||
315 | //**************** |
|
315 | //**************** | |
316 | // OTHER FUNCTIONS |
|
316 | // OTHER FUNCTIONS | |
317 | int spacewire_open_link( void ) |
|
317 | int spacewire_open_link( void ) | |
318 | { |
|
318 | { | |
319 | /** This function opens the SpaceWire link. |
|
319 | /** This function opens the SpaceWire link. | |
320 | * |
|
320 | * | |
321 | * @return a valid file descriptor in case of success, -1 in case of a failure |
|
321 | * @return a valid file descriptor in case of success, -1 in case of a failure | |
322 | * |
|
322 | * | |
323 | */ |
|
323 | */ | |
324 | rtems_status_code status; |
|
324 | rtems_status_code status; | |
325 |
|
325 | |||
326 | fdSPW = open(GRSPW_DEVICE_NAME, O_RDWR); // open the device. the open call resets the hardware |
|
326 | fdSPW = open(GRSPW_DEVICE_NAME, O_RDWR); // open the device. the open call resets the hardware | |
327 | if ( fdSPW < 0 ) { |
|
327 | if ( fdSPW < 0 ) { | |
328 | PRINTF1("ERR *** in configure_spw_link *** error opening "GRSPW_DEVICE_NAME" with ERR %d\n", errno) |
|
328 | PRINTF1("ERR *** in configure_spw_link *** error opening "GRSPW_DEVICE_NAME" with ERR %d\n", errno) | |
329 | } |
|
329 | } | |
330 | else |
|
330 | else | |
331 | { |
|
331 | { | |
332 | status = RTEMS_SUCCESSFUL; |
|
332 | status = RTEMS_SUCCESSFUL; | |
333 | } |
|
333 | } | |
334 |
|
334 | |||
335 | return status; |
|
335 | return status; | |
336 | } |
|
336 | } | |
337 |
|
337 | |||
338 | int spacewire_start_link( int fd ) |
|
338 | int spacewire_start_link( int fd ) | |
339 | { |
|
339 | { | |
340 | rtems_status_code status; |
|
340 | rtems_status_code status; | |
341 |
|
341 | |||
342 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is started |
|
342 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is started | |
343 | // -1 default hardcoded driver timeout |
|
343 | // -1 default hardcoded driver timeout | |
344 |
|
344 | |||
345 | return status; |
|
345 | return status; | |
346 | } |
|
346 | } | |
347 |
|
347 | |||
348 | int spacewire_stop_start_link( int fd ) |
|
348 | int spacewire_stop_start_link( int fd ) | |
349 | { |
|
349 | { | |
350 | rtems_status_code status; |
|
350 | rtems_status_code status; | |
351 |
|
351 | |||
352 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_STOP); // start fails if link pDev->running != 0 |
|
352 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_STOP); // start fails if link pDev->running != 0 | |
353 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is started |
|
353 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is started | |
354 | // -1 default hardcoded driver timeout |
|
354 | // -1 default hardcoded driver timeout | |
355 |
|
355 | |||
356 | return status; |
|
356 | return status; | |
357 | } |
|
357 | } | |
358 |
|
358 | |||
359 | int spacewire_configure_link( int fd ) |
|
359 | int spacewire_configure_link( int fd ) | |
360 | { |
|
360 | { | |
361 | /** This function configures the SpaceWire link. |
|
361 | /** This function configures the SpaceWire link. | |
362 | * |
|
362 | * | |
363 | * @return GR-RTEMS-DRIVER directive status codes: |
|
363 | * @return GR-RTEMS-DRIVER directive status codes: | |
364 | * - 22 EINVAL - Null pointer or an out of range value was given as the argument. |
|
364 | * - 22 EINVAL - Null pointer or an out of range value was given as the argument. | |
365 | * - 16 EBUSY - Only used for SEND. Returned when no descriptors are avialble in non-blocking mode. |
|
365 | * - 16 EBUSY - Only used for SEND. Returned when no descriptors are avialble in non-blocking mode. | |
366 | * - 88 ENOSYS - Returned for SET_DESTKEY if RMAP command handler is not available or if a non-implemented call is used. |
|
366 | * - 88 ENOSYS - Returned for SET_DESTKEY if RMAP command handler is not available or if a non-implemented call is used. | |
367 | * - 116 ETIMEDOUT - REturned for SET_PACKET_SIZE and START if the link could not be brought up. |
|
367 | * - 116 ETIMEDOUT - REturned for SET_PACKET_SIZE and START if the link could not be brought up. | |
368 | * - 12 ENOMEM - Returned for SET_PACKETSIZE if it was unable to allocate the new buffers. |
|
368 | * - 12 ENOMEM - Returned for SET_PACKETSIZE if it was unable to allocate the new buffers. | |
369 | * - 5 EIO - Error when writing to grswp hardware registers. |
|
369 | * - 5 EIO - Error when writing to grswp hardware registers. | |
370 | * - 2 ENOENT - No such file or directory |
|
370 | * - 2 ENOENT - No such file or directory | |
371 | */ |
|
371 | */ | |
372 |
|
372 | |||
373 | rtems_status_code status; |
|
373 | rtems_status_code status; | |
374 |
|
374 | |||
375 | spacewire_set_NP(1, REGS_ADDR_GRSPW); // [N]o [P]ort force |
|
375 | spacewire_set_NP(1, REGS_ADDR_GRSPW); // [N]o [P]ort force | |
376 | spacewire_set_RE(1, REGS_ADDR_GRSPW); // [R]MAP [E]nable, the dedicated call seems to break the no port force configuration |
|
376 | spacewire_set_RE(1, REGS_ADDR_GRSPW); // [R]MAP [E]nable, the dedicated call seems to break the no port force configuration | |
377 |
|
377 | |||
378 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_RXBLOCK, 1); // sets the blocking mode for reception |
|
378 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_RXBLOCK, 1); // sets the blocking mode for reception | |
379 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_RXBLOCK\n") |
|
379 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_RXBLOCK\n") | |
380 | // |
|
380 | // | |
381 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_EVENT_ID, Task_id[TASKID_SPIQ]); // sets the task ID to which an event is sent when a |
|
381 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_EVENT_ID, Task_id[TASKID_SPIQ]); // sets the task ID to which an event is sent when a | |
382 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_EVENT_ID\n") // link-error interrupt occurs |
|
382 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_EVENT_ID\n") // link-error interrupt occurs | |
383 | // |
|
383 | // | |
384 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_DISABLE_ERR, 0); // automatic link-disabling due to link-error interrupts |
|
384 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_DISABLE_ERR, 0); // automatic link-disabling due to link-error interrupts | |
385 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_DISABLE_ERR\n") |
|
385 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_DISABLE_ERR\n") | |
386 | // |
|
386 | // | |
387 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ, 1); // sets the link-error interrupt bit |
|
387 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ, 1); // sets the link-error interrupt bit | |
388 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ\n") |
|
388 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ\n") | |
389 | // |
|
389 | // | |
390 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TXBLOCK, 0); // transmission blocks |
|
390 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TXBLOCK, 0); // transmission blocks | |
391 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK\n") |
|
391 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK\n") | |
392 | // |
|
392 | // | |
393 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL, 1); // transmission blocks when no transmission descriptor is available |
|
393 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL, 1); // transmission blocks when no transmission descriptor is available | |
394 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL\n") |
|
394 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL\n") | |
395 | // |
|
395 | // | |
396 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TCODE_CTRL, 0x0909); // [Time Rx : Time Tx : Link error : Tick-out IRQ] |
|
396 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TCODE_CTRL, 0x0909); // [Time Rx : Time Tx : Link error : Tick-out IRQ] | |
397 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TCODE_CTRL,\n") |
|
397 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TCODE_CTRL,\n") | |
398 |
|
398 | |||
399 | return status; |
|
399 | return status; | |
400 | } |
|
400 | } | |
401 |
|
401 | |||
402 | int spacewire_reset_link( void ) |
|
402 | int spacewire_reset_link( void ) | |
403 | { |
|
403 | { | |
404 | /** This function is executed by the SPIQ rtems_task wehn it has been awaken by an interruption raised by the SpaceWire driver. |
|
404 | /** This function is executed by the SPIQ rtems_task wehn it has been awaken by an interruption raised by the SpaceWire driver. | |
405 | * |
|
405 | * | |
406 | * @return RTEMS directive status code: |
|
406 | * @return RTEMS directive status code: | |
407 | * - RTEMS_UNSATISFIED is returned is the link is not in the running state after 10 s. |
|
407 | * - RTEMS_UNSATISFIED is returned is the link is not in the running state after 10 s. | |
408 | * - RTEMS_SUCCESSFUL is returned if the link is up before the timeout. |
|
408 | * - RTEMS_SUCCESSFUL is returned if the link is up before the timeout. | |
409 | * |
|
409 | * | |
410 | */ |
|
410 | */ | |
411 |
|
411 | |||
412 | rtems_status_code status_spw; |
|
412 | rtems_status_code status_spw; | |
413 | int i; |
|
413 | int i; | |
414 |
|
414 | |||
415 | for ( i=0; i<SY_LFR_DPU_CONNECT_ATTEMPT; i++ ) |
|
415 | for ( i=0; i<SY_LFR_DPU_CONNECT_ATTEMPT; i++ ) | |
416 | { |
|
416 | { | |
417 | PRINTF1("in spacewire_reset_link *** link recovery, try %d\n", i); |
|
417 | PRINTF1("in spacewire_reset_link *** link recovery, try %d\n", i); | |
418 |
|
418 | |||
419 | // CLOSING THE DRIVER AT THIS POINT WILL MAKE THE SEND TASK BLOCK THE SYSTEM |
|
419 | // CLOSING THE DRIVER AT THIS POINT WILL MAKE THE SEND TASK BLOCK THE SYSTEM | |
420 |
|
420 | |||
421 | status_spw = spacewire_stop_start_link( fdSPW ); |
|
421 | status_spw = spacewire_stop_start_link( fdSPW ); | |
422 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
422 | if ( status_spw != RTEMS_SUCCESSFUL ) | |
423 | { |
|
423 | { | |
424 | PRINTF1("in spacewire_reset_link *** ERR spacewire_start_link code %d\n", status_spw) |
|
424 | PRINTF1("in spacewire_reset_link *** ERR spacewire_start_link code %d\n", status_spw) | |
425 | } |
|
425 | } | |
426 |
|
426 | |||
427 | if ( status_spw == RTEMS_SUCCESSFUL) |
|
427 | if ( status_spw == RTEMS_SUCCESSFUL) | |
428 | { |
|
428 | { | |
429 | break; |
|
429 | break; | |
430 | } |
|
430 | } | |
431 | } |
|
431 | } | |
432 |
|
432 | |||
433 | return status_spw; |
|
433 | return status_spw; | |
434 | } |
|
434 | } | |
435 |
|
435 | |||
436 | void spacewire_set_NP( unsigned char val, unsigned int regAddr ) // [N]o [P]ort force |
|
436 | void spacewire_set_NP( unsigned char val, unsigned int regAddr ) // [N]o [P]ort force | |
437 | { |
|
437 | { | |
438 | /** This function sets the [N]o [P]ort force bit of the GRSPW control register. |
|
438 | /** This function sets the [N]o [P]ort force bit of the GRSPW control register. | |
439 | * |
|
439 | * | |
440 | * @param val is the value, 0 or 1, used to set the value of the NP bit. |
|
440 | * @param val is the value, 0 or 1, used to set the value of the NP bit. | |
441 | * @param regAddr is the address of the GRSPW control register. |
|
441 | * @param regAddr is the address of the GRSPW control register. | |
442 | * |
|
442 | * | |
443 | * NP is the bit 20 of the GRSPW control register. |
|
443 | * NP is the bit 20 of the GRSPW control register. | |
444 | * |
|
444 | * | |
445 | */ |
|
445 | */ | |
446 |
|
446 | |||
447 | unsigned int *spwptr = (unsigned int*) regAddr; |
|
447 | unsigned int *spwptr = (unsigned int*) regAddr; | |
448 |
|
448 | |||
449 | if (val == 1) { |
|
449 | if (val == 1) { | |
450 | *spwptr = *spwptr | 0x00100000; // [NP] set the No port force bit |
|
450 | *spwptr = *spwptr | 0x00100000; // [NP] set the No port force bit | |
451 | } |
|
451 | } | |
452 | if (val== 0) { |
|
452 | if (val== 0) { | |
453 | *spwptr = *spwptr & 0xffdfffff; |
|
453 | *spwptr = *spwptr & 0xffdfffff; | |
454 | } |
|
454 | } | |
455 | } |
|
455 | } | |
456 |
|
456 | |||
457 | void spacewire_set_RE( unsigned char val, unsigned int regAddr ) // [R]MAP [E]nable |
|
457 | void spacewire_set_RE( unsigned char val, unsigned int regAddr ) // [R]MAP [E]nable | |
458 | { |
|
458 | { | |
459 | /** This function sets the [R]MAP [E]nable bit of the GRSPW control register. |
|
459 | /** This function sets the [R]MAP [E]nable bit of the GRSPW control register. | |
460 | * |
|
460 | * | |
461 | * @param val is the value, 0 or 1, used to set the value of the RE bit. |
|
461 | * @param val is the value, 0 or 1, used to set the value of the RE bit. | |
462 | * @param regAddr is the address of the GRSPW control register. |
|
462 | * @param regAddr is the address of the GRSPW control register. | |
463 | * |
|
463 | * | |
464 | * RE is the bit 16 of the GRSPW control register. |
|
464 | * RE is the bit 16 of the GRSPW control register. | |
465 | * |
|
465 | * | |
466 | */ |
|
466 | */ | |
467 |
|
467 | |||
468 | unsigned int *spwptr = (unsigned int*) regAddr; |
|
468 | unsigned int *spwptr = (unsigned int*) regAddr; | |
469 |
|
469 | |||
470 | if (val == 1) |
|
470 | if (val == 1) | |
471 | { |
|
471 | { | |
472 | *spwptr = *spwptr | 0x00010000; // [RE] set the RMAP Enable bit |
|
472 | *spwptr = *spwptr | 0x00010000; // [RE] set the RMAP Enable bit | |
473 | } |
|
473 | } | |
474 | if (val== 0) |
|
474 | if (val== 0) | |
475 | { |
|
475 | { | |
476 | *spwptr = *spwptr & 0xfffdffff; |
|
476 | *spwptr = *spwptr & 0xfffdffff; | |
477 | } |
|
477 | } | |
478 | } |
|
478 | } | |
479 |
|
479 | |||
480 | void spacewire_compute_stats_offsets( void ) |
|
480 | void spacewire_compute_stats_offsets( void ) | |
481 | { |
|
481 | { | |
482 | /** This function computes the SpaceWire statistics offsets in case of a SpaceWire related interruption raising. |
|
482 | /** This function computes the SpaceWire statistics offsets in case of a SpaceWire related interruption raising. | |
483 | * |
|
483 | * | |
484 | * The offsets keep a record of the statistics in case of a reset of the statistics. They are added to the current statistics |
|
484 | * The offsets keep a record of the statistics in case of a reset of the statistics. They are added to the current statistics | |
485 | * to keep the counters consistent even after a reset of the SpaceWire driver (the counter are set to zero by the driver when it |
|
485 | * to keep the counters consistent even after a reset of the SpaceWire driver (the counter are set to zero by the driver when it | |
486 | * during the open systel call). |
|
486 | * during the open systel call). | |
487 | * |
|
487 | * | |
488 | */ |
|
488 | */ | |
489 |
|
489 | |||
490 | spw_stats spacewire_stats_grspw; |
|
490 | spw_stats spacewire_stats_grspw; | |
491 | rtems_status_code status; |
|
491 | rtems_status_code status; | |
492 |
|
492 | |||
493 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw ); |
|
493 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw ); | |
494 |
|
494 | |||
495 | spacewire_stats_backup.packets_received = spacewire_stats_grspw.packets_received |
|
495 | spacewire_stats_backup.packets_received = spacewire_stats_grspw.packets_received | |
496 | + spacewire_stats.packets_received; |
|
496 | + spacewire_stats.packets_received; | |
497 | spacewire_stats_backup.packets_sent = spacewire_stats_grspw.packets_sent |
|
497 | spacewire_stats_backup.packets_sent = spacewire_stats_grspw.packets_sent | |
498 | + spacewire_stats.packets_sent; |
|
498 | + spacewire_stats.packets_sent; | |
499 | spacewire_stats_backup.parity_err = spacewire_stats_grspw.parity_err |
|
499 | spacewire_stats_backup.parity_err = spacewire_stats_grspw.parity_err | |
500 | + spacewire_stats.parity_err; |
|
500 | + spacewire_stats.parity_err; | |
501 | spacewire_stats_backup.disconnect_err = spacewire_stats_grspw.disconnect_err |
|
501 | spacewire_stats_backup.disconnect_err = spacewire_stats_grspw.disconnect_err | |
502 | + spacewire_stats.disconnect_err; |
|
502 | + spacewire_stats.disconnect_err; | |
503 | spacewire_stats_backup.escape_err = spacewire_stats_grspw.escape_err |
|
503 | spacewire_stats_backup.escape_err = spacewire_stats_grspw.escape_err | |
504 | + spacewire_stats.escape_err; |
|
504 | + spacewire_stats.escape_err; | |
505 | spacewire_stats_backup.credit_err = spacewire_stats_grspw.credit_err |
|
505 | spacewire_stats_backup.credit_err = spacewire_stats_grspw.credit_err | |
506 | + spacewire_stats.credit_err; |
|
506 | + spacewire_stats.credit_err; | |
507 | spacewire_stats_backup.write_sync_err = spacewire_stats_grspw.write_sync_err |
|
507 | spacewire_stats_backup.write_sync_err = spacewire_stats_grspw.write_sync_err | |
508 | + spacewire_stats.write_sync_err; |
|
508 | + spacewire_stats.write_sync_err; | |
509 | spacewire_stats_backup.rx_rmap_header_crc_err = spacewire_stats_grspw.rx_rmap_header_crc_err |
|
509 | spacewire_stats_backup.rx_rmap_header_crc_err = spacewire_stats_grspw.rx_rmap_header_crc_err | |
510 | + spacewire_stats.rx_rmap_header_crc_err; |
|
510 | + spacewire_stats.rx_rmap_header_crc_err; | |
511 | spacewire_stats_backup.rx_rmap_data_crc_err = spacewire_stats_grspw.rx_rmap_data_crc_err |
|
511 | spacewire_stats_backup.rx_rmap_data_crc_err = spacewire_stats_grspw.rx_rmap_data_crc_err | |
512 | + spacewire_stats.rx_rmap_data_crc_err; |
|
512 | + spacewire_stats.rx_rmap_data_crc_err; | |
513 | spacewire_stats_backup.early_ep = spacewire_stats_grspw.early_ep |
|
513 | spacewire_stats_backup.early_ep = spacewire_stats_grspw.early_ep | |
514 | + spacewire_stats.early_ep; |
|
514 | + spacewire_stats.early_ep; | |
515 | spacewire_stats_backup.invalid_address = spacewire_stats_grspw.invalid_address |
|
515 | spacewire_stats_backup.invalid_address = spacewire_stats_grspw.invalid_address | |
516 | + spacewire_stats.invalid_address; |
|
516 | + spacewire_stats.invalid_address; | |
517 | spacewire_stats_backup.rx_eep_err = spacewire_stats_grspw.rx_eep_err |
|
517 | spacewire_stats_backup.rx_eep_err = spacewire_stats_grspw.rx_eep_err | |
518 | + spacewire_stats.rx_eep_err; |
|
518 | + spacewire_stats.rx_eep_err; | |
519 | spacewire_stats_backup.rx_truncated = spacewire_stats_grspw.rx_truncated |
|
519 | spacewire_stats_backup.rx_truncated = spacewire_stats_grspw.rx_truncated | |
520 | + spacewire_stats.rx_truncated; |
|
520 | + spacewire_stats.rx_truncated; | |
521 | } |
|
521 | } | |
522 |
|
522 | |||
523 | void spacewire_update_statistics( void ) |
|
523 | void spacewire_update_statistics( void ) | |
524 | { |
|
524 | { | |
525 | rtems_status_code status; |
|
525 | rtems_status_code status; | |
526 | spw_stats spacewire_stats_grspw; |
|
526 | spw_stats spacewire_stats_grspw; | |
527 |
|
527 | |||
528 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw ); |
|
528 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw ); | |
529 |
|
529 | |||
530 | spacewire_stats.packets_received = spacewire_stats_backup.packets_received |
|
530 | spacewire_stats.packets_received = spacewire_stats_backup.packets_received | |
531 | + spacewire_stats_grspw.packets_received; |
|
531 | + spacewire_stats_grspw.packets_received; | |
532 | spacewire_stats.packets_sent = spacewire_stats_backup.packets_sent |
|
532 | spacewire_stats.packets_sent = spacewire_stats_backup.packets_sent | |
533 | + spacewire_stats_grspw.packets_sent; |
|
533 | + spacewire_stats_grspw.packets_sent; | |
534 | spacewire_stats.parity_err = spacewire_stats_backup.parity_err |
|
534 | spacewire_stats.parity_err = spacewire_stats_backup.parity_err | |
535 | + spacewire_stats_grspw.parity_err; |
|
535 | + spacewire_stats_grspw.parity_err; | |
536 | spacewire_stats.disconnect_err = spacewire_stats_backup.disconnect_err |
|
536 | spacewire_stats.disconnect_err = spacewire_stats_backup.disconnect_err | |
537 | + spacewire_stats_grspw.disconnect_err; |
|
537 | + spacewire_stats_grspw.disconnect_err; | |
538 | spacewire_stats.escape_err = spacewire_stats_backup.escape_err |
|
538 | spacewire_stats.escape_err = spacewire_stats_backup.escape_err | |
539 | + spacewire_stats_grspw.escape_err; |
|
539 | + spacewire_stats_grspw.escape_err; | |
540 | spacewire_stats.credit_err = spacewire_stats_backup.credit_err |
|
540 | spacewire_stats.credit_err = spacewire_stats_backup.credit_err | |
541 | + spacewire_stats_grspw.credit_err; |
|
541 | + spacewire_stats_grspw.credit_err; | |
542 | spacewire_stats.write_sync_err = spacewire_stats_backup.write_sync_err |
|
542 | spacewire_stats.write_sync_err = spacewire_stats_backup.write_sync_err | |
543 | + spacewire_stats_grspw.write_sync_err; |
|
543 | + spacewire_stats_grspw.write_sync_err; | |
544 | spacewire_stats.rx_rmap_header_crc_err = spacewire_stats_backup.rx_rmap_header_crc_err |
|
544 | spacewire_stats.rx_rmap_header_crc_err = spacewire_stats_backup.rx_rmap_header_crc_err | |
545 | + spacewire_stats_grspw.rx_rmap_header_crc_err; |
|
545 | + spacewire_stats_grspw.rx_rmap_header_crc_err; | |
546 | spacewire_stats.rx_rmap_data_crc_err = spacewire_stats_backup.rx_rmap_data_crc_err |
|
546 | spacewire_stats.rx_rmap_data_crc_err = spacewire_stats_backup.rx_rmap_data_crc_err | |
547 | + spacewire_stats_grspw.rx_rmap_data_crc_err; |
|
547 | + spacewire_stats_grspw.rx_rmap_data_crc_err; | |
548 | spacewire_stats.early_ep = spacewire_stats_backup.early_ep |
|
548 | spacewire_stats.early_ep = spacewire_stats_backup.early_ep | |
549 | + spacewire_stats_grspw.early_ep; |
|
549 | + spacewire_stats_grspw.early_ep; | |
550 | spacewire_stats.invalid_address = spacewire_stats_backup.invalid_address |
|
550 | spacewire_stats.invalid_address = spacewire_stats_backup.invalid_address | |
551 | + spacewire_stats_grspw.invalid_address; |
|
551 | + spacewire_stats_grspw.invalid_address; | |
552 | spacewire_stats.rx_eep_err = spacewire_stats_backup.rx_eep_err |
|
552 | spacewire_stats.rx_eep_err = spacewire_stats_backup.rx_eep_err | |
553 | + spacewire_stats_grspw.rx_eep_err; |
|
553 | + spacewire_stats_grspw.rx_eep_err; | |
554 | spacewire_stats.rx_truncated = spacewire_stats_backup.rx_truncated |
|
554 | spacewire_stats.rx_truncated = spacewire_stats_backup.rx_truncated | |
555 | + spacewire_stats_grspw.rx_truncated; |
|
555 | + spacewire_stats_grspw.rx_truncated; | |
556 | //spacewire_stats.tx_link_err; |
|
556 | //spacewire_stats.tx_link_err; | |
557 |
|
557 | |||
558 | //**************************** |
|
558 | //**************************** | |
559 | // DPU_SPACEWIRE_IF_STATISTICS |
|
559 | // DPU_SPACEWIRE_IF_STATISTICS | |
560 | housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[0] = (unsigned char) (spacewire_stats.packets_received >> 8); |
|
560 | housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[0] = (unsigned char) (spacewire_stats.packets_received >> 8); | |
561 | housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[1] = (unsigned char) (spacewire_stats.packets_received); |
|
561 | housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[1] = (unsigned char) (spacewire_stats.packets_received); | |
562 | housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[0] = (unsigned char) (spacewire_stats.packets_sent >> 8); |
|
562 | housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[0] = (unsigned char) (spacewire_stats.packets_sent >> 8); | |
563 | housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[1] = (unsigned char) (spacewire_stats.packets_sent); |
|
563 | housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[1] = (unsigned char) (spacewire_stats.packets_sent); | |
564 | //housekeeping_packet.hk_lfr_dpu_spw_tick_out_cnt; |
|
564 | //housekeeping_packet.hk_lfr_dpu_spw_tick_out_cnt; | |
565 | //housekeeping_packet.hk_lfr_dpu_spw_last_timc; |
|
565 | //housekeeping_packet.hk_lfr_dpu_spw_last_timc; | |
566 |
|
566 | |||
567 | //****************************************** |
|
567 | //****************************************** | |
568 | // ERROR COUNTERS / SPACEWIRE / LOW SEVERITY |
|
568 | // ERROR COUNTERS / SPACEWIRE / LOW SEVERITY | |
569 | housekeeping_packet.hk_lfr_dpu_spw_parity = (unsigned char) spacewire_stats.parity_err; |
|
569 | housekeeping_packet.hk_lfr_dpu_spw_parity = (unsigned char) spacewire_stats.parity_err; | |
570 | housekeeping_packet.hk_lfr_dpu_spw_disconnect = (unsigned char) spacewire_stats.disconnect_err; |
|
570 | housekeeping_packet.hk_lfr_dpu_spw_disconnect = (unsigned char) spacewire_stats.disconnect_err; | |
571 | housekeeping_packet.hk_lfr_dpu_spw_escape = (unsigned char) spacewire_stats.escape_err; |
|
571 | housekeeping_packet.hk_lfr_dpu_spw_escape = (unsigned char) spacewire_stats.escape_err; | |
572 | housekeeping_packet.hk_lfr_dpu_spw_credit = (unsigned char) spacewire_stats.credit_err; |
|
572 | housekeeping_packet.hk_lfr_dpu_spw_credit = (unsigned char) spacewire_stats.credit_err; | |
573 | housekeeping_packet.hk_lfr_dpu_spw_write_sync = (unsigned char) spacewire_stats.write_sync_err; |
|
573 | housekeeping_packet.hk_lfr_dpu_spw_write_sync = (unsigned char) spacewire_stats.write_sync_err; | |
574 |
|
574 | |||
575 | //********************************************* |
|
575 | //********************************************* | |
576 | // ERROR COUNTERS / SPACEWIRE / MEDIUM SEVERITY |
|
576 | // ERROR COUNTERS / SPACEWIRE / MEDIUM SEVERITY | |
577 | housekeeping_packet.hk_lfr_dpu_spw_early_eop = (unsigned char) spacewire_stats.early_ep; |
|
577 | housekeeping_packet.hk_lfr_dpu_spw_early_eop = (unsigned char) spacewire_stats.early_ep; | |
578 | housekeeping_packet.hk_lfr_dpu_spw_invalid_addr = (unsigned char) spacewire_stats.invalid_address; |
|
578 | housekeeping_packet.hk_lfr_dpu_spw_invalid_addr = (unsigned char) spacewire_stats.invalid_address; | |
579 | housekeeping_packet.hk_lfr_dpu_spw_eep = (unsigned char) spacewire_stats.rx_eep_err; |
|
579 | housekeeping_packet.hk_lfr_dpu_spw_eep = (unsigned char) spacewire_stats.rx_eep_err; | |
580 | housekeeping_packet.hk_lfr_dpu_spw_rx_too_big = (unsigned char) spacewire_stats.rx_truncated; |
|
580 | housekeeping_packet.hk_lfr_dpu_spw_rx_too_big = (unsigned char) spacewire_stats.rx_truncated; | |
581 | } |
|
581 | } | |
582 |
|
582 | |||
583 | void timecode_irq_handler( void *pDev, void *regs, int minor, unsigned int tc ) |
|
583 | void timecode_irq_handler( void *pDev, void *regs, int minor, unsigned int tc ) | |
584 | { |
|
584 | { | |
585 | //if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_1 ) != RTEMS_SUCCESSFUL) { |
|
585 | //if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_1 ) != RTEMS_SUCCESSFUL) { | |
586 | // printf("In timecode_irq_handler *** Error sending event to DUMB\n"); |
|
586 | // printf("In timecode_irq_handler *** Error sending event to DUMB\n"); | |
587 | //} |
|
587 | //} | |
588 | } |
|
588 | } | |
589 |
|
589 | |||
590 | rtems_timer_service_routine user_routine( rtems_id timer_id, void *user_data ) |
|
590 | rtems_timer_service_routine user_routine( rtems_id timer_id, void *user_data ) | |
591 | { |
|
591 | { | |
592 | int linkStatus; |
|
592 | int linkStatus; | |
593 | rtems_status_code status; |
|
593 | rtems_status_code status; | |
594 |
|
594 | |||
595 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status |
|
595 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status | |
596 |
|
596 | |||
597 | if ( linkStatus == 5) { |
|
597 | if ( linkStatus == 5) { | |
598 | PRINTF("in spacewire_reset_link *** link is running\n") |
|
598 | PRINTF("in spacewire_reset_link *** link is running\n") | |
599 | status = RTEMS_SUCCESSFUL; |
|
599 | status = RTEMS_SUCCESSFUL; | |
600 | } |
|
600 | } | |
601 | } |
|
601 | } |
@@ -1,417 +1,437 | |||||
1 | /** Functions related to TeleCommand acceptance. |
|
1 | /** Functions related to TeleCommand acceptance. | |
2 | * |
|
2 | * | |
3 | * @file |
|
3 | * @file | |
4 | * @author P. LEROY |
|
4 | * @author P. LEROY | |
5 | * |
|
5 | * | |
6 | * A group of functions to handle TeleCommands parsing.\n |
|
6 | * A group of functions to handle TeleCommands parsing.\n | |
7 | * |
|
7 | * | |
8 | */ |
|
8 | */ | |
9 |
|
9 | |||
10 | #include "tc_acceptance.h" |
|
10 | #include "tc_acceptance.h" | |
11 |
|
11 | |||
12 | unsigned int lookUpTableForCRC[256]; |
|
12 | unsigned int lookUpTableForCRC[256]; | |
13 |
|
13 | |||
14 | //********************** |
|
14 | //********************** | |
15 | // GENERAL USE FUNCTIONS |
|
15 | // GENERAL USE FUNCTIONS | |
16 | unsigned int Crc_opt( unsigned char D, unsigned int Chk) |
|
16 | unsigned int Crc_opt( unsigned char D, unsigned int Chk) | |
17 | { |
|
17 | { | |
18 | /** This function generate the CRC for one byte and returns the value of the new syndrome. |
|
18 | /** This function generate the CRC for one byte and returns the value of the new syndrome. | |
19 | * |
|
19 | * | |
20 | * @param D is the current byte of data. |
|
20 | * @param D is the current byte of data. | |
21 | * @param Chk is the current syndrom value. |
|
21 | * @param Chk is the current syndrom value. | |
22 | * |
|
22 | * | |
23 | * @return the value of the new syndrome on two bytes. |
|
23 | * @return the value of the new syndrome on two bytes. | |
24 | * |
|
24 | * | |
25 | */ |
|
25 | */ | |
26 |
|
26 | |||
27 | return(((Chk << 8) & 0xff00)^lookUpTableForCRC [(((Chk >> 8)^D) & 0x00ff)]); |
|
27 | return(((Chk << 8) & 0xff00)^lookUpTableForCRC [(((Chk >> 8)^D) & 0x00ff)]); | |
28 | } |
|
28 | } | |
29 |
|
29 | |||
30 | void initLookUpTableForCRC( void ) |
|
30 | void initLookUpTableForCRC( void ) | |
31 | { |
|
31 | { | |
32 | /** This function is used to initiates the look-up table for fast CRC computation. |
|
32 | /** This function is used to initiates the look-up table for fast CRC computation. | |
33 | * |
|
33 | * | |
34 | * The global table lookUpTableForCRC[256] is initiated. |
|
34 | * The global table lookUpTableForCRC[256] is initiated. | |
35 | * |
|
35 | * | |
36 | */ |
|
36 | */ | |
37 |
|
37 | |||
38 | unsigned int i; |
|
38 | unsigned int i; | |
39 | unsigned int tmp; |
|
39 | unsigned int tmp; | |
40 |
|
40 | |||
41 | for (i=0; i<256; i++) |
|
41 | for (i=0; i<256; i++) | |
42 | { |
|
42 | { | |
43 | tmp = 0; |
|
43 | tmp = 0; | |
44 | if((i & 1) != 0) { |
|
44 | if((i & 1) != 0) { | |
45 | tmp = tmp ^ 0x1021; |
|
45 | tmp = tmp ^ 0x1021; | |
46 | } |
|
46 | } | |
47 | if((i & 2) != 0) { |
|
47 | if((i & 2) != 0) { | |
48 | tmp = tmp ^ 0x2042; |
|
48 | tmp = tmp ^ 0x2042; | |
49 | } |
|
49 | } | |
50 | if((i & 4) != 0) { |
|
50 | if((i & 4) != 0) { | |
51 | tmp = tmp ^ 0x4084; |
|
51 | tmp = tmp ^ 0x4084; | |
52 | } |
|
52 | } | |
53 | if((i & 8) != 0) { |
|
53 | if((i & 8) != 0) { | |
54 | tmp = tmp ^ 0x8108; |
|
54 | tmp = tmp ^ 0x8108; | |
55 | } |
|
55 | } | |
56 | if((i & 16) != 0) { |
|
56 | if((i & 16) != 0) { | |
57 | tmp = tmp ^ 0x1231; |
|
57 | tmp = tmp ^ 0x1231; | |
58 | } |
|
58 | } | |
59 | if((i & 32) != 0) { |
|
59 | if((i & 32) != 0) { | |
60 | tmp = tmp ^ 0x2462; |
|
60 | tmp = tmp ^ 0x2462; | |
61 | } |
|
61 | } | |
62 | if((i & 64) != 0) { |
|
62 | if((i & 64) != 0) { | |
63 | tmp = tmp ^ 0x48c4; |
|
63 | tmp = tmp ^ 0x48c4; | |
64 | } |
|
64 | } | |
65 | if((i & 128) != 0) { |
|
65 | if((i & 128) != 0) { | |
66 | tmp = tmp ^ 0x9188; |
|
66 | tmp = tmp ^ 0x9188; | |
67 | } |
|
67 | } | |
68 | lookUpTableForCRC[i] = tmp; |
|
68 | lookUpTableForCRC[i] = tmp; | |
69 | } |
|
69 | } | |
70 | } |
|
70 | } | |
71 |
|
71 | |||
72 | void GetCRCAsTwoBytes(unsigned char* data, unsigned char* crcAsTwoBytes, unsigned int sizeOfData) |
|
72 | void GetCRCAsTwoBytes(unsigned char* data, unsigned char* crcAsTwoBytes, unsigned int sizeOfData) | |
73 | { |
|
73 | { | |
74 | /** This function calculates a two bytes Cyclic Redundancy Code. |
|
74 | /** This function calculates a two bytes Cyclic Redundancy Code. | |
75 | * |
|
75 | * | |
76 | * @param data points to a buffer containing the data on which to compute the CRC. |
|
76 | * @param data points to a buffer containing the data on which to compute the CRC. | |
77 | * @param crcAsTwoBytes points points to a two bytes buffer in which the CRC is stored. |
|
77 | * @param crcAsTwoBytes points points to a two bytes buffer in which the CRC is stored. | |
78 | * @param sizeOfData is the number of bytes of *data* used to compute the CRC. |
|
78 | * @param sizeOfData is the number of bytes of *data* used to compute the CRC. | |
79 | * |
|
79 | * | |
80 | * The specification of the Cyclic Redundancy Code is described in the following document: ECSS-E-70-41-A. |
|
80 | * The specification of the Cyclic Redundancy Code is described in the following document: ECSS-E-70-41-A. | |
81 | * |
|
81 | * | |
82 | */ |
|
82 | */ | |
83 |
|
83 | |||
84 | unsigned int Chk; |
|
84 | unsigned int Chk; | |
85 | int j; |
|
85 | int j; | |
86 | Chk = 0xffff; // reset the syndrom to all ones |
|
86 | Chk = 0xffff; // reset the syndrom to all ones | |
87 | for (j=0; j<sizeOfData; j++) { |
|
87 | for (j=0; j<sizeOfData; j++) { | |
88 | Chk = Crc_opt(data[j], Chk); |
|
88 | Chk = Crc_opt(data[j], Chk); | |
89 | } |
|
89 | } | |
90 | crcAsTwoBytes[0] = (unsigned char) (Chk >> 8); |
|
90 | crcAsTwoBytes[0] = (unsigned char) (Chk >> 8); | |
91 | crcAsTwoBytes[1] = (unsigned char) (Chk & 0x00ff); |
|
91 | crcAsTwoBytes[1] = (unsigned char) (Chk & 0x00ff); | |
92 | } |
|
92 | } | |
93 |
|
93 | |||
94 | //********************* |
|
94 | //********************* | |
95 | // ACCEPTANCE FUNCTIONS |
|
95 | // ACCEPTANCE FUNCTIONS | |
96 | int tc_parser(ccsdsTelecommandPacket_t * TCPacket, unsigned int TC_LEN_RCV, unsigned char *computed_CRC) |
|
96 | int tc_parser(ccsdsTelecommandPacket_t * TCPacket, unsigned int TC_LEN_RCV, unsigned char *computed_CRC) | |
97 | { |
|
97 | { | |
98 | /** This function parses TeleCommands. |
|
98 | /** This function parses TeleCommands. | |
99 | * |
|
99 | * | |
100 | * @param TC points to the TeleCommand that will be parsed. |
|
100 | * @param TC points to the TeleCommand that will be parsed. | |
101 | * @param TC_LEN_RCV is the received packet length. |
|
101 | * @param TC_LEN_RCV is the received packet length. | |
102 | * |
|
102 | * | |
103 | * @return Status code of the parsing. |
|
103 | * @return Status code of the parsing. | |
104 | * |
|
104 | * | |
105 | * The parsing checks: |
|
105 | * The parsing checks: | |
106 | * - process id |
|
106 | * - process id | |
107 | * - category |
|
107 | * - category | |
108 | * - length: a global check is performed and a per subtype check also |
|
108 | * - length: a global check is performed and a per subtype check also | |
109 | * - type |
|
109 | * - type | |
110 | * - subtype |
|
110 | * - subtype | |
111 | * - crc |
|
111 | * - crc | |
112 | * |
|
112 | * | |
113 | */ |
|
113 | */ | |
114 |
|
114 | |||
115 | int status; |
|
115 | int status; | |
116 | int status_crc; |
|
116 | int status_crc; | |
117 | unsigned char pid; |
|
117 | unsigned char pid; | |
118 | unsigned char category; |
|
118 | unsigned char category; | |
119 | unsigned int length; |
|
119 | unsigned int length; | |
120 | unsigned char packetType; |
|
120 | unsigned char packetType; | |
121 | unsigned char packetSubtype; |
|
121 | unsigned char packetSubtype; | |
122 | unsigned char sid; |
|
122 | unsigned char sid; | |
123 |
|
123 | |||
124 | status = CCSDS_TM_VALID; |
|
124 | status = CCSDS_TM_VALID; | |
125 |
|
125 | |||
126 | // APID check *** APID on 2 bytes |
|
126 | // APID check *** APID on 2 bytes | |
127 | pid = ((TCPacket->packetID[0] & 0x07)<<4) + ( (TCPacket->packetID[1]>>4) & 0x0f ); // PID = 11 *** 7 bits xxxxx210 7654xxxx |
|
127 | pid = ((TCPacket->packetID[0] & 0x07)<<4) + ( (TCPacket->packetID[1]>>4) & 0x0f ); // PID = 11 *** 7 bits xxxxx210 7654xxxx | |
128 | category = (TCPacket->packetID[1] & 0x0f); // PACKET_CATEGORY = 12 *** 4 bits xxxxxxxx xxxx3210 |
|
128 | category = (TCPacket->packetID[1] & 0x0f); // PACKET_CATEGORY = 12 *** 4 bits xxxxxxxx xxxx3210 | |
129 | length = (TCPacket->packetLength[0] * 256) + TCPacket->packetLength[1]; |
|
129 | length = (TCPacket->packetLength[0] * 256) + TCPacket->packetLength[1]; | |
130 | packetType = TCPacket->serviceType; |
|
130 | packetType = TCPacket->serviceType; | |
131 | packetSubtype = TCPacket->serviceSubType; |
|
131 | packetSubtype = TCPacket->serviceSubType; | |
132 | sid = TCPacket->sourceID; |
|
132 | sid = TCPacket->sourceID; | |
133 |
|
133 | |||
134 | if ( pid != CCSDS_PROCESS_ID ) // CHECK THE PROCESS ID |
|
134 | if ( pid != CCSDS_PROCESS_ID ) // CHECK THE PROCESS ID | |
135 | { |
|
135 | { | |
136 | status = ILLEGAL_APID; |
|
136 | status = ILLEGAL_APID; | |
137 | } |
|
137 | } | |
138 | if (status == CCSDS_TM_VALID) // CHECK THE CATEGORY |
|
138 | if (status == CCSDS_TM_VALID) // CHECK THE CATEGORY | |
139 | { |
|
139 | { | |
140 | if ( category != CCSDS_PACKET_CATEGORY ) |
|
140 | if ( category != CCSDS_PACKET_CATEGORY ) | |
141 | { |
|
141 | { | |
142 | status = ILLEGAL_APID; |
|
142 | status = ILLEGAL_APID; | |
143 | } |
|
143 | } | |
144 | } |
|
144 | } | |
145 | if (status == CCSDS_TM_VALID) // CHECK THE PACKET LENGTH FIELD AND THE ACTUAL LENGTH COMPLIANCE |
|
145 | if (status == CCSDS_TM_VALID) // CHECK THE PACKET LENGTH FIELD AND THE ACTUAL LENGTH COMPLIANCE | |
146 | { |
|
146 | { | |
147 | if (length != TC_LEN_RCV ) { |
|
147 | if (length != TC_LEN_RCV ) { | |
148 | status = WRONG_LEN_PKT; |
|
148 | status = WRONG_LEN_PKT; | |
149 | } |
|
149 | } | |
150 | } |
|
150 | } | |
151 | if (status == CCSDS_TM_VALID) // CHECK THAT THE PACKET DOES NOT EXCEED THE MAX SIZE |
|
151 | if (status == CCSDS_TM_VALID) // CHECK THAT THE PACKET DOES NOT EXCEED THE MAX SIZE | |
152 | { |
|
152 | { | |
153 | if ( length >= CCSDS_TC_PKT_MAX_SIZE ) { |
|
153 | if ( length >= CCSDS_TC_PKT_MAX_SIZE ) { | |
154 | status = WRONG_LEN_PKT; |
|
154 | status = WRONG_LEN_PKT; | |
155 | } |
|
155 | } | |
156 | } |
|
156 | } | |
157 | if (status == CCSDS_TM_VALID) // CHECK THE TYPE |
|
157 | if (status == CCSDS_TM_VALID) // CHECK THE TYPE | |
158 | { |
|
158 | { | |
159 | status = tc_check_type( packetType ); |
|
159 | status = tc_check_type( packetType ); | |
160 | } |
|
160 | } | |
161 | if (status == CCSDS_TM_VALID) // CHECK THE SUBTYPE |
|
161 | if (status == CCSDS_TM_VALID) // CHECK THE SUBTYPE | |
162 | { |
|
162 | { | |
163 | status = tc_check_subtype( packetSubtype ); |
|
163 | status = tc_check_type_subtype( packetType, packetSubtype ); | |
164 | } |
|
164 | } | |
165 | if (status == CCSDS_TM_VALID) // CHECK THE SID |
|
165 | if (status == CCSDS_TM_VALID) // CHECK THE SID | |
166 | { |
|
166 | { | |
167 | status = tc_check_sid( sid ); |
|
167 | status = tc_check_sid( sid ); | |
168 | } |
|
168 | } | |
169 | if (status == CCSDS_TM_VALID) // CHECK THE SUBTYPE AND LENGTH COMPLIANCE |
|
169 | if (status == CCSDS_TM_VALID) // CHECK THE SUBTYPE AND LENGTH COMPLIANCE | |
170 | { |
|
170 | { | |
171 | status = tc_check_length( packetSubtype, length ); |
|
171 | status = tc_check_length( packetSubtype, length ); | |
172 | } |
|
172 | } | |
173 | status_crc = tc_check_crc( TCPacket, length, computed_CRC ); |
|
173 | status_crc = tc_check_crc( TCPacket, length, computed_CRC ); | |
174 | if (status == CCSDS_TM_VALID ) // CHECK CRC |
|
174 | if (status == CCSDS_TM_VALID ) // CHECK CRC | |
175 | { |
|
175 | { | |
176 | status = status_crc; |
|
176 | status = status_crc; | |
177 | } |
|
177 | } | |
178 |
|
178 | |||
179 | return status; |
|
179 | return status; | |
180 | } |
|
180 | } | |
181 |
|
181 | |||
182 | int tc_check_type( unsigned char packetType ) |
|
182 | int tc_check_type( unsigned char packetType ) | |
183 | { |
|
183 | { | |
184 | /** This function checks that the type of a TeleCommand is valid. |
|
184 | /** This function checks that the type of a TeleCommand is valid. | |
185 | * |
|
185 | * | |
186 | * @param packetType is the type to check. |
|
186 | * @param packetType is the type to check. | |
187 | * |
|
187 | * | |
188 | * @return Status code CCSDS_TM_VALID or ILL_TYPE. |
|
188 | * @return Status code CCSDS_TM_VALID or ILL_TYPE. | |
189 | * |
|
189 | * | |
190 | */ |
|
190 | */ | |
191 |
|
191 | |||
192 | int status; |
|
192 | int status; | |
193 |
|
193 | |||
194 | if ( (packetType == TC_TYPE_GEN) || (packetType == TC_TYPE_TIME)) |
|
194 | if ( (packetType == TC_TYPE_GEN) || (packetType == TC_TYPE_TIME)) | |
195 | { |
|
195 | { | |
196 | status = CCSDS_TM_VALID; |
|
196 | status = CCSDS_TM_VALID; | |
197 | } |
|
197 | } | |
198 | else |
|
198 | else | |
199 | { |
|
199 | { | |
200 | status = ILL_TYPE; |
|
200 | status = ILL_TYPE; | |
201 | } |
|
201 | } | |
202 |
|
202 | |||
203 | return status; |
|
203 | return status; | |
204 | } |
|
204 | } | |
205 |
|
205 | |||
206 | int tc_check_subtype( unsigned char packetSubType ) |
|
206 | int tc_check_type_subtype( unsigned char packetType, unsigned char packetSubType ) | |
207 | { |
|
207 | { | |
208 | /** This function checks that the subtype of a TeleCommand is valid. |
|
208 | /** This function checks that the subtype of a TeleCommand is valid and coherent with the type. | |
209 | * |
|
209 | * | |
|
210 | * @param packetType is the type of the TC. | |||
210 | * @param packetSubType is the subtype to check. |
|
211 | * @param packetSubType is the subtype to check. | |
211 | * |
|
212 | * | |
212 | * @return Status code CCSDS_TM_VALID or ILL_SUBTYPE. |
|
213 | * @return Status code CCSDS_TM_VALID or ILL_SUBTYPE. | |
213 | * |
|
214 | * | |
214 | */ |
|
215 | */ | |
215 |
|
216 | |||
216 | int status; |
|
217 | int status; | |
217 |
|
218 | |||
218 | if ( (packetSubType == TC_SUBTYPE_RESET) |
|
219 | switch(packetType) | |
219 | || (packetSubType == TC_SUBTYPE_LOAD_COMM) |
|
|||
220 | || (packetSubType == TC_SUBTYPE_LOAD_NORM) || (packetSubType == TC_SUBTYPE_LOAD_BURST) |
|
|||
221 | || (packetSubType == TC_SUBTYPE_LOAD_SBM1) || (packetSubType == TC_SUBTYPE_LOAD_SBM2) |
|
|||
222 | || (packetSubType == TC_SUBTYPE_DUMP) |
|
|||
223 | || (packetSubType == TC_SUBTYPE_ENTER) |
|
|||
224 | || (packetSubType == TC_SUBTYPE_UPDT_INFO) || (packetSubType == TC_SUBTYPE_UPDT_TIME) |
|
|||
225 | || (packetSubType == TC_SUBTYPE_EN_CAL) || (packetSubType == TC_SUBTYPE_DIS_CAL) ) |
|
|||
226 | { |
|
220 | { | |
227 | status = CCSDS_TM_VALID; |
|
221 | case TC_TYPE_GEN: | |
228 | } |
|
222 | if ( (packetSubType == TC_SUBTYPE_RESET) | |
229 | else |
|
223 | || (packetSubType == TC_SUBTYPE_LOAD_COMM) | |
230 | { |
|
224 | || (packetSubType == TC_SUBTYPE_LOAD_NORM) || (packetSubType == TC_SUBTYPE_LOAD_BURST) | |
|
225 | || (packetSubType == TC_SUBTYPE_LOAD_SBM1) || (packetSubType == TC_SUBTYPE_LOAD_SBM2) | |||
|
226 | || (packetSubType == TC_SUBTYPE_DUMP) | |||
|
227 | || (packetSubType == TC_SUBTYPE_ENTER) | |||
|
228 | || (packetSubType == TC_SUBTYPE_UPDT_INFO) | |||
|
229 | || (packetSubType == TC_SUBTYPE_EN_CAL) || (packetSubType == TC_SUBTYPE_DIS_CAL) ) | |||
|
230 | { | |||
|
231 | status = CCSDS_TM_VALID; | |||
|
232 | } | |||
|
233 | else | |||
|
234 | { | |||
|
235 | status = ILL_SUBTYPE; | |||
|
236 | } | |||
|
237 | break; | |||
|
238 | ||||
|
239 | case TC_TYPE_TIME: | |||
|
240 | if (packetSubType == TC_SUBTYPE_UPDT_TIME) | |||
|
241 | { | |||
|
242 | status = CCSDS_TM_VALID; | |||
|
243 | } | |||
|
244 | else | |||
|
245 | { | |||
|
246 | status = ILL_SUBTYPE; | |||
|
247 | } | |||
|
248 | break; | |||
|
249 | ||||
|
250 | default: | |||
231 | status = ILL_SUBTYPE; |
|
251 | status = ILL_SUBTYPE; | |
|
252 | break; | |||
232 | } |
|
253 | } | |
233 |
|
254 | |||
234 | return status; |
|
255 | return status; | |
235 | } |
|
256 | } | |
236 |
|
257 | |||
237 | int tc_check_sid( unsigned char sid ) |
|
258 | int tc_check_sid( unsigned char sid ) | |
238 | { |
|
259 | { | |
239 | /** This function checks that the sid of a TeleCommand is valid. |
|
260 | /** This function checks that the sid of a TeleCommand is valid. | |
240 | * |
|
261 | * | |
241 | * @param sid is the sid to check. |
|
262 | * @param sid is the sid to check. | |
242 | * |
|
263 | * | |
243 | * @return Status code CCSDS_TM_VALID or CORRUPTED. |
|
264 | * @return Status code CCSDS_TM_VALID or CORRUPTED. | |
244 | * |
|
265 | * | |
245 | */ |
|
266 | */ | |
246 |
|
267 | |||
247 | int status; |
|
268 | int status; | |
248 |
|
269 | |||
249 | if ( (sid == SID_TC_GROUND) |
|
270 | if ( (sid == SID_TC_MISSION_TIMELINE) || (sid == SID_TC_TC_SEQUENCES) || (sid == SID_TC_RECOVERY_ACTION_CMD) | |
250 | || (sid == SID_TC_MISSION_TIMELINE) || (sid == SID_TC_TC_SEQUENCES) || (sid == SID_TC_RECOVERY_ACTION_CMD) |
|
|||
251 | || (sid == SID_TC_BACKUP_MISSION_TIMELINE) |
|
271 | || (sid == SID_TC_BACKUP_MISSION_TIMELINE) | |
252 | || (sid == SID_TC_DIRECT_CMD) || (sid == SID_TC_SPARE_GRD_SRC1) || (sid == SID_TC_SPARE_GRD_SRC2) |
|
272 | || (sid == SID_TC_DIRECT_CMD) || (sid == SID_TC_SPARE_GRD_SRC1) || (sid == SID_TC_SPARE_GRD_SRC2) | |
253 | || (sid == SID_TC_OBCP) || (sid == SID_TC_SYSTEM_CONTROL) || (sid == SID_TC_AOCS) |
|
273 | || (sid == SID_TC_OBCP) || (sid == SID_TC_SYSTEM_CONTROL) || (sid == SID_TC_AOCS) | |
254 | || (sid == SID_TC_RPW_INTERNAL)) |
|
274 | || (sid == SID_TC_RPW_INTERNAL)) | |
255 | { |
|
275 | { | |
256 | status = CCSDS_TM_VALID; |
|
276 | status = CCSDS_TM_VALID; | |
257 | } |
|
277 | } | |
258 | else |
|
278 | else | |
259 | { |
|
279 | { | |
260 | status = WRONG_SRC_ID; |
|
280 | status = WRONG_SRC_ID; | |
261 | } |
|
281 | } | |
262 |
|
282 | |||
263 | return status; |
|
283 | return status; | |
264 | } |
|
284 | } | |
265 |
|
285 | |||
266 | int tc_check_length( unsigned char packetSubType, unsigned int length ) |
|
286 | int tc_check_length( unsigned char packetSubType, unsigned int length ) | |
267 | { |
|
287 | { | |
268 | /** This function checks that the subtype and the length are compliant. |
|
288 | /** This function checks that the subtype and the length are compliant. | |
269 | * |
|
289 | * | |
270 | * @param packetSubType is the subtype to check. |
|
290 | * @param packetSubType is the subtype to check. | |
271 | * @param length is the length to check. |
|
291 | * @param length is the length to check. | |
272 | * |
|
292 | * | |
273 | * @return Status code CCSDS_TM_VALID or ILL_TYPE. |
|
293 | * @return Status code CCSDS_TM_VALID or ILL_TYPE. | |
274 | * |
|
294 | * | |
275 | */ |
|
295 | */ | |
276 |
|
296 | |||
277 | int status; |
|
297 | int status; | |
278 |
|
298 | |||
279 | status = LFR_SUCCESSFUL; |
|
299 | status = LFR_SUCCESSFUL; | |
280 |
|
300 | |||
281 | switch(packetSubType) |
|
301 | switch(packetSubType) | |
282 | { |
|
302 | { | |
283 | case TC_SUBTYPE_RESET: |
|
303 | case TC_SUBTYPE_RESET: | |
284 | if (length!=(TC_LEN_RESET-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
304 | if (length!=(TC_LEN_RESET-CCSDS_TC_TM_PACKET_OFFSET)) { | |
285 | status = WRONG_LEN_PKT; |
|
305 | status = WRONG_LEN_PKT; | |
286 | } |
|
306 | } | |
287 | else { |
|
307 | else { | |
288 | status = CCSDS_TM_VALID; |
|
308 | status = CCSDS_TM_VALID; | |
289 | } |
|
309 | } | |
290 | break; |
|
310 | break; | |
291 | case TC_SUBTYPE_LOAD_COMM: |
|
311 | case TC_SUBTYPE_LOAD_COMM: | |
292 | if (length!=(TC_LEN_LOAD_COMM-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
312 | if (length!=(TC_LEN_LOAD_COMM-CCSDS_TC_TM_PACKET_OFFSET)) { | |
293 | status = WRONG_LEN_PKT; |
|
313 | status = WRONG_LEN_PKT; | |
294 | } |
|
314 | } | |
295 | else { |
|
315 | else { | |
296 | status = CCSDS_TM_VALID; |
|
316 | status = CCSDS_TM_VALID; | |
297 | } |
|
317 | } | |
298 | break; |
|
318 | break; | |
299 | case TC_SUBTYPE_LOAD_NORM: |
|
319 | case TC_SUBTYPE_LOAD_NORM: | |
300 | if (length!=(TC_LEN_LOAD_NORM-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
320 | if (length!=(TC_LEN_LOAD_NORM-CCSDS_TC_TM_PACKET_OFFSET)) { | |
301 | status = WRONG_LEN_PKT; |
|
321 | status = WRONG_LEN_PKT; | |
302 | } |
|
322 | } | |
303 | else { |
|
323 | else { | |
304 | status = CCSDS_TM_VALID; |
|
324 | status = CCSDS_TM_VALID; | |
305 | } |
|
325 | } | |
306 | break; |
|
326 | break; | |
307 | case TC_SUBTYPE_LOAD_BURST: |
|
327 | case TC_SUBTYPE_LOAD_BURST: | |
308 | if (length!=(TC_LEN_LOAD_BURST-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
328 | if (length!=(TC_LEN_LOAD_BURST-CCSDS_TC_TM_PACKET_OFFSET)) { | |
309 | status = WRONG_LEN_PKT; |
|
329 | status = WRONG_LEN_PKT; | |
310 | } |
|
330 | } | |
311 | else { |
|
331 | else { | |
312 | status = CCSDS_TM_VALID; |
|
332 | status = CCSDS_TM_VALID; | |
313 | } |
|
333 | } | |
314 | break; |
|
334 | break; | |
315 | case TC_SUBTYPE_LOAD_SBM1: |
|
335 | case TC_SUBTYPE_LOAD_SBM1: | |
316 | if (length!=(TC_LEN_LOAD_SBM1-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
336 | if (length!=(TC_LEN_LOAD_SBM1-CCSDS_TC_TM_PACKET_OFFSET)) { | |
317 | status = WRONG_LEN_PKT; |
|
337 | status = WRONG_LEN_PKT; | |
318 | } |
|
338 | } | |
319 | else { |
|
339 | else { | |
320 | status = CCSDS_TM_VALID; |
|
340 | status = CCSDS_TM_VALID; | |
321 | } |
|
341 | } | |
322 | break; |
|
342 | break; | |
323 | case TC_SUBTYPE_LOAD_SBM2: |
|
343 | case TC_SUBTYPE_LOAD_SBM2: | |
324 | if (length!=(TC_LEN_LOAD_SBM2-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
344 | if (length!=(TC_LEN_LOAD_SBM2-CCSDS_TC_TM_PACKET_OFFSET)) { | |
325 | status = WRONG_LEN_PKT; |
|
345 | status = WRONG_LEN_PKT; | |
326 | } |
|
346 | } | |
327 | else { |
|
347 | else { | |
328 | status = CCSDS_TM_VALID; |
|
348 | status = CCSDS_TM_VALID; | |
329 | } |
|
349 | } | |
330 | break; |
|
350 | break; | |
331 | case TC_SUBTYPE_DUMP: |
|
351 | case TC_SUBTYPE_DUMP: | |
332 | if (length!=(TC_LEN_DUMP-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
352 | if (length!=(TC_LEN_DUMP-CCSDS_TC_TM_PACKET_OFFSET)) { | |
333 | status = WRONG_LEN_PKT; |
|
353 | status = WRONG_LEN_PKT; | |
334 | } |
|
354 | } | |
335 | else { |
|
355 | else { | |
336 | status = CCSDS_TM_VALID; |
|
356 | status = CCSDS_TM_VALID; | |
337 | } |
|
357 | } | |
338 | break; |
|
358 | break; | |
339 | case TC_SUBTYPE_ENTER: |
|
359 | case TC_SUBTYPE_ENTER: | |
340 | if (length!=(TC_LEN_ENTER-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
360 | if (length!=(TC_LEN_ENTER-CCSDS_TC_TM_PACKET_OFFSET)) { | |
341 | status = WRONG_LEN_PKT; |
|
361 | status = WRONG_LEN_PKT; | |
342 | } |
|
362 | } | |
343 | else { |
|
363 | else { | |
344 | status = CCSDS_TM_VALID; |
|
364 | status = CCSDS_TM_VALID; | |
345 | } |
|
365 | } | |
346 | break; |
|
366 | break; | |
347 | case TC_SUBTYPE_UPDT_INFO: |
|
367 | case TC_SUBTYPE_UPDT_INFO: | |
348 | if (length!=(TC_LEN_UPDT_INFO-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
368 | if (length!=(TC_LEN_UPDT_INFO-CCSDS_TC_TM_PACKET_OFFSET)) { | |
349 | status = WRONG_LEN_PKT; |
|
369 | status = WRONG_LEN_PKT; | |
350 | } |
|
370 | } | |
351 | else { |
|
371 | else { | |
352 | status = CCSDS_TM_VALID; |
|
372 | status = CCSDS_TM_VALID; | |
353 | } |
|
373 | } | |
354 | break; |
|
374 | break; | |
355 | case TC_SUBTYPE_EN_CAL: |
|
375 | case TC_SUBTYPE_EN_CAL: | |
356 | if (length!=(TC_LEN_EN_CAL-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
376 | if (length!=(TC_LEN_EN_CAL-CCSDS_TC_TM_PACKET_OFFSET)) { | |
357 | status = WRONG_LEN_PKT; |
|
377 | status = WRONG_LEN_PKT; | |
358 | } |
|
378 | } | |
359 | else { |
|
379 | else { | |
360 | status = CCSDS_TM_VALID; |
|
380 | status = CCSDS_TM_VALID; | |
361 | } |
|
381 | } | |
362 | break; |
|
382 | break; | |
363 | case TC_SUBTYPE_DIS_CAL: |
|
383 | case TC_SUBTYPE_DIS_CAL: | |
364 | if (length!=(TC_LEN_DIS_CAL-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
384 | if (length!=(TC_LEN_DIS_CAL-CCSDS_TC_TM_PACKET_OFFSET)) { | |
365 | status = WRONG_LEN_PKT; |
|
385 | status = WRONG_LEN_PKT; | |
366 | } |
|
386 | } | |
367 | else { |
|
387 | else { | |
368 | status = CCSDS_TM_VALID; |
|
388 | status = CCSDS_TM_VALID; | |
369 | } |
|
389 | } | |
370 | break; |
|
390 | break; | |
371 | case TC_SUBTYPE_UPDT_TIME: |
|
391 | case TC_SUBTYPE_UPDT_TIME: | |
372 | if (length!=(TC_LEN_UPDT_TIME-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
392 | if (length!=(TC_LEN_UPDT_TIME-CCSDS_TC_TM_PACKET_OFFSET)) { | |
373 | status = WRONG_LEN_PKT; |
|
393 | status = WRONG_LEN_PKT; | |
374 | } |
|
394 | } | |
375 | else { |
|
395 | else { | |
376 | status = CCSDS_TM_VALID; |
|
396 | status = CCSDS_TM_VALID; | |
377 | } |
|
397 | } | |
378 | break; |
|
398 | break; | |
379 | default: // if the subtype is not a legal value, return ILL_SUBTYPE |
|
399 | default: // if the subtype is not a legal value, return ILL_SUBTYPE | |
380 | status = ILL_SUBTYPE; |
|
400 | status = ILL_SUBTYPE; | |
381 | break ; |
|
401 | break ; | |
382 | } |
|
402 | } | |
383 |
|
403 | |||
384 | return status; |
|
404 | return status; | |
385 | } |
|
405 | } | |
386 |
|
406 | |||
387 | int tc_check_crc( ccsdsTelecommandPacket_t * TCPacket, unsigned int length, unsigned char *computed_CRC ) |
|
407 | int tc_check_crc( ccsdsTelecommandPacket_t * TCPacket, unsigned int length, unsigned char *computed_CRC ) | |
388 | { |
|
408 | { | |
389 | /** This function checks the CRC validity of the corresponding TeleCommand packet. |
|
409 | /** This function checks the CRC validity of the corresponding TeleCommand packet. | |
390 | * |
|
410 | * | |
391 | * @param TCPacket points to the TeleCommand packet to check. |
|
411 | * @param TCPacket points to the TeleCommand packet to check. | |
392 | * @param length is the length of the TC packet. |
|
412 | * @param length is the length of the TC packet. | |
393 | * |
|
413 | * | |
394 | * @return Status code CCSDS_TM_VALID or INCOR_CHECKSUM. |
|
414 | * @return Status code CCSDS_TM_VALID or INCOR_CHECKSUM. | |
395 | * |
|
415 | * | |
396 | */ |
|
416 | */ | |
397 |
|
417 | |||
398 | int status; |
|
418 | int status; | |
399 | unsigned char * CCSDSContent; |
|
419 | unsigned char * CCSDSContent; | |
400 |
|
420 | |||
401 | CCSDSContent = (unsigned char*) TCPacket->packetID; |
|
421 | CCSDSContent = (unsigned char*) TCPacket->packetID; | |
402 | GetCRCAsTwoBytes(CCSDSContent, computed_CRC, length + CCSDS_TC_TM_PACKET_OFFSET - 2); // 2 CRC bytes removed from the calculation of the CRC |
|
422 | GetCRCAsTwoBytes(CCSDSContent, computed_CRC, length + CCSDS_TC_TM_PACKET_OFFSET - 2); // 2 CRC bytes removed from the calculation of the CRC | |
403 | if (computed_CRC[0] != CCSDSContent[length + CCSDS_TC_TM_PACKET_OFFSET -2]) { |
|
423 | if (computed_CRC[0] != CCSDSContent[length + CCSDS_TC_TM_PACKET_OFFSET -2]) { | |
404 | status = INCOR_CHECKSUM; |
|
424 | status = INCOR_CHECKSUM; | |
405 | } |
|
425 | } | |
406 | else if (computed_CRC[1] != CCSDSContent[length + CCSDS_TC_TM_PACKET_OFFSET -1]) { |
|
426 | else if (computed_CRC[1] != CCSDSContent[length + CCSDS_TC_TM_PACKET_OFFSET -1]) { | |
407 | status = INCOR_CHECKSUM; |
|
427 | status = INCOR_CHECKSUM; | |
408 | } |
|
428 | } | |
409 | else { |
|
429 | else { | |
410 | status = CCSDS_TM_VALID; |
|
430 | status = CCSDS_TM_VALID; | |
411 | } |
|
431 | } | |
412 |
|
432 | |||
413 | return status; |
|
433 | return status; | |
414 | } |
|
434 | } | |
415 |
|
435 | |||
416 |
|
436 | |||
417 |
|
437 |
@@ -1,757 +1,765 | |||||
1 | /** Functions and tasks related to TeleCommand handling. |
|
1 | /** Functions and tasks related to TeleCommand handling. | |
2 | * |
|
2 | * | |
3 | * @file |
|
3 | * @file | |
4 | * @author P. LEROY |
|
4 | * @author P. LEROY | |
5 | * |
|
5 | * | |
6 | * A group of functions to handle TeleCommands:\n |
|
6 | * A group of functions to handle TeleCommands:\n | |
7 | * action launching\n |
|
7 | * action launching\n | |
8 | * TC parsing\n |
|
8 | * TC parsing\n | |
9 | * ... |
|
9 | * ... | |
10 | * |
|
10 | * | |
11 | */ |
|
11 | */ | |
12 |
|
12 | |||
13 | #include "tc_handler.h" |
|
13 | #include "tc_handler.h" | |
14 |
|
14 | |||
15 | //*********** |
|
15 | //*********** | |
16 | // RTEMS TASK |
|
16 | // RTEMS TASK | |
17 |
|
17 | |||
18 | rtems_task actn_task( rtems_task_argument unused ) |
|
18 | rtems_task actn_task( rtems_task_argument unused ) | |
19 | { |
|
19 | { | |
20 | /** This RTEMS task is responsible for launching actions upton the reception of valid TeleCommands. |
|
20 | /** This RTEMS task is responsible for launching actions upton the reception of valid TeleCommands. | |
21 | * |
|
21 | * | |
22 | * @param unused is the starting argument of the RTEMS task |
|
22 | * @param unused is the starting argument of the RTEMS task | |
23 | * |
|
23 | * | |
24 | * The ACTN task waits for data coming from an RTEMS msesage queue. When data arrives, it launches specific actions depending |
|
24 | * The ACTN task waits for data coming from an RTEMS msesage queue. When data arrives, it launches specific actions depending | |
25 | * on the incoming TeleCommand. |
|
25 | * on the incoming TeleCommand. | |
26 | * |
|
26 | * | |
27 | */ |
|
27 | */ | |
28 |
|
28 | |||
29 | int result; |
|
29 | int result; | |
30 | rtems_status_code status; // RTEMS status code |
|
30 | rtems_status_code status; // RTEMS status code | |
31 | ccsdsTelecommandPacket_t TC; // TC sent to the ACTN task |
|
31 | ccsdsTelecommandPacket_t TC; // TC sent to the ACTN task | |
32 | size_t size; // size of the incoming TC packet |
|
32 | size_t size; // size of the incoming TC packet | |
33 | unsigned char subtype; // subtype of the current TC packet |
|
33 | unsigned char subtype; // subtype of the current TC packet | |
34 | unsigned char time[6]; |
|
34 | unsigned char time[6]; | |
35 | rtems_id queue_rcv_id; |
|
35 | rtems_id queue_rcv_id; | |
36 | rtems_id queue_snd_id; |
|
36 | rtems_id queue_snd_id; | |
37 |
|
37 | |||
38 | status = get_message_queue_id_recv( &queue_rcv_id ); |
|
38 | status = get_message_queue_id_recv( &queue_rcv_id ); | |
39 | if (status != RTEMS_SUCCESSFUL) |
|
39 | if (status != RTEMS_SUCCESSFUL) | |
40 | { |
|
40 | { | |
41 | PRINTF1("in ACTN *** ERR get_message_queue_id_recv %d\n", status) |
|
41 | PRINTF1("in ACTN *** ERR get_message_queue_id_recv %d\n", status) | |
42 | } |
|
42 | } | |
43 |
|
43 | |||
44 | status = get_message_queue_id_send( &queue_snd_id ); |
|
44 | status = get_message_queue_id_send( &queue_snd_id ); | |
45 | if (status != RTEMS_SUCCESSFUL) |
|
45 | if (status != RTEMS_SUCCESSFUL) | |
46 | { |
|
46 | { | |
47 | PRINTF1("in ACTN *** ERR get_message_queue_id_send %d\n", status) |
|
47 | PRINTF1("in ACTN *** ERR get_message_queue_id_send %d\n", status) | |
48 | } |
|
48 | } | |
49 |
|
49 | |||
50 | result = LFR_SUCCESSFUL; |
|
50 | result = LFR_SUCCESSFUL; | |
51 | subtype = 0; // subtype of the current TC packet |
|
51 | subtype = 0; // subtype of the current TC packet | |
52 |
|
52 | |||
53 | BOOT_PRINTF("in ACTN *** \n") |
|
53 | BOOT_PRINTF("in ACTN *** \n") | |
54 |
|
54 | |||
55 | while(1) |
|
55 | while(1) | |
56 | { |
|
56 | { | |
57 | status = rtems_message_queue_receive( queue_rcv_id, (char*) &TC, &size, |
|
57 | status = rtems_message_queue_receive( queue_rcv_id, (char*) &TC, &size, | |
58 | RTEMS_WAIT, RTEMS_NO_TIMEOUT); |
|
58 | RTEMS_WAIT, RTEMS_NO_TIMEOUT); | |
59 | getTime( time ); // set time to the current time |
|
59 | getTime( time ); // set time to the current time | |
60 | if (status!=RTEMS_SUCCESSFUL) |
|
60 | if (status!=RTEMS_SUCCESSFUL) | |
61 | { |
|
61 | { | |
62 | PRINTF1("ERR *** in task ACTN *** error receiving a message, code %d \n", status) |
|
62 | PRINTF1("ERR *** in task ACTN *** error receiving a message, code %d \n", status) | |
63 | } |
|
63 | } | |
64 | else |
|
64 | else | |
65 | { |
|
65 | { | |
66 | subtype = TC.serviceSubType; |
|
66 | subtype = TC.serviceSubType; | |
67 | switch(subtype) |
|
67 | switch(subtype) | |
68 | { |
|
68 | { | |
69 | case TC_SUBTYPE_RESET: |
|
69 | case TC_SUBTYPE_RESET: | |
70 | result = action_reset( &TC, queue_snd_id, time ); |
|
70 | result = action_reset( &TC, queue_snd_id, time ); | |
71 |
close_action( &TC, result, queue_snd_id |
|
71 | close_action( &TC, result, queue_snd_id ); | |
72 | break; |
|
72 | break; | |
73 | // |
|
73 | // | |
74 | case TC_SUBTYPE_LOAD_COMM: |
|
74 | case TC_SUBTYPE_LOAD_COMM: | |
75 | result = action_load_common_par( &TC ); |
|
75 | result = action_load_common_par( &TC ); | |
76 |
close_action( &TC, result, queue_snd_id |
|
76 | close_action( &TC, result, queue_snd_id ); | |
77 | break; |
|
77 | break; | |
78 | // |
|
78 | // | |
79 | case TC_SUBTYPE_LOAD_NORM: |
|
79 | case TC_SUBTYPE_LOAD_NORM: | |
80 | result = action_load_normal_par( &TC, queue_snd_id, time ); |
|
80 | result = action_load_normal_par( &TC, queue_snd_id, time ); | |
81 |
close_action( &TC, result, queue_snd_id |
|
81 | close_action( &TC, result, queue_snd_id ); | |
82 | break; |
|
82 | break; | |
83 | // |
|
83 | // | |
84 | case TC_SUBTYPE_LOAD_BURST: |
|
84 | case TC_SUBTYPE_LOAD_BURST: | |
85 | result = action_load_burst_par( &TC, queue_snd_id, time ); |
|
85 | result = action_load_burst_par( &TC, queue_snd_id, time ); | |
86 |
close_action( &TC, result, queue_snd_id |
|
86 | close_action( &TC, result, queue_snd_id ); | |
87 | break; |
|
87 | break; | |
88 | // |
|
88 | // | |
89 | case TC_SUBTYPE_LOAD_SBM1: |
|
89 | case TC_SUBTYPE_LOAD_SBM1: | |
90 | result = action_load_sbm1_par( &TC, queue_snd_id, time ); |
|
90 | result = action_load_sbm1_par( &TC, queue_snd_id, time ); | |
91 |
close_action( &TC, result, queue_snd_id |
|
91 | close_action( &TC, result, queue_snd_id ); | |
92 | break; |
|
92 | break; | |
93 | // |
|
93 | // | |
94 | case TC_SUBTYPE_LOAD_SBM2: |
|
94 | case TC_SUBTYPE_LOAD_SBM2: | |
95 | result = action_load_sbm2_par( &TC, queue_snd_id, time ); |
|
95 | result = action_load_sbm2_par( &TC, queue_snd_id, time ); | |
96 |
close_action( &TC, result, queue_snd_id |
|
96 | close_action( &TC, result, queue_snd_id ); | |
97 | break; |
|
97 | break; | |
98 | // |
|
98 | // | |
99 | case TC_SUBTYPE_DUMP: |
|
99 | case TC_SUBTYPE_DUMP: | |
100 | result = action_dump_par( queue_snd_id ); |
|
100 | result = action_dump_par( queue_snd_id ); | |
101 |
close_action( &TC, result, queue_snd_id |
|
101 | close_action( &TC, result, queue_snd_id ); | |
102 | break; |
|
102 | break; | |
103 | // |
|
103 | // | |
104 | case TC_SUBTYPE_ENTER: |
|
104 | case TC_SUBTYPE_ENTER: | |
105 | result = action_enter_mode( &TC, queue_snd_id, time ); |
|
105 | result = action_enter_mode( &TC, queue_snd_id, time ); | |
106 |
close_action( &TC, result, queue_snd_id |
|
106 | close_action( &TC, result, queue_snd_id ); | |
107 | break; |
|
107 | break; | |
108 | // |
|
108 | // | |
109 | case TC_SUBTYPE_UPDT_INFO: |
|
109 | case TC_SUBTYPE_UPDT_INFO: | |
110 | result = action_update_info( &TC, queue_snd_id ); |
|
110 | result = action_update_info( &TC, queue_snd_id ); | |
111 |
close_action( &TC, result, queue_snd_id |
|
111 | close_action( &TC, result, queue_snd_id ); | |
112 | break; |
|
112 | break; | |
113 | // |
|
113 | // | |
114 | case TC_SUBTYPE_EN_CAL: |
|
114 | case TC_SUBTYPE_EN_CAL: | |
115 | result = action_enable_calibration( &TC, queue_snd_id, time ); |
|
115 | result = action_enable_calibration( &TC, queue_snd_id, time ); | |
116 |
close_action( &TC, result, queue_snd_id |
|
116 | close_action( &TC, result, queue_snd_id ); | |
117 | break; |
|
117 | break; | |
118 | // |
|
118 | // | |
119 | case TC_SUBTYPE_DIS_CAL: |
|
119 | case TC_SUBTYPE_DIS_CAL: | |
120 | result = action_disable_calibration( &TC, queue_snd_id, time ); |
|
120 | result = action_disable_calibration( &TC, queue_snd_id, time ); | |
121 |
close_action( &TC, result, queue_snd_id |
|
121 | close_action( &TC, result, queue_snd_id ); | |
122 | break; |
|
122 | break; | |
123 | // |
|
123 | // | |
124 | case TC_SUBTYPE_UPDT_TIME: |
|
124 | case TC_SUBTYPE_UPDT_TIME: | |
125 | result = action_update_time( &TC ); |
|
125 | result = action_update_time( &TC ); | |
126 |
close_action( &TC, result, queue_snd_id |
|
126 | close_action( &TC, result, queue_snd_id ); | |
127 | break; |
|
127 | break; | |
128 | // |
|
128 | // | |
129 | default: |
|
129 | default: | |
130 | break; |
|
130 | break; | |
131 | } |
|
131 | } | |
132 | } |
|
132 | } | |
133 | } |
|
133 | } | |
134 | } |
|
134 | } | |
135 |
|
135 | |||
136 | //*********** |
|
136 | //*********** | |
137 | // TC ACTIONS |
|
137 | // TC ACTIONS | |
138 |
|
138 | |||
139 | int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
139 | int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) | |
140 | { |
|
140 | { | |
141 | /** This function executes specific actions when a TC_LFR_RESET TeleCommand has been received. |
|
141 | /** This function executes specific actions when a TC_LFR_RESET TeleCommand has been received. | |
142 | * |
|
142 | * | |
143 | * @param TC points to the TeleCommand packet that is being processed |
|
143 | * @param TC points to the TeleCommand packet that is being processed | |
144 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
144 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver | |
145 | * |
|
145 | * | |
146 | */ |
|
146 | */ | |
147 |
|
147 | |||
148 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); |
|
148 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); | |
149 | return LFR_DEFAULT; |
|
149 | return LFR_DEFAULT; | |
150 | } |
|
150 | } | |
151 |
|
151 | |||
152 | int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
152 | int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) | |
153 | { |
|
153 | { | |
154 | /** This function executes specific actions when a TC_LFR_ENTER_MODE TeleCommand has been received. |
|
154 | /** This function executes specific actions when a TC_LFR_ENTER_MODE TeleCommand has been received. | |
155 | * |
|
155 | * | |
156 | * @param TC points to the TeleCommand packet that is being processed |
|
156 | * @param TC points to the TeleCommand packet that is being processed | |
157 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
157 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver | |
158 | * |
|
158 | * | |
159 | */ |
|
159 | */ | |
160 |
|
160 | |||
161 | rtems_status_code status; |
|
161 | rtems_status_code status; | |
162 | unsigned char requestedMode; |
|
162 | unsigned char requestedMode; | |
163 |
|
163 | |||
164 | requestedMode = TC->dataAndCRC[1]; |
|
164 | requestedMode = TC->dataAndCRC[1]; | |
165 |
|
165 | |||
166 | if ( (requestedMode != LFR_MODE_STANDBY) |
|
166 | if ( (requestedMode != LFR_MODE_STANDBY) | |
167 | && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST) |
|
167 | && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST) | |
168 | && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) ) |
|
168 | && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) ) | |
169 | { |
|
169 | { | |
170 | status = RTEMS_UNSATISFIED; |
|
170 | status = RTEMS_UNSATISFIED; | |
171 |
send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_LFR_MODE, requestedMode |
|
171 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_LFR_MODE, requestedMode ); | |
172 | } |
|
172 | } | |
173 | else |
|
173 | else | |
174 | { |
|
174 | { | |
175 | printf("in action_enter_mode *** enter mode %d\n", requestedMode); |
|
175 | printf("in action_enter_mode *** enter mode %d\n", requestedMode); | |
176 |
|
176 | |||
177 | status = transition_validation(requestedMode); |
|
177 | status = transition_validation(requestedMode); | |
178 |
|
178 | |||
179 | if ( status == LFR_SUCCESSFUL ) { |
|
179 | if ( status == LFR_SUCCESSFUL ) { | |
180 | if ( lfrCurrentMode != LFR_MODE_STANDBY) |
|
180 | if ( lfrCurrentMode != LFR_MODE_STANDBY) | |
181 | { |
|
181 | { | |
182 | status = stop_current_mode(); |
|
182 | status = stop_current_mode(); | |
183 | } |
|
183 | } | |
184 | if (status != RTEMS_SUCCESSFUL) |
|
184 | if (status != RTEMS_SUCCESSFUL) | |
185 | { |
|
185 | { | |
186 | PRINTF("ERR *** in action_enter *** stop_current_mode\n") |
|
186 | PRINTF("ERR *** in action_enter *** stop_current_mode\n") | |
187 | } |
|
187 | } | |
188 | status = enter_mode( requestedMode ); |
|
188 | status = enter_mode( requestedMode ); | |
189 | } |
|
189 | } | |
190 | else |
|
190 | else | |
191 | { |
|
191 | { | |
192 | PRINTF("ERR *** in action_enter *** transition rejected\n") |
|
192 | PRINTF("ERR *** in action_enter *** transition rejected\n") | |
193 |
send_tm_lfr_tc_exe_not_executable( TC, queue_id |
|
193 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); | |
194 | } |
|
194 | } | |
195 | } |
|
195 | } | |
196 |
|
196 | |||
197 | return status; |
|
197 | return status; | |
198 | } |
|
198 | } | |
199 |
|
199 | |||
200 | int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
200 | int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) | |
201 | { |
|
201 | { | |
202 | /** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received. |
|
202 | /** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received. | |
203 | * |
|
203 | * | |
204 | * @param TC points to the TeleCommand packet that is being processed |
|
204 | * @param TC points to the TeleCommand packet that is being processed | |
205 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
205 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver | |
206 | * |
|
206 | * | |
207 | * @return LFR directive status code: |
|
207 | * @return LFR directive status code: | |
208 | * - LFR_DEFAULT |
|
208 | * - LFR_DEFAULT | |
209 | * - LFR_SUCCESSFUL |
|
209 | * - LFR_SUCCESSFUL | |
210 | * |
|
210 | * | |
211 | */ |
|
211 | */ | |
212 |
|
212 | |||
213 | unsigned int val; |
|
213 | unsigned int val; | |
214 | int result; |
|
214 | int result; | |
215 |
|
215 | unsigned int status; | ||
216 | result = LFR_SUCCESSFUL; |
|
216 | unsigned char mode; | |
217 |
|
217 | |||
218 | val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256 |
|
218 | // check LFR MODE | |
219 | + housekeeping_packet.hk_lfr_update_info_tc_cnt[1]; |
|
219 | mode = (TC->dataAndCRC[ BYTE_POS_HK_UPDATE_INFO_PAR_SET5 ] & 0x1e) >> 1; | |
220 | val++; |
|
220 | status = check_update_info_hk_lfr_mode( mode ); | |
221 | housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8); |
|
221 | if (status != LFR_DEFAULT) // check TDS mode | |
222 | housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val); |
|
222 | { | |
|
223 | mode = (TC->dataAndCRC[ BYTE_POS_HK_UPDATE_INFO_PAR_SET6 ] & 0xf0) >> 4; | |||
|
224 | status = check_update_info_hk_tds_mode( mode ); | |||
|
225 | } | |||
|
226 | if (status != LFR_DEFAULT) // check THR mode | |||
|
227 | { | |||
|
228 | mode = (TC->dataAndCRC[ BYTE_POS_HK_UPDATE_INFO_PAR_SET6 ] & 0x0f); | |||
|
229 | status = check_update_info_hk_thr_mode( mode ); | |||
|
230 | } | |||
|
231 | if (status != LFR_DEFAULT) // if the parameter check is successful | |||
|
232 | { | |||
|
233 | val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256 | |||
|
234 | + housekeeping_packet.hk_lfr_update_info_tc_cnt[1]; | |||
|
235 | val++; | |||
|
236 | housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8); | |||
|
237 | housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val); | |||
|
238 | } | |||
|
239 | ||||
|
240 | result = status; | |||
223 |
|
241 | |||
224 | return result; |
|
242 | return result; | |
225 | } |
|
243 | } | |
226 |
|
244 | |||
227 | int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
245 | int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) | |
228 | { |
|
246 | { | |
229 | /** This function executes specific actions when a TC_LFR_ENABLE_CALIBRATION TeleCommand has been received. |
|
247 | /** This function executes specific actions when a TC_LFR_ENABLE_CALIBRATION TeleCommand has been received. | |
230 | * |
|
248 | * | |
231 | * @param TC points to the TeleCommand packet that is being processed |
|
249 | * @param TC points to the TeleCommand packet that is being processed | |
232 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
250 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver | |
233 | * |
|
251 | * | |
234 | */ |
|
252 | */ | |
235 |
|
253 | |||
236 | int result; |
|
254 | int result; | |
237 | unsigned char lfrMode; |
|
255 | unsigned char lfrMode; | |
238 |
|
256 | |||
239 | result = LFR_DEFAULT; |
|
257 | result = LFR_DEFAULT; | |
240 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
258 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
241 |
|
259 | |||
242 | if ( (lfrMode == LFR_MODE_STANDBY) || (lfrMode == LFR_MODE_BURST) || (lfrMode == LFR_MODE_SBM2) ) { |
|
260 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); | |
243 | send_tm_lfr_tc_exe_not_executable( TC, queue_id, time ); |
|
261 | result = LFR_DEFAULT; | |
244 | result = LFR_DEFAULT; |
|
262 | ||
245 | } |
|
|||
246 | else { |
|
|||
247 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); |
|
|||
248 | result = LFR_DEFAULT; |
|
|||
249 | } |
|
|||
250 | return result; |
|
263 | return result; | |
251 | } |
|
264 | } | |
252 |
|
265 | |||
253 | int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
266 | int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) | |
254 | { |
|
267 | { | |
255 | /** This function executes specific actions when a TC_LFR_DISABLE_CALIBRATION TeleCommand has been received. |
|
268 | /** This function executes specific actions when a TC_LFR_DISABLE_CALIBRATION TeleCommand has been received. | |
256 | * |
|
269 | * | |
257 | * @param TC points to the TeleCommand packet that is being processed |
|
270 | * @param TC points to the TeleCommand packet that is being processed | |
258 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
271 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver | |
259 | * |
|
272 | * | |
260 | */ |
|
273 | */ | |
261 |
|
274 | |||
262 | int result; |
|
275 | int result; | |
263 | unsigned char lfrMode; |
|
276 | unsigned char lfrMode; | |
264 |
|
277 | |||
265 | result = LFR_DEFAULT; |
|
278 | result = LFR_DEFAULT; | |
266 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
279 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
267 |
|
280 | |||
268 | if ( (lfrMode == LFR_MODE_STANDBY) || (lfrMode == LFR_MODE_BURST) || (lfrMode == LFR_MODE_SBM2) ) { |
|
281 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); | |
269 | send_tm_lfr_tc_exe_not_executable( TC, queue_id, time ); |
|
282 | result = LFR_DEFAULT; | |
270 | result = LFR_DEFAULT; |
|
283 | ||
271 | } |
|
|||
272 | else { |
|
|||
273 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); |
|
|||
274 | result = LFR_DEFAULT; |
|
|||
275 | } |
|
|||
276 | return result; |
|
284 | return result; | |
277 | } |
|
285 | } | |
278 |
|
286 | |||
279 | int action_update_time(ccsdsTelecommandPacket_t *TC) |
|
287 | int action_update_time(ccsdsTelecommandPacket_t *TC) | |
280 | { |
|
288 | { | |
281 | /** This function executes specific actions when a TC_LFR_UPDATE_TIME TeleCommand has been received. |
|
289 | /** This function executes specific actions when a TC_LFR_UPDATE_TIME TeleCommand has been received. | |
282 | * |
|
290 | * | |
283 | * @param TC points to the TeleCommand packet that is being processed |
|
291 | * @param TC points to the TeleCommand packet that is being processed | |
284 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
292 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver | |
285 | * |
|
293 | * | |
286 | * @return LFR_SUCCESSFUL |
|
294 | * @return LFR_SUCCESSFUL | |
287 | * |
|
295 | * | |
288 | */ |
|
296 | */ | |
289 |
|
297 | |||
290 | unsigned int val; |
|
298 | unsigned int val; | |
291 |
|
299 | |||
292 | time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24) |
|
300 | time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24) | |
293 | + (TC->dataAndCRC[1] << 16) |
|
301 | + (TC->dataAndCRC[1] << 16) | |
294 | + (TC->dataAndCRC[2] << 8) |
|
302 | + (TC->dataAndCRC[2] << 8) | |
295 | + TC->dataAndCRC[3]; |
|
303 | + TC->dataAndCRC[3]; | |
296 | val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256 |
|
304 | val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256 | |
297 | + housekeeping_packet.hk_lfr_update_time_tc_cnt[1]; |
|
305 | + housekeeping_packet.hk_lfr_update_time_tc_cnt[1]; | |
298 | val++; |
|
306 | val++; | |
299 | housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8); |
|
307 | housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8); | |
300 | housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val); |
|
308 | housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val); | |
301 | time_management_regs->ctrl = time_management_regs->ctrl | 1; |
|
309 | time_management_regs->ctrl = time_management_regs->ctrl | 1; | |
302 |
|
310 | |||
303 | return LFR_SUCCESSFUL; |
|
311 | return LFR_SUCCESSFUL; | |
304 | } |
|
312 | } | |
305 |
|
313 | |||
306 | //******************* |
|
314 | //******************* | |
307 | // ENTERING THE MODES |
|
315 | // ENTERING THE MODES | |
308 |
|
316 | |||
309 | int transition_validation(unsigned char requestedMode) |
|
317 | int transition_validation(unsigned char requestedMode) | |
310 | { |
|
318 | { | |
311 | /** This function checks the validity of the transition requested by the TC_LFR_ENTER_MODE. |
|
319 | /** This function checks the validity of the transition requested by the TC_LFR_ENTER_MODE. | |
312 | * |
|
320 | * | |
313 | * @param requestedMode is the mode requested by the TC_LFR_ENTER_MODE |
|
321 | * @param requestedMode is the mode requested by the TC_LFR_ENTER_MODE | |
314 | * |
|
322 | * | |
315 | * @return LFR directive status codes: |
|
323 | * @return LFR directive status codes: | |
316 | * - LFR_SUCCESSFUL - the transition is authorized |
|
324 | * - LFR_SUCCESSFUL - the transition is authorized | |
317 | * - LFR_DEFAULT - the transition is not authorized |
|
325 | * - LFR_DEFAULT - the transition is not authorized | |
318 | * |
|
326 | * | |
319 | */ |
|
327 | */ | |
320 |
|
328 | |||
321 | int status; |
|
329 | int status; | |
322 |
|
330 | |||
323 | switch (requestedMode) |
|
331 | switch (requestedMode) | |
324 | { |
|
332 | { | |
325 | case LFR_MODE_STANDBY: |
|
333 | case LFR_MODE_STANDBY: | |
326 | if ( lfrCurrentMode == LFR_MODE_STANDBY ) { |
|
334 | if ( lfrCurrentMode == LFR_MODE_STANDBY ) { | |
327 | status = LFR_DEFAULT; |
|
335 | status = LFR_DEFAULT; | |
328 | } |
|
336 | } | |
329 | else |
|
337 | else | |
330 | { |
|
338 | { | |
331 | status = LFR_SUCCESSFUL; |
|
339 | status = LFR_SUCCESSFUL; | |
332 | } |
|
340 | } | |
333 | break; |
|
341 | break; | |
334 | case LFR_MODE_NORMAL: |
|
342 | case LFR_MODE_NORMAL: | |
335 | if ( lfrCurrentMode == LFR_MODE_NORMAL ) { |
|
343 | if ( lfrCurrentMode == LFR_MODE_NORMAL ) { | |
336 | status = LFR_DEFAULT; |
|
344 | status = LFR_DEFAULT; | |
337 | } |
|
345 | } | |
338 | else { |
|
346 | else { | |
339 | status = LFR_SUCCESSFUL; |
|
347 | status = LFR_SUCCESSFUL; | |
340 | } |
|
348 | } | |
341 | break; |
|
349 | break; | |
342 | case LFR_MODE_BURST: |
|
350 | case LFR_MODE_BURST: | |
343 | if ( lfrCurrentMode == LFR_MODE_BURST ) { |
|
351 | if ( lfrCurrentMode == LFR_MODE_BURST ) { | |
344 | status = LFR_DEFAULT; |
|
352 | status = LFR_DEFAULT; | |
345 | } |
|
353 | } | |
346 | else { |
|
354 | else { | |
347 | status = LFR_SUCCESSFUL; |
|
355 | status = LFR_SUCCESSFUL; | |
348 | } |
|
356 | } | |
349 | break; |
|
357 | break; | |
350 | case LFR_MODE_SBM1: |
|
358 | case LFR_MODE_SBM1: | |
351 | if ( lfrCurrentMode == LFR_MODE_SBM1 ) { |
|
359 | if ( lfrCurrentMode == LFR_MODE_SBM1 ) { | |
352 | status = LFR_DEFAULT; |
|
360 | status = LFR_DEFAULT; | |
353 | } |
|
361 | } | |
354 | else { |
|
362 | else { | |
355 | status = LFR_SUCCESSFUL; |
|
363 | status = LFR_SUCCESSFUL; | |
356 | } |
|
364 | } | |
357 | break; |
|
365 | break; | |
358 | case LFR_MODE_SBM2: |
|
366 | case LFR_MODE_SBM2: | |
359 | if ( lfrCurrentMode == LFR_MODE_SBM2 ) { |
|
367 | if ( lfrCurrentMode == LFR_MODE_SBM2 ) { | |
360 | status = LFR_DEFAULT; |
|
368 | status = LFR_DEFAULT; | |
361 | } |
|
369 | } | |
362 | else { |
|
370 | else { | |
363 | status = LFR_SUCCESSFUL; |
|
371 | status = LFR_SUCCESSFUL; | |
364 | } |
|
372 | } | |
365 | break; |
|
373 | break; | |
366 | default: |
|
374 | default: | |
367 | status = LFR_DEFAULT; |
|
375 | status = LFR_DEFAULT; | |
368 | break; |
|
376 | break; | |
369 | } |
|
377 | } | |
370 |
|
378 | |||
371 | return status; |
|
379 | return status; | |
372 | } |
|
380 | } | |
373 |
|
381 | |||
374 | int stop_current_mode(void) |
|
382 | int stop_current_mode(void) | |
375 | { |
|
383 | { | |
376 | /** This function stops the current mode by masking interrupt lines and suspending science tasks. |
|
384 | /** This function stops the current mode by masking interrupt lines and suspending science tasks. | |
377 | * |
|
385 | * | |
378 | * @return RTEMS directive status codes: |
|
386 | * @return RTEMS directive status codes: | |
379 | * - RTEMS_SUCCESSFUL - task restarted successfully |
|
387 | * - RTEMS_SUCCESSFUL - task restarted successfully | |
380 | * - RTEMS_INVALID_ID - task id invalid |
|
388 | * - RTEMS_INVALID_ID - task id invalid | |
381 | * - RTEMS_ALREADY_SUSPENDED - task already suspended |
|
389 | * - RTEMS_ALREADY_SUSPENDED - task already suspended | |
382 | * |
|
390 | * | |
383 | */ |
|
391 | */ | |
384 |
|
392 | |||
385 | rtems_status_code status; |
|
393 | rtems_status_code status; | |
386 |
|
394 | |||
387 | status = RTEMS_SUCCESSFUL; |
|
395 | status = RTEMS_SUCCESSFUL; | |
388 |
|
396 | |||
389 | // (1) mask interruptions |
|
397 | // (1) mask interruptions | |
390 | LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt |
|
398 | LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt | |
391 | LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt |
|
399 | LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt | |
392 |
|
400 | |||
393 | // (2) clear interruptions |
|
401 | // (2) clear interruptions | |
394 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt |
|
402 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt | |
395 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt |
|
403 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt | |
396 |
|
404 | |||
397 | // (3) reset registers |
|
405 | // (3) reset registers | |
398 | reset_wfp_burst_enable(); // reset burst and enable bits |
|
406 | reset_wfp_burst_enable(); // reset burst and enable bits | |
399 | reset_wfp_status(); // reset all the status bits |
|
407 | reset_wfp_status(); // reset all the status bits | |
400 | disable_irq_on_new_ready_matrix(); // stop the spectral matrices |
|
408 | disable_irq_on_new_ready_matrix(); // stop the spectral matrices | |
401 |
|
409 | |||
402 | // <Spectral Matrices simulator> |
|
410 | // <Spectral Matrices simulator> | |
403 | LEON_Mask_interrupt( IRQ_SM_SIMULATOR ); // mask spectral matrix interrupt simulator |
|
411 | LEON_Mask_interrupt( IRQ_SM_SIMULATOR ); // mask spectral matrix interrupt simulator | |
404 | timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); |
|
412 | timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); | |
405 | LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); // clear spectral matrix interrupt simulator |
|
413 | LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); // clear spectral matrix interrupt simulator | |
406 | // </Spectral Matrices simulator> |
|
414 | // </Spectral Matrices simulator> | |
407 |
|
415 | |||
408 | // suspend several tasks |
|
416 | // suspend several tasks | |
409 | if (lfrCurrentMode != LFR_MODE_STANDBY) { |
|
417 | if (lfrCurrentMode != LFR_MODE_STANDBY) { | |
410 | status = suspend_science_tasks(); |
|
418 | status = suspend_science_tasks(); | |
411 | } |
|
419 | } | |
412 |
|
420 | |||
413 | if (status != RTEMS_SUCCESSFUL) |
|
421 | if (status != RTEMS_SUCCESSFUL) | |
414 | { |
|
422 | { | |
415 | PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status) |
|
423 | PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status) | |
416 | } |
|
424 | } | |
417 |
|
425 | |||
418 | return status; |
|
426 | return status; | |
419 | } |
|
427 | } | |
420 |
|
428 | |||
421 | int enter_mode(unsigned char mode ) |
|
429 | int enter_mode(unsigned char mode ) | |
422 | { |
|
430 | { | |
423 | /** This function is launched after a mode transition validation. |
|
431 | /** This function is launched after a mode transition validation. | |
424 | * |
|
432 | * | |
425 | * @param mode is the mode in which LFR will be put. |
|
433 | * @param mode is the mode in which LFR will be put. | |
426 | * |
|
434 | * | |
427 | * @return RTEMS directive status codes: |
|
435 | * @return RTEMS directive status codes: | |
428 | * - RTEMS_SUCCESSFUL - the mode has been entered successfully |
|
436 | * - RTEMS_SUCCESSFUL - the mode has been entered successfully | |
429 | * - RTEMS_NOT_SATISFIED - the mode has not been entered successfully |
|
437 | * - RTEMS_NOT_SATISFIED - the mode has not been entered successfully | |
430 | * |
|
438 | * | |
431 | */ |
|
439 | */ | |
432 |
|
440 | |||
433 | rtems_status_code status; |
|
441 | rtems_status_code status; | |
434 |
|
442 | |||
435 | status = RTEMS_UNSATISFIED; |
|
443 | status = RTEMS_UNSATISFIED; | |
436 |
|
444 | |||
437 | housekeeping_packet.lfr_status_word[0] = (unsigned char) ((mode << 4) + 0x0d); |
|
445 | housekeeping_packet.lfr_status_word[0] = (unsigned char) ((mode << 4) + 0x0d); | |
438 | updateLFRCurrentMode(); |
|
446 | updateLFRCurrentMode(); | |
439 |
|
447 | |||
440 | if ( (mode == LFR_MODE_NORMAL) || (mode == LFR_MODE_BURST) |
|
448 | if ( (mode == LFR_MODE_NORMAL) || (mode == LFR_MODE_BURST) | |
441 | || (mode == LFR_MODE_SBM1) || (mode == LFR_MODE_SBM2) ) |
|
449 | || (mode == LFR_MODE_SBM1) || (mode == LFR_MODE_SBM2) ) | |
442 | { |
|
450 | { | |
443 | #ifdef PRINT_TASK_STATISTICS |
|
451 | #ifdef PRINT_TASK_STATISTICS | |
444 | rtems_cpu_usage_reset(); |
|
452 | rtems_cpu_usage_reset(); | |
445 | maxCount = 0; |
|
453 | maxCount = 0; | |
446 | #endif |
|
454 | #endif | |
447 | status = restart_science_tasks(); |
|
455 | status = restart_science_tasks(); | |
448 | launch_waveform_picker( mode ); |
|
456 | launch_waveform_picker( mode ); | |
449 | launch_spectral_matrix( mode ); |
|
457 | launch_spectral_matrix( mode ); | |
450 | } |
|
458 | } | |
451 | else if ( mode == LFR_MODE_STANDBY ) |
|
459 | else if ( mode == LFR_MODE_STANDBY ) | |
452 | { |
|
460 | { | |
453 | #ifdef PRINT_TASK_STATISTICS |
|
461 | #ifdef PRINT_TASK_STATISTICS | |
454 | rtems_cpu_usage_report(); |
|
462 | rtems_cpu_usage_report(); | |
455 | #endif |
|
463 | #endif | |
456 |
|
464 | |||
457 | #ifdef PRINT_STACK_REPORT |
|
465 | #ifdef PRINT_STACK_REPORT | |
458 | rtems_stack_checker_report_usage(); |
|
466 | rtems_stack_checker_report_usage(); | |
459 | #endif |
|
467 | #endif | |
460 | status = stop_current_mode(); |
|
468 | status = stop_current_mode(); | |
461 | PRINTF1("maxCount = %d\n", maxCount) |
|
469 | PRINTF1("maxCount = %d\n", maxCount) | |
462 | } |
|
470 | } | |
463 | else |
|
471 | else | |
464 | { |
|
472 | { | |
465 | status = RTEMS_UNSATISFIED; |
|
473 | status = RTEMS_UNSATISFIED; | |
466 | } |
|
474 | } | |
467 |
|
475 | |||
468 | if (status != RTEMS_SUCCESSFUL) |
|
476 | if (status != RTEMS_SUCCESSFUL) | |
469 | { |
|
477 | { | |
470 | PRINTF1("in enter_mode *** ERR = %d\n", status) |
|
478 | PRINTF1("in enter_mode *** ERR = %d\n", status) | |
471 | status = RTEMS_UNSATISFIED; |
|
479 | status = RTEMS_UNSATISFIED; | |
472 | } |
|
480 | } | |
473 |
|
481 | |||
474 | return status; |
|
482 | return status; | |
475 | } |
|
483 | } | |
476 |
|
484 | |||
477 | int restart_science_tasks() |
|
485 | int restart_science_tasks() | |
478 | { |
|
486 | { | |
479 | /** This function is used to restart all science tasks. |
|
487 | /** This function is used to restart all science tasks. | |
480 | * |
|
488 | * | |
481 | * @return RTEMS directive status codes: |
|
489 | * @return RTEMS directive status codes: | |
482 | * - RTEMS_SUCCESSFUL - task restarted successfully |
|
490 | * - RTEMS_SUCCESSFUL - task restarted successfully | |
483 | * - RTEMS_INVALID_ID - task id invalid |
|
491 | * - RTEMS_INVALID_ID - task id invalid | |
484 | * - RTEMS_INCORRECT_STATE - task never started |
|
492 | * - RTEMS_INCORRECT_STATE - task never started | |
485 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task |
|
493 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task | |
486 | * |
|
494 | * | |
487 | * Science tasks are AVF0, BPF0, WFRM, CWF3, CW2, CWF1 |
|
495 | * Science tasks are AVF0, BPF0, WFRM, CWF3, CW2, CWF1 | |
488 | * |
|
496 | * | |
489 | */ |
|
497 | */ | |
490 |
|
498 | |||
491 | rtems_status_code status[6]; |
|
499 | rtems_status_code status[6]; | |
492 | rtems_status_code ret; |
|
500 | rtems_status_code ret; | |
493 |
|
501 | |||
494 | ret = RTEMS_SUCCESSFUL; |
|
502 | ret = RTEMS_SUCCESSFUL; | |
495 |
|
503 | |||
496 | status[0] = rtems_task_restart( Task_id[TASKID_AVF0], 1 ); |
|
504 | status[0] = rtems_task_restart( Task_id[TASKID_AVF0], 1 ); | |
497 | if (status[0] != RTEMS_SUCCESSFUL) |
|
505 | if (status[0] != RTEMS_SUCCESSFUL) | |
498 | { |
|
506 | { | |
499 | PRINTF1("in restart_science_task *** 0 ERR %d\n", status[0]) |
|
507 | PRINTF1("in restart_science_task *** 0 ERR %d\n", status[0]) | |
500 | } |
|
508 | } | |
501 |
|
509 | |||
502 | status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 ); |
|
510 | status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 ); | |
503 | if (status[2] != RTEMS_SUCCESSFUL) |
|
511 | if (status[2] != RTEMS_SUCCESSFUL) | |
504 | { |
|
512 | { | |
505 | PRINTF1("in restart_science_task *** 2 ERR %d\n", status[2]) |
|
513 | PRINTF1("in restart_science_task *** 2 ERR %d\n", status[2]) | |
506 | } |
|
514 | } | |
507 |
|
515 | |||
508 | status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 ); |
|
516 | status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 ); | |
509 | if (status[3] != RTEMS_SUCCESSFUL) |
|
517 | if (status[3] != RTEMS_SUCCESSFUL) | |
510 | { |
|
518 | { | |
511 | PRINTF1("in restart_science_task *** 3 ERR %d\n", status[3]) |
|
519 | PRINTF1("in restart_science_task *** 3 ERR %d\n", status[3]) | |
512 | } |
|
520 | } | |
513 |
|
521 | |||
514 | status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 ); |
|
522 | status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 ); | |
515 | if (status[4] != RTEMS_SUCCESSFUL) |
|
523 | if (status[4] != RTEMS_SUCCESSFUL) | |
516 | { |
|
524 | { | |
517 | PRINTF1("in restart_science_task *** 4 ERR %d\n", status[4]) |
|
525 | PRINTF1("in restart_science_task *** 4 ERR %d\n", status[4]) | |
518 | } |
|
526 | } | |
519 |
|
527 | |||
520 | status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 ); |
|
528 | status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 ); | |
521 | if (status[5] != RTEMS_SUCCESSFUL) |
|
529 | if (status[5] != RTEMS_SUCCESSFUL) | |
522 | { |
|
530 | { | |
523 | PRINTF1("in restart_science_task *** 5 ERR %d\n", status[5]) |
|
531 | PRINTF1("in restart_science_task *** 5 ERR %d\n", status[5]) | |
524 | } |
|
532 | } | |
525 |
|
533 | |||
526 | if ( (status[0] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) || |
|
534 | if ( (status[0] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) || | |
527 | (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) ) |
|
535 | (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) ) | |
528 | { |
|
536 | { | |
529 | ret = RTEMS_UNSATISFIED; |
|
537 | ret = RTEMS_UNSATISFIED; | |
530 | } |
|
538 | } | |
531 |
|
539 | |||
532 | return ret; |
|
540 | return ret; | |
533 | } |
|
541 | } | |
534 |
|
542 | |||
535 | int suspend_science_tasks() |
|
543 | int suspend_science_tasks() | |
536 | { |
|
544 | { | |
537 | /** This function suspends the science tasks. |
|
545 | /** This function suspends the science tasks. | |
538 | * |
|
546 | * | |
539 | * @return RTEMS directive status codes: |
|
547 | * @return RTEMS directive status codes: | |
540 | * - RTEMS_SUCCESSFUL - task restarted successfully |
|
548 | * - RTEMS_SUCCESSFUL - task restarted successfully | |
541 | * - RTEMS_INVALID_ID - task id invalid |
|
549 | * - RTEMS_INVALID_ID - task id invalid | |
542 | * - RTEMS_ALREADY_SUSPENDED - task already suspended |
|
550 | * - RTEMS_ALREADY_SUSPENDED - task already suspended | |
543 | * |
|
551 | * | |
544 | */ |
|
552 | */ | |
545 |
|
553 | |||
546 | rtems_status_code status; |
|
554 | rtems_status_code status; | |
547 |
|
555 | |||
548 | status = rtems_task_suspend( Task_id[TASKID_AVF0] ); |
|
556 | status = rtems_task_suspend( Task_id[TASKID_AVF0] ); | |
549 | if (status != RTEMS_SUCCESSFUL) |
|
557 | if (status != RTEMS_SUCCESSFUL) | |
550 | { |
|
558 | { | |
551 | PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status) |
|
559 | PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status) | |
552 | } |
|
560 | } | |
553 |
|
561 | |||
554 | if (status == RTEMS_SUCCESSFUL) // suspend WFRM |
|
562 | if (status == RTEMS_SUCCESSFUL) // suspend WFRM | |
555 | { |
|
563 | { | |
556 | status = rtems_task_suspend( Task_id[TASKID_WFRM] ); |
|
564 | status = rtems_task_suspend( Task_id[TASKID_WFRM] ); | |
557 | if (status != RTEMS_SUCCESSFUL) |
|
565 | if (status != RTEMS_SUCCESSFUL) | |
558 | { |
|
566 | { | |
559 | PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status) |
|
567 | PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status) | |
560 | } |
|
568 | } | |
561 | } |
|
569 | } | |
562 |
|
570 | |||
563 | if (status == RTEMS_SUCCESSFUL) // suspend CWF3 |
|
571 | if (status == RTEMS_SUCCESSFUL) // suspend CWF3 | |
564 | { |
|
572 | { | |
565 | status = rtems_task_suspend( Task_id[TASKID_CWF3] ); |
|
573 | status = rtems_task_suspend( Task_id[TASKID_CWF3] ); | |
566 | if (status != RTEMS_SUCCESSFUL) |
|
574 | if (status != RTEMS_SUCCESSFUL) | |
567 | { |
|
575 | { | |
568 | PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status) |
|
576 | PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status) | |
569 | } |
|
577 | } | |
570 | } |
|
578 | } | |
571 |
|
579 | |||
572 | if (status == RTEMS_SUCCESSFUL) // suspend CWF2 |
|
580 | if (status == RTEMS_SUCCESSFUL) // suspend CWF2 | |
573 | { |
|
581 | { | |
574 | status = rtems_task_suspend( Task_id[TASKID_CWF2] ); |
|
582 | status = rtems_task_suspend( Task_id[TASKID_CWF2] ); | |
575 | if (status != RTEMS_SUCCESSFUL) |
|
583 | if (status != RTEMS_SUCCESSFUL) | |
576 | { |
|
584 | { | |
577 | PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status) |
|
585 | PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status) | |
578 | } |
|
586 | } | |
579 | } |
|
587 | } | |
580 |
|
588 | |||
581 | if (status == RTEMS_SUCCESSFUL) // suspend CWF1 |
|
589 | if (status == RTEMS_SUCCESSFUL) // suspend CWF1 | |
582 | { |
|
590 | { | |
583 | status = rtems_task_suspend( Task_id[TASKID_CWF1] ); |
|
591 | status = rtems_task_suspend( Task_id[TASKID_CWF1] ); | |
584 | if (status != RTEMS_SUCCESSFUL) |
|
592 | if (status != RTEMS_SUCCESSFUL) | |
585 | { |
|
593 | { | |
586 | PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status) |
|
594 | PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status) | |
587 | } |
|
595 | } | |
588 | } |
|
596 | } | |
589 |
|
597 | |||
590 | return status; |
|
598 | return status; | |
591 | } |
|
599 | } | |
592 |
|
600 | |||
593 | void launch_waveform_picker( unsigned char mode ) |
|
601 | void launch_waveform_picker( unsigned char mode ) | |
594 | { |
|
602 | { | |
595 | int startDate; |
|
603 | int startDate; | |
596 |
|
604 | |||
597 | reset_current_ring_nodes(); |
|
605 | reset_current_ring_nodes(); | |
598 | reset_waveform_picker_regs(); |
|
606 | reset_waveform_picker_regs(); | |
599 | set_wfp_burst_enable_register( mode ); |
|
607 | set_wfp_burst_enable_register( mode ); | |
600 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); |
|
608 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); | |
601 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); |
|
609 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); | |
602 | startDate = time_management_regs->coarse_time + 2; |
|
610 | startDate = time_management_regs->coarse_time + 2; | |
603 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x80; // [1000 0000] |
|
611 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x80; // [1000 0000] | |
604 | waveform_picker_regs->start_date = startDate; |
|
612 | waveform_picker_regs->start_date = startDate; | |
605 | } |
|
613 | } | |
606 |
|
614 | |||
607 | void launch_spectral_matrix( unsigned char mode ) |
|
615 | void launch_spectral_matrix( unsigned char mode ) | |
608 | { |
|
616 | { | |
609 | reset_nb_sm_f0(); |
|
617 | reset_nb_sm_f0(); | |
610 | reset_current_sm_ring_nodes(); |
|
618 | reset_current_sm_ring_nodes(); | |
611 | reset_spectral_matrix_regs(); |
|
619 | reset_spectral_matrix_regs(); | |
612 |
|
620 | |||
613 | enable_irq_on_new_ready_matrix(); |
|
621 | enable_irq_on_new_ready_matrix(); | |
614 |
|
622 | |||
615 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); |
|
623 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); | |
616 | LEON_Unmask_interrupt( IRQ_SPECTRAL_MATRIX ); |
|
624 | LEON_Unmask_interrupt( IRQ_SPECTRAL_MATRIX ); | |
617 | } |
|
625 | } | |
618 |
|
626 | |||
619 | void enable_irq_on_new_ready_matrix( void ) |
|
627 | void enable_irq_on_new_ready_matrix( void ) | |
620 | { |
|
628 | { | |
621 | spectral_matrix_regs->config = spectral_matrix_regs->config | 0x01; |
|
629 | spectral_matrix_regs->config = spectral_matrix_regs->config | 0x01; | |
622 | } |
|
630 | } | |
623 |
|
631 | |||
624 | void disable_irq_on_new_ready_matrix( void ) |
|
632 | void disable_irq_on_new_ready_matrix( void ) | |
625 | { |
|
633 | { | |
626 | spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffe; // 1110 |
|
634 | spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffe; // 1110 | |
627 | } |
|
635 | } | |
628 |
|
636 | |||
629 |
|
637 | |||
630 | void launch_spectral_matrix_simu( unsigned char mode ) |
|
638 | void launch_spectral_matrix_simu( unsigned char mode ) | |
631 | { |
|
639 | { | |
632 | reset_nb_sm_f0(); |
|
640 | reset_nb_sm_f0(); | |
633 | reset_current_sm_ring_nodes(); |
|
641 | reset_current_sm_ring_nodes(); | |
634 | reset_spectral_matrix_regs(); |
|
642 | reset_spectral_matrix_regs(); | |
635 |
|
643 | |||
636 | // Spectral Matrices simulator |
|
644 | // Spectral Matrices simulator | |
637 | timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); |
|
645 | timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); | |
638 | LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); |
|
646 | LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); | |
639 | LEON_Unmask_interrupt( IRQ_SM_SIMULATOR ); |
|
647 | LEON_Unmask_interrupt( IRQ_SM_SIMULATOR ); | |
640 | set_local_nb_interrupt_f0_MAX(); |
|
648 | set_local_nb_interrupt_f0_MAX(); | |
641 | } |
|
649 | } | |
642 |
|
650 | |||
643 | //**************** |
|
651 | //**************** | |
644 | // CLOSING ACTIONS |
|
652 | // CLOSING ACTIONS | |
645 |
void update_last_TC_exe(ccsdsTelecommandPacket_t *TC |
|
653 | void update_last_TC_exe(ccsdsTelecommandPacket_t *TC) | |
646 | { |
|
654 | { | |
647 | /** This function is used to update the HK packets statistics after a successful TC execution. |
|
655 | /** This function is used to update the HK packets statistics after a successful TC execution. | |
648 | * |
|
656 | * | |
649 | * @param TC points to the TC being processed |
|
657 | * @param TC points to the TC being processed | |
650 | * @param time is the time used to date the TC execution |
|
658 | * @param time is the time used to date the TC execution | |
651 | * |
|
659 | * | |
652 | */ |
|
660 | */ | |
653 |
|
661 | |||
654 | housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0]; |
|
662 | housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0]; | |
655 | housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1]; |
|
663 | housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1]; | |
656 | housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00; |
|
664 | housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00; | |
657 | housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType; |
|
665 | housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType; | |
658 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00; |
|
666 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00; | |
659 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType; |
|
667 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType; | |
660 |
housekeeping_packet.hk_lfr_last_exe_tc_time[0] = |
|
668 | housekeeping_packet.hk_lfr_last_exe_tc_time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
661 |
housekeeping_packet.hk_lfr_last_exe_tc_time[1] = |
|
669 | housekeeping_packet.hk_lfr_last_exe_tc_time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
662 |
housekeeping_packet.hk_lfr_last_exe_tc_time[2] = |
|
670 | housekeeping_packet.hk_lfr_last_exe_tc_time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
663 |
housekeeping_packet.hk_lfr_last_exe_tc_time[3] = |
|
671 | housekeeping_packet.hk_lfr_last_exe_tc_time[3] = (unsigned char) (time_management_regs->coarse_time); | |
664 |
housekeeping_packet.hk_lfr_last_exe_tc_time[4] = |
|
672 | housekeeping_packet.hk_lfr_last_exe_tc_time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
665 |
housekeeping_packet.hk_lfr_last_exe_tc_time[5] = |
|
673 | housekeeping_packet.hk_lfr_last_exe_tc_time[5] = (unsigned char) (time_management_regs->fine_time); | |
666 | } |
|
674 | } | |
667 |
|
675 | |||
668 |
void update_last_TC_rej(ccsdsTelecommandPacket_t *TC |
|
676 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC ) | |
669 | { |
|
677 | { | |
670 | /** This function is used to update the HK packets statistics after a TC rejection. |
|
678 | /** This function is used to update the HK packets statistics after a TC rejection. | |
671 | * |
|
679 | * | |
672 | * @param TC points to the TC being processed |
|
680 | * @param TC points to the TC being processed | |
673 | * @param time is the time used to date the TC rejection |
|
681 | * @param time is the time used to date the TC rejection | |
674 | * |
|
682 | * | |
675 | */ |
|
683 | */ | |
676 |
|
684 | |||
677 | housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0]; |
|
685 | housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0]; | |
678 | housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1]; |
|
686 | housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1]; | |
679 | housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00; |
|
687 | housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00; | |
680 | housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType; |
|
688 | housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType; | |
681 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00; |
|
689 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00; | |
682 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType; |
|
690 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType; | |
683 |
housekeeping_packet.hk_lfr_last_rej_tc_time[0] = |
|
691 | housekeeping_packet.hk_lfr_last_rej_tc_time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
684 |
housekeeping_packet.hk_lfr_last_rej_tc_time[1] = |
|
692 | housekeeping_packet.hk_lfr_last_rej_tc_time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
685 |
housekeeping_packet.hk_lfr_last_rej_tc_time[2] = |
|
693 | housekeeping_packet.hk_lfr_last_rej_tc_time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
686 |
housekeeping_packet.hk_lfr_last_rej_tc_time[3] = |
|
694 | housekeeping_packet.hk_lfr_last_rej_tc_time[3] = (unsigned char) (time_management_regs->coarse_time); | |
687 |
housekeeping_packet.hk_lfr_last_rej_tc_time[4] = |
|
695 | housekeeping_packet.hk_lfr_last_rej_tc_time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
688 |
housekeeping_packet.hk_lfr_last_rej_tc_time[5] = |
|
696 | housekeeping_packet.hk_lfr_last_rej_tc_time[5] = (unsigned char) (time_management_regs->fine_time); | |
689 | } |
|
697 | } | |
690 |
|
698 | |||
691 |
void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id |
|
699 | void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id ) | |
692 | { |
|
700 | { | |
693 | /** This function is the last step of the TC execution workflow. |
|
701 | /** This function is the last step of the TC execution workflow. | |
694 | * |
|
702 | * | |
695 | * @param TC points to the TC being processed |
|
703 | * @param TC points to the TC being processed | |
696 | * @param result is the result of the TC execution (LFR_SUCCESSFUL / LFR_DEFAULT) |
|
704 | * @param result is the result of the TC execution (LFR_SUCCESSFUL / LFR_DEFAULT) | |
697 | * @param queue_id is the id of the RTEMS message queue used to send TM packets |
|
705 | * @param queue_id is the id of the RTEMS message queue used to send TM packets | |
698 | * @param time is the time used to date the TC execution |
|
706 | * @param time is the time used to date the TC execution | |
699 | * |
|
707 | * | |
700 | */ |
|
708 | */ | |
701 |
|
709 | |||
702 | unsigned int val = 0; |
|
710 | unsigned int val = 0; | |
703 |
|
711 | |||
704 | if (result == LFR_SUCCESSFUL) |
|
712 | if (result == LFR_SUCCESSFUL) | |
705 | { |
|
713 | { | |
706 | if ( !( (TC->serviceType==TC_TYPE_TIME) && (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) ) |
|
714 | if ( !( (TC->serviceType==TC_TYPE_TIME) && (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) ) | |
707 | && |
|
715 | && | |
708 | !( (TC->serviceType==TC_TYPE_GEN) && (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO)) |
|
716 | !( (TC->serviceType==TC_TYPE_GEN) && (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO)) | |
709 | ) |
|
717 | ) | |
710 | { |
|
718 | { | |
711 |
send_tm_lfr_tc_exe_success( TC, queue_id |
|
719 | send_tm_lfr_tc_exe_success( TC, queue_id ); | |
712 | } |
|
720 | } | |
713 |
update_last_TC_exe( TC |
|
721 | update_last_TC_exe( TC ); | |
714 | val = housekeeping_packet.hk_lfr_exe_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_exe_tc_cnt[1]; |
|
722 | val = housekeeping_packet.hk_lfr_exe_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_exe_tc_cnt[1]; | |
715 | val++; |
|
723 | val++; | |
716 | housekeeping_packet.hk_lfr_exe_tc_cnt[0] = (unsigned char) (val >> 8); |
|
724 | housekeeping_packet.hk_lfr_exe_tc_cnt[0] = (unsigned char) (val >> 8); | |
717 | housekeeping_packet.hk_lfr_exe_tc_cnt[1] = (unsigned char) (val); |
|
725 | housekeeping_packet.hk_lfr_exe_tc_cnt[1] = (unsigned char) (val); | |
718 | } |
|
726 | } | |
719 | else |
|
727 | else | |
720 | { |
|
728 | { | |
721 |
update_last_TC_rej( TC |
|
729 | update_last_TC_rej( TC ); | |
722 | val = housekeeping_packet.hk_lfr_rej_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_rej_tc_cnt[1]; |
|
730 | val = housekeeping_packet.hk_lfr_rej_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_rej_tc_cnt[1]; | |
723 | val++; |
|
731 | val++; | |
724 | housekeeping_packet.hk_lfr_rej_tc_cnt[0] = (unsigned char) (val >> 8); |
|
732 | housekeeping_packet.hk_lfr_rej_tc_cnt[0] = (unsigned char) (val >> 8); | |
725 | housekeeping_packet.hk_lfr_rej_tc_cnt[1] = (unsigned char) (val); |
|
733 | housekeeping_packet.hk_lfr_rej_tc_cnt[1] = (unsigned char) (val); | |
726 | } |
|
734 | } | |
727 | } |
|
735 | } | |
728 |
|
736 | |||
729 | //*************************** |
|
737 | //*************************** | |
730 | // Interrupt Service Routines |
|
738 | // Interrupt Service Routines | |
731 | rtems_isr commutation_isr1( rtems_vector_number vector ) |
|
739 | rtems_isr commutation_isr1( rtems_vector_number vector ) | |
732 | { |
|
740 | { | |
733 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
741 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { | |
734 | printf("In commutation_isr1 *** Error sending event to DUMB\n"); |
|
742 | printf("In commutation_isr1 *** Error sending event to DUMB\n"); | |
735 | } |
|
743 | } | |
736 | } |
|
744 | } | |
737 |
|
745 | |||
738 | rtems_isr commutation_isr2( rtems_vector_number vector ) |
|
746 | rtems_isr commutation_isr2( rtems_vector_number vector ) | |
739 | { |
|
747 | { | |
740 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
748 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { | |
741 | printf("In commutation_isr2 *** Error sending event to DUMB\n"); |
|
749 | printf("In commutation_isr2 *** Error sending event to DUMB\n"); | |
742 | } |
|
750 | } | |
743 | } |
|
751 | } | |
744 |
|
752 | |||
745 | //**************** |
|
753 | //**************** | |
746 | // OTHER FUNCTIONS |
|
754 | // OTHER FUNCTIONS | |
747 | void updateLFRCurrentMode() |
|
755 | void updateLFRCurrentMode() | |
748 | { |
|
756 | { | |
749 | /** This function updates the value of the global variable lfrCurrentMode. |
|
757 | /** This function updates the value of the global variable lfrCurrentMode. | |
750 | * |
|
758 | * | |
751 | * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running. |
|
759 | * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running. | |
752 | * |
|
760 | * | |
753 | */ |
|
761 | */ | |
754 | // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure |
|
762 | // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure | |
755 | lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
763 | lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
756 | } |
|
764 | } | |
757 |
|
765 |
@@ -1,483 +1,539 | |||||
1 | /** Functions to load and dump parameters in the LFR registers. |
|
1 | /** Functions to load and dump parameters in the LFR registers. | |
2 | * |
|
2 | * | |
3 | * @file |
|
3 | * @file | |
4 | * @author P. LEROY |
|
4 | * @author P. LEROY | |
5 | * |
|
5 | * | |
6 | * A group of functions to handle TC related to parameter loading and dumping.\n |
|
6 | * A group of functions to handle TC related to parameter loading and dumping.\n | |
7 | * TC_LFR_LOAD_COMMON_PAR\n |
|
7 | * TC_LFR_LOAD_COMMON_PAR\n | |
8 | * TC_LFR_LOAD_NORMAL_PAR\n |
|
8 | * TC_LFR_LOAD_NORMAL_PAR\n | |
9 | * TC_LFR_LOAD_BURST_PAR\n |
|
9 | * TC_LFR_LOAD_BURST_PAR\n | |
10 | * TC_LFR_LOAD_SBM1_PAR\n |
|
10 | * TC_LFR_LOAD_SBM1_PAR\n | |
11 | * TC_LFR_LOAD_SBM2_PAR\n |
|
11 | * TC_LFR_LOAD_SBM2_PAR\n | |
12 | * |
|
12 | * | |
13 | */ |
|
13 | */ | |
14 |
|
14 | |||
15 | #include "tc_load_dump_parameters.h" |
|
15 | #include "tc_load_dump_parameters.h" | |
16 |
|
16 | |||
17 | int action_load_common_par(ccsdsTelecommandPacket_t *TC) |
|
17 | int action_load_common_par(ccsdsTelecommandPacket_t *TC) | |
18 | { |
|
18 | { | |
19 | /** This function updates the LFR registers with the incoming common parameters. |
|
19 | /** This function updates the LFR registers with the incoming common parameters. | |
20 | * |
|
20 | * | |
21 | * @param TC points to the TeleCommand packet that is being processed |
|
21 | * @param TC points to the TeleCommand packet that is being processed | |
22 | * |
|
22 | * | |
23 | * |
|
23 | * | |
24 | */ |
|
24 | */ | |
25 |
|
25 | |||
26 | parameter_dump_packet.unused0 = TC->dataAndCRC[0]; |
|
26 | parameter_dump_packet.unused0 = TC->dataAndCRC[0]; | |
27 | parameter_dump_packet.bw_sp0_sp1_r0_r1 = TC->dataAndCRC[1]; |
|
27 | parameter_dump_packet.bw_sp0_sp1_r0_r1 = TC->dataAndCRC[1]; | |
28 | set_wfp_data_shaping( ); |
|
28 | set_wfp_data_shaping( ); | |
29 | return LFR_SUCCESSFUL; |
|
29 | return LFR_SUCCESSFUL; | |
30 | } |
|
30 | } | |
31 |
|
31 | |||
32 | int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
32 | int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) | |
33 | { |
|
33 | { | |
34 | /** This function updates the LFR registers with the incoming normal parameters. |
|
34 | /** This function updates the LFR registers with the incoming normal parameters. | |
35 | * |
|
35 | * | |
36 | * @param TC points to the TeleCommand packet that is being processed |
|
36 | * @param TC points to the TeleCommand packet that is being processed | |
37 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
37 | * @param queue_id is the id of the queue which handles TM related to this execution step | |
38 | * |
|
38 | * | |
39 | */ |
|
39 | */ | |
40 |
|
40 | |||
41 | int result; |
|
41 | int result; | |
42 | int flag; |
|
42 | int flag; | |
43 | rtems_status_code status; |
|
43 | rtems_status_code status; | |
44 |
|
44 | |||
45 | flag = LFR_SUCCESSFUL; |
|
45 | flag = LFR_SUCCESSFUL; | |
46 |
|
46 | |||
47 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) || |
|
47 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) || | |
48 | (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) { |
|
48 | (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) { | |
49 |
status = send_tm_lfr_tc_exe_not_executable( TC, queue_id |
|
49 | status = send_tm_lfr_tc_exe_not_executable( TC, queue_id ); | |
50 | flag = LFR_DEFAULT; |
|
50 | flag = LFR_DEFAULT; | |
51 | } |
|
51 | } | |
52 |
|
52 | |||
53 | //*************** |
|
53 | //*************** | |
54 | // sy_lfr_n_swf_l |
|
54 | // sy_lfr_n_swf_l | |
55 | if (flag == LFR_SUCCESSFUL) |
|
55 | if (flag == LFR_SUCCESSFUL) | |
56 | { |
|
56 | { | |
57 | result = set_sy_lfr_n_swf_l( TC, queue_id, time ); |
|
57 | result = set_sy_lfr_n_swf_l( TC, queue_id, time ); | |
58 | if (result != LFR_SUCCESSFUL) |
|
58 | if (result != LFR_SUCCESSFUL) | |
59 | { |
|
59 | { | |
60 | flag = LFR_DEFAULT; |
|
60 | flag = LFR_DEFAULT; | |
61 | } |
|
61 | } | |
62 | } |
|
62 | } | |
63 |
|
63 | |||
64 | //*************** |
|
64 | //*************** | |
65 | // sy_lfr_n_swf_p |
|
65 | // sy_lfr_n_swf_p | |
66 | if (flag == LFR_SUCCESSFUL) |
|
66 | if (flag == LFR_SUCCESSFUL) | |
67 | { |
|
67 | { | |
68 | result = set_sy_lfr_n_swf_p( TC, queue_id, time ); |
|
68 | result = set_sy_lfr_n_swf_p( TC, queue_id, time ); | |
69 | if (result != LFR_SUCCESSFUL) |
|
69 | if (result != LFR_SUCCESSFUL) | |
70 | { |
|
70 | { | |
71 | flag = LFR_DEFAULT; |
|
71 | flag = LFR_DEFAULT; | |
72 | } |
|
72 | } | |
73 | } |
|
73 | } | |
74 |
|
74 | |||
75 | //*************** |
|
75 | //*************** | |
76 | // sy_lfr_n_asm_p |
|
76 | // sy_lfr_n_asm_p | |
77 | if (flag == LFR_SUCCESSFUL) |
|
77 | if (flag == LFR_SUCCESSFUL) | |
78 | { |
|
78 | { | |
79 | result = set_sy_lfr_n_asm_p( TC, queue_id ); |
|
79 | result = set_sy_lfr_n_asm_p( TC, queue_id ); | |
80 | if (result != LFR_SUCCESSFUL) |
|
80 | if (result != LFR_SUCCESSFUL) | |
81 | { |
|
81 | { | |
82 | flag = LFR_DEFAULT; |
|
82 | flag = LFR_DEFAULT; | |
83 | } |
|
83 | } | |
84 | } |
|
84 | } | |
85 |
|
85 | |||
86 | //*************** |
|
86 | //*************** | |
87 | // sy_lfr_n_bp_p0 |
|
87 | // sy_lfr_n_bp_p0 | |
88 | if (flag == LFR_SUCCESSFUL) |
|
88 | if (flag == LFR_SUCCESSFUL) | |
89 | { |
|
89 | { | |
90 | result = set_sy_lfr_n_bp_p0( TC, queue_id ); |
|
90 | result = set_sy_lfr_n_bp_p0( TC, queue_id ); | |
91 | if (result != LFR_SUCCESSFUL) |
|
91 | if (result != LFR_SUCCESSFUL) | |
92 | { |
|
92 | { | |
93 | flag = LFR_DEFAULT; |
|
93 | flag = LFR_DEFAULT; | |
94 | } |
|
94 | } | |
95 | } |
|
95 | } | |
96 |
|
96 | |||
97 | //*************** |
|
97 | //*************** | |
98 | // sy_lfr_n_bp_p1 |
|
98 | // sy_lfr_n_bp_p1 | |
99 | if (flag == LFR_SUCCESSFUL) |
|
99 | if (flag == LFR_SUCCESSFUL) | |
100 | { |
|
100 | { | |
101 | result = set_sy_lfr_n_bp_p1( TC, queue_id ); |
|
101 | result = set_sy_lfr_n_bp_p1( TC, queue_id ); | |
102 | if (result != LFR_SUCCESSFUL) |
|
102 | if (result != LFR_SUCCESSFUL) | |
103 | { |
|
103 | { | |
104 | flag = LFR_DEFAULT; |
|
104 | flag = LFR_DEFAULT; | |
105 | } |
|
105 | } | |
106 | } |
|
106 | } | |
107 |
|
107 | |||
108 | //********************* |
|
108 | //********************* | |
109 | // sy_lfr_n_cwf_long_f3 |
|
109 | // sy_lfr_n_cwf_long_f3 | |
110 | if (flag == LFR_SUCCESSFUL) |
|
110 | if (flag == LFR_SUCCESSFUL) | |
111 | { |
|
111 | { | |
112 | result = set_sy_lfr_n_cwf_long_f3( TC, queue_id ); |
|
112 | result = set_sy_lfr_n_cwf_long_f3( TC, queue_id ); | |
113 | if (result != LFR_SUCCESSFUL) |
|
113 | if (result != LFR_SUCCESSFUL) | |
114 | { |
|
114 | { | |
115 | flag = LFR_DEFAULT; |
|
115 | flag = LFR_DEFAULT; | |
116 | } |
|
116 | } | |
117 | } |
|
117 | } | |
118 |
|
118 | |||
119 | return flag; |
|
119 | return flag; | |
120 | } |
|
120 | } | |
121 |
|
121 | |||
122 | int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
122 | int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) | |
123 | { |
|
123 | { | |
124 | /** This function updates the LFR registers with the incoming burst parameters. |
|
124 | /** This function updates the LFR registers with the incoming burst parameters. | |
125 | * |
|
125 | * | |
126 | * @param TC points to the TeleCommand packet that is being processed |
|
126 | * @param TC points to the TeleCommand packet that is being processed | |
127 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
127 | * @param queue_id is the id of the queue which handles TM related to this execution step | |
128 | * |
|
128 | * | |
129 | */ |
|
129 | */ | |
130 |
|
130 | |||
131 | int result; |
|
131 | int result; | |
132 | unsigned char lfrMode; |
|
132 | unsigned char lfrMode; | |
133 | rtems_status_code status; |
|
133 | rtems_status_code status; | |
134 |
|
134 | |||
135 | result = LFR_DEFAULT; |
|
135 | result = LFR_DEFAULT; | |
136 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
136 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
137 |
|
137 | |||
138 | if ( lfrMode == LFR_MODE_BURST ) { |
|
138 | if ( lfrMode == LFR_MODE_BURST ) { | |
139 |
status = send_tm_lfr_tc_exe_not_executable( TC, queue_id |
|
139 | status = send_tm_lfr_tc_exe_not_executable( TC, queue_id ); | |
140 | result = LFR_DEFAULT; |
|
140 | result = LFR_DEFAULT; | |
141 | } |
|
141 | } | |
142 | else { |
|
142 | else { | |
143 | parameter_dump_packet.sy_lfr_b_bp_p0 = TC->dataAndCRC[0]; |
|
143 | parameter_dump_packet.sy_lfr_b_bp_p0 = TC->dataAndCRC[0]; | |
144 | parameter_dump_packet.sy_lfr_b_bp_p1 = TC->dataAndCRC[1]; |
|
144 | parameter_dump_packet.sy_lfr_b_bp_p1 = TC->dataAndCRC[1]; | |
145 |
|
145 | |||
146 | result = LFR_SUCCESSFUL; |
|
146 | result = LFR_SUCCESSFUL; | |
147 | } |
|
147 | } | |
148 |
|
148 | |||
149 | return result; |
|
149 | return result; | |
150 | } |
|
150 | } | |
151 |
|
151 | |||
152 | int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
152 | int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) | |
153 | { |
|
153 | { | |
154 | /** This function updates the LFR registers with the incoming sbm1 parameters. |
|
154 | /** This function updates the LFR registers with the incoming sbm1 parameters. | |
155 | * |
|
155 | * | |
156 | * @param TC points to the TeleCommand packet that is being processed |
|
156 | * @param TC points to the TeleCommand packet that is being processed | |
157 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
157 | * @param queue_id is the id of the queue which handles TM related to this execution step | |
158 | * |
|
158 | * | |
159 | */ |
|
159 | */ | |
160 | int result; |
|
160 | int result; | |
161 | unsigned char lfrMode; |
|
161 | unsigned char lfrMode; | |
162 | rtems_status_code status; |
|
162 | rtems_status_code status; | |
163 |
|
163 | |||
164 | result = LFR_DEFAULT; |
|
164 | result = LFR_DEFAULT; | |
165 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
165 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
166 |
|
166 | |||
167 | if ( (lfrMode == LFR_MODE_SBM1) || (lfrMode == LFR_MODE_SBM2) ) { |
|
167 | if ( (lfrMode == LFR_MODE_SBM1) || (lfrMode == LFR_MODE_SBM2) ) { | |
168 |
status = send_tm_lfr_tc_exe_not_executable( TC, queue_id |
|
168 | status = send_tm_lfr_tc_exe_not_executable( TC, queue_id ); | |
169 | result = LFR_DEFAULT; |
|
169 | result = LFR_DEFAULT; | |
170 | } |
|
170 | } | |
171 | else { |
|
171 | else { | |
172 | parameter_dump_packet.sy_lfr_s1_bp_p0 = TC->dataAndCRC[0]; |
|
172 | parameter_dump_packet.sy_lfr_s1_bp_p0 = TC->dataAndCRC[0]; | |
173 | parameter_dump_packet.sy_lfr_s1_bp_p1 = TC->dataAndCRC[1]; |
|
173 | parameter_dump_packet.sy_lfr_s1_bp_p1 = TC->dataAndCRC[1]; | |
174 |
|
174 | |||
175 | result = LFR_SUCCESSFUL; |
|
175 | result = LFR_SUCCESSFUL; | |
176 | } |
|
176 | } | |
177 |
|
177 | |||
178 | return result; |
|
178 | return result; | |
179 | } |
|
179 | } | |
180 |
|
180 | |||
181 | int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
181 | int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) | |
182 | { |
|
182 | { | |
183 | /** This function updates the LFR registers with the incoming sbm2 parameters. |
|
183 | /** This function updates the LFR registers with the incoming sbm2 parameters. | |
184 | * |
|
184 | * | |
185 | * @param TC points to the TeleCommand packet that is being processed |
|
185 | * @param TC points to the TeleCommand packet that is being processed | |
186 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
186 | * @param queue_id is the id of the queue which handles TM related to this execution step | |
187 | * |
|
187 | * | |
188 | */ |
|
188 | */ | |
189 |
|
189 | |||
190 | int result; |
|
190 | int result; | |
191 | unsigned char lfrMode; |
|
191 | unsigned char lfrMode; | |
192 | rtems_status_code status; |
|
192 | rtems_status_code status; | |
193 |
|
193 | |||
194 | result = LFR_DEFAULT; |
|
194 | result = LFR_DEFAULT; | |
195 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
195 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
196 |
|
196 | |||
197 |
if ( (lfrMode == LFR_MODE_SBM |
|
197 | if ( (lfrMode == LFR_MODE_SBM1) || (lfrMode == LFR_MODE_SBM2) ) { | |
198 |
status = send_tm_lfr_tc_exe_not_executable( TC, queue_id |
|
198 | status = send_tm_lfr_tc_exe_not_executable( TC, queue_id ); | |
199 | result = LFR_DEFAULT; |
|
199 | result = LFR_DEFAULT; | |
200 | } |
|
200 | } | |
201 | else { |
|
201 | else { | |
202 | parameter_dump_packet.sy_lfr_s2_bp_p0 = TC->dataAndCRC[0]; |
|
202 | parameter_dump_packet.sy_lfr_s2_bp_p0 = TC->dataAndCRC[0]; | |
203 | parameter_dump_packet.sy_lfr_s2_bp_p1 = TC->dataAndCRC[1]; |
|
203 | parameter_dump_packet.sy_lfr_s2_bp_p1 = TC->dataAndCRC[1]; | |
204 |
|
204 | |||
205 | result = LFR_SUCCESSFUL; |
|
205 | result = LFR_SUCCESSFUL; | |
206 | } |
|
206 | } | |
207 |
|
207 | |||
208 | return result; |
|
208 | return result; | |
209 | } |
|
209 | } | |
210 |
|
210 | |||
211 | int action_dump_par( rtems_id queue_id ) |
|
211 | int action_dump_par( rtems_id queue_id ) | |
212 | { |
|
212 | { | |
213 | /** This function dumps the LFR parameters by sending the appropriate TM packet to the dedicated RTEMS message queue. |
|
213 | /** This function dumps the LFR parameters by sending the appropriate TM packet to the dedicated RTEMS message queue. | |
214 | * |
|
214 | * | |
215 | * @param queue_id is the id of the queue which handles TM related to this execution step. |
|
215 | * @param queue_id is the id of the queue which handles TM related to this execution step. | |
216 | * |
|
216 | * | |
217 | * @return RTEMS directive status codes: |
|
217 | * @return RTEMS directive status codes: | |
218 | * - RTEMS_SUCCESSFUL - message sent successfully |
|
218 | * - RTEMS_SUCCESSFUL - message sent successfully | |
219 | * - RTEMS_INVALID_ID - invalid queue id |
|
219 | * - RTEMS_INVALID_ID - invalid queue id | |
220 | * - RTEMS_INVALID_SIZE - invalid message size |
|
220 | * - RTEMS_INVALID_SIZE - invalid message size | |
221 | * - RTEMS_INVALID_ADDRESS - buffer is NULL |
|
221 | * - RTEMS_INVALID_ADDRESS - buffer is NULL | |
222 | * - RTEMS_UNSATISFIED - out of message buffers |
|
222 | * - RTEMS_UNSATISFIED - out of message buffers | |
223 | * - RTEMS_TOO_MANY - queue s limit has been reached |
|
223 | * - RTEMS_TOO_MANY - queue s limit has been reached | |
224 | * |
|
224 | * | |
225 | */ |
|
225 | */ | |
226 |
|
226 | |||
227 | int status; |
|
227 | int status; | |
228 |
|
228 | |||
229 | // UPDATE TIME |
|
229 | // UPDATE TIME | |
230 | increment_seq_counter( parameter_dump_packet.packetSequenceControl ); |
|
230 | increment_seq_counter( parameter_dump_packet.packetSequenceControl ); | |
231 | parameter_dump_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
231 | parameter_dump_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
232 | parameter_dump_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
232 | parameter_dump_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
233 | parameter_dump_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
233 | parameter_dump_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
234 | parameter_dump_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
234 | parameter_dump_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); | |
235 | parameter_dump_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
235 | parameter_dump_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
236 | parameter_dump_packet.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
236 | parameter_dump_packet.time[5] = (unsigned char) (time_management_regs->fine_time); | |
237 | // SEND DATA |
|
237 | // SEND DATA | |
238 | status = rtems_message_queue_send( queue_id, ¶meter_dump_packet, |
|
238 | status = rtems_message_queue_send( queue_id, ¶meter_dump_packet, | |
239 | PACKET_LENGTH_PARAMETER_DUMP + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES); |
|
239 | PACKET_LENGTH_PARAMETER_DUMP + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES); | |
240 | if (status != RTEMS_SUCCESSFUL) { |
|
240 | if (status != RTEMS_SUCCESSFUL) { | |
241 | PRINTF1("in action_dump *** ERR sending packet, code %d", status) |
|
241 | PRINTF1("in action_dump *** ERR sending packet, code %d", status) | |
242 | } |
|
242 | } | |
243 |
|
243 | |||
244 | return status; |
|
244 | return status; | |
245 | } |
|
245 | } | |
246 |
|
246 | |||
247 | //*********************** |
|
247 | //*********************** | |
248 | // NORMAL MODE PARAMETERS |
|
248 | // NORMAL MODE PARAMETERS | |
249 |
|
249 | |||
250 | int set_sy_lfr_n_swf_l( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time ) |
|
250 | int set_sy_lfr_n_swf_l( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time ) | |
251 | { |
|
251 | { | |
252 | /** This function sets the number of points of a snapshot (sy_lfr_n_swf_l). |
|
252 | /** This function sets the number of points of a snapshot (sy_lfr_n_swf_l). | |
253 | * |
|
253 | * | |
254 | * @param TC points to the TeleCommand packet that is being processed |
|
254 | * @param TC points to the TeleCommand packet that is being processed | |
255 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
255 | * @param queue_id is the id of the queue which handles TM related to this execution step | |
256 | * |
|
256 | * | |
257 | */ |
|
257 | */ | |
258 |
|
258 | |||
259 | unsigned int tmp; |
|
259 | unsigned int tmp; | |
260 | int result; |
|
260 | int result; | |
261 | unsigned char msb; |
|
261 | unsigned char msb; | |
262 | unsigned char lsb; |
|
262 | unsigned char lsb; | |
263 | rtems_status_code status; |
|
263 | rtems_status_code status; | |
264 |
|
264 | |||
265 | msb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_L ]; |
|
265 | msb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_L ]; | |
266 | lsb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_L+1 ]; |
|
266 | lsb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_L+1 ]; | |
267 |
|
267 | |||
268 | tmp = ( unsigned int ) floor( |
|
268 | tmp = ( unsigned int ) floor( | |
269 | ( ( msb*256 ) + lsb ) / 16 |
|
269 | ( ( msb*256 ) + lsb ) / 16 | |
270 | ) * 16; |
|
270 | ) * 16; | |
271 |
|
271 | |||
272 | if ( (tmp < 16) || (tmp > 2048) ) // the snapshot period is a multiple of 16 |
|
272 | if ( (tmp < 16) || (tmp > 2048) ) // the snapshot period is a multiple of 16 | |
273 | { // 2048 is the maximum limit due to the size of the buffers |
|
273 | { // 2048 is the maximum limit due to the size of the buffers | |
274 |
status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_SY_LFR_N_SWF_L+10, lsb |
|
274 | status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_SY_LFR_N_SWF_L+10, lsb ); | |
275 | result = WRONG_APP_DATA; |
|
275 | result = WRONG_APP_DATA; | |
276 | } |
|
276 | } | |
277 | else if (tmp != 2048) |
|
277 | else if (tmp != 2048) | |
278 | { |
|
278 | { | |
279 | status = send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); |
|
279 | status = send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); | |
280 | result = FUNCT_NOT_IMPL; |
|
280 | result = FUNCT_NOT_IMPL; | |
281 | } |
|
281 | } | |
282 | else |
|
282 | else | |
283 | { |
|
283 | { | |
284 | parameter_dump_packet.sy_lfr_n_swf_l[0] = (unsigned char) (tmp >> 8); |
|
284 | parameter_dump_packet.sy_lfr_n_swf_l[0] = (unsigned char) (tmp >> 8); | |
285 | parameter_dump_packet.sy_lfr_n_swf_l[1] = (unsigned char) (tmp ); |
|
285 | parameter_dump_packet.sy_lfr_n_swf_l[1] = (unsigned char) (tmp ); | |
286 | result = LFR_SUCCESSFUL; |
|
286 | result = LFR_SUCCESSFUL; | |
287 | } |
|
287 | } | |
288 |
|
288 | |||
289 | return result; |
|
289 | return result; | |
290 | } |
|
290 | } | |
291 |
|
291 | |||
292 | int set_sy_lfr_n_swf_p(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time) |
|
292 | int set_sy_lfr_n_swf_p(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time) | |
293 | { |
|
293 | { | |
294 | /** This function sets the time between two snapshots, in s (sy_lfr_n_swf_p). |
|
294 | /** This function sets the time between two snapshots, in s (sy_lfr_n_swf_p). | |
295 | * |
|
295 | * | |
296 | * @param TC points to the TeleCommand packet that is being processed |
|
296 | * @param TC points to the TeleCommand packet that is being processed | |
297 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
297 | * @param queue_id is the id of the queue which handles TM related to this execution step | |
298 | * |
|
298 | * | |
299 | */ |
|
299 | */ | |
300 |
|
300 | |||
301 | unsigned int tmp; |
|
301 | unsigned int tmp; | |
302 | int result; |
|
302 | int result; | |
303 | unsigned char msb; |
|
303 | unsigned char msb; | |
304 | unsigned char lsb; |
|
304 | unsigned char lsb; | |
305 | rtems_status_code status; |
|
305 | rtems_status_code status; | |
306 |
|
306 | |||
307 | msb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_P ]; |
|
307 | msb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_P ]; | |
308 | lsb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_P+1 ]; |
|
308 | lsb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_P+1 ]; | |
309 |
|
309 | |||
310 | tmp = msb * 256 + lsb; |
|
310 | tmp = msb * 256 + lsb; | |
311 |
|
311 | |||
312 | if ( tmp < 16 ) |
|
312 | if ( tmp < 16 ) | |
313 | { |
|
313 | { | |
314 |
status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_SY_LFR_N_SWF_P+10, lsb |
|
314 | status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_SY_LFR_N_SWF_P+10, lsb ); | |
315 | result = WRONG_APP_DATA; |
|
315 | result = WRONG_APP_DATA; | |
316 | } |
|
316 | } | |
317 | else |
|
317 | else | |
318 | { |
|
318 | { | |
319 | parameter_dump_packet.sy_lfr_n_swf_p[0] = (unsigned char) (tmp >> 8); |
|
319 | parameter_dump_packet.sy_lfr_n_swf_p[0] = (unsigned char) (tmp >> 8); | |
320 | parameter_dump_packet.sy_lfr_n_swf_p[1] = (unsigned char) (tmp ); |
|
320 | parameter_dump_packet.sy_lfr_n_swf_p[1] = (unsigned char) (tmp ); | |
321 | result = LFR_SUCCESSFUL; |
|
321 | result = LFR_SUCCESSFUL; | |
322 | } |
|
322 | } | |
323 |
|
323 | |||
324 | return result; |
|
324 | return result; | |
325 | } |
|
325 | } | |
326 |
|
326 | |||
327 | int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) |
|
327 | int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) | |
328 | { |
|
328 | { | |
329 | /** This function sets the time between two full spectral matrices transmission, in s (SY_LFR_N_ASM_P). |
|
329 | /** This function sets the time between two full spectral matrices transmission, in s (SY_LFR_N_ASM_P). | |
330 | * |
|
330 | * | |
331 | * @param TC points to the TeleCommand packet that is being processed |
|
331 | * @param TC points to the TeleCommand packet that is being processed | |
332 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
332 | * @param queue_id is the id of the queue which handles TM related to this execution step | |
333 | * |
|
333 | * | |
334 | */ |
|
334 | */ | |
335 |
|
335 | |||
336 | int result; |
|
336 | int result; | |
337 | unsigned char msb; |
|
337 | unsigned char msb; | |
338 | unsigned char lsb; |
|
338 | unsigned char lsb; | |
339 |
|
339 | |||
340 | msb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_ASM_P ]; |
|
340 | msb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_ASM_P ]; | |
341 | lsb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_ASM_P+1 ]; |
|
341 | lsb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_ASM_P+1 ]; | |
342 |
|
342 | |||
343 | parameter_dump_packet.sy_lfr_n_asm_p[0] = msb; |
|
343 | parameter_dump_packet.sy_lfr_n_asm_p[0] = msb; | |
344 | parameter_dump_packet.sy_lfr_n_asm_p[1] = lsb; |
|
344 | parameter_dump_packet.sy_lfr_n_asm_p[1] = lsb; | |
345 | result = LFR_SUCCESSFUL; |
|
345 | result = LFR_SUCCESSFUL; | |
346 |
|
346 | |||
347 | return result; |
|
347 | return result; | |
348 | } |
|
348 | } | |
349 |
|
349 | |||
350 | int set_sy_lfr_n_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) |
|
350 | int set_sy_lfr_n_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) | |
351 | { |
|
351 | { | |
352 | /** This function sets the time between two basic parameter sets, in s (SY_LFR_N_BP_P0). |
|
352 | /** This function sets the time between two basic parameter sets, in s (SY_LFR_N_BP_P0). | |
353 | * |
|
353 | * | |
354 | * @param TC points to the TeleCommand packet that is being processed |
|
354 | * @param TC points to the TeleCommand packet that is being processed | |
355 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
355 | * @param queue_id is the id of the queue which handles TM related to this execution step | |
356 | * |
|
356 | * | |
357 | */ |
|
357 | */ | |
358 |
|
358 | |||
359 | int status; |
|
359 | int status; | |
360 |
|
360 | |||
361 | status = LFR_SUCCESSFUL; |
|
361 | status = LFR_SUCCESSFUL; | |
362 |
|
362 | |||
363 | parameter_dump_packet.sy_lfr_n_bp_p0 = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_BP_P0 ]; |
|
363 | parameter_dump_packet.sy_lfr_n_bp_p0 = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_BP_P0 ]; | |
364 |
|
364 | |||
365 | return status; |
|
365 | return status; | |
366 | } |
|
366 | } | |
367 |
|
367 | |||
368 | int set_sy_lfr_n_bp_p1(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
368 | int set_sy_lfr_n_bp_p1(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) | |
369 | { |
|
369 | { | |
370 | /** This function sets the time between two basic parameter sets (autocorrelation + crosscorrelation), in s (sy_lfr_n_bp_p1). |
|
370 | /** This function sets the time between two basic parameter sets (autocorrelation + crosscorrelation), in s (sy_lfr_n_bp_p1). | |
371 | * |
|
371 | * | |
372 | * @param TC points to the TeleCommand packet that is being processed |
|
372 | * @param TC points to the TeleCommand packet that is being processed | |
373 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
373 | * @param queue_id is the id of the queue which handles TM related to this execution step | |
374 | * |
|
374 | * | |
375 | */ |
|
375 | */ | |
376 |
|
376 | |||
377 | int status; |
|
377 | int status; | |
378 |
|
378 | |||
379 | status = LFR_SUCCESSFUL; |
|
379 | status = LFR_SUCCESSFUL; | |
380 |
|
380 | |||
381 | parameter_dump_packet.sy_lfr_n_bp_p1 = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_BP_P1 ]; |
|
381 | parameter_dump_packet.sy_lfr_n_bp_p1 = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_BP_P1 ]; | |
382 |
|
382 | |||
383 | return status; |
|
383 | return status; | |
384 | } |
|
384 | } | |
385 |
|
385 | |||
386 | int set_sy_lfr_n_cwf_long_f3(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
386 | int set_sy_lfr_n_cwf_long_f3(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) | |
387 | { |
|
387 | { | |
388 | /** This function allows to switch from CWF_F3 packets to CWF_LONG_F3 packets. |
|
388 | /** This function allows to switch from CWF_F3 packets to CWF_LONG_F3 packets. | |
389 | * |
|
389 | * | |
390 | * @param TC points to the TeleCommand packet that is being processed |
|
390 | * @param TC points to the TeleCommand packet that is being processed | |
391 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
391 | * @param queue_id is the id of the queue which handles TM related to this execution step | |
392 | * |
|
392 | * | |
393 | */ |
|
393 | */ | |
394 |
|
394 | |||
395 | int status; |
|
395 | int status; | |
396 |
|
396 | |||
397 | status = LFR_SUCCESSFUL; |
|
397 | status = LFR_SUCCESSFUL; | |
398 |
|
398 | |||
399 | parameter_dump_packet.sy_lfr_n_cwf_long_f3 = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_CWF_LONG_F3 ]; |
|
399 | parameter_dump_packet.sy_lfr_n_cwf_long_f3 = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_CWF_LONG_F3 ]; | |
400 |
|
400 | |||
401 | return status; |
|
401 | return status; | |
402 | } |
|
402 | } | |
403 |
|
403 | |||
404 | //********************** |
|
404 | //********************** | |
405 | // BURST MODE PARAMETERS |
|
405 | // BURST MODE PARAMETERS | |
406 |
|
406 | |||
407 | //********************* |
|
407 | //********************* | |
408 | // SBM1 MODE PARAMETERS |
|
408 | // SBM1 MODE PARAMETERS | |
409 |
|
409 | |||
410 | //********************* |
|
410 | //********************* | |
411 | // SBM2 MODE PARAMETERS |
|
411 | // SBM2 MODE PARAMETERS | |
412 |
|
412 | |||
|
413 | //******************* | |||
|
414 | // TC_LFR_UPDATE_INFO | |||
|
415 | unsigned int check_update_info_hk_lfr_mode( unsigned char mode ) | |||
|
416 | { | |||
|
417 | unsigned int status; | |||
|
418 | ||||
|
419 | if ( (mode == LFR_MODE_STANDBY) || (mode == LFR_MODE_NORMAL) | |||
|
420 | || (mode = LFR_MODE_BURST) | |||
|
421 | || (mode == LFR_MODE_SBM1) || (mode == LFR_MODE_SBM2)) | |||
|
422 | { | |||
|
423 | status = LFR_SUCCESSFUL; | |||
|
424 | } | |||
|
425 | else | |||
|
426 | { | |||
|
427 | status = LFR_DEFAULT; | |||
|
428 | } | |||
|
429 | ||||
|
430 | return status; | |||
|
431 | } | |||
|
432 | ||||
|
433 | unsigned int check_update_info_hk_tds_mode( unsigned char mode ) | |||
|
434 | { | |||
|
435 | unsigned int status; | |||
|
436 | ||||
|
437 | if ( (mode == TDS_MODE_STANDBY) || (mode == TDS_MODE_NORMAL) | |||
|
438 | || (mode = TDS_MODE_BURST) | |||
|
439 | || (mode == TDS_MODE_SBM1) || (mode == TDS_MODE_SBM2) | |||
|
440 | || (mode == TDS_MODE_LFM)) | |||
|
441 | { | |||
|
442 | status = LFR_SUCCESSFUL; | |||
|
443 | } | |||
|
444 | else | |||
|
445 | { | |||
|
446 | status = LFR_DEFAULT; | |||
|
447 | } | |||
|
448 | ||||
|
449 | return status; | |||
|
450 | } | |||
|
451 | ||||
|
452 | unsigned int check_update_info_hk_thr_mode( unsigned char mode ) | |||
|
453 | { | |||
|
454 | unsigned int status; | |||
|
455 | ||||
|
456 | if ( (mode == THR_MODE_STANDBY) || (mode == THR_MODE_NORMAL) | |||
|
457 | || (mode = THR_MODE_BURST)) | |||
|
458 | { | |||
|
459 | status = LFR_SUCCESSFUL; | |||
|
460 | } | |||
|
461 | else | |||
|
462 | { | |||
|
463 | status = LFR_DEFAULT; | |||
|
464 | } | |||
|
465 | ||||
|
466 | return status; | |||
|
467 | } | |||
|
468 | ||||
413 | //********** |
|
469 | //********** | |
414 | // init dump |
|
470 | // init dump | |
415 |
|
471 | |||
416 | void init_parameter_dump( void ) |
|
472 | void init_parameter_dump( void ) | |
417 | { |
|
473 | { | |
418 | /** This function initialize the parameter_dump_packet global variable with default values. |
|
474 | /** This function initialize the parameter_dump_packet global variable with default values. | |
419 | * |
|
475 | * | |
420 | */ |
|
476 | */ | |
421 |
|
477 | |||
422 | parameter_dump_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
478 | parameter_dump_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; | |
423 | parameter_dump_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
479 | parameter_dump_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
424 | parameter_dump_packet.reserved = CCSDS_RESERVED; |
|
480 | parameter_dump_packet.reserved = CCSDS_RESERVED; | |
425 | parameter_dump_packet.userApplication = CCSDS_USER_APP; |
|
481 | parameter_dump_packet.userApplication = CCSDS_USER_APP; | |
426 | parameter_dump_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_PARAMETER_DUMP >> 8); |
|
482 | parameter_dump_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_PARAMETER_DUMP >> 8); | |
427 | parameter_dump_packet.packetID[1] = (unsigned char) TM_PACKET_ID_PARAMETER_DUMP; |
|
483 | parameter_dump_packet.packetID[1] = (unsigned char) TM_PACKET_ID_PARAMETER_DUMP; | |
428 | parameter_dump_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
484 | parameter_dump_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
429 | parameter_dump_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
485 | parameter_dump_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
430 | parameter_dump_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_PARAMETER_DUMP >> 8); |
|
486 | parameter_dump_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_PARAMETER_DUMP >> 8); | |
431 | parameter_dump_packet.packetLength[1] = (unsigned char) PACKET_LENGTH_PARAMETER_DUMP; |
|
487 | parameter_dump_packet.packetLength[1] = (unsigned char) PACKET_LENGTH_PARAMETER_DUMP; | |
432 | // DATA FIELD HEADER |
|
488 | // DATA FIELD HEADER | |
433 | parameter_dump_packet.spare1_pusVersion_spare2 = SPARE1_PUSVERSION_SPARE2; |
|
489 | parameter_dump_packet.spare1_pusVersion_spare2 = SPARE1_PUSVERSION_SPARE2; | |
434 | parameter_dump_packet.serviceType = TM_TYPE_PARAMETER_DUMP; |
|
490 | parameter_dump_packet.serviceType = TM_TYPE_PARAMETER_DUMP; | |
435 | parameter_dump_packet.serviceSubType = TM_SUBTYPE_PARAMETER_DUMP; |
|
491 | parameter_dump_packet.serviceSubType = TM_SUBTYPE_PARAMETER_DUMP; | |
436 | parameter_dump_packet.destinationID = TM_DESTINATION_ID_GROUND; |
|
492 | parameter_dump_packet.destinationID = TM_DESTINATION_ID_GROUND; | |
437 | parameter_dump_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
493 | parameter_dump_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
438 | parameter_dump_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
494 | parameter_dump_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
439 | parameter_dump_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
495 | parameter_dump_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
440 | parameter_dump_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
496 | parameter_dump_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); | |
441 | parameter_dump_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
497 | parameter_dump_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
442 | parameter_dump_packet.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
498 | parameter_dump_packet.time[5] = (unsigned char) (time_management_regs->fine_time); | |
443 | parameter_dump_packet.sid = SID_PARAMETER_DUMP; |
|
499 | parameter_dump_packet.sid = SID_PARAMETER_DUMP; | |
444 |
|
500 | |||
445 | //****************** |
|
501 | //****************** | |
446 | // COMMON PARAMETERS |
|
502 | // COMMON PARAMETERS | |
447 | parameter_dump_packet.unused0 = DEFAULT_SY_LFR_COMMON0; |
|
503 | parameter_dump_packet.unused0 = DEFAULT_SY_LFR_COMMON0; | |
448 | parameter_dump_packet.bw_sp0_sp1_r0_r1 = DEFAULT_SY_LFR_COMMON1; |
|
504 | parameter_dump_packet.bw_sp0_sp1_r0_r1 = DEFAULT_SY_LFR_COMMON1; | |
449 |
|
505 | |||
450 | //****************** |
|
506 | //****************** | |
451 | // NORMAL PARAMETERS |
|
507 | // NORMAL PARAMETERS | |
452 | parameter_dump_packet.sy_lfr_n_swf_l[0] = (unsigned char) (SY_LFR_N_SWF_L >> 8); |
|
508 | parameter_dump_packet.sy_lfr_n_swf_l[0] = (unsigned char) (SY_LFR_N_SWF_L >> 8); | |
453 | parameter_dump_packet.sy_lfr_n_swf_l[1] = (unsigned char) (SY_LFR_N_SWF_L ); |
|
509 | parameter_dump_packet.sy_lfr_n_swf_l[1] = (unsigned char) (SY_LFR_N_SWF_L ); | |
454 | parameter_dump_packet.sy_lfr_n_swf_p[0] = (unsigned char) (SY_LFR_N_SWF_P >> 8); |
|
510 | parameter_dump_packet.sy_lfr_n_swf_p[0] = (unsigned char) (SY_LFR_N_SWF_P >> 8); | |
455 | parameter_dump_packet.sy_lfr_n_swf_p[1] = (unsigned char) (SY_LFR_N_SWF_P ); |
|
511 | parameter_dump_packet.sy_lfr_n_swf_p[1] = (unsigned char) (SY_LFR_N_SWF_P ); | |
456 | parameter_dump_packet.sy_lfr_n_asm_p[0] = (unsigned char) (SY_LFR_N_ASM_P >> 8); |
|
512 | parameter_dump_packet.sy_lfr_n_asm_p[0] = (unsigned char) (SY_LFR_N_ASM_P >> 8); | |
457 | parameter_dump_packet.sy_lfr_n_asm_p[1] = (unsigned char) (SY_LFR_N_ASM_P ); |
|
513 | parameter_dump_packet.sy_lfr_n_asm_p[1] = (unsigned char) (SY_LFR_N_ASM_P ); | |
458 | parameter_dump_packet.sy_lfr_n_bp_p0 = (unsigned char) SY_LFR_N_BP_P0; |
|
514 | parameter_dump_packet.sy_lfr_n_bp_p0 = (unsigned char) SY_LFR_N_BP_P0; | |
459 | parameter_dump_packet.sy_lfr_n_bp_p1 = (unsigned char) SY_LFR_N_BP_P1; |
|
515 | parameter_dump_packet.sy_lfr_n_bp_p1 = (unsigned char) SY_LFR_N_BP_P1; | |
460 | parameter_dump_packet.sy_lfr_n_cwf_long_f3 = (unsigned char) SY_LFR_N_CWF_LONG_F3; |
|
516 | parameter_dump_packet.sy_lfr_n_cwf_long_f3 = (unsigned char) SY_LFR_N_CWF_LONG_F3; | |
461 |
|
517 | |||
462 | //***************** |
|
518 | //***************** | |
463 | // BURST PARAMETERS |
|
519 | // BURST PARAMETERS | |
464 | parameter_dump_packet.sy_lfr_b_bp_p0 = (unsigned char) DEFAULT_SY_LFR_B_BP_P0; |
|
520 | parameter_dump_packet.sy_lfr_b_bp_p0 = (unsigned char) DEFAULT_SY_LFR_B_BP_P0; | |
465 | parameter_dump_packet.sy_lfr_b_bp_p1 = (unsigned char) DEFAULT_SY_LFR_B_BP_P1; |
|
521 | parameter_dump_packet.sy_lfr_b_bp_p1 = (unsigned char) DEFAULT_SY_LFR_B_BP_P1; | |
466 |
|
522 | |||
467 | //**************** |
|
523 | //**************** | |
468 | // SBM1 PARAMETERS |
|
524 | // SBM1 PARAMETERS | |
469 | parameter_dump_packet.sy_lfr_s1_bp_p0 = (unsigned char) DEFAULT_SY_LFR_S1_BP_P0; // min value is 0.25 s for the period |
|
525 | parameter_dump_packet.sy_lfr_s1_bp_p0 = (unsigned char) DEFAULT_SY_LFR_S1_BP_P0; // min value is 0.25 s for the period | |
470 | parameter_dump_packet.sy_lfr_s1_bp_p1 = (unsigned char) DEFAULT_SY_LFR_S1_BP_P1; |
|
526 | parameter_dump_packet.sy_lfr_s1_bp_p1 = (unsigned char) DEFAULT_SY_LFR_S1_BP_P1; | |
471 |
|
527 | |||
472 | //**************** |
|
528 | //**************** | |
473 | // SBM2 PARAMETERS |
|
529 | // SBM2 PARAMETERS | |
474 | parameter_dump_packet.sy_lfr_s2_bp_p0 = (unsigned char) DEFAULT_SY_LFR_S2_BP_P0; |
|
530 | parameter_dump_packet.sy_lfr_s2_bp_p0 = (unsigned char) DEFAULT_SY_LFR_S2_BP_P0; | |
475 | parameter_dump_packet.sy_lfr_s2_bp_p1 = (unsigned char) DEFAULT_SY_LFR_S2_BP_P1; |
|
531 | parameter_dump_packet.sy_lfr_s2_bp_p1 = (unsigned char) DEFAULT_SY_LFR_S2_BP_P1; | |
476 | } |
|
532 | } | |
477 |
|
533 | |||
478 |
|
534 | |||
479 |
|
535 | |||
480 |
|
536 | |||
481 |
|
537 | |||
482 |
|
538 | |||
483 |
|
539 |
@@ -1,494 +1,493 | |||||
1 | /** Functions to send TM packets related to TC parsing and execution. |
|
1 | /** Functions to send TM packets related to TC parsing and execution. | |
2 | * |
|
2 | * | |
3 | * @file |
|
3 | * @file | |
4 | * @author P. LEROY |
|
4 | * @author P. LEROY | |
5 | * |
|
5 | * | |
6 | * A group of functions to send appropriate TM packets after parsing and execution: |
|
6 | * A group of functions to send appropriate TM packets after parsing and execution: | |
7 | * - TM_LFR_TC_EXE_SUCCESS |
|
7 | * - TM_LFR_TC_EXE_SUCCESS | |
8 | * - TM_LFR_TC_EXE_INCONSISTENT |
|
8 | * - TM_LFR_TC_EXE_INCONSISTENT | |
9 | * - TM_LFR_TC_EXE_NOT_EXECUTABLE |
|
9 | * - TM_LFR_TC_EXE_NOT_EXECUTABLE | |
10 | * - TM_LFR_TC_EXE_NOT_IMPLEMENTED |
|
10 | * - TM_LFR_TC_EXE_NOT_IMPLEMENTED | |
11 | * - TM_LFR_TC_EXE_ERROR |
|
11 | * - TM_LFR_TC_EXE_ERROR | |
12 | * - TM_LFR_TC_EXE_CORRUPTED |
|
12 | * - TM_LFR_TC_EXE_CORRUPTED | |
13 | * |
|
13 | * | |
14 | */ |
|
14 | */ | |
15 |
|
15 | |||
16 | #include "tm_lfr_tc_exe.h" |
|
16 | #include "tm_lfr_tc_exe.h" | |
17 |
|
17 | |||
18 |
int send_tm_lfr_tc_exe_success( ccsdsTelecommandPacket_t *TC, rtems_id queue_id |
|
18 | int send_tm_lfr_tc_exe_success( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) | |
19 | { |
|
19 | { | |
20 | /** This function sends a TM_LFR_TC_EXE_SUCCESS packet in the dedicated RTEMS message queue. |
|
20 | /** This function sends a TM_LFR_TC_EXE_SUCCESS packet in the dedicated RTEMS message queue. | |
21 | * |
|
21 | * | |
22 | * @param TC points to the TeleCommand packet that is being processed |
|
22 | * @param TC points to the TeleCommand packet that is being processed | |
23 | * @param queue_id is the id of the queue which handles TM |
|
23 | * @param queue_id is the id of the queue which handles TM | |
24 | * |
|
24 | * | |
25 | * @return RTEMS directive status code: |
|
25 | * @return RTEMS directive status code: | |
26 | * - RTEMS_SUCCESSFUL - message sent successfully |
|
26 | * - RTEMS_SUCCESSFUL - message sent successfully | |
27 | * - RTEMS_INVALID_ID - invalid queue id |
|
27 | * - RTEMS_INVALID_ID - invalid queue id | |
28 | * - RTEMS_INVALID_SIZE - invalid message size |
|
28 | * - RTEMS_INVALID_SIZE - invalid message size | |
29 | * - RTEMS_INVALID_ADDRESS - buffer is NULL |
|
29 | * - RTEMS_INVALID_ADDRESS - buffer is NULL | |
30 | * - RTEMS_UNSATISFIED - out of message buffers |
|
30 | * - RTEMS_UNSATISFIED - out of message buffers | |
31 | * - RTEMS_TOO_MANY - queue s limit has been reached |
|
31 | * - RTEMS_TOO_MANY - queue s limit has been reached | |
32 | * |
|
32 | * | |
33 | */ |
|
33 | */ | |
34 |
|
34 | |||
35 | rtems_status_code status; |
|
35 | rtems_status_code status; | |
36 | Packet_TM_LFR_TC_EXE_SUCCESS_t TM; |
|
36 | Packet_TM_LFR_TC_EXE_SUCCESS_t TM; | |
37 | unsigned char messageSize; |
|
37 | unsigned char messageSize; | |
38 |
|
38 | |||
39 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
39 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; | |
40 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
40 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
41 | TM.reserved = DEFAULT_RESERVED; |
|
41 | TM.reserved = DEFAULT_RESERVED; | |
42 | TM.userApplication = CCSDS_USER_APP; |
|
42 | TM.userApplication = CCSDS_USER_APP; | |
43 | // PACKET HEADER |
|
43 | // PACKET HEADER | |
44 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); |
|
44 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); | |
45 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); |
|
45 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); | |
46 | increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID ); |
|
46 | increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID ); | |
47 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_SUCCESS >> 8); |
|
47 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_SUCCESS >> 8); | |
48 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_SUCCESS ); |
|
48 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_SUCCESS ); | |
49 | // DATA FIELD HEADER |
|
49 | // DATA FIELD HEADER | |
50 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
50 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
51 | TM.serviceType = TM_TYPE_TC_EXE; |
|
51 | TM.serviceType = TM_TYPE_TC_EXE; | |
52 | TM.serviceSubType = TM_SUBTYPE_EXE_OK; |
|
52 | TM.serviceSubType = TM_SUBTYPE_EXE_OK; | |
53 | TM.destinationID = TC->sourceID; |
|
53 | TM.destinationID = TC->sourceID; | |
54 | TM.time[0] = time[0]; |
|
54 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
55 | TM.time[1] = time[1]; |
|
55 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
56 | TM.time[2] = time[2]; |
|
56 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
57 | TM.time[3] = time[3]; |
|
57 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); | |
58 | TM.time[4] = time[4]; |
|
58 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
59 | TM.time[5] = time[5]; |
|
59 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); | |
60 | // |
|
60 | // | |
61 | TM.telecommand_pkt_id[0] = TC->packetID[0]; |
|
61 | TM.telecommand_pkt_id[0] = TC->packetID[0]; | |
62 | TM.telecommand_pkt_id[1] = TC->packetID[1]; |
|
62 | TM.telecommand_pkt_id[1] = TC->packetID[1]; | |
63 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; |
|
63 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; | |
64 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; |
|
64 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; | |
65 |
|
65 | |||
66 | messageSize = PACKET_LENGTH_TC_EXE_SUCCESS + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
66 | messageSize = PACKET_LENGTH_TC_EXE_SUCCESS + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; | |
67 |
|
67 | |||
68 | // SEND DATA |
|
68 | // SEND DATA | |
69 | status = rtems_message_queue_send( queue_id, &TM, messageSize); |
|
69 | status = rtems_message_queue_send( queue_id, &TM, messageSize); | |
70 | if (status != RTEMS_SUCCESSFUL) { |
|
70 | if (status != RTEMS_SUCCESSFUL) { | |
71 | PRINTF("in send_tm_lfr_tc_exe_success *** ERR\n") |
|
71 | PRINTF("in send_tm_lfr_tc_exe_success *** ERR\n") | |
72 | } |
|
72 | } | |
73 |
|
73 | |||
74 | return status; |
|
74 | return status; | |
75 | } |
|
75 | } | |
76 |
|
76 | |||
77 | int send_tm_lfr_tc_exe_inconsistent( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, |
|
77 | int send_tm_lfr_tc_exe_inconsistent( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, | |
78 |
unsigned char byte_position, unsigned char rcv_value |
|
78 | unsigned char byte_position, unsigned char rcv_value ) | |
79 | unsigned char *time) |
|
|||
80 | { |
|
79 | { | |
81 | /** This function sends a TM_LFR_TC_EXE_INCONSISTENT packet in the dedicated RTEMS message queue. |
|
80 | /** This function sends a TM_LFR_TC_EXE_INCONSISTENT packet in the dedicated RTEMS message queue. | |
82 | * |
|
81 | * | |
83 | * @param TC points to the TeleCommand packet that is being processed |
|
82 | * @param TC points to the TeleCommand packet that is being processed | |
84 | * @param queue_id is the id of the queue which handles TM |
|
83 | * @param queue_id is the id of the queue which handles TM | |
85 | * @param byte_position is the byte position of the MSB of the parameter that has been seen as inconsistent |
|
84 | * @param byte_position is the byte position of the MSB of the parameter that has been seen as inconsistent | |
86 | * @param rcv_value is the value of the LSB of the parameter that has been deteced as inconsistent |
|
85 | * @param rcv_value is the value of the LSB of the parameter that has been deteced as inconsistent | |
87 | * |
|
86 | * | |
88 | * @return RTEMS directive status code: |
|
87 | * @return RTEMS directive status code: | |
89 | * - RTEMS_SUCCESSFUL - message sent successfully |
|
88 | * - RTEMS_SUCCESSFUL - message sent successfully | |
90 | * - RTEMS_INVALID_ID - invalid queue id |
|
89 | * - RTEMS_INVALID_ID - invalid queue id | |
91 | * - RTEMS_INVALID_SIZE - invalid message size |
|
90 | * - RTEMS_INVALID_SIZE - invalid message size | |
92 | * - RTEMS_INVALID_ADDRESS - buffer is NULL |
|
91 | * - RTEMS_INVALID_ADDRESS - buffer is NULL | |
93 | * - RTEMS_UNSATISFIED - out of message buffers |
|
92 | * - RTEMS_UNSATISFIED - out of message buffers | |
94 | * - RTEMS_TOO_MANY - queue s limit has been reached |
|
93 | * - RTEMS_TOO_MANY - queue s limit has been reached | |
95 | * |
|
94 | * | |
96 | */ |
|
95 | */ | |
97 |
|
96 | |||
98 | rtems_status_code status; |
|
97 | rtems_status_code status; | |
99 | Packet_TM_LFR_TC_EXE_INCONSISTENT_t TM; |
|
98 | Packet_TM_LFR_TC_EXE_INCONSISTENT_t TM; | |
100 | unsigned char messageSize; |
|
99 | unsigned char messageSize; | |
101 |
|
100 | |||
102 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
101 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; | |
103 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
102 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
104 | TM.reserved = DEFAULT_RESERVED; |
|
103 | TM.reserved = DEFAULT_RESERVED; | |
105 | TM.userApplication = CCSDS_USER_APP; |
|
104 | TM.userApplication = CCSDS_USER_APP; | |
106 | // PACKET HEADER |
|
105 | // PACKET HEADER | |
107 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); |
|
106 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); | |
108 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); |
|
107 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); | |
109 | increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID ); |
|
108 | increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID ); | |
110 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_INCONSISTENT >> 8); |
|
109 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_INCONSISTENT >> 8); | |
111 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_INCONSISTENT ); |
|
110 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_INCONSISTENT ); | |
112 | // DATA FIELD HEADER |
|
111 | // DATA FIELD HEADER | |
113 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
112 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
114 | TM.serviceType = TM_TYPE_TC_EXE; |
|
113 | TM.serviceType = TM_TYPE_TC_EXE; | |
115 | TM.serviceSubType = TM_SUBTYPE_EXE_NOK; |
|
114 | TM.serviceSubType = TM_SUBTYPE_EXE_NOK; | |
116 | TM.destinationID = TC->sourceID; |
|
115 | TM.destinationID = TC->sourceID; | |
117 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
116 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
118 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
117 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
119 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
118 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
120 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
119 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); | |
121 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
120 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
122 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
121 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); | |
123 | // |
|
122 | // | |
124 | TM.tc_failure_code[0] = (char) (WRONG_APP_DATA >> 8); |
|
123 | TM.tc_failure_code[0] = (char) (WRONG_APP_DATA >> 8); | |
125 | TM.tc_failure_code[1] = (char) (WRONG_APP_DATA ); |
|
124 | TM.tc_failure_code[1] = (char) (WRONG_APP_DATA ); | |
126 | TM.telecommand_pkt_id[0] = TC->packetID[0]; |
|
125 | TM.telecommand_pkt_id[0] = TC->packetID[0]; | |
127 | TM.telecommand_pkt_id[1] = TC->packetID[1]; |
|
126 | TM.telecommand_pkt_id[1] = TC->packetID[1]; | |
128 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; |
|
127 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; | |
129 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; |
|
128 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; | |
130 | TM.tc_service = TC->serviceType; // type of the rejected TC |
|
129 | TM.tc_service = TC->serviceType; // type of the rejected TC | |
131 | TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC |
|
130 | TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC | |
132 | TM.byte_position = byte_position; |
|
131 | TM.byte_position = byte_position; | |
133 | TM.rcv_value = rcv_value; |
|
132 | TM.rcv_value = rcv_value; | |
134 |
|
133 | |||
135 | messageSize = PACKET_LENGTH_TC_EXE_INCONSISTENT + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
134 | messageSize = PACKET_LENGTH_TC_EXE_INCONSISTENT + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; | |
136 |
|
135 | |||
137 | // SEND DATA |
|
136 | // SEND DATA | |
138 | status = rtems_message_queue_send( queue_id, &TM, messageSize); |
|
137 | status = rtems_message_queue_send( queue_id, &TM, messageSize); | |
139 | if (status != RTEMS_SUCCESSFUL) { |
|
138 | if (status != RTEMS_SUCCESSFUL) { | |
140 | PRINTF("in send_tm_lfr_tc_exe_inconsistent *** ERR\n") |
|
139 | PRINTF("in send_tm_lfr_tc_exe_inconsistent *** ERR\n") | |
141 | } |
|
140 | } | |
142 |
|
141 | |||
143 | return status; |
|
142 | return status; | |
144 | } |
|
143 | } | |
145 |
|
144 | |||
146 |
int send_tm_lfr_tc_exe_not_executable( ccsdsTelecommandPacket_t *TC, rtems_id queue_id |
|
145 | int send_tm_lfr_tc_exe_not_executable( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) | |
147 | { |
|
146 | { | |
148 | /** This function sends a TM_LFR_TC_EXE_NOT_EXECUTABLE packet in the dedicated RTEMS message queue. |
|
147 | /** This function sends a TM_LFR_TC_EXE_NOT_EXECUTABLE packet in the dedicated RTEMS message queue. | |
149 | * |
|
148 | * | |
150 | * @param TC points to the TeleCommand packet that is being processed |
|
149 | * @param TC points to the TeleCommand packet that is being processed | |
151 | * @param queue_id is the id of the queue which handles TM |
|
150 | * @param queue_id is the id of the queue which handles TM | |
152 | * |
|
151 | * | |
153 | * @return RTEMS directive status code: |
|
152 | * @return RTEMS directive status code: | |
154 | * - RTEMS_SUCCESSFUL - message sent successfully |
|
153 | * - RTEMS_SUCCESSFUL - message sent successfully | |
155 | * - RTEMS_INVALID_ID - invalid queue id |
|
154 | * - RTEMS_INVALID_ID - invalid queue id | |
156 | * - RTEMS_INVALID_SIZE - invalid message size |
|
155 | * - RTEMS_INVALID_SIZE - invalid message size | |
157 | * - RTEMS_INVALID_ADDRESS - buffer is NULL |
|
156 | * - RTEMS_INVALID_ADDRESS - buffer is NULL | |
158 | * - RTEMS_UNSATISFIED - out of message buffers |
|
157 | * - RTEMS_UNSATISFIED - out of message buffers | |
159 | * - RTEMS_TOO_MANY - queue s limit has been reached |
|
158 | * - RTEMS_TOO_MANY - queue s limit has been reached | |
160 | * |
|
159 | * | |
161 | */ |
|
160 | */ | |
162 |
|
161 | |||
163 | rtems_status_code status; |
|
162 | rtems_status_code status; | |
164 | Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t TM; |
|
163 | Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t TM; | |
165 | unsigned char messageSize; |
|
164 | unsigned char messageSize; | |
166 |
|
165 | |||
167 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
166 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; | |
168 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
167 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
169 | TM.reserved = DEFAULT_RESERVED; |
|
168 | TM.reserved = DEFAULT_RESERVED; | |
170 | TM.userApplication = CCSDS_USER_APP; |
|
169 | TM.userApplication = CCSDS_USER_APP; | |
171 | // PACKET HEADER |
|
170 | // PACKET HEADER | |
172 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); |
|
171 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); | |
173 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); |
|
172 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); | |
174 | increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID ); |
|
173 | increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID ); | |
175 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE >> 8); |
|
174 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE >> 8); | |
176 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE ); |
|
175 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE ); | |
177 | // DATA FIELD HEADER |
|
176 | // DATA FIELD HEADER | |
178 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
177 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
179 | TM.serviceType = TM_TYPE_TC_EXE; |
|
178 | TM.serviceType = TM_TYPE_TC_EXE; | |
180 | TM.serviceSubType = TM_SUBTYPE_EXE_NOK; |
|
179 | TM.serviceSubType = TM_SUBTYPE_EXE_NOK; | |
181 | TM.destinationID = TC->sourceID; // default destination id |
|
180 | TM.destinationID = TC->sourceID; // default destination id | |
182 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
181 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
183 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
182 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
184 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
183 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
185 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
184 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); | |
186 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
185 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
187 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
186 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); | |
188 | // |
|
187 | // | |
189 | TM.tc_failure_code[0] = (char) (TC_NOT_EXE >> 8); |
|
188 | TM.tc_failure_code[0] = (char) (TC_NOT_EXE >> 8); | |
190 | TM.tc_failure_code[1] = (char) (TC_NOT_EXE ); |
|
189 | TM.tc_failure_code[1] = (char) (TC_NOT_EXE ); | |
191 | TM.telecommand_pkt_id[0] = TC->packetID[0]; |
|
190 | TM.telecommand_pkt_id[0] = TC->packetID[0]; | |
192 | TM.telecommand_pkt_id[1] = TC->packetID[1]; |
|
191 | TM.telecommand_pkt_id[1] = TC->packetID[1]; | |
193 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; |
|
192 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; | |
194 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; |
|
193 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; | |
195 | TM.tc_service = TC->serviceType; // type of the rejected TC |
|
194 | TM.tc_service = TC->serviceType; // type of the rejected TC | |
196 | TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC |
|
195 | TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC | |
197 | TM.lfr_status_word[0] = housekeeping_packet.lfr_status_word[0]; |
|
196 | TM.lfr_status_word[0] = housekeeping_packet.lfr_status_word[0]; | |
198 | TM.lfr_status_word[1] = housekeeping_packet.lfr_status_word[1]; |
|
197 | TM.lfr_status_word[1] = housekeeping_packet.lfr_status_word[1]; | |
199 |
|
198 | |||
200 | messageSize = PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
199 | messageSize = PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; | |
201 |
|
200 | |||
202 | // SEND DATA |
|
201 | // SEND DATA | |
203 | status = rtems_message_queue_send( queue_id, &TM, messageSize); |
|
202 | status = rtems_message_queue_send( queue_id, &TM, messageSize); | |
204 | if (status != RTEMS_SUCCESSFUL) { |
|
203 | if (status != RTEMS_SUCCESSFUL) { | |
205 | PRINTF("in send_tm_lfr_tc_exe_not_executable *** ERR\n") |
|
204 | PRINTF("in send_tm_lfr_tc_exe_not_executable *** ERR\n") | |
206 | } |
|
205 | } | |
207 |
|
206 | |||
208 | return status; |
|
207 | return status; | |
209 | } |
|
208 | } | |
210 |
|
209 | |||
211 | int send_tm_lfr_tc_exe_not_implemented( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time ) |
|
210 | int send_tm_lfr_tc_exe_not_implemented( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time ) | |
212 | { |
|
211 | { | |
213 | /** This function sends a TM_LFR_TC_EXE_NOT_IMPLEMENTED packet in the dedicated RTEMS message queue. |
|
212 | /** This function sends a TM_LFR_TC_EXE_NOT_IMPLEMENTED packet in the dedicated RTEMS message queue. | |
214 | * |
|
213 | * | |
215 | * @param TC points to the TeleCommand packet that is being processed |
|
214 | * @param TC points to the TeleCommand packet that is being processed | |
216 | * @param queue_id is the id of the queue which handles TM |
|
215 | * @param queue_id is the id of the queue which handles TM | |
217 | * |
|
216 | * | |
218 | * @return RTEMS directive status code: |
|
217 | * @return RTEMS directive status code: | |
219 | * - RTEMS_SUCCESSFUL - message sent successfully |
|
218 | * - RTEMS_SUCCESSFUL - message sent successfully | |
220 | * - RTEMS_INVALID_ID - invalid queue id |
|
219 | * - RTEMS_INVALID_ID - invalid queue id | |
221 | * - RTEMS_INVALID_SIZE - invalid message size |
|
220 | * - RTEMS_INVALID_SIZE - invalid message size | |
222 | * - RTEMS_INVALID_ADDRESS - buffer is NULL |
|
221 | * - RTEMS_INVALID_ADDRESS - buffer is NULL | |
223 | * - RTEMS_UNSATISFIED - out of message buffers |
|
222 | * - RTEMS_UNSATISFIED - out of message buffers | |
224 | * - RTEMS_TOO_MANY - queue s limit has been reached |
|
223 | * - RTEMS_TOO_MANY - queue s limit has been reached | |
225 | * |
|
224 | * | |
226 | */ |
|
225 | */ | |
227 |
|
226 | |||
228 | rtems_status_code status; |
|
227 | rtems_status_code status; | |
229 | Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t TM; |
|
228 | Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t TM; | |
230 | unsigned char messageSize; |
|
229 | unsigned char messageSize; | |
231 |
|
230 | |||
232 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
231 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; | |
233 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
232 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
234 | TM.reserved = DEFAULT_RESERVED; |
|
233 | TM.reserved = DEFAULT_RESERVED; | |
235 | TM.userApplication = CCSDS_USER_APP; |
|
234 | TM.userApplication = CCSDS_USER_APP; | |
236 | // PACKET HEADER |
|
235 | // PACKET HEADER | |
237 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); |
|
236 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); | |
238 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); |
|
237 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); | |
239 | increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID ); |
|
238 | increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID ); | |
240 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED >> 8); |
|
239 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED >> 8); | |
241 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED ); |
|
240 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED ); | |
242 | // DATA FIELD HEADER |
|
241 | // DATA FIELD HEADER | |
243 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
242 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
244 | TM.serviceType = TM_TYPE_TC_EXE; |
|
243 | TM.serviceType = TM_TYPE_TC_EXE; | |
245 | TM.serviceSubType = TM_SUBTYPE_EXE_NOK; |
|
244 | TM.serviceSubType = TM_SUBTYPE_EXE_NOK; | |
246 | TM.destinationID = TC->sourceID; // default destination id |
|
245 | TM.destinationID = TC->sourceID; // default destination id | |
247 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
246 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
248 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
247 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
249 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
248 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
250 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
249 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); | |
251 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
250 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
252 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
251 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); | |
253 | // |
|
252 | // | |
254 | TM.tc_failure_code[0] = (char) (FUNCT_NOT_IMPL >> 8); |
|
253 | TM.tc_failure_code[0] = (char) (FUNCT_NOT_IMPL >> 8); | |
255 | TM.tc_failure_code[1] = (char) (FUNCT_NOT_IMPL ); |
|
254 | TM.tc_failure_code[1] = (char) (FUNCT_NOT_IMPL ); | |
256 | TM.telecommand_pkt_id[0] = TC->packetID[0]; |
|
255 | TM.telecommand_pkt_id[0] = TC->packetID[0]; | |
257 | TM.telecommand_pkt_id[1] = TC->packetID[1]; |
|
256 | TM.telecommand_pkt_id[1] = TC->packetID[1]; | |
258 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; |
|
257 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; | |
259 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; |
|
258 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; | |
260 | TM.tc_service = TC->serviceType; // type of the rejected TC |
|
259 | TM.tc_service = TC->serviceType; // type of the rejected TC | |
261 | TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC |
|
260 | TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC | |
262 |
|
261 | |||
263 | messageSize = PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
262 | messageSize = PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; | |
264 |
|
263 | |||
265 | // SEND DATA |
|
264 | // SEND DATA | |
266 | status = rtems_message_queue_send( queue_id, &TM, messageSize); |
|
265 | status = rtems_message_queue_send( queue_id, &TM, messageSize); | |
267 | if (status != RTEMS_SUCCESSFUL) { |
|
266 | if (status != RTEMS_SUCCESSFUL) { | |
268 | PRINTF("in send_tm_lfr_tc_exe_not_implemented *** ERR\n") |
|
267 | PRINTF("in send_tm_lfr_tc_exe_not_implemented *** ERR\n") | |
269 | } |
|
268 | } | |
270 |
|
269 | |||
271 | return status; |
|
270 | return status; | |
272 | } |
|
271 | } | |
273 |
|
272 | |||
274 | int send_tm_lfr_tc_exe_error( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time ) |
|
273 | int send_tm_lfr_tc_exe_error( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time ) | |
275 | { |
|
274 | { | |
276 | /** This function sends a TM_LFR_TC_EXE_ERROR packet in the dedicated RTEMS message queue. |
|
275 | /** This function sends a TM_LFR_TC_EXE_ERROR packet in the dedicated RTEMS message queue. | |
277 | * |
|
276 | * | |
278 | * @param TC points to the TeleCommand packet that is being processed |
|
277 | * @param TC points to the TeleCommand packet that is being processed | |
279 | * @param queue_id is the id of the queue which handles TM |
|
278 | * @param queue_id is the id of the queue which handles TM | |
280 | * |
|
279 | * | |
281 | * @return RTEMS directive status code: |
|
280 | * @return RTEMS directive status code: | |
282 | * - RTEMS_SUCCESSFUL - message sent successfully |
|
281 | * - RTEMS_SUCCESSFUL - message sent successfully | |
283 | * - RTEMS_INVALID_ID - invalid queue id |
|
282 | * - RTEMS_INVALID_ID - invalid queue id | |
284 | * - RTEMS_INVALID_SIZE - invalid message size |
|
283 | * - RTEMS_INVALID_SIZE - invalid message size | |
285 | * - RTEMS_INVALID_ADDRESS - buffer is NULL |
|
284 | * - RTEMS_INVALID_ADDRESS - buffer is NULL | |
286 | * - RTEMS_UNSATISFIED - out of message buffers |
|
285 | * - RTEMS_UNSATISFIED - out of message buffers | |
287 | * - RTEMS_TOO_MANY - queue s limit has been reached |
|
286 | * - RTEMS_TOO_MANY - queue s limit has been reached | |
288 | * |
|
287 | * | |
289 | */ |
|
288 | */ | |
290 |
|
289 | |||
291 | rtems_status_code status; |
|
290 | rtems_status_code status; | |
292 | Packet_TM_LFR_TC_EXE_ERROR_t TM; |
|
291 | Packet_TM_LFR_TC_EXE_ERROR_t TM; | |
293 | unsigned char messageSize; |
|
292 | unsigned char messageSize; | |
294 |
|
293 | |||
295 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
294 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; | |
296 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
295 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
297 | TM.reserved = DEFAULT_RESERVED; |
|
296 | TM.reserved = DEFAULT_RESERVED; | |
298 | TM.userApplication = CCSDS_USER_APP; |
|
297 | TM.userApplication = CCSDS_USER_APP; | |
299 | // PACKET HEADER |
|
298 | // PACKET HEADER | |
300 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); |
|
299 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); | |
301 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); |
|
300 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); | |
302 | increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID ); |
|
301 | increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID ); | |
303 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_ERROR >> 8); |
|
302 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_ERROR >> 8); | |
304 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_ERROR ); |
|
303 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_ERROR ); | |
305 | // DATA FIELD HEADER |
|
304 | // DATA FIELD HEADER | |
306 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
305 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
307 | TM.serviceType = TM_TYPE_TC_EXE; |
|
306 | TM.serviceType = TM_TYPE_TC_EXE; | |
308 | TM.serviceSubType = TM_SUBTYPE_EXE_NOK; |
|
307 | TM.serviceSubType = TM_SUBTYPE_EXE_NOK; | |
309 | TM.destinationID = TC->sourceID; // default destination id |
|
308 | TM.destinationID = TC->sourceID; // default destination id | |
310 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
309 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
311 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
310 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
312 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
311 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
313 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
312 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); | |
314 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
313 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
315 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
314 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); | |
316 | // |
|
315 | // | |
317 | TM.tc_failure_code[0] = (char) (FAIL_DETECTED >> 8); |
|
316 | TM.tc_failure_code[0] = (char) (FAIL_DETECTED >> 8); | |
318 | TM.tc_failure_code[1] = (char) (FAIL_DETECTED ); |
|
317 | TM.tc_failure_code[1] = (char) (FAIL_DETECTED ); | |
319 | TM.telecommand_pkt_id[0] = TC->packetID[0]; |
|
318 | TM.telecommand_pkt_id[0] = TC->packetID[0]; | |
320 | TM.telecommand_pkt_id[1] = TC->packetID[1]; |
|
319 | TM.telecommand_pkt_id[1] = TC->packetID[1]; | |
321 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; |
|
320 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; | |
322 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; |
|
321 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; | |
323 | TM.tc_service = TC->serviceType; // type of the rejected TC |
|
322 | TM.tc_service = TC->serviceType; // type of the rejected TC | |
324 | TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC |
|
323 | TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC | |
325 |
|
324 | |||
326 | messageSize = PACKET_LENGTH_TC_EXE_ERROR + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
325 | messageSize = PACKET_LENGTH_TC_EXE_ERROR + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; | |
327 |
|
326 | |||
328 | // SEND DATA |
|
327 | // SEND DATA | |
329 | status = rtems_message_queue_send( queue_id, &TM, messageSize); |
|
328 | status = rtems_message_queue_send( queue_id, &TM, messageSize); | |
330 | if (status != RTEMS_SUCCESSFUL) { |
|
329 | if (status != RTEMS_SUCCESSFUL) { | |
331 | PRINTF("in send_tm_lfr_tc_exe_error *** ERR\n") |
|
330 | PRINTF("in send_tm_lfr_tc_exe_error *** ERR\n") | |
332 | } |
|
331 | } | |
333 |
|
332 | |||
334 | return status; |
|
333 | return status; | |
335 | } |
|
334 | } | |
336 |
|
335 | |||
337 | int send_tm_lfr_tc_exe_corrupted(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, |
|
336 | int send_tm_lfr_tc_exe_corrupted(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, | |
338 | unsigned char *computed_CRC, unsigned char *currentTC_LEN_RCV, |
|
337 | unsigned char *computed_CRC, unsigned char *currentTC_LEN_RCV, | |
339 |
unsigned char destinationID |
|
338 | unsigned char destinationID ) | |
340 | { |
|
339 | { | |
341 | /** This function sends a TM_LFR_TC_EXE_CORRUPTED packet in the dedicated RTEMS message queue. |
|
340 | /** This function sends a TM_LFR_TC_EXE_CORRUPTED packet in the dedicated RTEMS message queue. | |
342 | * |
|
341 | * | |
343 | * @param TC points to the TeleCommand packet that is being processed |
|
342 | * @param TC points to the TeleCommand packet that is being processed | |
344 | * @param queue_id is the id of the queue which handles TM |
|
343 | * @param queue_id is the id of the queue which handles TM | |
345 | * @param computed_CRC points to a buffer of two bytes containing the CRC computed during the parsing of the TeleCommand |
|
344 | * @param computed_CRC points to a buffer of two bytes containing the CRC computed during the parsing of the TeleCommand | |
346 | * @param currentTC_LEN_RCV points to a buffer of two bytes containing a packet size field computed on the received data |
|
345 | * @param currentTC_LEN_RCV points to a buffer of two bytes containing a packet size field computed on the received data | |
347 | * |
|
346 | * | |
348 | * @return RTEMS directive status code: |
|
347 | * @return RTEMS directive status code: | |
349 | * - RTEMS_SUCCESSFUL - message sent successfully |
|
348 | * - RTEMS_SUCCESSFUL - message sent successfully | |
350 | * - RTEMS_INVALID_ID - invalid queue id |
|
349 | * - RTEMS_INVALID_ID - invalid queue id | |
351 | * - RTEMS_INVALID_SIZE - invalid message size |
|
350 | * - RTEMS_INVALID_SIZE - invalid message size | |
352 | * - RTEMS_INVALID_ADDRESS - buffer is NULL |
|
351 | * - RTEMS_INVALID_ADDRESS - buffer is NULL | |
353 | * - RTEMS_UNSATISFIED - out of message buffers |
|
352 | * - RTEMS_UNSATISFIED - out of message buffers | |
354 | * - RTEMS_TOO_MANY - queue s limit has been reached |
|
353 | * - RTEMS_TOO_MANY - queue s limit has been reached | |
355 | * |
|
354 | * | |
356 | */ |
|
355 | */ | |
357 |
|
356 | |||
358 | rtems_status_code status; |
|
357 | rtems_status_code status; | |
359 | Packet_TM_LFR_TC_EXE_CORRUPTED_t TM; |
|
358 | Packet_TM_LFR_TC_EXE_CORRUPTED_t TM; | |
360 | unsigned char messageSize; |
|
359 | unsigned char messageSize; | |
361 | unsigned int packetLength; |
|
360 | unsigned int packetLength; | |
362 | unsigned char *packetDataField; |
|
361 | unsigned char *packetDataField; | |
363 |
|
362 | |||
364 | packetLength = (TC->packetLength[0] * 256) + TC->packetLength[1]; // compute the packet length parameter |
|
363 | packetLength = (TC->packetLength[0] * 256) + TC->packetLength[1]; // compute the packet length parameter | |
365 | packetDataField = (unsigned char *) &TC->headerFlag_pusVersion_Ack; // get the beginning of the data field |
|
364 | packetDataField = (unsigned char *) &TC->headerFlag_pusVersion_Ack; // get the beginning of the data field | |
366 |
|
365 | |||
367 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
366 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; | |
368 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
367 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
369 | TM.reserved = DEFAULT_RESERVED; |
|
368 | TM.reserved = DEFAULT_RESERVED; | |
370 | TM.userApplication = CCSDS_USER_APP; |
|
369 | TM.userApplication = CCSDS_USER_APP; | |
371 | // PACKET HEADER |
|
370 | // PACKET HEADER | |
372 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); |
|
371 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); | |
373 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); |
|
372 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); | |
374 | increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID ); |
|
373 | increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID ); | |
375 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_CORRUPTED >> 8); |
|
374 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_CORRUPTED >> 8); | |
376 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_CORRUPTED ); |
|
375 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_CORRUPTED ); | |
377 | // DATA FIELD HEADER |
|
376 | // DATA FIELD HEADER | |
378 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
377 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
379 | TM.serviceType = TM_TYPE_TC_EXE; |
|
378 | TM.serviceType = TM_TYPE_TC_EXE; | |
380 | TM.serviceSubType = TM_SUBTYPE_EXE_NOK; |
|
379 | TM.serviceSubType = TM_SUBTYPE_EXE_NOK; | |
381 | TM.destinationID = destinationID; |
|
380 | TM.destinationID = destinationID; | |
382 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
381 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
383 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
382 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
384 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
383 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
385 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
384 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); | |
386 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
385 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
387 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
386 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); | |
388 | // |
|
387 | // | |
389 | TM.tc_failure_code[0] = (unsigned char) (CORRUPTED >> 8); |
|
388 | TM.tc_failure_code[0] = (unsigned char) (CORRUPTED >> 8); | |
390 | TM.tc_failure_code[1] = (unsigned char) (CORRUPTED ); |
|
389 | TM.tc_failure_code[1] = (unsigned char) (CORRUPTED ); | |
391 | TM.telecommand_pkt_id[0] = TC->packetID[0]; |
|
390 | TM.telecommand_pkt_id[0] = TC->packetID[0]; | |
392 | TM.telecommand_pkt_id[1] = TC->packetID[1]; |
|
391 | TM.telecommand_pkt_id[1] = TC->packetID[1]; | |
393 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; |
|
392 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; | |
394 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; |
|
393 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; | |
395 | TM.tc_service = TC->serviceType; // type of the rejected TC |
|
394 | TM.tc_service = TC->serviceType; // type of the rejected TC | |
396 | TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC |
|
395 | TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC | |
397 | TM.pkt_len_rcv_value[0] = TC->packetLength[0]; |
|
396 | TM.pkt_len_rcv_value[0] = TC->packetLength[0]; | |
398 | TM.pkt_len_rcv_value[1] = TC->packetLength[1]; |
|
397 | TM.pkt_len_rcv_value[1] = TC->packetLength[1]; | |
399 | TM.pkt_datafieldsize_cnt[0] = currentTC_LEN_RCV[0]; |
|
398 | TM.pkt_datafieldsize_cnt[0] = currentTC_LEN_RCV[0]; | |
400 | TM.pkt_datafieldsize_cnt[1] = currentTC_LEN_RCV[1]; |
|
399 | TM.pkt_datafieldsize_cnt[1] = currentTC_LEN_RCV[1]; | |
401 | TM.rcv_crc[0] = packetDataField[ packetLength - 1 ]; |
|
400 | TM.rcv_crc[0] = packetDataField[ packetLength - 1 ]; | |
402 | TM.rcv_crc[1] = packetDataField[ packetLength ]; |
|
401 | TM.rcv_crc[1] = packetDataField[ packetLength ]; | |
403 | TM.computed_crc[0] = computed_CRC[0]; |
|
402 | TM.computed_crc[0] = computed_CRC[0]; | |
404 | TM.computed_crc[1] = computed_CRC[1]; |
|
403 | TM.computed_crc[1] = computed_CRC[1]; | |
405 |
|
404 | |||
406 | messageSize = PACKET_LENGTH_TC_EXE_CORRUPTED + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
405 | messageSize = PACKET_LENGTH_TC_EXE_CORRUPTED + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; | |
407 |
|
406 | |||
408 | // SEND DATA |
|
407 | // SEND DATA | |
409 | status = rtems_message_queue_send( queue_id, &TM, messageSize); |
|
408 | status = rtems_message_queue_send( queue_id, &TM, messageSize); | |
410 | if (status != RTEMS_SUCCESSFUL) { |
|
409 | if (status != RTEMS_SUCCESSFUL) { | |
411 | PRINTF("in send_tm_lfr_tc_exe_error *** ERR\n") |
|
410 | PRINTF("in send_tm_lfr_tc_exe_error *** ERR\n") | |
412 | } |
|
411 | } | |
413 |
|
412 | |||
414 | return status; |
|
413 | return status; | |
415 | } |
|
414 | } | |
416 |
|
415 | |||
417 | void increment_seq_counter_destination_id( unsigned char *packet_sequence_control, unsigned char destination_id ) |
|
416 | void increment_seq_counter_destination_id( unsigned char *packet_sequence_control, unsigned char destination_id ) | |
418 | { |
|
417 | { | |
419 | /** This function increment the packet sequence control parameter of a TC, depending on its destination ID. |
|
418 | /** This function increment the packet sequence control parameter of a TC, depending on its destination ID. | |
420 | * |
|
419 | * | |
421 | * @param packet_sequence_control points to the packet sequence control which will be incremented |
|
420 | * @param packet_sequence_control points to the packet sequence control which will be incremented | |
422 | * @param destination_id is the destination ID of the TM, there is one counter by destination ID |
|
421 | * @param destination_id is the destination ID of the TM, there is one counter by destination ID | |
423 | * |
|
422 | * | |
424 | * If the destination ID is not known, a dedicated counter is incremented. |
|
423 | * If the destination ID is not known, a dedicated counter is incremented. | |
425 | * |
|
424 | * | |
426 | */ |
|
425 | */ | |
427 |
|
426 | |||
428 | unsigned short sequence_cnt; |
|
427 | unsigned short sequence_cnt; | |
429 | unsigned short segmentation_grouping_flag; |
|
428 | unsigned short segmentation_grouping_flag; | |
430 | unsigned short new_packet_sequence_control; |
|
429 | unsigned short new_packet_sequence_control; | |
431 | unsigned char i; |
|
430 | unsigned char i; | |
432 |
|
431 | |||
433 | switch (destination_id) |
|
432 | switch (destination_id) | |
434 | { |
|
433 | { | |
435 | case SID_TC_GROUND: |
|
434 | case SID_TC_GROUND: | |
436 | i = GROUND; |
|
435 | i = GROUND; | |
437 | break; |
|
436 | break; | |
438 | case SID_TC_MISSION_TIMELINE: |
|
437 | case SID_TC_MISSION_TIMELINE: | |
439 | i = MISSION_TIMELINE; |
|
438 | i = MISSION_TIMELINE; | |
440 | break; |
|
439 | break; | |
441 | case SID_TC_TC_SEQUENCES: |
|
440 | case SID_TC_TC_SEQUENCES: | |
442 | i = TC_SEQUENCES; |
|
441 | i = TC_SEQUENCES; | |
443 | break; |
|
442 | break; | |
444 | case SID_TC_RECOVERY_ACTION_CMD: |
|
443 | case SID_TC_RECOVERY_ACTION_CMD: | |
445 | i = RECOVERY_ACTION_CMD; |
|
444 | i = RECOVERY_ACTION_CMD; | |
446 | break; |
|
445 | break; | |
447 | case SID_TC_BACKUP_MISSION_TIMELINE: |
|
446 | case SID_TC_BACKUP_MISSION_TIMELINE: | |
448 | i = BACKUP_MISSION_TIMELINE; |
|
447 | i = BACKUP_MISSION_TIMELINE; | |
449 | break; |
|
448 | break; | |
450 | case SID_TC_DIRECT_CMD: |
|
449 | case SID_TC_DIRECT_CMD: | |
451 | i = DIRECT_CMD; |
|
450 | i = DIRECT_CMD; | |
452 | break; |
|
451 | break; | |
453 | case SID_TC_SPARE_GRD_SRC1: |
|
452 | case SID_TC_SPARE_GRD_SRC1: | |
454 | i = SPARE_GRD_SRC1; |
|
453 | i = SPARE_GRD_SRC1; | |
455 | break; |
|
454 | break; | |
456 | case SID_TC_SPARE_GRD_SRC2: |
|
455 | case SID_TC_SPARE_GRD_SRC2: | |
457 | i = SPARE_GRD_SRC2; |
|
456 | i = SPARE_GRD_SRC2; | |
458 | break; |
|
457 | break; | |
459 | case SID_TC_OBCP: |
|
458 | case SID_TC_OBCP: | |
460 | i = OBCP; |
|
459 | i = OBCP; | |
461 | break; |
|
460 | break; | |
462 | case SID_TC_SYSTEM_CONTROL: |
|
461 | case SID_TC_SYSTEM_CONTROL: | |
463 | i = SYSTEM_CONTROL; |
|
462 | i = SYSTEM_CONTROL; | |
464 | break; |
|
463 | break; | |
465 | case SID_TC_AOCS: |
|
464 | case SID_TC_AOCS: | |
466 | i = AOCS; |
|
465 | i = AOCS; | |
467 | break; |
|
466 | break; | |
468 | case SID_TC_RPW_INTERNAL: |
|
467 | case SID_TC_RPW_INTERNAL: | |
469 | i = RPW_INTERNAL; |
|
468 | i = RPW_INTERNAL; | |
470 | break; |
|
469 | break; | |
471 | default: |
|
470 | default: | |
472 | i = GROUND; |
|
471 | i = GROUND; | |
473 | break; |
|
472 | break; | |
474 | } |
|
473 | } | |
475 |
|
474 | |||
|
475 | // increment the sequence counter | |||
|
476 | if ( sequenceCounters_TC_EXE[ i ] < SEQ_CNT_MAX ) | |||
|
477 | { | |||
|
478 | sequenceCounters_TC_EXE[ i ] = sequenceCounters_TC_EXE[ i ] + 1; | |||
|
479 | } | |||
|
480 | else | |||
|
481 | { | |||
|
482 | sequenceCounters_TC_EXE[ i ] = 0; | |||
|
483 | } | |||
|
484 | ||||
476 | segmentation_grouping_flag = TM_PACKET_SEQ_CTRL_STANDALONE << 8; |
|
485 | segmentation_grouping_flag = TM_PACKET_SEQ_CTRL_STANDALONE << 8; | |
477 | sequence_cnt = sequenceCounters_TC_EXE[ i ] & 0x3fff; |
|
486 | sequence_cnt = sequenceCounters_TC_EXE[ i ] & 0x3fff; | |
478 |
|
487 | |||
479 | new_packet_sequence_control = segmentation_grouping_flag | sequence_cnt ; |
|
488 | new_packet_sequence_control = segmentation_grouping_flag | sequence_cnt ; | |
480 |
|
489 | |||
481 | packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8); |
|
490 | packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8); | |
482 | packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control ); |
|
491 | packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control ); | |
483 |
|
492 | |||
484 | // increment the sequence counter for the next packet |
|
|||
485 | if ( sequenceCounters_TC_EXE[ i ] < SEQ_CNT_MAX) |
|
|||
486 | { |
|
|||
487 | sequenceCounters_TC_EXE[ i ] = sequenceCounters_TC_EXE[ i ] + 1; |
|
|||
488 | } |
|
|||
489 | else |
|
|||
490 | { |
|
|||
491 | sequenceCounters_TC_EXE[ i ] = 0; |
|
|||
492 | } |
|
|||
493 |
|
||||
494 | } |
|
493 | } |
General Comments 0
You need to be logged in to leave comments.
Login now