@@ -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 Apr 1 12:03:12 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=5 -D |
|
13 | DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=5 -DPRINT_MESSAGES_ON_CONSOLE -DPRINT_TASK_STATISTICS | |
14 | CFLAGS = -pipe -O3 -Wall $(DEFINES) |
|
14 | CFLAGS = -pipe -O3 -Wall $(DEFINES) | |
15 | CXXFLAGS = -pipe -O3 -Wall $(DEFINES) |
|
15 | CXXFLAGS = -pipe -O3 -Wall $(DEFINES) | |
16 | INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header -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,85 +1,85 | |||||
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 *** vhdl_dev *** debug_tch |
|
3 | # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** vhdl_dev *** debug_tch | |
4 |
CONFIG += console verbose |
|
4 | CONFIG += console verbose cpu_usage_report | |
5 | CONFIG -= qt |
|
5 | CONFIG -= qt | |
6 |
|
6 | |||
7 | include(./sparc.pri) |
|
7 | include(./sparc.pri) | |
8 |
|
8 | |||
9 | # flight software version |
|
9 | # flight software version | |
10 | SWVERSION=-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=5 # internal |
|
14 | DEFINES += SW_VERSION_N4=5 # internal | |
15 |
|
15 | |||
16 | contains( CONFIG, debug_tch ) { |
|
16 | contains( CONFIG, debug_tch ) { | |
17 | DEFINES += DEBUG_TCH |
|
17 | DEFINES += DEBUG_TCH | |
18 | } |
|
18 | } | |
19 |
|
19 | |||
20 | contains( CONFIG, vhdl_dev ) { |
|
20 | contains( CONFIG, vhdl_dev ) { | |
21 | DEFINES += VHDL_DEV |
|
21 | DEFINES += VHDL_DEV | |
22 | } |
|
22 | } | |
23 |
|
23 | |||
24 | contains( CONFIG, verbose ) { |
|
24 | contains( CONFIG, verbose ) { | |
25 | DEFINES += PRINT_MESSAGES_ON_CONSOLE |
|
25 | DEFINES += PRINT_MESSAGES_ON_CONSOLE | |
26 | } |
|
26 | } | |
27 |
|
27 | |||
28 | contains( CONFIG, debug_messages ) { |
|
28 | contains( CONFIG, debug_messages ) { | |
29 | DEFINES += DEBUG_MESSAGES |
|
29 | DEFINES += DEBUG_MESSAGES | |
30 | } |
|
30 | } | |
31 |
|
31 | |||
32 | contains( CONFIG, cpu_usage_report ) { |
|
32 | contains( CONFIG, cpu_usage_report ) { | |
33 | DEFINES += PRINT_TASK_STATISTICS |
|
33 | DEFINES += PRINT_TASK_STATISTICS | |
34 | } |
|
34 | } | |
35 |
|
35 | |||
36 | contains( CONFIG, stack_report ) { |
|
36 | contains( CONFIG, stack_report ) { | |
37 | DEFINES += PRINT_STACK_REPORT |
|
37 | DEFINES += PRINT_STACK_REPORT | |
38 | } |
|
38 | } | |
39 |
|
39 | |||
40 | contains( CONFIG, boot_messages ) { |
|
40 | contains( CONFIG, boot_messages ) { | |
41 | DEFINES += BOOT_MESSAGES |
|
41 | DEFINES += BOOT_MESSAGES | |
42 | } |
|
42 | } | |
43 |
|
43 | |||
44 | #doxygen.target = doxygen |
|
44 | #doxygen.target = doxygen | |
45 | #doxygen.commands = doxygen ../doc/Doxyfile |
|
45 | #doxygen.commands = doxygen ../doc/Doxyfile | |
46 | #QMAKE_EXTRA_TARGETS += doxygen |
|
46 | #QMAKE_EXTRA_TARGETS += doxygen | |
47 |
|
47 | |||
48 | TARGET = fsw |
|
48 | TARGET = fsw | |
49 |
|
49 | |||
50 | INCLUDEPATH += \ |
|
50 | INCLUDEPATH += \ | |
51 | ../src \ |
|
51 | ../src \ | |
52 | ../header \ |
|
52 | ../header \ | |
53 | ../../LFR_basic-parameters |
|
53 | ../../LFR_basic-parameters | |
54 |
|
54 | |||
55 | SOURCES += \ |
|
55 | SOURCES += \ | |
56 | ../src/wf_handler.c \ |
|
56 | ../src/wf_handler.c \ | |
57 | ../src/tc_handler.c \ |
|
57 | ../src/tc_handler.c \ | |
58 | ../src/fsw_processing.c \ |
|
58 | ../src/fsw_processing.c \ | |
59 | ../src/fsw_misc.c \ |
|
59 | ../src/fsw_misc.c \ | |
60 | ../src/fsw_init.c \ |
|
60 | ../src/fsw_init.c \ | |
61 | ../src/fsw_globals.c \ |
|
61 | ../src/fsw_globals.c \ | |
62 | ../src/fsw_spacewire.c \ |
|
62 | ../src/fsw_spacewire.c \ | |
63 | ../src/tc_load_dump_parameters.c \ |
|
63 | ../src/tc_load_dump_parameters.c \ | |
64 | ../src/tm_lfr_tc_exe.c \ |
|
64 | ../src/tm_lfr_tc_exe.c \ | |
65 | ../src/tc_acceptance.c \ |
|
65 | ../src/tc_acceptance.c \ | |
66 | ../../LFR_basic-parameters/basic_parameters.c |
|
66 | ../../LFR_basic-parameters/basic_parameters.c | |
67 |
|
67 | |||
68 |
|
68 | |||
69 | HEADERS += \ |
|
69 | HEADERS += \ | |
70 | ../header/wf_handler.h \ |
|
70 | ../header/wf_handler.h \ | |
71 | ../header/tc_handler.h \ |
|
71 | ../header/tc_handler.h \ | |
72 | ../header/grlib_regs.h \ |
|
72 | ../header/grlib_regs.h \ | |
73 | ../header/fsw_processing.h \ |
|
73 | ../header/fsw_processing.h \ | |
74 | ../header/fsw_params.h \ |
|
74 | ../header/fsw_params.h \ | |
75 | ../header/fsw_misc.h \ |
|
75 | ../header/fsw_misc.h \ | |
76 | ../header/fsw_init.h \ |
|
76 | ../header/fsw_init.h \ | |
77 | ../header/ccsds_types.h \ |
|
77 | ../header/ccsds_types.h \ | |
78 | ../header/fsw_params_processing.h \ |
|
78 | ../header/fsw_params_processing.h \ | |
79 | ../header/fsw_spacewire.h \ |
|
79 | ../header/fsw_spacewire.h \ | |
80 | ../header/tc_load_dump_parameters.h \ |
|
80 | ../header/tc_load_dump_parameters.h \ | |
81 | ../header/tm_lfr_tc_exe.h \ |
|
81 | ../header/tm_lfr_tc_exe.h \ | |
82 | ../header/tc_acceptance.h \ |
|
82 | ../header/tc_acceptance.h \ | |
83 | ../header/fsw_params_nb_bytes.h \ |
|
83 | ../header/fsw_params_nb_bytes.h \ | |
84 | ../../LFR_basic-parameters/basic_parameters.h |
|
84 | ../../LFR_basic-parameters/basic_parameters.h | |
85 |
|
85 |
@@ -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.1, 2014-0 |
|
3 | <!-- Written by QtCreator 3.0.1, 2014-04-01T07:09:49. --> | |
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,610 +1,632 | |||||
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 | #define TC_PACKET_CAT 12 |
|
34 | #define TC_PACKET_CAT 12 | |
35 |
|
35 | |||
36 | // PACKET SEQUENCE CONTROL |
|
36 | // PACKET SEQUENCE CONTROL | |
37 | #define TM_PACKET_SEQ_CTRL_CONTINUATION 0x00 // [0000 0000] |
|
37 | #define TM_PACKET_SEQ_CTRL_CONTINUATION 0x00 // [0000 0000] | |
38 | #define TM_PACKET_SEQ_CTRL_FIRST 0x40 // [0100 0000] |
|
38 | #define TM_PACKET_SEQ_CTRL_FIRST 0x40 // [0100 0000] | |
39 | #define TM_PACKET_SEQ_CTRL_LAST 0x80 // [1000 0000] |
|
39 | #define TM_PACKET_SEQ_CTRL_LAST 0x80 // [1000 0000] | |
40 | #define TM_PACKET_SEQ_CTRL_STANDALONE 0xc0 // [1100 0000] |
|
40 | #define TM_PACKET_SEQ_CTRL_STANDALONE 0xc0 // [1100 0000] | |
41 | #define TM_PACKET_SEQ_CNT_DEFAULT 0x00 // [0000 0000] |
|
41 | #define TM_PACKET_SEQ_CNT_DEFAULT 0x00 // [0000 0000] | |
42 |
|
42 | |||
43 | // DESTINATION ID |
|
43 | // DESTINATION ID | |
44 | #define TM_DESTINATION_ID_GROUND 0 |
|
44 | #define TM_DESTINATION_ID_GROUND 0 | |
45 | #define TM_DESTINATION_ID_MISSION_TIMELINE 110 |
|
45 | #define TM_DESTINATION_ID_MISSION_TIMELINE 110 | |
46 | #define TM_DESTINATION_ID_TC_SEQUENCES 111 |
|
46 | #define TM_DESTINATION_ID_TC_SEQUENCES 111 | |
47 | #define TM_DESTINATION_ID_RECOVERY_ACTION_COMMAND 112 |
|
47 | #define TM_DESTINATION_ID_RECOVERY_ACTION_COMMAND 112 | |
48 | #define TM_DESTINATION_ID_BACKUP_MISSION_TIMELINE 113 |
|
48 | #define TM_DESTINATION_ID_BACKUP_MISSION_TIMELINE 113 | |
49 | #define TM_DESTINATION_ID_DIRECT_CMD 120 |
|
49 | #define TM_DESTINATION_ID_DIRECT_CMD 120 | |
50 | #define TM_DESTINATION_ID_SPARE_GRD_SRC1 121 |
|
50 | #define TM_DESTINATION_ID_SPARE_GRD_SRC1 121 | |
51 | #define TM_DESTINATION_ID_SPARE_GRD_SRC2 122 |
|
51 | #define TM_DESTINATION_ID_SPARE_GRD_SRC2 122 | |
52 | #define TM_DESTINATION_ID_OBCP 15 |
|
52 | #define TM_DESTINATION_ID_OBCP 15 | |
53 | #define TM_DESTINATION_ID_SYSTEM_CONTROL 14 |
|
53 | #define TM_DESTINATION_ID_SYSTEM_CONTROL 14 | |
54 | #define TM_DESTINATION_ID_AOCS 11 |
|
54 | #define TM_DESTINATION_ID_AOCS 11 | |
55 |
|
55 | |||
56 | #define CCSDS_DESTINATION_ID 0x01 |
|
56 | #define CCSDS_DESTINATION_ID 0x01 | |
57 | #define CCSDS_PROTOCOLE_ID 0x02 |
|
57 | #define CCSDS_PROTOCOLE_ID 0x02 | |
58 | #define CCSDS_RESERVED 0x00 |
|
58 | #define CCSDS_RESERVED 0x00 | |
59 | #define CCSDS_USER_APP 0x00 |
|
59 | #define CCSDS_USER_APP 0x00 | |
60 |
|
60 | |||
61 | #define SIZE_TM_LFR_TC_EXE_NOT_IMPLEMENTED 24 |
|
61 | #define SIZE_TM_LFR_TC_EXE_NOT_IMPLEMENTED 24 | |
62 | #define SIZE_TM_LFR_TC_EXE_CORRUPTED 32 |
|
62 | #define SIZE_TM_LFR_TC_EXE_CORRUPTED 32 | |
63 | #define SIZE_HK_PARAMETERS 112 |
|
63 | #define SIZE_HK_PARAMETERS 112 | |
64 |
|
64 | |||
65 | // TC TYPES |
|
65 | // TC TYPES | |
66 | #define TC_TYPE_GEN 181 |
|
66 | #define TC_TYPE_GEN 181 | |
67 | #define TC_TYPE_TIME 9 |
|
67 | #define TC_TYPE_TIME 9 | |
68 |
|
68 | |||
69 | // TC SUBTYPES |
|
69 | // TC SUBTYPES | |
70 | #define TC_SUBTYPE_RESET 1 |
|
70 | #define TC_SUBTYPE_RESET 1 | |
71 | #define TC_SUBTYPE_LOAD_COMM 11 |
|
71 | #define TC_SUBTYPE_LOAD_COMM 11 | |
72 | #define TC_SUBTYPE_LOAD_NORM 13 |
|
72 | #define TC_SUBTYPE_LOAD_NORM 13 | |
73 | #define TC_SUBTYPE_LOAD_BURST 19 |
|
73 | #define TC_SUBTYPE_LOAD_BURST 19 | |
74 | #define TC_SUBTYPE_LOAD_SBM1 25 |
|
74 | #define TC_SUBTYPE_LOAD_SBM1 25 | |
75 | #define TC_SUBTYPE_LOAD_SBM2 27 |
|
75 | #define TC_SUBTYPE_LOAD_SBM2 27 | |
76 | #define TC_SUBTYPE_DUMP 31 |
|
76 | #define TC_SUBTYPE_DUMP 31 | |
77 | #define TC_SUBTYPE_ENTER 41 |
|
77 | #define TC_SUBTYPE_ENTER 41 | |
78 | #define TC_SUBTYPE_UPDT_INFO 51 |
|
78 | #define TC_SUBTYPE_UPDT_INFO 51 | |
79 | #define TC_SUBTYPE_EN_CAL 61 |
|
79 | #define TC_SUBTYPE_EN_CAL 61 | |
80 | #define TC_SUBTYPE_DIS_CAL 63 |
|
80 | #define TC_SUBTYPE_DIS_CAL 63 | |
81 | #define TC_SUBTYPE_UPDT_TIME 129 |
|
81 | #define TC_SUBTYPE_UPDT_TIME 129 | |
82 |
|
82 | |||
83 | // TC LEN |
|
83 | // TC LEN | |
84 | #define TC_LEN_RESET 12 |
|
84 | #define TC_LEN_RESET 12 | |
85 | #define TC_LEN_LOAD_COMM 14 |
|
85 | #define TC_LEN_LOAD_COMM 14 | |
86 | #define TC_LEN_LOAD_NORM 22 |
|
86 | #define TC_LEN_LOAD_NORM 22 | |
87 | #define TC_LEN_LOAD_BURST 14 |
|
87 | #define TC_LEN_LOAD_BURST 14 | |
88 | #define TC_LEN_LOAD_SBM1 14 |
|
88 | #define TC_LEN_LOAD_SBM1 14 | |
89 | #define TC_LEN_LOAD_SBM2 14 |
|
89 | #define TC_LEN_LOAD_SBM2 14 | |
90 | #define TC_LEN_DUMP 12 |
|
90 | #define TC_LEN_DUMP 12 | |
91 | #define TC_LEN_ENTER 20 |
|
91 | #define TC_LEN_ENTER 20 | |
92 | #define TC_LEN_UPDT_INFO 46 |
|
92 | #define TC_LEN_UPDT_INFO 46 | |
93 | #define TC_LEN_EN_CAL 12 |
|
93 | #define TC_LEN_EN_CAL 12 | |
94 | #define TC_LEN_DIS_CAL 12 |
|
94 | #define TC_LEN_DIS_CAL 12 | |
95 | #define TC_LEN_UPDT_TIME 18 |
|
95 | #define TC_LEN_UPDT_TIME 18 | |
96 |
|
96 | |||
97 | // TM TYPES |
|
97 | // TM TYPES | |
98 | #define TM_TYPE_TC_EXE 1 |
|
98 | #define TM_TYPE_TC_EXE 1 | |
99 | #define TM_TYPE_HK 3 |
|
99 | #define TM_TYPE_HK 3 | |
100 | #define TM_TYPE_PARAMETER_DUMP 3 |
|
100 | #define TM_TYPE_PARAMETER_DUMP 3 | |
101 | #define TM_TYPE_LFR_SCIENCE 21 |
|
101 | #define TM_TYPE_LFR_SCIENCE 21 | |
102 |
|
102 | |||
103 | // TM SUBTYPES |
|
103 | // TM SUBTYPES | |
104 | #define TM_SUBTYPE_EXE_OK 7 |
|
104 | #define TM_SUBTYPE_EXE_OK 7 | |
105 | #define TM_SUBTYPE_EXE_NOK 8 |
|
105 | #define TM_SUBTYPE_EXE_NOK 8 | |
106 | #define TM_SUBTYPE_HK 25 |
|
106 | #define TM_SUBTYPE_HK 25 | |
107 | #define TM_SUBTYPE_PARAMETER_DUMP 25 |
|
107 | #define TM_SUBTYPE_PARAMETER_DUMP 25 | |
108 | #define TM_SUBTYPE_SCIENCE 3 |
|
108 | #define TM_SUBTYPE_SCIENCE 3 | |
109 | #define TM_SUBTYPE_LFR_SCIENCE 3 |
|
109 | #define TM_SUBTYPE_LFR_SCIENCE 3 | |
110 |
|
110 | |||
111 | // FAILURE CODES |
|
111 | // FAILURE CODES | |
112 | #define ILLEGAL_APID 0 |
|
112 | #define ILLEGAL_APID 0 | |
113 | #define WRONG_LEN_PKT 1 |
|
113 | #define WRONG_LEN_PKT 1 | |
114 | #define INCOR_CHECKSUM 2 |
|
114 | #define INCOR_CHECKSUM 2 | |
115 | #define ILL_TYPE 3 |
|
115 | #define ILL_TYPE 3 | |
116 | #define ILL_SUBTYPE 4 |
|
116 | #define ILL_SUBTYPE 4 | |
117 | #define WRONG_APP_DATA 5 // 0x00 0x05 |
|
117 | #define WRONG_APP_DATA 5 // 0x00 0x05 | |
118 | #define TC_NOT_EXE 42000 // 0xa4 0x10 |
|
118 | #define TC_NOT_EXE 42000 // 0xa4 0x10 | |
119 | #define WRONG_SRC_ID 42001 // 0xa4 0x11 |
|
119 | #define WRONG_SRC_ID 42001 // 0xa4 0x11 | |
120 | #define FUNCT_NOT_IMPL 42002 // 0xa4 0x12 |
|
120 | #define FUNCT_NOT_IMPL 42002 // 0xa4 0x12 | |
121 | #define FAIL_DETECTED 42003 // 0xa4 0x13 |
|
121 | #define FAIL_DETECTED 42003 // 0xa4 0x13 | |
122 | #define NOT_ALLOWED 42004 // 0xa4 0x14 |
|
122 | #define NOT_ALLOWED 42004 // 0xa4 0x14 | |
123 | #define CORRUPTED 42005 // 0xa4 0x15 |
|
123 | #define CORRUPTED 42005 // 0xa4 0x15 | |
124 | #define CCSDS_TM_VALID 7 |
|
124 | #define CCSDS_TM_VALID 7 | |
125 |
|
125 | |||
126 | // TC SID |
|
126 | // TC SID | |
127 | #define SID_TC_GROUND 0 |
|
127 | #define SID_TC_GROUND 0 | |
128 | #define SID_TC_MISSION_TIMELINE 110 |
|
128 | #define SID_TC_MISSION_TIMELINE 110 | |
129 | #define SID_TC_TC_SEQUENCES 111 |
|
129 | #define SID_TC_TC_SEQUENCES 111 | |
130 | #define SID_TC_RECOVERY_ACTION_CMD 112 |
|
130 | #define SID_TC_RECOVERY_ACTION_CMD 112 | |
131 | #define SID_TC_BACKUP_MISSION_TIMELINE 113 |
|
131 | #define SID_TC_BACKUP_MISSION_TIMELINE 113 | |
132 | #define SID_TC_DIRECT_CMD 120 |
|
132 | #define SID_TC_DIRECT_CMD 120 | |
133 | #define SID_TC_SPARE_GRD_SRC1 121 |
|
133 | #define SID_TC_SPARE_GRD_SRC1 121 | |
134 | #define SID_TC_SPARE_GRD_SRC2 122 |
|
134 | #define SID_TC_SPARE_GRD_SRC2 122 | |
135 | #define SID_TC_OBCP 15 |
|
135 | #define SID_TC_OBCP 15 | |
136 | #define SID_TC_SYSTEM_CONTROL 14 |
|
136 | #define SID_TC_SYSTEM_CONTROL 14 | |
137 | #define SID_TC_AOCS 11 |
|
137 | #define SID_TC_AOCS 11 | |
138 | #define SID_TC_RPW_INTERNAL 254 |
|
138 | #define SID_TC_RPW_INTERNAL 254 | |
139 |
|
139 | |||
140 | enum apid_destid{ |
|
140 | enum apid_destid{ | |
141 | GROUND, |
|
141 | GROUND, | |
142 | MISSION_TIMELINE, |
|
142 | MISSION_TIMELINE, | |
143 | TC_SEQUENCES, |
|
143 | TC_SEQUENCES, | |
144 | RECOVERY_ACTION_CMD, |
|
144 | RECOVERY_ACTION_CMD, | |
145 | BACKUP_MISSION_TIMELINE, |
|
145 | BACKUP_MISSION_TIMELINE, | |
146 | DIRECT_CMD, |
|
146 | DIRECT_CMD, | |
147 | SPARE_GRD_SRC1, |
|
147 | SPARE_GRD_SRC1, | |
148 | SPARE_GRD_SRC2, |
|
148 | SPARE_GRD_SRC2, | |
149 | OBCP, |
|
149 | OBCP, | |
150 | SYSTEM_CONTROL, |
|
150 | SYSTEM_CONTROL, | |
151 | AOCS, |
|
151 | AOCS, | |
152 | RPW_INTERNAL |
|
152 | RPW_INTERNAL | |
153 | }; |
|
153 | }; | |
154 | // SEQUENCE COUNTERS |
|
154 | // SEQUENCE COUNTERS | |
155 | #define SEQ_CNT_MAX 16383 |
|
155 | #define SEQ_CNT_MAX 16383 | |
156 | #define SEQ_CNT_NB_DEST_ID 12 |
|
156 | #define SEQ_CNT_NB_DEST_ID 12 | |
157 |
|
157 | |||
158 | // TM SID |
|
158 | // TM SID | |
159 | #define SID_HK 1 |
|
159 | #define SID_HK 1 | |
160 | #define SID_PARAMETER_DUMP 10 |
|
160 | #define SID_PARAMETER_DUMP 10 | |
161 |
|
161 | |||
162 | #define SID_NORM_SWF_F0 3 |
|
162 | #define SID_NORM_SWF_F0 3 | |
163 | #define SID_NORM_SWF_F1 4 |
|
163 | #define SID_NORM_SWF_F1 4 | |
164 | #define SID_NORM_SWF_F2 5 |
|
164 | #define SID_NORM_SWF_F2 5 | |
165 | #define SID_NORM_CWF_F3 1 |
|
165 | #define SID_NORM_CWF_F3 1 | |
166 | #define SID_BURST_CWF_F2 2 |
|
166 | #define SID_BURST_CWF_F2 2 | |
167 | #define SID_SBM1_CWF_F1 24 |
|
167 | #define SID_SBM1_CWF_F1 24 | |
168 | #define SID_SBM2_CWF_F2 25 |
|
168 | #define SID_SBM2_CWF_F2 25 | |
169 | #define SID_NORM_ASM_F0 11 |
|
169 | #define SID_NORM_ASM_F0 11 | |
170 | #define SID_NORM_ASM_F1 12 |
|
170 | #define SID_NORM_ASM_F1 12 | |
171 | #define SID_NORM_ASM_F2 13 |
|
171 | #define SID_NORM_ASM_F2 13 | |
172 | #define SID_NORM_BP1_F0 14 |
|
172 | #define SID_NORM_BP1_F0 14 | |
173 | #define SID_NORM_BP1_F1 15 |
|
173 | #define SID_NORM_BP1_F1 15 | |
174 | #define SID_NORM_BP1_F2 16 |
|
174 | #define SID_NORM_BP1_F2 16 | |
175 | #define SID_NORM_BP2_F0 19 |
|
175 | #define SID_NORM_BP2_F0 19 | |
176 | #define SID_NORM_BP2_F1 20 |
|
176 | #define SID_NORM_BP2_F1 20 | |
177 | #define SID_NORM_BP2_F2 21 |
|
177 | #define SID_NORM_BP2_F2 21 | |
178 | #define SID_BURST_BP1_F0 17 |
|
178 | #define SID_BURST_BP1_F0 17 | |
179 | #define SID_BURST_BP2_F0 22 |
|
179 | #define SID_BURST_BP2_F0 22 | |
180 | #define SID_BURST_BP1_F1 18 |
|
180 | #define SID_BURST_BP1_F1 18 | |
181 | #define SID_BURST_BP2_F1 23 |
|
181 | #define SID_BURST_BP2_F1 23 | |
182 | #define SID_SBM1_BP1_F0 28 |
|
182 | #define SID_SBM1_BP1_F0 28 | |
183 | #define SID_SBM1_BP2_F0 31 |
|
183 | #define SID_SBM1_BP2_F0 31 | |
184 | #define SID_SBM2_BP1_F0 29 |
|
184 | #define SID_SBM2_BP1_F0 29 | |
185 | #define SID_SBM2_BP2_F0 32 |
|
185 | #define SID_SBM2_BP2_F0 32 | |
186 | #define SID_SBM2_BP1_F1 30 |
|
186 | #define SID_SBM2_BP1_F1 30 | |
187 | #define SID_SBM2_BP2_F1 33 |
|
187 | #define SID_SBM2_BP2_F1 33 | |
188 | #define SID_NORM_CWF_LONG_F3 34 |
|
188 | #define SID_NORM_CWF_LONG_F3 34 | |
189 |
|
189 | |||
190 | // LENGTH (BYTES) |
|
190 | // LENGTH (BYTES) | |
191 | #define LENGTH_TM_LFR_TC_EXE_MAX 32 |
|
191 | #define LENGTH_TM_LFR_TC_EXE_MAX 32 | |
192 | #define LENGTH_TM_LFR_HK 126 |
|
192 | #define LENGTH_TM_LFR_HK 126 | |
193 |
|
193 | |||
194 | // HEADER_LENGTH |
|
194 | // HEADER_LENGTH | |
195 | #define TM_HEADER_LEN 16 |
|
195 | #define TM_HEADER_LEN 16 | |
196 | #define HEADER_LENGTH_TM_LFR_SCIENCE_ASM 28 |
|
196 | #define HEADER_LENGTH_TM_LFR_SCIENCE_ASM 28 | |
197 | // PACKET_LENGTH |
|
197 | // PACKET_LENGTH | |
198 | #define PACKET_LENGTH_TC_EXE_SUCCESS (20 - CCSDS_TC_TM_PACKET_OFFSET) |
|
198 | #define PACKET_LENGTH_TC_EXE_SUCCESS (20 - CCSDS_TC_TM_PACKET_OFFSET) | |
199 | #define PACKET_LENGTH_TC_EXE_INCONSISTENT (26 - CCSDS_TC_TM_PACKET_OFFSET) |
|
199 | #define PACKET_LENGTH_TC_EXE_INCONSISTENT (26 - CCSDS_TC_TM_PACKET_OFFSET) | |
200 | #define PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE (26 - CCSDS_TC_TM_PACKET_OFFSET) |
|
200 | #define PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE (26 - CCSDS_TC_TM_PACKET_OFFSET) | |
201 | #define PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED (24 - CCSDS_TC_TM_PACKET_OFFSET) |
|
201 | #define PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED (24 - CCSDS_TC_TM_PACKET_OFFSET) | |
202 | #define PACKET_LENGTH_TC_EXE_ERROR (24 - CCSDS_TC_TM_PACKET_OFFSET) |
|
202 | #define PACKET_LENGTH_TC_EXE_ERROR (24 - CCSDS_TC_TM_PACKET_OFFSET) | |
203 | #define PACKET_LENGTH_TC_EXE_CORRUPTED (32 - CCSDS_TC_TM_PACKET_OFFSET) |
|
203 | #define PACKET_LENGTH_TC_EXE_CORRUPTED (32 - CCSDS_TC_TM_PACKET_OFFSET) | |
204 | #define PACKET_LENGTH_HK (124 - CCSDS_TC_TM_PACKET_OFFSET) |
|
204 | #define PACKET_LENGTH_HK (124 - CCSDS_TC_TM_PACKET_OFFSET) | |
205 | #define PACKET_LENGTH_PARAMETER_DUMP (36 - CCSDS_TC_TM_PACKET_OFFSET) |
|
205 | #define PACKET_LENGTH_PARAMETER_DUMP (36 - CCSDS_TC_TM_PACKET_OFFSET) | |
206 | #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0 2221 // 44 * 25 * 2 + 28 - 7 |
|
206 | #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0 2221 // 44 * 25 * 2 + 28 - 7 | |
207 | #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F1 2621 // 52 * 25 * 2 + 28 - 7 |
|
207 | #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F1 2621 // 52 * 25 * 2 + 28 - 7 | |
208 | #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F2 2421 // 48 * 25 * 2 + 28 - 7 |
|
208 | #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F2 2421 // 48 * 25 * 2 + 28 - 7 | |
209 |
|
209 | |||
210 | #define SPARE1_PUSVERSION_SPARE2 0x10 |
|
210 | #define SPARE1_PUSVERSION_SPARE2 0x10 | |
211 |
|
211 | |||
212 | // R1 |
|
212 | // R1 | |
213 | #define TM_LEN_SCI_SWF_340 4101 // 340 * 12 + 10 + 12 - 1 |
|
213 | #define TM_LEN_SCI_SWF_340 4101 // 340 * 12 + 10 + 12 - 1 | |
214 | #define TM_LEN_SCI_SWF_8 117 // 8 * 12 + 10 + 12 - 1 |
|
214 | #define TM_LEN_SCI_SWF_8 117 // 8 * 12 + 10 + 12 - 1 | |
215 | #define TM_LEN_SCI_CWF_340 4099 // 340 * 12 + 10 + 10 - 1 |
|
215 | #define TM_LEN_SCI_CWF_340 4099 // 340 * 12 + 10 + 10 - 1 | |
216 | #define TM_LEN_SCI_CWF_8 115 // 8 * 12 + 10 + 10 - 1 |
|
216 | #define TM_LEN_SCI_CWF_8 115 // 8 * 12 + 10 + 10 - 1 | |
217 | #define TM_LEN_SCI_CWF3_LIGHT_340 2059 // 340 * 6 + 10 + 10 - 1 |
|
217 | #define TM_LEN_SCI_CWF3_LIGHT_340 2059 // 340 * 6 + 10 + 10 - 1 | |
218 | #define TM_LEN_SCI_CWF3_LIGHT_8 67 // 8 * 6 + 10 + 10 - 1 |
|
218 | #define TM_LEN_SCI_CWF3_LIGHT_8 67 // 8 * 6 + 10 + 10 - 1 | |
219 | // R2 |
|
219 | // R2 | |
220 | #define TM_LEN_SCI_SWF_304 3669 // 304 * 12 + 10 + 12 - 1 |
|
220 | #define TM_LEN_SCI_SWF_304 3669 // 304 * 12 + 10 + 12 - 1 | |
221 | #define TM_LEN_SCI_SWF_224 2709 // 224 * 12 + 10 + 12 - 1 |
|
221 | #define TM_LEN_SCI_SWF_224 2709 // 224 * 12 + 10 + 12 - 1 | |
222 | #define TM_LEN_SCI_CWF_336 4051 // 336 * 12 + 10 + 10 - 1 |
|
222 | #define TM_LEN_SCI_CWF_336 4051 // 336 * 12 + 10 + 10 - 1 | |
223 | #define TM_LEN_SCI_CWF_672 4051 // 672 * 6 + 10 + 10 - 1 |
|
223 | #define TM_LEN_SCI_CWF_672 4051 // 672 * 6 + 10 + 10 - 1 | |
224 | // |
|
224 | // | |
225 | #define DEFAULT_PKTCNT 0x07 |
|
225 | #define DEFAULT_PKTCNT 0x07 | |
226 | #define BLK_NR_304 0x0130 |
|
226 | #define BLK_NR_304 0x0130 | |
227 | #define BLK_NR_224 0x00e0 |
|
227 | #define BLK_NR_224 0x00e0 | |
228 | #define BLK_NR_CWF 0x0150 // 336 |
|
228 | #define BLK_NR_CWF 0x0150 // 336 | |
229 | #define BLK_NR_CWF_SHORT_F3 0x02a0 // 672 |
|
229 | #define BLK_NR_CWF_SHORT_F3 0x02a0 // 672 | |
230 |
|
230 | |||
231 | enum TM_TYPE{ |
|
231 | enum TM_TYPE{ | |
232 | TM_LFR_TC_EXE_OK, |
|
232 | TM_LFR_TC_EXE_OK, | |
233 | TM_LFR_TC_EXE_ERR, |
|
233 | TM_LFR_TC_EXE_ERR, | |
234 | TM_LFR_HK, |
|
234 | TM_LFR_HK, | |
235 | TM_LFR_SCI, |
|
235 | TM_LFR_SCI, | |
236 | TM_LFR_SCI_SBM, |
|
236 | TM_LFR_SCI_SBM, | |
237 | TM_LFR_PAR_DUMP |
|
237 | TM_LFR_PAR_DUMP | |
238 | }; |
|
238 | }; | |
239 |
|
239 | |||
240 | typedef struct { |
|
240 | typedef struct { | |
241 | unsigned char targetLogicalAddress; |
|
241 | unsigned char targetLogicalAddress; | |
242 | unsigned char protocolIdentifier; |
|
242 | unsigned char protocolIdentifier; | |
243 | unsigned char reserved; |
|
243 | unsigned char reserved; | |
244 | unsigned char userApplication; |
|
244 | unsigned char userApplication; | |
245 | // PACKET HEADER |
|
245 | // PACKET HEADER | |
246 | unsigned char packetID[2]; |
|
246 | unsigned char packetID[2]; | |
247 | unsigned char packetSequenceControl[2]; |
|
247 | unsigned char packetSequenceControl[2]; | |
248 | unsigned char packetLength[2]; |
|
248 | unsigned char packetLength[2]; | |
249 | // DATA FIELD HEADER |
|
249 | // DATA FIELD HEADER | |
250 | unsigned char spare1_pusVersion_spare2; |
|
250 | unsigned char spare1_pusVersion_spare2; | |
251 | unsigned char serviceType; |
|
251 | unsigned char serviceType; | |
252 | unsigned char serviceSubType; |
|
252 | unsigned char serviceSubType; | |
253 | unsigned char destinationID; |
|
253 | unsigned char destinationID; | |
254 | unsigned char time[6]; |
|
254 | unsigned char time[6]; | |
255 | // |
|
255 | // | |
256 | unsigned char telecommand_pkt_id[2]; |
|
256 | unsigned char telecommand_pkt_id[2]; | |
257 | unsigned char pkt_seq_control[2]; |
|
257 | unsigned char pkt_seq_control[2]; | |
258 | } Packet_TM_LFR_TC_EXE_SUCCESS_t; |
|
258 | } Packet_TM_LFR_TC_EXE_SUCCESS_t; | |
259 |
|
259 | |||
260 | typedef struct { |
|
260 | typedef struct { | |
261 | unsigned char targetLogicalAddress; |
|
261 | unsigned char targetLogicalAddress; | |
262 | unsigned char protocolIdentifier; |
|
262 | unsigned char protocolIdentifier; | |
263 | unsigned char reserved; |
|
263 | unsigned char reserved; | |
264 | unsigned char userApplication; |
|
264 | unsigned char userApplication; | |
265 | // PACKET HEADER |
|
265 | // PACKET HEADER | |
266 | unsigned char packetID[2]; |
|
266 | unsigned char packetID[2]; | |
267 | unsigned char packetSequenceControl[2]; |
|
267 | unsigned char packetSequenceControl[2]; | |
268 | unsigned char packetLength[2]; |
|
268 | unsigned char packetLength[2]; | |
269 | // DATA FIELD HEADER |
|
269 | // DATA FIELD HEADER | |
270 | unsigned char spare1_pusVersion_spare2; |
|
270 | unsigned char spare1_pusVersion_spare2; | |
271 | unsigned char serviceType; |
|
271 | unsigned char serviceType; | |
272 | unsigned char serviceSubType; |
|
272 | unsigned char serviceSubType; | |
273 | unsigned char destinationID; |
|
273 | unsigned char destinationID; | |
274 | unsigned char time[6]; |
|
274 | unsigned char time[6]; | |
275 | // |
|
275 | // | |
276 | unsigned char tc_failure_code[2]; |
|
276 | unsigned char tc_failure_code[2]; | |
277 | unsigned char telecommand_pkt_id[2]; |
|
277 | unsigned char telecommand_pkt_id[2]; | |
278 | unsigned char pkt_seq_control[2]; |
|
278 | unsigned char pkt_seq_control[2]; | |
279 | unsigned char tc_service; |
|
279 | unsigned char tc_service; | |
280 | unsigned char tc_subtype; |
|
280 | unsigned char tc_subtype; | |
281 | unsigned char byte_position; |
|
281 | unsigned char byte_position; | |
282 | unsigned char rcv_value; |
|
282 | unsigned char rcv_value; | |
283 | } Packet_TM_LFR_TC_EXE_INCONSISTENT_t; |
|
283 | } Packet_TM_LFR_TC_EXE_INCONSISTENT_t; | |
284 |
|
284 | |||
285 | typedef struct { |
|
285 | typedef struct { | |
286 | unsigned char targetLogicalAddress; |
|
286 | unsigned char targetLogicalAddress; | |
287 | unsigned char protocolIdentifier; |
|
287 | unsigned char protocolIdentifier; | |
288 | unsigned char reserved; |
|
288 | unsigned char reserved; | |
289 | unsigned char userApplication; |
|
289 | unsigned char userApplication; | |
290 | // PACKET HEADER |
|
290 | // PACKET HEADER | |
291 | unsigned char packetID[2]; |
|
291 | unsigned char packetID[2]; | |
292 | unsigned char packetSequenceControl[2]; |
|
292 | unsigned char packetSequenceControl[2]; | |
293 | unsigned char packetLength[2]; |
|
293 | unsigned char packetLength[2]; | |
294 | // DATA FIELD HEADER |
|
294 | // DATA FIELD HEADER | |
295 | unsigned char spare1_pusVersion_spare2; |
|
295 | unsigned char spare1_pusVersion_spare2; | |
296 | unsigned char serviceType; |
|
296 | unsigned char serviceType; | |
297 | unsigned char serviceSubType; |
|
297 | unsigned char serviceSubType; | |
298 | unsigned char destinationID; |
|
298 | unsigned char destinationID; | |
299 | unsigned char time[6]; |
|
299 | unsigned char time[6]; | |
300 | // |
|
300 | // | |
301 | unsigned char tc_failure_code[2]; |
|
301 | unsigned char tc_failure_code[2]; | |
302 | unsigned char telecommand_pkt_id[2]; |
|
302 | unsigned char telecommand_pkt_id[2]; | |
303 | unsigned char pkt_seq_control[2]; |
|
303 | unsigned char pkt_seq_control[2]; | |
304 | unsigned char tc_service; |
|
304 | unsigned char tc_service; | |
305 | unsigned char tc_subtype; |
|
305 | unsigned char tc_subtype; | |
306 | unsigned char lfr_status_word[2]; |
|
306 | unsigned char lfr_status_word[2]; | |
307 | } Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t; |
|
307 | } Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t; | |
308 |
|
308 | |||
309 | typedef struct { |
|
309 | typedef struct { | |
310 | unsigned char targetLogicalAddress; |
|
310 | unsigned char targetLogicalAddress; | |
311 | unsigned char protocolIdentifier; |
|
311 | unsigned char protocolIdentifier; | |
312 | unsigned char reserved; |
|
312 | unsigned char reserved; | |
313 | unsigned char userApplication; |
|
313 | unsigned char userApplication; | |
314 | // PACKET HEADER |
|
314 | // PACKET HEADER | |
315 | unsigned char packetID[2]; |
|
315 | unsigned char packetID[2]; | |
316 | unsigned char packetSequenceControl[2]; |
|
316 | unsigned char packetSequenceControl[2]; | |
317 | unsigned char packetLength[2]; |
|
317 | unsigned char packetLength[2]; | |
318 | // DATA FIELD HEADER |
|
318 | // DATA FIELD HEADER | |
319 | unsigned char spare1_pusVersion_spare2; |
|
319 | unsigned char spare1_pusVersion_spare2; | |
320 | unsigned char serviceType; |
|
320 | unsigned char serviceType; | |
321 | unsigned char serviceSubType; |
|
321 | unsigned char serviceSubType; | |
322 | unsigned char destinationID; |
|
322 | unsigned char destinationID; | |
323 | unsigned char time[6]; |
|
323 | unsigned char time[6]; | |
324 | // |
|
324 | // | |
325 | unsigned char tc_failure_code[2]; |
|
325 | unsigned char tc_failure_code[2]; | |
326 | unsigned char telecommand_pkt_id[2]; |
|
326 | unsigned char telecommand_pkt_id[2]; | |
327 | unsigned char pkt_seq_control[2]; |
|
327 | unsigned char pkt_seq_control[2]; | |
328 | unsigned char tc_service; |
|
328 | unsigned char tc_service; | |
329 | unsigned char tc_subtype; |
|
329 | unsigned char tc_subtype; | |
330 | } Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t; |
|
330 | } Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t; | |
331 |
|
331 | |||
332 | typedef struct { |
|
332 | typedef struct { | |
333 | unsigned char targetLogicalAddress; |
|
333 | unsigned char targetLogicalAddress; | |
334 | unsigned char protocolIdentifier; |
|
334 | unsigned char protocolIdentifier; | |
335 | unsigned char reserved; |
|
335 | unsigned char reserved; | |
336 | unsigned char userApplication; |
|
336 | unsigned char userApplication; | |
337 | // PACKET HEADER |
|
337 | // PACKET HEADER | |
338 | unsigned char packetID[2]; |
|
338 | unsigned char packetID[2]; | |
339 | unsigned char packetSequenceControl[2]; |
|
339 | unsigned char packetSequenceControl[2]; | |
340 | unsigned char packetLength[2]; |
|
340 | unsigned char packetLength[2]; | |
341 | // DATA FIELD HEADER |
|
341 | // DATA FIELD HEADER | |
342 | unsigned char spare1_pusVersion_spare2; |
|
342 | unsigned char spare1_pusVersion_spare2; | |
343 | unsigned char serviceType; |
|
343 | unsigned char serviceType; | |
344 | unsigned char serviceSubType; |
|
344 | unsigned char serviceSubType; | |
345 | unsigned char destinationID; |
|
345 | unsigned char destinationID; | |
346 | unsigned char time[6]; |
|
346 | unsigned char time[6]; | |
347 | // |
|
347 | // | |
348 | unsigned char tc_failure_code[2]; |
|
348 | unsigned char tc_failure_code[2]; | |
349 | unsigned char telecommand_pkt_id[2]; |
|
349 | unsigned char telecommand_pkt_id[2]; | |
350 | unsigned char pkt_seq_control[2]; |
|
350 | unsigned char pkt_seq_control[2]; | |
351 | unsigned char tc_service; |
|
351 | unsigned char tc_service; | |
352 | unsigned char tc_subtype; |
|
352 | unsigned char tc_subtype; | |
353 | } Packet_TM_LFR_TC_EXE_ERROR_t; |
|
353 | } Packet_TM_LFR_TC_EXE_ERROR_t; | |
354 |
|
354 | |||
355 | typedef struct { |
|
355 | typedef struct { | |
356 | unsigned char targetLogicalAddress; |
|
356 | unsigned char targetLogicalAddress; | |
357 | unsigned char protocolIdentifier; |
|
357 | unsigned char protocolIdentifier; | |
358 | unsigned char reserved; |
|
358 | unsigned char reserved; | |
359 | unsigned char userApplication; |
|
359 | unsigned char userApplication; | |
360 | // PACKET HEADER |
|
360 | // PACKET HEADER | |
361 | unsigned char packetID[2]; |
|
361 | unsigned char packetID[2]; | |
362 | unsigned char packetSequenceControl[2]; |
|
362 | unsigned char packetSequenceControl[2]; | |
363 | unsigned char packetLength[2]; |
|
363 | unsigned char packetLength[2]; | |
364 | // DATA FIELD HEADER |
|
364 | // DATA FIELD HEADER | |
365 | unsigned char spare1_pusVersion_spare2; |
|
365 | unsigned char spare1_pusVersion_spare2; | |
366 | unsigned char serviceType; |
|
366 | unsigned char serviceType; | |
367 | unsigned char serviceSubType; |
|
367 | unsigned char serviceSubType; | |
368 | unsigned char destinationID; |
|
368 | unsigned char destinationID; | |
369 | unsigned char time[6]; |
|
369 | unsigned char time[6]; | |
370 | // |
|
370 | // | |
371 | unsigned char tc_failure_code[2]; |
|
371 | unsigned char tc_failure_code[2]; | |
372 | unsigned char telecommand_pkt_id[2]; |
|
372 | unsigned char telecommand_pkt_id[2]; | |
373 | unsigned char pkt_seq_control[2]; |
|
373 | unsigned char pkt_seq_control[2]; | |
374 | unsigned char tc_service; |
|
374 | unsigned char tc_service; | |
375 | unsigned char tc_subtype; |
|
375 | unsigned char tc_subtype; | |
376 | unsigned char pkt_len_rcv_value[2]; |
|
376 | unsigned char pkt_len_rcv_value[2]; | |
377 | unsigned char pkt_datafieldsize_cnt[2]; |
|
377 | unsigned char pkt_datafieldsize_cnt[2]; | |
378 | unsigned char rcv_crc[2]; |
|
378 | unsigned char rcv_crc[2]; | |
379 | unsigned char computed_crc[2]; |
|
379 | unsigned char computed_crc[2]; | |
380 | } Packet_TM_LFR_TC_EXE_CORRUPTED_t; |
|
380 | } Packet_TM_LFR_TC_EXE_CORRUPTED_t; | |
381 |
|
381 | |||
382 | typedef struct { |
|
382 | typedef struct { | |
383 | unsigned char targetLogicalAddress; |
|
383 | unsigned char targetLogicalAddress; | |
384 | unsigned char protocolIdentifier; |
|
384 | unsigned char protocolIdentifier; | |
385 | unsigned char reserved; |
|
385 | unsigned char reserved; | |
386 | unsigned char userApplication; |
|
386 | unsigned char userApplication; | |
387 | unsigned char packetID[2]; |
|
387 | unsigned char packetID[2]; | |
388 | unsigned char packetSequenceControl[2]; |
|
388 | unsigned char packetSequenceControl[2]; | |
389 | unsigned char packetLength[2]; |
|
389 | unsigned char packetLength[2]; | |
390 | // DATA FIELD HEADER |
|
390 | // DATA FIELD HEADER | |
391 | unsigned char spare1_pusVersion_spare2; |
|
391 | unsigned char spare1_pusVersion_spare2; | |
392 | unsigned char serviceType; |
|
392 | unsigned char serviceType; | |
393 | unsigned char serviceSubType; |
|
393 | unsigned char serviceSubType; | |
394 | unsigned char destinationID; |
|
394 | unsigned char destinationID; | |
395 | unsigned char time[6]; |
|
395 | unsigned char time[6]; | |
396 | // AUXILIARY HEADER |
|
396 | // AUXILIARY HEADER | |
397 | unsigned char sid; |
|
397 | unsigned char sid; | |
398 | unsigned char hkBIA; |
|
398 | unsigned char hkBIA; | |
399 | unsigned char pktCnt; |
|
399 | unsigned char pktCnt; | |
400 | unsigned char pktNr; |
|
400 | unsigned char pktNr; | |
401 | unsigned char acquisitionTime[6]; |
|
401 | unsigned char acquisitionTime[6]; | |
402 | unsigned char blkNr[2]; |
|
402 | unsigned char blkNr[2]; | |
403 | } Header_TM_LFR_SCIENCE_SWF_t; |
|
403 | } Header_TM_LFR_SCIENCE_SWF_t; | |
404 |
|
404 | |||
405 | typedef struct { |
|
405 | typedef struct { | |
406 | unsigned char targetLogicalAddress; |
|
406 | unsigned char targetLogicalAddress; | |
407 | unsigned char protocolIdentifier; |
|
407 | unsigned char protocolIdentifier; | |
408 | unsigned char reserved; |
|
408 | unsigned char reserved; | |
409 | unsigned char userApplication; |
|
409 | unsigned char userApplication; | |
410 | unsigned char packetID[2]; |
|
410 | unsigned char packetID[2]; | |
411 | unsigned char packetSequenceControl[2]; |
|
411 | unsigned char packetSequenceControl[2]; | |
412 | unsigned char packetLength[2]; |
|
412 | unsigned char packetLength[2]; | |
413 | // DATA FIELD HEADER |
|
413 | // DATA FIELD HEADER | |
414 | unsigned char spare1_pusVersion_spare2; |
|
414 | unsigned char spare1_pusVersion_spare2; | |
415 | unsigned char serviceType; |
|
415 | unsigned char serviceType; | |
416 | unsigned char serviceSubType; |
|
416 | unsigned char serviceSubType; | |
417 | unsigned char destinationID; |
|
417 | unsigned char destinationID; | |
418 | unsigned char time[6]; |
|
418 | unsigned char time[6]; | |
419 | // AUXILIARY DATA HEADER |
|
419 | // AUXILIARY DATA HEADER | |
420 | unsigned char sid; |
|
420 | unsigned char sid; | |
421 | unsigned char hkBIA; |
|
421 | unsigned char hkBIA; | |
422 | unsigned char acquisitionTime[6]; |
|
422 | unsigned char acquisitionTime[6]; | |
423 | unsigned char blkNr[2]; |
|
423 | unsigned char blkNr[2]; | |
424 | } Header_TM_LFR_SCIENCE_CWF_t; |
|
424 | } Header_TM_LFR_SCIENCE_CWF_t; | |
425 |
|
425 | |||
426 | typedef struct { |
|
426 | typedef struct { | |
427 | unsigned char targetLogicalAddress; |
|
427 | unsigned char targetLogicalAddress; | |
428 | unsigned char protocolIdentifier; |
|
428 | unsigned char protocolIdentifier; | |
429 | unsigned char reserved; |
|
429 | unsigned char reserved; | |
430 | unsigned char userApplication; |
|
430 | unsigned char userApplication; | |
431 | unsigned char packetID[2]; |
|
431 | unsigned char packetID[2]; | |
432 | unsigned char packetSequenceControl[2]; |
|
432 | unsigned char packetSequenceControl[2]; | |
433 | unsigned char packetLength[2]; |
|
433 | unsigned char packetLength[2]; | |
434 | // DATA FIELD HEADER |
|
434 | // DATA FIELD HEADER | |
435 | unsigned char spare1_pusVersion_spare2; |
|
435 | unsigned char spare1_pusVersion_spare2; | |
436 | unsigned char serviceType; |
|
436 | unsigned char serviceType; | |
437 | unsigned char serviceSubType; |
|
437 | unsigned char serviceSubType; | |
438 | unsigned char destinationID; |
|
438 | unsigned char destinationID; | |
439 | unsigned char time[6]; |
|
439 | unsigned char time[6]; | |
440 | // AUXILIARY HEADER |
|
440 | // AUXILIARY HEADER | |
441 | unsigned char sid; |
|
441 | unsigned char sid; | |
442 | unsigned char biaStatusInfo; |
|
442 | unsigned char biaStatusInfo; | |
443 | unsigned char pa_lfr_pkt_cnt_asm; |
|
443 | unsigned char pa_lfr_pkt_cnt_asm; | |
444 | unsigned char pa_lfr_pkt_nr_asm; |
|
444 | unsigned char pa_lfr_pkt_nr_asm; | |
445 | unsigned char acquisitionTime[6]; |
|
445 | unsigned char acquisitionTime[6]; | |
446 | unsigned char pa_lfr_asm_blk_nr[2]; |
|
446 | unsigned char pa_lfr_asm_blk_nr[2]; | |
447 | } Header_TM_LFR_SCIENCE_ASM_t; |
|
447 | } Header_TM_LFR_SCIENCE_ASM_t; | |
448 |
|
448 | |||
449 | typedef struct { |
|
449 | typedef struct { | |
|
450 | unsigned char targetLogicalAddress; | |||
|
451 | unsigned char protocolIdentifier; | |||
|
452 | unsigned char reserved; | |||
|
453 | unsigned char userApplication; | |||
|
454 | unsigned char packetID[2]; | |||
|
455 | unsigned char packetSequenceControl[2]; | |||
|
456 | unsigned char packetLength[2]; | |||
|
457 | // DATA FIELD HEADER | |||
|
458 | unsigned char spare1_pusVersion_spare2; | |||
|
459 | unsigned char serviceType; | |||
|
460 | unsigned char serviceSubType; | |||
|
461 | unsigned char destinationID; | |||
|
462 | unsigned char time[6]; | |||
|
463 | // AUXILIARY HEADER | |||
|
464 | unsigned char sid; | |||
|
465 | unsigned char biaStatusInfo; | |||
|
466 | unsigned char acquisitionTime[6]; | |||
|
467 | unsigned char spare_source_data; | |||
|
468 | unsigned char pa_lfr_bp_blk_nr[2]; | |||
|
469 | } Header_TM_LFR_SCIENCE_BP_t; | |||
|
470 | ||||
|
471 | typedef struct { | |||
450 | //targetLogicalAddress is removed by the grspw module |
|
472 | //targetLogicalAddress is removed by the grspw module | |
451 | unsigned char protocolIdentifier; |
|
473 | unsigned char protocolIdentifier; | |
452 | unsigned char reserved; |
|
474 | unsigned char reserved; | |
453 | unsigned char userApplication; |
|
475 | unsigned char userApplication; | |
454 | unsigned char packetID[2]; |
|
476 | unsigned char packetID[2]; | |
455 | unsigned char packetSequenceControl[2]; |
|
477 | unsigned char packetSequenceControl[2]; | |
456 | unsigned char packetLength[2]; |
|
478 | unsigned char packetLength[2]; | |
457 | // DATA FIELD HEADER |
|
479 | // DATA FIELD HEADER | |
458 | unsigned char headerFlag_pusVersion_Ack; |
|
480 | unsigned char headerFlag_pusVersion_Ack; | |
459 | unsigned char serviceType; |
|
481 | unsigned char serviceType; | |
460 | unsigned char serviceSubType; |
|
482 | unsigned char serviceSubType; | |
461 | unsigned char sourceID; |
|
483 | unsigned char sourceID; | |
462 | unsigned char dataAndCRC[CCSDS_TC_PKT_MAX_SIZE-10]; |
|
484 | unsigned char dataAndCRC[CCSDS_TC_PKT_MAX_SIZE-10]; | |
463 | } ccsdsTelecommandPacket_t; |
|
485 | } ccsdsTelecommandPacket_t; | |
464 |
|
486 | |||
465 | typedef struct { |
|
487 | typedef struct { | |
466 | unsigned char targetLogicalAddress; |
|
488 | unsigned char targetLogicalAddress; | |
467 | unsigned char protocolIdentifier; |
|
489 | unsigned char protocolIdentifier; | |
468 | unsigned char reserved; |
|
490 | unsigned char reserved; | |
469 | unsigned char userApplication; |
|
491 | unsigned char userApplication; | |
470 | unsigned char packetID[2]; |
|
492 | unsigned char packetID[2]; | |
471 | unsigned char packetSequenceControl[2]; |
|
493 | unsigned char packetSequenceControl[2]; | |
472 | unsigned char packetLength[2]; |
|
494 | unsigned char packetLength[2]; | |
473 | unsigned char spare1_pusVersion_spare2; |
|
495 | unsigned char spare1_pusVersion_spare2; | |
474 | unsigned char serviceType; |
|
496 | unsigned char serviceType; | |
475 | unsigned char serviceSubType; |
|
497 | unsigned char serviceSubType; | |
476 | unsigned char destinationID; |
|
498 | unsigned char destinationID; | |
477 | unsigned char time[6]; |
|
499 | unsigned char time[6]; | |
478 | unsigned char sid; |
|
500 | unsigned char sid; | |
479 |
|
501 | |||
480 | //************** |
|
502 | //************** | |
481 | // HK PARAMETERS |
|
503 | // HK PARAMETERS | |
482 | unsigned char lfr_status_word[2]; |
|
504 | unsigned char lfr_status_word[2]; | |
483 | unsigned char lfr_sw_version[4]; |
|
505 | unsigned char lfr_sw_version[4]; | |
484 | unsigned char lfr_fpga_version[3]; |
|
506 | unsigned char lfr_fpga_version[3]; | |
485 | // ressource statistics |
|
507 | // ressource statistics | |
486 | unsigned char hk_lfr_cpu_load; |
|
508 | unsigned char hk_lfr_cpu_load; | |
487 | unsigned char hk_lfr_load_max; |
|
509 | unsigned char hk_lfr_load_max; | |
488 | unsigned char hk_lfr_load_aver; |
|
510 | unsigned char hk_lfr_load_aver; | |
489 | // tc statistics |
|
511 | // tc statistics | |
490 | unsigned char hk_lfr_update_info_tc_cnt[2]; |
|
512 | unsigned char hk_lfr_update_info_tc_cnt[2]; | |
491 | unsigned char hk_lfr_update_time_tc_cnt[2]; |
|
513 | unsigned char hk_lfr_update_time_tc_cnt[2]; | |
492 | unsigned char hk_lfr_exe_tc_cnt[2]; |
|
514 | unsigned char hk_lfr_exe_tc_cnt[2]; | |
493 | unsigned char hk_lfr_rej_tc_cnt[2]; |
|
515 | unsigned char hk_lfr_rej_tc_cnt[2]; | |
494 | unsigned char hk_lfr_last_exe_tc_id[2]; |
|
516 | unsigned char hk_lfr_last_exe_tc_id[2]; | |
495 | unsigned char hk_lfr_last_exe_tc_type[2]; |
|
517 | unsigned char hk_lfr_last_exe_tc_type[2]; | |
496 | unsigned char hk_lfr_last_exe_tc_subtype[2]; |
|
518 | unsigned char hk_lfr_last_exe_tc_subtype[2]; | |
497 | unsigned char hk_lfr_last_exe_tc_time[6]; |
|
519 | unsigned char hk_lfr_last_exe_tc_time[6]; | |
498 | unsigned char hk_lfr_last_rej_tc_id[2]; |
|
520 | unsigned char hk_lfr_last_rej_tc_id[2]; | |
499 | unsigned char hk_lfr_last_rej_tc_type[2]; |
|
521 | unsigned char hk_lfr_last_rej_tc_type[2]; | |
500 | unsigned char hk_lfr_last_rej_tc_subtype[2]; |
|
522 | unsigned char hk_lfr_last_rej_tc_subtype[2]; | |
501 | unsigned char hk_lfr_last_rej_tc_time[6]; |
|
523 | unsigned char hk_lfr_last_rej_tc_time[6]; | |
502 | // anomaly statistics |
|
524 | // anomaly statistics | |
503 | unsigned char hk_lfr_le_cnt[2]; |
|
525 | unsigned char hk_lfr_le_cnt[2]; | |
504 | unsigned char hk_lfr_me_cnt[2]; |
|
526 | unsigned char hk_lfr_me_cnt[2]; | |
505 | unsigned char hk_lfr_he_cnt[2]; |
|
527 | unsigned char hk_lfr_he_cnt[2]; | |
506 | unsigned char hk_lfr_last_er_rid[2]; |
|
528 | unsigned char hk_lfr_last_er_rid[2]; | |
507 | unsigned char hk_lfr_last_er_code; |
|
529 | unsigned char hk_lfr_last_er_code; | |
508 | unsigned char hk_lfr_last_er_time[6]; |
|
530 | unsigned char hk_lfr_last_er_time[6]; | |
509 | // vhdl_blk_status |
|
531 | // vhdl_blk_status | |
510 | unsigned char hk_lfr_vhdl_aa_sm; |
|
532 | unsigned char hk_lfr_vhdl_aa_sm; | |
511 | unsigned char hk_lfr_vhdl_fft_sr; |
|
533 | unsigned char hk_lfr_vhdl_fft_sr; | |
512 | unsigned char hk_lfr_vhdl_cic_hk; |
|
534 | unsigned char hk_lfr_vhdl_cic_hk; | |
513 | unsigned char hk_lfr_vhdl_iir_cal; |
|
535 | unsigned char hk_lfr_vhdl_iir_cal; | |
514 | // spacewire_if_statistics |
|
536 | // spacewire_if_statistics | |
515 | unsigned char hk_lfr_dpu_spw_pkt_rcv_cnt[2]; |
|
537 | unsigned char hk_lfr_dpu_spw_pkt_rcv_cnt[2]; | |
516 | unsigned char hk_lfr_dpu_spw_pkt_sent_cnt[2]; |
|
538 | unsigned char hk_lfr_dpu_spw_pkt_sent_cnt[2]; | |
517 | unsigned char hk_lfr_dpu_spw_tick_out_cnt; |
|
539 | unsigned char hk_lfr_dpu_spw_tick_out_cnt; | |
518 | unsigned char hk_lfr_dpu_spw_last_timc; |
|
540 | unsigned char hk_lfr_dpu_spw_last_timc; | |
519 | // ahb error statistics |
|
541 | // ahb error statistics | |
520 | unsigned int hk_lfr_last_fail_addr; |
|
542 | unsigned int hk_lfr_last_fail_addr; | |
521 | // temperatures |
|
543 | // temperatures | |
522 | unsigned char hk_lfr_temp_scm[2]; |
|
544 | unsigned char hk_lfr_temp_scm[2]; | |
523 | unsigned char hk_lfr_temp_pcb[2]; |
|
545 | unsigned char hk_lfr_temp_pcb[2]; | |
524 | unsigned char hk_lfr_temp_fpga[2]; |
|
546 | unsigned char hk_lfr_temp_fpga[2]; | |
525 | // spacecraft potential |
|
547 | // spacecraft potential | |
526 | unsigned char hk_lfr_sc_v_f3[2]; |
|
548 | unsigned char hk_lfr_sc_v_f3[2]; | |
527 | unsigned char hk_lfr_sc_e1_f3[2]; |
|
549 | unsigned char hk_lfr_sc_e1_f3[2]; | |
528 | unsigned char hk_lfr_sc_e2_f3[2]; |
|
550 | unsigned char hk_lfr_sc_e2_f3[2]; | |
529 | // error counters |
|
551 | // error counters | |
530 | unsigned char hk_lfr_dpu_spw_parity; |
|
552 | unsigned char hk_lfr_dpu_spw_parity; | |
531 | unsigned char hk_lfr_dpu_spw_disconnect; |
|
553 | unsigned char hk_lfr_dpu_spw_disconnect; | |
532 | unsigned char hk_lfr_dpu_spw_escape; |
|
554 | unsigned char hk_lfr_dpu_spw_escape; | |
533 | unsigned char hk_lfr_dpu_spw_credit; |
|
555 | unsigned char hk_lfr_dpu_spw_credit; | |
534 | unsigned char hk_lfr_dpu_spw_write_sync; |
|
556 | unsigned char hk_lfr_dpu_spw_write_sync; | |
535 | unsigned char hk_lfr_dpu_spw_rx_ahb; |
|
557 | unsigned char hk_lfr_dpu_spw_rx_ahb; | |
536 | unsigned char hk_lfr_dpu_spw_tx_ahb; |
|
558 | unsigned char hk_lfr_dpu_spw_tx_ahb; | |
537 | unsigned char hk_lfr_dpu_spw_early_eop; |
|
559 | unsigned char hk_lfr_dpu_spw_early_eop; | |
538 | unsigned char hk_lfr_dpu_spw_invalid_addr; |
|
560 | unsigned char hk_lfr_dpu_spw_invalid_addr; | |
539 | unsigned char hk_lfr_dpu_spw_eep; |
|
561 | unsigned char hk_lfr_dpu_spw_eep; | |
540 | unsigned char hk_lfr_dpu_spw_rx_too_big; |
|
562 | unsigned char hk_lfr_dpu_spw_rx_too_big; | |
541 | // timecode |
|
563 | // timecode | |
542 | unsigned char hk_lfr_timecode_erroneous; |
|
564 | unsigned char hk_lfr_timecode_erroneous; | |
543 | unsigned char hk_lfr_timecode_missing; |
|
565 | unsigned char hk_lfr_timecode_missing; | |
544 | unsigned char hk_lfr_timecode_invalid; |
|
566 | unsigned char hk_lfr_timecode_invalid; | |
545 | // time |
|
567 | // time | |
546 | unsigned char hk_lfr_time_timecode_it; |
|
568 | unsigned char hk_lfr_time_timecode_it; | |
547 | unsigned char hk_lfr_time_not_synchro; |
|
569 | unsigned char hk_lfr_time_not_synchro; | |
548 | unsigned char hk_lfr_time_timecode_ctr; |
|
570 | unsigned char hk_lfr_time_timecode_ctr; | |
549 | // hk_lfr_buffer_dpu_ |
|
571 | // hk_lfr_buffer_dpu_ | |
550 | unsigned char hk_lfr_buffer_dpu_tc_fifo; |
|
572 | unsigned char hk_lfr_buffer_dpu_tc_fifo; | |
551 | unsigned char hk_lfr_buffer_dpu_tm_fifo; |
|
573 | unsigned char hk_lfr_buffer_dpu_tm_fifo; | |
552 | // hk_lfr_ahb_ |
|
574 | // hk_lfr_ahb_ | |
553 | unsigned char hk_lfr_ahb_correctable; |
|
575 | unsigned char hk_lfr_ahb_correctable; | |
554 | unsigned char hk_lfr_ahb_uncorrectable; |
|
576 | unsigned char hk_lfr_ahb_uncorrectable; | |
555 | // spare |
|
577 | // spare | |
556 | unsigned char parameters_spare; |
|
578 | unsigned char parameters_spare; | |
557 | } Packet_TM_LFR_HK_t; |
|
579 | } Packet_TM_LFR_HK_t; | |
558 |
|
580 | |||
559 | typedef struct { |
|
581 | typedef struct { | |
560 | unsigned char targetLogicalAddress; |
|
582 | unsigned char targetLogicalAddress; | |
561 | unsigned char protocolIdentifier; |
|
583 | unsigned char protocolIdentifier; | |
562 | unsigned char reserved; |
|
584 | unsigned char reserved; | |
563 | unsigned char userApplication; |
|
585 | unsigned char userApplication; | |
564 | unsigned char packetID[2]; |
|
586 | unsigned char packetID[2]; | |
565 | unsigned char packetSequenceControl[2]; |
|
587 | unsigned char packetSequenceControl[2]; | |
566 | unsigned char packetLength[2]; |
|
588 | unsigned char packetLength[2]; | |
567 | // DATA FIELD HEADER |
|
589 | // DATA FIELD HEADER | |
568 | unsigned char spare1_pusVersion_spare2; |
|
590 | unsigned char spare1_pusVersion_spare2; | |
569 | unsigned char serviceType; |
|
591 | unsigned char serviceType; | |
570 | unsigned char serviceSubType; |
|
592 | unsigned char serviceSubType; | |
571 | unsigned char destinationID; |
|
593 | unsigned char destinationID; | |
572 | unsigned char time[6]; |
|
594 | unsigned char time[6]; | |
573 | unsigned char sid; |
|
595 | unsigned char sid; | |
574 |
|
596 | |||
575 | //****************** |
|
597 | //****************** | |
576 | // COMMON PARAMETERS |
|
598 | // COMMON PARAMETERS | |
577 | unsigned char unused0; |
|
599 | unsigned char unused0; | |
578 | unsigned char bw_sp0_sp1_r0_r1; |
|
600 | unsigned char bw_sp0_sp1_r0_r1; | |
579 |
|
601 | |||
580 | //****************** |
|
602 | //****************** | |
581 | // NORMAL PARAMETERS |
|
603 | // NORMAL PARAMETERS | |
582 | unsigned char sy_lfr_n_swf_l[2]; |
|
604 | unsigned char sy_lfr_n_swf_l[2]; | |
583 | unsigned char sy_lfr_n_swf_p[2]; |
|
605 | unsigned char sy_lfr_n_swf_p[2]; | |
584 | unsigned char sy_lfr_n_asm_p[2]; |
|
606 | unsigned char sy_lfr_n_asm_p[2]; | |
585 | unsigned char sy_lfr_n_bp_p0; |
|
607 | unsigned char sy_lfr_n_bp_p0; | |
586 | unsigned char sy_lfr_n_bp_p1; |
|
608 | unsigned char sy_lfr_n_bp_p1; | |
587 | unsigned char sy_lfr_n_cwf_long_f3; |
|
609 | unsigned char sy_lfr_n_cwf_long_f3; | |
588 | unsigned char lfr_normal_parameters_spare; |
|
610 | unsigned char lfr_normal_parameters_spare; | |
589 |
|
611 | |||
590 | //***************** |
|
612 | //***************** | |
591 | // BURST PARAMETERS |
|
613 | // BURST PARAMETERS | |
592 | unsigned char sy_lfr_b_bp_p0; |
|
614 | unsigned char sy_lfr_b_bp_p0; | |
593 | unsigned char sy_lfr_b_bp_p1; |
|
615 | unsigned char sy_lfr_b_bp_p1; | |
594 |
|
616 | |||
595 | //**************** |
|
617 | //**************** | |
596 | // SBM1 PARAMETERS |
|
618 | // SBM1 PARAMETERS | |
597 | unsigned char sy_lfr_s1_bp_p0; |
|
619 | unsigned char sy_lfr_s1_bp_p0; | |
598 | unsigned char sy_lfr_s1_bp_p1; |
|
620 | unsigned char sy_lfr_s1_bp_p1; | |
599 |
|
621 | |||
600 | //**************** |
|
622 | //**************** | |
601 | // SBM2 PARAMETERS |
|
623 | // SBM2 PARAMETERS | |
602 | unsigned char sy_lfr_s2_bp_p0; |
|
624 | unsigned char sy_lfr_s2_bp_p0; | |
603 | unsigned char sy_lfr_s2_bp_p1; |
|
625 | unsigned char sy_lfr_s2_bp_p1; | |
604 |
|
626 | |||
605 | // SPARE |
|
627 | // SPARE | |
606 | unsigned char source_data_spare; |
|
628 | unsigned char source_data_spare; | |
607 | } Packet_TM_LFR_PARAMETER_DUMP_t; |
|
629 | } Packet_TM_LFR_PARAMETER_DUMP_t; | |
608 |
|
630 | |||
609 |
|
631 | |||
610 | #endif // CCSDS_TYPES_H_INCLUDED |
|
632 | #endif // CCSDS_TYPES_H_INCLUDED |
@@ -1,225 +1,235 | |||||
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 "fsw_params_nb_bytes.h" | |
7 | #include "tm_byte_positions.h" |
|
7 | #include "tm_byte_positions.h" | |
8 | #include "ccsds_types.h" |
|
8 | #include "ccsds_types.h" | |
9 |
|
9 | |||
10 | #define GRSPW_DEVICE_NAME "/dev/grspw0" |
|
10 | #define GRSPW_DEVICE_NAME "/dev/grspw0" | |
11 | #define UART_DEVICE_NAME "/dev/console" |
|
11 | #define UART_DEVICE_NAME "/dev/console" | |
12 |
|
12 | |||
13 | typedef struct ring_node |
|
13 | typedef struct ring_node | |
14 | { |
|
14 | { | |
15 | struct ring_node *previous; |
|
15 | struct ring_node *previous; | |
16 | int buffer_address; |
|
16 | int buffer_address; | |
17 | struct ring_node *next; |
|
17 | struct ring_node *next; | |
18 | unsigned int status; |
|
18 | unsigned int status; | |
19 | } ring_node; |
|
19 | } ring_node; | |
20 |
|
20 | |||
|
21 | typedef struct ring_node_sm | |||
|
22 | { | |||
|
23 | struct ring_node_sm *previous; | |||
|
24 | int buffer_address; | |||
|
25 | struct ring_node_sm *next; | |||
|
26 | unsigned int status; | |||
|
27 | unsigned int coarseTime; | |||
|
28 | unsigned int fineTime; | |||
|
29 | } ring_node_sm; | |||
|
30 | ||||
21 | //************************ |
|
31 | //************************ | |
22 | // flight software version |
|
32 | // flight software version | |
23 | // this parameters is handled by the Qt project options |
|
33 | // this parameters is handled by the Qt project options | |
24 |
|
34 | |||
25 | #define NB_PACKETS_PER_GROUP_OF_CWF 8 // 8 packets containing 336 blk |
|
35 | #define NB_PACKETS_PER_GROUP_OF_CWF 8 // 8 packets containing 336 blk | |
26 | #define NB_PACKETS_PER_GROUP_OF_CWF_LIGHT 4 // 4 packets containing 672 blk |
|
36 | #define NB_PACKETS_PER_GROUP_OF_CWF_LIGHT 4 // 4 packets containing 672 blk | |
27 | #define NB_SAMPLES_PER_SNAPSHOT 2688 // 336 * 8 = 672 * 4 = 2688 |
|
37 | #define NB_SAMPLES_PER_SNAPSHOT 2688 // 336 * 8 = 672 * 4 = 2688 | |
28 | #define TIME_OFFSET 2 |
|
38 | #define TIME_OFFSET 2 | |
29 | #define TIME_OFFSET_IN_BYTES 8 |
|
39 | #define TIME_OFFSET_IN_BYTES 8 | |
30 | #define WAVEFORM_EXTENDED_HEADER_OFFSET 22 |
|
40 | #define WAVEFORM_EXTENDED_HEADER_OFFSET 22 | |
31 | #define NB_BYTES_SWF_BLK (2 * 6) |
|
41 | #define NB_BYTES_SWF_BLK (2 * 6) | |
32 | #define NB_WORDS_SWF_BLK 3 |
|
42 | #define NB_WORDS_SWF_BLK 3 | |
33 | #define NB_BYTES_CWF3_LIGHT_BLK 6 |
|
43 | #define NB_BYTES_CWF3_LIGHT_BLK 6 | |
34 | #define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8 |
|
44 | #define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8 | |
35 | #define NB_RING_NODES_F0 3 // AT LEAST 3 |
|
45 | #define NB_RING_NODES_F0 3 // AT LEAST 3 | |
36 | #define NB_RING_NODES_F1 5 // AT LEAST 3 |
|
46 | #define NB_RING_NODES_F1 5 // AT LEAST 3 | |
37 | #define NB_RING_NODES_F2 5 // AT LEAST 3 |
|
47 | #define NB_RING_NODES_F2 5 // AT LEAST 3 | |
38 |
|
48 | |||
39 | //********** |
|
49 | //********** | |
40 | // LFR MODES |
|
50 | // LFR MODES | |
41 | #define LFR_MODE_STANDBY 0 |
|
51 | #define LFR_MODE_STANDBY 0 | |
42 | #define LFR_MODE_NORMAL 1 |
|
52 | #define LFR_MODE_NORMAL 1 | |
43 | #define LFR_MODE_BURST 2 |
|
53 | #define LFR_MODE_BURST 2 | |
44 | #define LFR_MODE_SBM1 3 |
|
54 | #define LFR_MODE_SBM1 3 | |
45 | #define LFR_MODE_SBM2 4 |
|
55 | #define LFR_MODE_SBM2 4 | |
46 |
|
56 | |||
47 | #define TDS_MODE_LFM 5 |
|
57 | #define TDS_MODE_LFM 5 | |
48 | #define TDS_MODE_STANDBY 0 |
|
58 | #define TDS_MODE_STANDBY 0 | |
49 | #define TDS_MODE_NORMAL 1 |
|
59 | #define TDS_MODE_NORMAL 1 | |
50 | #define TDS_MODE_BURST 2 |
|
60 | #define TDS_MODE_BURST 2 | |
51 | #define TDS_MODE_SBM1 3 |
|
61 | #define TDS_MODE_SBM1 3 | |
52 | #define TDS_MODE_SBM2 4 |
|
62 | #define TDS_MODE_SBM2 4 | |
53 |
|
63 | |||
54 | #define THR_MODE_STANDBY 0 |
|
64 | #define THR_MODE_STANDBY 0 | |
55 | #define THR_MODE_NORMAL 1 |
|
65 | #define THR_MODE_NORMAL 1 | |
56 | #define THR_MODE_BURST 2 |
|
66 | #define THR_MODE_BURST 2 | |
57 |
|
67 | |||
58 | #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0 |
|
68 | #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0 | |
59 | #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1 |
|
69 | #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1 | |
60 | #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2 |
|
70 | #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2 | |
61 | #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3 |
|
71 | #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3 | |
62 | #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4 |
|
72 | #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4 | |
63 | #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5 |
|
73 | #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5 | |
64 | #define RTEMS_EVENT_MODE_NORMAL_SWF_F0 RTEMS_EVENT_6 |
|
74 | #define RTEMS_EVENT_MODE_NORMAL_SWF_F0 RTEMS_EVENT_6 | |
65 | #define RTEMS_EVENT_MODE_NORMAL_SWF_F1 RTEMS_EVENT_7 |
|
75 | #define RTEMS_EVENT_MODE_NORMAL_SWF_F1 RTEMS_EVENT_7 | |
66 | #define RTEMS_EVENT_MODE_NORMAL_SWF_F2 RTEMS_EVENT_8 |
|
76 | #define RTEMS_EVENT_MODE_NORMAL_SWF_F2 RTEMS_EVENT_8 | |
67 |
|
77 | |||
68 | //**************************** |
|
78 | //**************************** | |
69 | // LFR DEFAULT MODE PARAMETERS |
|
79 | // LFR DEFAULT MODE PARAMETERS | |
70 | // COMMON |
|
80 | // COMMON | |
71 | #define DEFAULT_SY_LFR_COMMON0 0x00 |
|
81 | #define DEFAULT_SY_LFR_COMMON0 0x00 | |
72 | #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0 |
|
82 | #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0 | |
73 | // NORM |
|
83 | // NORM | |
74 | #define SY_LFR_N_SWF_L 2048 // nb sample |
|
84 | #define SY_LFR_N_SWF_L 2048 // nb sample | |
75 | #define SY_LFR_N_SWF_P 300 // sec |
|
85 | #define SY_LFR_N_SWF_P 300 // sec | |
76 | #define SY_LFR_N_ASM_P 3600 // sec |
|
86 | #define SY_LFR_N_ASM_P 3600 // sec | |
77 | #define SY_LFR_N_BP_P0 4 // sec |
|
87 | #define SY_LFR_N_BP_P0 4 // sec | |
78 | #define SY_LFR_N_BP_P1 20 // sec |
|
88 | #define SY_LFR_N_BP_P1 20 // sec | |
79 | #define SY_LFR_N_CWF_LONG_F3 0 // 0 => production of light continuous waveforms at f3 |
|
89 | #define SY_LFR_N_CWF_LONG_F3 0 // 0 => production of light continuous waveforms at f3 | |
80 | #define MIN_DELTA_SNAPSHOT 16 // sec |
|
90 | #define MIN_DELTA_SNAPSHOT 16 // sec | |
81 | // BURST |
|
91 | // BURST | |
82 | #define DEFAULT_SY_LFR_B_BP_P0 1 // sec |
|
92 | #define DEFAULT_SY_LFR_B_BP_P0 1 // sec | |
83 | #define DEFAULT_SY_LFR_B_BP_P1 5 // sec |
|
93 | #define DEFAULT_SY_LFR_B_BP_P1 5 // sec | |
84 | // SBM1 |
|
94 | // SBM1 | |
85 | #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec |
|
95 | #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec | |
86 | #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec |
|
96 | #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec | |
87 | // SBM2 |
|
97 | // SBM2 | |
88 | #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec |
|
98 | #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec | |
89 | #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec |
|
99 | #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec | |
90 | // ADDITIONAL PARAMETERS |
|
100 | // ADDITIONAL PARAMETERS | |
91 | #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms |
|
101 | #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms | |
92 | #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s |
|
102 | #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s | |
93 | // STATUS WORD |
|
103 | // STATUS WORD | |
94 | #define DEFAULT_STATUS_WORD_BYTE0 0x0d // [0000] [1] [101] mode 4 bits / SPW enabled 1 bit / state is run 3 bits |
|
104 | #define DEFAULT_STATUS_WORD_BYTE0 0x0d // [0000] [1] [101] mode 4 bits / SPW enabled 1 bit / state is run 3 bits | |
95 | #define DEFAULT_STATUS_WORD_BYTE1 0x00 |
|
105 | #define DEFAULT_STATUS_WORD_BYTE1 0x00 | |
96 | // |
|
106 | // | |
97 | #define SY_LFR_DPU_CONNECT_TIMEOUT 100 // 100 * 10 ms = 1 s |
|
107 | #define SY_LFR_DPU_CONNECT_TIMEOUT 100 // 100 * 10 ms = 1 s | |
98 | #define SY_LFR_DPU_CONNECT_ATTEMPT 3 |
|
108 | #define SY_LFR_DPU_CONNECT_ATTEMPT 3 | |
99 | //**************************** |
|
109 | //**************************** | |
100 |
|
110 | |||
101 | //***************************** |
|
111 | //***************************** | |
102 | // APB REGISTERS BASE ADDRESSES |
|
112 | // APB REGISTERS BASE ADDRESSES | |
103 | #define REGS_ADDR_APBUART 0x80000100 |
|
113 | #define REGS_ADDR_APBUART 0x80000100 | |
104 | #define REGS_ADDR_GPTIMER 0x80000300 |
|
114 | #define REGS_ADDR_GPTIMER 0x80000300 | |
105 | #define REGS_ADDR_GRSPW 0x80000500 |
|
115 | #define REGS_ADDR_GRSPW 0x80000500 | |
106 | #define REGS_ADDR_TIME_MANAGEMENT 0x80000600 |
|
116 | #define REGS_ADDR_TIME_MANAGEMENT 0x80000600 | |
107 | #define REGS_ADDR_GRGPIO 0x80000b00 |
|
117 | #define REGS_ADDR_GRGPIO 0x80000b00 | |
108 |
|
118 | |||
109 | #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00 |
|
119 | #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00 | |
110 | #define REGS_ADDR_WAVEFORM_PICKER 0x80000f40 |
|
120 | #define REGS_ADDR_WAVEFORM_PICKER 0x80000f40 | |
111 |
|
121 | |||
112 | #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff |
|
122 | #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff | |
113 | #define APBUART_CTRL_REG_MASK_TE 0x00000002 |
|
123 | #define APBUART_CTRL_REG_MASK_TE 0x00000002 | |
114 | #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50) |
|
124 | #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50) | |
115 |
|
125 | |||
116 | //********** |
|
126 | //********** | |
117 | // IRQ LINES |
|
127 | // IRQ LINES | |
118 | #define IRQ_SM_SIMULATOR 9 |
|
128 | #define IRQ_SM_SIMULATOR 9 | |
119 | #define IRQ_SPARC_SM_SIMULATOR 0x19 // see sparcv8.pdf p.76 for interrupt levels |
|
129 | #define IRQ_SPARC_SM_SIMULATOR 0x19 // see sparcv8.pdf p.76 for interrupt levels | |
120 | #define IRQ_WAVEFORM_PICKER 14 |
|
130 | #define IRQ_WAVEFORM_PICKER 14 | |
121 | #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels |
|
131 | #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels | |
122 | #define IRQ_SPECTRAL_MATRIX 6 |
|
132 | #define IRQ_SPECTRAL_MATRIX 6 | |
123 | #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels |
|
133 | #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels | |
124 |
|
134 | |||
125 | //***** |
|
135 | //***** | |
126 | // TIME |
|
136 | // TIME | |
127 | #define CLKDIV_SM_SIMULATOR (10000 - 1) // 10 ms |
|
137 | #define CLKDIV_SM_SIMULATOR (10000 - 1) // 10 ms | |
128 | #define TIMER_SM_SIMULATOR 1 |
|
138 | #define TIMER_SM_SIMULATOR 1 | |
129 | #define HK_PERIOD 100 // 100 * 10ms => 1s |
|
139 | #define HK_PERIOD 100 // 100 * 10ms => 1s | |
130 | #define SY_LFR_TIME_SYN_TIMEOUT_in_ms 2000 |
|
140 | #define SY_LFR_TIME_SYN_TIMEOUT_in_ms 2000 | |
131 | #define SY_LFR_TIME_SYN_TIMEOUT_in_ticks 200 // 200 * 10 ms = 2 s |
|
141 | #define SY_LFR_TIME_SYN_TIMEOUT_in_ticks 200 // 200 * 10 ms = 2 s | |
132 |
|
142 | |||
133 | //********** |
|
143 | //********** | |
134 | // LPP CODES |
|
144 | // LPP CODES | |
135 | #define LFR_SUCCESSFUL 0 |
|
145 | #define LFR_SUCCESSFUL 0 | |
136 | #define LFR_DEFAULT 1 |
|
146 | #define LFR_DEFAULT 1 | |
137 |
|
147 | |||
138 | //****** |
|
148 | //****** | |
139 | // RTEMS |
|
149 | // RTEMS | |
140 | #define TASKID_RECV 1 |
|
150 | #define TASKID_RECV 1 | |
141 | #define TASKID_ACTN 2 |
|
151 | #define TASKID_ACTN 2 | |
142 | #define TASKID_SPIQ 3 |
|
152 | #define TASKID_SPIQ 3 | |
143 | #define TASKID_SMIQ 4 |
|
153 | #define TASKID_SMIQ 4 | |
144 | #define TASKID_STAT 5 |
|
154 | #define TASKID_STAT 5 | |
145 | #define TASKID_AVF0 6 |
|
155 | #define TASKID_AVF0 6 | |
146 | #define TASKID_SWBD 7 |
|
156 | #define TASKID_SWBD 7 | |
147 | #define TASKID_WFRM 8 |
|
157 | #define TASKID_WFRM 8 | |
148 | #define TASKID_DUMB 9 |
|
158 | #define TASKID_DUMB 9 | |
149 | #define TASKID_HOUS 10 |
|
159 | #define TASKID_HOUS 10 | |
150 | #define TASKID_MATR 11 |
|
160 | #define TASKID_MATR 11 | |
151 | #define TASKID_CWF3 12 |
|
161 | #define TASKID_CWF3 12 | |
152 | #define TASKID_CWF2 13 |
|
162 | #define TASKID_CWF2 13 | |
153 | #define TASKID_CWF1 14 |
|
163 | #define TASKID_CWF1 14 | |
154 | #define TASKID_SEND 15 |
|
164 | #define TASKID_SEND 15 | |
155 | #define TASKID_WTDG 16 |
|
165 | #define TASKID_WTDG 16 | |
156 |
|
166 | |||
157 | #define TASK_PRIORITY_SPIQ 5 |
|
167 | #define TASK_PRIORITY_SPIQ 5 | |
158 | #define TASK_PRIORITY_SMIQ 10 |
|
168 | #define TASK_PRIORITY_SMIQ 10 | |
159 | #define TASK_PRIORITY_WTDG 20 |
|
169 | #define TASK_PRIORITY_WTDG 20 | |
160 | #define TASK_PRIORITY_HOUS 30 |
|
170 | #define TASK_PRIORITY_HOUS 30 | |
161 | #define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together |
|
171 | #define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together | |
162 | #define TASK_PRIORITY_CWF2 35 // |
|
172 | #define TASK_PRIORITY_CWF2 35 // | |
163 | #define TASK_PRIORITY_SWBD 37 // SWBD has a lower priority than WFRM, this is to extract the snapshot before sending it |
|
173 | #define TASK_PRIORITY_SWBD 37 // SWBD has a lower priority than WFRM, this is to extract the snapshot before sending it | |
164 | #define TASK_PRIORITY_WFRM 40 |
|
174 | #define TASK_PRIORITY_WFRM 40 | |
165 | #define TASK_PRIORITY_CWF3 40 // there is a printf in this function, be careful with its priority wrt CWF1 |
|
175 | #define TASK_PRIORITY_CWF3 40 // there is a printf in this function, be careful with its priority wrt CWF1 | |
166 | #define TASK_PRIORITY_SEND 45 |
|
176 | #define TASK_PRIORITY_SEND 45 | |
167 | #define TASK_PRIORITY_RECV 50 |
|
177 | #define TASK_PRIORITY_RECV 50 | |
168 | #define TASK_PRIORITY_ACTN 50 |
|
178 | #define TASK_PRIORITY_ACTN 50 | |
169 | #define TASK_PRIORITY_AVF0 60 |
|
179 | #define TASK_PRIORITY_AVF0 60 | |
170 | #define TASK_PRIORITY_BPF0 60 |
|
180 | #define TASK_PRIORITY_BPF0 60 | |
171 | #define TASK_PRIORITY_MATR 100 |
|
181 | #define TASK_PRIORITY_MATR 100 | |
172 | #define TASK_PRIORITY_STAT 200 |
|
182 | #define TASK_PRIORITY_STAT 200 | |
173 | #define TASK_PRIORITY_DUMB 200 |
|
183 | #define TASK_PRIORITY_DUMB 200 | |
174 |
|
184 | |||
175 | #define ACTION_MSG_QUEUE_COUNT 10 |
|
185 | #define ACTION_MSG_QUEUE_COUNT 10 | |
176 | #define ACTION_MSG_PKTS_COUNT 50 |
|
186 | #define ACTION_MSG_PKTS_COUNT 50 | |
177 | #define ACTION_MSG_PKTS_MAX_SIZE (PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES) |
|
187 | #define ACTION_MSG_PKTS_MAX_SIZE (PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES) | |
178 | #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options |
|
188 | #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options | |
179 |
|
189 | |||
180 | #define QUEUE_RECV 0 |
|
190 | #define QUEUE_RECV 0 | |
181 | #define QUEUE_SEND 1 |
|
191 | #define QUEUE_SEND 1 | |
182 |
|
192 | |||
183 | //******* |
|
193 | //******* | |
184 | // MACROS |
|
194 | // MACROS | |
185 | #ifdef PRINT_MESSAGES_ON_CONSOLE |
|
195 | #ifdef PRINT_MESSAGES_ON_CONSOLE | |
186 | #define PRINTF(x) printf(x); |
|
196 | #define PRINTF(x) printf(x); | |
187 | #define PRINTF1(x,y) printf(x,y); |
|
197 | #define PRINTF1(x,y) printf(x,y); | |
188 | #define PRINTF2(x,y,z) printf(x,y,z); |
|
198 | #define PRINTF2(x,y,z) printf(x,y,z); | |
189 | #else |
|
199 | #else | |
190 | #define PRINTF(x) ; |
|
200 | #define PRINTF(x) ; | |
191 | #define PRINTF1(x,y) ; |
|
201 | #define PRINTF1(x,y) ; | |
192 | #define PRINTF2(x,y,z) ; |
|
202 | #define PRINTF2(x,y,z) ; | |
193 | #endif |
|
203 | #endif | |
194 |
|
204 | |||
195 | #ifdef BOOT_MESSAGES |
|
205 | #ifdef BOOT_MESSAGES | |
196 | #define BOOT_PRINTF(x) printf(x); |
|
206 | #define BOOT_PRINTF(x) printf(x); | |
197 | #define BOOT_PRINTF1(x,y) printf(x,y); |
|
207 | #define BOOT_PRINTF1(x,y) printf(x,y); | |
198 | #define BOOT_PRINTF2(x,y,z) printf(x,y,z); |
|
208 | #define BOOT_PRINTF2(x,y,z) printf(x,y,z); | |
199 | #else |
|
209 | #else | |
200 | #define BOOT_PRINTF(x) ; |
|
210 | #define BOOT_PRINTF(x) ; | |
201 | #define BOOT_PRINTF1(x,y) ; |
|
211 | #define BOOT_PRINTF1(x,y) ; | |
202 | #define BOOT_PRINTF2(x,y,z) ; |
|
212 | #define BOOT_PRINTF2(x,y,z) ; | |
203 | #endif |
|
213 | #endif | |
204 |
|
214 | |||
205 | #ifdef DEBUG_MESSAGES |
|
215 | #ifdef DEBUG_MESSAGES | |
206 | #define DEBUG_PRINTF(x) printf(x); |
|
216 | #define DEBUG_PRINTF(x) printf(x); | |
207 | #define DEBUG_PRINTF1(x,y) printf(x,y); |
|
217 | #define DEBUG_PRINTF1(x,y) printf(x,y); | |
208 | #define DEBUG_PRINTF2(x,y,z) printf(x,y,z); |
|
218 | #define DEBUG_PRINTF2(x,y,z) printf(x,y,z); | |
209 | #else |
|
219 | #else | |
210 | #define DEBUG_PRINTF(x) ; |
|
220 | #define DEBUG_PRINTF(x) ; | |
211 | #define DEBUG_PRINTF1(x,y) ; |
|
221 | #define DEBUG_PRINTF1(x,y) ; | |
212 | #define DEBUG_PRINTF2(x,y,z) ; |
|
222 | #define DEBUG_PRINTF2(x,y,z) ; | |
213 | #endif |
|
223 | #endif | |
214 |
|
224 | |||
215 | #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period |
|
225 | #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period | |
216 |
|
226 | |||
217 | struct param_local_str{ |
|
227 | struct param_local_str{ | |
218 | unsigned int local_sbm1_nb_cwf_sent; |
|
228 | unsigned int local_sbm1_nb_cwf_sent; | |
219 | unsigned int local_sbm1_nb_cwf_max; |
|
229 | unsigned int local_sbm1_nb_cwf_max; | |
220 | unsigned int local_sbm2_nb_cwf_sent; |
|
230 | unsigned int local_sbm2_nb_cwf_sent; | |
221 | unsigned int local_sbm2_nb_cwf_max; |
|
231 | unsigned int local_sbm2_nb_cwf_max; | |
222 | unsigned int local_nb_interrupt_f0_MAX; |
|
232 | unsigned int local_nb_interrupt_f0_MAX; | |
223 | }; |
|
233 | }; | |
224 |
|
234 | |||
225 | #endif // FSW_PARAMS_H_INCLUDED |
|
235 | #endif // FSW_PARAMS_H_INCLUDED |
@@ -1,28 +1,28 | |||||
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 | // TC_LFR_LOAD_COMMON_PAR |
|
4 | // TC_LFR_LOAD_COMMON_PAR | |
5 |
|
5 | |||
6 | // TC_LFR_LOAD_NORMAL_PAR |
|
6 | // TC_LFR_LOAD_NORMAL_PAR | |
7 |
#define |
|
7 | #define DATAFIELD_POS_SY_LFR_N_SWF_L 0 | |
8 |
#define |
|
8 | #define DATAFIELD_POS_SY_LFR_N_SWF_P 2 | |
9 |
#define |
|
9 | #define DATAFIELD_POS_SY_LFR_N_ASM_P 4 | |
10 |
#define |
|
10 | #define DATAFIELD_POS_SY_LFR_N_BP_P0 6 | |
11 |
#define |
|
11 | #define DATAFIELD_POS_SY_LFR_N_BP_P1 7 | |
12 |
#define |
|
12 | #define DATAFIELD_POS_SY_LFR_N_CWF_LONG_F3 8 | |
13 |
|
13 | |||
14 | // TC_LFR_LOAD_BURST_PAR |
|
14 | // TC_LFR_LOAD_BURST_PAR | |
15 |
|
15 | |||
16 | // TC_LFR_LOAD_SBM1_PAR |
|
16 | // TC_LFR_LOAD_SBM1_PAR | |
17 |
|
17 | |||
18 | // TC_LFR_LOAD_SBM2_PAR |
|
18 | // TC_LFR_LOAD_SBM2_PAR | |
19 |
|
19 | |||
20 | // TC_LFR_UPDATE_INFO |
|
20 | // TC_LFR_UPDATE_INFO | |
21 | #define BYTE_POS_UPDATE_INFO_PARAMETERS_SET5 34 |
|
21 | #define BYTE_POS_UPDATE_INFO_PARAMETERS_SET5 34 | |
22 | #define BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 35 |
|
22 | #define BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 35 | |
23 |
|
23 | |||
24 | // TC_LFR_ENTER_MODE |
|
24 | // TC_LFR_ENTER_MODE | |
25 | #define BYTE_POS_CP_MODE_LFR_SET 11 |
|
25 | #define BYTE_POS_CP_MODE_LFR_SET 11 | |
26 | #define BYTE_POS_CP_LFR_ENTER_MODE_TIME 12 |
|
26 | #define BYTE_POS_CP_LFR_ENTER_MODE_TIME 12 | |
27 |
|
27 | |||
28 | #endif // TM_BYTE_POSITIONS_H |
|
28 | #endif // TM_BYTE_POSITIONS_H |
@@ -1,57 +1,59 | |||||
1 | #ifndef FSW_PARAMS_PROCESSING_H |
|
1 | #ifndef FSW_PARAMS_PROCESSING_H | |
2 | #define FSW_PARAMS_PROCESSING_H |
|
2 | #define FSW_PARAMS_PROCESSING_H | |
3 |
|
3 | |||
4 | #define NB_BINS_PER_SM 128 |
|
4 | #define NB_BINS_PER_SM 128 | |
5 | #define NB_VALUES_PER_SM 25 |
|
5 | #define NB_VALUES_PER_SM 25 | |
6 | #define TOTAL_SIZE_SM 3200 // 25 * 128 |
|
6 | #define TOTAL_SIZE_SM 3200 // 25 * 128 | |
7 | #define TOTAL_SIZE_BP1_F0 99 // 11 * 9 = 99 |
|
7 | #define TOTAL_SIZE_BP1_F0 99 // 11 * 9 = 99 | |
8 | #define TOTAL_SIZE_BP1_F1 117 // 13 * 9 = 117 |
|
8 | #define TOTAL_SIZE_BP1_F1 117 // 13 * 9 = 117 | |
9 | #define TOTAL_SIZE_BP1_F2 108 // 12 * 9 = 108 |
|
9 | #define TOTAL_SIZE_BP1_F2 108 // 12 * 9 = 108 | |
10 | // |
|
10 | // | |
11 | #define NB_RING_NODES_ASM_F0 12 // AT LEAST 3 |
|
11 | #define NB_RING_NODES_ASM_F0 12 // AT LEAST 3 | |
12 | #define NB_RING_NODES_ASM_F1 2 // AT LEAST 3 |
|
12 | #define NB_RING_NODES_ASM_F1 2 // AT LEAST 3 | |
13 | #define NB_RING_NODES_ASM_F2 2 // AT LEAST 3 |
|
13 | #define NB_RING_NODES_ASM_F2 2 // AT LEAST 3 | |
14 | // |
|
14 | // | |
15 | #define NB_BINS_PER_ASM_F0 88 |
|
15 | #define NB_BINS_PER_ASM_F0 88 | |
16 | #define NB_BINS_PER_PKT_ASM_F0 44 |
|
16 | #define NB_BINS_PER_PKT_ASM_F0 44 | |
17 | #define TOTAL_SIZE_ASM_F0_IN_BYTES 4400 // 25 * 88 * 2 |
|
17 | #define TOTAL_SIZE_ASM_F0_IN_BYTES 4400 // 25 * 88 * 2 | |
18 | #define ASM_F0_INDICE_START 17 // 88 bins |
|
18 | #define ASM_F0_INDICE_START 17 // 88 bins | |
19 | #define ASM_F0_INDICE_STOP 104 // 2 packets of 44 bins |
|
19 | #define ASM_F0_INDICE_STOP 104 // 2 packets of 44 bins | |
20 | // |
|
20 | // | |
21 | #define NB_BINS_PER_ASM_F1 104 |
|
21 | #define NB_BINS_PER_ASM_F1 104 | |
22 | #define NB_BINS_PER_PKT_ASM_F1 52 |
|
22 | #define NB_BINS_PER_PKT_ASM_F1 52 | |
23 | #define TOTAL_SIZE_ASM_F1 2600 // 25 * 104 |
|
23 | #define TOTAL_SIZE_ASM_F1 2600 // 25 * 104 | |
24 | #define ASM_F1_INDICE_START 6 // 104 bins |
|
24 | #define ASM_F1_INDICE_START 6 // 104 bins | |
25 | #define ASM_F1_INDICE_STOP 109 // 2 packets of 52 bins |
|
25 | #define ASM_F1_INDICE_STOP 109 // 2 packets of 52 bins | |
26 | // |
|
26 | // | |
27 | #define NB_BINS_PER_ASM_F2 96 |
|
27 | #define NB_BINS_PER_ASM_F2 96 | |
28 | #define NB_BINS_PER_PKT_ASM_F2 48 |
|
28 | #define NB_BINS_PER_PKT_ASM_F2 48 | |
29 | #define TOTAL_SIZE_ASM_F2 2400 // 25 * 96 |
|
29 | #define TOTAL_SIZE_ASM_F2 2400 // 25 * 96 | |
30 | #define ASM_F2_INDICE_START 7 // 96 bins |
|
30 | #define ASM_F2_INDICE_START 7 // 96 bins | |
31 | #define ASM_F2_INDICE_STOP 102 // 2 packets of 48 bins |
|
31 | #define ASM_F2_INDICE_STOP 102 // 2 packets of 48 bins | |
32 | // |
|
32 | // | |
33 | #define NB_BINS_COMPRESSED_SM_F0 11 |
|
33 | #define NB_BINS_COMPRESSED_SM_F0 11 | |
34 | #define NB_BINS_COMPRESSED_SM_F1 13 |
|
34 | #define NB_BINS_COMPRESSED_SM_F1 13 | |
35 | #define NB_BINS_COMPRESSED_SM_F2 12 |
|
35 | #define NB_BINS_COMPRESSED_SM_F2 12 | |
36 | // |
|
36 | // | |
37 | #define NB_BINS_TO_AVERAGE_ASM_F0 8 |
|
37 | #define NB_BINS_TO_AVERAGE_ASM_F0 8 | |
38 | #define NB_BINS_TO_AVERAGE_ASM_F1 8 |
|
38 | #define NB_BINS_TO_AVERAGE_ASM_F1 8 | |
39 | #define NB_BINS_TO_AVERAGE_ASM_F2 8 |
|
39 | #define NB_BINS_TO_AVERAGE_ASM_F2 8 | |
40 | // |
|
40 | // | |
41 | #define TOTAL_SIZE_COMPRESSED_ASM_F0 275 // 11 * 25 |
|
41 | #define TOTAL_SIZE_COMPRESSED_ASM_F0 275 // 11 * 25 WORDS | |
42 | #define TOTAL_SIZE_COMPRESSED_ASM_F1 325 // 13 * 25 |
|
42 | #define TOTAL_SIZE_COMPRESSED_ASM_F1 325 // 13 * 25 WORDS | |
43 | #define TOTAL_SIZE_COMPRESSED_ASM_F2 300 // 12 * 25 |
|
43 | #define TOTAL_SIZE_COMPRESSED_ASM_F2 300 // 12 * 25 WORDS | |
44 | #define NB_AVERAGE_NORMAL_f0 96*4 |
|
44 | #define TOTAL_SIZE_COMPRESSED_ASM_SBM1 550 // 22 * 25 WORDS | |
|
45 | #define NB_AVERAGE_NORMAL_f0 384 // 96 * 4 | |||
|
46 | #define NB_AVERAGE_SBM1_f0 24 // 24 matrices at f0 = 0.25 second | |||
45 | #define NB_SM_TO_RECEIVE_BEFORE_AVF0 8 |
|
47 | #define NB_SM_TO_RECEIVE_BEFORE_AVF0 8 | |
46 |
|
48 | |||
47 | typedef struct { |
|
49 | typedef struct { | |
48 | volatile unsigned char PE[2]; |
|
50 | volatile unsigned char PE[2]; | |
49 | volatile unsigned char PB[2]; |
|
51 | volatile unsigned char PB[2]; | |
50 | volatile unsigned char V0; |
|
52 | volatile unsigned char V0; | |
51 | volatile unsigned char V1; |
|
53 | volatile unsigned char V1; | |
52 | volatile unsigned char V2_ELLIP_DOP; |
|
54 | volatile unsigned char V2_ELLIP_DOP; | |
53 | volatile unsigned char SZ; |
|
55 | volatile unsigned char SZ; | |
54 | volatile unsigned char VPHI; |
|
56 | volatile unsigned char VPHI; | |
55 | } BP1_t; |
|
57 | } BP1_t; | |
56 |
|
58 | |||
57 | #endif // FSW_PARAMS_PROCESSING_H |
|
59 | #endif // FSW_PARAMS_PROCESSING_H |
@@ -1,54 +1,57 | |||||
1 | #ifndef FSW_PROCESSING_H_INCLUDED |
|
1 | #ifndef FSW_PROCESSING_H_INCLUDED | |
2 | #define FSW_PROCESSING_H_INCLUDED |
|
2 | #define FSW_PROCESSING_H_INCLUDED | |
3 |
|
3 | |||
4 | #include <rtems.h> |
|
4 | #include <rtems.h> | |
5 | #include <grspw.h> |
|
5 | #include <grspw.h> | |
6 | #include <math.h> |
|
6 | #include <math.h> | |
7 | #include <stdlib.h> // abs() is in the stdlib |
|
7 | #include <stdlib.h> // abs() is in the stdlib | |
8 | #include <stdio.h> // printf() |
|
8 | #include <stdio.h> // printf() | |
9 | #include <math.h> |
|
9 | #include <math.h> | |
10 |
|
10 | |||
11 | #include "fsw_params.h" |
|
11 | #include "fsw_params.h" | |
12 | #include "fsw_spacewire.h" |
|
12 | #include "fsw_spacewire.h" | |
13 |
|
13 | |||
14 | extern volatile int sm_f0[ ]; |
|
14 | extern volatile int sm_f0[ ]; | |
15 | extern volatile int sm_f1[ ]; |
|
15 | extern volatile int sm_f1[ ]; | |
16 | extern volatile int sm_f2[ ]; |
|
16 | extern volatile int sm_f2[ ]; | |
17 |
|
17 | |||
18 | // parameters |
|
18 | // parameters | |
19 | extern struct param_local_str param_local; |
|
19 | extern struct param_local_str param_local; | |
20 |
|
20 | |||
21 | // registers |
|
21 | // registers | |
22 | extern time_management_regs_t *time_management_regs; |
|
22 | extern time_management_regs_t *time_management_regs; | |
23 | extern spectral_matrix_regs_t *spectral_matrix_regs; |
|
23 | extern spectral_matrix_regs_t *spectral_matrix_regs; | |
24 |
|
24 | |||
25 | extern rtems_name misc_name[5]; |
|
25 | extern rtems_name misc_name[5]; | |
26 | extern rtems_id Task_id[20]; /* array of task ids */ |
|
26 | extern rtems_id Task_id[20]; /* array of task ids */ | |
27 |
|
27 | |||
28 | void init_sm_rings( void ); |
|
28 | void init_sm_rings( void ); | |
29 | void reset_current_sm_ring_nodes( void ); |
|
29 | void reset_current_sm_ring_nodes( void ); | |
30 |
|
30 | |||
31 | // ISR |
|
31 | // ISR | |
32 | void reset_nb_sm_f0( void ); |
|
32 | void reset_nb_sm_f0( void ); | |
33 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ); |
|
33 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ); | |
34 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ); |
|
34 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ); | |
35 |
|
35 | |||
36 | // RTEMS TASKS |
|
36 | // RTEMS TASKS | |
37 | rtems_task avf0_task(rtems_task_argument argument); |
|
37 | rtems_task avf0_task(rtems_task_argument argument); | |
38 | rtems_task smiq_task(rtems_task_argument argument); // added to test the spectral matrix simulator |
|
38 | rtems_task smiq_task(rtems_task_argument argument); // added to test the spectral matrix simulator | |
39 | rtems_task matr_task(rtems_task_argument argument); |
|
39 | rtems_task matr_task(rtems_task_argument argument); | |
40 |
|
40 | |||
41 | void matrix_reset(volatile float *averaged_spec_mat); |
|
|||
42 | void BP1_set_old(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1); |
|
41 | void BP1_set_old(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1); | |
43 | void BP2_set_old(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat); |
|
42 | void BP2_set_old(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat); | |
44 | // |
|
43 | // | |
45 | void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header); |
|
44 | void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header); | |
|
45 | void matrix_reset(volatile float *averaged_spec_mat); | |||
|
46 | void ASM_average(float *averaged_spec_mat_f0, float *averaged_spec_mat_f1, | |||
|
47 | ring_node_sm *ring_node_tab[], | |||
|
48 | unsigned int firstTimeF0, unsigned int firstTimeF1 ); | |||
46 | void ASM_reorganize( float *averaged_spec_mat, float *averaged_spec_mat_reorganized ); |
|
49 | void ASM_reorganize( float *averaged_spec_mat, float *averaged_spec_mat_reorganized ); | |
47 | void ASM_compress( float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat ); |
|
50 | void ASM_compress( float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat ); | |
48 | void ASM_convert(volatile float *input_matrix, char *output_matrix); |
|
51 | void ASM_convert(volatile float *input_matrix, char *output_matrix); | |
49 | void ASM_send(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, |
|
52 | void ASM_send(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, | |
50 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id); |
|
53 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id); | |
51 | void fill_averaged_spectral_matrix( void ); |
|
54 | void fill_averaged_spectral_matrix( void ); | |
52 | void reset_spectral_matrix_regs(); |
|
55 | void reset_spectral_matrix_regs(); | |
53 |
|
56 | |||
54 | #endif // FSW_PROCESSING_H_INCLUDED |
|
57 | #endif // FSW_PROCESSING_H_INCLUDED |
@@ -1,644 +1,644 | |||||
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 | reset_local_time(); | |
74 |
|
74 | |||
75 | rtems_status_code status; |
|
75 | rtems_status_code status; | |
76 | rtems_status_code status_spw; |
|
76 | rtems_status_code status_spw; | |
77 | rtems_isr_entry old_isr_handler; |
|
77 | rtems_isr_entry old_isr_handler; | |
78 |
|
78 | |||
79 | // UART settings |
|
79 | // UART settings | |
80 | send_console_outputs_on_apbuart_port(); |
|
80 | send_console_outputs_on_apbuart_port(); | |
81 | 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); | |
82 | enable_apbuart_transmitter(); |
|
82 | enable_apbuart_transmitter(); | |
83 | 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") | |
84 |
|
84 | |||
85 | PRINTF("\n\n\n\n\n") |
|
85 | PRINTF("\n\n\n\n\n") | |
86 | PRINTF("*************************\n") |
|
86 | PRINTF("*************************\n") | |
87 | PRINTF("** LFR Flight Software **\n") |
|
87 | PRINTF("** LFR Flight Software **\n") | |
88 | PRINTF1("** %d.", SW_VERSION_N1) |
|
88 | PRINTF1("** %d.", SW_VERSION_N1) | |
89 | PRINTF1("%d.", SW_VERSION_N2) |
|
89 | PRINTF1("%d.", SW_VERSION_N2) | |
90 | PRINTF1("%d.", SW_VERSION_N3) |
|
90 | PRINTF1("%d.", SW_VERSION_N3) | |
91 | PRINTF1("%d **\n", SW_VERSION_N4) |
|
91 | PRINTF1("%d **\n", SW_VERSION_N4) | |
92 | PRINTF("*************************\n") |
|
92 | PRINTF("*************************\n") | |
93 | PRINTF("\n\n") |
|
93 | PRINTF("\n\n") | |
94 |
|
94 | |||
95 | init_parameter_dump(); |
|
95 | init_parameter_dump(); | |
96 | init_local_mode_parameters(); |
|
96 | init_local_mode_parameters(); | |
97 | init_housekeeping_parameters(); |
|
97 | init_housekeeping_parameters(); | |
98 |
|
98 | |||
99 | init_waveform_rings(); // initialize the waveform rings |
|
99 | init_waveform_rings(); // initialize the waveform rings | |
100 | init_sm_rings(); // initialize spectral matrices rings |
|
100 | init_sm_rings(); // initialize spectral matrices rings | |
101 |
|
101 | |||
102 | reset_wfp_burst_enable(); |
|
102 | reset_wfp_burst_enable(); | |
103 | reset_wfp_status(); |
|
103 | reset_wfp_status(); | |
104 | set_wfp_data_shaping(); |
|
104 | set_wfp_data_shaping(); | |
105 |
|
105 | |||
106 | updateLFRCurrentMode(); |
|
106 | updateLFRCurrentMode(); | |
107 |
|
107 | |||
108 | BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode) |
|
108 | BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode) | |
109 |
|
109 | |||
110 | create_names(); // create all names |
|
110 | create_names(); // create all names | |
111 |
|
111 | |||
112 | status = create_message_queues(); // create message queues |
|
112 | status = create_message_queues(); // create message queues | |
113 | if (status != RTEMS_SUCCESSFUL) |
|
113 | if (status != RTEMS_SUCCESSFUL) | |
114 | { |
|
114 | { | |
115 | PRINTF1("in INIT *** ERR in create_message_queues, code %d", status) |
|
115 | PRINTF1("in INIT *** ERR in create_message_queues, code %d", status) | |
116 | } |
|
116 | } | |
117 |
|
117 | |||
118 | status = create_all_tasks(); // create all tasks |
|
118 | status = create_all_tasks(); // create all tasks | |
119 | if (status != RTEMS_SUCCESSFUL) |
|
119 | if (status != RTEMS_SUCCESSFUL) | |
120 | { |
|
120 | { | |
121 | PRINTF1("in INIT *** ERR in create_all_tasks, code %d", status) |
|
121 | PRINTF1("in INIT *** ERR in create_all_tasks, code %d", status) | |
122 | } |
|
122 | } | |
123 |
|
123 | |||
124 | // ************************** |
|
124 | // ************************** | |
125 | // <SPACEWIRE INITIALIZATION> |
|
125 | // <SPACEWIRE INITIALIZATION> | |
126 | grspw_timecode_callback = &timecode_irq_handler; |
|
126 | grspw_timecode_callback = &timecode_irq_handler; | |
127 |
|
127 | |||
128 | status_spw = spacewire_open_link(); // (1) open the link |
|
128 | status_spw = spacewire_open_link(); // (1) open the link | |
129 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
129 | if ( status_spw != RTEMS_SUCCESSFUL ) | |
130 | { |
|
130 | { | |
131 | PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw ) |
|
131 | PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw ) | |
132 | } |
|
132 | } | |
133 |
|
133 | |||
134 | if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link |
|
134 | if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link | |
135 | { |
|
135 | { | |
136 | status_spw = spacewire_configure_link( fdSPW ); |
|
136 | status_spw = spacewire_configure_link( fdSPW ); | |
137 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
137 | if ( status_spw != RTEMS_SUCCESSFUL ) | |
138 | { |
|
138 | { | |
139 | PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw ) |
|
139 | PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw ) | |
140 | } |
|
140 | } | |
141 | } |
|
141 | } | |
142 |
|
142 | |||
143 | if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link |
|
143 | if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link | |
144 | { |
|
144 | { | |
145 | status_spw = spacewire_start_link( fdSPW ); |
|
145 | status_spw = spacewire_start_link( fdSPW ); | |
146 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
146 | if ( status_spw != RTEMS_SUCCESSFUL ) | |
147 | { |
|
147 | { | |
148 | PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw ) |
|
148 | PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw ) | |
149 | } |
|
149 | } | |
150 | } |
|
150 | } | |
151 | // </SPACEWIRE INITIALIZATION> |
|
151 | // </SPACEWIRE INITIALIZATION> | |
152 | // *************************** |
|
152 | // *************************** | |
153 |
|
153 | |||
154 | status = start_all_tasks(); // start all tasks |
|
154 | status = start_all_tasks(); // start all tasks | |
155 | if (status != RTEMS_SUCCESSFUL) |
|
155 | if (status != RTEMS_SUCCESSFUL) | |
156 | { |
|
156 | { | |
157 | PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status) |
|
157 | PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status) | |
158 | } |
|
158 | } | |
159 |
|
159 | |||
160 | // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization |
|
160 | // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization | |
161 | status = start_recv_send_tasks(); |
|
161 | status = start_recv_send_tasks(); | |
162 | if ( status != RTEMS_SUCCESSFUL ) |
|
162 | if ( status != RTEMS_SUCCESSFUL ) | |
163 | { |
|
163 | { | |
164 | PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status ) |
|
164 | PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status ) | |
165 | } |
|
165 | } | |
166 |
|
166 | |||
167 | // suspend science tasks, they will be restarted later depending on the mode |
|
167 | // suspend science tasks, they will be restarted later depending on the mode | |
168 | status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY) |
|
168 | status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY) | |
169 | if (status != RTEMS_SUCCESSFUL) |
|
169 | if (status != RTEMS_SUCCESSFUL) | |
170 | { |
|
170 | { | |
171 | PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status) |
|
171 | PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status) | |
172 | } |
|
172 | } | |
173 |
|
173 | |||
174 | //****************************** |
|
174 | //****************************** | |
175 | // <SPECTRAL MATRICES SIMULATOR> |
|
175 | // <SPECTRAL MATRICES SIMULATOR> | |
176 | LEON_Mask_interrupt( IRQ_SM_SIMULATOR ); |
|
176 | LEON_Mask_interrupt( IRQ_SM_SIMULATOR ); | |
177 | configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR, |
|
177 | configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR, | |
178 | IRQ_SPARC_SM_SIMULATOR, spectral_matrices_isr_simu ); |
|
178 | IRQ_SPARC_SM_SIMULATOR, spectral_matrices_isr_simu ); | |
179 | // </SPECTRAL MATRICES SIMULATOR> |
|
179 | // </SPECTRAL MATRICES SIMULATOR> | |
180 | //******************************* |
|
180 | //******************************* | |
181 |
|
181 | |||
182 | // configure IRQ handling for the waveform picker unit |
|
182 | // configure IRQ handling for the waveform picker unit | |
183 | status = rtems_interrupt_catch( waveforms_isr, |
|
183 | status = rtems_interrupt_catch( waveforms_isr, | |
184 | IRQ_SPARC_WAVEFORM_PICKER, |
|
184 | IRQ_SPARC_WAVEFORM_PICKER, | |
185 | &old_isr_handler) ; |
|
185 | &old_isr_handler) ; | |
186 | // configure IRQ handling for the spectral matrices unit |
|
186 | // configure IRQ handling for the spectral matrices unit | |
187 | status = rtems_interrupt_catch( spectral_matrices_isr, |
|
187 | status = rtems_interrupt_catch( spectral_matrices_isr, | |
188 | IRQ_SPARC_SPECTRAL_MATRIX, |
|
188 | IRQ_SPARC_SPECTRAL_MATRIX, | |
189 | &old_isr_handler) ; |
|
189 | &old_isr_handler) ; | |
190 |
|
190 | |||
191 | // if the spacewire link is not up then send an event to the SPIQ task for link recovery |
|
191 | // if the spacewire link is not up then send an event to the SPIQ task for link recovery | |
192 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
192 | if ( status_spw != RTEMS_SUCCESSFUL ) | |
193 | { |
|
193 | { | |
194 | status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT ); |
|
194 | status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT ); | |
195 | if ( status != RTEMS_SUCCESSFUL ) { |
|
195 | if ( status != RTEMS_SUCCESSFUL ) { | |
196 | PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status ) |
|
196 | PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status ) | |
197 | } |
|
197 | } | |
198 | } |
|
198 | } | |
199 |
|
199 | |||
200 | BOOT_PRINTF("delete INIT\n") |
|
200 | BOOT_PRINTF("delete INIT\n") | |
201 |
|
201 | |||
202 | send_dumb_hk(); |
|
202 | send_dumb_hk(); | |
203 |
|
203 | |||
204 | status = rtems_task_delete(RTEMS_SELF); |
|
204 | status = rtems_task_delete(RTEMS_SELF); | |
205 |
|
205 | |||
206 | } |
|
206 | } | |
207 |
|
207 | |||
208 | void init_local_mode_parameters( void ) |
|
208 | void init_local_mode_parameters( void ) | |
209 | { |
|
209 | { | |
210 | /** This function initialize the param_local global variable with default values. |
|
210 | /** This function initialize the param_local global variable with default values. | |
211 | * |
|
211 | * | |
212 | */ |
|
212 | */ | |
213 |
|
213 | |||
214 | unsigned int i; |
|
214 | unsigned int i; | |
215 |
|
215 | |||
216 | // LOCAL PARAMETERS |
|
216 | // LOCAL PARAMETERS | |
217 | set_local_nb_interrupt_f0_MAX(); |
|
217 | set_local_nb_interrupt_f0_MAX(); | |
218 |
|
218 | |||
219 | BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max) |
|
219 | BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max) | |
220 | BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max) |
|
220 | BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max) | |
221 | BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX) |
|
221 | BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX) | |
222 |
|
222 | |||
223 | // init sequence counters |
|
223 | // init sequence counters | |
224 |
|
224 | |||
225 | for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++) |
|
225 | for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++) | |
226 | { |
|
226 | { | |
227 | sequenceCounters_TC_EXE[i] = 0x00; |
|
227 | sequenceCounters_TC_EXE[i] = 0x00; | |
228 | } |
|
228 | } | |
229 | sequenceCounters_SCIENCE_NORMAL_BURST = 0x00; |
|
229 | sequenceCounters_SCIENCE_NORMAL_BURST = 0x00; | |
230 | sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00; |
|
230 | sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00; | |
231 | } |
|
231 | } | |
232 |
|
232 | |||
233 | void reset_local_time( void ) |
|
233 | void reset_local_time( void ) | |
234 | { |
|
234 | { | |
235 |
time_management_regs->c |
|
235 | time_management_regs->ctrl = 0x02; // software reset, coarse time = 0x80000000 | |
236 | } |
|
236 | } | |
237 |
|
237 | |||
238 | void create_names( void ) // create all names for tasks and queues |
|
238 | void create_names( void ) // create all names for tasks and queues | |
239 | { |
|
239 | { | |
240 | /** This function creates all RTEMS names used in the software for tasks and queues. |
|
240 | /** This function creates all RTEMS names used in the software for tasks and queues. | |
241 | * |
|
241 | * | |
242 | * @return RTEMS directive status codes: |
|
242 | * @return RTEMS directive status codes: | |
243 | * - RTEMS_SUCCESSFUL - successful completion |
|
243 | * - RTEMS_SUCCESSFUL - successful completion | |
244 | * |
|
244 | * | |
245 | */ |
|
245 | */ | |
246 |
|
246 | |||
247 | // task names |
|
247 | // task names | |
248 | Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' ); |
|
248 | Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' ); | |
249 | Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' ); |
|
249 | Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' ); | |
250 | Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' ); |
|
250 | Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' ); | |
251 | Task_name[TASKID_SMIQ] = rtems_build_name( 'S', 'M', 'I', 'Q' ); |
|
251 | Task_name[TASKID_SMIQ] = rtems_build_name( 'S', 'M', 'I', 'Q' ); | |
252 | Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' ); |
|
252 | Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' ); | |
253 | Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' ); |
|
253 | Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' ); | |
254 | Task_name[TASKID_SWBD] = rtems_build_name( 'S', 'W', 'B', 'D' ); |
|
254 | Task_name[TASKID_SWBD] = rtems_build_name( 'S', 'W', 'B', 'D' ); | |
255 | Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' ); |
|
255 | Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' ); | |
256 | Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' ); |
|
256 | Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' ); | |
257 | Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' ); |
|
257 | Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' ); | |
258 | Task_name[TASKID_MATR] = rtems_build_name( 'M', 'A', 'T', 'R' ); |
|
258 | Task_name[TASKID_MATR] = rtems_build_name( 'M', 'A', 'T', 'R' ); | |
259 | Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' ); |
|
259 | Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' ); | |
260 | Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' ); |
|
260 | Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' ); | |
261 | Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' ); |
|
261 | Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' ); | |
262 | Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' ); |
|
262 | Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' ); | |
263 | Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' ); |
|
263 | Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' ); | |
264 |
|
264 | |||
265 | // rate monotonic period names |
|
265 | // rate monotonic period names | |
266 | name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' ); |
|
266 | name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' ); | |
267 |
|
267 | |||
268 | misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' ); |
|
268 | misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' ); | |
269 | misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' ); |
|
269 | misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' ); | |
270 | } |
|
270 | } | |
271 |
|
271 | |||
272 | int create_all_tasks( void ) // create all tasks which run in the software |
|
272 | int create_all_tasks( void ) // create all tasks which run in the software | |
273 | { |
|
273 | { | |
274 | /** This function creates all RTEMS tasks used in the software. |
|
274 | /** This function creates all RTEMS tasks used in the software. | |
275 | * |
|
275 | * | |
276 | * @return RTEMS directive status codes: |
|
276 | * @return RTEMS directive status codes: | |
277 | * - RTEMS_SUCCESSFUL - task created successfully |
|
277 | * - RTEMS_SUCCESSFUL - task created successfully | |
278 | * - RTEMS_INVALID_ADDRESS - id is NULL |
|
278 | * - RTEMS_INVALID_ADDRESS - id is NULL | |
279 | * - RTEMS_INVALID_NAME - invalid task name |
|
279 | * - RTEMS_INVALID_NAME - invalid task name | |
280 | * - RTEMS_INVALID_PRIORITY - invalid task priority |
|
280 | * - RTEMS_INVALID_PRIORITY - invalid task priority | |
281 | * - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured |
|
281 | * - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured | |
282 | * - RTEMS_TOO_MANY - too many tasks created |
|
282 | * - RTEMS_TOO_MANY - too many tasks created | |
283 | * - RTEMS_UNSATISFIED - not enough memory for stack/FP context |
|
283 | * - RTEMS_UNSATISFIED - not enough memory for stack/FP context | |
284 | * - RTEMS_TOO_MANY - too many global objects |
|
284 | * - RTEMS_TOO_MANY - too many global objects | |
285 | * |
|
285 | * | |
286 | */ |
|
286 | */ | |
287 |
|
287 | |||
288 | rtems_status_code status; |
|
288 | rtems_status_code status; | |
289 |
|
289 | |||
290 | //********** |
|
290 | //********** | |
291 | // SPACEWIRE |
|
291 | // SPACEWIRE | |
292 | // RECV |
|
292 | // RECV | |
293 | status = rtems_task_create( |
|
293 | status = rtems_task_create( | |
294 | Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE, |
|
294 | Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE, | |
295 | RTEMS_DEFAULT_MODES, |
|
295 | RTEMS_DEFAULT_MODES, | |
296 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV] |
|
296 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV] | |
297 | ); |
|
297 | ); | |
298 | if (status == RTEMS_SUCCESSFUL) // SEND |
|
298 | if (status == RTEMS_SUCCESSFUL) // SEND | |
299 | { |
|
299 | { | |
300 | status = rtems_task_create( |
|
300 | status = rtems_task_create( | |
301 | Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE, |
|
301 | Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE, | |
302 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
302 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, | |
303 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SEND] |
|
303 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SEND] | |
304 | ); |
|
304 | ); | |
305 | } |
|
305 | } | |
306 | if (status == RTEMS_SUCCESSFUL) // WTDG |
|
306 | if (status == RTEMS_SUCCESSFUL) // WTDG | |
307 | { |
|
307 | { | |
308 | status = rtems_task_create( |
|
308 | status = rtems_task_create( | |
309 | Task_name[TASKID_WTDG], TASK_PRIORITY_WTDG, RTEMS_MINIMUM_STACK_SIZE, |
|
309 | Task_name[TASKID_WTDG], TASK_PRIORITY_WTDG, RTEMS_MINIMUM_STACK_SIZE, | |
310 | RTEMS_DEFAULT_MODES, |
|
310 | RTEMS_DEFAULT_MODES, | |
311 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_WTDG] |
|
311 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_WTDG] | |
312 | ); |
|
312 | ); | |
313 | } |
|
313 | } | |
314 | if (status == RTEMS_SUCCESSFUL) // ACTN |
|
314 | if (status == RTEMS_SUCCESSFUL) // ACTN | |
315 | { |
|
315 | { | |
316 | status = rtems_task_create( |
|
316 | status = rtems_task_create( | |
317 | Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE, |
|
317 | Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE, | |
318 | RTEMS_DEFAULT_MODES, |
|
318 | RTEMS_DEFAULT_MODES, | |
319 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN] |
|
319 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN] | |
320 | ); |
|
320 | ); | |
321 | } |
|
321 | } | |
322 | if (status == RTEMS_SUCCESSFUL) // SPIQ |
|
322 | if (status == RTEMS_SUCCESSFUL) // SPIQ | |
323 | { |
|
323 | { | |
324 | status = rtems_task_create( |
|
324 | status = rtems_task_create( | |
325 | Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE, |
|
325 | Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE, | |
326 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
326 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, | |
327 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ] |
|
327 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ] | |
328 | ); |
|
328 | ); | |
329 | } |
|
329 | } | |
330 |
|
330 | |||
331 | //****************** |
|
331 | //****************** | |
332 | // SPECTRAL MATRICES |
|
332 | // SPECTRAL MATRICES | |
333 | if (status == RTEMS_SUCCESSFUL) // SMIQ |
|
333 | if (status == RTEMS_SUCCESSFUL) // SMIQ | |
334 | { |
|
334 | { | |
335 | status = rtems_task_create( |
|
335 | status = rtems_task_create( | |
336 | Task_name[TASKID_SMIQ], TASK_PRIORITY_SMIQ, RTEMS_MINIMUM_STACK_SIZE, |
|
336 | Task_name[TASKID_SMIQ], TASK_PRIORITY_SMIQ, RTEMS_MINIMUM_STACK_SIZE, | |
337 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
337 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, | |
338 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SMIQ] |
|
338 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SMIQ] | |
339 | ); |
|
339 | ); | |
340 | } |
|
340 | } | |
341 | if (status == RTEMS_SUCCESSFUL) // AVF0 |
|
341 | if (status == RTEMS_SUCCESSFUL) // AVF0 | |
342 | { |
|
342 | { | |
343 | status = rtems_task_create( |
|
343 | status = rtems_task_create( | |
344 | Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE, |
|
344 | Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE, | |
345 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
345 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, | |
346 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0] |
|
346 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0] | |
347 | ); |
|
347 | ); | |
348 | } |
|
348 | } | |
349 | if (status == RTEMS_SUCCESSFUL) // MATR |
|
349 | if (status == RTEMS_SUCCESSFUL) // MATR | |
350 | { |
|
350 | { | |
351 | status = rtems_task_create( |
|
351 | status = rtems_task_create( | |
352 | Task_name[TASKID_MATR], TASK_PRIORITY_MATR, RTEMS_MINIMUM_STACK_SIZE, |
|
352 | Task_name[TASKID_MATR], TASK_PRIORITY_MATR, RTEMS_MINIMUM_STACK_SIZE, | |
353 | RTEMS_DEFAULT_MODES, |
|
353 | RTEMS_DEFAULT_MODES, | |
354 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_MATR] |
|
354 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_MATR] | |
355 | ); |
|
355 | ); | |
356 | } |
|
356 | } | |
357 |
|
357 | |||
358 | //**************** |
|
358 | //**************** | |
359 | // WAVEFORM PICKER |
|
359 | // WAVEFORM PICKER | |
360 | if (status == RTEMS_SUCCESSFUL) // WFRM |
|
360 | if (status == RTEMS_SUCCESSFUL) // WFRM | |
361 | { |
|
361 | { | |
362 | status = rtems_task_create( |
|
362 | status = rtems_task_create( | |
363 | Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE, |
|
363 | Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE, | |
364 | RTEMS_DEFAULT_MODES, |
|
364 | RTEMS_DEFAULT_MODES, | |
365 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM] |
|
365 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM] | |
366 | ); |
|
366 | ); | |
367 | } |
|
367 | } | |
368 | if (status == RTEMS_SUCCESSFUL) // CWF3 |
|
368 | if (status == RTEMS_SUCCESSFUL) // CWF3 | |
369 | { |
|
369 | { | |
370 | status = rtems_task_create( |
|
370 | status = rtems_task_create( | |
371 | Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE, |
|
371 | Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE, | |
372 | RTEMS_DEFAULT_MODES, |
|
372 | RTEMS_DEFAULT_MODES, | |
373 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF3] |
|
373 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF3] | |
374 | ); |
|
374 | ); | |
375 | } |
|
375 | } | |
376 | if (status == RTEMS_SUCCESSFUL) // CWF2 |
|
376 | if (status == RTEMS_SUCCESSFUL) // CWF2 | |
377 | { |
|
377 | { | |
378 | status = rtems_task_create( |
|
378 | status = rtems_task_create( | |
379 | Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE, |
|
379 | Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE, | |
380 | RTEMS_DEFAULT_MODES, |
|
380 | RTEMS_DEFAULT_MODES, | |
381 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF2] |
|
381 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF2] | |
382 | ); |
|
382 | ); | |
383 | } |
|
383 | } | |
384 | if (status == RTEMS_SUCCESSFUL) // CWF1 |
|
384 | if (status == RTEMS_SUCCESSFUL) // CWF1 | |
385 | { |
|
385 | { | |
386 | status = rtems_task_create( |
|
386 | status = rtems_task_create( | |
387 | Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE, |
|
387 | Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE, | |
388 | RTEMS_DEFAULT_MODES, |
|
388 | RTEMS_DEFAULT_MODES, | |
389 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF1] |
|
389 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF1] | |
390 | ); |
|
390 | ); | |
391 | } |
|
391 | } | |
392 | if (status == RTEMS_SUCCESSFUL) // SWBD |
|
392 | if (status == RTEMS_SUCCESSFUL) // SWBD | |
393 | { |
|
393 | { | |
394 | status = rtems_task_create( |
|
394 | status = rtems_task_create( | |
395 | Task_name[TASKID_SWBD], TASK_PRIORITY_SWBD, RTEMS_MINIMUM_STACK_SIZE, |
|
395 | Task_name[TASKID_SWBD], TASK_PRIORITY_SWBD, RTEMS_MINIMUM_STACK_SIZE, | |
396 | RTEMS_DEFAULT_MODES, |
|
396 | RTEMS_DEFAULT_MODES, | |
397 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_SWBD] |
|
397 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_SWBD] | |
398 | ); |
|
398 | ); | |
399 | } |
|
399 | } | |
400 |
|
400 | |||
401 | //***** |
|
401 | //***** | |
402 | // MISC |
|
402 | // MISC | |
403 | if (status == RTEMS_SUCCESSFUL) // STAT |
|
403 | if (status == RTEMS_SUCCESSFUL) // STAT | |
404 | { |
|
404 | { | |
405 | status = rtems_task_create( |
|
405 | status = rtems_task_create( | |
406 | Task_name[TASKID_STAT], TASK_PRIORITY_STAT, RTEMS_MINIMUM_STACK_SIZE, |
|
406 | Task_name[TASKID_STAT], TASK_PRIORITY_STAT, RTEMS_MINIMUM_STACK_SIZE, | |
407 | RTEMS_DEFAULT_MODES, |
|
407 | RTEMS_DEFAULT_MODES, | |
408 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT] |
|
408 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT] | |
409 | ); |
|
409 | ); | |
410 | } |
|
410 | } | |
411 | if (status == RTEMS_SUCCESSFUL) // DUMB |
|
411 | if (status == RTEMS_SUCCESSFUL) // DUMB | |
412 | { |
|
412 | { | |
413 | status = rtems_task_create( |
|
413 | status = rtems_task_create( | |
414 | Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE, |
|
414 | Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE, | |
415 | RTEMS_DEFAULT_MODES, |
|
415 | RTEMS_DEFAULT_MODES, | |
416 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB] |
|
416 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB] | |
417 | ); |
|
417 | ); | |
418 | } |
|
418 | } | |
419 | if (status == RTEMS_SUCCESSFUL) // HOUS |
|
419 | if (status == RTEMS_SUCCESSFUL) // HOUS | |
420 | { |
|
420 | { | |
421 | status = rtems_task_create( |
|
421 | status = rtems_task_create( | |
422 | Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE, |
|
422 | Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE, | |
423 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
423 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, | |
424 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS] |
|
424 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS] | |
425 | ); |
|
425 | ); | |
426 | } |
|
426 | } | |
427 |
|
427 | |||
428 | return status; |
|
428 | return status; | |
429 | } |
|
429 | } | |
430 |
|
430 | |||
431 | int start_recv_send_tasks( void ) |
|
431 | int start_recv_send_tasks( void ) | |
432 | { |
|
432 | { | |
433 | rtems_status_code status; |
|
433 | rtems_status_code status; | |
434 |
|
434 | |||
435 | status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 ); |
|
435 | status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 ); | |
436 | if (status!=RTEMS_SUCCESSFUL) { |
|
436 | if (status!=RTEMS_SUCCESSFUL) { | |
437 | BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n") |
|
437 | BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n") | |
438 | } |
|
438 | } | |
439 |
|
439 | |||
440 | if (status == RTEMS_SUCCESSFUL) // SEND |
|
440 | if (status == RTEMS_SUCCESSFUL) // SEND | |
441 | { |
|
441 | { | |
442 | status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 ); |
|
442 | status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 ); | |
443 | if (status!=RTEMS_SUCCESSFUL) { |
|
443 | if (status!=RTEMS_SUCCESSFUL) { | |
444 | BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n") |
|
444 | BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n") | |
445 | } |
|
445 | } | |
446 | } |
|
446 | } | |
447 |
|
447 | |||
448 | return status; |
|
448 | return status; | |
449 | } |
|
449 | } | |
450 |
|
450 | |||
451 | int start_all_tasks( void ) // start all tasks except SEND RECV and HOUS |
|
451 | int start_all_tasks( void ) // start all tasks except SEND RECV and HOUS | |
452 | { |
|
452 | { | |
453 | /** This function starts all RTEMS tasks used in the software. |
|
453 | /** This function starts all RTEMS tasks used in the software. | |
454 | * |
|
454 | * | |
455 | * @return RTEMS directive status codes: |
|
455 | * @return RTEMS directive status codes: | |
456 | * - RTEMS_SUCCESSFUL - ask started successfully |
|
456 | * - RTEMS_SUCCESSFUL - ask started successfully | |
457 | * - RTEMS_INVALID_ADDRESS - invalid task entry point |
|
457 | * - RTEMS_INVALID_ADDRESS - invalid task entry point | |
458 | * - RTEMS_INVALID_ID - invalid task id |
|
458 | * - RTEMS_INVALID_ID - invalid task id | |
459 | * - RTEMS_INCORRECT_STATE - task not in the dormant state |
|
459 | * - RTEMS_INCORRECT_STATE - task not in the dormant state | |
460 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot start remote task |
|
460 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot start remote task | |
461 | * |
|
461 | * | |
462 | */ |
|
462 | */ | |
463 | // starts all the tasks fot eh flight software |
|
463 | // starts all the tasks fot eh flight software | |
464 |
|
464 | |||
465 | rtems_status_code status; |
|
465 | rtems_status_code status; | |
466 |
|
466 | |||
467 | //********** |
|
467 | //********** | |
468 | // SPACEWIRE |
|
468 | // SPACEWIRE | |
469 | status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 ); |
|
469 | status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 ); | |
470 | if (status!=RTEMS_SUCCESSFUL) { |
|
470 | if (status!=RTEMS_SUCCESSFUL) { | |
471 | BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n") |
|
471 | BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n") | |
472 | } |
|
472 | } | |
473 |
|
473 | |||
474 | if (status == RTEMS_SUCCESSFUL) // WTDG |
|
474 | if (status == RTEMS_SUCCESSFUL) // WTDG | |
475 | { |
|
475 | { | |
476 | status = rtems_task_start( Task_id[TASKID_WTDG], wtdg_task, 1 ); |
|
476 | status = rtems_task_start( Task_id[TASKID_WTDG], wtdg_task, 1 ); | |
477 | if (status!=RTEMS_SUCCESSFUL) { |
|
477 | if (status!=RTEMS_SUCCESSFUL) { | |
478 | BOOT_PRINTF("in INIT *** Error starting TASK_WTDG\n") |
|
478 | BOOT_PRINTF("in INIT *** Error starting TASK_WTDG\n") | |
479 | } |
|
479 | } | |
480 | } |
|
480 | } | |
481 |
|
481 | |||
482 | if (status == RTEMS_SUCCESSFUL) // ACTN |
|
482 | if (status == RTEMS_SUCCESSFUL) // ACTN | |
483 | { |
|
483 | { | |
484 | status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 ); |
|
484 | status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 ); | |
485 | if (status!=RTEMS_SUCCESSFUL) { |
|
485 | if (status!=RTEMS_SUCCESSFUL) { | |
486 | BOOT_PRINTF("in INIT *** Error starting TASK_ACTN\n") |
|
486 | BOOT_PRINTF("in INIT *** Error starting TASK_ACTN\n") | |
487 | } |
|
487 | } | |
488 | } |
|
488 | } | |
489 |
|
489 | |||
490 | //****************** |
|
490 | //****************** | |
491 | // SPECTRAL MATRICES |
|
491 | // SPECTRAL MATRICES | |
492 | if (status == RTEMS_SUCCESSFUL) // SMIQ |
|
492 | if (status == RTEMS_SUCCESSFUL) // SMIQ | |
493 | { |
|
493 | { | |
494 | status = rtems_task_start( Task_id[TASKID_SMIQ], smiq_task, 1 ); |
|
494 | status = rtems_task_start( Task_id[TASKID_SMIQ], smiq_task, 1 ); | |
495 | if (status!=RTEMS_SUCCESSFUL) { |
|
495 | if (status!=RTEMS_SUCCESSFUL) { | |
496 | BOOT_PRINTF("in INIT *** Error starting TASK_BPPR\n") |
|
496 | BOOT_PRINTF("in INIT *** Error starting TASK_BPPR\n") | |
497 | } |
|
497 | } | |
498 | } |
|
498 | } | |
499 |
|
499 | |||
500 | if (status == RTEMS_SUCCESSFUL) // AVF0 |
|
500 | if (status == RTEMS_SUCCESSFUL) // AVF0 | |
501 | { |
|
501 | { | |
502 | status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, 1 ); |
|
502 | status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, 1 ); | |
503 | if (status!=RTEMS_SUCCESSFUL) { |
|
503 | if (status!=RTEMS_SUCCESSFUL) { | |
504 | BOOT_PRINTF("in INIT *** Error starting TASK_AVF0\n") |
|
504 | BOOT_PRINTF("in INIT *** Error starting TASK_AVF0\n") | |
505 | } |
|
505 | } | |
506 | } |
|
506 | } | |
507 |
|
507 | |||
508 | if (status == RTEMS_SUCCESSFUL) // MATR |
|
508 | if (status == RTEMS_SUCCESSFUL) // MATR | |
509 | { |
|
509 | { | |
510 | status = rtems_task_start( Task_id[TASKID_MATR], matr_task, 1 ); |
|
510 | status = rtems_task_start( Task_id[TASKID_MATR], matr_task, 1 ); | |
511 | if (status!=RTEMS_SUCCESSFUL) { |
|
511 | if (status!=RTEMS_SUCCESSFUL) { | |
512 | BOOT_PRINTF("in INIT *** Error starting TASK_MATR\n") |
|
512 | BOOT_PRINTF("in INIT *** Error starting TASK_MATR\n") | |
513 | } |
|
513 | } | |
514 | } |
|
514 | } | |
515 |
|
515 | |||
516 | //**************** |
|
516 | //**************** | |
517 | // WAVEFORM PICKER |
|
517 | // WAVEFORM PICKER | |
518 | if (status == RTEMS_SUCCESSFUL) // WFRM |
|
518 | if (status == RTEMS_SUCCESSFUL) // WFRM | |
519 | { |
|
519 | { | |
520 | status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 ); |
|
520 | status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 ); | |
521 | if (status!=RTEMS_SUCCESSFUL) { |
|
521 | if (status!=RTEMS_SUCCESSFUL) { | |
522 | BOOT_PRINTF("in INIT *** Error starting TASK_WFRM\n") |
|
522 | BOOT_PRINTF("in INIT *** Error starting TASK_WFRM\n") | |
523 | } |
|
523 | } | |
524 | } |
|
524 | } | |
525 |
|
525 | |||
526 | if (status == RTEMS_SUCCESSFUL) // CWF3 |
|
526 | if (status == RTEMS_SUCCESSFUL) // CWF3 | |
527 | { |
|
527 | { | |
528 | status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 ); |
|
528 | status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 ); | |
529 | if (status!=RTEMS_SUCCESSFUL) { |
|
529 | if (status!=RTEMS_SUCCESSFUL) { | |
530 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF3\n") |
|
530 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF3\n") | |
531 | } |
|
531 | } | |
532 | } |
|
532 | } | |
533 |
|
533 | |||
534 | if (status == RTEMS_SUCCESSFUL) // CWF2 |
|
534 | if (status == RTEMS_SUCCESSFUL) // CWF2 | |
535 | { |
|
535 | { | |
536 | status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 ); |
|
536 | status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 ); | |
537 | if (status!=RTEMS_SUCCESSFUL) { |
|
537 | if (status!=RTEMS_SUCCESSFUL) { | |
538 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF2\n") |
|
538 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF2\n") | |
539 | } |
|
539 | } | |
540 | } |
|
540 | } | |
541 |
|
541 | |||
542 | if (status == RTEMS_SUCCESSFUL) // CWF1 |
|
542 | if (status == RTEMS_SUCCESSFUL) // CWF1 | |
543 | { |
|
543 | { | |
544 | status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 ); |
|
544 | status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 ); | |
545 | if (status!=RTEMS_SUCCESSFUL) { |
|
545 | if (status!=RTEMS_SUCCESSFUL) { | |
546 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF1\n") |
|
546 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF1\n") | |
547 | } |
|
547 | } | |
548 | } |
|
548 | } | |
549 |
|
549 | |||
550 | if (status == RTEMS_SUCCESSFUL) // SWBD |
|
550 | if (status == RTEMS_SUCCESSFUL) // SWBD | |
551 | { |
|
551 | { | |
552 | status = rtems_task_start( Task_id[TASKID_SWBD], swbd_task, 1 ); |
|
552 | status = rtems_task_start( Task_id[TASKID_SWBD], swbd_task, 1 ); | |
553 | if (status!=RTEMS_SUCCESSFUL) { |
|
553 | if (status!=RTEMS_SUCCESSFUL) { | |
554 | BOOT_PRINTF("in INIT *** Error starting TASK_SWBD\n") |
|
554 | BOOT_PRINTF("in INIT *** Error starting TASK_SWBD\n") | |
555 | } |
|
555 | } | |
556 | } |
|
556 | } | |
557 |
|
557 | |||
558 | //***** |
|
558 | //***** | |
559 | // MISC |
|
559 | // MISC | |
560 | if (status == RTEMS_SUCCESSFUL) // HOUS |
|
560 | if (status == RTEMS_SUCCESSFUL) // HOUS | |
561 | { |
|
561 | { | |
562 | status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 ); |
|
562 | status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 ); | |
563 | if (status!=RTEMS_SUCCESSFUL) { |
|
563 | if (status!=RTEMS_SUCCESSFUL) { | |
564 | BOOT_PRINTF("in INIT *** Error starting TASK_HOUS\n") |
|
564 | BOOT_PRINTF("in INIT *** Error starting TASK_HOUS\n") | |
565 | } |
|
565 | } | |
566 | } |
|
566 | } | |
567 |
|
567 | |||
568 | if (status == RTEMS_SUCCESSFUL) // DUMB |
|
568 | if (status == RTEMS_SUCCESSFUL) // DUMB | |
569 | { |
|
569 | { | |
570 | status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 ); |
|
570 | status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 ); | |
571 | if (status!=RTEMS_SUCCESSFUL) { |
|
571 | if (status!=RTEMS_SUCCESSFUL) { | |
572 | BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n") |
|
572 | BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n") | |
573 | } |
|
573 | } | |
574 | } |
|
574 | } | |
575 |
|
575 | |||
576 | if (status == RTEMS_SUCCESSFUL) // STAT |
|
576 | if (status == RTEMS_SUCCESSFUL) // STAT | |
577 | { |
|
577 | { | |
578 | status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 ); |
|
578 | status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 ); | |
579 | if (status!=RTEMS_SUCCESSFUL) { |
|
579 | if (status!=RTEMS_SUCCESSFUL) { | |
580 | BOOT_PRINTF("in INIT *** Error starting TASK_STAT\n") |
|
580 | BOOT_PRINTF("in INIT *** Error starting TASK_STAT\n") | |
581 | } |
|
581 | } | |
582 | } |
|
582 | } | |
583 |
|
583 | |||
584 | return status; |
|
584 | return status; | |
585 | } |
|
585 | } | |
586 |
|
586 | |||
587 | rtems_status_code create_message_queues( void ) // create the two message queues used in the software |
|
587 | rtems_status_code create_message_queues( void ) // create the two message queues used in the software | |
588 | { |
|
588 | { | |
589 | rtems_status_code status_recv; |
|
589 | rtems_status_code status_recv; | |
590 | rtems_status_code status_send; |
|
590 | rtems_status_code status_send; | |
591 | rtems_status_code ret; |
|
591 | rtems_status_code ret; | |
592 | rtems_id queue_id; |
|
592 | rtems_id queue_id; | |
593 |
|
593 | |||
594 | // create the queue for handling valid TCs |
|
594 | // create the queue for handling valid TCs | |
595 | status_recv = rtems_message_queue_create( misc_name[QUEUE_RECV], |
|
595 | status_recv = rtems_message_queue_create( misc_name[QUEUE_RECV], | |
596 | ACTION_MSG_QUEUE_COUNT, CCSDS_TC_PKT_MAX_SIZE, |
|
596 | ACTION_MSG_QUEUE_COUNT, CCSDS_TC_PKT_MAX_SIZE, | |
597 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); |
|
597 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); | |
598 | if ( status_recv != RTEMS_SUCCESSFUL ) { |
|
598 | if ( status_recv != RTEMS_SUCCESSFUL ) { | |
599 | PRINTF1("in create_message_queues *** ERR creating QUEU queue, %d\n", status_recv) |
|
599 | PRINTF1("in create_message_queues *** ERR creating QUEU queue, %d\n", status_recv) | |
600 | } |
|
600 | } | |
601 |
|
601 | |||
602 | // create the queue for handling TM packet sending |
|
602 | // create the queue for handling TM packet sending | |
603 | status_send = rtems_message_queue_create( misc_name[QUEUE_SEND], |
|
603 | status_send = rtems_message_queue_create( misc_name[QUEUE_SEND], | |
604 | ACTION_MSG_PKTS_COUNT, ACTION_MSG_PKTS_MAX_SIZE, |
|
604 | ACTION_MSG_PKTS_COUNT, ACTION_MSG_PKTS_MAX_SIZE, | |
605 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); |
|
605 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); | |
606 | if ( status_send != RTEMS_SUCCESSFUL ) { |
|
606 | if ( status_send != RTEMS_SUCCESSFUL ) { | |
607 | PRINTF1("in create_message_queues *** ERR creating PKTS queue, %d\n", status_send) |
|
607 | PRINTF1("in create_message_queues *** ERR creating PKTS queue, %d\n", status_send) | |
608 | } |
|
608 | } | |
609 |
|
609 | |||
610 | if ( status_recv != RTEMS_SUCCESSFUL ) |
|
610 | if ( status_recv != RTEMS_SUCCESSFUL ) | |
611 | { |
|
611 | { | |
612 | ret = status_recv; |
|
612 | ret = status_recv; | |
613 | } |
|
613 | } | |
614 | else |
|
614 | else | |
615 | { |
|
615 | { | |
616 | ret = status_send; |
|
616 | ret = status_send; | |
617 | } |
|
617 | } | |
618 |
|
618 | |||
619 | return ret; |
|
619 | return ret; | |
620 | } |
|
620 | } | |
621 |
|
621 | |||
622 | rtems_status_code get_message_queue_id_send( rtems_id *queue_id ) |
|
622 | rtems_status_code get_message_queue_id_send( rtems_id *queue_id ) | |
623 | { |
|
623 | { | |
624 | rtems_status_code status; |
|
624 | rtems_status_code status; | |
625 | rtems_name queue_name; |
|
625 | rtems_name queue_name; | |
626 |
|
626 | |||
627 | queue_name = rtems_build_name( 'Q', '_', 'S', 'D' ); |
|
627 | queue_name = rtems_build_name( 'Q', '_', 'S', 'D' ); | |
628 |
|
628 | |||
629 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); |
|
629 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); | |
630 |
|
630 | |||
631 | return status; |
|
631 | return status; | |
632 | } |
|
632 | } | |
633 |
|
633 | |||
634 | rtems_status_code get_message_queue_id_recv( rtems_id *queue_id ) |
|
634 | rtems_status_code get_message_queue_id_recv( rtems_id *queue_id ) | |
635 | { |
|
635 | { | |
636 | rtems_status_code status; |
|
636 | rtems_status_code status; | |
637 | rtems_name queue_name; |
|
637 | rtems_name queue_name; | |
638 |
|
638 | |||
639 | queue_name = rtems_build_name( 'Q', '_', 'R', 'V' ); |
|
639 | queue_name = rtems_build_name( 'Q', '_', 'R', 'V' ); | |
640 |
|
640 | |||
641 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); |
|
641 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); | |
642 |
|
642 | |||
643 | return status; |
|
643 | return status; | |
644 | } |
|
644 | } |
@@ -1,414 +1,420 | |||||
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 | rtems_rate_monotonic_period_status period_status; | |
147 |
|
147 | |||
148 | status = get_message_queue_id_send( &queue_id ); |
|
148 | status = get_message_queue_id_send( &queue_id ); | |
149 | if (status != RTEMS_SUCCESSFUL) |
|
149 | if (status != RTEMS_SUCCESSFUL) | |
150 | { |
|
150 | { | |
151 | 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) | |
152 | } |
|
152 | } | |
153 |
|
153 | |||
154 | BOOT_PRINTF("in HOUS ***\n") |
|
154 | BOOT_PRINTF("in HOUS ***\n") | |
155 |
|
155 | |||
156 | 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) { | |
157 | status = rtems_rate_monotonic_create( name_hk_rate_monotonic, &HK_id ); |
|
157 | status = rtems_rate_monotonic_create( name_hk_rate_monotonic, &HK_id ); | |
158 | if( status != RTEMS_SUCCESSFUL ) { |
|
158 | if( status != RTEMS_SUCCESSFUL ) { | |
159 | 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 ) | |
160 | } |
|
160 | } | |
161 | } |
|
161 | } | |
162 |
|
162 | |||
163 | housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
163 | housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; | |
164 | housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
164 | housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
165 | housekeeping_packet.reserved = DEFAULT_RESERVED; |
|
165 | housekeeping_packet.reserved = DEFAULT_RESERVED; | |
166 | housekeeping_packet.userApplication = CCSDS_USER_APP; |
|
166 | housekeeping_packet.userApplication = CCSDS_USER_APP; | |
167 | housekeeping_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_HK >> 8); |
|
167 | housekeeping_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_HK >> 8); | |
168 | housekeeping_packet.packetID[1] = (unsigned char) (TM_PACKET_ID_HK); |
|
168 | housekeeping_packet.packetID[1] = (unsigned char) (TM_PACKET_ID_HK); | |
169 | housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
169 | housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
170 | housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
170 | housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
171 | housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8); |
|
171 | housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8); | |
172 | housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK ); |
|
172 | housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK ); | |
173 | housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
173 | housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
174 | housekeeping_packet.serviceType = TM_TYPE_HK; |
|
174 | housekeeping_packet.serviceType = TM_TYPE_HK; | |
175 | housekeeping_packet.serviceSubType = TM_SUBTYPE_HK; |
|
175 | housekeeping_packet.serviceSubType = TM_SUBTYPE_HK; | |
176 | housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND; |
|
176 | housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND; | |
177 | housekeeping_packet.sid = SID_HK; |
|
177 | housekeeping_packet.sid = SID_HK; | |
178 |
|
178 | |||
179 | status = rtems_rate_monotonic_cancel(HK_id); |
|
179 | status = rtems_rate_monotonic_cancel(HK_id); | |
180 | if( status != RTEMS_SUCCESSFUL ) { |
|
180 | if( status != RTEMS_SUCCESSFUL ) { | |
181 | 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 ) | |
182 | } |
|
182 | } | |
183 | else { |
|
183 | else { | |
184 | 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") | |
185 | } |
|
185 | } | |
186 |
|
186 | |||
187 | // startup phase |
|
187 | // startup phase | |
188 | status = rtems_rate_monotonic_period( HK_id, SY_LFR_TIME_SYN_TIMEOUT_in_ticks ); |
|
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 ); |
|
189 | status = rtems_rate_monotonic_get_status( HK_id, &period_status ); | |
190 | DEBUG_PRINTF1("startup HK, HK_id status = %d\n", period_status.state) |
|
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 |
|
191 | while(period_status.state != RATE_MONOTONIC_EXPIRED ) // after SY_LFR_TIME_SYN_TIMEOUT ms, starts HK anyway | |
192 | { |
|
192 | { | |
193 | if ((time_management_regs->coarse_time & 0x80000000) == 0x00000000) // check time synchronization |
|
193 | if ((time_management_regs->coarse_time & 0x80000000) == 0x00000000) // check time synchronization | |
194 | { |
|
194 | { | |
195 | break; // break if LFR is synchronized |
|
195 | break; // break if LFR is synchronized | |
196 | } |
|
196 | } | |
197 | else |
|
197 | else | |
198 | { |
|
198 | { | |
199 | status = rtems_rate_monotonic_get_status( HK_id, &period_status ); |
|
199 | status = rtems_rate_monotonic_get_status( HK_id, &period_status ); | |
200 | sched_yield(); |
|
200 | sched_yield(); | |
201 | } |
|
201 | } | |
202 | } |
|
202 | } | |
203 | status = rtems_rate_monotonic_cancel(HK_id); |
|
203 | status = rtems_rate_monotonic_cancel(HK_id); | |
204 | DEBUG_PRINTF1("startup HK, HK_id status = %d\n", period_status.state) |
|
204 | DEBUG_PRINTF1("startup HK, HK_id status = %d\n", period_status.state) | |
205 |
|
205 | |||
206 | while(1){ // launch the rate monotonic task |
|
206 | while(1){ // launch the rate monotonic task | |
207 | status = rtems_rate_monotonic_period( HK_id, HK_PERIOD ); |
|
207 | status = rtems_rate_monotonic_period( HK_id, HK_PERIOD ); | |
208 | if ( status != RTEMS_SUCCESSFUL ) { |
|
208 | if ( status != RTEMS_SUCCESSFUL ) { | |
209 | PRINTF1( "in HOUS *** ERR period: %d\n", status); |
|
209 | PRINTF1( "in HOUS *** ERR period: %d\n", status); | |
210 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_6 ); |
|
210 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_6 ); | |
211 | } |
|
211 | } | |
212 | else { |
|
212 | else { | |
213 | increment_seq_counter( housekeeping_packet.packetSequenceControl ); |
|
213 | increment_seq_counter( housekeeping_packet.packetSequenceControl ); | |
214 | 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); | |
215 | 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); | |
216 | 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); | |
217 | housekeeping_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
217 | housekeeping_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); | |
218 | 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); | |
219 | housekeeping_packet.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
219 | housekeeping_packet.time[5] = (unsigned char) (time_management_regs->fine_time); | |
220 |
|
220 | |||
221 | spacewire_update_statistics(); |
|
221 | spacewire_update_statistics(); | |
222 |
|
222 | |||
223 | // SEND PACKET |
|
223 | // SEND PACKET | |
224 | status = rtems_message_queue_urgent( queue_id, &housekeeping_packet, |
|
224 | status = rtems_message_queue_urgent( queue_id, &housekeeping_packet, | |
225 | 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); | |
226 | if (status != RTEMS_SUCCESSFUL) { |
|
226 | if (status != RTEMS_SUCCESSFUL) { | |
227 | PRINTF1("in HOUS *** ERR send: %d\n", status) |
|
227 | PRINTF1("in HOUS *** ERR send: %d\n", status) | |
228 | } |
|
228 | } | |
229 | } |
|
229 | } | |
230 | } |
|
230 | } | |
231 |
|
231 | |||
232 | PRINTF("in HOUS *** deleting task\n") |
|
232 | PRINTF("in HOUS *** deleting task\n") | |
233 |
|
233 | |||
234 | status = rtems_task_delete( RTEMS_SELF ); // should not return |
|
234 | status = rtems_task_delete( RTEMS_SELF ); // should not return | |
235 | printf( "rtems_task_delete returned with status of %d.\n", status ); |
|
235 | printf( "rtems_task_delete returned with status of %d.\n", status ); | |
236 | return; |
|
236 | return; | |
237 | } |
|
237 | } | |
238 |
|
238 | |||
239 | rtems_task dumb_task( rtems_task_argument unused ) |
|
239 | rtems_task dumb_task( rtems_task_argument unused ) | |
240 | { |
|
240 | { | |
241 | /** 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. | |
242 | * |
|
242 | * | |
243 | * @param unused is the starting argument of the RTEMS task |
|
243 | * @param unused is the starting argument of the RTEMS task | |
244 | * |
|
244 | * | |
245 | * 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. | |
246 | * |
|
246 | * | |
247 | */ |
|
247 | */ | |
248 |
|
248 | |||
249 | unsigned int i; |
|
249 | unsigned int i; | |
250 | unsigned int intEventOut; |
|
250 | unsigned int intEventOut; | |
251 | unsigned int coarse_time = 0; |
|
251 | unsigned int coarse_time = 0; | |
252 | unsigned int fine_time = 0; |
|
252 | unsigned int fine_time = 0; | |
253 | rtems_event_set event_out; |
|
253 | rtems_event_set event_out; | |
254 |
|
254 | |||
255 | char *DumbMessages[10] = {"in DUMB *** default", // RTEMS_EVENT_0 |
|
255 | char *DumbMessages[10] = {"in DUMB *** default", // RTEMS_EVENT_0 | |
256 | "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1 |
|
256 | "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1 | |
257 | "in DUMB *** waveforms_isr", // RTEMS_EVENT_2 |
|
257 | "in DUMB *** waveforms_isr", // RTEMS_EVENT_2 | |
258 | "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 | |
259 | "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 | |
260 | "in DUMB *** waveforms_simulator_isr", // RTEMS_EVENT_5 |
|
260 | "in DUMB *** waveforms_simulator_isr", // RTEMS_EVENT_5 | |
261 | "ERR HK", // RTEMS_EVENT_6 |
|
261 | "ERR HK", // RTEMS_EVENT_6 | |
262 | "ready for dump", // RTEMS_EVENT_7 |
|
262 | "ready for dump", // RTEMS_EVENT_7 | |
263 | "in DUMB *** spectral_matrices_isr", // RTEMS_EVENT_8 |
|
263 | "in DUMB *** spectral_matrices_isr", // RTEMS_EVENT_8 | |
264 | "tick" // RTEMS_EVENT_9 |
|
264 | "tick" // RTEMS_EVENT_9 | |
265 | }; |
|
265 | }; | |
266 |
|
266 | |||
267 | BOOT_PRINTF("in DUMB *** \n") |
|
267 | BOOT_PRINTF("in DUMB *** \n") | |
268 |
|
268 | |||
269 | while(1){ |
|
269 | while(1){ | |
270 | rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3 |
|
270 | rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3 | |
271 | | RTEMS_EVENT_4 | RTEMS_EVENT_5 | RTEMS_EVENT_6 | RTEMS_EVENT_7 |
|
271 | | RTEMS_EVENT_4 | RTEMS_EVENT_5 | RTEMS_EVENT_6 | RTEMS_EVENT_7 | |
272 | | RTEMS_EVENT_8 | RTEMS_EVENT_9, |
|
272 | | RTEMS_EVENT_8 | RTEMS_EVENT_9, | |
273 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT |
|
273 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT | |
274 | intEventOut = (unsigned int) event_out; |
|
274 | intEventOut = (unsigned int) event_out; | |
275 | for ( i=0; i<32; i++) |
|
275 | for ( i=0; i<32; i++) | |
276 | { |
|
276 | { | |
277 | if ( ((intEventOut >> i) & 0x0001) != 0) |
|
277 | if ( ((intEventOut >> i) & 0x0001) != 0) | |
278 | { |
|
278 | { | |
279 | coarse_time = time_management_regs->coarse_time; |
|
279 | coarse_time = time_management_regs->coarse_time; | |
280 | fine_time = time_management_regs->fine_time; |
|
280 | fine_time = time_management_regs->fine_time; | |
281 | printf("in DUMB *** coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]); |
|
281 | printf("in DUMB *** coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]); | |
282 | } |
|
282 | } | |
283 | } |
|
283 | } | |
284 | } |
|
284 | } | |
285 | } |
|
285 | } | |
286 |
|
286 | |||
287 | //***************************** |
|
287 | //***************************** | |
288 | // init housekeeping parameters |
|
288 | // init housekeeping parameters | |
289 |
|
289 | |||
290 | void init_housekeeping_parameters( void ) |
|
290 | void init_housekeeping_parameters( void ) | |
291 | { |
|
291 | { | |
292 | /** This function initialize the housekeeping_packet global variable with default values. |
|
292 | /** This function initialize the housekeeping_packet global variable with default values. | |
293 | * |
|
293 | * | |
294 | */ |
|
294 | */ | |
295 |
|
295 | |||
296 | unsigned int i = 0; |
|
296 | unsigned int i = 0; | |
297 | unsigned char *parameters; |
|
297 | unsigned char *parameters; | |
298 |
|
298 | |||
299 | parameters = (unsigned char*) &housekeeping_packet.lfr_status_word; |
|
299 | parameters = (unsigned char*) &housekeeping_packet.lfr_status_word; | |
300 | for(i = 0; i< SIZE_HK_PARAMETERS; i++) |
|
300 | for(i = 0; i< SIZE_HK_PARAMETERS; i++) | |
301 | { |
|
301 | { | |
302 | parameters[i] = 0x00; |
|
302 | parameters[i] = 0x00; | |
303 | } |
|
303 | } | |
304 | // init status word |
|
304 | // init status word | |
305 | housekeeping_packet.lfr_status_word[0] = DEFAULT_STATUS_WORD_BYTE0; |
|
305 | housekeeping_packet.lfr_status_word[0] = DEFAULT_STATUS_WORD_BYTE0; | |
306 | housekeeping_packet.lfr_status_word[1] = DEFAULT_STATUS_WORD_BYTE1; |
|
306 | housekeeping_packet.lfr_status_word[1] = DEFAULT_STATUS_WORD_BYTE1; | |
307 | // init software version |
|
307 | // init software version | |
308 | housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1; |
|
308 | housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1; | |
309 | housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2; |
|
309 | housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2; | |
310 | housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3; |
|
310 | housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3; | |
311 | housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4; |
|
311 | housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4; | |
312 | // init fpga version |
|
312 | // init fpga version | |
313 | parameters = (unsigned char *) (REGS_ADDR_WAVEFORM_PICKER + 0xb0); |
|
313 | parameters = (unsigned char *) (REGS_ADDR_WAVEFORM_PICKER + 0xb0); | |
314 | housekeeping_packet.lfr_fpga_version[0] = parameters[1]; // n1 |
|
314 | housekeeping_packet.lfr_fpga_version[0] = parameters[1]; // n1 | |
315 | housekeeping_packet.lfr_fpga_version[1] = parameters[2]; // n2 |
|
315 | housekeeping_packet.lfr_fpga_version[1] = parameters[2]; // n2 | |
316 | housekeeping_packet.lfr_fpga_version[2] = parameters[3]; // n3 |
|
316 | housekeeping_packet.lfr_fpga_version[2] = parameters[3]; // n3 | |
317 | } |
|
317 | } | |
318 |
|
318 | |||
319 | void increment_seq_counter( unsigned char *packet_sequence_control) |
|
319 | void increment_seq_counter( unsigned char *packet_sequence_control) | |
320 | { |
|
320 | { | |
321 | /** This function increment the sequence counter psased in argument. |
|
321 | /** This function increment the sequence counter psased in argument. | |
322 | * |
|
322 | * | |
323 | * The increment does not affect the grouping flag. In case of an overflow, the counter is reset to 0. |
|
323 | * The increment does not affect the grouping flag. In case of an overflow, the counter is reset to 0. | |
324 | * |
|
324 | * | |
325 | */ |
|
325 | */ | |
326 |
|
326 | |||
327 | unsigned short sequence_cnt; |
|
327 | unsigned short sequence_cnt; | |
328 | unsigned short segmentation_grouping_flag; |
|
328 | unsigned short segmentation_grouping_flag; | |
329 | unsigned short new_packet_sequence_control; |
|
329 | unsigned short new_packet_sequence_control; | |
330 |
|
330 | |||
331 | segmentation_grouping_flag = (unsigned short) ( (packet_sequence_control[0] & 0xc0) << 8 ); // keep bits 7 downto 6 |
|
331 | segmentation_grouping_flag = (unsigned short) ( (packet_sequence_control[0] & 0xc0) << 8 ); // keep bits 7 downto 6 | |
332 | sequence_cnt = (unsigned short) ( |
|
332 | sequence_cnt = (unsigned short) ( | |
333 | ( (packet_sequence_control[0] & 0x3f) << 8 ) // keep bits 5 downto 0 |
|
333 | ( (packet_sequence_control[0] & 0x3f) << 8 ) // keep bits 5 downto 0 | |
334 | + packet_sequence_control[1] |
|
334 | + packet_sequence_control[1] | |
335 | ); |
|
335 | ); | |
336 |
|
336 | |||
337 | if ( sequence_cnt < SEQ_CNT_MAX) |
|
337 | if ( sequence_cnt < SEQ_CNT_MAX) | |
338 | { |
|
338 | { | |
339 | sequence_cnt = sequence_cnt + 1; |
|
339 | sequence_cnt = sequence_cnt + 1; | |
340 | } |
|
340 | } | |
341 | else |
|
341 | else | |
342 | { |
|
342 | { | |
343 | sequence_cnt = 0; |
|
343 | sequence_cnt = 0; | |
344 | } |
|
344 | } | |
345 |
|
345 | |||
346 | new_packet_sequence_control = segmentation_grouping_flag | sequence_cnt ; |
|
346 | new_packet_sequence_control = segmentation_grouping_flag | sequence_cnt ; | |
347 |
|
347 | |||
348 | packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8); |
|
348 | packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8); | |
349 | packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control ); |
|
349 | packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control ); | |
350 | } |
|
350 | } | |
351 |
|
351 | |||
352 | void getTime( unsigned char *time) |
|
352 | void getTime( unsigned char *time) | |
353 | { |
|
353 | { | |
354 | /** This function write the current local time in the time buffer passed in argument. |
|
354 | /** This function write the current local time in the time buffer passed in argument. | |
355 | * |
|
355 | * | |
356 | */ |
|
356 | */ | |
357 |
|
357 | |||
358 | time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
358 | time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
359 | time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
359 | time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
360 | time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
360 | time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
361 | time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
361 | time[3] = (unsigned char) (time_management_regs->coarse_time); | |
362 | time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
362 | time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
363 | time[5] = (unsigned char) (time_management_regs->fine_time); |
|
363 | time[5] = (unsigned char) (time_management_regs->fine_time); | |
364 | } |
|
364 | } | |
365 |
|
365 | |||
366 | void send_dumb_hk( void ) |
|
366 | void send_dumb_hk( void ) | |
367 | { |
|
367 | { | |
368 | Packet_TM_LFR_HK_t dummy_hk_packet; |
|
368 | Packet_TM_LFR_HK_t dummy_hk_packet; | |
369 | unsigned char *parameters; |
|
369 | unsigned char *parameters; | |
370 | unsigned int i; |
|
370 | unsigned int i; | |
371 | rtems_id queue_id; |
|
371 | rtems_id queue_id; | |
372 |
|
372 | |||
373 | dummy_hk_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
373 | dummy_hk_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; | |
374 | dummy_hk_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
374 | dummy_hk_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
375 | dummy_hk_packet.reserved = DEFAULT_RESERVED; |
|
375 | dummy_hk_packet.reserved = DEFAULT_RESERVED; | |
376 | dummy_hk_packet.userApplication = CCSDS_USER_APP; |
|
376 | dummy_hk_packet.userApplication = CCSDS_USER_APP; | |
377 | dummy_hk_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_HK >> 8); |
|
377 | dummy_hk_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_HK >> 8); | |
378 | dummy_hk_packet.packetID[1] = (unsigned char) (TM_PACKET_ID_HK); |
|
378 | dummy_hk_packet.packetID[1] = (unsigned char) (TM_PACKET_ID_HK); | |
379 | dummy_hk_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
379 | dummy_hk_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
380 | dummy_hk_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
380 | dummy_hk_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
381 | dummy_hk_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8); |
|
381 | dummy_hk_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8); | |
382 | dummy_hk_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK ); |
|
382 | dummy_hk_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK ); | |
383 | dummy_hk_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
383 | dummy_hk_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
384 | dummy_hk_packet.serviceType = TM_TYPE_HK; |
|
384 | dummy_hk_packet.serviceType = TM_TYPE_HK; | |
385 | dummy_hk_packet.serviceSubType = TM_SUBTYPE_HK; |
|
385 | dummy_hk_packet.serviceSubType = TM_SUBTYPE_HK; | |
386 | dummy_hk_packet.destinationID = TM_DESTINATION_ID_GROUND; |
|
386 | dummy_hk_packet.destinationID = TM_DESTINATION_ID_GROUND; | |
|
387 | dummy_hk_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |||
|
388 | dummy_hk_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |||
|
389 | dummy_hk_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |||
|
390 | dummy_hk_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); | |||
|
391 | dummy_hk_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |||
|
392 | dummy_hk_packet.time[5] = (unsigned char) (time_management_regs->fine_time); | |||
387 | dummy_hk_packet.sid = SID_HK; |
|
393 | dummy_hk_packet.sid = SID_HK; | |
388 |
|
394 | |||
389 | // init status word |
|
395 | // init status word | |
390 | dummy_hk_packet.lfr_status_word[0] = 0xff; |
|
396 | dummy_hk_packet.lfr_status_word[0] = 0xff; | |
391 | dummy_hk_packet.lfr_status_word[1] = 0xff; |
|
397 | dummy_hk_packet.lfr_status_word[1] = 0xff; | |
392 | // init software version |
|
398 | // init software version | |
393 | dummy_hk_packet.lfr_sw_version[0] = SW_VERSION_N1; |
|
399 | dummy_hk_packet.lfr_sw_version[0] = SW_VERSION_N1; | |
394 | dummy_hk_packet.lfr_sw_version[1] = SW_VERSION_N2; |
|
400 | dummy_hk_packet.lfr_sw_version[1] = SW_VERSION_N2; | |
395 | dummy_hk_packet.lfr_sw_version[2] = SW_VERSION_N3; |
|
401 | dummy_hk_packet.lfr_sw_version[2] = SW_VERSION_N3; | |
396 | dummy_hk_packet.lfr_sw_version[3] = SW_VERSION_N4; |
|
402 | dummy_hk_packet.lfr_sw_version[3] = SW_VERSION_N4; | |
397 | // init fpga version |
|
403 | // init fpga version | |
398 | parameters = (unsigned char *) (REGS_ADDR_WAVEFORM_PICKER + 0xb0); |
|
404 | parameters = (unsigned char *) (REGS_ADDR_WAVEFORM_PICKER + 0xb0); | |
399 | dummy_hk_packet.lfr_fpga_version[0] = parameters[1]; // n1 |
|
405 | dummy_hk_packet.lfr_fpga_version[0] = parameters[1]; // n1 | |
400 | dummy_hk_packet.lfr_fpga_version[1] = parameters[2]; // n2 |
|
406 | dummy_hk_packet.lfr_fpga_version[1] = parameters[2]; // n2 | |
401 | dummy_hk_packet.lfr_fpga_version[2] = parameters[3]; // n3 |
|
407 | dummy_hk_packet.lfr_fpga_version[2] = parameters[3]; // n3 | |
402 |
|
408 | |||
403 | parameters = (unsigned char *) &dummy_hk_packet.hk_lfr_cpu_load; |
|
409 | parameters = (unsigned char *) &dummy_hk_packet.hk_lfr_cpu_load; | |
404 |
|
410 | |||
405 | for (i=0; i<100; i++) |
|
411 | for (i=0; i<100; i++) | |
406 | { |
|
412 | { | |
407 | parameters[i] = 0xff; |
|
413 | parameters[i] = 0xff; | |
408 | } |
|
414 | } | |
409 |
|
415 | |||
410 | get_message_queue_id_send( &queue_id ); |
|
416 | get_message_queue_id_send( &queue_id ); | |
411 |
|
417 | |||
412 | rtems_message_queue_urgent( queue_id, &dummy_hk_packet, |
|
418 | rtems_message_queue_urgent( queue_id, &dummy_hk_packet, | |
413 | PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES); |
|
419 | PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES); | |
414 | } |
|
420 | } |
@@ -1,766 +1,885 | |||||
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 sm_ring_f0[NB_RING_NODES_ASM_F0]; | |
17 | ring_node sm_ring_f1[NB_RING_NODES_ASM_F1]; |
|
17 | ring_node_sm sm_ring_f1[NB_RING_NODES_ASM_F1]; | |
18 | ring_node sm_ring_f2[NB_RING_NODES_ASM_F2]; |
|
18 | ring_node_sm sm_ring_f2[NB_RING_NODES_ASM_F2]; | |
19 | ring_node *current_ring_node_sm_f0; |
|
19 | ring_node_sm *current_ring_node_sm_f0; | |
20 | ring_node *ring_node_for_averaging_sm_f0; |
|
20 | ring_node_sm *ring_node_for_averaging_sm_f0; | |
21 | ring_node *current_ring_node_sm_f1; |
|
21 | ring_node_sm *current_ring_node_sm_f1; | |
22 | ring_node *current_ring_node_sm_f2; |
|
22 | ring_node_sm *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 | ||||
|
26 | //***** | |||
|
27 | // NORM | |||
|
28 | // F0 | |||
25 | float averaged_sm_f0 [ TIME_OFFSET + TOTAL_SIZE_SM ]; |
|
29 | float averaged_sm_f0 [ TIME_OFFSET + TOTAL_SIZE_SM ]; | |
26 | float averaged_sm_f0_reorganized[ TIME_OFFSET + TOTAL_SIZE_SM ]; |
|
30 | float averaged_sm_f0_reorganized[ TIME_OFFSET + TOTAL_SIZE_SM ]; | |
27 | char averaged_sm_f0_char [ TIME_OFFSET_IN_BYTES + TOTAL_SIZE_SM ]; |
|
31 | char averaged_sm_f0_char [ TIME_OFFSET_IN_BYTES + (TOTAL_SIZE_SM * 2) ]; | |
28 | float compressed_sm_f0 [ TOTAL_SIZE_COMPRESSED_ASM_F0 ]; |
|
32 | float compressed_sm_f0 [ TOTAL_SIZE_COMPRESSED_ASM_F0 ]; | |
29 |
|
33 | |||
|
34 | //***** | |||
|
35 | // SBM1 | |||
|
36 | float averaged_sm_sbm1 [ TIME_OFFSET + TOTAL_SIZE_SM ]; | |||
|
37 | float compressed_sm_sbm1 [ TOTAL_SIZE_COMPRESSED_ASM_SBM1 ]; | |||
|
38 | ||||
30 | unsigned char LFR_BP1_F0[ TIME_OFFSET_IN_BYTES + TOTAL_SIZE_BP1_F0 * 2 ]; |
|
39 | unsigned char LFR_BP1_F0[ TIME_OFFSET_IN_BYTES + TOTAL_SIZE_BP1_F0 * 2 ]; | |
31 | unsigned char LFR_BP1_F1[ TIME_OFFSET_IN_BYTES + TOTAL_SIZE_BP1_F1 ]; |
|
40 | unsigned char LFR_BP1_F1[ TIME_OFFSET_IN_BYTES + TOTAL_SIZE_BP1_F1 ]; | |
32 | unsigned char LFR_BP1_F2[ TIME_OFFSET_IN_BYTES + TOTAL_SIZE_BP1_F2 ]; |
|
41 | unsigned char LFR_BP1_F2[ TIME_OFFSET_IN_BYTES + TOTAL_SIZE_BP1_F2 ]; | |
33 |
|
42 | |||
34 | unsigned int nb_sm_f0; |
|
43 | unsigned int nb_sm_f0; | |
35 |
|
44 | |||
36 | void init_sm_rings( void ) |
|
45 | void init_sm_rings( void ) | |
37 | { |
|
46 | { | |
38 | unsigned char i; |
|
47 | unsigned char i; | |
39 |
|
48 | |||
40 | // F0 RING |
|
49 | // F0 RING | |
41 | sm_ring_f0[0].next = (ring_node*) &sm_ring_f0[1]; |
|
50 | sm_ring_f0[0].next = (ring_node_sm*) &sm_ring_f0[1]; | |
42 | sm_ring_f0[0].previous = (ring_node*) &sm_ring_f0[NB_RING_NODES_ASM_F0-1]; |
|
51 | sm_ring_f0[0].previous = (ring_node_sm*) &sm_ring_f0[NB_RING_NODES_ASM_F0-1]; | |
43 | sm_ring_f0[0].buffer_address = |
|
52 | sm_ring_f0[0].buffer_address = | |
44 | (int) &sm_f0[ 0 ]; |
|
53 | (int) &sm_f0[ 0 ]; | |
45 |
|
54 | |||
46 | sm_ring_f0[NB_RING_NODES_ASM_F0-1].next = (ring_node*) &sm_ring_f0[0]; |
|
55 | sm_ring_f0[NB_RING_NODES_ASM_F0-1].next = (ring_node_sm*) &sm_ring_f0[0]; | |
47 | sm_ring_f0[NB_RING_NODES_ASM_F0-1].previous = (ring_node*) &sm_ring_f0[NB_RING_NODES_ASM_F0-2]; |
|
56 | sm_ring_f0[NB_RING_NODES_ASM_F0-1].previous = (ring_node_sm*) &sm_ring_f0[NB_RING_NODES_ASM_F0-2]; | |
48 | sm_ring_f0[NB_RING_NODES_ASM_F0-1].buffer_address = |
|
57 | sm_ring_f0[NB_RING_NODES_ASM_F0-1].buffer_address = | |
49 | (int) &sm_f0[ (NB_RING_NODES_ASM_F0-1) * TOTAL_SIZE_SM ]; |
|
58 | (int) &sm_f0[ (NB_RING_NODES_ASM_F0-1) * TOTAL_SIZE_SM ]; | |
50 |
|
59 | |||
51 | for(i=1; i<NB_RING_NODES_ASM_F0-1; i++) |
|
60 | for(i=1; i<NB_RING_NODES_ASM_F0-1; i++) | |
52 | { |
|
61 | { | |
53 | sm_ring_f0[i].next = (ring_node*) &sm_ring_f0[i+1]; |
|
62 | sm_ring_f0[i].next = (ring_node_sm*) &sm_ring_f0[i+1]; | |
54 | sm_ring_f0[i].previous = (ring_node*) &sm_ring_f0[i-1]; |
|
63 | sm_ring_f0[i].previous = (ring_node_sm*) &sm_ring_f0[i-1]; | |
55 | sm_ring_f0[i].buffer_address = |
|
64 | sm_ring_f0[i].buffer_address = | |
56 | (int) &sm_f0[ i * TOTAL_SIZE_SM ]; |
|
65 | (int) &sm_f0[ i * TOTAL_SIZE_SM ]; | |
57 | } |
|
66 | } | |
58 |
|
67 | |||
59 | // F1 RING |
|
68 | // F1 RING | |
60 | sm_ring_f1[0].next = (ring_node*) &sm_ring_f1[1]; |
|
69 | sm_ring_f1[0].next = (ring_node_sm*) &sm_ring_f1[1]; | |
61 | sm_ring_f1[0].previous = (ring_node*) &sm_ring_f1[NB_RING_NODES_ASM_F1-1]; |
|
70 | sm_ring_f1[0].previous = (ring_node_sm*) &sm_ring_f1[NB_RING_NODES_ASM_F1-1]; | |
62 | sm_ring_f1[0].buffer_address = |
|
71 | sm_ring_f1[0].buffer_address = | |
63 | (int) &sm_f1[ 0 ]; |
|
72 | (int) &sm_f1[ 0 ]; | |
64 |
|
73 | |||
65 | sm_ring_f1[NB_RING_NODES_ASM_F1-1].next = (ring_node*) &sm_ring_f1[0]; |
|
74 | sm_ring_f1[NB_RING_NODES_ASM_F1-1].next = (ring_node_sm*) &sm_ring_f1[0]; | |
66 | sm_ring_f1[NB_RING_NODES_ASM_F1-1].previous = (ring_node*) &sm_ring_f1[NB_RING_NODES_ASM_F1-2]; |
|
75 | sm_ring_f1[NB_RING_NODES_ASM_F1-1].previous = (ring_node_sm*) &sm_ring_f1[NB_RING_NODES_ASM_F1-2]; | |
67 | sm_ring_f1[NB_RING_NODES_ASM_F1-1].buffer_address = |
|
76 | sm_ring_f1[NB_RING_NODES_ASM_F1-1].buffer_address = | |
68 | (int) &sm_f1[ (NB_RING_NODES_ASM_F1-1) * TOTAL_SIZE_SM ]; |
|
77 | (int) &sm_f1[ (NB_RING_NODES_ASM_F1-1) * TOTAL_SIZE_SM ]; | |
69 |
|
78 | |||
70 | for(i=1; i<NB_RING_NODES_ASM_F1-1; i++) |
|
79 | for(i=1; i<NB_RING_NODES_ASM_F1-1; i++) | |
71 | { |
|
80 | { | |
72 | sm_ring_f1[i].next = (ring_node*) &sm_ring_f1[i+1]; |
|
81 | sm_ring_f1[i].next = (ring_node_sm*) &sm_ring_f1[i+1]; | |
73 | sm_ring_f1[i].previous = (ring_node*) &sm_ring_f1[i-1]; |
|
82 | sm_ring_f1[i].previous = (ring_node_sm*) &sm_ring_f1[i-1]; | |
74 | sm_ring_f1[i].buffer_address = |
|
83 | sm_ring_f1[i].buffer_address = | |
75 | (int) &sm_f1[ i * TOTAL_SIZE_SM ]; |
|
84 | (int) &sm_f1[ i * TOTAL_SIZE_SM ]; | |
76 | } |
|
85 | } | |
77 |
|
86 | |||
78 | // F2 RING |
|
87 | // F2 RING | |
79 | sm_ring_f2[0].next = (ring_node*) &sm_ring_f2[1]; |
|
88 | sm_ring_f2[0].next = (ring_node_sm*) &sm_ring_f2[1]; | |
80 | sm_ring_f2[0].previous = (ring_node*) &sm_ring_f2[NB_RING_NODES_ASM_F2-1]; |
|
89 | sm_ring_f2[0].previous = (ring_node_sm*) &sm_ring_f2[NB_RING_NODES_ASM_F2-1]; | |
81 | sm_ring_f2[0].buffer_address = |
|
90 | sm_ring_f2[0].buffer_address = | |
82 | (int) &sm_f2[ 0 ]; |
|
91 | (int) &sm_f2[ 0 ]; | |
83 |
|
92 | |||
84 | sm_ring_f2[NB_RING_NODES_ASM_F2-1].next = (ring_node*) &sm_ring_f2[0]; |
|
93 | sm_ring_f2[NB_RING_NODES_ASM_F2-1].next = (ring_node_sm*) &sm_ring_f2[0]; | |
85 | sm_ring_f2[NB_RING_NODES_ASM_F2-1].previous = (ring_node*) &sm_ring_f2[NB_RING_NODES_ASM_F2-2]; |
|
94 | sm_ring_f2[NB_RING_NODES_ASM_F2-1].previous = (ring_node_sm*) &sm_ring_f2[NB_RING_NODES_ASM_F2-2]; | |
86 | sm_ring_f2[NB_RING_NODES_ASM_F2-1].buffer_address = |
|
95 | sm_ring_f2[NB_RING_NODES_ASM_F2-1].buffer_address = | |
87 | (int) &sm_f2[ (NB_RING_NODES_ASM_F2-1) * TOTAL_SIZE_SM ]; |
|
96 | (int) &sm_f2[ (NB_RING_NODES_ASM_F2-1) * TOTAL_SIZE_SM ]; | |
88 |
|
97 | |||
89 | for(i=1; i<NB_RING_NODES_ASM_F2-1; i++) |
|
98 | for(i=1; i<NB_RING_NODES_ASM_F2-1; i++) | |
90 | { |
|
99 | { | |
91 | sm_ring_f2[i].next = (ring_node*) &sm_ring_f2[i+1]; |
|
100 | sm_ring_f2[i].next = (ring_node_sm*) &sm_ring_f2[i+1]; | |
92 | sm_ring_f2[i].previous = (ring_node*) &sm_ring_f2[i-1]; |
|
101 | sm_ring_f2[i].previous = (ring_node_sm*) &sm_ring_f2[i-1]; | |
93 | sm_ring_f2[i].buffer_address = |
|
102 | sm_ring_f2[i].buffer_address = | |
94 | (int) &sm_f2[ i * TOTAL_SIZE_SM ]; |
|
103 | (int) &sm_f2[ i * TOTAL_SIZE_SM ]; | |
95 | } |
|
104 | } | |
96 |
|
105 | |||
97 | DEBUG_PRINTF1("asm_ring_f0 @%x\n", (unsigned int) sm_ring_f0) |
|
106 | DEBUG_PRINTF1("asm_ring_f0 @%x\n", (unsigned int) sm_ring_f0) | |
98 | DEBUG_PRINTF1("asm_ring_f1 @%x\n", (unsigned int) sm_ring_f1) |
|
107 | DEBUG_PRINTF1("asm_ring_f1 @%x\n", (unsigned int) sm_ring_f1) | |
99 | DEBUG_PRINTF1("asm_ring_f2 @%x\n", (unsigned int) sm_ring_f2) |
|
108 | DEBUG_PRINTF1("asm_ring_f2 @%x\n", (unsigned int) sm_ring_f2) | |
100 |
|
109 | |||
101 | spectral_matrix_regs->matrixF0_Address0 = sm_ring_f0[0].buffer_address; |
|
110 | spectral_matrix_regs->matrixF0_Address0 = sm_ring_f0[0].buffer_address; | |
102 | DEBUG_PRINTF1("spectral_matrix_regs->matrixF0_Address0 @%x\n", spectral_matrix_regs->matrixF0_Address0) |
|
111 | DEBUG_PRINTF1("spectral_matrix_regs->matrixF0_Address0 @%x\n", spectral_matrix_regs->matrixF0_Address0) | |
103 | } |
|
112 | } | |
104 |
|
113 | |||
105 | void reset_current_sm_ring_nodes( void ) |
|
114 | void reset_current_sm_ring_nodes( void ) | |
106 | { |
|
115 | { | |
107 | current_ring_node_sm_f0 = sm_ring_f0; |
|
116 | current_ring_node_sm_f0 = sm_ring_f0; | |
108 | current_ring_node_sm_f1 = sm_ring_f1; |
|
117 | current_ring_node_sm_f1 = sm_ring_f1; | |
109 | current_ring_node_sm_f2 = sm_ring_f2; |
|
118 | current_ring_node_sm_f2 = sm_ring_f2; | |
110 |
|
119 | |||
111 | ring_node_for_averaging_sm_f0 = sm_ring_f0; |
|
120 | ring_node_for_averaging_sm_f0 = sm_ring_f0; | |
112 | } |
|
121 | } | |
113 |
|
122 | |||
114 | //*********************************************************** |
|
123 | //*********************************************************** | |
115 | // Interrupt Service Routine for spectral matrices processing |
|
124 | // Interrupt Service Routine for spectral matrices processing | |
116 | void reset_nb_sm_f0( void ) |
|
125 | void reset_nb_sm_f0( void ) | |
117 | { |
|
126 | { | |
118 | nb_sm_f0 = 0; |
|
127 | nb_sm_f0 = 0; | |
119 | } |
|
128 | } | |
120 |
|
129 | |||
121 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ) |
|
130 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ) | |
122 | { |
|
131 | { | |
123 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); |
|
132 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); | |
124 |
|
133 | |||
125 | if ( (spectral_matrix_regs->status & 0x1) == 0x01) |
|
134 | if ( (spectral_matrix_regs->status & 0x1) == 0x01) | |
126 | { |
|
135 | { | |
127 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; |
|
136 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; | |
128 | spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address; |
|
137 | spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address; | |
129 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe; // 1110 |
|
138 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe; // 1110 | |
130 | nb_sm_f0 = nb_sm_f0 + 1; |
|
139 | nb_sm_f0 = nb_sm_f0 + 1; | |
131 | } |
|
140 | } | |
132 | else if ( (spectral_matrix_regs->status & 0x2) == 0x02) |
|
141 | else if ( (spectral_matrix_regs->status & 0x2) == 0x02) | |
133 | { |
|
142 | { | |
134 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; |
|
143 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; | |
135 | spectral_matrix_regs->matrixFO_Address1 = current_ring_node_sm_f0->buffer_address; |
|
144 | spectral_matrix_regs->matrixFO_Address1 = current_ring_node_sm_f0->buffer_address; | |
136 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd; // 1101 |
|
145 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd; // 1101 | |
137 | nb_sm_f0 = nb_sm_f0 + 1; |
|
146 | nb_sm_f0 = nb_sm_f0 + 1; | |
138 | } |
|
147 | } | |
139 |
|
148 | |||
140 | if ( (spectral_matrix_regs->status & 0x30) != 0x00) |
|
149 | if ( (spectral_matrix_regs->status & 0x30) != 0x00) | |
141 | { |
|
150 | { | |
142 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); |
|
151 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); | |
143 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xffffffcf; // 1100 1111 |
|
152 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xffffffcf; // 1100 1111 | |
144 | } |
|
153 | } | |
145 |
|
154 | |||
146 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff3; // 0011 |
|
155 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff3; // 0011 | |
147 |
|
156 | |||
148 | if (nb_sm_f0 == (NB_SM_TO_RECEIVE_BEFORE_AVF0-1) ) |
|
157 | if (nb_sm_f0 == (NB_SM_TO_RECEIVE_BEFORE_AVF0-1) ) | |
149 | { |
|
158 | { | |
150 | ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0; |
|
159 | ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0; | |
151 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
160 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |
152 | { |
|
161 | { | |
153 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
162 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |
154 | } |
|
163 | } | |
155 | nb_sm_f0 = 0; |
|
164 | nb_sm_f0 = 0; | |
156 | } |
|
165 | } | |
157 | else |
|
166 | else | |
158 | { |
|
167 | { | |
159 | nb_sm_f0 = nb_sm_f0 + 1; |
|
168 | nb_sm_f0 = nb_sm_f0 + 1; | |
160 | } |
|
169 | } | |
161 | } |
|
170 | } | |
162 |
|
171 | |||
163 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ) |
|
172 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ) | |
164 | { |
|
173 | { | |
165 | if (nb_sm_f0 == (NB_SM_TO_RECEIVE_BEFORE_AVF0-1) ) |
|
174 | if (nb_sm_f0 == (NB_SM_TO_RECEIVE_BEFORE_AVF0-1) ) | |
166 | { |
|
175 | { | |
167 | ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0; |
|
176 | ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0; | |
168 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
177 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |
169 | { |
|
178 | { | |
170 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
179 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |
171 | } |
|
180 | } | |
172 | nb_sm_f0 = 0; |
|
181 | nb_sm_f0 = 0; | |
173 | } |
|
182 | } | |
174 | else |
|
183 | else | |
175 | { |
|
184 | { | |
176 | nb_sm_f0 = nb_sm_f0 + 1; |
|
185 | nb_sm_f0 = nb_sm_f0 + 1; | |
177 | } |
|
186 | } | |
178 | } |
|
187 | } | |
179 |
|
188 | |||
180 | //************ |
|
189 | //************ | |
181 | // RTEMS TASKS |
|
190 | // RTEMS TASKS | |
182 |
|
191 | |||
183 | rtems_task smiq_task(rtems_task_argument argument) // process the Spectral Matrices IRQ |
|
192 | rtems_task smiq_task(rtems_task_argument argument) // process the Spectral Matrices IRQ | |
184 | { |
|
193 | { | |
185 | rtems_event_set event_out; |
|
194 | rtems_event_set event_out; | |
186 |
|
195 | |||
187 | BOOT_PRINTF("in SMIQ *** \n") |
|
196 | BOOT_PRINTF("in SMIQ *** \n") | |
188 |
|
197 | |||
189 | while(1){ |
|
198 | while(1){ | |
190 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
199 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 | |
191 | } |
|
200 | } | |
192 | } |
|
201 | } | |
193 |
|
202 | |||
194 | rtems_task avf0_task(rtems_task_argument argument) |
|
203 | rtems_task avf0_task(rtems_task_argument argument) | |
195 | { |
|
204 | { | |
196 | int i; |
|
205 | int i; | |
197 | static int nb_average; |
|
206 | static unsigned int nb_average_norm; | |
|
207 | static unsigned int nb_average_sbm1; | |||
198 | rtems_event_set event_out; |
|
208 | rtems_event_set event_out; | |
199 | rtems_status_code status; |
|
209 | rtems_status_code status; | |
200 | ring_node *ring_node_tab[8]; |
|
210 | ring_node_sm *ring_node_tab[8]; | |
201 |
|
211 | |||
202 | nb_average = 0; |
|
212 | nb_average_norm = 0; | |
|
213 | nb_average_sbm1 = 0; | |||
203 |
|
214 | |||
204 | BOOT_PRINTF("in AVFO *** \n") |
|
215 | BOOT_PRINTF("in AVFO *** \n") | |
205 |
|
216 | |||
206 | while(1){ |
|
217 | while(1){ | |
207 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
218 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 | |
208 | ring_node_tab[NB_SM_TO_RECEIVE_BEFORE_AVF0-1] = ring_node_for_averaging_sm_f0; |
|
219 | ring_node_tab[NB_SM_TO_RECEIVE_BEFORE_AVF0-1] = ring_node_for_averaging_sm_f0; | |
209 | for (i=2; i<NB_SM_TO_RECEIVE_BEFORE_AVF0+1; i++) |
|
220 | for ( i = 2; i < (NB_SM_TO_RECEIVE_BEFORE_AVF0+1); i++ ) | |
210 | { |
|
221 | { | |
211 | ring_node_for_averaging_sm_f0 = ring_node_for_averaging_sm_f0->previous; |
|
222 | ring_node_for_averaging_sm_f0 = ring_node_for_averaging_sm_f0->previous; | |
212 | ring_node_tab[NB_SM_TO_RECEIVE_BEFORE_AVF0-i] = ring_node_for_averaging_sm_f0; |
|
223 | ring_node_tab[NB_SM_TO_RECEIVE_BEFORE_AVF0-i] = ring_node_for_averaging_sm_f0; | |
213 | } |
|
224 | } | |
214 |
|
225 | |||
215 | averaged_sm_f0[0] = ( (int *) (ring_node_tab[7]->buffer_address) ) [0]; |
|
226 | // copy time information in the averaged_sm_f0 buffer | |
216 |
averaged_sm_f0[ |
|
227 | averaged_sm_f0[0] = ring_node_tab[7]->coarseTime; | |
217 | for(i=0; i<TOTAL_SIZE_SM; i++) |
|
228 | averaged_sm_f0[1] = ring_node_tab[7]->fineTime; | |
|
229 | averaged_sm_f1[0] = ring_node_tab[7]->coarseTime; | |||
|
230 | averaged_sm_f1[1] = ring_node_tab[7]->fineTime; | |||
|
231 | ||||
|
232 | // compute the average and store it in the averaged_sm_f1 buffer | |||
|
233 | ASM_average( averaged_sm_f0, averaged_sm_f1, | |||
|
234 | ring_node_tab, | |||
|
235 | nb_average_norm, nb_average_sbm1 ); | |||
|
236 | ||||
|
237 | ||||
|
238 | // update nb_average | |||
|
239 | nb_average_norm = nb_average_norm + NB_SM_TO_RECEIVE_BEFORE_AVF0; | |||
|
240 | nb_average_sbm1 = nb_average_sbm1 + NB_SM_TO_RECEIVE_BEFORE_AVF0; | |||
|
241 | ||||
|
242 | // launch actions depending on the current mode | |||
|
243 | if (lfrCurrentMode == LFR_MODE_SBM1) | |||
218 | { |
|
244 | { | |
219 | averaged_sm_f0[i] = ( (int *) (ring_node_tab[0]->buffer_address) ) [i + TIME_OFFSET] |
|
245 | if (nb_average_sbm1 == NB_AVERAGE_SBM1_f0) { | |
220 | + ( (int *) (ring_node_tab[1]->buffer_address) ) [i + TIME_OFFSET] |
|
246 | nb_average_sbm1 = 0; | |
221 | + ( (int *) (ring_node_tab[2]->buffer_address) ) [i + TIME_OFFSET] |
|
247 | status = rtems_event_send( Task_id[TASKID_MATR], RTEMS_EVENT_MODE_SBM1 ); // sending an event to the task 7, BPF0 | |
222 | + ( (int *) (ring_node_tab[3]->buffer_address) ) [i + TIME_OFFSET] |
|
248 | if (status != RTEMS_SUCCESSFUL) { | |
223 | + ( (int *) (ring_node_tab[4]->buffer_address) ) [i + TIME_OFFSET] |
|
249 | printf("in AVF0 *** Error sending RTEMS_EVENT_0, code %d\n", status); | |
224 | + ( (int *) (ring_node_tab[5]->buffer_address) ) [i + TIME_OFFSET] |
|
250 | } | |
225 | + ( (int *) (ring_node_tab[6]->buffer_address) ) [i + TIME_OFFSET] |
|
251 | } | |
226 | + ( (int *) (ring_node_tab[7]->buffer_address) ) [i + TIME_OFFSET]; |
|
|||
227 | } |
|
252 | } | |
228 |
|
253 | if (lfrCurrentMode == LFR_MODE_NORMAL) | ||
229 | nb_average = nb_average + NB_SM_TO_RECEIVE_BEFORE_AVF0; |
|
254 | { | |
230 | if (nb_average == NB_AVERAGE_NORMAL_f0) { |
|
255 | if (nb_average_norm == NB_AVERAGE_NORMAL_f0) { | |
231 | nb_average = 0; |
|
256 | nb_average_norm = 0; | |
232 |
status = rtems_event_send( Task_id[TASKID_MATR], RTEMS_EVENT_ |
|
257 | status = rtems_event_send( Task_id[TASKID_MATR], RTEMS_EVENT_MODE_NORMAL ); // sending an event to the task 7, BPF0 | |
233 | if (status != RTEMS_SUCCESSFUL) { |
|
258 | if (status != RTEMS_SUCCESSFUL) { | |
234 | printf("in AVF0 *** Error sending RTEMS_EVENT_0, code %d\n", status); |
|
259 | printf("in AVF0 *** Error sending RTEMS_EVENT_0, code %d\n", status); | |
|
260 | } | |||
235 | } |
|
261 | } | |
236 | } |
|
262 | } | |
237 | } |
|
263 | } | |
238 | } |
|
264 | } | |
239 |
|
265 | |||
240 | rtems_task matr_task(rtems_task_argument argument) |
|
266 | rtems_task matr_task(rtems_task_argument argument) | |
241 | { |
|
267 | { | |
242 | spw_ioctl_pkt_send spw_ioctl_send_ASM; |
|
268 | spw_ioctl_pkt_send spw_ioctl_send_ASM; | |
243 | rtems_event_set event_out; |
|
269 | rtems_event_set event_out; | |
244 | rtems_status_code status; |
|
270 | rtems_status_code status; | |
245 | rtems_id queue_id; |
|
271 | rtems_id queue_id; | |
246 | Header_TM_LFR_SCIENCE_ASM_t headerASM; |
|
272 | Header_TM_LFR_SCIENCE_ASM_t headerASM; | |
247 |
|
273 | |||
248 | init_header_asm( &headerASM ); |
|
274 | init_header_asm( &headerASM ); | |
249 |
|
275 | |||
250 | status = get_message_queue_id_send( &queue_id ); |
|
276 | status = get_message_queue_id_send( &queue_id ); | |
251 | if (status != RTEMS_SUCCESSFUL) |
|
277 | if (status != RTEMS_SUCCESSFUL) | |
252 | { |
|
278 | { | |
253 | PRINTF1("in MATR *** ERR get_message_queue_id_send %d\n", status) |
|
279 | PRINTF1("in MATR *** ERR get_message_queue_id_send %d\n", status) | |
254 | } |
|
280 | } | |
255 |
|
281 | |||
256 | BOOT_PRINTF("in MATR *** \n") |
|
282 | BOOT_PRINTF("in MATR *** \n") | |
257 |
|
283 | |||
258 | fill_averaged_spectral_matrix( ); |
|
284 | fill_averaged_spectral_matrix( ); | |
259 |
|
285 | |||
260 | while(1){ |
|
286 | while(1){ | |
261 |
rtems_event_receive(RTEMS_EVENT_ |
|
287 | rtems_event_receive( RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1, | |
262 | // 1) compress the matrix for Basic Parameters calculation |
|
288 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
263 | ASM_compress( averaged_sm_f0, 0, compressed_sm_f0 ); |
|
289 | if (event_out==RTEMS_EVENT_MODE_NORMAL) | |
264 |
|
|
290 | { | |
265 | // BP1_set( (float *) &compressed_sm_f0[TIME_OFFSET], NB_BINS_COMPRESSED_SM_F0, (unsigned char *) &LFR_BP1_F0[TIME_OFFSET_IN_BYTES] ); |
|
291 | // 1) compress the matrix for Basic Parameters calculation | |
266 | // 3) convert the float array in a char array |
|
292 | ASM_compress( averaged_sm_f0, 0, compressed_sm_f0 ); | |
267 | ASM_reorganize( averaged_sm_f0, averaged_sm_f0_reorganized ); |
|
293 | // 2) compute the BP1 set | |
268 | ASM_convert( averaged_sm_f0_reorganized, averaged_sm_f0_char); |
|
294 | ||
269 | // 4) send the spectral matrix packets |
|
295 | // 3) convert the float array in a char array | |
270 | ASM_send( &headerASM, averaged_sm_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id); |
|
296 | ASM_reorganize( averaged_sm_f0, averaged_sm_f0_reorganized ); | |
|
297 | ASM_convert( averaged_sm_f0_reorganized, averaged_sm_f0_char); | |||
|
298 | // 4) send the spectral matrix packets | |||
|
299 | ASM_send( &headerASM, averaged_sm_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id); | |||
|
300 | } | |||
|
301 | else if (event_out==RTEMS_EVENT_MODE_SBM1) | |||
|
302 | { | |||
|
303 | // 1) compress the matrix for Basic Parameters calculation | |||
|
304 | ASM_compress( averaged_sm_f1, 0, compressed_sm_f1 ); | |||
|
305 | // 2) compute the BP1 set | |||
|
306 | ||||
|
307 | // 4) send the basic parameters set 1 packet | |||
|
308 | BP1_send( ); | |||
|
309 | } | |||
|
310 | else | |||
|
311 | { | |||
|
312 | PRINTF1("ERR *** in MATR *** unexect event = %x\n", (unsigned int) event_out) | |||
|
313 | } | |||
271 | } |
|
314 | } | |
272 | } |
|
315 | } | |
273 |
|
316 | |||
274 | //***************************** |
|
317 | //***************************** | |
275 | // Spectral matrices processing |
|
318 | // Spectral matrices processing | |
276 |
|
319 | |||
277 | void matrix_reset(volatile float *averaged_spec_mat) |
|
320 | void matrix_reset(volatile float *averaged_spec_mat) | |
278 | { |
|
321 | { | |
279 | int i; |
|
322 | int i; | |
280 | for(i=0; i<TOTAL_SIZE_SM; i++){ |
|
323 | for(i=0; i<TOTAL_SIZE_SM; i++){ | |
281 | averaged_spec_mat[i] = 0; |
|
324 | averaged_spec_mat[i] = 0; | |
282 | } |
|
325 | } | |
283 | } |
|
326 | } | |
284 |
|
327 | |||
|
328 | void ASM_average( float *averaged_spec_mat_f0, float *averaged_spec_mat_f1, | |||
|
329 | ring_node_sm *ring_node_tab[], | |||
|
330 | unsigned int firstTimeF0, unsigned int firstTimeF1 ) | |||
|
331 | { | |||
|
332 | float sum; | |||
|
333 | unsigned int i; | |||
|
334 | ||||
|
335 | for(i=0; i<TOTAL_SIZE_SM; i++) | |||
|
336 | { | |||
|
337 | sum = ( (int *) (ring_node_tab[0]->buffer_address) ) [ i ] | |||
|
338 | + ( (int *) (ring_node_tab[1]->buffer_address) ) [ i ] | |||
|
339 | + ( (int *) (ring_node_tab[2]->buffer_address) ) [ i ] | |||
|
340 | + ( (int *) (ring_node_tab[3]->buffer_address) ) [ i ] | |||
|
341 | + ( (int *) (ring_node_tab[4]->buffer_address) ) [ i ] | |||
|
342 | + ( (int *) (ring_node_tab[5]->buffer_address) ) [ i ] | |||
|
343 | + ( (int *) (ring_node_tab[6]->buffer_address) ) [ i ] | |||
|
344 | + ( (int *) (ring_node_tab[7]->buffer_address) ) [ i ]; | |||
|
345 | ||||
|
346 | if ( (firstTimeF0 == 0) && (firstTimeF1 == 0) ) | |||
|
347 | { | |||
|
348 | averaged_spec_mat_f0[ i ] = averaged_spec_mat_f0[ i ] + sum; | |||
|
349 | averaged_spec_mat_f1[ i ] = averaged_spec_mat_f1[ i ] + sum; | |||
|
350 | } | |||
|
351 | else if ( (firstTimeF0 == 0) && (firstTimeF1 != 0) ) | |||
|
352 | { | |||
|
353 | averaged_spec_mat_f0[ i ] = averaged_spec_mat_f0[ i ] + sum; | |||
|
354 | averaged_spec_mat_f1[ i ] = sum; | |||
|
355 | } | |||
|
356 | else if ( (firstTimeF0 != 0) && (firstTimeF1 == 0) ) | |||
|
357 | { | |||
|
358 | averaged_spec_mat_f0[ i ] = sum; | |||
|
359 | averaged_spec_mat_f1[ i ] = averaged_spec_mat_f1[ i ] + sum; | |||
|
360 | } | |||
|
361 | else | |||
|
362 | { | |||
|
363 | averaged_spec_mat_f0[ i ] = sum; | |||
|
364 | averaged_spec_mat_f1[ i ] = sum; | |||
|
365 | } | |||
|
366 | } | |||
|
367 | } | |||
|
368 | ||||
285 | void ASM_reorganize( float *averaged_spec_mat, float *averaged_spec_mat_reorganized ) |
|
369 | void ASM_reorganize( float *averaged_spec_mat, float *averaged_spec_mat_reorganized ) | |
286 | { |
|
370 | { | |
287 | int frequencyBin; |
|
371 | int frequencyBin; | |
288 | int asmComponent; |
|
372 | int asmComponent; | |
289 |
|
373 | |||
290 | // copy the time information |
|
374 | // copy the time information | |
291 | averaged_spec_mat_reorganized[ 0 ] = averaged_spec_mat[ 0 ]; |
|
375 | averaged_spec_mat_reorganized[ 0 ] = averaged_spec_mat[ 0 ]; | |
292 | averaged_spec_mat_reorganized[ 1 ] = averaged_spec_mat[ 1 ]; |
|
376 | averaged_spec_mat_reorganized[ 1 ] = averaged_spec_mat[ 1 ]; | |
293 |
|
377 | |||
294 | for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++) |
|
378 | for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++) | |
295 | { |
|
379 | { | |
296 | for( frequencyBin = 0; frequencyBin < NB_BINS_PER_SM; frequencyBin++ ) |
|
380 | for( frequencyBin = 0; frequencyBin < NB_BINS_PER_SM; frequencyBin++ ) | |
297 | { |
|
381 | { | |
298 | averaged_spec_mat_reorganized[ frequencyBin * NB_VALUES_PER_SM + asmComponent + TIME_OFFSET ] = |
|
382 | averaged_spec_mat_reorganized[ frequencyBin * NB_VALUES_PER_SM + asmComponent + TIME_OFFSET ] = | |
299 | averaged_spec_mat[ asmComponent * NB_BINS_PER_SM + frequencyBin + TIME_OFFSET]; |
|
383 | averaged_spec_mat[ asmComponent * NB_BINS_PER_SM + frequencyBin + TIME_OFFSET]; | |
300 | } |
|
384 | } | |
301 | } |
|
385 | } | |
302 | } |
|
386 | } | |
303 |
|
387 | |||
304 | void ASM_compress( float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat ) |
|
388 | void ASM_compress( float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat ) | |
305 | { |
|
389 | { | |
306 | int frequencyBin; |
|
390 | int frequencyBin; | |
307 | int asmComponent; |
|
391 | int asmComponent; | |
308 | int offsetASM; |
|
392 | int offsetASM; | |
309 | int offsetCompressed; |
|
393 | int offsetCompressed; | |
310 | int k; |
|
394 | int k; | |
311 |
|
395 | |||
312 | switch (fChannel){ |
|
396 | switch (fChannel){ | |
313 | case 0: |
|
397 | case 0: | |
314 | for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++) |
|
398 | for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++) | |
315 | { |
|
399 | { | |
316 | for( frequencyBin = 0; frequencyBin < NB_BINS_COMPRESSED_SM_F0; frequencyBin++ ) |
|
400 | for( frequencyBin = 0; frequencyBin < NB_BINS_COMPRESSED_SM_F0; frequencyBin++ ) | |
317 | { |
|
401 | { | |
318 | offsetCompressed = TIME_OFFSET |
|
402 | offsetCompressed = TIME_OFFSET | |
319 | + frequencyBin * NB_VALUES_PER_SM |
|
403 | + frequencyBin * NB_VALUES_PER_SM | |
320 | + asmComponent; |
|
404 | + asmComponent; | |
321 | offsetASM = TIME_OFFSET |
|
405 | offsetASM = TIME_OFFSET | |
322 | + asmComponent * NB_BINS_PER_SM |
|
406 | + asmComponent * NB_BINS_PER_SM | |
323 | + ASM_F0_INDICE_START |
|
407 | + ASM_F0_INDICE_START | |
324 | + frequencyBin * NB_BINS_TO_AVERAGE_ASM_F0; |
|
408 | + frequencyBin * NB_BINS_TO_AVERAGE_ASM_F0; | |
325 | compressed_spec_mat[ offsetCompressed ] = 0; |
|
409 | compressed_spec_mat[ offsetCompressed ] = 0; | |
326 | for ( k = 0; k < NB_BINS_TO_AVERAGE_ASM_F0; k++ ) |
|
410 | for ( k = 0; k < NB_BINS_TO_AVERAGE_ASM_F0; k++ ) | |
327 | { |
|
411 | { | |
328 | compressed_spec_mat[offsetCompressed ] = |
|
412 | compressed_spec_mat[offsetCompressed ] = | |
329 | compressed_spec_mat[ offsetCompressed ] |
|
413 | compressed_spec_mat[ offsetCompressed ] | |
330 | + averaged_spec_mat[ offsetASM + k ]; |
|
414 | + averaged_spec_mat[ offsetASM + k ]; | |
331 | } |
|
415 | } | |
332 | } |
|
416 | } | |
333 | } |
|
417 | } | |
334 | break; |
|
418 | break; | |
335 |
|
419 | |||
336 | case 1: |
|
420 | case 1: | |
337 | // case fChannel = f1 to be completed later |
|
421 | // case fChannel = f1 to be completed later | |
338 | break; |
|
422 | break; | |
339 |
|
423 | |||
340 | case 2: |
|
424 | case 2: | |
341 | // case fChannel = f1 to be completed later |
|
425 | // case fChannel = f1 to be completed later | |
342 | break; |
|
426 | break; | |
343 |
|
427 | |||
344 | default: |
|
428 | default: | |
345 | break; |
|
429 | break; | |
346 | } |
|
430 | } | |
347 | } |
|
431 | } | |
348 |
|
432 | |||
349 | void ASM_convert( volatile float *input_matrix, char *output_matrix) |
|
433 | void ASM_convert( volatile float *input_matrix, char *output_matrix) | |
350 | { |
|
434 | { | |
351 | unsigned int i; |
|
435 | unsigned int i; | |
352 | unsigned int frequencyBin; |
|
436 | unsigned int frequencyBin; | |
353 | unsigned int asmComponent; |
|
437 | unsigned int asmComponent; | |
354 | char * pt_char_input; |
|
438 | char * pt_char_input; | |
355 | char * pt_char_output; |
|
439 | char * pt_char_output; | |
356 |
|
440 | |||
357 | pt_char_input = (char*) &input_matrix; |
|
441 | pt_char_input = (char*) &input_matrix; | |
358 | pt_char_output = (char*) &output_matrix; |
|
442 | pt_char_output = (char*) &output_matrix; | |
359 |
|
443 | |||
360 | // copy the time information |
|
444 | // copy the time information | |
361 | for (i=0; i<TIME_OFFSET_IN_BYTES; i++) |
|
445 | for (i=0; i<TIME_OFFSET_IN_BYTES; i++) | |
362 | { |
|
446 | { | |
363 | pt_char_output[ i ] = pt_char_output[ i ]; |
|
447 | pt_char_output[ i ] = pt_char_output[ i ]; | |
364 | } |
|
448 | } | |
365 |
|
449 | |||
366 | // convert all other data |
|
450 | // convert all other data | |
367 | for( frequencyBin=0; frequencyBin<NB_BINS_PER_SM; frequencyBin++) |
|
451 | for( frequencyBin=0; frequencyBin<NB_BINS_PER_SM; frequencyBin++) | |
368 | { |
|
452 | { | |
369 | for ( asmComponent=0; asmComponent<NB_VALUES_PER_SM; asmComponent++) |
|
453 | for ( asmComponent=0; asmComponent<NB_VALUES_PER_SM; asmComponent++) | |
370 | { |
|
454 | { | |
371 | pt_char_input = (char*) &input_matrix [ (frequencyBin*NB_VALUES_PER_SM) + asmComponent + TIME_OFFSET ]; |
|
455 | pt_char_input = (char*) &input_matrix [ (frequencyBin*NB_VALUES_PER_SM) + asmComponent + TIME_OFFSET ]; | |
372 | pt_char_output = (char*) &output_matrix[ 2 * ( (frequencyBin*NB_VALUES_PER_SM) + asmComponent ) + TIME_OFFSET_IN_BYTES ]; |
|
456 | pt_char_output = (char*) &output_matrix[ 2 * ( (frequencyBin*NB_VALUES_PER_SM) + asmComponent ) + TIME_OFFSET_IN_BYTES ]; | |
373 | pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float |
|
457 | pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float | |
374 | pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float |
|
458 | pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float | |
375 | } |
|
459 | } | |
376 | } |
|
460 | } | |
377 | } |
|
461 | } | |
378 |
|
462 | |||
379 | void ASM_send(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, |
|
463 | void ASM_send(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, | |
380 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id) |
|
464 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id) | |
381 | { |
|
465 | { | |
382 | unsigned int i; |
|
466 | unsigned int i; | |
383 | unsigned int length = 0; |
|
467 | unsigned int length = 0; | |
384 | rtems_status_code status; |
|
468 | rtems_status_code status; | |
385 |
|
469 | |||
386 | for (i=0; i<2; i++) |
|
470 | for (i=0; i<2; i++) | |
387 | { |
|
471 | { | |
388 | // (1) BUILD THE DATA |
|
472 | // (1) BUILD THE DATA | |
389 | switch(sid) |
|
473 | switch(sid) | |
390 | { |
|
474 | { | |
391 | case SID_NORM_ASM_F0: |
|
475 | case SID_NORM_ASM_F0: | |
392 | spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F0_IN_BYTES / 2; |
|
476 | spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F0_IN_BYTES / 2; | |
393 | spw_ioctl_send->data = &spectral_matrix[ |
|
477 | spw_ioctl_send->data = &spectral_matrix[ | |
394 | ( (ASM_F0_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F0) ) * NB_VALUES_PER_SM ) * 2 |
|
478 | ( (ASM_F0_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F0) ) * NB_VALUES_PER_SM ) * 2 | |
395 | + TIME_OFFSET_IN_BYTES |
|
479 | + TIME_OFFSET_IN_BYTES | |
396 | ]; |
|
480 | ]; | |
397 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0; |
|
481 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0; | |
398 | header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F0) >> 8 ); // BLK_NR MSB |
|
482 | header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F0) >> 8 ); // BLK_NR MSB | |
399 | header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F0); // BLK_NR LSB |
|
483 | header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F0); // BLK_NR LSB | |
400 | break; |
|
484 | break; | |
401 | case SID_NORM_ASM_F1: |
|
485 | case SID_NORM_ASM_F1: | |
402 | break; |
|
486 | break; | |
403 | case SID_NORM_ASM_F2: |
|
487 | case SID_NORM_ASM_F2: | |
404 | break; |
|
488 | break; | |
405 | default: |
|
489 | default: | |
406 | PRINTF1("ERR *** in ASM_send *** unexpected sid %d\n", sid) |
|
490 | PRINTF1("ERR *** in ASM_send *** unexpected sid %d\n", sid) | |
407 | break; |
|
491 | break; | |
408 | } |
|
492 | } | |
409 | spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
493 | spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES; | |
410 | spw_ioctl_send->hdr = (char *) header; |
|
494 | spw_ioctl_send->hdr = (char *) header; | |
411 | spw_ioctl_send->options = 0; |
|
495 | spw_ioctl_send->options = 0; | |
412 |
|
496 | |||
413 | // (2) BUILD THE HEADER |
|
497 | // (2) BUILD THE HEADER | |
414 | header->packetLength[0] = (unsigned char) (length>>8); |
|
498 | header->packetLength[0] = (unsigned char) (length>>8); | |
415 | header->packetLength[1] = (unsigned char) (length); |
|
499 | header->packetLength[1] = (unsigned char) (length); | |
416 | header->sid = (unsigned char) sid; // SID |
|
500 | header->sid = (unsigned char) sid; // SID | |
417 | header->pa_lfr_pkt_cnt_asm = 2; |
|
501 | header->pa_lfr_pkt_cnt_asm = 2; | |
418 | header->pa_lfr_pkt_nr_asm = (unsigned char) (i+1); |
|
502 | header->pa_lfr_pkt_nr_asm = (unsigned char) (i+1); | |
419 |
|
503 | |||
420 | // (3) SET PACKET TIME |
|
504 | // (3) SET PACKET TIME | |
421 | header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
505 | header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
422 | header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
506 | header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
423 | header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
507 | header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
424 | header->time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
508 | header->time[3] = (unsigned char) (time_management_regs->coarse_time); | |
425 | header->time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
509 | header->time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
426 | header->time[5] = (unsigned char) (time_management_regs->fine_time); |
|
510 | header->time[5] = (unsigned char) (time_management_regs->fine_time); | |
427 | // |
|
511 | // | |
428 | header->acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
512 | header->acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
429 | header->acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
513 | header->acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
430 | header->acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
514 | header->acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
431 | header->acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time); |
|
515 | header->acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time); | |
432 | header->acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
516 | header->acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
433 | header->acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time); |
|
517 | header->acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time); | |
434 |
|
518 | |||
435 | // (4) SEND PACKET |
|
519 | // (4) SEND PACKET | |
436 | status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE); |
|
520 | status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE); | |
437 | if (status != RTEMS_SUCCESSFUL) { |
|
521 | if (status != RTEMS_SUCCESSFUL) { | |
438 | printf("in ASM_send *** ERR %d\n", (int) status); |
|
522 | printf("in ASM_send *** ERR %d\n", (int) status); | |
439 | } |
|
523 | } | |
440 | } |
|
524 | } | |
441 | } |
|
525 | } | |
442 |
|
526 | |||
|
527 | void BP1_send() | |||
|
528 | { | |||
|
529 | ||||
|
530 | } | |||
|
531 | ||||
443 | void BP1_set_old(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1){ |
|
532 | void BP1_set_old(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1){ | |
444 | int i; |
|
533 | int i; | |
445 | int j; |
|
534 | int j; | |
446 | unsigned char tmp_u_char; |
|
535 | unsigned char tmp_u_char; | |
447 | unsigned char * pt_char = NULL; |
|
536 | unsigned char * pt_char = NULL; | |
448 | float PSDB, PSDE; |
|
537 | float PSDB, PSDE; | |
449 | float NVEC_V0; |
|
538 | float NVEC_V0; | |
450 | float NVEC_V1; |
|
539 | float NVEC_V1; | |
451 | float NVEC_V2; |
|
540 | float NVEC_V2; | |
452 | //float significand; |
|
541 | //float significand; | |
453 | //int exponent; |
|
542 | //int exponent; | |
454 | float aux; |
|
543 | float aux; | |
455 | float tr_SB_SB; |
|
544 | float tr_SB_SB; | |
456 | float tmp; |
|
545 | float tmp; | |
457 | float sx_re; |
|
546 | float sx_re; | |
458 | float sx_im; |
|
547 | float sx_im; | |
459 | float nebx_re = 0; |
|
548 | float nebx_re = 0; | |
460 | float nebx_im = 0; |
|
549 | float nebx_im = 0; | |
461 | float ny = 0; |
|
550 | float ny = 0; | |
462 | float nz = 0; |
|
551 | float nz = 0; | |
463 | float bx_bx_star = 0; |
|
552 | float bx_bx_star = 0; | |
464 | for(i=0; i<nb_bins_compressed_spec_mat; i++){ |
|
553 | for(i=0; i<nb_bins_compressed_spec_mat; i++){ | |
465 | //============================================== |
|
554 | //============================================== | |
466 | // BP1 PSD == B PAR_LFR_SC_BP1_PE_FL0 == 16 bits |
|
555 | // BP1 PSD == B PAR_LFR_SC_BP1_PE_FL0 == 16 bits | |
467 | PSDB = compressed_spec_mat[i*30] // S11 |
|
556 | PSDB = compressed_spec_mat[i*30] // S11 | |
468 | + compressed_spec_mat[(i*30) + 10] // S22 |
|
557 | + compressed_spec_mat[(i*30) + 10] // S22 | |
469 | + compressed_spec_mat[(i*30) + 18]; // S33 |
|
558 | + compressed_spec_mat[(i*30) + 18]; // S33 | |
470 | //significand = frexp(PSDB, &exponent); |
|
559 | //significand = frexp(PSDB, &exponent); | |
471 | pt_char = (unsigned char*) &PSDB; |
|
560 | pt_char = (unsigned char*) &PSDB; | |
472 | LFR_BP1[(i*9) + 2] = pt_char[0]; // bits 31 downto 24 of the float |
|
561 | LFR_BP1[(i*9) + 2] = pt_char[0]; // bits 31 downto 24 of the float | |
473 | LFR_BP1[(i*9) + 3] = pt_char[1]; // bits 23 downto 16 of the float |
|
562 | LFR_BP1[(i*9) + 3] = pt_char[1]; // bits 23 downto 16 of the float | |
474 | //============================================== |
|
563 | //============================================== | |
475 | // BP1 PSD == E PAR_LFR_SC_BP1_PB_FL0 == 16 bits |
|
564 | // BP1 PSD == E PAR_LFR_SC_BP1_PB_FL0 == 16 bits | |
476 | PSDE = compressed_spec_mat[(i*30) + 24] * K44_pe // S44 |
|
565 | PSDE = compressed_spec_mat[(i*30) + 24] * K44_pe // S44 | |
477 | + compressed_spec_mat[(i*30) + 28] * K55_pe // S55 |
|
566 | + compressed_spec_mat[(i*30) + 28] * K55_pe // S55 | |
478 | + compressed_spec_mat[(i*30) + 26] * K45_pe_re // S45 |
|
567 | + compressed_spec_mat[(i*30) + 26] * K45_pe_re // S45 | |
479 | - compressed_spec_mat[(i*30) + 27] * K45_pe_im; // S45 |
|
568 | - compressed_spec_mat[(i*30) + 27] * K45_pe_im; // S45 | |
480 | pt_char = (unsigned char*) &PSDE; |
|
569 | pt_char = (unsigned char*) &PSDE; | |
481 | LFR_BP1[(i*9) + 0] = pt_char[0]; // bits 31 downto 24 of the float |
|
570 | LFR_BP1[(i*9) + 0] = pt_char[0]; // bits 31 downto 24 of the float | |
482 | LFR_BP1[(i*9) + 1] = pt_char[1]; // bits 23 downto 16 of the float |
|
571 | LFR_BP1[(i*9) + 1] = pt_char[1]; // bits 23 downto 16 of the float | |
483 | //============================================================================== |
|
572 | //============================================================================== | |
484 | // BP1 normal wave vector == PAR_LFR_SC_BP1_NVEC_V0_F0 == 8 bits |
|
573 | // BP1 normal wave vector == PAR_LFR_SC_BP1_NVEC_V0_F0 == 8 bits | |
485 | // == PAR_LFR_SC_BP1_NVEC_V1_F0 == 8 bits |
|
574 | // == PAR_LFR_SC_BP1_NVEC_V1_F0 == 8 bits | |
486 | // == PAR_LFR_SC_BP1_NVEC_V2_F0 == 1 bits |
|
575 | // == PAR_LFR_SC_BP1_NVEC_V2_F0 == 1 bits | |
487 | tmp = sqrt( |
|
576 | tmp = sqrt( | |
488 | compressed_spec_mat[(i*30) + 3]*compressed_spec_mat[(i*30) + 3] //Im S12 |
|
577 | compressed_spec_mat[(i*30) + 3]*compressed_spec_mat[(i*30) + 3] //Im S12 | |
489 | +compressed_spec_mat[(i*30) + 5]*compressed_spec_mat[(i*30) + 5] //Im S13 |
|
578 | +compressed_spec_mat[(i*30) + 5]*compressed_spec_mat[(i*30) + 5] //Im S13 | |
490 | +compressed_spec_mat[(i*30) + 13]*compressed_spec_mat[(i*30) + 13] //Im S23 |
|
579 | +compressed_spec_mat[(i*30) + 13]*compressed_spec_mat[(i*30) + 13] //Im S23 | |
491 | ); |
|
580 | ); | |
492 | NVEC_V0 = compressed_spec_mat[(i*30) + 13] / tmp; // Im S23 |
|
581 | NVEC_V0 = compressed_spec_mat[(i*30) + 13] / tmp; // Im S23 | |
493 | NVEC_V1 = -compressed_spec_mat[(i*30) + 5] / tmp; // Im S13 |
|
582 | NVEC_V1 = -compressed_spec_mat[(i*30) + 5] / tmp; // Im S13 | |
494 | NVEC_V2 = compressed_spec_mat[(i*30) + 3] / tmp; // Im S12 |
|
583 | NVEC_V2 = compressed_spec_mat[(i*30) + 3] / tmp; // Im S12 | |
495 | LFR_BP1[(i*9) + 4] = (char) (NVEC_V0*127); |
|
584 | LFR_BP1[(i*9) + 4] = (char) (NVEC_V0*127); | |
496 | LFR_BP1[(i*9) + 5] = (char) (NVEC_V1*127); |
|
585 | LFR_BP1[(i*9) + 5] = (char) (NVEC_V1*127); | |
497 | pt_char = (unsigned char*) &NVEC_V2; |
|
586 | pt_char = (unsigned char*) &NVEC_V2; | |
498 | LFR_BP1[(i*9) + 6] = pt_char[0] & 0x80; // extract the sign of NVEC_V2 |
|
587 | LFR_BP1[(i*9) + 6] = pt_char[0] & 0x80; // extract the sign of NVEC_V2 | |
499 | //======================================================= |
|
588 | //======================================================= | |
500 | // BP1 ellipticity == PAR_LFR_SC_BP1_ELLIP_F0 == 4 bits |
|
589 | // BP1 ellipticity == PAR_LFR_SC_BP1_ELLIP_F0 == 4 bits | |
501 | aux = 2*tmp / PSDB; // compute the ellipticity |
|
590 | aux = 2*tmp / PSDB; // compute the ellipticity | |
502 | tmp_u_char = (unsigned char) (aux*(16-1)); // convert the ellipticity |
|
591 | tmp_u_char = (unsigned char) (aux*(16-1)); // convert the ellipticity | |
503 | LFR_BP1[i*9+6] = LFR_BP1[i*9+6] | ((tmp_u_char&0x0f)<<3); // keeps 4 bits of the resulting unsigned char |
|
592 | LFR_BP1[i*9+6] = LFR_BP1[i*9+6] | ((tmp_u_char&0x0f)<<3); // keeps 4 bits of the resulting unsigned char | |
504 | //============================================================== |
|
593 | //============================================================== | |
505 | // BP1 degree of polarization == PAR_LFR_SC_BP1_DOP_F0 == 3 bits |
|
594 | // BP1 degree of polarization == PAR_LFR_SC_BP1_DOP_F0 == 3 bits | |
506 | for(j = 0; j<NB_VALUES_PER_SM;j++){ |
|
595 | for(j = 0; j<NB_VALUES_PER_SM;j++){ | |
507 | tr_SB_SB = compressed_spec_mat[i*30] * compressed_spec_mat[i*30] |
|
596 | tr_SB_SB = compressed_spec_mat[i*30] * compressed_spec_mat[i*30] | |
508 | + compressed_spec_mat[(i*30) + 10] * compressed_spec_mat[(i*30) + 10] |
|
597 | + compressed_spec_mat[(i*30) + 10] * compressed_spec_mat[(i*30) + 10] | |
509 | + compressed_spec_mat[(i*30) + 18] * compressed_spec_mat[(i*30) + 18] |
|
598 | + compressed_spec_mat[(i*30) + 18] * compressed_spec_mat[(i*30) + 18] | |
510 | + 2 * compressed_spec_mat[(i*30) + 2] * compressed_spec_mat[(i*30) + 2] |
|
599 | + 2 * compressed_spec_mat[(i*30) + 2] * compressed_spec_mat[(i*30) + 2] | |
511 | + 2 * compressed_spec_mat[(i*30) + 3] * compressed_spec_mat[(i*30) + 3] |
|
600 | + 2 * compressed_spec_mat[(i*30) + 3] * compressed_spec_mat[(i*30) + 3] | |
512 | + 2 * compressed_spec_mat[(i*30) + 4] * compressed_spec_mat[(i*30) + 4] |
|
601 | + 2 * compressed_spec_mat[(i*30) + 4] * compressed_spec_mat[(i*30) + 4] | |
513 | + 2 * compressed_spec_mat[(i*30) + 5] * compressed_spec_mat[(i*30) + 5] |
|
602 | + 2 * compressed_spec_mat[(i*30) + 5] * compressed_spec_mat[(i*30) + 5] | |
514 | + 2 * compressed_spec_mat[(i*30) + 12] * compressed_spec_mat[(i*30) + 12] |
|
603 | + 2 * compressed_spec_mat[(i*30) + 12] * compressed_spec_mat[(i*30) + 12] | |
515 | + 2 * compressed_spec_mat[(i*30) + 13] * compressed_spec_mat[(i*30) + 13]; |
|
604 | + 2 * compressed_spec_mat[(i*30) + 13] * compressed_spec_mat[(i*30) + 13]; | |
516 | } |
|
605 | } | |
517 | aux = PSDB*PSDB; |
|
606 | aux = PSDB*PSDB; | |
518 | tmp = sqrt( abs( ( 3*tr_SB_SB - aux ) / ( 2 * aux ) ) ); |
|
607 | tmp = sqrt( abs( ( 3*tr_SB_SB - aux ) / ( 2 * aux ) ) ); | |
519 | tmp_u_char = (unsigned char) (NVEC_V0*(8-1)); |
|
608 | tmp_u_char = (unsigned char) (NVEC_V0*(8-1)); | |
520 | LFR_BP1[(i*9) + 6] = LFR_BP1[(i*9) + 6] | (tmp_u_char & 0x07); // keeps 3 bits of the resulting unsigned char |
|
609 | LFR_BP1[(i*9) + 6] = LFR_BP1[(i*9) + 6] | (tmp_u_char & 0x07); // keeps 3 bits of the resulting unsigned char | |
521 | //======================================================================================= |
|
610 | //======================================================================================= | |
522 | // BP1 x-component of the normalized Poynting flux == PAR_LFR_SC_BP1_SZ_F0 == 8 bits (7+1) |
|
611 | // BP1 x-component of the normalized Poynting flux == PAR_LFR_SC_BP1_SZ_F0 == 8 bits (7+1) | |
523 | sx_re = compressed_spec_mat[(i*30) + 20] * K34_sx_re |
|
612 | sx_re = compressed_spec_mat[(i*30) + 20] * K34_sx_re | |
524 | + compressed_spec_mat[(i*30) + 6] * K14_sx_re |
|
613 | + compressed_spec_mat[(i*30) + 6] * K14_sx_re | |
525 | + compressed_spec_mat[(i*30) + 8] * K15_sx_re |
|
614 | + compressed_spec_mat[(i*30) + 8] * K15_sx_re | |
526 | + compressed_spec_mat[(i*30) + 14] * K24_sx_re |
|
615 | + compressed_spec_mat[(i*30) + 14] * K24_sx_re | |
527 | + compressed_spec_mat[(i*30) + 16] * K25_sx_re |
|
616 | + compressed_spec_mat[(i*30) + 16] * K25_sx_re | |
528 | + compressed_spec_mat[(i*30) + 22] * K35_sx_re; |
|
617 | + compressed_spec_mat[(i*30) + 22] * K35_sx_re; | |
529 | sx_im = compressed_spec_mat[(i*30) + 21] * K34_sx_im |
|
618 | sx_im = compressed_spec_mat[(i*30) + 21] * K34_sx_im | |
530 | + compressed_spec_mat[(i*30) + 7] * K14_sx_im |
|
619 | + compressed_spec_mat[(i*30) + 7] * K14_sx_im | |
531 | + compressed_spec_mat[(i*30) + 9] * K15_sx_im |
|
620 | + compressed_spec_mat[(i*30) + 9] * K15_sx_im | |
532 | + compressed_spec_mat[(i*30) + 15] * K24_sx_im |
|
621 | + compressed_spec_mat[(i*30) + 15] * K24_sx_im | |
533 | + compressed_spec_mat[(i*30) + 17] * K25_sx_im |
|
622 | + compressed_spec_mat[(i*30) + 17] * K25_sx_im | |
534 | + compressed_spec_mat[(i*30) + 23] * K35_sx_im; |
|
623 | + compressed_spec_mat[(i*30) + 23] * K35_sx_im; | |
535 | LFR_BP1[(i*9) + 7] = ((unsigned char) (sx_re * 128)) & 0x7f; // cf DOC for the compression |
|
624 | LFR_BP1[(i*9) + 7] = ((unsigned char) (sx_re * 128)) & 0x7f; // cf DOC for the compression | |
536 | if ( abs(sx_re) > abs(sx_im) ) { |
|
625 | if ( abs(sx_re) > abs(sx_im) ) { | |
537 | LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] | (0x80); // extract the sector of sx |
|
626 | LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] | (0x80); // extract the sector of sx | |
538 | } |
|
627 | } | |
539 | else { |
|
628 | else { | |
540 | LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] & (0x7f); // extract the sector of sx |
|
629 | LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] & (0x7f); // extract the sector of sx | |
541 | } |
|
630 | } | |
542 | //====================================================================== |
|
631 | //====================================================================== | |
543 | // BP1 phase velocity estimator == PAR_LFR_SC_BP1_VPHI_F0 == 8 bits (7+1) |
|
632 | // BP1 phase velocity estimator == PAR_LFR_SC_BP1_VPHI_F0 == 8 bits (7+1) | |
544 | ny = sin(Alpha_M)*NVEC_V1 + cos(Alpha_M)*NVEC_V2; |
|
633 | ny = sin(Alpha_M)*NVEC_V1 + cos(Alpha_M)*NVEC_V2; | |
545 | nz = NVEC_V0; |
|
634 | nz = NVEC_V0; | |
546 | bx_bx_star = cos(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+10] // re S22 |
|
635 | bx_bx_star = cos(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+10] // re S22 | |
547 | + sin(Alpha_M) * sin(Alpha_M) * compressed_spec_mat[i*30+18] // re S33 |
|
636 | + sin(Alpha_M) * sin(Alpha_M) * compressed_spec_mat[i*30+18] // re S33 | |
548 | - 2 * sin(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+12]; // re S23 |
|
637 | - 2 * sin(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+12]; // re S23 | |
549 | nebx_re = ny * (compressed_spec_mat[(i*30) + 14] * K24_ny_re |
|
638 | nebx_re = ny * (compressed_spec_mat[(i*30) + 14] * K24_ny_re | |
550 | +compressed_spec_mat[(i*30) + 16] * K25_ny_re |
|
639 | +compressed_spec_mat[(i*30) + 16] * K25_ny_re | |
551 | +compressed_spec_mat[(i*30) + 20] * K34_ny_re |
|
640 | +compressed_spec_mat[(i*30) + 20] * K34_ny_re | |
552 | +compressed_spec_mat[(i*30) + 22] * K35_ny_re) |
|
641 | +compressed_spec_mat[(i*30) + 22] * K35_ny_re) | |
553 | + nz * (compressed_spec_mat[(i*30) + 14] * K24_nz_re |
|
642 | + nz * (compressed_spec_mat[(i*30) + 14] * K24_nz_re | |
554 | +compressed_spec_mat[(i*30) + 16] * K25_nz_re |
|
643 | +compressed_spec_mat[(i*30) + 16] * K25_nz_re | |
555 | +compressed_spec_mat[(i*30) + 20] * K34_nz_re |
|
644 | +compressed_spec_mat[(i*30) + 20] * K34_nz_re | |
556 | +compressed_spec_mat[(i*30) + 22] * K35_nz_re); |
|
645 | +compressed_spec_mat[(i*30) + 22] * K35_nz_re); | |
557 | nebx_im = ny * (compressed_spec_mat[(i*30) + 15]*K24_ny_re |
|
646 | nebx_im = ny * (compressed_spec_mat[(i*30) + 15]*K24_ny_re | |
558 | +compressed_spec_mat[(i*30) + 17] * K25_ny_re |
|
647 | +compressed_spec_mat[(i*30) + 17] * K25_ny_re | |
559 | +compressed_spec_mat[(i*30) + 21] * K34_ny_re |
|
648 | +compressed_spec_mat[(i*30) + 21] * K34_ny_re | |
560 | +compressed_spec_mat[(i*30) + 23] * K35_ny_re) |
|
649 | +compressed_spec_mat[(i*30) + 23] * K35_ny_re) | |
561 | + nz * (compressed_spec_mat[(i*30) + 15] * K24_nz_im |
|
650 | + nz * (compressed_spec_mat[(i*30) + 15] * K24_nz_im | |
562 | +compressed_spec_mat[(i*30) + 17] * K25_nz_im |
|
651 | +compressed_spec_mat[(i*30) + 17] * K25_nz_im | |
563 | +compressed_spec_mat[(i*30) + 21] * K34_nz_im |
|
652 | +compressed_spec_mat[(i*30) + 21] * K34_nz_im | |
564 | +compressed_spec_mat[(i*30) + 23] * K35_nz_im); |
|
653 | +compressed_spec_mat[(i*30) + 23] * K35_nz_im); | |
565 | tmp = nebx_re / bx_bx_star; |
|
654 | tmp = nebx_re / bx_bx_star; | |
566 | LFR_BP1[(i*9) + 8] = ((unsigned char) (tmp * 128)) & 0x7f; // cf DOC for the compression |
|
655 | LFR_BP1[(i*9) + 8] = ((unsigned char) (tmp * 128)) & 0x7f; // cf DOC for the compression | |
567 | if ( abs(nebx_re) > abs(nebx_im) ) { |
|
656 | if ( abs(nebx_re) > abs(nebx_im) ) { | |
568 | LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] | (0x80); // extract the sector of nebx |
|
657 | LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] | (0x80); // extract the sector of nebx | |
569 | } |
|
658 | } | |
570 | else { |
|
659 | else { | |
571 | LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] & (0x7f); // extract the sector of nebx |
|
660 | LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] & (0x7f); // extract the sector of nebx | |
572 | } |
|
661 | } | |
573 | } |
|
662 | } | |
574 |
|
663 | |||
575 | } |
|
664 | } | |
576 |
|
665 | |||
577 | void BP2_set_old(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat){ |
|
666 | void BP2_set_old(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat){ | |
578 | // BP2 autocorrelation |
|
667 | // BP2 autocorrelation | |
579 | int i; |
|
668 | int i; | |
580 | int aux = 0; |
|
669 | int aux = 0; | |
581 |
|
670 | |||
582 | for(i = 0; i<nb_bins_compressed_spec_mat; i++){ |
|
671 | for(i = 0; i<nb_bins_compressed_spec_mat; i++){ | |
583 | // S12 |
|
672 | // S12 | |
584 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 10]); |
|
673 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 10]); | |
585 | compressed_spec_mat[(i*30) + 2] = compressed_spec_mat[(i*30) + 2] / aux; |
|
674 | compressed_spec_mat[(i*30) + 2] = compressed_spec_mat[(i*30) + 2] / aux; | |
586 | compressed_spec_mat[(i*30) + 3] = compressed_spec_mat[(i*30) + 3] / aux; |
|
675 | compressed_spec_mat[(i*30) + 3] = compressed_spec_mat[(i*30) + 3] / aux; | |
587 | // S13 |
|
676 | // S13 | |
588 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 18]); |
|
677 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 18]); | |
589 | compressed_spec_mat[(i*30) + 4] = compressed_spec_mat[(i*30) + 4] / aux; |
|
678 | compressed_spec_mat[(i*30) + 4] = compressed_spec_mat[(i*30) + 4] / aux; | |
590 | compressed_spec_mat[(i*30) + 5] = compressed_spec_mat[(i*30) + 5] / aux; |
|
679 | compressed_spec_mat[(i*30) + 5] = compressed_spec_mat[(i*30) + 5] / aux; | |
591 | // S23 |
|
680 | // S23 | |
592 | aux = sqrt(compressed_spec_mat[i*30+12]*compressed_spec_mat[(i*30) + 18]); |
|
681 | aux = sqrt(compressed_spec_mat[i*30+12]*compressed_spec_mat[(i*30) + 18]); | |
593 | compressed_spec_mat[(i*30) + 12] = compressed_spec_mat[(i*30) + 12] / aux; |
|
682 | compressed_spec_mat[(i*30) + 12] = compressed_spec_mat[(i*30) + 12] / aux; | |
594 | compressed_spec_mat[(i*30) + 13] = compressed_spec_mat[(i*30) + 13] / aux; |
|
683 | compressed_spec_mat[(i*30) + 13] = compressed_spec_mat[(i*30) + 13] / aux; | |
595 | // S45 |
|
684 | // S45 | |
596 | aux = sqrt(compressed_spec_mat[i*30+24]*compressed_spec_mat[(i*30) + 28]); |
|
685 | aux = sqrt(compressed_spec_mat[i*30+24]*compressed_spec_mat[(i*30) + 28]); | |
597 | compressed_spec_mat[(i*30) + 26] = compressed_spec_mat[(i*30) + 26] / aux; |
|
686 | compressed_spec_mat[(i*30) + 26] = compressed_spec_mat[(i*30) + 26] / aux; | |
598 | compressed_spec_mat[(i*30) + 27] = compressed_spec_mat[(i*30) + 27] / aux; |
|
687 | compressed_spec_mat[(i*30) + 27] = compressed_spec_mat[(i*30) + 27] / aux; | |
599 | // S14 |
|
688 | // S14 | |
600 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) +24]); |
|
689 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) +24]); | |
601 | compressed_spec_mat[(i*30) + 6] = compressed_spec_mat[(i*30) + 6] / aux; |
|
690 | compressed_spec_mat[(i*30) + 6] = compressed_spec_mat[(i*30) + 6] / aux; | |
602 | compressed_spec_mat[(i*30) + 7] = compressed_spec_mat[(i*30) + 7] / aux; |
|
691 | compressed_spec_mat[(i*30) + 7] = compressed_spec_mat[(i*30) + 7] / aux; | |
603 | // S15 |
|
692 | // S15 | |
604 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 28]); |
|
693 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 28]); | |
605 | compressed_spec_mat[(i*30) + 8] = compressed_spec_mat[(i*30) + 8] / aux; |
|
694 | compressed_spec_mat[(i*30) + 8] = compressed_spec_mat[(i*30) + 8] / aux; | |
606 | compressed_spec_mat[(i*30) + 9] = compressed_spec_mat[(i*30) + 9] / aux; |
|
695 | compressed_spec_mat[(i*30) + 9] = compressed_spec_mat[(i*30) + 9] / aux; | |
607 | // S24 |
|
696 | // S24 | |
608 | aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 24]); |
|
697 | aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 24]); | |
609 | compressed_spec_mat[(i*30) + 14] = compressed_spec_mat[(i*30) + 14] / aux; |
|
698 | compressed_spec_mat[(i*30) + 14] = compressed_spec_mat[(i*30) + 14] / aux; | |
610 | compressed_spec_mat[(i*30) + 15] = compressed_spec_mat[(i*30) + 15] / aux; |
|
699 | compressed_spec_mat[(i*30) + 15] = compressed_spec_mat[(i*30) + 15] / aux; | |
611 | // S25 |
|
700 | // S25 | |
612 | aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 28]); |
|
701 | aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 28]); | |
613 | compressed_spec_mat[(i*30) + 16] = compressed_spec_mat[(i*30) + 16] / aux; |
|
702 | compressed_spec_mat[(i*30) + 16] = compressed_spec_mat[(i*30) + 16] / aux; | |
614 | compressed_spec_mat[(i*30) + 17] = compressed_spec_mat[(i*30) + 17] / aux; |
|
703 | compressed_spec_mat[(i*30) + 17] = compressed_spec_mat[(i*30) + 17] / aux; | |
615 | // S34 |
|
704 | // S34 | |
616 | aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 24]); |
|
705 | aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 24]); | |
617 | compressed_spec_mat[(i*30) + 20] = compressed_spec_mat[(i*30) + 20] / aux; |
|
706 | compressed_spec_mat[(i*30) + 20] = compressed_spec_mat[(i*30) + 20] / aux; | |
618 | compressed_spec_mat[(i*30) + 21] = compressed_spec_mat[(i*30) + 21] / aux; |
|
707 | compressed_spec_mat[(i*30) + 21] = compressed_spec_mat[(i*30) + 21] / aux; | |
619 | // S35 |
|
708 | // S35 | |
620 | aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 28]); |
|
709 | aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 28]); | |
621 | compressed_spec_mat[(i*30) + 22] = compressed_spec_mat[(i*30) + 22] / aux; |
|
710 | compressed_spec_mat[(i*30) + 22] = compressed_spec_mat[(i*30) + 22] / aux; | |
622 | compressed_spec_mat[(i*30) + 23] = compressed_spec_mat[(i*30) + 23] / aux; |
|
711 | compressed_spec_mat[(i*30) + 23] = compressed_spec_mat[(i*30) + 23] / aux; | |
623 | } |
|
712 | } | |
624 | } |
|
713 | } | |
625 |
|
714 | |||
626 | void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header) |
|
715 | void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header) | |
627 | { |
|
716 | { | |
628 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
717 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; | |
629 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
718 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
630 | header->reserved = 0x00; |
|
719 | header->reserved = 0x00; | |
631 | header->userApplication = CCSDS_USER_APP; |
|
720 | header->userApplication = CCSDS_USER_APP; | |
632 | header->packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); |
|
721 | header->packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); | |
633 | header->packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); |
|
722 | header->packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); | |
634 | header->packetSequenceControl[0] = 0xc0; |
|
723 | header->packetSequenceControl[0] = 0xc0; | |
635 | header->packetSequenceControl[1] = 0x00; |
|
724 | header->packetSequenceControl[1] = 0x00; | |
636 | header->packetLength[0] = 0x00; |
|
725 | header->packetLength[0] = 0x00; | |
637 | header->packetLength[1] = 0x00; |
|
726 | header->packetLength[1] = 0x00; | |
638 | // DATA FIELD HEADER |
|
727 | // DATA FIELD HEADER | |
639 | header->spare1_pusVersion_spare2 = 0x10; |
|
728 | header->spare1_pusVersion_spare2 = 0x10; | |
640 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
729 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
641 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
730 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
642 | header->destinationID = TM_DESTINATION_ID_GROUND; |
|
731 | header->destinationID = TM_DESTINATION_ID_GROUND; | |
643 | // AUXILIARY DATA HEADER |
|
732 | // AUXILIARY DATA HEADER | |
644 | header->sid = 0x00; |
|
733 | header->sid = 0x00; | |
645 | header->biaStatusInfo = 0x00; |
|
734 | header->biaStatusInfo = 0x00; | |
646 | header->pa_lfr_pkt_cnt_asm = 0x00; |
|
735 | header->pa_lfr_pkt_cnt_asm = 0x00; | |
647 | header->pa_lfr_pkt_nr_asm = 0x00; |
|
736 | header->pa_lfr_pkt_nr_asm = 0x00; | |
648 | header->time[0] = 0x00; |
|
737 | header->time[0] = 0x00; | |
649 | header->time[0] = 0x00; |
|
738 | header->time[0] = 0x00; | |
650 | header->time[0] = 0x00; |
|
739 | header->time[0] = 0x00; | |
651 | header->time[0] = 0x00; |
|
740 | header->time[0] = 0x00; | |
652 | header->time[0] = 0x00; |
|
741 | header->time[0] = 0x00; | |
653 | header->time[0] = 0x00; |
|
742 | header->time[0] = 0x00; | |
654 | header->pa_lfr_asm_blk_nr[0] = 0x00; // BLK_NR MSB |
|
743 | header->pa_lfr_asm_blk_nr[0] = 0x00; // BLK_NR MSB | |
655 | header->pa_lfr_asm_blk_nr[1] = 0x00; // BLK_NR LSB |
|
744 | header->pa_lfr_asm_blk_nr[1] = 0x00; // BLK_NR LSB | |
656 | } |
|
745 | } | |
657 |
|
746 | |||
|
747 | void init_header_bp( Header_TM_LFR_SCIENCE_BP_t *header) | |||
|
748 | { | |||
|
749 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; | |||
|
750 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; | |||
|
751 | header->reserved = 0x00; | |||
|
752 | header->userApplication = CCSDS_USER_APP; | |||
|
753 | // header->packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); | |||
|
754 | // header->packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); | |||
|
755 | header->packetSequenceControl[0] = 0xc0; | |||
|
756 | header->packetSequenceControl[1] = 0x00; | |||
|
757 | header->packetLength[0] = 0x00; | |||
|
758 | header->packetLength[1] = 0x00; | |||
|
759 | // DATA FIELD HEADER | |||
|
760 | header->spare1_pusVersion_spare2 = 0x10; | |||
|
761 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type | |||
|
762 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |||
|
763 | header->destinationID = TM_DESTINATION_ID_GROUND; | |||
|
764 | // AUXILIARY DATA HEADER | |||
|
765 | header->sid = 0x00; | |||
|
766 | header->biaStatusInfo = 0x00; | |||
|
767 | header->time[0] = 0x00; | |||
|
768 | header->time[0] = 0x00; | |||
|
769 | header->time[0] = 0x00; | |||
|
770 | header->time[0] = 0x00; | |||
|
771 | header->time[0] = 0x00; | |||
|
772 | header->time[0] = 0x00; | |||
|
773 | header->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB | |||
|
774 | header->pa_lfr_bp_blk_nr[1] = 0x00; // BLK_NR LSB | |||
|
775 | } | |||
|
776 | ||||
658 | void fill_averaged_spectral_matrix(void) |
|
777 | void fill_averaged_spectral_matrix(void) | |
659 | { |
|
778 | { | |
660 | /** This function fills spectral matrices related buffers with arbitrary data. |
|
779 | /** This function fills spectral matrices related buffers with arbitrary data. | |
661 | * |
|
780 | * | |
662 | * This function is for testing purpose only. |
|
781 | * This function is for testing purpose only. | |
663 | * |
|
782 | * | |
664 | */ |
|
783 | */ | |
665 |
|
784 | |||
666 | float offset; |
|
785 | float offset; | |
667 | float coeff; |
|
786 | float coeff; | |
668 |
|
787 | |||
669 | offset = 10.; |
|
788 | offset = 10.; | |
670 | coeff = 100000.; |
|
789 | coeff = 100000.; | |
671 | averaged_sm_f0[ 0 + 25 * 0 ] = 0. + offset; |
|
790 | averaged_sm_f0[ 0 + 25 * 0 ] = 0. + offset; | |
672 | averaged_sm_f0[ 0 + 25 * 1 ] = 1. + offset; |
|
791 | averaged_sm_f0[ 0 + 25 * 1 ] = 1. + offset; | |
673 | averaged_sm_f0[ 0 + 25 * 2 ] = 2. + offset; |
|
792 | averaged_sm_f0[ 0 + 25 * 2 ] = 2. + offset; | |
674 | averaged_sm_f0[ 0 + 25 * 3 ] = 3. + offset; |
|
793 | averaged_sm_f0[ 0 + 25 * 3 ] = 3. + offset; | |
675 | averaged_sm_f0[ 0 + 25 * 4 ] = 4. + offset; |
|
794 | averaged_sm_f0[ 0 + 25 * 4 ] = 4. + offset; | |
676 | averaged_sm_f0[ 0 + 25 * 5 ] = 5. + offset; |
|
795 | averaged_sm_f0[ 0 + 25 * 5 ] = 5. + offset; | |
677 | averaged_sm_f0[ 0 + 25 * 6 ] = 6. + offset; |
|
796 | averaged_sm_f0[ 0 + 25 * 6 ] = 6. + offset; | |
678 | averaged_sm_f0[ 0 + 25 * 7 ] = 7. + offset; |
|
797 | averaged_sm_f0[ 0 + 25 * 7 ] = 7. + offset; | |
679 | averaged_sm_f0[ 0 + 25 * 8 ] = 8. + offset; |
|
798 | averaged_sm_f0[ 0 + 25 * 8 ] = 8. + offset; | |
680 | averaged_sm_f0[ 0 + 25 * 9 ] = 9. + offset; |
|
799 | averaged_sm_f0[ 0 + 25 * 9 ] = 9. + offset; | |
681 | averaged_sm_f0[ 0 + 25 * 10 ] = 10. + offset; |
|
800 | averaged_sm_f0[ 0 + 25 * 10 ] = 10. + offset; | |
682 | averaged_sm_f0[ 0 + 25 * 11 ] = 11. + offset; |
|
801 | averaged_sm_f0[ 0 + 25 * 11 ] = 11. + offset; | |
683 | averaged_sm_f0[ 0 + 25 * 12 ] = 12. + offset; |
|
802 | averaged_sm_f0[ 0 + 25 * 12 ] = 12. + offset; | |
684 | averaged_sm_f0[ 0 + 25 * 13 ] = 13. + offset; |
|
803 | averaged_sm_f0[ 0 + 25 * 13 ] = 13. + offset; | |
685 | averaged_sm_f0[ 0 + 25 * 14 ] = 14. + offset; |
|
804 | averaged_sm_f0[ 0 + 25 * 14 ] = 14. + offset; | |
686 | averaged_sm_f0[ 9 + 25 * 0 ] = -(0. + offset)* coeff; |
|
805 | averaged_sm_f0[ 9 + 25 * 0 ] = -(0. + offset)* coeff; | |
687 | averaged_sm_f0[ 9 + 25 * 1 ] = -(1. + offset)* coeff; |
|
806 | averaged_sm_f0[ 9 + 25 * 1 ] = -(1. + offset)* coeff; | |
688 | averaged_sm_f0[ 9 + 25 * 2 ] = -(2. + offset)* coeff; |
|
807 | averaged_sm_f0[ 9 + 25 * 2 ] = -(2. + offset)* coeff; | |
689 | averaged_sm_f0[ 9 + 25 * 3 ] = -(3. + offset)* coeff; |
|
808 | averaged_sm_f0[ 9 + 25 * 3 ] = -(3. + offset)* coeff; | |
690 | averaged_sm_f0[ 9 + 25 * 4 ] = -(4. + offset)* coeff; |
|
809 | averaged_sm_f0[ 9 + 25 * 4 ] = -(4. + offset)* coeff; | |
691 | averaged_sm_f0[ 9 + 25 * 5 ] = -(5. + offset)* coeff; |
|
810 | averaged_sm_f0[ 9 + 25 * 5 ] = -(5. + offset)* coeff; | |
692 | averaged_sm_f0[ 9 + 25 * 6 ] = -(6. + offset)* coeff; |
|
811 | averaged_sm_f0[ 9 + 25 * 6 ] = -(6. + offset)* coeff; | |
693 | averaged_sm_f0[ 9 + 25 * 7 ] = -(7. + offset)* coeff; |
|
812 | averaged_sm_f0[ 9 + 25 * 7 ] = -(7. + offset)* coeff; | |
694 | averaged_sm_f0[ 9 + 25 * 8 ] = -(8. + offset)* coeff; |
|
813 | averaged_sm_f0[ 9 + 25 * 8 ] = -(8. + offset)* coeff; | |
695 | averaged_sm_f0[ 9 + 25 * 9 ] = -(9. + offset)* coeff; |
|
814 | averaged_sm_f0[ 9 + 25 * 9 ] = -(9. + offset)* coeff; | |
696 | averaged_sm_f0[ 9 + 25 * 10 ] = -(10. + offset)* coeff; |
|
815 | averaged_sm_f0[ 9 + 25 * 10 ] = -(10. + offset)* coeff; | |
697 | averaged_sm_f0[ 9 + 25 * 11 ] = -(11. + offset)* coeff; |
|
816 | averaged_sm_f0[ 9 + 25 * 11 ] = -(11. + offset)* coeff; | |
698 | averaged_sm_f0[ 9 + 25 * 12 ] = -(12. + offset)* coeff; |
|
817 | averaged_sm_f0[ 9 + 25 * 12 ] = -(12. + offset)* coeff; | |
699 | averaged_sm_f0[ 9 + 25 * 13 ] = -(13. + offset)* coeff; |
|
818 | averaged_sm_f0[ 9 + 25 * 13 ] = -(13. + offset)* coeff; | |
700 | averaged_sm_f0[ 9 + 25 * 14 ] = -(14. + offset)* coeff; |
|
819 | averaged_sm_f0[ 9 + 25 * 14 ] = -(14. + offset)* coeff; | |
701 |
|
820 | |||
702 | offset = 10000000; |
|
821 | offset = 10000000; | |
703 | averaged_sm_f0[ 16 + 25 * 0 ] = (0. + offset)* coeff; |
|
822 | averaged_sm_f0[ 16 + 25 * 0 ] = (0. + offset)* coeff; | |
704 | averaged_sm_f0[ 16 + 25 * 1 ] = (1. + offset)* coeff; |
|
823 | averaged_sm_f0[ 16 + 25 * 1 ] = (1. + offset)* coeff; | |
705 | averaged_sm_f0[ 16 + 25 * 2 ] = (2. + offset)* coeff; |
|
824 | averaged_sm_f0[ 16 + 25 * 2 ] = (2. + offset)* coeff; | |
706 | averaged_sm_f0[ 16 + 25 * 3 ] = (3. + offset)* coeff; |
|
825 | averaged_sm_f0[ 16 + 25 * 3 ] = (3. + offset)* coeff; | |
707 | averaged_sm_f0[ 16 + 25 * 4 ] = (4. + offset)* coeff; |
|
826 | averaged_sm_f0[ 16 + 25 * 4 ] = (4. + offset)* coeff; | |
708 | averaged_sm_f0[ 16 + 25 * 5 ] = (5. + offset)* coeff; |
|
827 | averaged_sm_f0[ 16 + 25 * 5 ] = (5. + offset)* coeff; | |
709 | averaged_sm_f0[ 16 + 25 * 6 ] = (6. + offset)* coeff; |
|
828 | averaged_sm_f0[ 16 + 25 * 6 ] = (6. + offset)* coeff; | |
710 | averaged_sm_f0[ 16 + 25 * 7 ] = (7. + offset)* coeff; |
|
829 | averaged_sm_f0[ 16 + 25 * 7 ] = (7. + offset)* coeff; | |
711 | averaged_sm_f0[ 16 + 25 * 8 ] = (8. + offset)* coeff; |
|
830 | averaged_sm_f0[ 16 + 25 * 8 ] = (8. + offset)* coeff; | |
712 | averaged_sm_f0[ 16 + 25 * 9 ] = (9. + offset)* coeff; |
|
831 | averaged_sm_f0[ 16 + 25 * 9 ] = (9. + offset)* coeff; | |
713 | averaged_sm_f0[ 16 + 25 * 10 ] = (10. + offset)* coeff; |
|
832 | averaged_sm_f0[ 16 + 25 * 10 ] = (10. + offset)* coeff; | |
714 | averaged_sm_f0[ 16 + 25 * 11 ] = (11. + offset)* coeff; |
|
833 | averaged_sm_f0[ 16 + 25 * 11 ] = (11. + offset)* coeff; | |
715 | averaged_sm_f0[ 16 + 25 * 12 ] = (12. + offset)* coeff; |
|
834 | averaged_sm_f0[ 16 + 25 * 12 ] = (12. + offset)* coeff; | |
716 | averaged_sm_f0[ 16 + 25 * 13 ] = (13. + offset)* coeff; |
|
835 | averaged_sm_f0[ 16 + 25 * 13 ] = (13. + offset)* coeff; | |
717 | averaged_sm_f0[ 16 + 25 * 14 ] = (14. + offset)* coeff; |
|
836 | averaged_sm_f0[ 16 + 25 * 14 ] = (14. + offset)* coeff; | |
718 |
|
837 | |||
719 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 0 ] = averaged_sm_f0[ 0 ]; |
|
838 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 0 ] = averaged_sm_f0[ 0 ]; | |
720 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 1 ] = averaged_sm_f0[ 1 ]; |
|
839 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 1 ] = averaged_sm_f0[ 1 ]; | |
721 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 2 ] = averaged_sm_f0[ 2 ]; |
|
840 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 2 ] = averaged_sm_f0[ 2 ]; | |
722 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 3 ] = averaged_sm_f0[ 3 ]; |
|
841 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 3 ] = averaged_sm_f0[ 3 ]; | |
723 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 4 ] = averaged_sm_f0[ 4 ]; |
|
842 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 4 ] = averaged_sm_f0[ 4 ]; | |
724 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 5 ] = averaged_sm_f0[ 5 ]; |
|
843 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 5 ] = averaged_sm_f0[ 5 ]; | |
725 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 6 ] = averaged_sm_f0[ 6 ]; |
|
844 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 6 ] = averaged_sm_f0[ 6 ]; | |
726 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 7 ] = averaged_sm_f0[ 7 ]; |
|
845 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 7 ] = averaged_sm_f0[ 7 ]; | |
727 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 8 ] = averaged_sm_f0[ 8 ]; |
|
846 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 8 ] = averaged_sm_f0[ 8 ]; | |
728 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 9 ] = averaged_sm_f0[ 9 ]; |
|
847 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 9 ] = averaged_sm_f0[ 9 ]; | |
729 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 10 ] = averaged_sm_f0[ 10 ]; |
|
848 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 10 ] = averaged_sm_f0[ 10 ]; | |
730 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 11 ] = averaged_sm_f0[ 11 ]; |
|
849 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 11 ] = averaged_sm_f0[ 11 ]; | |
731 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 12 ] = averaged_sm_f0[ 12 ]; |
|
850 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 12 ] = averaged_sm_f0[ 12 ]; | |
732 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 13 ] = averaged_sm_f0[ 13 ]; |
|
851 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 13 ] = averaged_sm_f0[ 13 ]; | |
733 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 14 ] = averaged_sm_f0[ 14 ]; |
|
852 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 14 ] = averaged_sm_f0[ 14 ]; | |
734 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 15 ] = averaged_sm_f0[ 15 ]; |
|
853 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 15 ] = averaged_sm_f0[ 15 ]; | |
735 | } |
|
854 | } | |
736 |
|
855 | |||
737 | void reset_spectral_matrix_regs() |
|
856 | void reset_spectral_matrix_regs() | |
738 | { |
|
857 | { | |
739 | /** This function resets the spectral matrices module registers. |
|
858 | /** This function resets the spectral matrices module registers. | |
740 | * |
|
859 | * | |
741 | * The registers affected by this function are located at the following offset addresses: |
|
860 | * The registers affected by this function are located at the following offset addresses: | |
742 | * |
|
861 | * | |
743 | * - 0x00 config |
|
862 | * - 0x00 config | |
744 | * - 0x04 status |
|
863 | * - 0x04 status | |
745 | * - 0x08 matrixF0_Address0 |
|
864 | * - 0x08 matrixF0_Address0 | |
746 | * - 0x10 matrixFO_Address1 |
|
865 | * - 0x10 matrixFO_Address1 | |
747 | * - 0x14 matrixF1_Address |
|
866 | * - 0x14 matrixF1_Address | |
748 | * - 0x18 matrixF2_Address |
|
867 | * - 0x18 matrixF2_Address | |
749 | * |
|
868 | * | |
750 | */ |
|
869 | */ | |
751 |
|
870 | |||
752 | spectral_matrix_regs->config = 0x00; |
|
871 | spectral_matrix_regs->config = 0x00; | |
753 | spectral_matrix_regs->status = 0x00; |
|
872 | spectral_matrix_regs->status = 0x00; | |
754 |
|
873 | |||
755 | spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address; |
|
874 | spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address; | |
756 | spectral_matrix_regs->matrixFO_Address1 = current_ring_node_sm_f0->buffer_address; |
|
875 | spectral_matrix_regs->matrixFO_Address1 = current_ring_node_sm_f0->buffer_address; | |
757 | spectral_matrix_regs->matrixF1_Address = current_ring_node_sm_f1->buffer_address; |
|
876 | spectral_matrix_regs->matrixF1_Address = current_ring_node_sm_f1->buffer_address; | |
758 | spectral_matrix_regs->matrixF2_Address = current_ring_node_sm_f2->buffer_address; |
|
877 | spectral_matrix_regs->matrixF2_Address = current_ring_node_sm_f2->buffer_address; | |
759 | } |
|
878 | } | |
760 |
|
879 | |||
761 | //****************** |
|
880 | //****************** | |
762 | // general functions |
|
881 | // general functions | |
763 |
|
882 | |||
764 |
|
883 | |||
765 |
|
884 | |||
766 |
|
885 |
@@ -1,885 +1,879 | |||||
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 ); |
|
105 | result = action_enter_mode( &TC, queue_snd_id ); | |
106 | close_action( &TC, result, queue_snd_id ); |
|
106 | close_action( &TC, result, queue_snd_id ); | |
107 | break; |
|
107 | break; | |
108 | // |
|
108 | // | |
109 | case TC_SUBTYPE_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 ) |
|
152 | int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) | |
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 | unsigned int *transitionCoarseTime_ptr; |
|
163 | unsigned int *transitionCoarseTime_ptr; | |
164 | unsigned int transitionCoarseTime; |
|
164 | unsigned int transitionCoarseTime; | |
165 | unsigned char * bytePosPtr; |
|
165 | unsigned char * bytePosPtr; | |
166 |
|
166 | |||
167 | bytePosPtr = (unsigned char *) &TC->packetID; |
|
167 | bytePosPtr = (unsigned char *) &TC->packetID; | |
168 |
|
168 | |||
169 | requestedMode = bytePosPtr[ BYTE_POS_CP_MODE_LFR_SET ]; |
|
169 | requestedMode = bytePosPtr[ BYTE_POS_CP_MODE_LFR_SET ]; | |
170 | transitionCoarseTime_ptr = (unsigned int *) ( &bytePosPtr[ BYTE_POS_CP_LFR_ENTER_MODE_TIME ] ); |
|
170 | transitionCoarseTime_ptr = (unsigned int *) ( &bytePosPtr[ BYTE_POS_CP_LFR_ENTER_MODE_TIME ] ); | |
171 | transitionCoarseTime = (*transitionCoarseTime_ptr) & 0x7fffffff; |
|
171 | transitionCoarseTime = (*transitionCoarseTime_ptr) & 0x7fffffff; | |
172 |
|
172 | |||
173 | status = check_mode_value( requestedMode ); |
|
173 | status = check_mode_value( requestedMode ); | |
174 |
|
174 | |||
175 | if ( status != LFR_SUCCESSFUL ) // the mode value is inconsistent |
|
175 | if ( status != LFR_SUCCESSFUL ) // the mode value is inconsistent | |
176 | { |
|
176 | { | |
177 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_MODE_LFR_SET, requestedMode ); |
|
177 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_MODE_LFR_SET, requestedMode ); | |
178 | } |
|
178 | } | |
179 | else // the mode value is consistent, check the transition |
|
179 | else // the mode value is consistent, check the transition | |
180 | { |
|
180 | { | |
181 | status = check_mode_transition(requestedMode); |
|
181 | status = check_mode_transition(requestedMode); | |
182 | if (status != LFR_SUCCESSFUL) |
|
182 | if (status != LFR_SUCCESSFUL) | |
183 | { |
|
183 | { | |
184 | PRINTF("ERR *** in action_enter_mode *** check_mode_transition\n") |
|
184 | PRINTF("ERR *** in action_enter_mode *** check_mode_transition\n") | |
185 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); |
|
185 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); | |
186 | } |
|
186 | } | |
187 | } |
|
187 | } | |
188 |
|
188 | |||
189 | if ( status == LFR_SUCCESSFUL ) // the transition is valid, enter the mode |
|
189 | if ( status == LFR_SUCCESSFUL ) // the transition is valid, enter the mode | |
190 | { |
|
190 | { | |
191 | status = check_transition_date( transitionCoarseTime ); |
|
191 | status = check_transition_date( transitionCoarseTime ); | |
192 | if (status != LFR_SUCCESSFUL) |
|
192 | if (status != LFR_SUCCESSFUL) | |
193 | { |
|
193 | { | |
194 | PRINTF("ERR *** in action_enter_mode *** check_transition_date\n") |
|
194 | PRINTF("ERR *** in action_enter_mode *** check_transition_date\n") | |
195 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, |
|
195 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, | |
196 | BYTE_POS_CP_LFR_ENTER_MODE_TIME, |
|
196 | BYTE_POS_CP_LFR_ENTER_MODE_TIME, | |
197 | bytePosPtr[ BYTE_POS_CP_LFR_ENTER_MODE_TIME + 3 ] ); |
|
197 | bytePosPtr[ BYTE_POS_CP_LFR_ENTER_MODE_TIME + 3 ] ); | |
198 | } |
|
198 | } | |
199 | } |
|
199 | } | |
200 |
|
200 | |||
201 | if ( status == LFR_SUCCESSFUL ) // the date is valid, enter the mode |
|
201 | if ( status == LFR_SUCCESSFUL ) // the date is valid, enter the mode | |
202 | { |
|
202 | { | |
203 | PRINTF1("OK *** in action_enter_mode *** enter mode %d\n", requestedMode); |
|
203 | PRINTF1("OK *** in action_enter_mode *** enter mode %d\n", requestedMode); | |
204 | status = enter_mode( requestedMode, transitionCoarseTime ); |
|
204 | status = enter_mode( requestedMode, transitionCoarseTime ); | |
205 | } |
|
205 | } | |
206 |
|
206 | |||
207 | return status; |
|
207 | return status; | |
208 | } |
|
208 | } | |
209 |
|
209 | |||
210 | int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
210 | int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) | |
211 | { |
|
211 | { | |
212 | /** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received. |
|
212 | /** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received. | |
213 | * |
|
213 | * | |
214 | * @param TC points to the TeleCommand packet that is being processed |
|
214 | * @param TC points to the TeleCommand packet that is being processed | |
215 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
215 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver | |
216 | * |
|
216 | * | |
217 | * @return LFR directive status code: |
|
217 | * @return LFR directive status code: | |
218 | * - LFR_DEFAULT |
|
218 | * - LFR_DEFAULT | |
219 | * - LFR_SUCCESSFUL |
|
219 | * - LFR_SUCCESSFUL | |
220 | * |
|
220 | * | |
221 | */ |
|
221 | */ | |
222 |
|
222 | |||
223 | unsigned int val; |
|
223 | unsigned int val; | |
224 | int result; |
|
224 | int result; | |
225 | unsigned int status; |
|
225 | unsigned int status; | |
226 | unsigned char mode; |
|
226 | unsigned char mode; | |
227 | unsigned char * bytePosPtr; |
|
227 | unsigned char * bytePosPtr; | |
228 |
|
228 | |||
229 | bytePosPtr = (unsigned char *) &TC->packetID; |
|
229 | bytePosPtr = (unsigned char *) &TC->packetID; | |
230 |
|
230 | |||
231 | // check LFR mode |
|
231 | // check LFR mode | |
232 | mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET5 ] & 0x1e) >> 1; |
|
232 | mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET5 ] & 0x1e) >> 1; | |
233 | status = check_update_info_hk_lfr_mode( mode ); |
|
233 | status = check_update_info_hk_lfr_mode( mode ); | |
234 | if (status == LFR_SUCCESSFUL) // check TDS mode |
|
234 | if (status == LFR_SUCCESSFUL) // check TDS mode | |
235 | { |
|
235 | { | |
236 | mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 ] & 0xf0) >> 4; |
|
236 | mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 ] & 0xf0) >> 4; | |
237 | status = check_update_info_hk_tds_mode( mode ); |
|
237 | status = check_update_info_hk_tds_mode( mode ); | |
238 | } |
|
238 | } | |
239 | if (status == LFR_SUCCESSFUL) // check THR mode |
|
239 | if (status == LFR_SUCCESSFUL) // check THR mode | |
240 | { |
|
240 | { | |
241 | mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 ] & 0x0f); |
|
241 | mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 ] & 0x0f); | |
242 | status = check_update_info_hk_thr_mode( mode ); |
|
242 | status = check_update_info_hk_thr_mode( mode ); | |
243 | } |
|
243 | } | |
244 | if (status == LFR_SUCCESSFUL) // if the parameter check is successful |
|
244 | if (status == LFR_SUCCESSFUL) // if the parameter check is successful | |
245 | { |
|
245 | { | |
246 | val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256 |
|
246 | val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256 | |
247 | + housekeeping_packet.hk_lfr_update_info_tc_cnt[1]; |
|
247 | + housekeeping_packet.hk_lfr_update_info_tc_cnt[1]; | |
248 | val++; |
|
248 | val++; | |
249 | housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8); |
|
249 | housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8); | |
250 | housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val); |
|
250 | housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val); | |
251 | } |
|
251 | } | |
252 |
|
252 | |||
253 | result = status; |
|
253 | result = status; | |
254 |
|
254 | |||
255 | return result; |
|
255 | return result; | |
256 | } |
|
256 | } | |
257 |
|
257 | |||
258 | int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
258 | int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) | |
259 | { |
|
259 | { | |
260 | /** This function executes specific actions when a TC_LFR_ENABLE_CALIBRATION TeleCommand has been received. |
|
260 | /** This function executes specific actions when a TC_LFR_ENABLE_CALIBRATION TeleCommand has been received. | |
261 | * |
|
261 | * | |
262 | * @param TC points to the TeleCommand packet that is being processed |
|
262 | * @param TC points to the TeleCommand packet that is being processed | |
263 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
263 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver | |
264 | * |
|
264 | * | |
265 | */ |
|
265 | */ | |
266 |
|
266 | |||
267 | int result; |
|
267 | int result; | |
268 | unsigned char lfrMode; |
|
268 | unsigned char lfrMode; | |
269 |
|
269 | |||
270 | result = LFR_DEFAULT; |
|
270 | result = LFR_DEFAULT; | |
271 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
271 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
272 |
|
272 | |||
273 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); |
|
273 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); | |
274 | result = LFR_DEFAULT; |
|
274 | result = LFR_DEFAULT; | |
275 |
|
275 | |||
276 | return result; |
|
276 | return result; | |
277 | } |
|
277 | } | |
278 |
|
278 | |||
279 | int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
279 | int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) | |
280 | { |
|
280 | { | |
281 | /** This function executes specific actions when a TC_LFR_DISABLE_CALIBRATION TeleCommand has been received. |
|
281 | /** This function executes specific actions when a TC_LFR_DISABLE_CALIBRATION TeleCommand has been received. | |
282 | * |
|
282 | * | |
283 | * @param TC points to the TeleCommand packet that is being processed |
|
283 | * @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 |
|
284 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver | |
285 | * |
|
285 | * | |
286 | */ |
|
286 | */ | |
287 |
|
287 | |||
288 | int result; |
|
288 | int result; | |
289 | unsigned char lfrMode; |
|
289 | unsigned char lfrMode; | |
290 |
|
290 | |||
291 | result = LFR_DEFAULT; |
|
291 | result = LFR_DEFAULT; | |
292 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
292 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
293 |
|
293 | |||
294 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); |
|
294 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); | |
295 | result = LFR_DEFAULT; |
|
295 | result = LFR_DEFAULT; | |
296 |
|
296 | |||
297 | return result; |
|
297 | return result; | |
298 | } |
|
298 | } | |
299 |
|
299 | |||
300 | int action_update_time(ccsdsTelecommandPacket_t *TC) |
|
300 | int action_update_time(ccsdsTelecommandPacket_t *TC) | |
301 | { |
|
301 | { | |
302 | /** This function executes specific actions when a TC_LFR_UPDATE_TIME TeleCommand has been received. |
|
302 | /** This function executes specific actions when a TC_LFR_UPDATE_TIME TeleCommand has been received. | |
303 | * |
|
303 | * | |
304 | * @param TC points to the TeleCommand packet that is being processed |
|
304 | * @param TC points to the TeleCommand packet that is being processed | |
305 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
305 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver | |
306 | * |
|
306 | * | |
307 | * @return LFR_SUCCESSFUL |
|
307 | * @return LFR_SUCCESSFUL | |
308 | * |
|
308 | * | |
309 | */ |
|
309 | */ | |
310 |
|
310 | |||
311 | unsigned int val; |
|
311 | unsigned int val; | |
312 |
|
312 | |||
313 | time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24) |
|
313 | time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24) | |
314 | + (TC->dataAndCRC[1] << 16) |
|
314 | + (TC->dataAndCRC[1] << 16) | |
315 | + (TC->dataAndCRC[2] << 8) |
|
315 | + (TC->dataAndCRC[2] << 8) | |
316 | + TC->dataAndCRC[3]; |
|
316 | + TC->dataAndCRC[3]; | |
317 |
|
317 | |||
318 | PRINTF1("time received: %x\n", time_management_regs->coarse_time_load) |
|
318 | PRINTF1("time received: %x\n", time_management_regs->coarse_time_load) | |
319 |
|
319 | |||
320 | val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256 |
|
320 | val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256 | |
321 | + housekeeping_packet.hk_lfr_update_time_tc_cnt[1]; |
|
321 | + housekeeping_packet.hk_lfr_update_time_tc_cnt[1]; | |
322 | val++; |
|
322 | val++; | |
323 | housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8); |
|
323 | housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8); | |
324 | housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val); |
|
324 | housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val); | |
325 | // time_management_regs->ctrl = time_management_regs->ctrl | 1; // force tick |
|
325 | // time_management_regs->ctrl = time_management_regs->ctrl | 1; // force tick | |
326 |
|
326 | |||
327 | return LFR_SUCCESSFUL; |
|
327 | return LFR_SUCCESSFUL; | |
328 | } |
|
328 | } | |
329 |
|
329 | |||
330 | //******************* |
|
330 | //******************* | |
331 | // ENTERING THE MODES |
|
331 | // ENTERING THE MODES | |
332 | int check_mode_value( unsigned char requestedMode ) |
|
332 | int check_mode_value( unsigned char requestedMode ) | |
333 | { |
|
333 | { | |
334 | int status; |
|
334 | int status; | |
335 |
|
335 | |||
336 | if ( (requestedMode != LFR_MODE_STANDBY) |
|
336 | if ( (requestedMode != LFR_MODE_STANDBY) | |
337 | && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST) |
|
337 | && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST) | |
338 | && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) ) |
|
338 | && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) ) | |
339 | { |
|
339 | { | |
340 | status = LFR_DEFAULT; |
|
340 | status = LFR_DEFAULT; | |
341 | } |
|
341 | } | |
342 | else |
|
342 | else | |
343 | { |
|
343 | { | |
344 | status = LFR_SUCCESSFUL; |
|
344 | status = LFR_SUCCESSFUL; | |
345 | } |
|
345 | } | |
346 |
|
346 | |||
347 | return status; |
|
347 | return status; | |
348 | } |
|
348 | } | |
349 |
|
349 | |||
350 | int check_mode_transition( unsigned char requestedMode ) |
|
350 | int check_mode_transition( unsigned char requestedMode ) | |
351 | { |
|
351 | { | |
352 | /** This function checks the validity of the transition requested by the TC_LFR_ENTER_MODE. |
|
352 | /** This function checks the validity of the transition requested by the TC_LFR_ENTER_MODE. | |
353 | * |
|
353 | * | |
354 | * @param requestedMode is the mode requested by the TC_LFR_ENTER_MODE |
|
354 | * @param requestedMode is the mode requested by the TC_LFR_ENTER_MODE | |
355 | * |
|
355 | * | |
356 | * @return LFR directive status codes: |
|
356 | * @return LFR directive status codes: | |
357 | * - LFR_SUCCESSFUL - the transition is authorized |
|
357 | * - LFR_SUCCESSFUL - the transition is authorized | |
358 | * - LFR_DEFAULT - the transition is not authorized |
|
358 | * - LFR_DEFAULT - the transition is not authorized | |
359 | * |
|
359 | * | |
360 | */ |
|
360 | */ | |
361 |
|
361 | |||
362 | int status; |
|
362 | int status; | |
363 |
|
363 | |||
364 | switch (requestedMode) |
|
364 | switch (requestedMode) | |
365 | { |
|
365 | { | |
366 | case LFR_MODE_STANDBY: |
|
366 | case LFR_MODE_STANDBY: | |
367 | if ( lfrCurrentMode == LFR_MODE_STANDBY ) { |
|
367 | if ( lfrCurrentMode == LFR_MODE_STANDBY ) { | |
368 | status = LFR_DEFAULT; |
|
368 | status = LFR_DEFAULT; | |
369 | } |
|
369 | } | |
370 | else |
|
370 | else | |
371 | { |
|
371 | { | |
372 | status = LFR_SUCCESSFUL; |
|
372 | status = LFR_SUCCESSFUL; | |
373 | } |
|
373 | } | |
374 | break; |
|
374 | break; | |
375 | case LFR_MODE_NORMAL: |
|
375 | case LFR_MODE_NORMAL: | |
376 | if ( lfrCurrentMode == LFR_MODE_NORMAL ) { |
|
376 | if ( lfrCurrentMode == LFR_MODE_NORMAL ) { | |
377 | status = LFR_DEFAULT; |
|
377 | status = LFR_DEFAULT; | |
378 | } |
|
378 | } | |
379 | else { |
|
379 | else { | |
380 | status = LFR_SUCCESSFUL; |
|
380 | status = LFR_SUCCESSFUL; | |
381 | } |
|
381 | } | |
382 | break; |
|
382 | break; | |
383 | case LFR_MODE_BURST: |
|
383 | case LFR_MODE_BURST: | |
384 | if ( lfrCurrentMode == LFR_MODE_BURST ) { |
|
384 | if ( lfrCurrentMode == LFR_MODE_BURST ) { | |
385 | status = LFR_DEFAULT; |
|
385 | status = LFR_DEFAULT; | |
386 | } |
|
386 | } | |
387 | else { |
|
387 | else { | |
388 | status = LFR_SUCCESSFUL; |
|
388 | status = LFR_SUCCESSFUL; | |
389 | } |
|
389 | } | |
390 | break; |
|
390 | break; | |
391 | case LFR_MODE_SBM1: |
|
391 | case LFR_MODE_SBM1: | |
392 | if ( lfrCurrentMode == LFR_MODE_SBM1 ) { |
|
392 | if ( lfrCurrentMode == LFR_MODE_SBM1 ) { | |
393 | status = LFR_DEFAULT; |
|
393 | status = LFR_DEFAULT; | |
394 | } |
|
394 | } | |
395 | else { |
|
395 | else { | |
396 | status = LFR_SUCCESSFUL; |
|
396 | status = LFR_SUCCESSFUL; | |
397 | } |
|
397 | } | |
398 | break; |
|
398 | break; | |
399 | case LFR_MODE_SBM2: |
|
399 | case LFR_MODE_SBM2: | |
400 | if ( lfrCurrentMode == LFR_MODE_SBM2 ) { |
|
400 | if ( lfrCurrentMode == LFR_MODE_SBM2 ) { | |
401 | status = LFR_DEFAULT; |
|
401 | status = LFR_DEFAULT; | |
402 | } |
|
402 | } | |
403 | else { |
|
403 | else { | |
404 | status = LFR_SUCCESSFUL; |
|
404 | status = LFR_SUCCESSFUL; | |
405 | } |
|
405 | } | |
406 | break; |
|
406 | break; | |
407 | default: |
|
407 | default: | |
408 | status = LFR_DEFAULT; |
|
408 | status = LFR_DEFAULT; | |
409 | break; |
|
409 | break; | |
410 | } |
|
410 | } | |
411 |
|
411 | |||
412 | return status; |
|
412 | return status; | |
413 | } |
|
413 | } | |
414 |
|
414 | |||
415 | int check_transition_date( unsigned int transitionCoarseTime ) |
|
415 | int check_transition_date( unsigned int transitionCoarseTime ) | |
416 | { |
|
416 | { | |
417 | int status; |
|
417 | int status; | |
418 | unsigned int localCoarseTime; |
|
418 | unsigned int localCoarseTime; | |
419 | unsigned int deltaCoarseTime; |
|
419 | unsigned int deltaCoarseTime; | |
420 |
|
420 | |||
421 | status = LFR_SUCCESSFUL; |
|
421 | status = LFR_SUCCESSFUL; | |
422 |
|
422 | |||
423 | if (transitionCoarseTime == 0) // transition time = 0 means an instant transition |
|
423 | if (transitionCoarseTime == 0) // transition time = 0 means an instant transition | |
424 | { |
|
424 | { | |
425 | status = LFR_SUCCESSFUL; |
|
425 | status = LFR_SUCCESSFUL; | |
426 | } |
|
426 | } | |
427 | else |
|
427 | else | |
428 | { |
|
428 | { | |
429 | localCoarseTime = time_management_regs->coarse_time & 0x7fffffff; |
|
429 | localCoarseTime = time_management_regs->coarse_time & 0x7fffffff; | |
430 |
|
430 | |||
431 | if ( transitionCoarseTime <= localCoarseTime ) // SSS-CP-EQS-322 |
|
431 | if ( transitionCoarseTime <= localCoarseTime ) // SSS-CP-EQS-322 | |
432 | { |
|
432 | { | |
433 | status = LFR_DEFAULT; |
|
433 | status = LFR_DEFAULT; | |
434 | PRINTF2("ERR *** in check_transition_date *** transition = %x, local = %x\n", transitionCoarseTime, localCoarseTime) |
|
434 | PRINTF2("ERR *** in check_transition_date *** transition = %x, local = %x\n", transitionCoarseTime, localCoarseTime) | |
435 | } |
|
435 | } | |
436 |
|
436 | |||
437 | if (status == LFR_SUCCESSFUL) |
|
437 | if (status == LFR_SUCCESSFUL) | |
438 | { |
|
438 | { | |
439 | deltaCoarseTime = transitionCoarseTime - localCoarseTime; |
|
439 | deltaCoarseTime = transitionCoarseTime - localCoarseTime; | |
440 | if ( deltaCoarseTime > 3 ) // SSS-CP-EQS-323 |
|
440 | if ( deltaCoarseTime > 3 ) // SSS-CP-EQS-323 | |
441 | { |
|
441 | { | |
442 | status = LFR_DEFAULT; |
|
442 | status = LFR_DEFAULT; | |
443 | PRINTF1("ERR *** in check_transition_date *** deltaCoarseTime = %x\n", deltaCoarseTime) |
|
443 | PRINTF1("ERR *** in check_transition_date *** deltaCoarseTime = %x\n", deltaCoarseTime) | |
444 | } |
|
444 | } | |
445 | } |
|
445 | } | |
446 | } |
|
446 | } | |
447 |
|
447 | |||
448 | return status; |
|
448 | return status; | |
449 | } |
|
449 | } | |
450 |
|
450 | |||
451 | int stop_current_mode( void ) |
|
451 | int stop_current_mode( void ) | |
452 | { |
|
452 | { | |
453 | /** This function stops the current mode by masking interrupt lines and suspending science tasks. |
|
453 | /** This function stops the current mode by masking interrupt lines and suspending science tasks. | |
454 | * |
|
454 | * | |
455 | * @return RTEMS directive status codes: |
|
455 | * @return RTEMS directive status codes: | |
456 | * - RTEMS_SUCCESSFUL - task restarted successfully |
|
456 | * - RTEMS_SUCCESSFUL - task restarted successfully | |
457 | * - RTEMS_INVALID_ID - task id invalid |
|
457 | * - RTEMS_INVALID_ID - task id invalid | |
458 | * - RTEMS_ALREADY_SUSPENDED - task already suspended |
|
458 | * - RTEMS_ALREADY_SUSPENDED - task already suspended | |
459 | * |
|
459 | * | |
460 | */ |
|
460 | */ | |
461 |
|
461 | |||
462 | rtems_status_code status; |
|
462 | rtems_status_code status; | |
463 |
|
463 | |||
464 | status = RTEMS_SUCCESSFUL; |
|
464 | status = RTEMS_SUCCESSFUL; | |
465 |
|
465 | |||
466 | // (1) mask interruptions |
|
466 | // (1) mask interruptions | |
467 | LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt |
|
467 | LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt | |
468 | LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt |
|
468 | LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt | |
469 |
|
469 | |||
470 | // (2) clear interruptions |
|
470 | // (2) clear interruptions | |
471 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt |
|
471 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt | |
472 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt |
|
472 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt | |
473 |
|
473 | |||
474 | // (3) reset waveform picker registers |
|
474 | // (3) reset waveform picker registers | |
475 | reset_wfp_burst_enable(); // reset burst and enable bits |
|
475 | reset_wfp_burst_enable(); // reset burst and enable bits | |
476 | reset_wfp_status(); // reset all the status bits |
|
476 | reset_wfp_status(); // reset all the status bits | |
477 |
|
477 | |||
478 | // (4) reset spectral matrices registers |
|
478 | // (4) reset spectral matrices registers | |
479 | set_irq_on_new_ready_matrix( 0 ); // stop the spectral matrices |
|
479 | set_irq_on_new_ready_matrix( 0 ); // stop the spectral matrices | |
480 | set_run_matrix_spectral( 0 ); // run_matrix_spectral is set to 0 |
|
480 | set_run_matrix_spectral( 0 ); // run_matrix_spectral is set to 0 | |
481 | reset_extractSWF(); // reset the extractSWF flag to false |
|
481 | reset_extractSWF(); // reset the extractSWF flag to false | |
482 |
|
482 | |||
483 | // <Spectral Matrices simulator> |
|
483 | // <Spectral Matrices simulator> | |
484 | LEON_Mask_interrupt( IRQ_SM_SIMULATOR ); // mask spectral matrix interrupt simulator |
|
484 | LEON_Mask_interrupt( IRQ_SM_SIMULATOR ); // mask spectral matrix interrupt simulator | |
485 | timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); |
|
485 | timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); | |
486 | LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); // clear spectral matrix interrupt simulator |
|
486 | LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); // clear spectral matrix interrupt simulator | |
487 | // </Spectral Matrices simulator> |
|
487 | // </Spectral Matrices simulator> | |
488 |
|
488 | |||
489 | // suspend several tasks |
|
489 | // suspend several tasks | |
490 | if (lfrCurrentMode != LFR_MODE_STANDBY) { |
|
490 | if (lfrCurrentMode != LFR_MODE_STANDBY) { | |
491 | status = suspend_science_tasks(); |
|
491 | status = suspend_science_tasks(); | |
492 | } |
|
492 | } | |
493 |
|
493 | |||
494 | if (status != RTEMS_SUCCESSFUL) |
|
494 | if (status != RTEMS_SUCCESSFUL) | |
495 | { |
|
495 | { | |
496 | PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status) |
|
496 | PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status) | |
497 | } |
|
497 | } | |
498 |
|
498 | |||
499 | return status; |
|
499 | return status; | |
500 | } |
|
500 | } | |
501 |
|
501 | |||
502 | int enter_mode( unsigned char mode, unsigned int transitionCoarseTime ) |
|
502 | int enter_mode( unsigned char mode, unsigned int transitionCoarseTime ) | |
503 | { |
|
503 | { | |
504 | /** This function is launched after a mode transition validation. |
|
504 | /** This function is launched after a mode transition validation. | |
505 | * |
|
505 | * | |
506 | * @param mode is the mode in which LFR will be put. |
|
506 | * @param mode is the mode in which LFR will be put. | |
507 | * |
|
507 | * | |
508 | * @return RTEMS directive status codes: |
|
508 | * @return RTEMS directive status codes: | |
509 | * - RTEMS_SUCCESSFUL - the mode has been entered successfully |
|
509 | * - RTEMS_SUCCESSFUL - the mode has been entered successfully | |
510 | * - RTEMS_NOT_SATISFIED - the mode has not been entered successfully |
|
510 | * - RTEMS_NOT_SATISFIED - the mode has not been entered successfully | |
511 | * |
|
511 | * | |
512 | */ |
|
512 | */ | |
513 |
|
513 | |||
514 | rtems_status_code status; |
|
514 | rtems_status_code status; | |
515 |
|
515 | |||
516 | //********************** |
|
516 | //********************** | |
517 | // STOP THE CURRENT MODE |
|
517 | // STOP THE CURRENT MODE | |
518 | status = stop_current_mode(); |
|
518 | status = stop_current_mode(); | |
519 | if (status != RTEMS_SUCCESSFUL) |
|
519 | if (status != RTEMS_SUCCESSFUL) | |
520 | { |
|
520 | { | |
521 | PRINTF1("ERR *** in enter_mode *** stop_current_mode with mode = %d\n", mode) |
|
521 | PRINTF1("ERR *** in enter_mode *** stop_current_mode with mode = %d\n", mode) | |
522 | } |
|
522 | } | |
523 |
|
523 | |||
524 | //************************* |
|
524 | //************************* | |
525 | // ENTER THE REQUESTED MODE |
|
525 | // ENTER THE REQUESTED MODE | |
526 | if ( (mode == LFR_MODE_NORMAL) || (mode == LFR_MODE_BURST) |
|
526 | if ( (mode == LFR_MODE_NORMAL) || (mode == LFR_MODE_BURST) | |
527 | || (mode == LFR_MODE_SBM1) || (mode == LFR_MODE_SBM2) ) |
|
527 | || (mode == LFR_MODE_SBM1) || (mode == LFR_MODE_SBM2) ) | |
528 | { |
|
528 | { | |
529 | #ifdef PRINT_TASK_STATISTICS |
|
529 | #ifdef PRINT_TASK_STATISTICS | |
530 | rtems_cpu_usage_reset(); |
|
530 | rtems_cpu_usage_reset(); | |
531 | maxCount = 0; |
|
531 | maxCount = 0; | |
532 | #endif |
|
532 | #endif | |
533 | status = restart_science_tasks(); |
|
533 | status = restart_science_tasks(); | |
534 | launch_waveform_picker( mode, transitionCoarseTime ); |
|
534 | launch_waveform_picker( mode, transitionCoarseTime ); | |
535 |
|
|
535 | launch_spectral_matrix_simu( mode ); | |
536 | } |
|
536 | } | |
537 | else if ( mode == LFR_MODE_STANDBY ) |
|
537 | else if ( mode == LFR_MODE_STANDBY ) | |
538 | { |
|
538 | { | |
539 | #ifdef PRINT_TASK_STATISTICS |
|
539 | #ifdef PRINT_TASK_STATISTICS | |
540 | rtems_cpu_usage_report(); |
|
540 | rtems_cpu_usage_report(); | |
541 | #endif |
|
541 | #endif | |
542 |
|
542 | |||
543 | #ifdef PRINT_STACK_REPORT |
|
543 | #ifdef PRINT_STACK_REPORT | |
544 | rtems_stack_checker_report_usage(); |
|
544 | rtems_stack_checker_report_usage(); | |
545 | #endif |
|
545 | #endif | |
546 | PRINTF1("maxCount = %d\n", maxCount) |
|
546 | PRINTF1("maxCount = %d\n", maxCount) | |
547 | } |
|
547 | } | |
548 | else |
|
548 | else | |
549 | { |
|
549 | { | |
550 | status = RTEMS_UNSATISFIED; |
|
550 | status = RTEMS_UNSATISFIED; | |
551 | } |
|
551 | } | |
552 |
|
552 | |||
553 | if (status != RTEMS_SUCCESSFUL) |
|
553 | if (status != RTEMS_SUCCESSFUL) | |
554 | { |
|
554 | { | |
555 | PRINTF1("ERR *** in enter_mode *** status = %d\n", status) |
|
555 | PRINTF1("ERR *** in enter_mode *** status = %d\n", status) | |
556 | status = RTEMS_UNSATISFIED; |
|
556 | status = RTEMS_UNSATISFIED; | |
557 | } |
|
557 | } | |
558 |
|
558 | |||
559 | return status; |
|
559 | return status; | |
560 | } |
|
560 | } | |
561 |
|
561 | |||
562 | int restart_science_tasks() |
|
562 | int restart_science_tasks() | |
563 | { |
|
563 | { | |
564 | /** This function is used to restart all science tasks. |
|
564 | /** This function is used to restart all science tasks. | |
565 | * |
|
565 | * | |
566 | * @return RTEMS directive status codes: |
|
566 | * @return RTEMS directive status codes: | |
567 | * - RTEMS_SUCCESSFUL - task restarted successfully |
|
567 | * - RTEMS_SUCCESSFUL - task restarted successfully | |
568 | * - RTEMS_INVALID_ID - task id invalid |
|
568 | * - RTEMS_INVALID_ID - task id invalid | |
569 | * - RTEMS_INCORRECT_STATE - task never started |
|
569 | * - RTEMS_INCORRECT_STATE - task never started | |
570 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task |
|
570 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task | |
571 | * |
|
571 | * | |
572 | * Science tasks are AVF0, BPF0, WFRM, CWF3, CW2, CWF1 |
|
572 | * Science tasks are AVF0, BPF0, WFRM, CWF3, CW2, CWF1 | |
573 | * |
|
573 | * | |
574 | */ |
|
574 | */ | |
575 |
|
575 | |||
576 | rtems_status_code status[6]; |
|
576 | rtems_status_code status[6]; | |
577 | rtems_status_code ret; |
|
577 | rtems_status_code ret; | |
578 |
|
578 | |||
579 | ret = RTEMS_SUCCESSFUL; |
|
579 | ret = RTEMS_SUCCESSFUL; | |
580 |
|
580 | |||
581 | status[0] = rtems_task_restart( Task_id[TASKID_AVF0], 1 ); |
|
581 | status[0] = rtems_task_restart( Task_id[TASKID_AVF0], 1 ); | |
582 | if (status[0] != RTEMS_SUCCESSFUL) |
|
582 | if (status[0] != RTEMS_SUCCESSFUL) | |
583 | { |
|
583 | { | |
584 | PRINTF1("in restart_science_task *** 0 ERR %d\n", status[0]) |
|
584 | PRINTF1("in restart_science_task *** 0 ERR %d\n", status[0]) | |
585 | } |
|
585 | } | |
586 |
|
586 | |||
587 | status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 ); |
|
587 | status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 ); | |
588 | if (status[2] != RTEMS_SUCCESSFUL) |
|
588 | if (status[2] != RTEMS_SUCCESSFUL) | |
589 | { |
|
589 | { | |
590 | PRINTF1("in restart_science_task *** 2 ERR %d\n", status[2]) |
|
590 | PRINTF1("in restart_science_task *** 2 ERR %d\n", status[2]) | |
591 | } |
|
591 | } | |
592 |
|
592 | |||
593 | status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 ); |
|
593 | status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 ); | |
594 | if (status[3] != RTEMS_SUCCESSFUL) |
|
594 | if (status[3] != RTEMS_SUCCESSFUL) | |
595 | { |
|
595 | { | |
596 | PRINTF1("in restart_science_task *** 3 ERR %d\n", status[3]) |
|
596 | PRINTF1("in restart_science_task *** 3 ERR %d\n", status[3]) | |
597 | } |
|
597 | } | |
598 |
|
598 | |||
599 | status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 ); |
|
599 | status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 ); | |
600 | if (status[4] != RTEMS_SUCCESSFUL) |
|
600 | if (status[4] != RTEMS_SUCCESSFUL) | |
601 | { |
|
601 | { | |
602 | PRINTF1("in restart_science_task *** 4 ERR %d\n", status[4]) |
|
602 | PRINTF1("in restart_science_task *** 4 ERR %d\n", status[4]) | |
603 | } |
|
603 | } | |
604 |
|
604 | |||
605 | status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 ); |
|
605 | status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 ); | |
606 | if (status[5] != RTEMS_SUCCESSFUL) |
|
606 | if (status[5] != RTEMS_SUCCESSFUL) | |
607 | { |
|
607 | { | |
608 | PRINTF1("in restart_science_task *** 5 ERR %d\n", status[5]) |
|
608 | PRINTF1("in restart_science_task *** 5 ERR %d\n", status[5]) | |
609 | } |
|
609 | } | |
610 |
|
610 | |||
611 | if ( (status[0] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) || |
|
611 | if ( (status[0] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) || | |
612 | (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) ) |
|
612 | (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) ) | |
613 | { |
|
613 | { | |
614 | ret = RTEMS_UNSATISFIED; |
|
614 | ret = RTEMS_UNSATISFIED; | |
615 | } |
|
615 | } | |
616 |
|
616 | |||
617 | return ret; |
|
617 | return ret; | |
618 | } |
|
618 | } | |
619 |
|
619 | |||
620 | int suspend_science_tasks() |
|
620 | int suspend_science_tasks() | |
621 | { |
|
621 | { | |
622 | /** This function suspends the science tasks. |
|
622 | /** This function suspends the science tasks. | |
623 | * |
|
623 | * | |
624 | * @return RTEMS directive status codes: |
|
624 | * @return RTEMS directive status codes: | |
625 | * - RTEMS_SUCCESSFUL - task restarted successfully |
|
625 | * - RTEMS_SUCCESSFUL - task restarted successfully | |
626 | * - RTEMS_INVALID_ID - task id invalid |
|
626 | * - RTEMS_INVALID_ID - task id invalid | |
627 | * - RTEMS_ALREADY_SUSPENDED - task already suspended |
|
627 | * - RTEMS_ALREADY_SUSPENDED - task already suspended | |
628 | * |
|
628 | * | |
629 | */ |
|
629 | */ | |
630 |
|
630 | |||
631 | rtems_status_code status; |
|
631 | rtems_status_code status; | |
632 |
|
632 | |||
633 | status = rtems_task_suspend( Task_id[TASKID_AVF0] ); |
|
633 | status = rtems_task_suspend( Task_id[TASKID_AVF0] ); | |
634 | if (status != RTEMS_SUCCESSFUL) |
|
634 | if (status != RTEMS_SUCCESSFUL) | |
635 | { |
|
635 | { | |
636 | PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status) |
|
636 | PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status) | |
637 | } |
|
637 | } | |
638 |
|
638 | |||
639 | if (status == RTEMS_SUCCESSFUL) // suspend WFRM |
|
639 | if (status == RTEMS_SUCCESSFUL) // suspend WFRM | |
640 | { |
|
640 | { | |
641 | status = rtems_task_suspend( Task_id[TASKID_WFRM] ); |
|
641 | status = rtems_task_suspend( Task_id[TASKID_WFRM] ); | |
642 | if (status != RTEMS_SUCCESSFUL) |
|
642 | if (status != RTEMS_SUCCESSFUL) | |
643 | { |
|
643 | { | |
644 | PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status) |
|
644 | PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status) | |
645 | } |
|
645 | } | |
646 | } |
|
646 | } | |
647 |
|
647 | |||
648 | if (status == RTEMS_SUCCESSFUL) // suspend CWF3 |
|
648 | if (status == RTEMS_SUCCESSFUL) // suspend CWF3 | |
649 | { |
|
649 | { | |
650 | status = rtems_task_suspend( Task_id[TASKID_CWF3] ); |
|
650 | status = rtems_task_suspend( Task_id[TASKID_CWF3] ); | |
651 | if (status != RTEMS_SUCCESSFUL) |
|
651 | if (status != RTEMS_SUCCESSFUL) | |
652 | { |
|
652 | { | |
653 | PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status) |
|
653 | PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status) | |
654 | } |
|
654 | } | |
655 | } |
|
655 | } | |
656 |
|
656 | |||
657 | if (status == RTEMS_SUCCESSFUL) // suspend CWF2 |
|
657 | if (status == RTEMS_SUCCESSFUL) // suspend CWF2 | |
658 | { |
|
658 | { | |
659 | status = rtems_task_suspend( Task_id[TASKID_CWF2] ); |
|
659 | status = rtems_task_suspend( Task_id[TASKID_CWF2] ); | |
660 | if (status != RTEMS_SUCCESSFUL) |
|
660 | if (status != RTEMS_SUCCESSFUL) | |
661 | { |
|
661 | { | |
662 | PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status) |
|
662 | PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status) | |
663 | } |
|
663 | } | |
664 | } |
|
664 | } | |
665 |
|
665 | |||
666 | if (status == RTEMS_SUCCESSFUL) // suspend CWF1 |
|
666 | if (status == RTEMS_SUCCESSFUL) // suspend CWF1 | |
667 | { |
|
667 | { | |
668 | status = rtems_task_suspend( Task_id[TASKID_CWF1] ); |
|
668 | status = rtems_task_suspend( Task_id[TASKID_CWF1] ); | |
669 | if (status != RTEMS_SUCCESSFUL) |
|
669 | if (status != RTEMS_SUCCESSFUL) | |
670 | { |
|
670 | { | |
671 | PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status) |
|
671 | PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status) | |
672 | } |
|
672 | } | |
673 | } |
|
673 | } | |
674 |
|
674 | |||
675 | return status; |
|
675 | return status; | |
676 | } |
|
676 | } | |
677 |
|
677 | |||
678 | void launch_waveform_picker( unsigned char mode, unsigned int transitionCoarseTime ) |
|
678 | void launch_waveform_picker( unsigned char mode, unsigned int transitionCoarseTime ) | |
679 | { |
|
679 | { | |
680 | reset_current_ring_nodes(); |
|
680 | reset_current_ring_nodes(); | |
681 | reset_waveform_picker_regs(); |
|
681 | reset_waveform_picker_regs(); | |
682 | set_wfp_burst_enable_register( mode ); |
|
682 | set_wfp_burst_enable_register( mode ); | |
683 |
|
683 | |||
684 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); |
|
684 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); | |
685 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); |
|
685 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); | |
686 |
|
686 | |||
687 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x80; // [1000 0000] |
|
687 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x80; // [1000 0000] | |
688 | if (transitionCoarseTime == 0) |
|
688 | if (transitionCoarseTime == 0) | |
689 | { |
|
689 | { | |
690 | waveform_picker_regs->start_date = time_management_regs->coarse_time; |
|
690 | waveform_picker_regs->start_date = time_management_regs->coarse_time; | |
691 | } |
|
691 | } | |
692 | else |
|
692 | else | |
693 | { |
|
693 | { | |
694 | waveform_picker_regs->start_date = transitionCoarseTime; |
|
694 | waveform_picker_regs->start_date = transitionCoarseTime; | |
695 | } |
|
695 | } | |
696 | } |
|
696 | } | |
697 |
|
697 | |||
698 | void launch_spectral_matrix( unsigned char mode ) |
|
698 | void launch_spectral_matrix( unsigned char mode ) | |
699 | { |
|
699 | { | |
700 | reset_nb_sm_f0(); |
|
700 | reset_nb_sm_f0(); | |
701 | reset_current_sm_ring_nodes(); |
|
701 | reset_current_sm_ring_nodes(); | |
702 | reset_spectral_matrix_regs(); |
|
702 | reset_spectral_matrix_regs(); | |
703 |
|
703 | |||
704 | #ifdef VHDL_DEV |
|
|||
705 | struct grgpio_regs_str *grgpio_regs = (struct grgpio_regs_str *) REGS_ADDR_GRGPIO; |
|
704 | struct grgpio_regs_str *grgpio_regs = (struct grgpio_regs_str *) REGS_ADDR_GRGPIO; | |
706 | grgpio_regs->io_port_direction_register = |
|
705 | grgpio_regs->io_port_direction_register = | |
707 | grgpio_regs->io_port_direction_register | 0x01; // [0001 1000], 0 = output disabled, 1 = output enabled |
|
706 | grgpio_regs->io_port_direction_register | 0x01; // [0001 1000], 0 = output disabled, 1 = output enabled | |
708 | grgpio_regs->io_port_output_register = grgpio_regs->io_port_output_register | 0x00; // set the bit 0 to 1 |
|
707 | grgpio_regs->io_port_output_register = grgpio_regs->io_port_output_register | 0x00; // set the bit 0 to 1 | |
709 | set_irq_on_new_ready_matrix( 1 ); |
|
708 | set_irq_on_new_ready_matrix( 1 ); | |
710 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); |
|
709 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); | |
711 | LEON_Unmask_interrupt( IRQ_SPECTRAL_MATRIX ); |
|
710 | LEON_Unmask_interrupt( IRQ_SPECTRAL_MATRIX ); | |
712 | set_run_matrix_spectral( 1 ); |
|
711 | set_run_matrix_spectral( 1 ); | |
713 | #else |
|
712 | ||
714 | // Spectral Matrices simulator |
|
|||
715 | timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); |
|
|||
716 | LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); |
|
|||
717 | LEON_Unmask_interrupt( IRQ_SM_SIMULATOR ); |
|
|||
718 | #endif |
|
|||
719 | } |
|
713 | } | |
720 |
|
714 | |||
721 | void set_irq_on_new_ready_matrix( unsigned char value ) |
|
715 | void set_irq_on_new_ready_matrix( unsigned char value ) | |
722 | { |
|
716 | { | |
723 | if (value == 1) |
|
717 | if (value == 1) | |
724 | { |
|
718 | { | |
725 | spectral_matrix_regs->config = spectral_matrix_regs->config | 0x01; |
|
719 | spectral_matrix_regs->config = spectral_matrix_regs->config | 0x01; | |
726 | } |
|
720 | } | |
727 | else |
|
721 | else | |
728 | { |
|
722 | { | |
729 | spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffe; // 1110 |
|
723 | spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffe; // 1110 | |
730 | } |
|
724 | } | |
731 | } |
|
725 | } | |
732 |
|
726 | |||
733 | void set_run_matrix_spectral( unsigned char value ) |
|
727 | void set_run_matrix_spectral( unsigned char value ) | |
734 | { |
|
728 | { | |
735 | if (value == 1) |
|
729 | if (value == 1) | |
736 | { |
|
730 | { | |
737 | spectral_matrix_regs->config = spectral_matrix_regs->config | 0x4; // [0100] set run_matrix spectral to 1 |
|
731 | spectral_matrix_regs->config = spectral_matrix_regs->config | 0x4; // [0100] set run_matrix spectral to 1 | |
738 | } |
|
732 | } | |
739 | else |
|
733 | else | |
740 | { |
|
734 | { | |
741 | spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffb; // [1011] set run_matrix spectral to 0 |
|
735 | spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffb; // [1011] set run_matrix spectral to 0 | |
742 | } |
|
736 | } | |
743 | } |
|
737 | } | |
744 |
|
738 | |||
745 | void launch_spectral_matrix_simu( unsigned char mode ) |
|
739 | void launch_spectral_matrix_simu( unsigned char mode ) | |
746 | { |
|
740 | { | |
747 | reset_nb_sm_f0(); |
|
741 | reset_nb_sm_f0(); | |
748 | reset_current_sm_ring_nodes(); |
|
742 | reset_current_sm_ring_nodes(); | |
749 | reset_spectral_matrix_regs(); |
|
743 | reset_spectral_matrix_regs(); | |
750 |
|
744 | |||
751 | // Spectral Matrices simulator |
|
745 | // Spectral Matrices simulator | |
752 | timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); |
|
746 | timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); | |
753 | LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); |
|
747 | LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); | |
754 | LEON_Unmask_interrupt( IRQ_SM_SIMULATOR ); |
|
748 | LEON_Unmask_interrupt( IRQ_SM_SIMULATOR ); | |
755 | set_local_nb_interrupt_f0_MAX(); |
|
749 | set_local_nb_interrupt_f0_MAX(); | |
756 | } |
|
750 | } | |
757 |
|
751 | |||
758 | //**************** |
|
752 | //**************** | |
759 | // CLOSING ACTIONS |
|
753 | // CLOSING ACTIONS | |
760 | void update_last_TC_exe( ccsdsTelecommandPacket_t *TC, unsigned char * time ) |
|
754 | void update_last_TC_exe( ccsdsTelecommandPacket_t *TC, unsigned char * time ) | |
761 | { |
|
755 | { | |
762 | /** This function is used to update the HK packets statistics after a successful TC execution. |
|
756 | /** This function is used to update the HK packets statistics after a successful TC execution. | |
763 | * |
|
757 | * | |
764 | * @param TC points to the TC being processed |
|
758 | * @param TC points to the TC being processed | |
765 | * @param time is the time used to date the TC execution |
|
759 | * @param time is the time used to date the TC execution | |
766 | * |
|
760 | * | |
767 | */ |
|
761 | */ | |
768 |
|
762 | |||
769 | unsigned int val; |
|
763 | unsigned int val; | |
770 |
|
764 | |||
771 | housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0]; |
|
765 | housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0]; | |
772 | housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1]; |
|
766 | housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1]; | |
773 | housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00; |
|
767 | housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00; | |
774 | housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType; |
|
768 | housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType; | |
775 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00; |
|
769 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00; | |
776 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType; |
|
770 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType; | |
777 | housekeeping_packet.hk_lfr_last_exe_tc_time[0] = time[0]; |
|
771 | housekeeping_packet.hk_lfr_last_exe_tc_time[0] = time[0]; | |
778 | housekeeping_packet.hk_lfr_last_exe_tc_time[1] = time[1]; |
|
772 | housekeeping_packet.hk_lfr_last_exe_tc_time[1] = time[1]; | |
779 | housekeeping_packet.hk_lfr_last_exe_tc_time[2] = time[2]; |
|
773 | housekeeping_packet.hk_lfr_last_exe_tc_time[2] = time[2]; | |
780 | housekeeping_packet.hk_lfr_last_exe_tc_time[3] = time[3]; |
|
774 | housekeeping_packet.hk_lfr_last_exe_tc_time[3] = time[3]; | |
781 | housekeeping_packet.hk_lfr_last_exe_tc_time[4] = time[4]; |
|
775 | housekeeping_packet.hk_lfr_last_exe_tc_time[4] = time[4]; | |
782 | housekeeping_packet.hk_lfr_last_exe_tc_time[5] = time[5]; |
|
776 | housekeeping_packet.hk_lfr_last_exe_tc_time[5] = time[5]; | |
783 |
|
777 | |||
784 | val = housekeeping_packet.hk_lfr_exe_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_exe_tc_cnt[1]; |
|
778 | val = housekeeping_packet.hk_lfr_exe_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_exe_tc_cnt[1]; | |
785 | val++; |
|
779 | val++; | |
786 | housekeeping_packet.hk_lfr_exe_tc_cnt[0] = (unsigned char) (val >> 8); |
|
780 | housekeeping_packet.hk_lfr_exe_tc_cnt[0] = (unsigned char) (val >> 8); | |
787 | housekeeping_packet.hk_lfr_exe_tc_cnt[1] = (unsigned char) (val); |
|
781 | housekeeping_packet.hk_lfr_exe_tc_cnt[1] = (unsigned char) (val); | |
788 | } |
|
782 | } | |
789 |
|
783 | |||
790 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char * time ) |
|
784 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char * time ) | |
791 | { |
|
785 | { | |
792 | /** This function is used to update the HK packets statistics after a TC rejection. |
|
786 | /** This function is used to update the HK packets statistics after a TC rejection. | |
793 | * |
|
787 | * | |
794 | * @param TC points to the TC being processed |
|
788 | * @param TC points to the TC being processed | |
795 | * @param time is the time used to date the TC rejection |
|
789 | * @param time is the time used to date the TC rejection | |
796 | * |
|
790 | * | |
797 | */ |
|
791 | */ | |
798 |
|
792 | |||
799 | unsigned int val; |
|
793 | unsigned int val; | |
800 |
|
794 | |||
801 | housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0]; |
|
795 | housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0]; | |
802 | housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1]; |
|
796 | housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1]; | |
803 | housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00; |
|
797 | housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00; | |
804 | housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType; |
|
798 | housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType; | |
805 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00; |
|
799 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00; | |
806 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType; |
|
800 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType; | |
807 | housekeeping_packet.hk_lfr_last_rej_tc_time[0] = time[0]; |
|
801 | housekeeping_packet.hk_lfr_last_rej_tc_time[0] = time[0]; | |
808 | housekeeping_packet.hk_lfr_last_rej_tc_time[1] = time[1]; |
|
802 | housekeeping_packet.hk_lfr_last_rej_tc_time[1] = time[1]; | |
809 | housekeeping_packet.hk_lfr_last_rej_tc_time[2] = time[2]; |
|
803 | housekeeping_packet.hk_lfr_last_rej_tc_time[2] = time[2]; | |
810 | housekeeping_packet.hk_lfr_last_rej_tc_time[3] = time[3]; |
|
804 | housekeeping_packet.hk_lfr_last_rej_tc_time[3] = time[3]; | |
811 | housekeeping_packet.hk_lfr_last_rej_tc_time[4] = time[4]; |
|
805 | housekeeping_packet.hk_lfr_last_rej_tc_time[4] = time[4]; | |
812 | housekeeping_packet.hk_lfr_last_rej_tc_time[5] = time[5]; |
|
806 | housekeeping_packet.hk_lfr_last_rej_tc_time[5] = time[5]; | |
813 |
|
807 | |||
814 | val = housekeeping_packet.hk_lfr_rej_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_rej_tc_cnt[1]; |
|
808 | val = housekeeping_packet.hk_lfr_rej_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_rej_tc_cnt[1]; | |
815 | val++; |
|
809 | val++; | |
816 | housekeeping_packet.hk_lfr_rej_tc_cnt[0] = (unsigned char) (val >> 8); |
|
810 | housekeeping_packet.hk_lfr_rej_tc_cnt[0] = (unsigned char) (val >> 8); | |
817 | housekeeping_packet.hk_lfr_rej_tc_cnt[1] = (unsigned char) (val); |
|
811 | housekeeping_packet.hk_lfr_rej_tc_cnt[1] = (unsigned char) (val); | |
818 | } |
|
812 | } | |
819 |
|
813 | |||
820 | void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id ) |
|
814 | void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id ) | |
821 | { |
|
815 | { | |
822 | /** This function is the last step of the TC execution workflow. |
|
816 | /** This function is the last step of the TC execution workflow. | |
823 | * |
|
817 | * | |
824 | * @param TC points to the TC being processed |
|
818 | * @param TC points to the TC being processed | |
825 | * @param result is the result of the TC execution (LFR_SUCCESSFUL / LFR_DEFAULT) |
|
819 | * @param result is the result of the TC execution (LFR_SUCCESSFUL / LFR_DEFAULT) | |
826 | * @param queue_id is the id of the RTEMS message queue used to send TM packets |
|
820 | * @param queue_id is the id of the RTEMS message queue used to send TM packets | |
827 | * @param time is the time used to date the TC execution |
|
821 | * @param time is the time used to date the TC execution | |
828 | * |
|
822 | * | |
829 | */ |
|
823 | */ | |
830 |
|
824 | |||
831 | unsigned char requestedMode; |
|
825 | unsigned char requestedMode; | |
832 |
|
826 | |||
833 | if (result == LFR_SUCCESSFUL) |
|
827 | if (result == LFR_SUCCESSFUL) | |
834 | { |
|
828 | { | |
835 | if ( !( (TC->serviceType==TC_TYPE_TIME) & (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) ) |
|
829 | if ( !( (TC->serviceType==TC_TYPE_TIME) & (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) ) | |
836 | & |
|
830 | & | |
837 | !( (TC->serviceType==TC_TYPE_GEN) & (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO)) |
|
831 | !( (TC->serviceType==TC_TYPE_GEN) & (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO)) | |
838 | ) |
|
832 | ) | |
839 | { |
|
833 | { | |
840 | send_tm_lfr_tc_exe_success( TC, queue_id ); |
|
834 | send_tm_lfr_tc_exe_success( TC, queue_id ); | |
841 | } |
|
835 | } | |
842 | if ( (TC->serviceType == TC_TYPE_GEN) & (TC->serviceSubType == TC_SUBTYPE_ENTER) ) |
|
836 | if ( (TC->serviceType == TC_TYPE_GEN) & (TC->serviceSubType == TC_SUBTYPE_ENTER) ) | |
843 | { |
|
837 | { | |
844 | //********************************** |
|
838 | //********************************** | |
845 | // UPDATE THE LFRMODE LOCAL VARIABLE |
|
839 | // UPDATE THE LFRMODE LOCAL VARIABLE | |
846 | requestedMode = TC->dataAndCRC[1]; |
|
840 | requestedMode = TC->dataAndCRC[1]; | |
847 | housekeeping_packet.lfr_status_word[0] = (unsigned char) ((requestedMode << 4) + 0x0d); |
|
841 | housekeeping_packet.lfr_status_word[0] = (unsigned char) ((requestedMode << 4) + 0x0d); | |
848 | updateLFRCurrentMode(); |
|
842 | updateLFRCurrentMode(); | |
849 | } |
|
843 | } | |
850 | } |
|
844 | } | |
851 | else |
|
845 | else | |
852 | { |
|
846 | { | |
853 | send_tm_lfr_tc_exe_error( TC, queue_id ); |
|
847 | send_tm_lfr_tc_exe_error( TC, queue_id ); | |
854 | } |
|
848 | } | |
855 | } |
|
849 | } | |
856 |
|
850 | |||
857 | //*************************** |
|
851 | //*************************** | |
858 | // Interrupt Service Routines |
|
852 | // Interrupt Service Routines | |
859 | rtems_isr commutation_isr1( rtems_vector_number vector ) |
|
853 | rtems_isr commutation_isr1( rtems_vector_number vector ) | |
860 | { |
|
854 | { | |
861 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
855 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { | |
862 | printf("In commutation_isr1 *** Error sending event to DUMB\n"); |
|
856 | printf("In commutation_isr1 *** Error sending event to DUMB\n"); | |
863 | } |
|
857 | } | |
864 | } |
|
858 | } | |
865 |
|
859 | |||
866 | rtems_isr commutation_isr2( rtems_vector_number vector ) |
|
860 | rtems_isr commutation_isr2( rtems_vector_number vector ) | |
867 | { |
|
861 | { | |
868 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
862 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { | |
869 | printf("In commutation_isr2 *** Error sending event to DUMB\n"); |
|
863 | printf("In commutation_isr2 *** Error sending event to DUMB\n"); | |
870 | } |
|
864 | } | |
871 | } |
|
865 | } | |
872 |
|
866 | |||
873 | //**************** |
|
867 | //**************** | |
874 | // OTHER FUNCTIONS |
|
868 | // OTHER FUNCTIONS | |
875 | void updateLFRCurrentMode() |
|
869 | void updateLFRCurrentMode() | |
876 | { |
|
870 | { | |
877 | /** This function updates the value of the global variable lfrCurrentMode. |
|
871 | /** This function updates the value of the global variable lfrCurrentMode. | |
878 | * |
|
872 | * | |
879 | * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running. |
|
873 | * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running. | |
880 | * |
|
874 | * | |
881 | */ |
|
875 | */ | |
882 | // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure |
|
876 | // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure | |
883 | lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
877 | lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
884 | } |
|
878 | } | |
885 |
|
879 |
@@ -1,539 +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 ) { |
|
167 | if ( lfrMode == LFR_MODE_SBM1 ) { | |
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_SBM2 ) { |
|
197 | if ( 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[ |
|
265 | msb = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_SWF_L ]; | |
266 |
lsb = TC->dataAndCRC[ |
|
266 | lsb = TC->dataAndCRC[ DATAFIELD_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, |
|
274 | status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_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[ |
|
307 | msb = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_SWF_P ]; | |
308 |
lsb = TC->dataAndCRC[ |
|
308 | lsb = TC->dataAndCRC[ DATAFIELD_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, |
|
314 | status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_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[ |
|
340 | msb = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_ASM_P ]; | |
341 |
lsb = TC->dataAndCRC[ |
|
341 | lsb = TC->dataAndCRC[ DATAFIELD_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[ |
|
363 | parameter_dump_packet.sy_lfr_n_bp_p0 = TC->dataAndCRC[ DATAFIELD_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[ |
|
381 | parameter_dump_packet.sy_lfr_n_bp_p1 = TC->dataAndCRC[ DATAFIELD_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[ |
|
399 | parameter_dump_packet.sy_lfr_n_cwf_long_f3 = TC->dataAndCRC[ DATAFIELD_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 | //******************* |
|
413 | //******************* | |
414 | // TC_LFR_UPDATE_INFO |
|
414 | // TC_LFR_UPDATE_INFO | |
415 | unsigned int check_update_info_hk_lfr_mode( unsigned char mode ) |
|
415 | unsigned int check_update_info_hk_lfr_mode( unsigned char mode ) | |
416 | { |
|
416 | { | |
417 | unsigned int status; |
|
417 | unsigned int status; | |
418 |
|
418 | |||
419 | if ( (mode == LFR_MODE_STANDBY) || (mode == LFR_MODE_NORMAL) |
|
419 | if ( (mode == LFR_MODE_STANDBY) || (mode == LFR_MODE_NORMAL) | |
420 | || (mode == LFR_MODE_BURST) |
|
420 | || (mode == LFR_MODE_BURST) | |
421 | || (mode == LFR_MODE_SBM1) || (mode == LFR_MODE_SBM2)) |
|
421 | || (mode == LFR_MODE_SBM1) || (mode == LFR_MODE_SBM2)) | |
422 | { |
|
422 | { | |
423 | status = LFR_SUCCESSFUL; |
|
423 | status = LFR_SUCCESSFUL; | |
424 | } |
|
424 | } | |
425 | else |
|
425 | else | |
426 | { |
|
426 | { | |
427 | status = LFR_DEFAULT; |
|
427 | status = LFR_DEFAULT; | |
428 | } |
|
428 | } | |
429 |
|
429 | |||
430 | return status; |
|
430 | return status; | |
431 | } |
|
431 | } | |
432 |
|
432 | |||
433 | unsigned int check_update_info_hk_tds_mode( unsigned char mode ) |
|
433 | unsigned int check_update_info_hk_tds_mode( unsigned char mode ) | |
434 | { |
|
434 | { | |
435 | unsigned int status; |
|
435 | unsigned int status; | |
436 |
|
436 | |||
437 | if ( (mode == TDS_MODE_STANDBY) || (mode == TDS_MODE_NORMAL) |
|
437 | if ( (mode == TDS_MODE_STANDBY) || (mode == TDS_MODE_NORMAL) | |
438 | || (mode == TDS_MODE_BURST) |
|
438 | || (mode == TDS_MODE_BURST) | |
439 | || (mode == TDS_MODE_SBM1) || (mode == TDS_MODE_SBM2) |
|
439 | || (mode == TDS_MODE_SBM1) || (mode == TDS_MODE_SBM2) | |
440 | || (mode == TDS_MODE_LFM)) |
|
440 | || (mode == TDS_MODE_LFM)) | |
441 | { |
|
441 | { | |
442 | status = LFR_SUCCESSFUL; |
|
442 | status = LFR_SUCCESSFUL; | |
443 | } |
|
443 | } | |
444 | else |
|
444 | else | |
445 | { |
|
445 | { | |
446 | status = LFR_DEFAULT; |
|
446 | status = LFR_DEFAULT; | |
447 | } |
|
447 | } | |
448 |
|
448 | |||
449 | return status; |
|
449 | return status; | |
450 | } |
|
450 | } | |
451 |
|
451 | |||
452 | unsigned int check_update_info_hk_thr_mode( unsigned char mode ) |
|
452 | unsigned int check_update_info_hk_thr_mode( unsigned char mode ) | |
453 | { |
|
453 | { | |
454 | unsigned int status; |
|
454 | unsigned int status; | |
455 |
|
455 | |||
456 | if ( (mode == THR_MODE_STANDBY) || (mode == THR_MODE_NORMAL) |
|
456 | if ( (mode == THR_MODE_STANDBY) || (mode == THR_MODE_NORMAL) | |
457 | || (mode == THR_MODE_BURST)) |
|
457 | || (mode == THR_MODE_BURST)) | |
458 | { |
|
458 | { | |
459 | status = LFR_SUCCESSFUL; |
|
459 | status = LFR_SUCCESSFUL; | |
460 | } |
|
460 | } | |
461 | else |
|
461 | else | |
462 | { |
|
462 | { | |
463 | status = LFR_DEFAULT; |
|
463 | status = LFR_DEFAULT; | |
464 | } |
|
464 | } | |
465 |
|
465 | |||
466 | return status; |
|
466 | return status; | |
467 | } |
|
467 | } | |
468 |
|
468 | |||
469 | //********** |
|
469 | //********** | |
470 | // init dump |
|
470 | // init dump | |
471 |
|
471 | |||
472 | void init_parameter_dump( void ) |
|
472 | void init_parameter_dump( void ) | |
473 | { |
|
473 | { | |
474 | /** 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. | |
475 | * |
|
475 | * | |
476 | */ |
|
476 | */ | |
477 |
|
477 | |||
478 | parameter_dump_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
478 | parameter_dump_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; | |
479 | parameter_dump_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
479 | parameter_dump_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
480 | parameter_dump_packet.reserved = CCSDS_RESERVED; |
|
480 | parameter_dump_packet.reserved = CCSDS_RESERVED; | |
481 | parameter_dump_packet.userApplication = CCSDS_USER_APP; |
|
481 | parameter_dump_packet.userApplication = CCSDS_USER_APP; | |
482 | 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); | |
483 | 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; | |
484 | parameter_dump_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
484 | parameter_dump_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
485 | parameter_dump_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
485 | parameter_dump_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
486 | 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); | |
487 | parameter_dump_packet.packetLength[1] = (unsigned char) PACKET_LENGTH_PARAMETER_DUMP; |
|
487 | parameter_dump_packet.packetLength[1] = (unsigned char) PACKET_LENGTH_PARAMETER_DUMP; | |
488 | // DATA FIELD HEADER |
|
488 | // DATA FIELD HEADER | |
489 | parameter_dump_packet.spare1_pusVersion_spare2 = SPARE1_PUSVERSION_SPARE2; |
|
489 | parameter_dump_packet.spare1_pusVersion_spare2 = SPARE1_PUSVERSION_SPARE2; | |
490 | parameter_dump_packet.serviceType = TM_TYPE_PARAMETER_DUMP; |
|
490 | parameter_dump_packet.serviceType = TM_TYPE_PARAMETER_DUMP; | |
491 | parameter_dump_packet.serviceSubType = TM_SUBTYPE_PARAMETER_DUMP; |
|
491 | parameter_dump_packet.serviceSubType = TM_SUBTYPE_PARAMETER_DUMP; | |
492 | parameter_dump_packet.destinationID = TM_DESTINATION_ID_GROUND; |
|
492 | parameter_dump_packet.destinationID = TM_DESTINATION_ID_GROUND; | |
493 | 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); | |
494 | 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); | |
495 | 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); | |
496 | 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); | |
497 | 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); | |
498 | 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); | |
499 | parameter_dump_packet.sid = SID_PARAMETER_DUMP; |
|
499 | parameter_dump_packet.sid = SID_PARAMETER_DUMP; | |
500 |
|
500 | |||
501 | //****************** |
|
501 | //****************** | |
502 | // COMMON PARAMETERS |
|
502 | // COMMON PARAMETERS | |
503 | parameter_dump_packet.unused0 = DEFAULT_SY_LFR_COMMON0; |
|
503 | parameter_dump_packet.unused0 = DEFAULT_SY_LFR_COMMON0; | |
504 | 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; | |
505 |
|
505 | |||
506 | //****************** |
|
506 | //****************** | |
507 | // NORMAL PARAMETERS |
|
507 | // NORMAL PARAMETERS | |
508 | 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); | |
509 | 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 ); | |
510 | 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); | |
511 | 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 ); | |
512 | 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); | |
513 | 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 ); | |
514 | 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; | |
515 | 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; | |
516 | 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; | |
517 |
|
517 | |||
518 | //***************** |
|
518 | //***************** | |
519 | // BURST PARAMETERS |
|
519 | // BURST PARAMETERS | |
520 | 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; | |
521 | 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; | |
522 |
|
522 | |||
523 | //**************** |
|
523 | //**************** | |
524 | // SBM1 PARAMETERS |
|
524 | // SBM1 PARAMETERS | |
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 |
|
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 | |
526 | 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; | |
527 |
|
527 | |||
528 | //**************** |
|
528 | //**************** | |
529 | // SBM2 PARAMETERS |
|
529 | // SBM2 PARAMETERS | |
530 | 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; | |
531 | 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; | |
532 | } |
|
532 | } | |
533 |
|
533 | |||
534 |
|
534 | |||
535 |
|
535 | |||
536 |
|
536 | |||
537 |
|
537 | |||
538 |
|
538 | |||
539 |
|
539 |
@@ -1,1351 +1,1351 | |||||
1 | /** Functions and tasks related to waveform packet generation. |
|
1 | /** Functions and tasks related to waveform packet generation. | |
2 | * |
|
2 | * | |
3 | * @file |
|
3 | * @file | |
4 | * @author P. LEROY |
|
4 | * @author P. LEROY | |
5 | * |
|
5 | * | |
6 | * A group of functions to handle waveforms, in snapshot or continuous format.\n |
|
6 | * A group of functions to handle waveforms, in snapshot or continuous format.\n | |
7 | * |
|
7 | * | |
8 | */ |
|
8 | */ | |
9 |
|
9 | |||
10 | #include "wf_handler.h" |
|
10 | #include "wf_handler.h" | |
11 |
|
11 | |||
12 | //***************** |
|
12 | //***************** | |
13 | // waveform headers |
|
13 | // waveform headers | |
14 | // SWF |
|
14 | // SWF | |
15 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F0[7]; |
|
15 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F0[7]; | |
16 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F1[7]; |
|
16 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F1[7]; | |
17 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F2[7]; |
|
17 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F2[7]; | |
18 | // CWF |
|
18 | // CWF | |
19 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F1[ NB_PACKETS_PER_GROUP_OF_CWF ]; |
|
19 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F1[ NB_PACKETS_PER_GROUP_OF_CWF ]; | |
20 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_BURST[ NB_PACKETS_PER_GROUP_OF_CWF ]; |
|
20 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_BURST[ NB_PACKETS_PER_GROUP_OF_CWF ]; | |
21 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_SBM2[ NB_PACKETS_PER_GROUP_OF_CWF ]; |
|
21 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_SBM2[ NB_PACKETS_PER_GROUP_OF_CWF ]; | |
22 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3[ NB_PACKETS_PER_GROUP_OF_CWF ]; |
|
22 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3[ NB_PACKETS_PER_GROUP_OF_CWF ]; | |
23 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3_light[ NB_PACKETS_PER_GROUP_OF_CWF_LIGHT ]; |
|
23 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3_light[ NB_PACKETS_PER_GROUP_OF_CWF_LIGHT ]; | |
24 |
|
24 | |||
25 | //************** |
|
25 | //************** | |
26 | // waveform ring |
|
26 | // waveform ring | |
27 | ring_node waveform_ring_f0[NB_RING_NODES_F0]; |
|
27 | ring_node waveform_ring_f0[NB_RING_NODES_F0]; | |
28 | ring_node waveform_ring_f1[NB_RING_NODES_F1]; |
|
28 | ring_node waveform_ring_f1[NB_RING_NODES_F1]; | |
29 | ring_node waveform_ring_f2[NB_RING_NODES_F2]; |
|
29 | ring_node waveform_ring_f2[NB_RING_NODES_F2]; | |
30 | ring_node *current_ring_node_f0; |
|
30 | ring_node *current_ring_node_f0; | |
31 | ring_node *ring_node_to_send_swf_f0; |
|
31 | ring_node *ring_node_to_send_swf_f0; | |
32 | ring_node *current_ring_node_f1; |
|
32 | ring_node *current_ring_node_f1; | |
33 | ring_node *ring_node_to_send_swf_f1; |
|
33 | ring_node *ring_node_to_send_swf_f1; | |
34 | ring_node *ring_node_to_send_cwf_f1; |
|
34 | ring_node *ring_node_to_send_cwf_f1; | |
35 | ring_node *current_ring_node_f2; |
|
35 | ring_node *current_ring_node_f2; | |
36 | ring_node *ring_node_to_send_swf_f2; |
|
36 | ring_node *ring_node_to_send_swf_f2; | |
37 | ring_node *ring_node_to_send_cwf_f2; |
|
37 | ring_node *ring_node_to_send_cwf_f2; | |
38 |
|
38 | |||
39 | bool extractSWF = false; |
|
39 | bool extractSWF = false; | |
40 | bool swf_f0_ready = false; |
|
40 | bool swf_f0_ready = false; | |
41 | bool swf_f1_ready = false; |
|
41 | bool swf_f1_ready = false; | |
42 | bool swf_f2_ready = false; |
|
42 | bool swf_f2_ready = false; | |
43 |
|
43 | |||
44 | int wf_snap_extracted[ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET ]; |
|
44 | int wf_snap_extracted[ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET ]; | |
45 |
|
45 | |||
46 | //********************* |
|
46 | //********************* | |
47 | // Interrupt SubRoutine |
|
47 | // Interrupt SubRoutine | |
48 |
|
48 | |||
49 | void reset_extractSWF( void ) |
|
49 | void reset_extractSWF( void ) | |
50 | { |
|
50 | { | |
51 | extractSWF = false; |
|
51 | extractSWF = false; | |
52 | swf_f0_ready = false; |
|
52 | swf_f0_ready = false; | |
53 | swf_f1_ready = false; |
|
53 | swf_f1_ready = false; | |
54 | swf_f2_ready = false; |
|
54 | swf_f2_ready = false; | |
55 | } |
|
55 | } | |
56 |
|
56 | |||
57 | rtems_isr waveforms_isr( rtems_vector_number vector ) |
|
57 | rtems_isr waveforms_isr( rtems_vector_number vector ) | |
58 | { |
|
58 | { | |
59 | /** This is the interrupt sub routine called by the waveform picker core. |
|
59 | /** This is the interrupt sub routine called by the waveform picker core. | |
60 | * |
|
60 | * | |
61 | * This ISR launch different actions depending mainly on two pieces of information: |
|
61 | * This ISR launch different actions depending mainly on two pieces of information: | |
62 | * 1. the values read in the registers of the waveform picker. |
|
62 | * 1. the values read in the registers of the waveform picker. | |
63 | * 2. the current LFR mode. |
|
63 | * 2. the current LFR mode. | |
64 | * |
|
64 | * | |
65 | */ |
|
65 | */ | |
66 |
|
66 | |||
67 | rtems_status_code status; |
|
67 | rtems_status_code status; | |
68 | static unsigned char nb_swf = 0; |
|
68 | static unsigned char nb_swf = 0; | |
69 |
|
69 | |||
70 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) |
|
70 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) | |
71 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
71 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) | |
72 | { // in modes other than STANDBY and BURST, send the CWF_F3 data |
|
72 | { // in modes other than STANDBY and BURST, send the CWF_F3 data | |
73 | if ((waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full |
|
73 | if ((waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full | |
74 | // (1) change the receiving buffer for the waveform picker |
|
74 | // (1) change the receiving buffer for the waveform picker | |
75 | if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3_a) { |
|
75 | if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3_a) { | |
76 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_b); |
|
76 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_b); | |
77 | } |
|
77 | } | |
78 | else { |
|
78 | else { | |
79 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a); |
|
79 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a); | |
80 | } |
|
80 | } | |
81 | // (2) send an event for the waveforms transmission |
|
81 | // (2) send an event for the waveforms transmission | |
82 | if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
82 | if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { | |
83 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
83 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
84 | } |
|
84 | } | |
85 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff777; // reset f3 bits to 0, [1111 0111 0111 0111] |
|
85 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff777; // reset f3 bits to 0, [1111 0111 0111 0111] | |
86 | } |
|
86 | } | |
87 | } |
|
87 | } | |
88 |
|
88 | |||
89 | switch(lfrCurrentMode) |
|
89 | switch(lfrCurrentMode) | |
90 | { |
|
90 | { | |
91 | //******** |
|
91 | //******** | |
92 | // STANDBY |
|
92 | // STANDBY | |
93 | case(LFR_MODE_STANDBY): |
|
93 | case(LFR_MODE_STANDBY): | |
94 | break; |
|
94 | break; | |
95 |
|
95 | |||
96 | //****** |
|
96 | //****** | |
97 | // NORMAL |
|
97 | // NORMAL | |
98 | case(LFR_MODE_NORMAL): |
|
98 | case(LFR_MODE_NORMAL): | |
99 | if ( (waveform_picker_regs->status & 0xff8) != 0x00) // [1000] check the error bits |
|
99 | if ( (waveform_picker_regs->status & 0xff8) != 0x00) // [1000] check the error bits | |
100 | { |
|
100 | { | |
101 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
101 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
102 | } |
|
102 | } | |
103 | if ( (waveform_picker_regs->status & 0x07) == 0x07) // [0111] check the f2, f1, f0 full bits |
|
103 | if ( (waveform_picker_regs->status & 0x07) == 0x07) // [0111] check the f2, f1, f0 full bits | |
104 | { |
|
104 | { | |
105 | // change F0 ring node |
|
105 | // change F0 ring node | |
106 | ring_node_to_send_swf_f0 = current_ring_node_f0; |
|
106 | ring_node_to_send_swf_f0 = current_ring_node_f0; | |
107 | current_ring_node_f0 = current_ring_node_f0->next; |
|
107 | current_ring_node_f0 = current_ring_node_f0->next; | |
108 | waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address; |
|
108 | waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address; | |
109 | // change F1 ring node |
|
109 | // change F1 ring node | |
110 | ring_node_to_send_swf_f1 = current_ring_node_f1; |
|
110 | ring_node_to_send_swf_f1 = current_ring_node_f1; | |
111 | current_ring_node_f1 = current_ring_node_f1->next; |
|
111 | current_ring_node_f1 = current_ring_node_f1->next; | |
112 | waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; |
|
112 | waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; | |
113 | // change F2 ring node |
|
113 | // change F2 ring node | |
114 | ring_node_to_send_swf_f2 = current_ring_node_f2; |
|
114 | ring_node_to_send_swf_f2 = current_ring_node_f2; | |
115 | current_ring_node_f2 = current_ring_node_f2->next; |
|
115 | current_ring_node_f2 = current_ring_node_f2->next; | |
116 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; |
|
116 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; | |
117 | // |
|
117 | // | |
118 | // if (nb_swf < 2) |
|
118 | // if (nb_swf < 2) | |
119 | if (true) |
|
119 | if (true) | |
120 | { |
|
120 | { | |
121 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) { |
|
121 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) { | |
122 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
122 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
123 | } |
|
123 | } | |
124 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff888; // [1000 1000 1000] |
|
124 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff888; // [1000 1000 1000] | |
125 | nb_swf = nb_swf + 1; |
|
125 | nb_swf = nb_swf + 1; | |
126 | } |
|
126 | } | |
127 | else |
|
127 | else | |
128 | { |
|
128 | { | |
129 | reset_wfp_burst_enable(); |
|
129 | reset_wfp_burst_enable(); | |
130 | nb_swf = 0; |
|
130 | nb_swf = 0; | |
131 | } |
|
131 | } | |
132 |
|
132 | |||
133 | } |
|
133 | } | |
134 |
|
134 | |||
135 | break; |
|
135 | break; | |
136 |
|
136 | |||
137 | //****** |
|
137 | //****** | |
138 | // BURST |
|
138 | // BURST | |
139 | case(LFR_MODE_BURST): |
|
139 | case(LFR_MODE_BURST): | |
140 | if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit |
|
140 | if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit | |
141 | // (1) change the receiving buffer for the waveform picker |
|
141 | // (1) change the receiving buffer for the waveform picker | |
142 | ring_node_to_send_cwf_f2 = current_ring_node_f2; |
|
142 | ring_node_to_send_cwf_f2 = current_ring_node_f2; | |
143 | current_ring_node_f2 = current_ring_node_f2->next; |
|
143 | current_ring_node_f2 = current_ring_node_f2->next; | |
144 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; |
|
144 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; | |
145 | // (2) send an event for the waveforms transmission |
|
145 | // (2) send an event for the waveforms transmission | |
146 | if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) { |
|
146 | if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) { | |
147 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
147 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
148 | } |
|
148 | } | |
149 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0 |
|
149 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0 | |
150 | } |
|
150 | } | |
151 | break; |
|
151 | break; | |
152 |
|
152 | |||
153 | //***** |
|
153 | //***** | |
154 | // SBM1 |
|
154 | // SBM1 | |
155 | case(LFR_MODE_SBM1): |
|
155 | case(LFR_MODE_SBM1): | |
156 | if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit |
|
156 | if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit | |
157 | // (1) change the receiving buffer for the waveform picker |
|
157 | // (1) change the receiving buffer for the waveform picker | |
158 | ring_node_to_send_cwf_f1 = current_ring_node_f1; |
|
158 | ring_node_to_send_cwf_f1 = current_ring_node_f1; | |
159 | current_ring_node_f1 = current_ring_node_f1->next; |
|
159 | current_ring_node_f1 = current_ring_node_f1->next; | |
160 | waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; |
|
160 | waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; | |
161 | // (2) send an event for the the CWF1 task for transmission (and snapshot extraction if needed) |
|
161 | // (2) send an event for the the CWF1 task for transmission (and snapshot extraction if needed) | |
162 | status = rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 ); |
|
162 | status = rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 ); | |
163 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bits = 0 |
|
163 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bits = 0 | |
164 | } |
|
164 | } | |
165 | if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit |
|
165 | if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit | |
166 | swf_f0_ready = true; |
|
166 | swf_f0_ready = true; | |
167 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffeee; // [1111 1110 1110 1110] f0 bits = 0 |
|
167 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffeee; // [1111 1110 1110 1110] f0 bits = 0 | |
168 | } |
|
168 | } | |
169 | if ( (waveform_picker_regs->status & 0x04) == 0x04 ) { // [0100] check the f2 full bit |
|
169 | if ( (waveform_picker_regs->status & 0x04) == 0x04 ) { // [0100] check the f2 full bit | |
170 | swf_f2_ready = true; |
|
170 | swf_f2_ready = true; | |
171 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bits = 0 |
|
171 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bits = 0 | |
172 | } |
|
172 | } | |
173 | break; |
|
173 | break; | |
174 |
|
174 | |||
175 | //***** |
|
175 | //***** | |
176 | // SBM2 |
|
176 | // SBM2 | |
177 | case(LFR_MODE_SBM2): |
|
177 | case(LFR_MODE_SBM2): | |
178 | if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit |
|
178 | if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit | |
179 | // (1) change the receiving buffer for the waveform picker |
|
179 | // (1) change the receiving buffer for the waveform picker | |
180 | ring_node_to_send_cwf_f2 = current_ring_node_f2; |
|
180 | ring_node_to_send_cwf_f2 = current_ring_node_f2; | |
181 | current_ring_node_f2 = current_ring_node_f2->next; |
|
181 | current_ring_node_f2 = current_ring_node_f2->next; | |
182 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; |
|
182 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; | |
183 | // (2) send an event for the waveforms transmission |
|
183 | // (2) send an event for the waveforms transmission | |
184 | status = rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 ); |
|
184 | status = rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 ); | |
185 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0 |
|
185 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0 | |
186 | } |
|
186 | } | |
187 | if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit |
|
187 | if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit | |
188 | swf_f0_ready = true; |
|
188 | swf_f0_ready = true; | |
189 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffeee; // [1111 1110 1110 1110] f0 bits = 0 |
|
189 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffeee; // [1111 1110 1110 1110] f0 bits = 0 | |
190 | } |
|
190 | } | |
191 | if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit |
|
191 | if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit | |
192 | swf_f1_ready = true; |
|
192 | swf_f1_ready = true; | |
193 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1, f0 bits = 0 |
|
193 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1, f0 bits = 0 | |
194 | } |
|
194 | } | |
195 | break; |
|
195 | break; | |
196 |
|
196 | |||
197 | //******** |
|
197 | //******** | |
198 | // DEFAULT |
|
198 | // DEFAULT | |
199 | default: |
|
199 | default: | |
200 | break; |
|
200 | break; | |
201 | } |
|
201 | } | |
202 | } |
|
202 | } | |
203 |
|
203 | |||
204 | //************ |
|
204 | //************ | |
205 | // RTEMS TASKS |
|
205 | // RTEMS TASKS | |
206 |
|
206 | |||
207 | rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP |
|
207 | rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP | |
208 | { |
|
208 | { | |
209 | /** This RTEMS task is dedicated to the transmission of snapshots of the NORMAL mode. |
|
209 | /** This RTEMS task is dedicated to the transmission of snapshots of the NORMAL mode. | |
210 | * |
|
210 | * | |
211 | * @param unused is the starting argument of the RTEMS task |
|
211 | * @param unused is the starting argument of the RTEMS task | |
212 | * |
|
212 | * | |
213 | * The following data packets are sent by this task: |
|
213 | * The following data packets are sent by this task: | |
214 | * - TM_LFR_SCIENCE_NORMAL_SWF_F0 |
|
214 | * - TM_LFR_SCIENCE_NORMAL_SWF_F0 | |
215 | * - TM_LFR_SCIENCE_NORMAL_SWF_F1 |
|
215 | * - TM_LFR_SCIENCE_NORMAL_SWF_F1 | |
216 | * - TM_LFR_SCIENCE_NORMAL_SWF_F2 |
|
216 | * - TM_LFR_SCIENCE_NORMAL_SWF_F2 | |
217 | * |
|
217 | * | |
218 | */ |
|
218 | */ | |
219 |
|
219 | |||
220 | rtems_event_set event_out; |
|
220 | rtems_event_set event_out; | |
221 | rtems_id queue_id; |
|
221 | rtems_id queue_id; | |
222 | rtems_status_code status; |
|
222 | rtems_status_code status; | |
223 |
|
223 | |||
224 | init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 ); |
|
224 | init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 ); | |
225 | init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 ); |
|
225 | init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 ); | |
226 | init_header_snapshot_wf_table( SID_NORM_SWF_F2, headerSWF_F2 ); |
|
226 | init_header_snapshot_wf_table( SID_NORM_SWF_F2, headerSWF_F2 ); | |
227 |
|
227 | |||
228 | init_waveforms(); |
|
228 | init_waveforms(); | |
229 |
|
229 | |||
230 | status = get_message_queue_id_send( &queue_id ); |
|
230 | status = get_message_queue_id_send( &queue_id ); | |
231 | if (status != RTEMS_SUCCESSFUL) |
|
231 | if (status != RTEMS_SUCCESSFUL) | |
232 | { |
|
232 | { | |
233 | PRINTF1("in WFRM *** ERR get_message_queue_id_send %d\n", status) |
|
233 | PRINTF1("in WFRM *** ERR get_message_queue_id_send %d\n", status) | |
234 | } |
|
234 | } | |
235 |
|
235 | |||
236 | BOOT_PRINTF("in WFRM ***\n") |
|
236 | BOOT_PRINTF("in WFRM ***\n") | |
237 |
|
237 | |||
238 | while(1){ |
|
238 | while(1){ | |
239 | // wait for an RTEMS_EVENT |
|
239 | // wait for an RTEMS_EVENT | |
240 | rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1 |
|
240 | rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1 | |
241 | | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM, |
|
241 | | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM, | |
242 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
242 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
243 | if (event_out == RTEMS_EVENT_MODE_NORMAL) |
|
243 | if (event_out == RTEMS_EVENT_MODE_NORMAL) | |
244 | { |
|
244 | { | |
245 | DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_NORMAL\n") |
|
245 | DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_NORMAL\n") | |
246 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id); |
|
246 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id); | |
247 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id); |
|
247 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id); | |
248 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id); |
|
248 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id); | |
249 | } |
|
249 | } | |
250 | if (event_out == RTEMS_EVENT_MODE_SBM1) |
|
250 | if (event_out == RTEMS_EVENT_MODE_SBM1) | |
251 | { |
|
251 | { | |
252 | DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM1\n") |
|
252 | DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM1\n") | |
253 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id); |
|
253 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id); | |
254 | send_waveform_SWF((volatile int*) wf_snap_extracted , SID_NORM_SWF_F1, headerSWF_F1, queue_id); |
|
254 | send_waveform_SWF((volatile int*) wf_snap_extracted , SID_NORM_SWF_F1, headerSWF_F1, queue_id); | |
255 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id); |
|
255 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id); | |
256 | } |
|
256 | } | |
257 | if (event_out == RTEMS_EVENT_MODE_SBM2) |
|
257 | if (event_out == RTEMS_EVENT_MODE_SBM2) | |
258 | { |
|
258 | { | |
259 | DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM2\n") |
|
259 | DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM2\n") | |
260 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id); |
|
260 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id); | |
261 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id); |
|
261 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id); | |
262 | send_waveform_SWF((volatile int*) wf_snap_extracted , SID_NORM_SWF_F2, headerSWF_F2, queue_id); |
|
262 | send_waveform_SWF((volatile int*) wf_snap_extracted , SID_NORM_SWF_F2, headerSWF_F2, queue_id); | |
263 | } |
|
263 | } | |
264 | } |
|
264 | } | |
265 | } |
|
265 | } | |
266 |
|
266 | |||
267 | rtems_task cwf3_task(rtems_task_argument argument) //used with the waveform picker VHDL IP |
|
267 | rtems_task cwf3_task(rtems_task_argument argument) //used with the waveform picker VHDL IP | |
268 | { |
|
268 | { | |
269 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f3. |
|
269 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f3. | |
270 | * |
|
270 | * | |
271 | * @param unused is the starting argument of the RTEMS task |
|
271 | * @param unused is the starting argument of the RTEMS task | |
272 | * |
|
272 | * | |
273 | * The following data packet is sent by this task: |
|
273 | * The following data packet is sent by this task: | |
274 | * - TM_LFR_SCIENCE_NORMAL_CWF_F3 |
|
274 | * - TM_LFR_SCIENCE_NORMAL_CWF_F3 | |
275 | * |
|
275 | * | |
276 | */ |
|
276 | */ | |
277 |
|
277 | |||
278 | rtems_event_set event_out; |
|
278 | rtems_event_set event_out; | |
279 | rtems_id queue_id; |
|
279 | rtems_id queue_id; | |
280 | rtems_status_code status; |
|
280 | rtems_status_code status; | |
281 |
|
281 | |||
282 | init_header_continuous_wf_table( SID_NORM_CWF_LONG_F3, headerCWF_F3 ); |
|
282 | init_header_continuous_wf_table( SID_NORM_CWF_LONG_F3, headerCWF_F3 ); | |
283 | init_header_continuous_cwf3_light_table( headerCWF_F3_light ); |
|
283 | init_header_continuous_cwf3_light_table( headerCWF_F3_light ); | |
284 |
|
284 | |||
285 | status = get_message_queue_id_send( &queue_id ); |
|
285 | status = get_message_queue_id_send( &queue_id ); | |
286 | if (status != RTEMS_SUCCESSFUL) |
|
286 | if (status != RTEMS_SUCCESSFUL) | |
287 | { |
|
287 | { | |
288 | PRINTF1("in CWF3 *** ERR get_message_queue_id_send %d\n", status) |
|
288 | PRINTF1("in CWF3 *** ERR get_message_queue_id_send %d\n", status) | |
289 | } |
|
289 | } | |
290 |
|
290 | |||
291 | BOOT_PRINTF("in CWF3 ***\n") |
|
291 | BOOT_PRINTF("in CWF3 ***\n") | |
292 |
|
292 | |||
293 | while(1){ |
|
293 | while(1){ | |
294 | // wait for an RTEMS_EVENT |
|
294 | // wait for an RTEMS_EVENT | |
295 | rtems_event_receive( RTEMS_EVENT_0, |
|
295 | rtems_event_receive( RTEMS_EVENT_0, | |
296 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
296 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
297 | if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01) |
|
297 | if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01) | |
298 | { |
|
298 | { | |
299 | PRINTF("send CWF_LONG_F3\n") |
|
299 | PRINTF("send CWF_LONG_F3\n") | |
300 | } |
|
300 | } | |
301 | else |
|
301 | else | |
302 | { |
|
302 | { | |
303 | PRINTF("send CWF_F3 (light)\n") |
|
303 | PRINTF("send CWF_F3 (light)\n") | |
304 | } |
|
304 | } | |
305 | if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3_a) { |
|
305 | if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3_a) { | |
306 | if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01) |
|
306 | if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01) | |
307 | { |
|
307 | { | |
308 | send_waveform_CWF( wf_cont_f3_b, SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id ); |
|
308 | send_waveform_CWF( wf_cont_f3_b, SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id ); | |
309 | } |
|
309 | } | |
310 | else |
|
310 | else | |
311 | { |
|
311 | { | |
312 | send_waveform_CWF3_light( wf_cont_f3_b, headerCWF_F3_light, queue_id ); |
|
312 | send_waveform_CWF3_light( wf_cont_f3_b, headerCWF_F3_light, queue_id ); | |
313 | } |
|
313 | } | |
314 | } |
|
314 | } | |
315 | else |
|
315 | else | |
316 | { |
|
316 | { | |
317 | if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01) |
|
317 | if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01) | |
318 | { |
|
318 | { | |
319 | send_waveform_CWF( wf_cont_f3_a, SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id ); |
|
319 | send_waveform_CWF( wf_cont_f3_a, SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id ); | |
320 | } |
|
320 | } | |
321 | else |
|
321 | else | |
322 | { |
|
322 | { | |
323 | send_waveform_CWF3_light( wf_cont_f3_a, headerCWF_F3_light, queue_id ); |
|
323 | send_waveform_CWF3_light( wf_cont_f3_a, headerCWF_F3_light, queue_id ); | |
324 | } |
|
324 | } | |
325 |
|
325 | |||
326 | } |
|
326 | } | |
327 | } |
|
327 | } | |
328 | } |
|
328 | } | |
329 |
|
329 | |||
330 | rtems_task cwf2_task(rtems_task_argument argument) // ONLY USED IN BURST AND SBM2 |
|
330 | rtems_task cwf2_task(rtems_task_argument argument) // ONLY USED IN BURST AND SBM2 | |
331 | { |
|
331 | { | |
332 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f2. |
|
332 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f2. | |
333 | * |
|
333 | * | |
334 | * @param unused is the starting argument of the RTEMS task |
|
334 | * @param unused is the starting argument of the RTEMS task | |
335 | * |
|
335 | * | |
336 | * The following data packet is sent by this function: |
|
336 | * The following data packet is sent by this function: | |
337 | * - TM_LFR_SCIENCE_BURST_CWF_F2 |
|
337 | * - TM_LFR_SCIENCE_BURST_CWF_F2 | |
338 | * - TM_LFR_SCIENCE_SBM2_CWF_F2 |
|
338 | * - TM_LFR_SCIENCE_SBM2_CWF_F2 | |
339 | * |
|
339 | * | |
340 | */ |
|
340 | */ | |
341 |
|
341 | |||
342 | rtems_event_set event_out; |
|
342 | rtems_event_set event_out; | |
343 | rtems_id queue_id; |
|
343 | rtems_id queue_id; | |
344 | rtems_status_code status; |
|
344 | rtems_status_code status; | |
345 |
|
345 | |||
346 | init_header_continuous_wf_table( SID_BURST_CWF_F2, headerCWF_F2_BURST ); |
|
346 | init_header_continuous_wf_table( SID_BURST_CWF_F2, headerCWF_F2_BURST ); | |
347 | init_header_continuous_wf_table( SID_SBM2_CWF_F2, headerCWF_F2_SBM2 ); |
|
347 | init_header_continuous_wf_table( SID_SBM2_CWF_F2, headerCWF_F2_SBM2 ); | |
348 |
|
348 | |||
349 | status = get_message_queue_id_send( &queue_id ); |
|
349 | status = get_message_queue_id_send( &queue_id ); | |
350 | if (status != RTEMS_SUCCESSFUL) |
|
350 | if (status != RTEMS_SUCCESSFUL) | |
351 | { |
|
351 | { | |
352 | PRINTF1("in CWF2 *** ERR get_message_queue_id_send %d\n", status) |
|
352 | PRINTF1("in CWF2 *** ERR get_message_queue_id_send %d\n", status) | |
353 | } |
|
353 | } | |
354 |
|
354 | |||
355 | BOOT_PRINTF("in CWF2 ***\n") |
|
355 | BOOT_PRINTF("in CWF2 ***\n") | |
356 |
|
356 | |||
357 | while(1){ |
|
357 | while(1){ | |
358 | // wait for an RTEMS_EVENT |
|
358 | // wait for an RTEMS_EVENT | |
359 | rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2, |
|
359 | rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2, | |
360 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
360 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
361 | if (event_out == RTEMS_EVENT_MODE_BURST) |
|
361 | if (event_out == RTEMS_EVENT_MODE_BURST) | |
362 | { |
|
362 | { | |
363 | send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id ); |
|
363 | send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id ); | |
364 | } |
|
364 | } | |
365 | if (event_out == RTEMS_EVENT_MODE_SBM2) |
|
365 | if (event_out == RTEMS_EVENT_MODE_SBM2) | |
366 | { |
|
366 | { | |
367 | send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id ); |
|
367 | send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id ); | |
368 | // launch snapshot extraction if needed |
|
368 | // launch snapshot extraction if needed | |
369 | if (extractSWF == true) |
|
369 | if (extractSWF == true) | |
370 | { |
|
370 | { | |
371 | ring_node_to_send_swf_f2 = ring_node_to_send_cwf_f2; |
|
371 | ring_node_to_send_swf_f2 = ring_node_to_send_cwf_f2; | |
372 | // extract the snapshot |
|
372 | // extract the snapshot | |
373 | build_snapshot_from_ring( ring_node_to_send_swf_f2, 2 ); |
|
373 | build_snapshot_from_ring( ring_node_to_send_swf_f2, 2 ); | |
374 | // send the snapshot when built |
|
374 | // send the snapshot when built | |
375 | status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 ); |
|
375 | status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 ); | |
376 | extractSWF = false; |
|
376 | extractSWF = false; | |
377 | } |
|
377 | } | |
378 | if (swf_f0_ready && swf_f1_ready) |
|
378 | if (swf_f0_ready && swf_f1_ready) | |
379 | { |
|
379 | { | |
380 | extractSWF = true; |
|
380 | extractSWF = true; | |
381 | swf_f0_ready = false; |
|
381 | swf_f0_ready = false; | |
382 | swf_f1_ready = false; |
|
382 | swf_f1_ready = false; | |
383 | } |
|
383 | } | |
384 | } |
|
384 | } | |
385 | } |
|
385 | } | |
386 | } |
|
386 | } | |
387 |
|
387 | |||
388 | rtems_task cwf1_task(rtems_task_argument argument) // ONLY USED IN SBM1 |
|
388 | rtems_task cwf1_task(rtems_task_argument argument) // ONLY USED IN SBM1 | |
389 | { |
|
389 | { | |
390 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f1. |
|
390 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f1. | |
391 | * |
|
391 | * | |
392 | * @param unused is the starting argument of the RTEMS task |
|
392 | * @param unused is the starting argument of the RTEMS task | |
393 | * |
|
393 | * | |
394 | * The following data packet is sent by this function: |
|
394 | * The following data packet is sent by this function: | |
395 | * - TM_LFR_SCIENCE_SBM1_CWF_F1 |
|
395 | * - TM_LFR_SCIENCE_SBM1_CWF_F1 | |
396 | * |
|
396 | * | |
397 | */ |
|
397 | */ | |
398 |
|
398 | |||
399 | rtems_event_set event_out; |
|
399 | rtems_event_set event_out; | |
400 | rtems_id queue_id; |
|
400 | rtems_id queue_id; | |
401 | rtems_status_code status; |
|
401 | rtems_status_code status; | |
402 |
|
402 | |||
403 | init_header_continuous_wf_table( SID_SBM1_CWF_F1, headerCWF_F1 ); |
|
403 | init_header_continuous_wf_table( SID_SBM1_CWF_F1, headerCWF_F1 ); | |
404 |
|
404 | |||
405 | status = get_message_queue_id_send( &queue_id ); |
|
405 | status = get_message_queue_id_send( &queue_id ); | |
406 | if (status != RTEMS_SUCCESSFUL) |
|
406 | if (status != RTEMS_SUCCESSFUL) | |
407 | { |
|
407 | { | |
408 | PRINTF1("in CWF1 *** ERR get_message_queue_id_send %d\n", status) |
|
408 | PRINTF1("in CWF1 *** ERR get_message_queue_id_send %d\n", status) | |
409 | } |
|
409 | } | |
410 |
|
410 | |||
411 | BOOT_PRINTF("in CWF1 ***\n") |
|
411 | BOOT_PRINTF("in CWF1 ***\n") | |
412 |
|
412 | |||
413 | while(1){ |
|
413 | while(1){ | |
414 | // wait for an RTEMS_EVENT |
|
414 | // wait for an RTEMS_EVENT | |
415 | rtems_event_receive( RTEMS_EVENT_MODE_SBM1, |
|
415 | rtems_event_receive( RTEMS_EVENT_MODE_SBM1, | |
416 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
416 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
417 | send_waveform_CWF( (volatile int*) ring_node_to_send_cwf_f1->buffer_address, SID_SBM1_CWF_F1, headerCWF_F1, queue_id ); |
|
417 | send_waveform_CWF( (volatile int*) ring_node_to_send_cwf_f1->buffer_address, SID_SBM1_CWF_F1, headerCWF_F1, queue_id ); | |
418 | // launch snapshot extraction if needed |
|
418 | // launch snapshot extraction if needed | |
419 | if (extractSWF == true) |
|
419 | if (extractSWF == true) | |
420 | { |
|
420 | { | |
421 | ring_node_to_send_swf_f1 = ring_node_to_send_cwf_f1; |
|
421 | ring_node_to_send_swf_f1 = ring_node_to_send_cwf_f1; | |
422 | // launch the snapshot extraction |
|
422 | // launch the snapshot extraction | |
423 | status = rtems_event_send( Task_id[TASKID_SWBD], RTEMS_EVENT_MODE_SBM1 ); |
|
423 | status = rtems_event_send( Task_id[TASKID_SWBD], RTEMS_EVENT_MODE_SBM1 ); | |
424 | extractSWF = false; |
|
424 | extractSWF = false; | |
425 | } |
|
425 | } | |
426 | if (swf_f0_ready == true) |
|
426 | if (swf_f0_ready == true) | |
427 | { |
|
427 | { | |
428 | extractSWF = true; |
|
428 | extractSWF = true; | |
429 | swf_f0_ready = false; // this step shall be executed only one time |
|
429 | swf_f0_ready = false; // this step shall be executed only one time | |
430 | } |
|
430 | } | |
431 | if ((swf_f1_ready == true) && (swf_f2_ready == true)) // swf_f1 is ready after the extraction |
|
431 | if ((swf_f1_ready == true) && (swf_f2_ready == true)) // swf_f1 is ready after the extraction | |
432 | { |
|
432 | { | |
433 | status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM1 ); |
|
433 | status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM1 ); | |
434 | swf_f1_ready = false; |
|
434 | swf_f1_ready = false; | |
435 | swf_f2_ready = false; |
|
435 | swf_f2_ready = false; | |
436 | } |
|
436 | } | |
437 | } |
|
437 | } | |
438 | } |
|
438 | } | |
439 |
|
439 | |||
440 | rtems_task swbd_task(rtems_task_argument argument) |
|
440 | rtems_task swbd_task(rtems_task_argument argument) | |
441 | { |
|
441 | { | |
442 | /** This RTEMS task is dedicated to the building of snapshots from different continuous waveforms buffers. |
|
442 | /** This RTEMS task is dedicated to the building of snapshots from different continuous waveforms buffers. | |
443 | * |
|
443 | * | |
444 | * @param unused is the starting argument of the RTEMS task |
|
444 | * @param unused is the starting argument of the RTEMS task | |
445 | * |
|
445 | * | |
446 | */ |
|
446 | */ | |
447 |
|
447 | |||
448 | rtems_event_set event_out; |
|
448 | rtems_event_set event_out; | |
449 |
|
449 | |||
450 | BOOT_PRINTF("in SWBD ***\n") |
|
450 | BOOT_PRINTF("in SWBD ***\n") | |
451 |
|
451 | |||
452 | while(1){ |
|
452 | while(1){ | |
453 | // wait for an RTEMS_EVENT |
|
453 | // wait for an RTEMS_EVENT | |
454 | rtems_event_receive( RTEMS_EVENT_MODE_SBM1 | RTEMS_EVENT_MODE_SBM2, |
|
454 | rtems_event_receive( RTEMS_EVENT_MODE_SBM1 | RTEMS_EVENT_MODE_SBM2, | |
455 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
455 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
456 | if (event_out == RTEMS_EVENT_MODE_SBM1) |
|
456 | if (event_out == RTEMS_EVENT_MODE_SBM1) | |
457 | { |
|
457 | { | |
458 | build_snapshot_from_ring( ring_node_to_send_swf_f1, 1 ); |
|
458 | build_snapshot_from_ring( ring_node_to_send_swf_f1, 1 ); | |
459 | swf_f1_ready = true; // the snapshot has been extracted and is ready to be sent |
|
459 | swf_f1_ready = true; // the snapshot has been extracted and is ready to be sent | |
460 | } |
|
460 | } | |
461 | else |
|
461 | else | |
462 | { |
|
462 | { | |
463 | PRINTF1("in SWBD *** unexpected rtems event received %x\n", (int) event_out) |
|
463 | PRINTF1("in SWBD *** unexpected rtems event received %x\n", (int) event_out) | |
464 | } |
|
464 | } | |
465 | } |
|
465 | } | |
466 | } |
|
466 | } | |
467 |
|
467 | |||
468 | //****************** |
|
468 | //****************** | |
469 | // general functions |
|
469 | // general functions | |
470 | void init_waveforms( void ) |
|
470 | void init_waveforms( void ) | |
471 | { |
|
471 | { | |
472 | int i = 0; |
|
472 | int i = 0; | |
473 |
|
473 | |||
474 | for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++) |
|
474 | for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++) | |
475 | { |
|
475 | { | |
476 | //*** |
|
476 | //*** | |
477 | // F0 |
|
477 | // F0 | |
478 | // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x88887777; // |
|
478 | // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x88887777; // | |
479 | // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; // |
|
479 | // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; // | |
480 | // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x44443333; // |
|
480 | // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x44443333; // | |
481 |
|
481 | |||
482 | //*** |
|
482 | //*** | |
483 | // F1 |
|
483 | // F1 | |
484 | // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x22221111; |
|
484 | // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x22221111; | |
485 | // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x44443333; |
|
485 | // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x44443333; | |
486 | // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000; |
|
486 | // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000; | |
487 |
|
487 | |||
488 | //*** |
|
488 | //*** | |
489 | // F2 |
|
489 | // F2 | |
490 | // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x44443333; |
|
490 | // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x44443333; | |
491 | // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; |
|
491 | // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; | |
492 | // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000; |
|
492 | // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000; | |
493 |
|
493 | |||
494 | //*** |
|
494 | //*** | |
495 | // F3 |
|
495 | // F3 | |
496 | // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 0 ] = val1; |
|
496 | // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 0 ] = val1; | |
497 | // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 1 ] = val2; |
|
497 | // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 1 ] = val2; | |
498 | // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 2 ] = 0xaaaa0000; |
|
498 | // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 2 ] = 0xaaaa0000; | |
499 | } |
|
499 | } | |
500 | } |
|
500 | } | |
501 |
|
501 | |||
502 | void init_waveform_rings( void ) |
|
502 | void init_waveform_rings( void ) | |
503 | { |
|
503 | { | |
504 | unsigned char i; |
|
504 | unsigned char i; | |
505 |
|
505 | |||
506 | // F0 RING |
|
506 | // F0 RING | |
507 | waveform_ring_f0[0].next = (ring_node*) &waveform_ring_f0[1]; |
|
507 | waveform_ring_f0[0].next = (ring_node*) &waveform_ring_f0[1]; | |
508 | waveform_ring_f0[0].previous = (ring_node*) &waveform_ring_f0[NB_RING_NODES_F0-1]; |
|
508 | waveform_ring_f0[0].previous = (ring_node*) &waveform_ring_f0[NB_RING_NODES_F0-1]; | |
509 | waveform_ring_f0[0].buffer_address = (int) &wf_snap_f0[0][0]; |
|
509 | waveform_ring_f0[0].buffer_address = (int) &wf_snap_f0[0][0]; | |
510 |
|
510 | |||
511 | waveform_ring_f0[NB_RING_NODES_F0-1].next = (ring_node*) &waveform_ring_f0[0]; |
|
511 | waveform_ring_f0[NB_RING_NODES_F0-1].next = (ring_node*) &waveform_ring_f0[0]; | |
512 | waveform_ring_f0[NB_RING_NODES_F0-1].previous = (ring_node*) &waveform_ring_f0[NB_RING_NODES_F0-2]; |
|
512 | waveform_ring_f0[NB_RING_NODES_F0-1].previous = (ring_node*) &waveform_ring_f0[NB_RING_NODES_F0-2]; | |
513 | waveform_ring_f0[NB_RING_NODES_F0-1].buffer_address = (int) &wf_snap_f0[NB_RING_NODES_F0-1][0]; |
|
513 | waveform_ring_f0[NB_RING_NODES_F0-1].buffer_address = (int) &wf_snap_f0[NB_RING_NODES_F0-1][0]; | |
514 |
|
514 | |||
515 | for(i=1; i<NB_RING_NODES_F0-1; i++) |
|
515 | for(i=1; i<NB_RING_NODES_F0-1; i++) | |
516 | { |
|
516 | { | |
517 | waveform_ring_f0[i].next = (ring_node*) &waveform_ring_f0[i+1]; |
|
517 | waveform_ring_f0[i].next = (ring_node*) &waveform_ring_f0[i+1]; | |
518 | waveform_ring_f0[i].previous = (ring_node*) &waveform_ring_f0[i-1]; |
|
518 | waveform_ring_f0[i].previous = (ring_node*) &waveform_ring_f0[i-1]; | |
519 | waveform_ring_f0[i].buffer_address = (int) &wf_snap_f0[i][0]; |
|
519 | waveform_ring_f0[i].buffer_address = (int) &wf_snap_f0[i][0]; | |
520 | } |
|
520 | } | |
521 |
|
521 | |||
522 | // F1 RING |
|
522 | // F1 RING | |
523 | waveform_ring_f1[0].next = (ring_node*) &waveform_ring_f1[1]; |
|
523 | waveform_ring_f1[0].next = (ring_node*) &waveform_ring_f1[1]; | |
524 | waveform_ring_f1[0].previous = (ring_node*) &waveform_ring_f1[NB_RING_NODES_F1-1]; |
|
524 | waveform_ring_f1[0].previous = (ring_node*) &waveform_ring_f1[NB_RING_NODES_F1-1]; | |
525 | waveform_ring_f1[0].buffer_address = (int) &wf_snap_f1[0][0]; |
|
525 | waveform_ring_f1[0].buffer_address = (int) &wf_snap_f1[0][0]; | |
526 |
|
526 | |||
527 | waveform_ring_f1[NB_RING_NODES_F1-1].next = (ring_node*) &waveform_ring_f1[0]; |
|
527 | waveform_ring_f1[NB_RING_NODES_F1-1].next = (ring_node*) &waveform_ring_f1[0]; | |
528 | waveform_ring_f1[NB_RING_NODES_F1-1].previous = (ring_node*) &waveform_ring_f1[NB_RING_NODES_F1-2]; |
|
528 | waveform_ring_f1[NB_RING_NODES_F1-1].previous = (ring_node*) &waveform_ring_f1[NB_RING_NODES_F1-2]; | |
529 | waveform_ring_f1[NB_RING_NODES_F1-1].buffer_address = (int) &wf_snap_f1[NB_RING_NODES_F1-1][0]; |
|
529 | waveform_ring_f1[NB_RING_NODES_F1-1].buffer_address = (int) &wf_snap_f1[NB_RING_NODES_F1-1][0]; | |
530 |
|
530 | |||
531 | for(i=1; i<NB_RING_NODES_F1-1; i++) |
|
531 | for(i=1; i<NB_RING_NODES_F1-1; i++) | |
532 | { |
|
532 | { | |
533 | waveform_ring_f1[i].next = (ring_node*) &waveform_ring_f1[i+1]; |
|
533 | waveform_ring_f1[i].next = (ring_node*) &waveform_ring_f1[i+1]; | |
534 | waveform_ring_f1[i].previous = (ring_node*) &waveform_ring_f1[i-1]; |
|
534 | waveform_ring_f1[i].previous = (ring_node*) &waveform_ring_f1[i-1]; | |
535 | waveform_ring_f1[i].buffer_address = (int) &wf_snap_f1[i][0]; |
|
535 | waveform_ring_f1[i].buffer_address = (int) &wf_snap_f1[i][0]; | |
536 | } |
|
536 | } | |
537 |
|
537 | |||
538 | // F2 RING |
|
538 | // F2 RING | |
539 | waveform_ring_f2[0].next = (ring_node*) &waveform_ring_f2[1]; |
|
539 | waveform_ring_f2[0].next = (ring_node*) &waveform_ring_f2[1]; | |
540 | waveform_ring_f2[0].previous = (ring_node*) &waveform_ring_f2[NB_RING_NODES_F2-1]; |
|
540 | waveform_ring_f2[0].previous = (ring_node*) &waveform_ring_f2[NB_RING_NODES_F2-1]; | |
541 | waveform_ring_f2[0].buffer_address = (int) &wf_snap_f2[0][0]; |
|
541 | waveform_ring_f2[0].buffer_address = (int) &wf_snap_f2[0][0]; | |
542 |
|
542 | |||
543 | waveform_ring_f2[NB_RING_NODES_F2-1].next = (ring_node*) &waveform_ring_f2[0]; |
|
543 | waveform_ring_f2[NB_RING_NODES_F2-1].next = (ring_node*) &waveform_ring_f2[0]; | |
544 | waveform_ring_f2[NB_RING_NODES_F2-1].previous = (ring_node*) &waveform_ring_f2[NB_RING_NODES_F2-2]; |
|
544 | waveform_ring_f2[NB_RING_NODES_F2-1].previous = (ring_node*) &waveform_ring_f2[NB_RING_NODES_F2-2]; | |
545 | waveform_ring_f2[NB_RING_NODES_F2-1].buffer_address = (int) &wf_snap_f2[NB_RING_NODES_F2-1][0]; |
|
545 | waveform_ring_f2[NB_RING_NODES_F2-1].buffer_address = (int) &wf_snap_f2[NB_RING_NODES_F2-1][0]; | |
546 |
|
546 | |||
547 | for(i=1; i<NB_RING_NODES_F2-1; i++) |
|
547 | for(i=1; i<NB_RING_NODES_F2-1; i++) | |
548 | { |
|
548 | { | |
549 | waveform_ring_f2[i].next = (ring_node*) &waveform_ring_f2[i+1]; |
|
549 | waveform_ring_f2[i].next = (ring_node*) &waveform_ring_f2[i+1]; | |
550 | waveform_ring_f2[i].previous = (ring_node*) &waveform_ring_f2[i-1]; |
|
550 | waveform_ring_f2[i].previous = (ring_node*) &waveform_ring_f2[i-1]; | |
551 | waveform_ring_f2[i].buffer_address = (int) &wf_snap_f2[i][0]; |
|
551 | waveform_ring_f2[i].buffer_address = (int) &wf_snap_f2[i][0]; | |
552 | } |
|
552 | } | |
553 |
|
553 | |||
554 | DEBUG_PRINTF1("waveform_ring_f0 @%x\n", (unsigned int) waveform_ring_f0) |
|
554 | DEBUG_PRINTF1("waveform_ring_f0 @%x\n", (unsigned int) waveform_ring_f0) | |
555 | DEBUG_PRINTF1("waveform_ring_f1 @%x\n", (unsigned int) waveform_ring_f1) |
|
555 | DEBUG_PRINTF1("waveform_ring_f1 @%x\n", (unsigned int) waveform_ring_f1) | |
556 | DEBUG_PRINTF1("waveform_ring_f2 @%x\n", (unsigned int) waveform_ring_f2) |
|
556 | DEBUG_PRINTF1("waveform_ring_f2 @%x\n", (unsigned int) waveform_ring_f2) | |
557 |
|
557 | |||
558 | } |
|
558 | } | |
559 |
|
559 | |||
560 | void reset_current_ring_nodes( void ) |
|
560 | void reset_current_ring_nodes( void ) | |
561 | { |
|
561 | { | |
562 | current_ring_node_f0 = waveform_ring_f0; |
|
562 | current_ring_node_f0 = waveform_ring_f0; | |
563 | ring_node_to_send_swf_f0 = waveform_ring_f0; |
|
563 | ring_node_to_send_swf_f0 = waveform_ring_f0; | |
564 |
|
564 | |||
565 | current_ring_node_f1 = waveform_ring_f1; |
|
565 | current_ring_node_f1 = waveform_ring_f1; | |
566 | ring_node_to_send_cwf_f1 = waveform_ring_f1; |
|
566 | ring_node_to_send_cwf_f1 = waveform_ring_f1; | |
567 | ring_node_to_send_swf_f1 = waveform_ring_f1; |
|
567 | ring_node_to_send_swf_f1 = waveform_ring_f1; | |
568 |
|
568 | |||
569 | current_ring_node_f2 = waveform_ring_f2; |
|
569 | current_ring_node_f2 = waveform_ring_f2; | |
570 | ring_node_to_send_cwf_f2 = waveform_ring_f2; |
|
570 | ring_node_to_send_cwf_f2 = waveform_ring_f2; | |
571 | ring_node_to_send_swf_f2 = waveform_ring_f2; |
|
571 | ring_node_to_send_swf_f2 = waveform_ring_f2; | |
572 | } |
|
572 | } | |
573 |
|
573 | |||
574 | int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF) |
|
574 | int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF) | |
575 | { |
|
575 | { | |
576 | unsigned char i; |
|
576 | unsigned char i; | |
577 |
|
577 | |||
578 | for (i=0; i<7; i++) |
|
578 | for (i=0; i<7; i++) | |
579 | { |
|
579 | { | |
580 | headerSWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
580 | headerSWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; | |
581 | headerSWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
581 | headerSWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
582 | headerSWF[ i ].reserved = DEFAULT_RESERVED; |
|
582 | headerSWF[ i ].reserved = DEFAULT_RESERVED; | |
583 | headerSWF[ i ].userApplication = CCSDS_USER_APP; |
|
583 | headerSWF[ i ].userApplication = CCSDS_USER_APP; | |
584 | headerSWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); |
|
584 | headerSWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); | |
585 | headerSWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); |
|
585 | headerSWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); | |
586 | headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
586 | headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
587 | if (i == 6) |
|
587 | if (i == 6) | |
588 | { |
|
588 | { | |
589 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_224 >> 8); |
|
589 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_224 >> 8); | |
590 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_224 ); |
|
590 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_224 ); | |
591 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_224 >> 8); |
|
591 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_224 >> 8); | |
592 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_224 ); |
|
592 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_224 ); | |
593 | } |
|
593 | } | |
594 | else |
|
594 | else | |
595 | { |
|
595 | { | |
596 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_304 >> 8); |
|
596 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_304 >> 8); | |
597 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_304 ); |
|
597 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_304 ); | |
598 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_304 >> 8); |
|
598 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_304 >> 8); | |
599 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_304 ); |
|
599 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_304 ); | |
600 | } |
|
600 | } | |
601 | headerSWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
601 | headerSWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
602 | headerSWF[ i ].pktCnt = DEFAULT_PKTCNT; // PKT_CNT |
|
602 | headerSWF[ i ].pktCnt = DEFAULT_PKTCNT; // PKT_CNT | |
603 | headerSWF[ i ].pktNr = i+1; // PKT_NR |
|
603 | headerSWF[ i ].pktNr = i+1; // PKT_NR | |
604 | // DATA FIELD HEADER |
|
604 | // DATA FIELD HEADER | |
605 | headerSWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
605 | headerSWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
606 | headerSWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
606 | headerSWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
607 | headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
607 | headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
608 | headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; |
|
608 | headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; | |
609 | // AUXILIARY DATA HEADER |
|
609 | // AUXILIARY DATA HEADER | |
610 | headerSWF[ i ].time[0] = 0x00; |
|
610 | headerSWF[ i ].time[0] = 0x00; | |
611 | headerSWF[ i ].time[0] = 0x00; |
|
611 | headerSWF[ i ].time[0] = 0x00; | |
612 | headerSWF[ i ].time[0] = 0x00; |
|
612 | headerSWF[ i ].time[0] = 0x00; | |
613 | headerSWF[ i ].time[0] = 0x00; |
|
613 | headerSWF[ i ].time[0] = 0x00; | |
614 | headerSWF[ i ].time[0] = 0x00; |
|
614 | headerSWF[ i ].time[0] = 0x00; | |
615 | headerSWF[ i ].time[0] = 0x00; |
|
615 | headerSWF[ i ].time[0] = 0x00; | |
616 | headerSWF[ i ].sid = sid; |
|
616 | headerSWF[ i ].sid = sid; | |
617 | headerSWF[ i ].hkBIA = DEFAULT_HKBIA; |
|
617 | headerSWF[ i ].hkBIA = DEFAULT_HKBIA; | |
618 | } |
|
618 | } | |
619 | return LFR_SUCCESSFUL; |
|
619 | return LFR_SUCCESSFUL; | |
620 | } |
|
620 | } | |
621 |
|
621 | |||
622 | int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF ) |
|
622 | int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF ) | |
623 | { |
|
623 | { | |
624 | unsigned int i; |
|
624 | unsigned int i; | |
625 |
|
625 | |||
626 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF; i++) |
|
626 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF; i++) | |
627 | { |
|
627 | { | |
628 | headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
628 | headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; | |
629 | headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
629 | headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
630 | headerCWF[ i ].reserved = DEFAULT_RESERVED; |
|
630 | headerCWF[ i ].reserved = DEFAULT_RESERVED; | |
631 | headerCWF[ i ].userApplication = CCSDS_USER_APP; |
|
631 | headerCWF[ i ].userApplication = CCSDS_USER_APP; | |
632 | if ( (sid == SID_SBM1_CWF_F1) || (sid == SID_SBM2_CWF_F2) ) |
|
632 | if ( (sid == SID_SBM1_CWF_F1) || (sid == SID_SBM2_CWF_F2) ) | |
633 | { |
|
633 | { | |
634 | headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2 >> 8); |
|
634 | headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2 >> 8); | |
635 | headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2); |
|
635 | headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2); | |
636 | } |
|
636 | } | |
637 | else |
|
637 | else | |
638 | { |
|
638 | { | |
639 | headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); |
|
639 | headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); | |
640 | headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); |
|
640 | headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); | |
641 | } |
|
641 | } | |
642 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
642 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
643 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_336 >> 8); |
|
643 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_336 >> 8); | |
644 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_336 ); |
|
644 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_336 ); | |
645 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF >> 8); |
|
645 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF >> 8); | |
646 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF ); |
|
646 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF ); | |
647 | headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
647 | headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
648 | // DATA FIELD HEADER |
|
648 | // DATA FIELD HEADER | |
649 | headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
649 | headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
650 | headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
650 | headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
651 | headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
651 | headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
652 | headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; |
|
652 | headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; | |
653 | // AUXILIARY DATA HEADER |
|
653 | // AUXILIARY DATA HEADER | |
654 | headerCWF[ i ].sid = sid; |
|
654 | headerCWF[ i ].sid = sid; | |
655 | headerCWF[ i ].hkBIA = DEFAULT_HKBIA; |
|
655 | headerCWF[ i ].hkBIA = DEFAULT_HKBIA; | |
656 | headerCWF[ i ].time[0] = 0x00; |
|
656 | headerCWF[ i ].time[0] = 0x00; | |
657 | headerCWF[ i ].time[0] = 0x00; |
|
657 | headerCWF[ i ].time[0] = 0x00; | |
658 | headerCWF[ i ].time[0] = 0x00; |
|
658 | headerCWF[ i ].time[0] = 0x00; | |
659 | headerCWF[ i ].time[0] = 0x00; |
|
659 | headerCWF[ i ].time[0] = 0x00; | |
660 | headerCWF[ i ].time[0] = 0x00; |
|
660 | headerCWF[ i ].time[0] = 0x00; | |
661 | headerCWF[ i ].time[0] = 0x00; |
|
661 | headerCWF[ i ].time[0] = 0x00; | |
662 | } |
|
662 | } | |
663 | return LFR_SUCCESSFUL; |
|
663 | return LFR_SUCCESSFUL; | |
664 | } |
|
664 | } | |
665 |
|
665 | |||
666 | int init_header_continuous_cwf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF ) |
|
666 | int init_header_continuous_cwf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF ) | |
667 | { |
|
667 | { | |
668 | unsigned int i; |
|
668 | unsigned int i; | |
669 |
|
669 | |||
670 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF_LIGHT; i++) |
|
670 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF_LIGHT; i++) | |
671 | { |
|
671 | { | |
672 | headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
672 | headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; | |
673 | headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
673 | headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
674 | headerCWF[ i ].reserved = DEFAULT_RESERVED; |
|
674 | headerCWF[ i ].reserved = DEFAULT_RESERVED; | |
675 | headerCWF[ i ].userApplication = CCSDS_USER_APP; |
|
675 | headerCWF[ i ].userApplication = CCSDS_USER_APP; | |
676 |
|
676 | |||
677 | headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); |
|
677 | headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); | |
678 | headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); |
|
678 | headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); | |
679 |
|
679 | |||
680 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
680 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
681 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_672 >> 8); |
|
681 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_672 >> 8); | |
682 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_672 ); |
|
682 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_672 ); | |
683 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF_SHORT_F3 >> 8); |
|
683 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF_SHORT_F3 >> 8); | |
684 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF_SHORT_F3 ); |
|
684 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF_SHORT_F3 ); | |
685 |
|
685 | |||
686 | headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
686 | headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
687 | // DATA FIELD HEADER |
|
687 | // DATA FIELD HEADER | |
688 | headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
688 | headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
689 | headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
689 | headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
690 | headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
690 | headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
691 | headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; |
|
691 | headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; | |
692 | // AUXILIARY DATA HEADER |
|
692 | // AUXILIARY DATA HEADER | |
693 | headerCWF[ i ].sid = SID_NORM_CWF_F3; |
|
693 | headerCWF[ i ].sid = SID_NORM_CWF_F3; | |
694 | headerCWF[ i ].hkBIA = DEFAULT_HKBIA; |
|
694 | headerCWF[ i ].hkBIA = DEFAULT_HKBIA; | |
695 | headerCWF[ i ].time[0] = 0x00; |
|
695 | headerCWF[ i ].time[0] = 0x00; | |
696 | headerCWF[ i ].time[0] = 0x00; |
|
696 | headerCWF[ i ].time[0] = 0x00; | |
697 | headerCWF[ i ].time[0] = 0x00; |
|
697 | headerCWF[ i ].time[0] = 0x00; | |
698 | headerCWF[ i ].time[0] = 0x00; |
|
698 | headerCWF[ i ].time[0] = 0x00; | |
699 | headerCWF[ i ].time[0] = 0x00; |
|
699 | headerCWF[ i ].time[0] = 0x00; | |
700 | headerCWF[ i ].time[0] = 0x00; |
|
700 | headerCWF[ i ].time[0] = 0x00; | |
701 | } |
|
701 | } | |
702 | return LFR_SUCCESSFUL; |
|
702 | return LFR_SUCCESSFUL; | |
703 | } |
|
703 | } | |
704 |
|
704 | |||
705 | int send_waveform_SWF( volatile int *waveform, unsigned int sid, |
|
705 | int send_waveform_SWF( volatile int *waveform, unsigned int sid, | |
706 | Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id ) |
|
706 | Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id ) | |
707 | { |
|
707 | { | |
708 | /** This function sends SWF CCSDS packets (F2, F1 or F0). |
|
708 | /** This function sends SWF CCSDS packets (F2, F1 or F0). | |
709 | * |
|
709 | * | |
710 | * @param waveform points to the buffer containing the data that will be send. |
|
710 | * @param waveform points to the buffer containing the data that will be send. | |
711 | * @param sid is the source identifier of the data that will be sent. |
|
711 | * @param sid is the source identifier of the data that will be sent. | |
712 | * @param headerSWF points to a table of headers that have been prepared for the data transmission. |
|
712 | * @param headerSWF points to a table of headers that have been prepared for the data transmission. | |
713 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures |
|
713 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures | |
714 | * contain information to setup the transmission of the data packets. |
|
714 | * contain information to setup the transmission of the data packets. | |
715 | * |
|
715 | * | |
716 | * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks. |
|
716 | * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks. | |
717 | * |
|
717 | * | |
718 | */ |
|
718 | */ | |
719 |
|
719 | |||
720 | unsigned int i; |
|
720 | unsigned int i; | |
721 | int ret; |
|
721 | int ret; | |
722 | unsigned int coarseTime; |
|
722 | unsigned int coarseTime; | |
723 | unsigned int fineTime; |
|
723 | unsigned int fineTime; | |
724 | rtems_status_code status; |
|
724 | rtems_status_code status; | |
725 | spw_ioctl_pkt_send spw_ioctl_send_SWF; |
|
725 | spw_ioctl_pkt_send spw_ioctl_send_SWF; | |
726 |
|
726 | |||
727 | spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header |
|
727 | spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header | |
728 | spw_ioctl_send_SWF.options = 0; |
|
728 | spw_ioctl_send_SWF.options = 0; | |
729 |
|
729 | |||
730 | ret = LFR_DEFAULT; |
|
730 | ret = LFR_DEFAULT; | |
731 |
|
731 | |||
732 | coarseTime = waveform[0]; |
|
732 | coarseTime = waveform[0]; | |
733 | fineTime = waveform[1]; |
|
733 | fineTime = waveform[1]; | |
734 |
|
734 | |||
735 | for (i=0; i<7; i++) // send waveform |
|
735 | for (i=0; i<7; i++) // send waveform | |
736 | { |
|
736 | { | |
737 | spw_ioctl_send_SWF.data = (char*) &waveform[ (i * BLK_NR_304 * NB_WORDS_SWF_BLK) + TIME_OFFSET]; |
|
737 | spw_ioctl_send_SWF.data = (char*) &waveform[ (i * BLK_NR_304 * NB_WORDS_SWF_BLK) + TIME_OFFSET]; | |
738 | spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ]; |
|
738 | spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ]; | |
739 | // BUILD THE DATA |
|
739 | // BUILD THE DATA | |
740 | if (i==6) { |
|
740 | if (i==6) { | |
741 | spw_ioctl_send_SWF.dlen = BLK_NR_224 * NB_BYTES_SWF_BLK; |
|
741 | spw_ioctl_send_SWF.dlen = BLK_NR_224 * NB_BYTES_SWF_BLK; | |
742 | } |
|
742 | } | |
743 | else { |
|
743 | else { | |
744 | spw_ioctl_send_SWF.dlen = BLK_NR_304 * NB_BYTES_SWF_BLK; |
|
744 | spw_ioctl_send_SWF.dlen = BLK_NR_304 * NB_BYTES_SWF_BLK; | |
745 | } |
|
745 | } | |
746 | // SET PACKET SEQUENCE COUNTER |
|
746 | // SET PACKET SEQUENCE COUNTER | |
747 | increment_seq_counter_source_id( headerSWF[ i ].packetSequenceControl, sid ); |
|
747 | increment_seq_counter_source_id( headerSWF[ i ].packetSequenceControl, sid ); | |
748 | // SET PACKET TIME |
|
748 | // SET PACKET TIME | |
749 | compute_acquisition_time( coarseTime, fineTime, sid, i, headerSWF[ i ].acquisitionTime ); |
|
749 | compute_acquisition_time( coarseTime, fineTime, sid, i, headerSWF[ i ].acquisitionTime ); | |
750 | // |
|
750 | // | |
751 | headerSWF[ i ].time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
751 | headerSWF[ i ].time[0] = headerSWF[ i ].acquisitionTime[0]; | |
752 | headerSWF[ i ].time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
752 | headerSWF[ i ].time[1] = headerSWF[ i ].acquisitionTime[1]; | |
753 | headerSWF[ i ].time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
753 | headerSWF[ i ].time[2] = headerSWF[ i ].acquisitionTime[2]; | |
754 | headerSWF[ i ].time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
754 | headerSWF[ i ].time[3] = headerSWF[ i ].acquisitionTime[3]; | |
755 | headerSWF[ i ].time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
755 | headerSWF[ i ].time[4] = headerSWF[ i ].acquisitionTime[4]; | |
756 | headerSWF[ i ].time[5] = (unsigned char) (time_management_regs->fine_time); |
|
756 | headerSWF[ i ].time[5] = headerSWF[ i ].acquisitionTime[5]; | |
757 | // SEND PACKET |
|
757 | // SEND PACKET | |
758 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_SWF, ACTION_MSG_SPW_IOCTL_SEND_SIZE); |
|
758 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_SWF, ACTION_MSG_SPW_IOCTL_SEND_SIZE); | |
759 | if (status != RTEMS_SUCCESSFUL) { |
|
759 | if (status != RTEMS_SUCCESSFUL) { | |
760 | printf("%d-%d, ERR %d\n", sid, i, (int) status); |
|
760 | printf("%d-%d, ERR %d\n", sid, i, (int) status); | |
761 | ret = LFR_DEFAULT; |
|
761 | ret = LFR_DEFAULT; | |
762 | } |
|
762 | } | |
763 | rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds |
|
763 | rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds | |
764 | } |
|
764 | } | |
765 |
|
765 | |||
766 | return ret; |
|
766 | return ret; | |
767 | } |
|
767 | } | |
768 |
|
768 | |||
769 | int send_waveform_CWF(volatile int *waveform, unsigned int sid, |
|
769 | int send_waveform_CWF(volatile int *waveform, unsigned int sid, | |
770 | Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id) |
|
770 | Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id) | |
771 | { |
|
771 | { | |
772 | /** This function sends CWF CCSDS packets (F2, F1 or F0). |
|
772 | /** This function sends CWF CCSDS packets (F2, F1 or F0). | |
773 | * |
|
773 | * | |
774 | * @param waveform points to the buffer containing the data that will be send. |
|
774 | * @param waveform points to the buffer containing the data that will be send. | |
775 | * @param sid is the source identifier of the data that will be sent. |
|
775 | * @param sid is the source identifier of the data that will be sent. | |
776 | * @param headerCWF points to a table of headers that have been prepared for the data transmission. |
|
776 | * @param headerCWF points to a table of headers that have been prepared for the data transmission. | |
777 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures |
|
777 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures | |
778 | * contain information to setup the transmission of the data packets. |
|
778 | * contain information to setup the transmission of the data packets. | |
779 | * |
|
779 | * | |
780 | * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks. |
|
780 | * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks. | |
781 | * |
|
781 | * | |
782 | */ |
|
782 | */ | |
783 |
|
783 | |||
784 | unsigned int i; |
|
784 | unsigned int i; | |
785 | int ret; |
|
785 | int ret; | |
786 | unsigned int coarseTime; |
|
786 | unsigned int coarseTime; | |
787 | unsigned int fineTime; |
|
787 | unsigned int fineTime; | |
788 | rtems_status_code status; |
|
788 | rtems_status_code status; | |
789 | spw_ioctl_pkt_send spw_ioctl_send_CWF; |
|
789 | spw_ioctl_pkt_send spw_ioctl_send_CWF; | |
790 |
|
790 | |||
791 | spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header |
|
791 | spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header | |
792 | spw_ioctl_send_CWF.options = 0; |
|
792 | spw_ioctl_send_CWF.options = 0; | |
793 |
|
793 | |||
794 | ret = LFR_DEFAULT; |
|
794 | ret = LFR_DEFAULT; | |
795 |
|
795 | |||
796 | coarseTime = waveform[0]; |
|
796 | coarseTime = waveform[0]; | |
797 | fineTime = waveform[1]; |
|
797 | fineTime = waveform[1]; | |
798 |
|
798 | |||
799 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF; i++) // send waveform |
|
799 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF; i++) // send waveform | |
800 | { |
|
800 | { | |
801 | spw_ioctl_send_CWF.data = (char*) &waveform[ (i * BLK_NR_CWF * NB_WORDS_SWF_BLK) + TIME_OFFSET]; |
|
801 | spw_ioctl_send_CWF.data = (char*) &waveform[ (i * BLK_NR_CWF * NB_WORDS_SWF_BLK) + TIME_OFFSET]; | |
802 | spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ]; |
|
802 | spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ]; | |
803 | // BUILD THE DATA |
|
803 | // BUILD THE DATA | |
804 | spw_ioctl_send_CWF.dlen = BLK_NR_CWF * NB_BYTES_SWF_BLK; |
|
804 | spw_ioctl_send_CWF.dlen = BLK_NR_CWF * NB_BYTES_SWF_BLK; | |
805 | // SET PACKET SEQUENCE COUNTER |
|
805 | // SET PACKET SEQUENCE COUNTER | |
806 | increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, sid ); |
|
806 | increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, sid ); | |
807 | // SET PACKET TIME |
|
807 | // SET PACKET TIME | |
808 | compute_acquisition_time( coarseTime, fineTime, sid, i, headerCWF[ i ].acquisitionTime); |
|
808 | compute_acquisition_time( coarseTime, fineTime, sid, i, headerCWF[ i ].acquisitionTime); | |
809 | // |
|
809 | // | |
810 | headerCWF[ i ].time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
810 | headerCWF[ i ].time[0] = headerCWF[ i ].acquisitionTime[0]; | |
811 | headerCWF[ i ].time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
811 | headerCWF[ i ].time[1] = headerCWF[ i ].acquisitionTime[1]; | |
812 | headerCWF[ i ].time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
812 | headerCWF[ i ].time[2] = headerCWF[ i ].acquisitionTime[2]; | |
813 | headerCWF[ i ].time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
813 | headerCWF[ i ].time[3] = headerCWF[ i ].acquisitionTime[3]; | |
814 | headerCWF[ i ].time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
814 | headerCWF[ i ].time[4] = headerCWF[ i ].acquisitionTime[4]; | |
815 | headerCWF[ i ].time[5] = (unsigned char) (time_management_regs->fine_time); |
|
815 | headerCWF[ i ].time[5] = headerCWF[ i ].acquisitionTime[5]; | |
816 | // SEND PACKET |
|
816 | // SEND PACKET | |
817 | if (sid == SID_NORM_CWF_LONG_F3) |
|
817 | if (sid == SID_NORM_CWF_LONG_F3) | |
818 | { |
|
818 | { | |
819 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); |
|
819 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); | |
820 | if (status != RTEMS_SUCCESSFUL) { |
|
820 | if (status != RTEMS_SUCCESSFUL) { | |
821 | printf("%d-%d, ERR %d\n", sid, i, (int) status); |
|
821 | printf("%d-%d, ERR %d\n", sid, i, (int) status); | |
822 | ret = LFR_DEFAULT; |
|
822 | ret = LFR_DEFAULT; | |
823 | } |
|
823 | } | |
824 | rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS); |
|
824 | rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS); | |
825 | } |
|
825 | } | |
826 | else |
|
826 | else | |
827 | { |
|
827 | { | |
828 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); |
|
828 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); | |
829 | if (status != RTEMS_SUCCESSFUL) { |
|
829 | if (status != RTEMS_SUCCESSFUL) { | |
830 | printf("%d-%d, ERR %d\n", sid, i, (int) status); |
|
830 | printf("%d-%d, ERR %d\n", sid, i, (int) status); | |
831 | ret = LFR_DEFAULT; |
|
831 | ret = LFR_DEFAULT; | |
832 | } |
|
832 | } | |
833 | } |
|
833 | } | |
834 | } |
|
834 | } | |
835 |
|
835 | |||
836 | return ret; |
|
836 | return ret; | |
837 | } |
|
837 | } | |
838 |
|
838 | |||
839 | int send_waveform_CWF3_light(volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id) |
|
839 | int send_waveform_CWF3_light(volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id) | |
840 | { |
|
840 | { | |
841 | /** This function sends CWF_F3 CCSDS packets without the b1, b2 and b3 data. |
|
841 | /** This function sends CWF_F3 CCSDS packets without the b1, b2 and b3 data. | |
842 | * |
|
842 | * | |
843 | * @param waveform points to the buffer containing the data that will be send. |
|
843 | * @param waveform points to the buffer containing the data that will be send. | |
844 | * @param headerCWF points to a table of headers that have been prepared for the data transmission. |
|
844 | * @param headerCWF points to a table of headers that have been prepared for the data transmission. | |
845 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures |
|
845 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures | |
846 | * contain information to setup the transmission of the data packets. |
|
846 | * contain information to setup the transmission of the data packets. | |
847 | * |
|
847 | * | |
848 | * By default, CWF_F3 packet are send without the b1, b2 and b3 data. This function rebuilds a data buffer |
|
848 | * By default, CWF_F3 packet are send without the b1, b2 and b3 data. This function rebuilds a data buffer | |
849 | * from the incoming data and sends it in 7 packets, 6 containing 340 blocks and 1 one containing 8 blocks. |
|
849 | * from the incoming data and sends it in 7 packets, 6 containing 340 blocks and 1 one containing 8 blocks. | |
850 | * |
|
850 | * | |
851 | */ |
|
851 | */ | |
852 |
|
852 | |||
853 | unsigned int i; |
|
853 | unsigned int i; | |
854 | int ret; |
|
854 | int ret; | |
855 | unsigned int coarseTime; |
|
855 | unsigned int coarseTime; | |
856 | unsigned int fineTime; |
|
856 | unsigned int fineTime; | |
857 | rtems_status_code status; |
|
857 | rtems_status_code status; | |
858 | spw_ioctl_pkt_send spw_ioctl_send_CWF; |
|
858 | spw_ioctl_pkt_send spw_ioctl_send_CWF; | |
859 | char *sample; |
|
859 | char *sample; | |
860 |
|
860 | |||
861 | spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header |
|
861 | spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header | |
862 | spw_ioctl_send_CWF.options = 0; |
|
862 | spw_ioctl_send_CWF.options = 0; | |
863 |
|
863 | |||
864 | ret = LFR_DEFAULT; |
|
864 | ret = LFR_DEFAULT; | |
865 |
|
865 | |||
866 | //********************** |
|
866 | //********************** | |
867 | // BUILD CWF3_light DATA |
|
867 | // BUILD CWF3_light DATA | |
868 | for ( i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++) |
|
868 | for ( i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++) | |
869 | { |
|
869 | { | |
870 | sample = (char*) &waveform[ (i * NB_WORDS_SWF_BLK) + TIME_OFFSET ]; |
|
870 | sample = (char*) &waveform[ (i * NB_WORDS_SWF_BLK) + TIME_OFFSET ]; | |
871 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + TIME_OFFSET_IN_BYTES ] = sample[ 0 ]; |
|
871 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + TIME_OFFSET_IN_BYTES ] = sample[ 0 ]; | |
872 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 + TIME_OFFSET_IN_BYTES ] = sample[ 1 ]; |
|
872 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 + TIME_OFFSET_IN_BYTES ] = sample[ 1 ]; | |
873 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 + TIME_OFFSET_IN_BYTES ] = sample[ 2 ]; |
|
873 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 + TIME_OFFSET_IN_BYTES ] = sample[ 2 ]; | |
874 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 + TIME_OFFSET_IN_BYTES ] = sample[ 3 ]; |
|
874 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 + TIME_OFFSET_IN_BYTES ] = sample[ 3 ]; | |
875 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 + TIME_OFFSET_IN_BYTES ] = sample[ 4 ]; |
|
875 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 + TIME_OFFSET_IN_BYTES ] = sample[ 4 ]; | |
876 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 + TIME_OFFSET_IN_BYTES ] = sample[ 5 ]; |
|
876 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 + TIME_OFFSET_IN_BYTES ] = sample[ 5 ]; | |
877 | } |
|
877 | } | |
878 |
|
878 | |||
879 | coarseTime = waveform[0]; |
|
879 | coarseTime = waveform[0]; | |
880 | fineTime = waveform[1]; |
|
880 | fineTime = waveform[1]; | |
881 |
|
881 | |||
882 | //********************* |
|
882 | //********************* | |
883 | // SEND CWF3_light DATA |
|
883 | // SEND CWF3_light DATA | |
884 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF_LIGHT; i++) // send waveform |
|
884 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF_LIGHT; i++) // send waveform | |
885 | { |
|
885 | { | |
886 | spw_ioctl_send_CWF.data = (char*) &wf_cont_f3_light[ (i * BLK_NR_CWF_SHORT_F3 * NB_BYTES_CWF3_LIGHT_BLK) + TIME_OFFSET_IN_BYTES]; |
|
886 | spw_ioctl_send_CWF.data = (char*) &wf_cont_f3_light[ (i * BLK_NR_CWF_SHORT_F3 * NB_BYTES_CWF3_LIGHT_BLK) + TIME_OFFSET_IN_BYTES]; | |
887 | spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ]; |
|
887 | spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ]; | |
888 | // BUILD THE DATA |
|
888 | // BUILD THE DATA | |
889 | spw_ioctl_send_CWF.dlen = BLK_NR_CWF_SHORT_F3 * NB_BYTES_CWF3_LIGHT_BLK; |
|
889 | spw_ioctl_send_CWF.dlen = BLK_NR_CWF_SHORT_F3 * NB_BYTES_CWF3_LIGHT_BLK; | |
890 | // SET PACKET SEQUENCE COUNTER |
|
890 | // SET PACKET SEQUENCE COUNTER | |
891 | increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, SID_NORM_CWF_F3 ); |
|
891 | increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, SID_NORM_CWF_F3 ); | |
892 | // SET PACKET TIME |
|
892 | // SET PACKET TIME | |
893 | compute_acquisition_time( coarseTime, fineTime, SID_NORM_CWF_F3, i, headerCWF[ i ].acquisitionTime ); |
|
893 | compute_acquisition_time( coarseTime, fineTime, SID_NORM_CWF_F3, i, headerCWF[ i ].acquisitionTime ); | |
894 | // |
|
894 | // | |
895 | headerCWF[ i ].time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
895 | headerCWF[ i ].time[0] = headerCWF[ i ].acquisitionTime[0]; | |
896 | headerCWF[ i ].time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
896 | headerCWF[ i ].time[1] = headerCWF[ i ].acquisitionTime[1]; | |
897 | headerCWF[ i ].time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
897 | headerCWF[ i ].time[2] = headerCWF[ i ].acquisitionTime[2]; | |
898 | headerCWF[ i ].time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
898 | headerCWF[ i ].time[3] = headerCWF[ i ].acquisitionTime[3]; | |
899 | headerCWF[ i ].time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
899 | headerCWF[ i ].time[4] = headerCWF[ i ].acquisitionTime[4]; | |
900 | headerCWF[ i ].time[5] = (unsigned char) (time_management_regs->fine_time); |
|
900 | headerCWF[ i ].time[5] = headerCWF[ i ].acquisitionTime[5]; | |
901 | // SEND PACKET |
|
901 | // SEND PACKET | |
902 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); |
|
902 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); | |
903 | if (status != RTEMS_SUCCESSFUL) { |
|
903 | if (status != RTEMS_SUCCESSFUL) { | |
904 | printf("%d-%d, ERR %d\n", SID_NORM_CWF_F3, i, (int) status); |
|
904 | printf("%d-%d, ERR %d\n", SID_NORM_CWF_F3, i, (int) status); | |
905 | ret = LFR_DEFAULT; |
|
905 | ret = LFR_DEFAULT; | |
906 | } |
|
906 | } | |
907 | rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS); |
|
907 | rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS); | |
908 | } |
|
908 | } | |
909 |
|
909 | |||
910 | return ret; |
|
910 | return ret; | |
911 | } |
|
911 | } | |
912 |
|
912 | |||
913 | void compute_acquisition_time( unsigned int coarseTime, unsigned int fineTime, |
|
913 | void compute_acquisition_time( unsigned int coarseTime, unsigned int fineTime, | |
914 | unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char * acquisitionTime ) |
|
914 | unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char * acquisitionTime ) | |
915 | { |
|
915 | { | |
916 | unsigned long long int acquisitionTimeAsLong; |
|
916 | unsigned long long int acquisitionTimeAsLong; | |
917 | unsigned char localAcquisitionTime[6]; |
|
917 | unsigned char localAcquisitionTime[6]; | |
918 | double deltaT; |
|
918 | double deltaT; | |
919 |
|
919 | |||
920 | deltaT = 0.; |
|
920 | deltaT = 0.; | |
921 |
|
921 | |||
922 | localAcquisitionTime[0] = (unsigned char) ( coarseTime >> 8 ); |
|
922 | localAcquisitionTime[0] = (unsigned char) ( coarseTime >> 8 ); | |
923 | localAcquisitionTime[1] = (unsigned char) ( coarseTime ); |
|
923 | localAcquisitionTime[1] = (unsigned char) ( coarseTime ); | |
924 | localAcquisitionTime[2] = (unsigned char) ( coarseTime >> 24 ); |
|
924 | localAcquisitionTime[2] = (unsigned char) ( coarseTime >> 24 ); | |
925 | localAcquisitionTime[3] = (unsigned char) ( coarseTime >> 16 ); |
|
925 | localAcquisitionTime[3] = (unsigned char) ( coarseTime >> 16 ); | |
926 | localAcquisitionTime[4] = (unsigned char) ( fineTime >> 24 ); |
|
926 | localAcquisitionTime[4] = (unsigned char) ( fineTime >> 24 ); | |
927 | localAcquisitionTime[5] = (unsigned char) ( fineTime >> 16 ); |
|
927 | localAcquisitionTime[5] = (unsigned char) ( fineTime >> 16 ); | |
928 |
|
928 | |||
929 | acquisitionTimeAsLong = ( (unsigned long long int) localAcquisitionTime[0] << 40 ) |
|
929 | acquisitionTimeAsLong = ( (unsigned long long int) localAcquisitionTime[0] << 40 ) | |
930 | + ( (unsigned long long int) localAcquisitionTime[1] << 32 ) |
|
930 | + ( (unsigned long long int) localAcquisitionTime[1] << 32 ) | |
931 | + ( localAcquisitionTime[2] << 24 ) |
|
931 | + ( localAcquisitionTime[2] << 24 ) | |
932 | + ( localAcquisitionTime[3] << 16 ) |
|
932 | + ( localAcquisitionTime[3] << 16 ) | |
933 | + ( localAcquisitionTime[4] << 8 ) |
|
933 | + ( localAcquisitionTime[4] << 8 ) | |
934 | + ( localAcquisitionTime[5] ); |
|
934 | + ( localAcquisitionTime[5] ); | |
935 |
|
935 | |||
936 | switch( sid ) |
|
936 | switch( sid ) | |
937 | { |
|
937 | { | |
938 | case SID_NORM_SWF_F0: |
|
938 | case SID_NORM_SWF_F0: | |
939 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 24576. ; |
|
939 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 24576. ; | |
940 | break; |
|
940 | break; | |
941 |
|
941 | |||
942 | case SID_NORM_SWF_F1: |
|
942 | case SID_NORM_SWF_F1: | |
943 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 4096. ; |
|
943 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 4096. ; | |
944 | break; |
|
944 | break; | |
945 |
|
945 | |||
946 | case SID_NORM_SWF_F2: |
|
946 | case SID_NORM_SWF_F2: | |
947 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 256. ; |
|
947 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 256. ; | |
948 | break; |
|
948 | break; | |
949 |
|
949 | |||
950 | case SID_SBM1_CWF_F1: |
|
950 | case SID_SBM1_CWF_F1: | |
951 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 4096. ; |
|
951 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 4096. ; | |
952 | break; |
|
952 | break; | |
953 |
|
953 | |||
954 | case SID_SBM2_CWF_F2: |
|
954 | case SID_SBM2_CWF_F2: | |
955 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ; |
|
955 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ; | |
956 | break; |
|
956 | break; | |
957 |
|
957 | |||
958 | case SID_BURST_CWF_F2: |
|
958 | case SID_BURST_CWF_F2: | |
959 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ; |
|
959 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ; | |
960 | break; |
|
960 | break; | |
961 |
|
961 | |||
962 | case SID_NORM_CWF_F3: |
|
962 | case SID_NORM_CWF_F3: | |
963 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF_SHORT_F3 * 65536. / 16. ; |
|
963 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF_SHORT_F3 * 65536. / 16. ; | |
964 | break; |
|
964 | break; | |
965 |
|
965 | |||
966 | case SID_NORM_CWF_LONG_F3: |
|
966 | case SID_NORM_CWF_LONG_F3: | |
967 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 16. ; |
|
967 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 16. ; | |
968 | break; |
|
968 | break; | |
969 |
|
969 | |||
970 | default: |
|
970 | default: | |
971 | PRINTF1("in compute_acquisition_time *** ERR unexpected sid %d", sid) |
|
971 | PRINTF1("in compute_acquisition_time *** ERR unexpected sid %d", sid) | |
972 | deltaT = 0.; |
|
972 | deltaT = 0.; | |
973 | break; |
|
973 | break; | |
974 | } |
|
974 | } | |
975 |
|
975 | |||
976 | acquisitionTimeAsLong = acquisitionTimeAsLong + (unsigned long long int) deltaT; |
|
976 | acquisitionTimeAsLong = acquisitionTimeAsLong + (unsigned long long int) deltaT; | |
977 | // |
|
977 | // | |
978 | acquisitionTime[0] = (unsigned char) (acquisitionTimeAsLong >> 40); |
|
978 | acquisitionTime[0] = (unsigned char) (acquisitionTimeAsLong >> 40); | |
979 | acquisitionTime[1] = (unsigned char) (acquisitionTimeAsLong >> 32); |
|
979 | acquisitionTime[1] = (unsigned char) (acquisitionTimeAsLong >> 32); | |
980 | acquisitionTime[2] = (unsigned char) (acquisitionTimeAsLong >> 24); |
|
980 | acquisitionTime[2] = (unsigned char) (acquisitionTimeAsLong >> 24); | |
981 | acquisitionTime[3] = (unsigned char) (acquisitionTimeAsLong >> 16); |
|
981 | acquisitionTime[3] = (unsigned char) (acquisitionTimeAsLong >> 16); | |
982 | acquisitionTime[4] = (unsigned char) (acquisitionTimeAsLong >> 8 ); |
|
982 | acquisitionTime[4] = (unsigned char) (acquisitionTimeAsLong >> 8 ); | |
983 | acquisitionTime[5] = (unsigned char) (acquisitionTimeAsLong ); |
|
983 | acquisitionTime[5] = (unsigned char) (acquisitionTimeAsLong ); | |
984 |
|
984 | |||
985 | } |
|
985 | } | |
986 |
|
986 | |||
987 | void build_snapshot_from_ring( ring_node *ring_node_to_send, unsigned char frequencyChannel ) |
|
987 | void build_snapshot_from_ring( ring_node *ring_node_to_send, unsigned char frequencyChannel ) | |
988 | { |
|
988 | { | |
989 | unsigned int i; |
|
989 | unsigned int i; | |
990 | unsigned long long int centerTime_asLong; |
|
990 | unsigned long long int centerTime_asLong; | |
991 | unsigned long long int acquisitionTimeF0_asLong; |
|
991 | unsigned long long int acquisitionTimeF0_asLong; | |
992 | unsigned long long int acquisitionTime_asLong; |
|
992 | unsigned long long int acquisitionTime_asLong; | |
993 | unsigned long long int bufferAcquisitionTime_asLong; |
|
993 | unsigned long long int bufferAcquisitionTime_asLong; | |
994 | unsigned char *ptr1; |
|
994 | unsigned char *ptr1; | |
995 | unsigned char *ptr2; |
|
995 | unsigned char *ptr2; | |
996 | unsigned char nb_ring_nodes; |
|
996 | unsigned char nb_ring_nodes; | |
997 | unsigned long long int frequency_asLong; |
|
997 | unsigned long long int frequency_asLong; | |
998 | unsigned long long int nbTicksPerSample_asLong; |
|
998 | unsigned long long int nbTicksPerSample_asLong; | |
999 | unsigned long long int nbSamplesPart1_asLong; |
|
999 | unsigned long long int nbSamplesPart1_asLong; | |
1000 | unsigned long long int sampleOffset_asLong; |
|
1000 | unsigned long long int sampleOffset_asLong; | |
1001 |
|
1001 | |||
1002 | unsigned int deltaT_F0; |
|
1002 | unsigned int deltaT_F0; | |
1003 | unsigned int deltaT_F1; |
|
1003 | unsigned int deltaT_F1; | |
1004 | unsigned long long int deltaT_F2; |
|
1004 | unsigned long long int deltaT_F2; | |
1005 |
|
1005 | |||
1006 | deltaT_F0 = 2731; // (2048. / 24576. / 2.) * 65536. = 2730.667; |
|
1006 | deltaT_F0 = 2731; // (2048. / 24576. / 2.) * 65536. = 2730.667; | |
1007 | deltaT_F1 = 16384; // (2048. / 4096. / 2.) * 65536. = 16384; |
|
1007 | deltaT_F1 = 16384; // (2048. / 4096. / 2.) * 65536. = 16384; | |
1008 | deltaT_F2 = 262144; // (2048. / 256. / 2.) * 65536. = 262144; |
|
1008 | deltaT_F2 = 262144; // (2048. / 256. / 2.) * 65536. = 262144; | |
1009 | sampleOffset_asLong = 0x00; |
|
1009 | sampleOffset_asLong = 0x00; | |
1010 |
|
1010 | |||
1011 | // (1) get the f0 acquisition time |
|
1011 | // (1) get the f0 acquisition time | |
1012 | build_acquisition_time( &acquisitionTimeF0_asLong, current_ring_node_f0 ); |
|
1012 | build_acquisition_time( &acquisitionTimeF0_asLong, current_ring_node_f0 ); | |
1013 |
|
1013 | |||
1014 | // (2) compute the central reference time |
|
1014 | // (2) compute the central reference time | |
1015 | centerTime_asLong = acquisitionTimeF0_asLong + deltaT_F0; |
|
1015 | centerTime_asLong = acquisitionTimeF0_asLong + deltaT_F0; | |
1016 |
|
1016 | |||
1017 | // (3) compute the acquisition time of the current snapshot |
|
1017 | // (3) compute the acquisition time of the current snapshot | |
1018 | switch(frequencyChannel) |
|
1018 | switch(frequencyChannel) | |
1019 | { |
|
1019 | { | |
1020 | case 1: // 1 is for F1 = 4096 Hz |
|
1020 | case 1: // 1 is for F1 = 4096 Hz | |
1021 | acquisitionTime_asLong = centerTime_asLong - deltaT_F1; |
|
1021 | acquisitionTime_asLong = centerTime_asLong - deltaT_F1; | |
1022 | nb_ring_nodes = NB_RING_NODES_F1; |
|
1022 | nb_ring_nodes = NB_RING_NODES_F1; | |
1023 | frequency_asLong = 4096; |
|
1023 | frequency_asLong = 4096; | |
1024 | nbTicksPerSample_asLong = 16; // 65536 / 4096; |
|
1024 | nbTicksPerSample_asLong = 16; // 65536 / 4096; | |
1025 | break; |
|
1025 | break; | |
1026 | case 2: // 2 is for F2 = 256 Hz |
|
1026 | case 2: // 2 is for F2 = 256 Hz | |
1027 | acquisitionTime_asLong = centerTime_asLong - deltaT_F2; |
|
1027 | acquisitionTime_asLong = centerTime_asLong - deltaT_F2; | |
1028 | nb_ring_nodes = NB_RING_NODES_F2; |
|
1028 | nb_ring_nodes = NB_RING_NODES_F2; | |
1029 | frequency_asLong = 256; |
|
1029 | frequency_asLong = 256; | |
1030 | nbTicksPerSample_asLong = 256; // 65536 / 256; |
|
1030 | nbTicksPerSample_asLong = 256; // 65536 / 256; | |
1031 | break; |
|
1031 | break; | |
1032 | default: |
|
1032 | default: | |
1033 | acquisitionTime_asLong = centerTime_asLong; |
|
1033 | acquisitionTime_asLong = centerTime_asLong; | |
1034 | frequency_asLong = 256; |
|
1034 | frequency_asLong = 256; | |
1035 | nbTicksPerSample_asLong = 256; |
|
1035 | nbTicksPerSample_asLong = 256; | |
1036 | break; |
|
1036 | break; | |
1037 | } |
|
1037 | } | |
1038 |
|
1038 | |||
1039 | //**************************************************************************** |
|
1039 | //**************************************************************************** | |
1040 | // (4) search the ring_node with the acquisition time <= acquisitionTime_asLong |
|
1040 | // (4) search the ring_node with the acquisition time <= acquisitionTime_asLong | |
1041 | for (i=0; i<nb_ring_nodes; i++) |
|
1041 | for (i=0; i<nb_ring_nodes; i++) | |
1042 | { |
|
1042 | { | |
1043 | PRINTF1("%d ... ", i) |
|
1043 | PRINTF1("%d ... ", i) | |
1044 | build_acquisition_time( &bufferAcquisitionTime_asLong, ring_node_to_send ); |
|
1044 | build_acquisition_time( &bufferAcquisitionTime_asLong, ring_node_to_send ); | |
1045 | if (bufferAcquisitionTime_asLong <= acquisitionTime_asLong) |
|
1045 | if (bufferAcquisitionTime_asLong <= acquisitionTime_asLong) | |
1046 | { |
|
1046 | { | |
1047 | PRINTF1("buffer found with acquisition time = %llx\n", bufferAcquisitionTime_asLong) |
|
1047 | PRINTF1("buffer found with acquisition time = %llx\n", bufferAcquisitionTime_asLong) | |
1048 | break; |
|
1048 | break; | |
1049 | } |
|
1049 | } | |
1050 | ring_node_to_send = ring_node_to_send->previous; |
|
1050 | ring_node_to_send = ring_node_to_send->previous; | |
1051 | } |
|
1051 | } | |
1052 |
|
1052 | |||
1053 | // (5) compute the number of samples to take in the current buffer |
|
1053 | // (5) compute the number of samples to take in the current buffer | |
1054 | sampleOffset_asLong = ((acquisitionTime_asLong - bufferAcquisitionTime_asLong) * frequency_asLong ) >> 16; |
|
1054 | sampleOffset_asLong = ((acquisitionTime_asLong - bufferAcquisitionTime_asLong) * frequency_asLong ) >> 16; | |
1055 | nbSamplesPart1_asLong = NB_SAMPLES_PER_SNAPSHOT - sampleOffset_asLong; |
|
1055 | nbSamplesPart1_asLong = NB_SAMPLES_PER_SNAPSHOT - sampleOffset_asLong; | |
1056 | PRINTF2("sampleOffset_asLong = %lld, nbSamplesPart1_asLong = %lld\n", sampleOffset_asLong, nbSamplesPart1_asLong) |
|
1056 | PRINTF2("sampleOffset_asLong = %lld, nbSamplesPart1_asLong = %lld\n", sampleOffset_asLong, nbSamplesPart1_asLong) | |
1057 |
|
1057 | |||
1058 | // (6) compute the final acquisition time |
|
1058 | // (6) compute the final acquisition time | |
1059 | acquisitionTime_asLong = bufferAcquisitionTime_asLong + |
|
1059 | acquisitionTime_asLong = bufferAcquisitionTime_asLong + | |
1060 | sampleOffset_asLong * nbTicksPerSample_asLong; |
|
1060 | sampleOffset_asLong * nbTicksPerSample_asLong; | |
1061 |
|
1061 | |||
1062 | // (7) copy the acquisition time at the beginning of the extrated snapshot |
|
1062 | // (7) copy the acquisition time at the beginning of the extrated snapshot | |
1063 | ptr1 = (unsigned char*) &acquisitionTime_asLong; |
|
1063 | ptr1 = (unsigned char*) &acquisitionTime_asLong; | |
1064 | ptr2 = (unsigned char*) wf_snap_extracted; |
|
1064 | ptr2 = (unsigned char*) wf_snap_extracted; | |
1065 | ptr2[0] = ptr1[ 2 + 2 ]; |
|
1065 | ptr2[0] = ptr1[ 2 + 2 ]; | |
1066 | ptr2[1] = ptr1[ 3 + 2 ]; |
|
1066 | ptr2[1] = ptr1[ 3 + 2 ]; | |
1067 | ptr2[2] = ptr1[ 0 + 2 ]; |
|
1067 | ptr2[2] = ptr1[ 0 + 2 ]; | |
1068 | ptr2[3] = ptr1[ 1 + 2 ]; |
|
1068 | ptr2[3] = ptr1[ 1 + 2 ]; | |
1069 | ptr2[4] = ptr1[ 4 + 2 ]; |
|
1069 | ptr2[4] = ptr1[ 4 + 2 ]; | |
1070 | ptr2[5] = ptr1[ 5 + 2 ]; |
|
1070 | ptr2[5] = ptr1[ 5 + 2 ]; | |
1071 |
|
1071 | |||
1072 | // re set the synchronization bit |
|
1072 | // re set the synchronization bit | |
1073 |
|
1073 | |||
1074 |
|
1074 | |||
1075 | // copy the part 1 of the snapshot in the extracted buffer |
|
1075 | // copy the part 1 of the snapshot in the extracted buffer | |
1076 | for ( i = 0; i < (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i++ ) |
|
1076 | for ( i = 0; i < (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i++ ) | |
1077 | { |
|
1077 | { | |
1078 | wf_snap_extracted[i + TIME_OFFSET] = |
|
1078 | wf_snap_extracted[i + TIME_OFFSET] = | |
1079 | ((int*) ring_node_to_send->buffer_address)[i + (sampleOffset_asLong * NB_WORDS_SWF_BLK) + TIME_OFFSET]; |
|
1079 | ((int*) ring_node_to_send->buffer_address)[i + (sampleOffset_asLong * NB_WORDS_SWF_BLK) + TIME_OFFSET]; | |
1080 | } |
|
1080 | } | |
1081 | // copy the part 2 of the snapshot in the extracted buffer |
|
1081 | // copy the part 2 of the snapshot in the extracted buffer | |
1082 | ring_node_to_send = ring_node_to_send->next; |
|
1082 | ring_node_to_send = ring_node_to_send->next; | |
1083 | for ( i = (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i < (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK); i++ ) |
|
1083 | for ( i = (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i < (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK); i++ ) | |
1084 | { |
|
1084 | { | |
1085 | wf_snap_extracted[i + TIME_OFFSET] = |
|
1085 | wf_snap_extracted[i + TIME_OFFSET] = | |
1086 | ((int*) ring_node_to_send->buffer_address)[(i-(nbSamplesPart1_asLong * NB_WORDS_SWF_BLK)) + TIME_OFFSET]; |
|
1086 | ((int*) ring_node_to_send->buffer_address)[(i-(nbSamplesPart1_asLong * NB_WORDS_SWF_BLK)) + TIME_OFFSET]; | |
1087 | } |
|
1087 | } | |
1088 | } |
|
1088 | } | |
1089 |
|
1089 | |||
1090 | void build_acquisition_time( unsigned long long int *acquisitionTimeAslong, ring_node *current_ring_node ) |
|
1090 | void build_acquisition_time( unsigned long long int *acquisitionTimeAslong, ring_node *current_ring_node ) | |
1091 | { |
|
1091 | { | |
1092 | unsigned char *acquisitionTimeCharPtr; |
|
1092 | unsigned char *acquisitionTimeCharPtr; | |
1093 |
|
1093 | |||
1094 | acquisitionTimeCharPtr = (unsigned char*) current_ring_node->buffer_address; |
|
1094 | acquisitionTimeCharPtr = (unsigned char*) current_ring_node->buffer_address; | |
1095 |
|
1095 | |||
1096 | *acquisitionTimeAslong = 0x00; |
|
1096 | *acquisitionTimeAslong = 0x00; | |
1097 | *acquisitionTimeAslong = ( acquisitionTimeCharPtr[0] << 24 ) |
|
1097 | *acquisitionTimeAslong = ( acquisitionTimeCharPtr[0] << 24 ) | |
1098 | + ( acquisitionTimeCharPtr[1] << 16 ) |
|
1098 | + ( acquisitionTimeCharPtr[1] << 16 ) | |
1099 | + ( (unsigned long long int) (acquisitionTimeCharPtr[2] & 0x7f) << 40 ) // [0111 1111] mask the synchronization bit |
|
1099 | + ( (unsigned long long int) (acquisitionTimeCharPtr[2] & 0x7f) << 40 ) // [0111 1111] mask the synchronization bit | |
1100 | + ( (unsigned long long int) acquisitionTimeCharPtr[3] << 32 ) |
|
1100 | + ( (unsigned long long int) acquisitionTimeCharPtr[3] << 32 ) | |
1101 | + ( acquisitionTimeCharPtr[4] << 8 ) |
|
1101 | + ( acquisitionTimeCharPtr[4] << 8 ) | |
1102 | + ( acquisitionTimeCharPtr[5] ); |
|
1102 | + ( acquisitionTimeCharPtr[5] ); | |
1103 | } |
|
1103 | } | |
1104 |
|
1104 | |||
1105 | //************** |
|
1105 | //************** | |
1106 | // wfp registers |
|
1106 | // wfp registers | |
1107 | void reset_wfp_burst_enable(void) |
|
1107 | void reset_wfp_burst_enable(void) | |
1108 | { |
|
1108 | { | |
1109 | /** This function resets the waveform picker burst_enable register. |
|
1109 | /** This function resets the waveform picker burst_enable register. | |
1110 | * |
|
1110 | * | |
1111 | * The burst bits [f2 f1 f0] and the enable bits [f3 f2 f1 f0] are set to 0. |
|
1111 | * The burst bits [f2 f1 f0] and the enable bits [f3 f2 f1 f0] are set to 0. | |
1112 | * |
|
1112 | * | |
1113 | */ |
|
1113 | */ | |
1114 |
|
1114 | |||
1115 | waveform_picker_regs->run_burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 |
|
1115 | waveform_picker_regs->run_burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 | |
1116 | } |
|
1116 | } | |
1117 |
|
1117 | |||
1118 | void reset_wfp_status( void ) |
|
1118 | void reset_wfp_status( void ) | |
1119 | { |
|
1119 | { | |
1120 | /** This function resets the waveform picker status register. |
|
1120 | /** This function resets the waveform picker status register. | |
1121 | * |
|
1121 | * | |
1122 | * All status bits are set to 0 [new_err full_err full]. |
|
1122 | * All status bits are set to 0 [new_err full_err full]. | |
1123 | * |
|
1123 | * | |
1124 | */ |
|
1124 | */ | |
1125 |
|
1125 | |||
1126 | waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 |
|
1126 | waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 | |
1127 | } |
|
1127 | } | |
1128 |
|
1128 | |||
1129 | void reset_waveform_picker_regs(void) |
|
1129 | void reset_waveform_picker_regs(void) | |
1130 | { |
|
1130 | { | |
1131 | /** This function resets the waveform picker module registers. |
|
1131 | /** This function resets the waveform picker module registers. | |
1132 | * |
|
1132 | * | |
1133 | * The registers affected by this function are located at the following offset addresses: |
|
1133 | * The registers affected by this function are located at the following offset addresses: | |
1134 | * - 0x00 data_shaping |
|
1134 | * - 0x00 data_shaping | |
1135 | * - 0x04 run_burst_enable |
|
1135 | * - 0x04 run_burst_enable | |
1136 | * - 0x08 addr_data_f0 |
|
1136 | * - 0x08 addr_data_f0 | |
1137 | * - 0x0C addr_data_f1 |
|
1137 | * - 0x0C addr_data_f1 | |
1138 | * - 0x10 addr_data_f2 |
|
1138 | * - 0x10 addr_data_f2 | |
1139 | * - 0x14 addr_data_f3 |
|
1139 | * - 0x14 addr_data_f3 | |
1140 | * - 0x18 status |
|
1140 | * - 0x18 status | |
1141 | * - 0x1C delta_snapshot |
|
1141 | * - 0x1C delta_snapshot | |
1142 | * - 0x20 delta_f0 |
|
1142 | * - 0x20 delta_f0 | |
1143 | * - 0x24 delta_f0_2 |
|
1143 | * - 0x24 delta_f0_2 | |
1144 | * - 0x28 delta_f1 |
|
1144 | * - 0x28 delta_f1 | |
1145 | * - 0x2c delta_f2 |
|
1145 | * - 0x2c delta_f2 | |
1146 | * - 0x30 nb_data_by_buffer |
|
1146 | * - 0x30 nb_data_by_buffer | |
1147 | * - 0x34 nb_snapshot_param |
|
1147 | * - 0x34 nb_snapshot_param | |
1148 | * - 0x38 start_date |
|
1148 | * - 0x38 start_date | |
1149 | * - 0x3c nb_word_in_buffer |
|
1149 | * - 0x3c nb_word_in_buffer | |
1150 | * |
|
1150 | * | |
1151 | */ |
|
1151 | */ | |
1152 |
|
1152 | |||
1153 | set_wfp_data_shaping(); // 0x00 *** R1 R0 SP1 SP0 BW |
|
1153 | set_wfp_data_shaping(); // 0x00 *** R1 R0 SP1 SP0 BW | |
1154 | reset_wfp_burst_enable(); // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ] |
|
1154 | reset_wfp_burst_enable(); // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ] | |
1155 | waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address; // 0x08 |
|
1155 | waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address; // 0x08 | |
1156 | waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; // 0x0c |
|
1156 | waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; // 0x0c | |
1157 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; // 0x10 |
|
1157 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; // 0x10 | |
1158 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a); // 0x14 |
|
1158 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a); // 0x14 | |
1159 | reset_wfp_status(); // 0x18 |
|
1159 | reset_wfp_status(); // 0x18 | |
1160 | // |
|
1160 | // | |
1161 | set_wfp_delta_snapshot(); // 0x1c |
|
1161 | set_wfp_delta_snapshot(); // 0x1c | |
1162 | set_wfp_delta_f0_f0_2(); // 0x20, 0x24 |
|
1162 | set_wfp_delta_f0_f0_2(); // 0x20, 0x24 | |
1163 | set_wfp_delta_f1(); // 0x28 |
|
1163 | set_wfp_delta_f1(); // 0x28 | |
1164 | set_wfp_delta_f2(); // 0x2c |
|
1164 | set_wfp_delta_f2(); // 0x2c | |
1165 | DEBUG_PRINTF1("delta_snapshot %x\n", waveform_picker_regs->delta_snapshot) |
|
1165 | DEBUG_PRINTF1("delta_snapshot %x\n", waveform_picker_regs->delta_snapshot) | |
1166 | DEBUG_PRINTF1("delta_f0 %x\n", waveform_picker_regs->delta_f0) |
|
1166 | DEBUG_PRINTF1("delta_f0 %x\n", waveform_picker_regs->delta_f0) | |
1167 | DEBUG_PRINTF1("delta_f0_2 %x\n", waveform_picker_regs->delta_f0_2) |
|
1167 | DEBUG_PRINTF1("delta_f0_2 %x\n", waveform_picker_regs->delta_f0_2) | |
1168 | DEBUG_PRINTF1("delta_f1 %x\n", waveform_picker_regs->delta_f1) |
|
1168 | DEBUG_PRINTF1("delta_f1 %x\n", waveform_picker_regs->delta_f1) | |
1169 | DEBUG_PRINTF1("delta_f2 %x\n", waveform_picker_regs->delta_f2) |
|
1169 | DEBUG_PRINTF1("delta_f2 %x\n", waveform_picker_regs->delta_f2) | |
1170 | // 2688 = 8 * 336 |
|
1170 | // 2688 = 8 * 336 | |
1171 | waveform_picker_regs->nb_data_by_buffer = 0xa7f; // 0x30 *** 2688 - 1 => nb samples -1 |
|
1171 | waveform_picker_regs->nb_data_by_buffer = 0xa7f; // 0x30 *** 2688 - 1 => nb samples -1 | |
1172 | waveform_picker_regs->snapshot_param = 0xa80; // 0x34 *** 2688 => nb samples |
|
1172 | waveform_picker_regs->snapshot_param = 0xa80; // 0x34 *** 2688 => nb samples | |
1173 | waveform_picker_regs->start_date = 0x00; // 0x38 |
|
1173 | waveform_picker_regs->start_date = 0x00; // 0x38 | |
1174 | waveform_picker_regs->nb_word_in_buffer = 0x1f82; // 0x3c *** 2688 * 3 + 2 = 8066 |
|
1174 | waveform_picker_regs->nb_word_in_buffer = 0x1f82; // 0x3c *** 2688 * 3 + 2 = 8066 | |
1175 | } |
|
1175 | } | |
1176 |
|
1176 | |||
1177 | void set_wfp_data_shaping( void ) |
|
1177 | void set_wfp_data_shaping( void ) | |
1178 | { |
|
1178 | { | |
1179 | /** This function sets the data_shaping register of the waveform picker module. |
|
1179 | /** This function sets the data_shaping register of the waveform picker module. | |
1180 | * |
|
1180 | * | |
1181 | * The value is read from one field of the parameter_dump_packet structure:\n |
|
1181 | * The value is read from one field of the parameter_dump_packet structure:\n | |
1182 | * bw_sp0_sp1_r0_r1 |
|
1182 | * bw_sp0_sp1_r0_r1 | |
1183 | * |
|
1183 | * | |
1184 | */ |
|
1184 | */ | |
1185 |
|
1185 | |||
1186 | unsigned char data_shaping; |
|
1186 | unsigned char data_shaping; | |
1187 |
|
1187 | |||
1188 | // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register |
|
1188 | // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register | |
1189 | // waveform picker : [R1 R0 SP1 SP0 BW] |
|
1189 | // waveform picker : [R1 R0 SP1 SP0 BW] | |
1190 |
|
1190 | |||
1191 | data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1; |
|
1191 | data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1; | |
1192 |
|
1192 | |||
1193 | waveform_picker_regs->data_shaping = |
|
1193 | waveform_picker_regs->data_shaping = | |
1194 | ( (data_shaping & 0x10) >> 4 ) // BW |
|
1194 | ( (data_shaping & 0x10) >> 4 ) // BW | |
1195 | + ( (data_shaping & 0x08) >> 2 ) // SP0 |
|
1195 | + ( (data_shaping & 0x08) >> 2 ) // SP0 | |
1196 | + ( (data_shaping & 0x04) ) // SP1 |
|
1196 | + ( (data_shaping & 0x04) ) // SP1 | |
1197 | + ( (data_shaping & 0x02) << 2 ) // R0 |
|
1197 | + ( (data_shaping & 0x02) << 2 ) // R0 | |
1198 | + ( (data_shaping & 0x01) << 4 ); // R1 |
|
1198 | + ( (data_shaping & 0x01) << 4 ); // R1 | |
1199 | } |
|
1199 | } | |
1200 |
|
1200 | |||
1201 | void set_wfp_burst_enable_register( unsigned char mode ) |
|
1201 | void set_wfp_burst_enable_register( unsigned char mode ) | |
1202 | { |
|
1202 | { | |
1203 | /** This function sets the waveform picker burst_enable register depending on the mode. |
|
1203 | /** This function sets the waveform picker burst_enable register depending on the mode. | |
1204 | * |
|
1204 | * | |
1205 | * @param mode is the LFR mode to launch. |
|
1205 | * @param mode is the LFR mode to launch. | |
1206 | * |
|
1206 | * | |
1207 | * The burst bits shall be before the enable bits. |
|
1207 | * The burst bits shall be before the enable bits. | |
1208 | * |
|
1208 | * | |
1209 | */ |
|
1209 | */ | |
1210 |
|
1210 | |||
1211 | // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0 |
|
1211 | // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0 | |
1212 | // the burst bits shall be set first, before the enable bits |
|
1212 | // the burst bits shall be set first, before the enable bits | |
1213 | switch(mode) { |
|
1213 | switch(mode) { | |
1214 | case(LFR_MODE_NORMAL): |
|
1214 | case(LFR_MODE_NORMAL): | |
1215 | waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enable |
|
1215 | waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enable | |
1216 | waveform_picker_regs->run_burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0 |
|
1216 | waveform_picker_regs->run_burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0 | |
1217 | break; |
|
1217 | break; | |
1218 | case(LFR_MODE_BURST): |
|
1218 | case(LFR_MODE_BURST): | |
1219 | waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled |
|
1219 | waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled | |
1220 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x04; // [0100] enable f2 |
|
1220 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x04; // [0100] enable f2 | |
1221 | break; |
|
1221 | break; | |
1222 | case(LFR_MODE_SBM1): |
|
1222 | case(LFR_MODE_SBM1): | |
1223 | waveform_picker_regs->run_burst_enable = 0x20; // [0010 0000] f1 burst enabled |
|
1223 | waveform_picker_regs->run_burst_enable = 0x20; // [0010 0000] f1 burst enabled | |
1224 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 |
|
1224 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 | |
1225 | break; |
|
1225 | break; | |
1226 | case(LFR_MODE_SBM2): |
|
1226 | case(LFR_MODE_SBM2): | |
1227 | waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled |
|
1227 | waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled | |
1228 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 |
|
1228 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 | |
1229 | break; |
|
1229 | break; | |
1230 | default: |
|
1230 | default: | |
1231 | waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled |
|
1231 | waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled | |
1232 | break; |
|
1232 | break; | |
1233 | } |
|
1233 | } | |
1234 | } |
|
1234 | } | |
1235 |
|
1235 | |||
1236 | void set_wfp_delta_snapshot( void ) |
|
1236 | void set_wfp_delta_snapshot( void ) | |
1237 | { |
|
1237 | { | |
1238 | /** This function sets the delta_snapshot register of the waveform picker module. |
|
1238 | /** This function sets the delta_snapshot register of the waveform picker module. | |
1239 | * |
|
1239 | * | |
1240 | * The value is read from two (unsigned char) of the parameter_dump_packet structure: |
|
1240 | * The value is read from two (unsigned char) of the parameter_dump_packet structure: | |
1241 | * - sy_lfr_n_swf_p[0] |
|
1241 | * - sy_lfr_n_swf_p[0] | |
1242 | * - sy_lfr_n_swf_p[1] |
|
1242 | * - sy_lfr_n_swf_p[1] | |
1243 | * |
|
1243 | * | |
1244 | */ |
|
1244 | */ | |
1245 |
|
1245 | |||
1246 | unsigned int delta_snapshot; |
|
1246 | unsigned int delta_snapshot; | |
1247 | unsigned int delta_snapshot_in_T2; |
|
1247 | unsigned int delta_snapshot_in_T2; | |
1248 |
|
1248 | |||
1249 | delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256 |
|
1249 | delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256 | |
1250 | + parameter_dump_packet.sy_lfr_n_swf_p[1]; |
|
1250 | + parameter_dump_packet.sy_lfr_n_swf_p[1]; | |
1251 |
|
1251 | |||
1252 | delta_snapshot_in_T2 = delta_snapshot * 256; |
|
1252 | delta_snapshot_in_T2 = delta_snapshot * 256; | |
1253 | waveform_picker_regs->delta_snapshot = delta_snapshot_in_T2; // max 4 bytes |
|
1253 | waveform_picker_regs->delta_snapshot = delta_snapshot_in_T2; // max 4 bytes | |
1254 | } |
|
1254 | } | |
1255 |
|
1255 | |||
1256 | void set_wfp_delta_f0_f0_2( void ) |
|
1256 | void set_wfp_delta_f0_f0_2( void ) | |
1257 | { |
|
1257 | { | |
1258 | unsigned int delta_snapshot; |
|
1258 | unsigned int delta_snapshot; | |
1259 | unsigned int nb_samples_per_snapshot; |
|
1259 | unsigned int nb_samples_per_snapshot; | |
1260 | float delta_f0_in_float; |
|
1260 | float delta_f0_in_float; | |
1261 |
|
1261 | |||
1262 | delta_snapshot = waveform_picker_regs->delta_snapshot; |
|
1262 | delta_snapshot = waveform_picker_regs->delta_snapshot; | |
1263 | nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1]; |
|
1263 | nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1]; | |
1264 | delta_f0_in_float =nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 24576.) * 256.; |
|
1264 | delta_f0_in_float =nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 24576.) * 256.; | |
1265 |
|
1265 | |||
1266 | waveform_picker_regs->delta_f0 = delta_snapshot - floor( delta_f0_in_float ); |
|
1266 | waveform_picker_regs->delta_f0 = delta_snapshot - floor( delta_f0_in_float ); | |
1267 | waveform_picker_regs->delta_f0_2 = 0x7; // max 7 bits |
|
1267 | waveform_picker_regs->delta_f0_2 = 0x7; // max 7 bits | |
1268 | } |
|
1268 | } | |
1269 |
|
1269 | |||
1270 | void set_wfp_delta_f1( void ) |
|
1270 | void set_wfp_delta_f1( void ) | |
1271 | { |
|
1271 | { | |
1272 | unsigned int delta_snapshot; |
|
1272 | unsigned int delta_snapshot; | |
1273 | unsigned int nb_samples_per_snapshot; |
|
1273 | unsigned int nb_samples_per_snapshot; | |
1274 | float delta_f1_in_float; |
|
1274 | float delta_f1_in_float; | |
1275 |
|
1275 | |||
1276 | delta_snapshot = waveform_picker_regs->delta_snapshot; |
|
1276 | delta_snapshot = waveform_picker_regs->delta_snapshot; | |
1277 | nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1]; |
|
1277 | nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1]; | |
1278 | delta_f1_in_float = nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 4096.) * 256.; |
|
1278 | delta_f1_in_float = nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 4096.) * 256.; | |
1279 |
|
1279 | |||
1280 | waveform_picker_regs->delta_f1 = delta_snapshot - floor( delta_f1_in_float ); |
|
1280 | waveform_picker_regs->delta_f1 = delta_snapshot - floor( delta_f1_in_float ); | |
1281 | } |
|
1281 | } | |
1282 |
|
1282 | |||
1283 | void set_wfp_delta_f2() |
|
1283 | void set_wfp_delta_f2() | |
1284 | { |
|
1284 | { | |
1285 | unsigned int delta_snapshot; |
|
1285 | unsigned int delta_snapshot; | |
1286 | unsigned int nb_samples_per_snapshot; |
|
1286 | unsigned int nb_samples_per_snapshot; | |
1287 |
|
1287 | |||
1288 | delta_snapshot = waveform_picker_regs->delta_snapshot; |
|
1288 | delta_snapshot = waveform_picker_regs->delta_snapshot; | |
1289 | nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1]; |
|
1289 | nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1]; | |
1290 |
|
1290 | |||
1291 | waveform_picker_regs->delta_f2 = delta_snapshot - nb_samples_per_snapshot / 2; |
|
1291 | waveform_picker_regs->delta_f2 = delta_snapshot - nb_samples_per_snapshot / 2; | |
1292 | } |
|
1292 | } | |
1293 |
|
1293 | |||
1294 | //***************** |
|
1294 | //***************** | |
1295 | // local parameters |
|
1295 | // local parameters | |
1296 | void set_local_nb_interrupt_f0_MAX( void ) |
|
1296 | void set_local_nb_interrupt_f0_MAX( void ) | |
1297 | { |
|
1297 | { | |
1298 | /** This function sets the value of the nb_interrupt_f0_MAX local parameter. |
|
1298 | /** This function sets the value of the nb_interrupt_f0_MAX local parameter. | |
1299 | * |
|
1299 | * | |
1300 | * This parameter is used for the SM validation only.\n |
|
1300 | * This parameter is used for the SM validation only.\n | |
1301 | * The software waits param_local.local_nb_interrupt_f0_MAX interruptions from the spectral matrices |
|
1301 | * The software waits param_local.local_nb_interrupt_f0_MAX interruptions from the spectral matrices | |
1302 | * module before launching a basic processing. |
|
1302 | * module before launching a basic processing. | |
1303 | * |
|
1303 | * | |
1304 | */ |
|
1304 | */ | |
1305 |
|
1305 | |||
1306 | param_local.local_nb_interrupt_f0_MAX = ( (parameter_dump_packet.sy_lfr_n_asm_p[0]) * 256 |
|
1306 | param_local.local_nb_interrupt_f0_MAX = ( (parameter_dump_packet.sy_lfr_n_asm_p[0]) * 256 | |
1307 | + parameter_dump_packet.sy_lfr_n_asm_p[1] ) * 100; |
|
1307 | + parameter_dump_packet.sy_lfr_n_asm_p[1] ) * 100; | |
1308 | } |
|
1308 | } | |
1309 |
|
1309 | |||
1310 | void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid ) |
|
1310 | void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid ) | |
1311 | { |
|
1311 | { | |
1312 | unsigned short *sequence_cnt; |
|
1312 | unsigned short *sequence_cnt; | |
1313 | unsigned short segmentation_grouping_flag; |
|
1313 | unsigned short segmentation_grouping_flag; | |
1314 | unsigned short new_packet_sequence_control; |
|
1314 | unsigned short new_packet_sequence_control; | |
1315 |
|
1315 | |||
1316 | if ( (sid ==SID_NORM_SWF_F0) || (sid ==SID_NORM_SWF_F1) || (sid ==SID_NORM_SWF_F2) |
|
1316 | if ( (sid ==SID_NORM_SWF_F0) || (sid ==SID_NORM_SWF_F1) || (sid ==SID_NORM_SWF_F2) | |
1317 | || (sid ==SID_NORM_CWF_F3) || (sid==SID_NORM_CWF_LONG_F3) || (sid ==SID_BURST_CWF_F2) ) |
|
1317 | || (sid ==SID_NORM_CWF_F3) || (sid==SID_NORM_CWF_LONG_F3) || (sid ==SID_BURST_CWF_F2) ) | |
1318 | { |
|
1318 | { | |
1319 | sequence_cnt = &sequenceCounters_SCIENCE_NORMAL_BURST; |
|
1319 | sequence_cnt = &sequenceCounters_SCIENCE_NORMAL_BURST; | |
1320 | } |
|
1320 | } | |
1321 | else if ( (sid ==SID_SBM1_CWF_F1) || (sid ==SID_SBM2_CWF_F2) ) |
|
1321 | else if ( (sid ==SID_SBM1_CWF_F1) || (sid ==SID_SBM2_CWF_F2) ) | |
1322 | { |
|
1322 | { | |
1323 | sequence_cnt = &sequenceCounters_SCIENCE_SBM1_SBM2; |
|
1323 | sequence_cnt = &sequenceCounters_SCIENCE_SBM1_SBM2; | |
1324 | } |
|
1324 | } | |
1325 | else |
|
1325 | else | |
1326 | { |
|
1326 | { | |
1327 | sequence_cnt = NULL; |
|
1327 | sequence_cnt = NULL; | |
1328 | PRINTF1("in increment_seq_counter_source_id *** ERR apid_destid %d not known\n", sid) |
|
1328 | PRINTF1("in increment_seq_counter_source_id *** ERR apid_destid %d not known\n", sid) | |
1329 | } |
|
1329 | } | |
1330 |
|
1330 | |||
1331 | if (sequence_cnt != NULL) |
|
1331 | if (sequence_cnt != NULL) | |
1332 | { |
|
1332 | { | |
1333 | segmentation_grouping_flag = (packet_sequence_control[ 0 ] & 0xc0) << 8; |
|
1333 | segmentation_grouping_flag = (packet_sequence_control[ 0 ] & 0xc0) << 8; | |
1334 | *sequence_cnt = (*sequence_cnt) & 0x3fff; |
|
1334 | *sequence_cnt = (*sequence_cnt) & 0x3fff; | |
1335 |
|
1335 | |||
1336 | new_packet_sequence_control = segmentation_grouping_flag | *sequence_cnt ; |
|
1336 | new_packet_sequence_control = segmentation_grouping_flag | *sequence_cnt ; | |
1337 |
|
1337 | |||
1338 | packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8); |
|
1338 | packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8); | |
1339 | packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control ); |
|
1339 | packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control ); | |
1340 |
|
1340 | |||
1341 | // increment the sequence counter for the next packet |
|
1341 | // increment the sequence counter for the next packet | |
1342 | if ( *sequence_cnt < SEQ_CNT_MAX) |
|
1342 | if ( *sequence_cnt < SEQ_CNT_MAX) | |
1343 | { |
|
1343 | { | |
1344 | *sequence_cnt = *sequence_cnt + 1; |
|
1344 | *sequence_cnt = *sequence_cnt + 1; | |
1345 | } |
|
1345 | } | |
1346 | else |
|
1346 | else | |
1347 | { |
|
1347 | { | |
1348 | *sequence_cnt = 0; |
|
1348 | *sequence_cnt = 0; | |
1349 | } |
|
1349 | } | |
1350 | } |
|
1350 | } | |
1351 | } |
|
1351 | } |
General Comments 0
You need to be logged in to leave comments.
Login now