@@ -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: Tu |
|
3 | # Generated by qmake (2.01a) (Qt 4.8.5) on: Thu Apr 24 22:14:00 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=6 -DPRINT_MESSAGES_ON_CONSOLE -DPRINT_TASK_STATISTICS -DBOOT_MESSAGES |
|
13 | DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=6 -DPRINT_MESSAGES_ON_CONSOLE -DPRINT_TASK_STATISTICS -DBOOT_MESSAGES | |
14 | CFLAGS = -pipe -O3 -Wall $(DEFINES) |
|
14 | CFLAGS = -pipe -O3 -Wall $(DEFINES) | |
15 | CXXFLAGS = -pipe -O3 -Wall $(DEFINES) |
|
15 | CXXFLAGS = -pipe -O3 -Wall $(DEFINES) | |
16 | INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header -I../src/basic_parameters |
|
16 | INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header -I../src/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 | ../src/basic_parameters/basic_parameters.c |
|
56 | ../src/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: ../src/basic_parameters/basic_parameters.c ../src/basic_parameters/basic_parameters.h |
|
243 | obj/basic_parameters.o: ../src/basic_parameters/basic_parameters.c ../src/basic_parameters/basic_parameters.h | |
244 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/basic_parameters.o ../src/basic_parameters/basic_parameters.c |
|
244 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/basic_parameters.o ../src/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,201 +1,201 | |||||
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-04-2 |
|
3 | <!-- Written by QtCreator 3.0.1, 2014-04-24T22:30:22. --> | |
4 | <qtcreator> |
|
4 | <qtcreator> | |
5 | <data> |
|
5 | <data> | |
6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
|
6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> | |
7 | <value type="int">0</value> |
|
7 | <value type="int">0</value> | |
8 | </data> |
|
8 | </data> | |
9 | <data> |
|
9 | <data> | |
10 | <variable>ProjectExplorer.Project.EditorSettings</variable> |
|
10 | <variable>ProjectExplorer.Project.EditorSettings</variable> | |
11 | <valuemap type="QVariantMap"> |
|
11 | <valuemap type="QVariantMap"> | |
12 | <value type="bool" key="EditorConfiguration.AutoIndent">true</value> |
|
12 | <value type="bool" key="EditorConfiguration.AutoIndent">true</value> | |
13 | <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value> |
|
13 | <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value> | |
14 | <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value> |
|
14 | <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value> | |
15 | <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0"> |
|
15 | <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0"> | |
16 | <value type="QString" key="language">Cpp</value> |
|
16 | <value type="QString" key="language">Cpp</value> | |
17 | <valuemap type="QVariantMap" key="value"> |
|
17 | <valuemap type="QVariantMap" key="value"> | |
18 | <value type="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-Qt 4.8.3 in PATH (System)</value> |
|
54 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.3 in PATH (System)</value> | |
55 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.3 in PATH (System)</value> |
|
55 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.3 in PATH (System)</value> | |
56 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{be73cf6a-f9d8-4d5a-8adf-adc2d83e2e44}</value> |
|
56 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{be73cf6a-f9d8-4d5a-8adf-adc2d83e2e44}</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">true</value> |
|
180 | <value type="bool" key="RunConfiguration.UseCppDebugger">true</value> | |
181 | <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value> |
|
181 | <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</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.TargetCount</variable> |
|
190 | <variable>ProjectExplorer.Project.TargetCount</variable> | |
191 | <value type="int">1</value> |
|
191 | <value type="int">1</value> | |
192 | </data> |
|
192 | </data> | |
193 | <data> |
|
193 | <data> | |
194 | <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable> |
|
194 | <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable> | |
195 | <value type="QByteArray">{cdbf9cdc-1e84-406e-889b-c4feef49e75c}</value> |
|
195 | <value type="QByteArray">{cdbf9cdc-1e84-406e-889b-c4feef49e75c}</value> | |
196 | </data> |
|
196 | </data> | |
197 | <data> |
|
197 | <data> | |
198 | <variable>ProjectExplorer.Project.Updater.FileVersion</variable> |
|
198 | <variable>ProjectExplorer.Project.Updater.FileVersion</variable> | |
199 | <value type="int">15</value> |
|
199 | <value type="int">15</value> | |
200 | </data> |
|
200 | </data> | |
201 | </qtcreator> |
|
201 | </qtcreator> |
@@ -1,284 +1,283 | |||||
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 { |
|
21 | typedef struct { | |
22 |
unsigned int norm_bp1 |
|
22 | unsigned int norm_bp1; | |
23 |
unsigned int norm_bp2 |
|
23 | unsigned int norm_bp2; | |
24 |
unsigned int norm_asm |
|
24 | unsigned int norm_asm; | |
25 |
unsigned int burst_sbm_bp1 |
|
25 | unsigned int burst_sbm_bp1; | |
26 |
unsigned int burst_sbm_bp2 |
|
26 | unsigned int burst_sbm_bp2; | |
27 |
unsigned int burst_bp1 |
|
27 | unsigned int burst_bp1; | |
28 |
unsigned int burst_bp2 |
|
28 | unsigned int burst_bp2; | |
29 |
unsigned int sbm1_bp1 |
|
29 | unsigned int sbm1_bp1; | |
30 |
unsigned int sbm1_bp2 |
|
30 | unsigned int sbm1_bp2; | |
31 |
unsigned int sbm2_bp1 |
|
31 | unsigned int sbm2_bp1; | |
32 |
unsigned int sbm2_bp2 |
|
32 | unsigned int sbm2_bp2; | |
33 | } nb_sm_before_bp_asm_f0; |
|
33 | } nb_sm_before_bp_asm_f0; | |
34 |
|
34 | |||
35 | typedef struct { |
|
35 | typedef struct { | |
36 | unsigned int norm_bp1; |
|
36 | unsigned int norm_bp1; | |
37 | unsigned int norm_bp2; |
|
37 | unsigned int norm_bp2; | |
38 | unsigned int norm_asm; |
|
38 | unsigned int norm_asm; | |
39 | unsigned int burst_sbm_bp1; |
|
39 | unsigned int burst_sbm_bp1; | |
40 | unsigned int burst_sbm_bp2; |
|
40 | unsigned int burst_sbm_bp2; | |
41 | unsigned int burst_bp1; |
|
41 | unsigned int burst_bp1; | |
42 | unsigned int burst_bp2; |
|
42 | unsigned int burst_bp2; | |
43 | unsigned int sbm2_bp1; |
|
43 | unsigned int sbm2_bp1; | |
44 | unsigned int sbm2_bp2; |
|
44 | unsigned int sbm2_bp2; | |
45 | } nb_sm_before_bp_asm_f1; |
|
45 | } nb_sm_before_bp_asm_f1; | |
46 |
|
46 | |||
47 | typedef struct { |
|
47 | typedef struct { | |
48 | unsigned int norm_bp1_f2; |
|
48 | unsigned int norm_bp1_f2; | |
49 | unsigned int norm_bp2_f2; |
|
49 | unsigned int norm_bp2_f2; | |
50 | unsigned int norm_asm_f2; |
|
50 | unsigned int norm_asm_f2; | |
51 | unsigned int burst_sbm_bp1_f2; |
|
51 | unsigned int burst_sbm_bp1_f2; | |
52 | unsigned int burst_sbm_bp2_f2; |
|
52 | unsigned int burst_sbm_bp2_f2; | |
53 | unsigned int burst_bp1_f2; |
|
53 | unsigned int burst_bp1_f2; | |
54 | unsigned int burst_bp2_f2; |
|
54 | unsigned int burst_bp2_f2; | |
55 | unsigned int sbm2_bp1_f2; |
|
55 | unsigned int sbm2_bp1_f2; | |
56 | unsigned int sbm2_bp2_f2; |
|
56 | unsigned int sbm2_bp2_f2; | |
57 | } nb_sm_before_bp_asm_f2; |
|
57 | } nb_sm_before_bp_asm_f2; | |
58 |
|
58 | |||
59 | //************************ |
|
59 | //************************ | |
60 | // flight software version |
|
60 | // flight software version | |
61 | // this parameters is handled by the Qt project options |
|
61 | // this parameters is handled by the Qt project options | |
62 |
|
62 | |||
63 | #define NB_PACKETS_PER_GROUP_OF_CWF 8 // 8 packets containing 336 blk |
|
63 | #define NB_PACKETS_PER_GROUP_OF_CWF 8 // 8 packets containing 336 blk | |
64 | #define NB_PACKETS_PER_GROUP_OF_CWF_LIGHT 4 // 4 packets containing 672 blk |
|
64 | #define NB_PACKETS_PER_GROUP_OF_CWF_LIGHT 4 // 4 packets containing 672 blk | |
65 | #define NB_SAMPLES_PER_SNAPSHOT 2688 // 336 * 8 = 672 * 4 = 2688 |
|
65 | #define NB_SAMPLES_PER_SNAPSHOT 2688 // 336 * 8 = 672 * 4 = 2688 | |
66 | #define TIME_OFFSET 2 |
|
66 | #define TIME_OFFSET 2 | |
67 | #define TIME_OFFSET_IN_BYTES 8 |
|
67 | #define TIME_OFFSET_IN_BYTES 8 | |
68 | #define WAVEFORM_EXTENDED_HEADER_OFFSET 22 |
|
68 | #define WAVEFORM_EXTENDED_HEADER_OFFSET 22 | |
69 | #define NB_BYTES_SWF_BLK (2 * 6) |
|
69 | #define NB_BYTES_SWF_BLK (2 * 6) | |
70 | #define NB_WORDS_SWF_BLK 3 |
|
70 | #define NB_WORDS_SWF_BLK 3 | |
71 | #define NB_BYTES_CWF3_LIGHT_BLK 6 |
|
71 | #define NB_BYTES_CWF3_LIGHT_BLK 6 | |
72 | #define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8 |
|
72 | #define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8 | |
73 | #define NB_RING_NODES_F0 3 // AT LEAST 3 |
|
73 | #define NB_RING_NODES_F0 3 // AT LEAST 3 | |
74 | #define NB_RING_NODES_F1 5 // AT LEAST 3 |
|
74 | #define NB_RING_NODES_F1 5 // AT LEAST 3 | |
75 | #define NB_RING_NODES_F2 5 // AT LEAST 3 |
|
75 | #define NB_RING_NODES_F2 5 // AT LEAST 3 | |
76 |
|
76 | |||
77 | //********** |
|
77 | //********** | |
78 | // LFR MODES |
|
78 | // LFR MODES | |
79 | #define LFR_MODE_STANDBY 0 |
|
79 | #define LFR_MODE_STANDBY 0 | |
80 | #define LFR_MODE_NORMAL 1 |
|
80 | #define LFR_MODE_NORMAL 1 | |
81 | #define LFR_MODE_BURST 2 |
|
81 | #define LFR_MODE_BURST 2 | |
82 | #define LFR_MODE_SBM1 3 |
|
82 | #define LFR_MODE_SBM1 3 | |
83 | #define LFR_MODE_SBM2 4 |
|
83 | #define LFR_MODE_SBM2 4 | |
84 |
|
84 | |||
85 | #define TDS_MODE_LFM 5 |
|
85 | #define TDS_MODE_LFM 5 | |
86 | #define TDS_MODE_STANDBY 0 |
|
86 | #define TDS_MODE_STANDBY 0 | |
87 | #define TDS_MODE_NORMAL 1 |
|
87 | #define TDS_MODE_NORMAL 1 | |
88 | #define TDS_MODE_BURST 2 |
|
88 | #define TDS_MODE_BURST 2 | |
89 | #define TDS_MODE_SBM1 3 |
|
89 | #define TDS_MODE_SBM1 3 | |
90 | #define TDS_MODE_SBM2 4 |
|
90 | #define TDS_MODE_SBM2 4 | |
91 |
|
91 | |||
92 | #define THR_MODE_STANDBY 0 |
|
92 | #define THR_MODE_STANDBY 0 | |
93 | #define THR_MODE_NORMAL 1 |
|
93 | #define THR_MODE_NORMAL 1 | |
94 | #define THR_MODE_BURST 2 |
|
94 | #define THR_MODE_BURST 2 | |
95 |
|
95 | |||
96 | #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0 |
|
96 | #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0 | |
97 | #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1 |
|
97 | #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1 | |
98 | #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2 |
|
98 | #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2 | |
99 | #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3 |
|
99 | #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3 | |
100 | #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4 |
|
100 | #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4 | |
101 | #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5 |
|
101 | #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5 | |
102 | #define RTEMS_EVENT_NORM_BP1_F0 RTEMS_EVENT_6 |
|
102 | #define RTEMS_EVENT_NORM_BP1_F0 RTEMS_EVENT_6 | |
103 | #define RTEMS_EVENT_NORM_BP2_F0 RTEMS_EVENT_7 |
|
103 | #define RTEMS_EVENT_NORM_BP2_F0 RTEMS_EVENT_7 | |
104 | #define RTEMS_EVENT_NORM_ASM_F0 RTEMS_EVENT_8 |
|
104 | #define RTEMS_EVENT_NORM_ASM_F0 RTEMS_EVENT_8 | |
105 | #define RTEMS_EVENT_NORM_BP1_F1 RTEMS_EVENT_9 |
|
105 | #define RTEMS_EVENT_NORM_BP1_F1 RTEMS_EVENT_9 | |
106 | #define RTEMS_EVENT_NORM_BP2_F1 RTEMS_EVENT_10 |
|
106 | #define RTEMS_EVENT_NORM_BP2_F1 RTEMS_EVENT_10 | |
107 | #define RTEMS_EVENT_NORM_ASM_F1 RTEMS_EVENT_11 |
|
107 | #define RTEMS_EVENT_NORM_ASM_F1 RTEMS_EVENT_11 | |
108 | #define RTEMS_EVENT_NORM_BP1_F2 RTEMS_EVENT_12 |
|
108 | #define RTEMS_EVENT_NORM_BP1_F2 RTEMS_EVENT_12 | |
109 | #define RTEMS_EVENT_NORM_BP2_F2 RTEMS_EVENT_13 |
|
109 | #define RTEMS_EVENT_NORM_BP2_F2 RTEMS_EVENT_13 | |
110 | #define RTEMS_EVENT_NORM_ASM_F2 RTEMS_EVENT_14 |
|
110 | #define RTEMS_EVENT_NORM_ASM_F2 RTEMS_EVENT_14 | |
111 | #define RTEMS_EVENT_BURST_SBM_BP1_F0 RTEMS_EVENT_15 |
|
111 | #define RTEMS_EVENT_BURST_SBM_BP1_F0 RTEMS_EVENT_15 | |
112 | #define RTEMS_EVENT_BURST_SBM_BP2_F0 RTEMS_EVENT_16 |
|
112 | #define RTEMS_EVENT_BURST_SBM_BP2_F0 RTEMS_EVENT_16 | |
113 | #define RTEMS_EVENT_BURST_SBM_BP1_F1 RTEMS_EVENT_17 |
|
113 | #define RTEMS_EVENT_BURST_SBM_BP1_F1 RTEMS_EVENT_17 | |
114 | #define RTEMS_EVENT_BURST_SBM_BP2_F1 RTEMS_EVENT_18 |
|
114 | #define RTEMS_EVENT_BURST_SBM_BP2_F1 RTEMS_EVENT_18 | |
115 | #define RTEMS_EVENT_BURST_SBM_BP1_F2 RTEMS_EVENT_19 |
|
115 | #define RTEMS_EVENT_BURST_SBM_BP1_F2 RTEMS_EVENT_19 | |
116 | #define RTEMS_EVENT_BURST_SBM_BP2_F2 RTEMS_EVENT_20 |
|
116 | #define RTEMS_EVENT_BURST_SBM_BP2_F2 RTEMS_EVENT_20 | |
117 |
|
117 | |||
118 | //**************************** |
|
118 | //**************************** | |
119 | // LFR DEFAULT MODE PARAMETERS |
|
119 | // LFR DEFAULT MODE PARAMETERS | |
120 | // COMMON |
|
120 | // COMMON | |
121 | #define DEFAULT_SY_LFR_COMMON0 0x00 |
|
121 | #define DEFAULT_SY_LFR_COMMON0 0x00 | |
122 | #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0 |
|
122 | #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0 | |
123 | // NORM |
|
123 | // NORM | |
124 | #define SY_LFR_N_SWF_L 2048 // nb sample |
|
124 | #define SY_LFR_N_SWF_L 2048 // nb sample | |
125 | #define SY_LFR_N_SWF_P 300 // sec |
|
125 | #define SY_LFR_N_SWF_P 300 // sec | |
126 | #define SY_LFR_N_ASM_P 3600 // sec |
|
126 | #define SY_LFR_N_ASM_P 3600 // sec | |
127 | #define SY_LFR_N_BP_P0 4 // sec |
|
127 | #define SY_LFR_N_BP_P0 4 // sec | |
128 | #define SY_LFR_N_BP_P1 20 // sec |
|
128 | #define SY_LFR_N_BP_P1 20 // sec | |
129 | #define SY_LFR_N_CWF_LONG_F3 0 // 0 => production of light continuous waveforms at f3 |
|
129 | #define SY_LFR_N_CWF_LONG_F3 0 // 0 => production of light continuous waveforms at f3 | |
130 | #define MIN_DELTA_SNAPSHOT 16 // sec |
|
130 | #define MIN_DELTA_SNAPSHOT 16 // sec | |
131 | // BURST |
|
131 | // BURST | |
132 | #define DEFAULT_SY_LFR_B_BP_P0 1 // sec |
|
132 | #define DEFAULT_SY_LFR_B_BP_P0 1 // sec | |
133 | #define DEFAULT_SY_LFR_B_BP_P1 5 // sec |
|
133 | #define DEFAULT_SY_LFR_B_BP_P1 5 // sec | |
134 | // SBM1 |
|
134 | // SBM1 | |
135 | #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec |
|
135 | #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec | |
136 | #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec |
|
136 | #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec | |
137 | // SBM2 |
|
137 | // SBM2 | |
138 | #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec |
|
138 | #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec | |
139 | #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec |
|
139 | #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec | |
140 | // ADDITIONAL PARAMETERS |
|
140 | // ADDITIONAL PARAMETERS | |
141 | #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms |
|
141 | #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms | |
142 | #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s |
|
142 | #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s | |
143 | // STATUS WORD |
|
143 | // STATUS WORD | |
144 | #define DEFAULT_STATUS_WORD_BYTE0 0x0d // [0000] [1] [101] mode 4 bits / SPW enabled 1 bit / state is run 3 bits |
|
144 | #define DEFAULT_STATUS_WORD_BYTE0 0x0d // [0000] [1] [101] mode 4 bits / SPW enabled 1 bit / state is run 3 bits | |
145 | #define DEFAULT_STATUS_WORD_BYTE1 0x00 |
|
145 | #define DEFAULT_STATUS_WORD_BYTE1 0x00 | |
146 | // |
|
146 | // | |
147 | #define SY_LFR_DPU_CONNECT_TIMEOUT 100 // 100 * 10 ms = 1 s |
|
147 | #define SY_LFR_DPU_CONNECT_TIMEOUT 100 // 100 * 10 ms = 1 s | |
148 | #define SY_LFR_DPU_CONNECT_ATTEMPT 3 |
|
148 | #define SY_LFR_DPU_CONNECT_ATTEMPT 3 | |
149 | //**************************** |
|
149 | //**************************** | |
150 |
|
150 | |||
151 | //***************************** |
|
151 | //***************************** | |
152 | // APB REGISTERS BASE ADDRESSES |
|
152 | // APB REGISTERS BASE ADDRESSES | |
153 | #define REGS_ADDR_APBUART 0x80000100 |
|
153 | #define REGS_ADDR_APBUART 0x80000100 | |
154 | #define REGS_ADDR_GPTIMER 0x80000300 |
|
154 | #define REGS_ADDR_GPTIMER 0x80000300 | |
155 | #define REGS_ADDR_GRSPW 0x80000500 |
|
155 | #define REGS_ADDR_GRSPW 0x80000500 | |
156 | #define REGS_ADDR_TIME_MANAGEMENT 0x80000600 |
|
156 | #define REGS_ADDR_TIME_MANAGEMENT 0x80000600 | |
157 | #define REGS_ADDR_GRGPIO 0x80000b00 |
|
157 | #define REGS_ADDR_GRGPIO 0x80000b00 | |
158 |
|
158 | |||
159 | #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00 |
|
159 | #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00 | |
160 | #define REGS_ADDR_WAVEFORM_PICKER 0x80000f40 |
|
160 | #define REGS_ADDR_WAVEFORM_PICKER 0x80000f40 | |
161 |
|
161 | |||
162 | #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff |
|
162 | #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff | |
163 | #define APBUART_CTRL_REG_MASK_TE 0x00000002 |
|
163 | #define APBUART_CTRL_REG_MASK_TE 0x00000002 | |
164 | #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50) |
|
164 | #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50) | |
165 |
|
165 | |||
166 | //********** |
|
166 | //********** | |
167 | // IRQ LINES |
|
167 | // IRQ LINES | |
168 | #define IRQ_SM_SIMULATOR 9 |
|
168 | #define IRQ_SM_SIMULATOR 9 | |
169 | #define IRQ_SPARC_SM_SIMULATOR 0x19 // see sparcv8.pdf p.76 for interrupt levels |
|
169 | #define IRQ_SPARC_SM_SIMULATOR 0x19 // see sparcv8.pdf p.76 for interrupt levels | |
170 | #define IRQ_WAVEFORM_PICKER 14 |
|
170 | #define IRQ_WAVEFORM_PICKER 14 | |
171 | #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels |
|
171 | #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels | |
172 | #define IRQ_SPECTRAL_MATRIX 6 |
|
172 | #define IRQ_SPECTRAL_MATRIX 6 | |
173 | #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels |
|
173 | #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels | |
174 |
|
174 | |||
175 | //***** |
|
175 | //***** | |
176 | // TIME |
|
176 | // TIME | |
177 | #define CLKDIV_SM_SIMULATOR (10416 - 1) // 10 ms => nominal is 1/96 = 0.010416667, 10417 - 1 = 10416 |
|
177 | #define CLKDIV_SM_SIMULATOR (10416 - 1) // 10 ms => nominal is 1/96 = 0.010416667, 10417 - 1 = 10416 | |
178 | #define TIMER_SM_SIMULATOR 1 |
|
178 | #define TIMER_SM_SIMULATOR 1 | |
179 | #define HK_PERIOD 100 // 100 * 10ms => 1s |
|
179 | #define HK_PERIOD 100 // 100 * 10ms => 1s | |
180 | #define SY_LFR_TIME_SYN_TIMEOUT_in_ms 2000 |
|
180 | #define SY_LFR_TIME_SYN_TIMEOUT_in_ms 2000 | |
181 | #define SY_LFR_TIME_SYN_TIMEOUT_in_ticks 200 // 200 * 10 ms = 2 s |
|
181 | #define SY_LFR_TIME_SYN_TIMEOUT_in_ticks 200 // 200 * 10 ms = 2 s | |
182 |
|
182 | |||
183 | //********** |
|
183 | //********** | |
184 | // LPP CODES |
|
184 | // LPP CODES | |
185 | #define LFR_SUCCESSFUL 0 |
|
185 | #define LFR_SUCCESSFUL 0 | |
186 | #define LFR_DEFAULT 1 |
|
186 | #define LFR_DEFAULT 1 | |
187 | #define LFR_EXE_ERROR 2 |
|
187 | #define LFR_EXE_ERROR 2 | |
188 |
|
188 | |||
189 | //****** |
|
189 | //****** | |
190 | // RTEMS |
|
190 | // RTEMS | |
191 | #define TASKID_RECV 1 |
|
191 | #define TASKID_RECV 1 | |
192 | #define TASKID_ACTN 2 |
|
192 | #define TASKID_ACTN 2 | |
193 | #define TASKID_SPIQ 3 |
|
193 | #define TASKID_SPIQ 3 | |
194 | #define TASKID_STAT 4 |
|
194 | #define TASKID_STAT 4 | |
195 | #define TASKID_AVF0 5 |
|
195 | #define TASKID_AVF0 5 | |
196 | #define TASKID_SWBD 6 |
|
196 | #define TASKID_SWBD 6 | |
197 | #define TASKID_WFRM 7 |
|
197 | #define TASKID_WFRM 7 | |
198 | #define TASKID_DUMB 8 |
|
198 | #define TASKID_DUMB 8 | |
199 | #define TASKID_HOUS 9 |
|
199 | #define TASKID_HOUS 9 | |
200 | #define TASKID_PRC0 10 |
|
200 | #define TASKID_PRC0 10 | |
201 | #define TASKID_CWF3 11 |
|
201 | #define TASKID_CWF3 11 | |
202 | #define TASKID_CWF2 12 |
|
202 | #define TASKID_CWF2 12 | |
203 | #define TASKID_CWF1 13 |
|
203 | #define TASKID_CWF1 13 | |
204 | #define TASKID_SEND 14 |
|
204 | #define TASKID_SEND 14 | |
205 | #define TASKID_WTDG 15 |
|
205 | #define TASKID_WTDG 15 | |
206 | #define TASKID_AVF1 16 |
|
206 | #define TASKID_AVF1 16 | |
207 | #define TASKID_PRC1 17 |
|
207 | #define TASKID_PRC1 17 | |
208 |
|
208 | |||
209 | #define TASK_PRIORITY_SPIQ 5 |
|
209 | #define TASK_PRIORITY_SPIQ 5 | |
210 | //#define TASK_PRIORITY_SMIQ 10 |
|
|||
211 | #define TASK_PRIORITY_WTDG 20 |
|
210 | #define TASK_PRIORITY_WTDG 20 | |
212 | #define TASK_PRIORITY_HOUS 30 |
|
211 | #define TASK_PRIORITY_HOUS 30 | |
213 | #define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together |
|
212 | #define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together | |
214 | #define TASK_PRIORITY_CWF2 35 // |
|
213 | #define TASK_PRIORITY_CWF2 35 // | |
215 | #define TASK_PRIORITY_SWBD 37 // SWBD has a lower priority than WFRM, this is to extract the snapshot before sending it |
|
214 | #define TASK_PRIORITY_SWBD 37 // SWBD has a lower priority than WFRM, this is to extract the snapshot before sending it | |
216 | #define TASK_PRIORITY_WFRM 40 |
|
215 | #define TASK_PRIORITY_WFRM 40 | |
217 | #define TASK_PRIORITY_CWF3 40 // there is a printf in this function, be careful with its priority wrt CWF1 |
|
216 | #define TASK_PRIORITY_CWF3 40 // there is a printf in this function, be careful with its priority wrt CWF1 | |
218 | #define TASK_PRIORITY_SEND 45 |
|
217 | #define TASK_PRIORITY_SEND 45 | |
219 | #define TASK_PRIORITY_RECV 50 |
|
218 | #define TASK_PRIORITY_RECV 50 | |
220 | #define TASK_PRIORITY_ACTN 50 |
|
219 | #define TASK_PRIORITY_ACTN 50 | |
221 | #define TASK_PRIORITY_AVF0 60 |
|
220 | #define TASK_PRIORITY_AVF0 60 | |
|
221 | #define TASK_PRIORITY_AVF1 70 | |||
222 | #define TASK_PRIORITY_PRC0 100 |
|
222 | #define TASK_PRIORITY_PRC0 100 | |
223 | #define TASK_PRIORITY_PRC1 100 |
|
223 | #define TASK_PRIORITY_PRC1 100 | |
224 | #define TASK_PRIORITY_AVF1 60 |
|
|||
225 | #define TASK_PRIORITY_STAT 200 |
|
224 | #define TASK_PRIORITY_STAT 200 | |
226 | #define TASK_PRIORITY_DUMB 200 |
|
225 | #define TASK_PRIORITY_DUMB 200 | |
227 |
|
226 | |||
228 | #define MSG_QUEUE_COUNT_RECV 10 |
|
227 | #define MSG_QUEUE_COUNT_RECV 10 | |
229 | #define MSG_QUEUE_COUNT_SEND 50 |
|
228 | #define MSG_QUEUE_COUNT_SEND 50 | |
230 | #define MSG_QUEUE_COUNT_PRC0 10 |
|
229 | #define MSG_QUEUE_COUNT_PRC0 10 | |
231 | #define MSG_QUEUE_COUNT_PRC1 10 |
|
230 | #define MSG_QUEUE_COUNT_PRC1 10 | |
232 | #define MSG_QUEUE_SIZE_SEND 810 // 806 + 4 => TM_LFR_SCIENCE_BURST_BP2_F1 |
|
231 | #define MSG_QUEUE_SIZE_SEND 810 // 806 + 4 => TM_LFR_SCIENCE_BURST_BP2_F1 | |
233 | #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options |
|
232 | #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options | |
234 | #define MSG_QUEUE_SIZE_PRC0 20 // two pointers and one rtems_event + 2 integers |
|
233 | #define MSG_QUEUE_SIZE_PRC0 20 // two pointers and one rtems_event + 2 integers | |
235 | #define MSG_QUEUE_SIZE_PRC1 20 // two pointers and one rtems_event + 2 integers |
|
234 | #define MSG_QUEUE_SIZE_PRC1 20 // two pointers and one rtems_event + 2 integers | |
236 |
|
235 | |||
237 | #define QUEUE_RECV 0 |
|
236 | #define QUEUE_RECV 0 | |
238 | #define QUEUE_SEND 1 |
|
237 | #define QUEUE_SEND 1 | |
239 | #define QUEUE_PRC0 2 |
|
238 | #define QUEUE_PRC0 2 | |
240 | #define QUEUE_PRC1 3 |
|
239 | #define QUEUE_PRC1 3 | |
241 |
|
240 | |||
242 | //******* |
|
241 | //******* | |
243 | // MACROS |
|
242 | // MACROS | |
244 | #ifdef PRINT_MESSAGES_ON_CONSOLE |
|
243 | #ifdef PRINT_MESSAGES_ON_CONSOLE | |
245 | #define PRINTF(x) printf(x); |
|
244 | #define PRINTF(x) printf(x); | |
246 | #define PRINTF1(x,y) printf(x,y); |
|
245 | #define PRINTF1(x,y) printf(x,y); | |
247 | #define PRINTF2(x,y,z) printf(x,y,z); |
|
246 | #define PRINTF2(x,y,z) printf(x,y,z); | |
248 | #else |
|
247 | #else | |
249 | #define PRINTF(x) ; |
|
248 | #define PRINTF(x) ; | |
250 | #define PRINTF1(x,y) ; |
|
249 | #define PRINTF1(x,y) ; | |
251 | #define PRINTF2(x,y,z) ; |
|
250 | #define PRINTF2(x,y,z) ; | |
252 | #endif |
|
251 | #endif | |
253 |
|
252 | |||
254 | #ifdef BOOT_MESSAGES |
|
253 | #ifdef BOOT_MESSAGES | |
255 | #define BOOT_PRINTF(x) printf(x); |
|
254 | #define BOOT_PRINTF(x) printf(x); | |
256 | #define BOOT_PRINTF1(x,y) printf(x,y); |
|
255 | #define BOOT_PRINTF1(x,y) printf(x,y); | |
257 | #define BOOT_PRINTF2(x,y,z) printf(x,y,z); |
|
256 | #define BOOT_PRINTF2(x,y,z) printf(x,y,z); | |
258 | #else |
|
257 | #else | |
259 | #define BOOT_PRINTF(x) ; |
|
258 | #define BOOT_PRINTF(x) ; | |
260 | #define BOOT_PRINTF1(x,y) ; |
|
259 | #define BOOT_PRINTF1(x,y) ; | |
261 | #define BOOT_PRINTF2(x,y,z) ; |
|
260 | #define BOOT_PRINTF2(x,y,z) ; | |
262 | #endif |
|
261 | #endif | |
263 |
|
262 | |||
264 | #ifdef DEBUG_MESSAGES |
|
263 | #ifdef DEBUG_MESSAGES | |
265 | #define DEBUG_PRINTF(x) printf(x); |
|
264 | #define DEBUG_PRINTF(x) printf(x); | |
266 | #define DEBUG_PRINTF1(x,y) printf(x,y); |
|
265 | #define DEBUG_PRINTF1(x,y) printf(x,y); | |
267 | #define DEBUG_PRINTF2(x,y,z) printf(x,y,z); |
|
266 | #define DEBUG_PRINTF2(x,y,z) printf(x,y,z); | |
268 | #else |
|
267 | #else | |
269 | #define DEBUG_PRINTF(x) ; |
|
268 | #define DEBUG_PRINTF(x) ; | |
270 | #define DEBUG_PRINTF1(x,y) ; |
|
269 | #define DEBUG_PRINTF1(x,y) ; | |
271 | #define DEBUG_PRINTF2(x,y,z) ; |
|
270 | #define DEBUG_PRINTF2(x,y,z) ; | |
272 | #endif |
|
271 | #endif | |
273 |
|
272 | |||
274 | #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period |
|
273 | #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period | |
275 |
|
274 | |||
276 | struct param_local_str{ |
|
275 | struct param_local_str{ | |
277 | unsigned int local_sbm1_nb_cwf_sent; |
|
276 | unsigned int local_sbm1_nb_cwf_sent; | |
278 | unsigned int local_sbm1_nb_cwf_max; |
|
277 | unsigned int local_sbm1_nb_cwf_max; | |
279 | unsigned int local_sbm2_nb_cwf_sent; |
|
278 | unsigned int local_sbm2_nb_cwf_sent; | |
280 | unsigned int local_sbm2_nb_cwf_max; |
|
279 | unsigned int local_sbm2_nb_cwf_max; | |
281 | unsigned int local_nb_interrupt_f0_MAX; |
|
280 | unsigned int local_nb_interrupt_f0_MAX; | |
282 | }; |
|
281 | }; | |
283 |
|
282 | |||
284 | #endif // FSW_PARAMS_H_INCLUDED |
|
283 | #endif // FSW_PARAMS_H_INCLUDED |
@@ -1,73 +1,63 | |||||
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_NORM_BP1_F0 99 // 11 * 9 = 99 |
|
7 | #define TOTAL_SIZE_NORM_BP1_F0 99 // 11 * 9 = 99 | |
8 | #define TOTAL_SIZE_NORM_BP1_F1 117 // 13 * 9 = 117 |
|
8 | #define TOTAL_SIZE_NORM_BP1_F1 117 // 13 * 9 = 117 | |
9 | #define TOTAL_SIZE_NORM_BP1_F2 108 // 12 * 9 = 108 |
|
9 | #define TOTAL_SIZE_NORM_BP1_F2 108 // 12 * 9 = 108 | |
10 | #define TOTAL_SIZE_SBM1_BP1_F0 198 // 22 * 9 = 198 |
|
10 | #define TOTAL_SIZE_SBM1_BP1_F0 198 // 22 * 9 = 198 | |
11 | // |
|
11 | // | |
12 | #define NB_RING_NODES_SM_F0 12 // AT LEAST 3 |
|
12 | #define NB_RING_NODES_SM_F0 12 // AT LEAST 3 | |
13 | #define NB_RING_NODES_ASM_BURST_SBM_F0 10 // AT LEAST 3 |
|
13 | #define NB_RING_NODES_ASM_BURST_SBM_F0 10 // AT LEAST 3 | |
14 | #define NB_RING_NODES_ASM_NORM_F0 10 // AT LEAST 3 |
|
14 | #define NB_RING_NODES_ASM_NORM_F0 10 // AT LEAST 3 | |
15 | #define NB_RING_NODES_SM_F1 3 // AT LEAST 3 |
|
15 | #define NB_RING_NODES_SM_F1 3 // AT LEAST 3 | |
16 | #define NB_RING_NODES_ASM_BURST_SBM_F1 5 // AT LEAST 3 |
|
16 | #define NB_RING_NODES_ASM_BURST_SBM_F1 5 // AT LEAST 3 | |
17 | #define NB_RING_NODES_ASM_NORM_F1 5 // AT LEAST 3 |
|
17 | #define NB_RING_NODES_ASM_NORM_F1 5 // AT LEAST 3 | |
18 | #define NB_RING_NODES_SM_F2 3 // AT LEAST 3 |
|
18 | #define NB_RING_NODES_SM_F2 3 // AT LEAST 3 | |
19 | // |
|
19 | // | |
20 | #define NB_BINS_PER_ASM_F0 88 |
|
20 | #define NB_BINS_PER_ASM_F0 88 | |
21 | #define NB_BINS_PER_PKT_ASM_F0 44 |
|
21 | #define NB_BINS_PER_PKT_ASM_F0 44 | |
22 | #define TOTAL_SIZE_ASM_F0_IN_BYTES 4400 // 25 * 88 * 2 |
|
22 | #define TOTAL_SIZE_ASM_F0_IN_BYTES 4400 // 25 * 88 * 2 | |
23 | #define ASM_F0_INDICE_START 17 // 88 bins |
|
23 | #define ASM_F0_INDICE_START 17 // 88 bins | |
24 | #define ASM_F0_INDICE_STOP 104 // 2 packets of 44 bins |
|
24 | #define ASM_F0_INDICE_STOP 104 // 2 packets of 44 bins | |
25 | // |
|
25 | // | |
26 | #define NB_BINS_PER_ASM_F1 104 |
|
26 | #define NB_BINS_PER_ASM_F1 104 | |
27 | #define NB_BINS_PER_PKT_ASM_F1 52 |
|
27 | #define NB_BINS_PER_PKT_ASM_F1 52 | |
28 |
#define TOTAL_SIZE_ASM_F1 2 |
|
28 | #define TOTAL_SIZE_ASM_F1_IN_BYTES 5200 // 25 * 104 * 2 | |
29 | #define ASM_F1_INDICE_START 6 // 104 bins |
|
29 | #define ASM_F1_INDICE_START 6 // 104 bins | |
30 | #define ASM_F1_INDICE_STOP 109 // 2 packets of 52 bins |
|
30 | #define ASM_F1_INDICE_STOP 109 // 2 packets of 52 bins | |
31 | // |
|
31 | // | |
32 | #define NB_BINS_PER_ASM_F2 96 |
|
32 | #define NB_BINS_PER_ASM_F2 96 | |
33 | #define NB_BINS_PER_PKT_ASM_F2 48 |
|
33 | #define NB_BINS_PER_PKT_ASM_F2 48 | |
34 |
#define TOTAL_SIZE_ASM_F2 |
|
34 | #define TOTAL_SIZE_ASM_F2_IN_BYTES 4800 // 25 * 96 * 2 | |
35 | #define ASM_F2_INDICE_START 7 // 96 bins |
|
35 | #define ASM_F2_INDICE_START 7 // 96 bins | |
36 | #define ASM_F2_INDICE_STOP 102 // 2 packets of 48 bins |
|
36 | #define ASM_F2_INDICE_STOP 102 // 2 packets of 48 bins | |
37 | // |
|
37 | // | |
38 | #define NB_BINS_COMPRESSED_SM_F0 11 |
|
38 | #define NB_BINS_COMPRESSED_SM_F0 11 | |
39 | #define NB_BINS_COMPRESSED_SM_F1 13 |
|
39 | #define NB_BINS_COMPRESSED_SM_F1 13 | |
40 | #define NB_BINS_COMPRESSED_SM_F2 12 |
|
40 | #define NB_BINS_COMPRESSED_SM_F2 12 | |
41 | #define NB_BINS_COMPRESSED_SM_SBM_F0 22 |
|
41 | #define NB_BINS_COMPRESSED_SM_SBM_F0 22 | |
42 | #define NB_BINS_COMPRESSED_SM_SBM_F1 26 |
|
42 | #define NB_BINS_COMPRESSED_SM_SBM_F1 26 | |
43 | #define NB_BINS_COMPRESSED_SM_SBM_F2 24 |
|
43 | #define NB_BINS_COMPRESSED_SM_SBM_F2 24 | |
44 | // |
|
44 | // | |
45 | #define NB_BINS_TO_AVERAGE_ASM_F0 8 |
|
45 | #define NB_BINS_TO_AVERAGE_ASM_F0 8 | |
46 | #define NB_BINS_TO_AVERAGE_ASM_F1 8 |
|
46 | #define NB_BINS_TO_AVERAGE_ASM_F1 8 | |
47 | #define NB_BINS_TO_AVERAGE_ASM_F2 8 |
|
47 | #define NB_BINS_TO_AVERAGE_ASM_F2 8 | |
48 | #define NB_BINS_TO_AVERAGE_ASM_SBM_F0 4 |
|
48 | #define NB_BINS_TO_AVERAGE_ASM_SBM_F0 4 | |
49 | #define NB_BINS_TO_AVERAGE_ASM_SBM_F1 4 |
|
49 | #define NB_BINS_TO_AVERAGE_ASM_SBM_F1 4 | |
50 | #define NB_BINS_TO_AVERAGE_ASM_SBM_F2 4 |
|
50 | #define NB_BINS_TO_AVERAGE_ASM_SBM_F2 4 | |
51 | // |
|
51 | // | |
52 | #define TOTAL_SIZE_COMPRESSED_ASM_F0 275 // 11 * 25 WORDS |
|
52 | #define TOTAL_SIZE_COMPRESSED_ASM_NORM_F0 275 // 11 * 25 WORDS | |
53 | #define TOTAL_SIZE_COMPRESSED_ASM_F1 325 // 13 * 25 WORDS |
|
53 | #define TOTAL_SIZE_COMPRESSED_ASM_NORM_F1 325 // 13 * 25 WORDS | |
54 | #define TOTAL_SIZE_COMPRESSED_ASM_F2 300 // 12 * 25 WORDS |
|
54 | #define TOTAL_SIZE_COMPRESSED_ASM_F2 300 // 12 * 25 WORDS | |
55 |
#define TOTAL_SIZE_COMPRESSED_ASM_SBM |
|
55 | #define TOTAL_SIZE_COMPRESSED_ASM_SBM_F0 550 // 22 * 25 WORDS | |
|
56 | #define TOTAL_SIZE_COMPRESSED_ASM_SBM_F1 650 // 26 * 25 WORDS | |||
56 | // NORM |
|
57 | // NORM | |
57 | #define NB_SM_BEFORE_NORM_BP1_F0 384 // 96 * 4 |
|
58 | #define NB_SM_BEFORE_NORM_BP1_F0 384 // 96 * 4 | |
58 | #define NB_SM_BEFORE_NORM_BP2_F0 1920 // 96 * 20 |
|
|||
59 | #define NB_SM_BEFORE_NORM_ASM_F0 384 // 384 matrices at f0 = 4.00 second |
|
|||
60 | // BURST |
|
|||
61 | #define NB_SM_BEFORE_BURST_BP1_F0 96 // 96 matrices at f0 = 1.00 second |
|
|||
62 | #define NB_SM_BEFORE_BURST_BP2_F0 480 // 480 matrices at f0 = 5.00 second |
|
|||
63 | // SBM1 |
|
|||
64 | #define NB_SM_BEFORE_SBM1_BP1_F0 24 // 24 matrices at f0 = 0.25 second |
|
|||
65 | #define NB_SM_BEFORE_SBM1_BP2_F0 96 // 96 matrices at f0 = 1.00 second |
|
|||
66 | // SBM2 |
|
|||
67 | #define NB_SM_BEFORE_SBM2_BP1_F0 96 // 96 matrices at f0 = 1.00 second |
|
|||
68 | #define NB_SM_BEFORE_SBM2_BP2_F0 480 // 480 matrices at f0 = 5.00 second |
|
|||
69 | // GENERAL |
|
59 | // GENERAL | |
70 | #define NB_SM_BEFORE_AVF0 8 |
|
60 | #define NB_SM_BEFORE_AVF0 8 | |
71 | #define NB_SM_BEFORE_AVF1 8 |
|
61 | #define NB_SM_BEFORE_AVF1 8 | |
72 |
|
62 | |||
73 | #endif // FSW_PARAMS_PROCESSING_H |
|
63 | #endif // FSW_PARAMS_PROCESSING_H |
@@ -1,1231 +1,1273 | |||||
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 | unsigned int nb_sm_f0; |
|
14 | unsigned int nb_sm_f0; | |
|
15 | unsigned int nb_sm_f0_aux; | |||
|
16 | unsigned int nb_sm_f1; | |||
15 |
|
17 | |||
16 | //************************ |
|
18 | //************************ | |
17 | // spectral matrices rings |
|
19 | // spectral matrices rings | |
18 | ring_node_sm sm_ring_f0[ NB_RING_NODES_SM_F0 ]; |
|
20 | ring_node_sm sm_ring_f0[ NB_RING_NODES_SM_F0 ]; | |
19 | ring_node_sm sm_ring_f1[ NB_RING_NODES_SM_F1 ]; |
|
21 | ring_node_sm sm_ring_f1[ NB_RING_NODES_SM_F1 ]; | |
20 | ring_node_sm sm_ring_f2[ NB_RING_NODES_SM_F2 ]; |
|
22 | ring_node_sm sm_ring_f2[ NB_RING_NODES_SM_F2 ]; | |
21 | ring_node_sm *current_ring_node_sm_f0; |
|
23 | ring_node_sm *current_ring_node_sm_f0; | |
22 | ring_node_sm *current_ring_node_sm_f1; |
|
24 | ring_node_sm *current_ring_node_sm_f1; | |
23 | ring_node_sm *current_ring_node_sm_f2; |
|
25 | ring_node_sm *current_ring_node_sm_f2; | |
24 | ring_node_sm *ring_node_for_averaging_sm_f0; |
|
26 | ring_node_sm *ring_node_for_averaging_sm_f0; | |
25 | ring_node_sm *ring_node_for_averaging_sm_f1; |
|
27 | ring_node_sm *ring_node_for_averaging_sm_f1; | |
26 |
|
28 | |||
27 | ring_node_asm asm_ring_norm_f0 [ NB_RING_NODES_ASM_NORM_F0 ]; |
|
29 | ring_node_asm asm_ring_norm_f0 [ NB_RING_NODES_ASM_NORM_F0 ]; | |
28 | ring_node_asm asm_ring_burst_sbm_f0[ NB_RING_NODES_ASM_BURST_SBM_F0 ]; |
|
30 | ring_node_asm asm_ring_burst_sbm_f0[ NB_RING_NODES_ASM_BURST_SBM_F0 ]; | |
29 | ring_node_asm asm_ring_norm_f1 [ NB_RING_NODES_ASM_NORM_F1 ]; |
|
31 | ring_node_asm asm_ring_norm_f1 [ NB_RING_NODES_ASM_NORM_F1 ]; | |
30 | ring_node_asm asm_ring_burst_sbm_f1[ NB_RING_NODES_ASM_BURST_SBM_F1 ]; |
|
32 | ring_node_asm asm_ring_burst_sbm_f1[ NB_RING_NODES_ASM_BURST_SBM_F1 ]; | |
31 | ring_node_asm *current_ring_node_asm_burst_sbm_f0; |
|
33 | ring_node_asm *current_ring_node_asm_burst_sbm_f0; | |
32 | ring_node_asm *current_ring_node_asm_norm_f0; |
|
34 | ring_node_asm *current_ring_node_asm_norm_f0; | |
33 | ring_node_asm *current_ring_node_asm_burst_sbm_f1; |
|
35 | ring_node_asm *current_ring_node_asm_burst_sbm_f1; | |
34 | ring_node_asm *current_ring_node_asm_norm_f1; |
|
36 | ring_node_asm *current_ring_node_asm_norm_f1; | |
35 |
|
37 | |||
36 | float asm_f0_reorganized [ TOTAL_SIZE_SM ]; |
|
38 | float asm_f0_reorganized [ TOTAL_SIZE_SM ]; | |
37 | char asm_f0_char [ TIME_OFFSET_IN_BYTES + (TOTAL_SIZE_SM * 2) ]; |
|
39 | char asm_f0_char [ TIME_OFFSET_IN_BYTES + (TOTAL_SIZE_SM * 2) ]; | |
38 |
float compressed_sm_norm_f0[ TOTAL_SIZE_COMPRESSED_ASM_F0 |
|
40 | float compressed_sm_norm_f0[ TOTAL_SIZE_COMPRESSED_ASM_NORM_F0]; | |
39 |
float compressed_sm_sbm |
|
41 | float compressed_sm_sbm_f0 [ TOTAL_SIZE_COMPRESSED_ASM_SBM_F0 ]; | |
|
42 | ||||
|
43 | float asm_f1_reorganized [ TOTAL_SIZE_SM ]; | |||
|
44 | char asm_f1_char [ TIME_OFFSET_IN_BYTES + (TOTAL_SIZE_SM * 2) ]; | |||
|
45 | float compressed_sm_norm_f1[ TOTAL_SIZE_COMPRESSED_ASM_NORM_F1]; | |||
|
46 | float compressed_sm_sbm_f1 [ TOTAL_SIZE_COMPRESSED_ASM_SBM_F1 ]; | |||
40 |
|
47 | |||
41 | //*********************************************************** |
|
48 | //*********************************************************** | |
42 | // Interrupt Service Routine for spectral matrices processing |
|
49 | // Interrupt Service Routine for spectral matrices processing | |
43 |
|
50 | |||
44 | void reset_nb_sm_f0( unsigned char lfrMode ) |
|
51 | void reset_nb_sm_f0( unsigned char lfrMode ) | |
45 | { |
|
52 | { | |
46 | nb_sm_f0 = 0; |
|
53 | nb_sm_f0 = 0; | |
|
54 | nb_sm_f0_aux = 0; | |||
47 |
|
55 | |||
48 |
nb_sm_before_f0.norm_bp1 |
|
56 | nb_sm_before_f0.norm_bp1 = parameter_dump_packet.sy_lfr_n_bp_p0 * 96; | |
49 |
nb_sm_before_f0.norm_bp2 |
|
57 | nb_sm_before_f0.norm_bp2 = parameter_dump_packet.sy_lfr_n_bp_p1 * 96; | |
50 |
nb_sm_before_f0.norm_asm |
|
58 | nb_sm_before_f0.norm_asm = (parameter_dump_packet.sy_lfr_n_asm_p[0] * 256 + parameter_dump_packet.sy_lfr_n_asm_p[1]) * 96; | |
51 |
nb_sm_before_f0.sbm1_bp1 |
|
59 | nb_sm_before_f0.sbm1_bp1 = parameter_dump_packet.sy_lfr_s1_bp_p0 * 24; | |
52 |
nb_sm_before_f0.sbm1_bp2 |
|
60 | nb_sm_before_f0.sbm1_bp2 = parameter_dump_packet.sy_lfr_s1_bp_p1 * 96; | |
53 |
nb_sm_before_f0.sbm2_bp1 |
|
61 | nb_sm_before_f0.sbm2_bp1 = parameter_dump_packet.sy_lfr_s2_bp_p0 * 96; | |
54 |
nb_sm_before_f0.sbm2_bp2 |
|
62 | nb_sm_before_f0.sbm2_bp2 = parameter_dump_packet.sy_lfr_s2_bp_p1 * 96; | |
55 |
nb_sm_before_f0.burst_bp1 |
|
63 | nb_sm_before_f0.burst_bp1 = parameter_dump_packet.sy_lfr_b_bp_p0 * 96; | |
56 |
nb_sm_before_f0.burst_bp2 |
|
64 | nb_sm_before_f0.burst_bp2 = parameter_dump_packet.sy_lfr_b_bp_p1 * 96; | |
57 |
|
65 | |||
58 | if (lfrMode == LFR_MODE_SBM1) |
|
66 | if (lfrMode == LFR_MODE_SBM1) | |
59 | { |
|
67 | { | |
60 |
nb_sm_before_f0.burst_sbm_bp1 |
|
68 | nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.sbm1_bp1; | |
61 |
nb_sm_before_f0.burst_sbm_bp2 |
|
69 | nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.sbm1_bp2; | |
62 | } |
|
70 | } | |
63 | else if (lfrMode == LFR_MODE_SBM2) |
|
71 | else if (lfrMode == LFR_MODE_SBM2) | |
64 | { |
|
72 | { | |
65 |
nb_sm_before_f0.burst_sbm_bp1 |
|
73 | nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.sbm2_bp1; | |
66 |
nb_sm_before_f0.burst_sbm_bp2 |
|
74 | nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.sbm2_bp2; | |
67 | } |
|
75 | } | |
68 | else if (lfrMode == LFR_MODE_BURST) |
|
76 | else if (lfrMode == LFR_MODE_BURST) | |
69 | { |
|
77 | { | |
70 |
nb_sm_before_f0.burst_sbm_bp1 |
|
78 | nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.burst_bp1; | |
71 |
nb_sm_before_f0.burst_sbm_bp2 |
|
79 | nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.burst_bp2; | |
72 | } |
|
80 | } | |
73 | else |
|
81 | else | |
74 | { |
|
82 | { | |
75 |
nb_sm_before_f0.burst_sbm_bp1 |
|
83 | nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.burst_bp1; | |
76 |
nb_sm_before_f0.burst_sbm_bp2 |
|
84 | nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.burst_bp2; | |
77 | } |
|
85 | } | |
78 | } |
|
86 | } | |
79 |
|
87 | |||
80 | void reset_nb_sm_f1( unsigned char lfrMode ) |
|
88 | void reset_nb_sm_f1( unsigned char lfrMode ) | |
81 | { |
|
89 | { | |
|
90 | nb_sm_f1 = 0; | |||
|
91 | ||||
82 | nb_sm_before_f1.norm_bp1 = parameter_dump_packet.sy_lfr_n_bp_p0 * 16; |
|
92 | nb_sm_before_f1.norm_bp1 = parameter_dump_packet.sy_lfr_n_bp_p0 * 16; | |
83 | nb_sm_before_f1.norm_bp2 = parameter_dump_packet.sy_lfr_n_bp_p1 * 16; |
|
93 | nb_sm_before_f1.norm_bp2 = parameter_dump_packet.sy_lfr_n_bp_p1 * 16; | |
84 | nb_sm_before_f1.norm_asm = (parameter_dump_packet.sy_lfr_n_asm_p[0] * 256 + parameter_dump_packet.sy_lfr_n_asm_p[1]) * 16; |
|
94 | nb_sm_before_f1.norm_asm = (parameter_dump_packet.sy_lfr_n_asm_p[0] * 256 + parameter_dump_packet.sy_lfr_n_asm_p[1]) * 16; | |
85 | nb_sm_before_f1.sbm2_bp1 = parameter_dump_packet.sy_lfr_s2_bp_p0 * 16; |
|
95 | nb_sm_before_f1.sbm2_bp1 = parameter_dump_packet.sy_lfr_s2_bp_p0 * 16; | |
86 | nb_sm_before_f1.sbm2_bp2 = parameter_dump_packet.sy_lfr_s2_bp_p1 * 16; |
|
96 | nb_sm_before_f1.sbm2_bp2 = parameter_dump_packet.sy_lfr_s2_bp_p1 * 16; | |
87 | nb_sm_before_f1.burst_bp1 = parameter_dump_packet.sy_lfr_b_bp_p0 * 16; |
|
97 | nb_sm_before_f1.burst_bp1 = parameter_dump_packet.sy_lfr_b_bp_p0 * 16; | |
88 | nb_sm_before_f1.burst_bp2 = parameter_dump_packet.sy_lfr_b_bp_p1 * 16; |
|
98 | nb_sm_before_f1.burst_bp2 = parameter_dump_packet.sy_lfr_b_bp_p1 * 16; | |
89 |
|
99 | |||
90 | if (lfrMode == LFR_MODE_SBM2) |
|
100 | if (lfrMode == LFR_MODE_SBM2) | |
91 | { |
|
101 | { | |
92 | nb_sm_before_f1.burst_sbm_bp1 = nb_sm_before_f1.sbm2_bp1; |
|
102 | nb_sm_before_f1.burst_sbm_bp1 = nb_sm_before_f1.sbm2_bp1; | |
93 | nb_sm_before_f1.burst_sbm_bp2 = nb_sm_before_f1.sbm2_bp2; |
|
103 | nb_sm_before_f1.burst_sbm_bp2 = nb_sm_before_f1.sbm2_bp2; | |
94 | } |
|
104 | } | |
95 | else if (lfrMode == LFR_MODE_BURST) |
|
105 | else if (lfrMode == LFR_MODE_BURST) | |
96 | { |
|
106 | { | |
97 | nb_sm_before_f1.burst_sbm_bp1 = nb_sm_before_f1.burst_bp1; |
|
107 | nb_sm_before_f1.burst_sbm_bp1 = nb_sm_before_f1.burst_bp1; | |
98 | nb_sm_before_f1.burst_sbm_bp2 = nb_sm_before_f1.burst_bp2; |
|
108 | nb_sm_before_f1.burst_sbm_bp2 = nb_sm_before_f1.burst_bp2; | |
99 | } |
|
109 | } | |
100 | else |
|
110 | else | |
101 | { |
|
111 | { | |
102 | nb_sm_before_f1.burst_sbm_bp1 = nb_sm_before_f1.burst_bp1; |
|
112 | nb_sm_before_f1.burst_sbm_bp1 = nb_sm_before_f1.burst_bp1; | |
103 | nb_sm_before_f1.burst_sbm_bp2 = nb_sm_before_f1.burst_bp2; |
|
113 | nb_sm_before_f1.burst_sbm_bp2 = nb_sm_before_f1.burst_bp2; | |
104 | } |
|
114 | } | |
105 | } |
|
115 | } | |
106 |
|
116 | |||
107 | void reset_nb_sm_f2( unsigned char lfrMode ) |
|
117 | void reset_nb_sm_f2( unsigned char lfrMode ) | |
108 | { |
|
118 | { | |
109 | nb_sm_before_f2.norm_bp1_f2 = parameter_dump_packet.sy_lfr_n_bp_p0; |
|
119 | nb_sm_before_f2.norm_bp1_f2 = parameter_dump_packet.sy_lfr_n_bp_p0; | |
110 | nb_sm_before_f2.norm_bp2_f2 = parameter_dump_packet.sy_lfr_n_bp_p1; |
|
120 | nb_sm_before_f2.norm_bp2_f2 = parameter_dump_packet.sy_lfr_n_bp_p1; | |
111 | nb_sm_before_f2.norm_asm_f2 = parameter_dump_packet.sy_lfr_n_asm_p[0] * 256 + parameter_dump_packet.sy_lfr_n_asm_p[1]; |
|
121 | nb_sm_before_f2.norm_asm_f2 = parameter_dump_packet.sy_lfr_n_asm_p[0] * 256 + parameter_dump_packet.sy_lfr_n_asm_p[1]; | |
112 | nb_sm_before_f2.sbm2_bp1_f2 = parameter_dump_packet.sy_lfr_s2_bp_p0; |
|
122 | nb_sm_before_f2.sbm2_bp1_f2 = parameter_dump_packet.sy_lfr_s2_bp_p0; | |
113 | nb_sm_before_f2.sbm2_bp2_f2 = parameter_dump_packet.sy_lfr_s2_bp_p1; |
|
123 | nb_sm_before_f2.sbm2_bp2_f2 = parameter_dump_packet.sy_lfr_s2_bp_p1; | |
114 | nb_sm_before_f2.burst_bp1_f2 = parameter_dump_packet.sy_lfr_b_bp_p0; |
|
124 | nb_sm_before_f2.burst_bp1_f2 = parameter_dump_packet.sy_lfr_b_bp_p0; | |
115 | nb_sm_before_f2.burst_bp2_f2 = parameter_dump_packet.sy_lfr_b_bp_p1; |
|
125 | nb_sm_before_f2.burst_bp2_f2 = parameter_dump_packet.sy_lfr_b_bp_p1; | |
116 |
|
126 | |||
117 | if (lfrMode == LFR_MODE_SBM2) |
|
127 | if (lfrMode == LFR_MODE_SBM2) | |
118 | { |
|
128 | { | |
119 | nb_sm_before_f2.burst_sbm_bp1_f2 = nb_sm_before_f2.sbm2_bp1_f2; |
|
129 | nb_sm_before_f2.burst_sbm_bp1_f2 = nb_sm_before_f2.sbm2_bp1_f2; | |
120 | nb_sm_before_f2.burst_sbm_bp2_f2 = nb_sm_before_f2.sbm2_bp2_f2; |
|
130 | nb_sm_before_f2.burst_sbm_bp2_f2 = nb_sm_before_f2.sbm2_bp2_f2; | |
121 | } |
|
131 | } | |
122 | else if (lfrMode == LFR_MODE_BURST) |
|
132 | else if (lfrMode == LFR_MODE_BURST) | |
123 | { |
|
133 | { | |
124 | nb_sm_before_f2.burst_sbm_bp1_f2 = nb_sm_before_f2.burst_bp1_f2; |
|
134 | nb_sm_before_f2.burst_sbm_bp1_f2 = nb_sm_before_f2.burst_bp1_f2; | |
125 | nb_sm_before_f2.burst_sbm_bp2_f2 = nb_sm_before_f2.burst_bp2_f2; |
|
135 | nb_sm_before_f2.burst_sbm_bp2_f2 = nb_sm_before_f2.burst_bp2_f2; | |
126 | } |
|
136 | } | |
127 | else |
|
137 | else | |
128 | { |
|
138 | { | |
129 | nb_sm_before_f2.burst_sbm_bp1_f2 = nb_sm_before_f2.burst_bp1_f2; |
|
139 | nb_sm_before_f2.burst_sbm_bp1_f2 = nb_sm_before_f2.burst_bp1_f2; | |
130 | nb_sm_before_f2.burst_sbm_bp2_f2 = nb_sm_before_f2.burst_bp2_f2; |
|
140 | nb_sm_before_f2.burst_sbm_bp2_f2 = nb_sm_before_f2.burst_bp2_f2; | |
131 | } |
|
141 | } | |
132 | } |
|
142 | } | |
133 |
|
143 | |||
134 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ) |
|
144 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ) | |
135 | { |
|
145 | { | |
136 | ring_node_sm *previous_ring_node_sm_f0; |
|
146 | ring_node_sm *previous_ring_node_sm_f0; | |
137 |
|
147 | |||
138 | // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); |
|
148 | // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); | |
139 |
|
149 | |||
140 | previous_ring_node_sm_f0 = current_ring_node_sm_f0; |
|
150 | previous_ring_node_sm_f0 = current_ring_node_sm_f0; | |
141 |
|
151 | |||
142 | if ( (spectral_matrix_regs->status & 0x2) == 0x02) // check ready matrix bit f0_1 |
|
152 | if ( (spectral_matrix_regs->status & 0x2) == 0x02) // check ready matrix bit f0_1 | |
143 | { |
|
153 | { | |
144 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; |
|
154 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; | |
145 | spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address; |
|
155 | spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address; | |
146 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd; // 1101 |
|
156 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd; // 1101 | |
147 | nb_sm_f0 = nb_sm_f0 + 1; |
|
157 | nb_sm_f0 = nb_sm_f0 + 1; | |
148 | } |
|
158 | } | |
149 |
|
159 | |||
150 | //************************ |
|
160 | //************************ | |
151 | // reset status error bits |
|
161 | // reset status error bits | |
152 | if ( (spectral_matrix_regs->status & 0x30) != 0x00) |
|
162 | if ( (spectral_matrix_regs->status & 0x30) != 0x00) | |
153 | { |
|
163 | { | |
154 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); |
|
164 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); | |
155 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xffffffcf; // 1100 1111 |
|
165 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xffffffcf; // 1100 1111 | |
156 | } |
|
166 | } | |
157 |
|
167 | |||
158 | //************************************** |
|
168 | //************************************** | |
159 | // reset ready matrix bits for f0_0, f1 and f2 |
|
169 | // reset ready matrix bits for f0_0, f1 and f2 | |
160 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff2; // 0010 |
|
170 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff2; // 0010 | |
161 |
|
171 | |||
162 | if (nb_sm_f0 == NB_SM_BEFORE_AVF0) |
|
172 | if (nb_sm_f0 == NB_SM_BEFORE_AVF0) | |
163 | { |
|
173 | { | |
164 | ring_node_for_averaging_sm_f0 = previous_ring_node_sm_f0; |
|
174 | ring_node_for_averaging_sm_f0 = previous_ring_node_sm_f0; | |
165 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
175 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |
166 | { |
|
176 | { | |
167 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
177 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |
168 | } |
|
178 | } | |
169 | nb_sm_f0 = 0; |
|
179 | nb_sm_f0 = 0; | |
170 | } |
|
180 | } | |
171 |
|
181 | |||
172 | } |
|
182 | } | |
173 |
|
183 | |||
174 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ) |
|
184 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ) | |
175 | { |
|
185 | { | |
176 | if (nb_sm_f0 == (NB_SM_BEFORE_AVF0-1) ) |
|
186 | //*** | |
|
187 | // F0 | |||
|
188 | nb_sm_f0 = nb_sm_f0 + 1; | |||
|
189 | if (nb_sm_f0 == NB_SM_BEFORE_AVF0 ) | |||
177 | { |
|
190 | { | |
178 | ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0; |
|
191 | ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0; | |
179 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
192 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |
180 | { |
|
193 | { | |
181 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
194 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |
182 | } |
|
195 | } | |
183 | nb_sm_f0 = 0; |
|
196 | nb_sm_f0 = 0; | |
184 | } |
|
197 | } | |
185 | else |
|
198 | ||
|
199 | //*** | |||
|
200 | // F1 | |||
|
201 | nb_sm_f0_aux = nb_sm_f0_aux + 1; | |||
|
202 | if (nb_sm_f0_aux == 6) | |||
186 | { |
|
203 | { | |
187 |
nb_sm_f0 = |
|
204 | nb_sm_f0_aux = 0; | |
|
205 | nb_sm_f1 = nb_sm_f1 + 1; | |||
|
206 | } | |||
|
207 | if (nb_sm_f1 == NB_SM_BEFORE_AVF1 ) | |||
|
208 | { | |||
|
209 | ring_node_for_averaging_sm_f1 = current_ring_node_sm_f1; | |||
|
210 | if (rtems_event_send( Task_id[TASKID_AVF1], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |||
|
211 | { | |||
|
212 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |||
|
213 | } | |||
|
214 | nb_sm_f1 = 0; | |||
188 | } |
|
215 | } | |
189 | } |
|
216 | } | |
190 |
|
217 | |||
191 | //************ |
|
218 | //************ | |
192 | // RTEMS TASKS |
|
219 | // RTEMS TASKS | |
193 |
|
220 | |||
194 | //***************** |
|
221 | //***************** | |
195 | // PROCESSING AT F0 |
|
222 | // PROCESSING AT F0 | |
196 |
|
223 | |||
197 | rtems_task avf0_task( rtems_task_argument lfrRequestedMode ) |
|
224 | rtems_task avf0_task( rtems_task_argument lfrRequestedMode ) | |
198 | { |
|
225 | { | |
199 | int i; |
|
226 | int i; | |
200 |
|
227 | |||
201 | rtems_event_set event_out; |
|
228 | rtems_event_set event_out; | |
202 | rtems_status_code status; |
|
229 | rtems_status_code status; | |
203 | rtems_id queue_id_prc0; |
|
230 | rtems_id queue_id_prc0; | |
204 | asm_msg msgForMATR; |
|
231 | asm_msg msgForMATR; | |
205 | ring_node_sm *ring_node_tab[8]; |
|
232 | ring_node_sm *ring_node_tab[8]; | |
206 |
|
233 | |||
207 |
|
|
234 | unsigned int nb_norm_bp1; | |
208 |
|
|
235 | unsigned int nb_norm_bp2; | |
209 |
|
|
236 | unsigned int nb_norm_asm; | |
210 |
|
|
237 | unsigned int nb_sbm_bp1; | |
211 |
|
|
238 | unsigned int nb_sbm_bp2; | |
212 |
|
239 | |||
213 | nb_norm_bp1 = 0; |
|
240 | nb_norm_bp1 = 0; | |
214 | nb_norm_bp2 = 0; |
|
241 | nb_norm_bp2 = 0; | |
215 | nb_norm_asm = 0; |
|
242 | nb_norm_asm = 0; | |
216 | nb_sbm_bp1 = 0; |
|
243 | nb_sbm_bp1 = 0; | |
217 | nb_sbm_bp2 = 0; |
|
244 | nb_sbm_bp2 = 0; | |
218 |
|
245 | |||
219 | reset_nb_sm_f0( lfrRequestedMode ); // reset the sm counters that drive the BP and ASM computations / transmissions |
|
246 | reset_nb_sm_f0( lfrRequestedMode ); // reset the sm counters that drive the BP and ASM computations / transmissions | |
220 |
|
247 | |||
221 | BOOT_PRINTF1("in AVFO *** lfrRequestedMode = %d\n", (int) lfrRequestedMode) |
|
248 | BOOT_PRINTF1("in AVFO *** lfrRequestedMode = %d\n", (int) lfrRequestedMode) | |
222 |
|
249 | |||
223 | status = get_message_queue_id_prc0( &queue_id_prc0 ); |
|
250 | status = get_message_queue_id_prc0( &queue_id_prc0 ); | |
224 | if (status != RTEMS_SUCCESSFUL) |
|
251 | if (status != RTEMS_SUCCESSFUL) | |
225 | { |
|
252 | { | |
226 | PRINTF1("in MATR *** ERR get_message_queue_id_prc0 %d\n", status) |
|
253 | PRINTF1("in MATR *** ERR get_message_queue_id_prc0 %d\n", status) | |
227 | } |
|
254 | } | |
228 |
|
255 | |||
229 | while(1){ |
|
256 | while(1){ | |
230 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
257 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 | |
231 | ring_node_tab[NB_SM_BEFORE_AVF0-1] = ring_node_for_averaging_sm_f0; |
|
258 | ring_node_tab[NB_SM_BEFORE_AVF0-1] = ring_node_for_averaging_sm_f0; | |
232 | for ( i = 2; i < (NB_SM_BEFORE_AVF0+1); i++ ) |
|
259 | for ( i = 2; i < (NB_SM_BEFORE_AVF0+1); i++ ) | |
233 | { |
|
260 | { | |
234 | ring_node_for_averaging_sm_f0 = ring_node_for_averaging_sm_f0->previous; |
|
261 | ring_node_for_averaging_sm_f0 = ring_node_for_averaging_sm_f0->previous; | |
235 | ring_node_tab[NB_SM_BEFORE_AVF0-i] = ring_node_for_averaging_sm_f0; |
|
262 | ring_node_tab[NB_SM_BEFORE_AVF0-i] = ring_node_for_averaging_sm_f0; | |
236 | } |
|
263 | } | |
237 |
|
264 | |||
238 | // compute the average and store it in the averaged_sm_f1 buffer |
|
265 | // compute the average and store it in the averaged_sm_f1 buffer | |
239 | SM_average( current_ring_node_asm_norm_f0->matrix, |
|
266 | SM_average( current_ring_node_asm_norm_f0->matrix, | |
240 | current_ring_node_asm_burst_sbm_f0->matrix, |
|
267 | current_ring_node_asm_burst_sbm_f0->matrix, | |
241 | ring_node_tab, |
|
268 | ring_node_tab, | |
242 | nb_norm_bp1, nb_sbm_bp1 ); |
|
269 | nb_norm_bp1, nb_sbm_bp1 ); | |
243 |
|
270 | |||
244 | // update nb_average |
|
271 | // update nb_average | |
245 | nb_norm_bp1 = nb_norm_bp1 + NB_SM_BEFORE_AVF0; |
|
272 | nb_norm_bp1 = nb_norm_bp1 + NB_SM_BEFORE_AVF0; | |
246 | nb_norm_bp2 = nb_norm_bp2 + NB_SM_BEFORE_AVF0; |
|
273 | nb_norm_bp2 = nb_norm_bp2 + NB_SM_BEFORE_AVF0; | |
247 | nb_norm_asm = nb_norm_asm + NB_SM_BEFORE_AVF0; |
|
274 | nb_norm_asm = nb_norm_asm + NB_SM_BEFORE_AVF0; | |
248 | nb_sbm_bp1 = nb_sbm_bp1 + NB_SM_BEFORE_AVF0; |
|
275 | nb_sbm_bp1 = nb_sbm_bp1 + NB_SM_BEFORE_AVF0; | |
249 | nb_sbm_bp2 = nb_sbm_bp2 + NB_SM_BEFORE_AVF0; |
|
276 | nb_sbm_bp2 = nb_sbm_bp2 + NB_SM_BEFORE_AVF0; | |
250 |
|
277 | |||
251 | //**************************************** |
|
278 | //**************************************** | |
252 | // initialize the mesage for the MATR task |
|
279 | // initialize the mesage for the MATR task | |
253 | msgForMATR.event = 0x00; // this composite event will be sent to the MATR task |
|
280 | msgForMATR.event = 0x00; // this composite event will be sent to the MATR task | |
254 | msgForMATR.burst_sbm = current_ring_node_asm_burst_sbm_f0; |
|
281 | msgForMATR.burst_sbm = current_ring_node_asm_burst_sbm_f0; | |
255 | msgForMATR.norm = current_ring_node_asm_norm_f0; |
|
282 | msgForMATR.norm = current_ring_node_asm_norm_f0; | |
256 | msgForMATR.coarseTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[0]; |
|
283 | // msgForMATR.coarseTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[0]; | |
257 | msgForMATR.fineTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[1]; |
|
284 | // msgForMATR.fineTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[1]; | |
|
285 | msgForMATR.coarseTime = time_management_regs->coarse_time; | |||
|
286 | msgForMATR.fineTime = time_management_regs->fine_time; | |||
258 |
|
287 | |||
259 |
if (nb_sbm_bp1 == nb_sm_before_f0.burst_sbm_bp1 |
|
288 | if (nb_sbm_bp1 == nb_sm_before_f0.burst_sbm_bp1) | |
260 | { |
|
289 | { | |
261 | nb_sbm_bp1 = 0; |
|
290 | nb_sbm_bp1 = 0; | |
262 | // set another ring for the ASM storage |
|
291 | // set another ring for the ASM storage | |
263 | current_ring_node_asm_burst_sbm_f0 = current_ring_node_asm_burst_sbm_f0->next; |
|
292 | current_ring_node_asm_burst_sbm_f0 = current_ring_node_asm_burst_sbm_f0->next; | |
264 | if ( (lfrCurrentMode == LFR_MODE_BURST) |
|
293 | if ( (lfrCurrentMode == LFR_MODE_BURST) | |
265 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
294 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) | |
266 | { |
|
295 | { | |
267 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_SBM_BP1_F0; |
|
296 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_SBM_BP1_F0; | |
268 | } |
|
297 | } | |
269 | } |
|
298 | } | |
270 |
|
299 | |||
271 |
if (nb_sbm_bp2 == nb_sm_before_f0.burst_sbm_bp2 |
|
300 | if (nb_sbm_bp2 == nb_sm_before_f0.burst_sbm_bp2) | |
272 | { |
|
301 | { | |
273 | nb_sbm_bp2 = 0; |
|
302 | nb_sbm_bp2 = 0; | |
274 | if ( (lfrCurrentMode == LFR_MODE_BURST) |
|
303 | if ( (lfrCurrentMode == LFR_MODE_BURST) | |
275 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
304 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) | |
276 | { |
|
305 | { | |
277 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_SBM_BP2_F0; |
|
306 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_SBM_BP2_F0; | |
278 | } |
|
307 | } | |
279 | } |
|
308 | } | |
280 |
|
309 | |||
281 |
if (nb_norm_bp1 == nb_sm_before_f0.norm_bp1 |
|
310 | if (nb_norm_bp1 == nb_sm_before_f0.norm_bp1) | |
282 | { |
|
311 | { | |
283 | nb_norm_bp1 = 0; |
|
312 | nb_norm_bp1 = 0; | |
284 | // set another ring for the ASM storage |
|
313 | // set another ring for the ASM storage | |
285 | current_ring_node_asm_norm_f0 = current_ring_node_asm_norm_f0->next; |
|
314 | current_ring_node_asm_norm_f0 = current_ring_node_asm_norm_f0->next; | |
286 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) |
|
315 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) | |
287 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
316 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) | |
288 | { |
|
317 | { | |
289 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP1_F0; |
|
318 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP1_F0; | |
290 | } |
|
319 | } | |
291 | } |
|
320 | } | |
292 |
|
321 | |||
293 |
if (nb_norm_bp2 == nb_sm_before_f0.norm_bp2 |
|
322 | if (nb_norm_bp2 == nb_sm_before_f0.norm_bp2) | |
294 | { |
|
323 | { | |
295 | nb_norm_bp2 = 0; |
|
324 | nb_norm_bp2 = 0; | |
296 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) |
|
325 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) | |
297 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
326 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) | |
298 | { |
|
327 | { | |
299 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP2_F0; |
|
328 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP2_F0; | |
300 | } |
|
329 | } | |
301 | } |
|
330 | } | |
302 |
|
331 | |||
303 |
if (nb_norm_asm == nb_sm_before_f0.norm_asm |
|
332 | if (nb_norm_asm == nb_sm_before_f0.norm_asm) | |
304 | { |
|
333 | { | |
305 | nb_norm_asm = 0; |
|
334 | nb_norm_asm = 0; | |
306 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) |
|
335 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) | |
307 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
336 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) | |
308 | { |
|
337 | { | |
309 | // PRINTF1("%lld\n", localTime) |
|
338 | // PRINTF1("%lld\n", localTime) | |
310 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_ASM_F0; |
|
339 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_ASM_F0; | |
311 | } |
|
340 | } | |
312 | } |
|
341 | } | |
313 |
|
342 | |||
314 | //************************* |
|
343 | //************************* | |
315 | // send the message to MATR |
|
344 | // send the message to MATR | |
316 | if (msgForMATR.event != 0x00) |
|
345 | if (msgForMATR.event != 0x00) | |
317 | { |
|
346 | { | |
318 | status = rtems_message_queue_send( queue_id_prc0, (char *) &msgForMATR, MSG_QUEUE_SIZE_PRC0); |
|
347 | status = rtems_message_queue_send( queue_id_prc0, (char *) &msgForMATR, MSG_QUEUE_SIZE_PRC0); | |
319 | } |
|
348 | } | |
320 |
|
349 | |||
321 | if (status != RTEMS_SUCCESSFUL) { |
|
350 | if (status != RTEMS_SUCCESSFUL) { | |
322 | printf("in AVF0 *** Error sending message to MATR, code %d\n", status); |
|
351 | printf("in AVF0 *** Error sending message to MATR, code %d\n", status); | |
323 | } |
|
352 | } | |
324 | } |
|
353 | } | |
325 | } |
|
354 | } | |
326 |
|
355 | |||
327 | rtems_task prc0_task( rtems_task_argument lfrRequestedMode ) |
|
356 | rtems_task prc0_task( rtems_task_argument lfrRequestedMode ) | |
328 | { |
|
357 | { | |
329 | char incomingData[MSG_QUEUE_SIZE_SEND]; // incoming data buffer |
|
358 | char incomingData[MSG_QUEUE_SIZE_SEND]; // incoming data buffer | |
330 | size_t size; // size of the incoming TC packet |
|
359 | size_t size; // size of the incoming TC packet | |
331 | asm_msg *incomingMsg; |
|
360 | asm_msg *incomingMsg; | |
332 | // |
|
361 | // | |
333 | spw_ioctl_pkt_send spw_ioctl_send_ASM; |
|
362 | spw_ioctl_pkt_send spw_ioctl_send_ASM; | |
334 | rtems_status_code status; |
|
363 | rtems_status_code status; | |
335 | rtems_id queue_id; |
|
364 | rtems_id queue_id; | |
336 | rtems_id queue_id_q_p0; |
|
365 | rtems_id queue_id_q_p0; | |
337 | Header_TM_LFR_SCIENCE_ASM_t headerASM; |
|
366 | Header_TM_LFR_SCIENCE_ASM_t headerASM; | |
338 | bp_packet_with_spare packet_norm_bp1_f0; |
|
367 | bp_packet_with_spare packet_norm_bp1_f0; | |
339 | bp_packet packet_norm_bp2_f0; |
|
368 | bp_packet packet_norm_bp2_f0; | |
340 | bp_packet packet_sbm_bp1_f0; |
|
369 | bp_packet packet_sbm_bp1_f0; | |
341 | bp_packet packet_sbm_bp2_f0; |
|
370 | bp_packet packet_sbm_bp2_f0; | |
342 |
|
371 | |||
343 | unsigned long long int localTime; |
|
372 | unsigned long long int localTime; | |
344 |
|
373 | |||
345 | ASM_init_header( &headerASM ); |
|
374 | ASM_init_header( &headerASM ); | |
346 |
|
375 | |||
347 | //************* |
|
376 | //************* | |
348 | // NORM headers |
|
377 | // NORM headers | |
349 | BP_init_header_with_spare( &packet_norm_bp1_f0.header, |
|
378 | BP_init_header_with_spare( &packet_norm_bp1_f0.header, | |
350 | APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F0, |
|
379 | APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F0, | |
351 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0, NB_BINS_COMPRESSED_SM_F0 ); |
|
380 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0, NB_BINS_COMPRESSED_SM_F0 ); | |
352 | BP_init_header( &packet_norm_bp2_f0.header, |
|
381 | BP_init_header( &packet_norm_bp2_f0.header, | |
353 | APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP2_F0, |
|
382 | APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP2_F0, | |
354 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0, NB_BINS_COMPRESSED_SM_F0); |
|
383 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0, NB_BINS_COMPRESSED_SM_F0); | |
355 |
|
384 | |||
356 | //**************************** |
|
385 | //**************************** | |
357 | // BURST SBM1 and SBM2 headers |
|
386 | // BURST SBM1 and SBM2 headers | |
358 | if ( lfrRequestedMode == LFR_MODE_BURST ) |
|
387 | if ( lfrRequestedMode == LFR_MODE_BURST ) | |
359 | { |
|
388 | { | |
360 | BP_init_header( &packet_sbm_bp1_f0.header, |
|
389 | BP_init_header( &packet_sbm_bp1_f0.header, | |
361 | APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP1_F0, |
|
390 | APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP1_F0, | |
362 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0); |
|
391 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0); | |
363 | BP_init_header( &packet_sbm_bp2_f0.header, |
|
392 | BP_init_header( &packet_sbm_bp2_f0.header, | |
364 | APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP2_F0, |
|
393 | APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP2_F0, | |
365 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0); |
|
394 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0); | |
366 | } |
|
395 | } | |
367 | else if ( lfrRequestedMode == LFR_MODE_SBM1 ) |
|
396 | else if ( lfrRequestedMode == LFR_MODE_SBM1 ) | |
368 | { |
|
397 | { | |
369 | BP_init_header( &packet_sbm_bp1_f0.header, |
|
398 | BP_init_header( &packet_sbm_bp1_f0.header, | |
370 | APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP1_F0, |
|
399 | APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP1_F0, | |
371 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0); |
|
400 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0); | |
372 | BP_init_header( &packet_sbm_bp2_f0.header, |
|
401 | BP_init_header( &packet_sbm_bp2_f0.header, | |
373 | APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP2_F0, |
|
402 | APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP2_F0, | |
374 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0); |
|
403 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0); | |
375 | } |
|
404 | } | |
376 | else if ( lfrRequestedMode == LFR_MODE_SBM2 ) |
|
405 | else if ( lfrRequestedMode == LFR_MODE_SBM2 ) | |
377 | { |
|
406 | { | |
378 | BP_init_header( &packet_sbm_bp1_f0.header, |
|
407 | BP_init_header( &packet_sbm_bp1_f0.header, | |
379 | APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP1_F0, |
|
408 | APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP1_F0, | |
380 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0); |
|
409 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0); | |
381 | BP_init_header( &packet_sbm_bp2_f0.header, |
|
410 | BP_init_header( &packet_sbm_bp2_f0.header, | |
382 | APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP2_F0, |
|
411 | APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP2_F0, | |
383 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0); |
|
412 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0); | |
384 | } |
|
413 | } | |
385 | else |
|
414 | else | |
386 | { |
|
415 | { | |
387 | PRINTF1("in PRC0 *** lfrRequestedMode is %d, several headers not initialized\n", (unsigned int) lfrRequestedMode) |
|
416 | PRINTF1("in PRC0 *** lfrRequestedMode is %d, several headers not initialized\n", (unsigned int) lfrRequestedMode) | |
388 | } |
|
417 | } | |
389 |
|
418 | |||
390 | status = get_message_queue_id_send( &queue_id ); |
|
419 | status = get_message_queue_id_send( &queue_id ); | |
391 | if (status != RTEMS_SUCCESSFUL) |
|
420 | if (status != RTEMS_SUCCESSFUL) | |
392 | { |
|
421 | { | |
393 | PRINTF1("in PRC0 *** ERR get_message_queue_id_send %d\n", status) |
|
422 | PRINTF1("in PRC0 *** ERR get_message_queue_id_send %d\n", status) | |
394 | } |
|
423 | } | |
395 | status = get_message_queue_id_prc0( &queue_id_q_p0); |
|
424 | status = get_message_queue_id_prc0( &queue_id_q_p0); | |
396 | if (status != RTEMS_SUCCESSFUL) |
|
425 | if (status != RTEMS_SUCCESSFUL) | |
397 | { |
|
426 | { | |
398 | PRINTF1("in PRC0 *** ERR get_message_queue_id_prc0 %d\n", status) |
|
427 | PRINTF1("in PRC0 *** ERR get_message_queue_id_prc0 %d\n", status) | |
399 | } |
|
428 | } | |
400 |
|
429 | |||
401 | BOOT_PRINTF1("in PRC0 *** lfrRequestedMode = %d\n", (int) lfrRequestedMode) |
|
430 | BOOT_PRINTF1("in PRC0 *** lfrRequestedMode = %d\n", (int) lfrRequestedMode) | |
402 |
|
431 | |||
403 | while(1){ |
|
432 | while(1){ | |
404 | status = rtems_message_queue_receive( queue_id_q_p0, incomingData, &size, //************************************ |
|
433 | status = rtems_message_queue_receive( queue_id_q_p0, incomingData, &size, //************************************ | |
405 | RTEMS_WAIT, RTEMS_NO_TIMEOUT ); // wait for a message coming from AVF0 |
|
434 | RTEMS_WAIT, RTEMS_NO_TIMEOUT ); // wait for a message coming from AVF0 | |
406 |
|
435 | |||
407 | incomingMsg = (asm_msg*) incomingData; |
|
436 | incomingMsg = (asm_msg*) incomingData; | |
408 |
|
437 | |||
409 | localTime = getTimeAsUnsignedLongLongInt( ); |
|
438 | localTime = getTimeAsUnsignedLongLongInt( ); | |
410 | //**************** |
|
439 | //**************** | |
411 | //**************** |
|
440 | //**************** | |
412 | // BURST SBM1 SBM2 |
|
441 | // BURST SBM1 SBM2 | |
413 | //**************** |
|
442 | //**************** | |
414 | //**************** |
|
443 | //**************** | |
415 | if (incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP1_F0 ) |
|
444 | if (incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP1_F0 ) | |
416 | { |
|
445 | { | |
417 | // 1) compress the matrix for Basic Parameters calculation |
|
446 | // 1) compress the matrix for Basic Parameters calculation | |
418 | ASM_compress_reorganize_and_divide( incomingMsg->burst_sbm->matrix, compressed_sm_sbm, |
|
447 | ASM_compress_reorganize_and_divide( incomingMsg->burst_sbm->matrix, compressed_sm_sbm_f0, | |
419 |
nb_sm_before_f0.burst_sbm_bp1 |
|
448 | nb_sm_before_f0.burst_sbm_bp1, | |
420 | NB_BINS_COMPRESSED_SM_SBM_F0, NB_BINS_TO_AVERAGE_ASM_SBM_F0, |
|
449 | NB_BINS_COMPRESSED_SM_SBM_F0, NB_BINS_TO_AVERAGE_ASM_SBM_F0, | |
421 | ASM_F0_INDICE_START); |
|
450 | ASM_F0_INDICE_START); | |
422 | // 2) compute the BP1 set |
|
451 | // 2) compute the BP1 set | |
423 |
|
452 | |||
424 | // 3) send the BP1 set |
|
453 | // 3) send the BP1 set | |
425 | set_time( packet_sbm_bp1_f0.header.time, (unsigned char *) &incomingMsg->coarseTime ); |
|
454 | set_time( packet_sbm_bp1_f0.header.time, (unsigned char *) &incomingMsg->coarseTime ); | |
426 | set_time( packet_sbm_bp1_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime ); |
|
455 | set_time( packet_sbm_bp1_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime ); | |
427 | BP_send( (char *) &packet_sbm_bp1_f0.header, queue_id, |
|
456 | BP_send( (char *) &packet_sbm_bp1_f0.header, queue_id, | |
428 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0 + PACKET_LENGTH_DELTA); |
|
457 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0 + PACKET_LENGTH_DELTA); | |
429 | // 4) compute the BP2 set if needed |
|
458 | // 4) compute the BP2 set if needed | |
430 | if ( incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP2_F0 ) |
|
459 | if ( incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP2_F0 ) | |
431 | { |
|
460 | { | |
432 | // 1) compute the BP2 set |
|
461 | // 1) compute the BP2 set | |
433 |
|
462 | |||
434 | // 2) send the BP2 set |
|
463 | // 2) send the BP2 set | |
435 | set_time( packet_sbm_bp2_f0.header.time, (unsigned char *) &incomingMsg->coarseTime ); |
|
464 | set_time( packet_sbm_bp2_f0.header.time, (unsigned char *) &incomingMsg->coarseTime ); | |
436 | set_time( packet_sbm_bp2_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime ); |
|
465 | set_time( packet_sbm_bp2_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime ); | |
437 | BP_send( (char *) &packet_sbm_bp2_f0.header, queue_id, |
|
466 | BP_send( (char *) &packet_sbm_bp2_f0.header, queue_id, | |
438 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0 + PACKET_LENGTH_DELTA); |
|
467 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0 + PACKET_LENGTH_DELTA); | |
439 | } |
|
468 | } | |
440 | } |
|
469 | } | |
441 |
|
470 | |||
442 | //***** |
|
471 | //***** | |
443 | //***** |
|
472 | //***** | |
444 | // NORM |
|
473 | // NORM | |
445 | //***** |
|
474 | //***** | |
446 | //***** |
|
475 | //***** | |
447 | if (incomingMsg->event & RTEMS_EVENT_NORM_BP1_F0) |
|
476 | if (incomingMsg->event & RTEMS_EVENT_NORM_BP1_F0) | |
448 | { |
|
477 | { | |
449 | // 1) compress the matrix for Basic Parameters calculation |
|
478 | // 1) compress the matrix for Basic Parameters calculation | |
450 | ASM_compress_reorganize_and_divide( incomingMsg->norm->matrix, compressed_sm_norm_f0, |
|
479 | ASM_compress_reorganize_and_divide( incomingMsg->norm->matrix, compressed_sm_norm_f0, | |
451 |
nb_sm_before_f0.norm_bp1 |
|
480 | nb_sm_before_f0.norm_bp1, | |
452 | NB_BINS_COMPRESSED_SM_F0, NB_BINS_TO_AVERAGE_ASM_F0, |
|
481 | NB_BINS_COMPRESSED_SM_F0, NB_BINS_TO_AVERAGE_ASM_F0, | |
453 | ASM_F0_INDICE_START ); |
|
482 | ASM_F0_INDICE_START ); | |
454 | // 2) compute the BP1 set |
|
483 | // 2) compute the BP1 set | |
455 |
|
484 | |||
456 | // 3) send the BP1 set |
|
485 | // 3) send the BP1 set | |
457 | set_time( packet_norm_bp1_f0.header.time, (unsigned char *) &incomingMsg->coarseTime ); |
|
486 | set_time( packet_norm_bp1_f0.header.time, (unsigned char *) &incomingMsg->coarseTime ); | |
458 | set_time( packet_norm_bp1_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime ); |
|
487 | set_time( packet_norm_bp1_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime ); | |
459 | BP_send( (char *) &packet_norm_bp1_f0.header, queue_id, |
|
488 | BP_send( (char *) &packet_norm_bp1_f0.header, queue_id, | |
460 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 + PACKET_LENGTH_DELTA); |
|
489 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 + PACKET_LENGTH_DELTA); | |
461 | if (incomingMsg->event & RTEMS_EVENT_NORM_BP2_F0) |
|
490 | if (incomingMsg->event & RTEMS_EVENT_NORM_BP2_F0) | |
462 | { |
|
491 | { | |
463 | // 1) compute the BP2 set |
|
492 | // 1) compute the BP2 set using the same ASM as the one used for BP1 | |
464 |
|
493 | |||
465 | // 2) send the BP2 set |
|
494 | // 2) send the BP2 set | |
466 | set_time( packet_norm_bp2_f0.header.time, (unsigned char *) &incomingMsg->coarseTime ); |
|
495 | set_time( packet_norm_bp2_f0.header.time, (unsigned char *) &incomingMsg->coarseTime ); | |
467 | set_time( packet_norm_bp2_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime ); |
|
496 | set_time( packet_norm_bp2_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime ); | |
468 | BP_send( (char *) &packet_norm_bp2_f0.header, queue_id, |
|
497 | BP_send( (char *) &packet_norm_bp2_f0.header, queue_id, | |
469 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0 + PACKET_LENGTH_DELTA); |
|
498 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0 + PACKET_LENGTH_DELTA); | |
470 | } |
|
499 | } | |
471 | } |
|
500 | } | |
472 |
|
501 | |||
473 | if (incomingMsg->event & RTEMS_EVENT_NORM_ASM_F0) |
|
502 | if (incomingMsg->event & RTEMS_EVENT_NORM_ASM_F0) | |
474 | { |
|
503 | { | |
475 | // 1) reorganize the ASM and divide |
|
504 | // 1) reorganize the ASM and divide | |
476 |
ASM_reorganize_and_divide( incomingMsg->norm->matrix, |
|
505 | ASM_reorganize_and_divide( incomingMsg->norm->matrix, | |
|
506 | asm_f0_reorganized, | |||
|
507 | nb_sm_before_f0.norm_bp1 ); | |||
477 | // 2) convert the float array in a char array |
|
508 | // 2) convert the float array in a char array | |
478 | ASM_convert( asm_f0_reorganized, asm_f0_char); |
|
509 | ASM_convert( asm_f0_reorganized, asm_f0_char); | |
479 | // 3) send the spectral matrix packets |
|
510 | // 3) send the spectral matrix packets | |
480 | set_time( headerASM.time , (unsigned char *) &incomingMsg->coarseTime ); |
|
511 | set_time( headerASM.time , (unsigned char *) &incomingMsg->coarseTime ); | |
481 | set_time( headerASM.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime ); |
|
512 | set_time( headerASM.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime ); | |
482 | ASM_send( &headerASM, asm_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id); |
|
513 | ASM_send( &headerASM, asm_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id); | |
483 | } |
|
514 | } | |
484 |
|
515 | |||
485 | } |
|
516 | } | |
486 | } |
|
517 | } | |
487 |
|
518 | |||
488 | //***************** |
|
519 | //***************** | |
489 | // PROCESSING AT F1 |
|
520 | // PROCESSING AT F1 | |
490 |
|
521 | |||
491 | rtems_task avf1_task( rtems_task_argument lfrRequestedMode ) |
|
522 | rtems_task avf1_task( rtems_task_argument lfrRequestedMode ) | |
492 | { |
|
523 | { | |
493 | int i; |
|
524 | int i; | |
494 |
|
525 | |||
495 | rtems_event_set event_out; |
|
526 | rtems_event_set event_out; | |
496 | rtems_status_code status; |
|
527 | rtems_status_code status; | |
497 | rtems_id queue_id_prc1; |
|
528 | rtems_id queue_id_prc1; | |
498 | asm_msg msgForMATR; |
|
529 | asm_msg msgForMATR; | |
499 | ring_node_sm *ring_node_tab[8]; |
|
530 | ring_node_sm *ring_node_tab[8]; | |
500 |
|
531 | |||
501 |
|
|
532 | unsigned int nb_norm_bp1; | |
502 |
|
|
533 | unsigned int nb_norm_bp2; | |
503 |
|
|
534 | unsigned int nb_norm_asm; | |
504 |
|
|
535 | unsigned int nb_sbm_bp1; | |
505 |
|
|
536 | unsigned int nb_sbm_bp2; | |
506 |
|
537 | |||
507 | nb_norm_bp1 = 0; |
|
538 | nb_norm_bp1 = 0; | |
508 | nb_norm_bp2 = 0; |
|
539 | nb_norm_bp2 = 0; | |
509 | nb_norm_asm = 0; |
|
540 | nb_norm_asm = 0; | |
510 | nb_sbm_bp1 = 0; |
|
541 | nb_sbm_bp1 = 0; | |
511 | nb_sbm_bp2 = 0; |
|
542 | nb_sbm_bp2 = 0; | |
512 |
|
543 | |||
513 | reset_nb_sm_f1( lfrRequestedMode ); // reset the sm counters that drive the BP and ASM computations / transmissions |
|
544 | reset_nb_sm_f1( lfrRequestedMode ); // reset the sm counters that drive the BP and ASM computations / transmissions | |
514 |
|
545 | |||
515 | BOOT_PRINTF1("in AVF1 *** lfrRequestedMode = %d\n", (int) lfrRequestedMode) |
|
546 | BOOT_PRINTF1("in AVF1 *** lfrRequestedMode = %d\n", (int) lfrRequestedMode) | |
516 |
|
547 | |||
517 | status = get_message_queue_id_prc1( &queue_id_prc1 ); |
|
548 | status = get_message_queue_id_prc1( &queue_id_prc1 ); | |
518 | if (status != RTEMS_SUCCESSFUL) |
|
549 | if (status != RTEMS_SUCCESSFUL) | |
519 | { |
|
550 | { | |
520 | PRINTF1("in AVF1 *** ERR get_message_queue_id_prc1 %d\n", status) |
|
551 | PRINTF1("in AVF1 *** ERR get_message_queue_id_prc1 %d\n", status) | |
521 | } |
|
552 | } | |
522 |
|
553 | |||
523 | while(1){ |
|
554 | while(1){ | |
524 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
555 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 | |
525 | ring_node_tab[NB_SM_BEFORE_AVF1-1] = ring_node_for_averaging_sm_f1; |
|
556 | ring_node_tab[NB_SM_BEFORE_AVF1-1] = ring_node_for_averaging_sm_f1; | |
526 | for ( i = 2; i < (NB_SM_BEFORE_AVF1+1); i++ ) |
|
557 | for ( i = 2; i < (NB_SM_BEFORE_AVF1+1); i++ ) | |
527 | { |
|
558 | { | |
528 | ring_node_for_averaging_sm_f1 = ring_node_for_averaging_sm_f1->previous; |
|
559 | ring_node_for_averaging_sm_f1 = ring_node_for_averaging_sm_f1->previous; | |
529 | ring_node_tab[NB_SM_BEFORE_AVF1-i] = ring_node_for_averaging_sm_f1; |
|
560 | ring_node_tab[NB_SM_BEFORE_AVF1-i] = ring_node_for_averaging_sm_f1; | |
530 | } |
|
561 | } | |
531 |
|
562 | |||
532 | // compute the average and store it in the averaged_sm_f1 buffer |
|
563 | // compute the average and store it in the averaged_sm_f1 buffer | |
533 | SM_average( current_ring_node_asm_norm_f1->matrix, |
|
564 | SM_average( current_ring_node_asm_norm_f1->matrix, | |
534 | current_ring_node_asm_burst_sbm_f1->matrix, |
|
565 | current_ring_node_asm_burst_sbm_f1->matrix, | |
535 | ring_node_tab, |
|
566 | ring_node_tab, | |
536 | nb_norm_bp1, nb_sbm_bp1 ); |
|
567 | nb_norm_bp1, nb_sbm_bp1 ); | |
537 |
|
568 | |||
538 | // update nb_average |
|
569 | // update nb_average | |
539 | nb_norm_bp1 = nb_norm_bp1 + NB_SM_BEFORE_AVF1; |
|
570 | nb_norm_bp1 = nb_norm_bp1 + NB_SM_BEFORE_AVF1; | |
540 | nb_norm_bp2 = nb_norm_bp2 + NB_SM_BEFORE_AVF1; |
|
571 | nb_norm_bp2 = nb_norm_bp2 + NB_SM_BEFORE_AVF1; | |
541 | nb_norm_asm = nb_norm_asm + NB_SM_BEFORE_AVF1; |
|
572 | nb_norm_asm = nb_norm_asm + NB_SM_BEFORE_AVF1; | |
542 | nb_sbm_bp1 = nb_sbm_bp1 + NB_SM_BEFORE_AVF1; |
|
573 | nb_sbm_bp1 = nb_sbm_bp1 + NB_SM_BEFORE_AVF1; | |
543 | nb_sbm_bp2 = nb_sbm_bp2 + NB_SM_BEFORE_AVF1; |
|
574 | nb_sbm_bp2 = nb_sbm_bp2 + NB_SM_BEFORE_AVF1; | |
544 |
|
575 | |||
545 | //**************************************** |
|
576 | //**************************************** | |
546 | // initialize the mesage for the MATR task |
|
577 | // initialize the mesage for the MATR task | |
547 | msgForMATR.event = 0x00; // this composite event will be sent to the PRC1 task |
|
578 | msgForMATR.event = 0x00; // this composite event will be sent to the PRC1 task | |
548 | msgForMATR.burst_sbm = current_ring_node_asm_burst_sbm_f1; |
|
579 | msgForMATR.burst_sbm = current_ring_node_asm_burst_sbm_f1; | |
549 | msgForMATR.norm = current_ring_node_asm_norm_f1; |
|
580 | msgForMATR.norm = current_ring_node_asm_norm_f1; | |
550 | msgForMATR.coarseTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[0]; |
|
581 | // msgForMATR.coarseTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[0]; | |
551 | msgForMATR.fineTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[1]; |
|
582 | // msgForMATR.fineTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[1]; | |
|
583 | msgForMATR.coarseTime = time_management_regs->coarse_time; | |||
|
584 | msgForMATR.fineTime = time_management_regs->fine_time; | |||
552 |
|
585 | |||
553 | if (nb_sbm_bp1 == nb_sm_before_f1.burst_sbm_bp1) |
|
586 | if (nb_sbm_bp1 == nb_sm_before_f1.burst_sbm_bp1) | |
554 | { |
|
587 | { | |
555 | nb_sbm_bp1 = 0; |
|
588 | nb_sbm_bp1 = 0; | |
556 | // set another ring for the ASM storage |
|
589 | // set another ring for the ASM storage | |
557 | current_ring_node_asm_burst_sbm_f1 = current_ring_node_asm_burst_sbm_f1->next; |
|
590 | current_ring_node_asm_burst_sbm_f1 = current_ring_node_asm_burst_sbm_f1->next; | |
558 | if ( (lfrCurrentMode == LFR_MODE_BURST) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
591 | if ( (lfrCurrentMode == LFR_MODE_BURST) || (lfrCurrentMode == LFR_MODE_SBM2) ) | |
559 | { |
|
592 | { | |
560 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_SBM_BP1_F1; |
|
593 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_SBM_BP1_F1; | |
561 | } |
|
594 | } | |
562 | } |
|
595 | } | |
563 |
|
596 | |||
564 | if (nb_sbm_bp2 == nb_sm_before_f1.burst_sbm_bp2) |
|
597 | if (nb_sbm_bp2 == nb_sm_before_f1.burst_sbm_bp2) | |
565 | { |
|
598 | { | |
566 | nb_sbm_bp2 = 0; |
|
599 | nb_sbm_bp2 = 0; | |
567 | if ( (lfrCurrentMode == LFR_MODE_BURST) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
600 | if ( (lfrCurrentMode == LFR_MODE_BURST) || (lfrCurrentMode == LFR_MODE_SBM2) ) | |
568 | { |
|
601 | { | |
569 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_SBM_BP2_F1; |
|
602 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_SBM_BP2_F1; | |
570 | } |
|
603 | } | |
571 | } |
|
604 | } | |
572 |
|
605 | |||
573 | if (nb_norm_bp1 == nb_sm_before_f1.norm_bp1) |
|
606 | if (nb_norm_bp1 == nb_sm_before_f1.norm_bp1) | |
574 | { |
|
607 | { | |
575 | nb_norm_bp1 = 0; |
|
608 | nb_norm_bp1 = 0; | |
576 | // set another ring for the ASM storage |
|
609 | // set another ring for the ASM storage | |
577 | current_ring_node_asm_norm_f1 = current_ring_node_asm_norm_f1->next; |
|
610 | current_ring_node_asm_norm_f1 = current_ring_node_asm_norm_f1->next; | |
578 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) |
|
611 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) | |
579 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
612 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) | |
580 | { |
|
613 | { | |
581 |
msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP1_F |
|
614 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP1_F1; | |
582 | } |
|
615 | } | |
583 | } |
|
616 | } | |
584 |
|
617 | |||
585 | if (nb_norm_bp2 == nb_sm_before_f1.norm_bp2) |
|
618 | if (nb_norm_bp2 == nb_sm_before_f1.norm_bp2) | |
586 | { |
|
619 | { | |
587 | nb_norm_bp2 = 0; |
|
620 | nb_norm_bp2 = 0; | |
588 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) |
|
621 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) | |
589 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
622 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) | |
590 | { |
|
623 | { | |
591 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP2_F1; |
|
624 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP2_F1; | |
592 | } |
|
625 | } | |
593 | } |
|
626 | } | |
594 |
|
627 | |||
595 | if (nb_norm_asm == nb_sm_before_f1.norm_asm) |
|
628 | if (nb_norm_asm == nb_sm_before_f1.norm_asm) | |
596 | { |
|
629 | { | |
597 | nb_norm_asm = 0; |
|
630 | nb_norm_asm = 0; | |
598 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) |
|
631 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) | |
599 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
632 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) | |
600 | { |
|
633 | { | |
601 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_ASM_F1; |
|
634 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_ASM_F1; | |
602 | } |
|
635 | } | |
603 | } |
|
636 | } | |
604 |
|
637 | |||
605 | //************************* |
|
638 | //************************* | |
606 | // send the message to MATR |
|
639 | // send the message to MATR | |
607 | if (msgForMATR.event != 0x00) |
|
640 | if (msgForMATR.event != 0x00) | |
608 | { |
|
641 | { | |
609 | status = rtems_message_queue_send( queue_id_prc1, (char *) &msgForMATR, MSG_QUEUE_SIZE_PRC1); |
|
642 | status = rtems_message_queue_send( queue_id_prc1, (char *) &msgForMATR, MSG_QUEUE_SIZE_PRC1); | |
610 | } |
|
643 | } | |
611 |
|
644 | |||
612 | if (status != RTEMS_SUCCESSFUL) { |
|
645 | if (status != RTEMS_SUCCESSFUL) { | |
613 | printf("in AVF1 *** Error sending message to PRC1, code %d\n", status); |
|
646 | printf("in AVF1 *** Error sending message to PRC1, code %d\n", status); | |
614 | } |
|
647 | } | |
615 | } |
|
648 | } | |
616 | } |
|
649 | } | |
617 |
|
650 | |||
618 | rtems_task prc1_task( rtems_task_argument lfrRequestedMode ) |
|
651 | rtems_task prc1_task( rtems_task_argument lfrRequestedMode ) | |
619 | { |
|
652 | { | |
620 | char incomingData[MSG_QUEUE_SIZE_SEND]; // incoming data buffer |
|
653 | char incomingData[MSG_QUEUE_SIZE_SEND]; // incoming data buffer | |
621 | size_t size; // size of the incoming TC packet |
|
654 | size_t size; // size of the incoming TC packet | |
622 | asm_msg *incomingMsg; |
|
655 | asm_msg *incomingMsg; | |
623 | // |
|
656 | // | |
624 | spw_ioctl_pkt_send spw_ioctl_send_ASM; |
|
657 | spw_ioctl_pkt_send spw_ioctl_send_ASM; | |
625 | rtems_status_code status; |
|
658 | rtems_status_code status; | |
626 | rtems_id queue_id; |
|
659 | rtems_id queue_id_send; | |
627 | rtems_id queue_id_q_p1; |
|
660 | rtems_id queue_id_q_p1; | |
628 | Header_TM_LFR_SCIENCE_ASM_t headerASM; |
|
661 | Header_TM_LFR_SCIENCE_ASM_t headerASM; | |
629 | bp_packet_with_spare packet_norm_bp1; |
|
662 | bp_packet_with_spare packet_norm_bp1; | |
630 | bp_packet packet_norm_bp2; |
|
663 | bp_packet packet_norm_bp2; | |
631 | bp_packet packet_sbm_bp1; |
|
664 | bp_packet packet_sbm_bp1; | |
632 | bp_packet packet_sbm_bp2; |
|
665 | bp_packet packet_sbm_bp2; | |
633 |
|
666 | |||
634 | unsigned long long int localTime; |
|
667 | unsigned long long int localTime; | |
635 |
|
668 | |||
636 | ASM_init_header( &headerASM ); |
|
669 | ASM_init_header( &headerASM ); | |
637 |
|
670 | |||
638 | //************* |
|
671 | //************* | |
639 | // NORM headers |
|
672 | // NORM headers | |
640 | BP_init_header_with_spare( &packet_norm_bp1.header, |
|
673 | BP_init_header_with_spare( &packet_norm_bp1.header, | |
641 | APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F1, |
|
674 | APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F1, | |
642 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F1, NB_BINS_COMPRESSED_SM_F1 ); |
|
675 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F1, NB_BINS_COMPRESSED_SM_F1 ); | |
643 | BP_init_header( &packet_norm_bp2.header, |
|
676 | BP_init_header( &packet_norm_bp2.header, | |
644 | APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP2_F1, |
|
677 | APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP2_F1, | |
645 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F1, NB_BINS_COMPRESSED_SM_F1); |
|
678 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F1, NB_BINS_COMPRESSED_SM_F1); | |
646 |
|
679 | |||
647 | //*********************** |
|
680 | //*********************** | |
648 | // BURST and SBM2 headers |
|
681 | // BURST and SBM2 headers | |
649 | if ( lfrRequestedMode == LFR_MODE_BURST ) |
|
682 | if ( lfrRequestedMode == LFR_MODE_BURST ) | |
650 | { |
|
683 | { | |
651 | BP_init_header( &packet_sbm_bp1.header, |
|
684 | BP_init_header( &packet_sbm_bp1.header, | |
652 | APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP1_F1, |
|
685 | APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP1_F1, | |
653 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F1); |
|
686 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F1); | |
654 | BP_init_header( &packet_sbm_bp2.header, |
|
687 | BP_init_header( &packet_sbm_bp2.header, | |
655 | APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP2_F1, |
|
688 | APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP2_F1, | |
656 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F1); |
|
689 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F1); | |
657 | } |
|
690 | } | |
658 | else if ( lfrRequestedMode == LFR_MODE_SBM2 ) |
|
691 | else if ( lfrRequestedMode == LFR_MODE_SBM2 ) | |
659 | { |
|
692 | { | |
660 | BP_init_header( &packet_sbm_bp1.header, |
|
693 | BP_init_header( &packet_sbm_bp1.header, | |
661 | APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP1_F1, |
|
694 | APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP1_F1, | |
662 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F1, NB_BINS_COMPRESSED_SM_SBM_F1); |
|
695 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F1, NB_BINS_COMPRESSED_SM_SBM_F1); | |
663 | BP_init_header( &packet_sbm_bp2.header, |
|
696 | BP_init_header( &packet_sbm_bp2.header, | |
664 | APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP2_F1, |
|
697 | APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP2_F1, | |
665 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F1, NB_BINS_COMPRESSED_SM_SBM_F1); |
|
698 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F1, NB_BINS_COMPRESSED_SM_SBM_F1); | |
666 | } |
|
699 | } | |
667 | else |
|
700 | else | |
668 | { |
|
701 | { | |
669 |
PRINTF1(" |
|
702 | PRINTF1("in PRC1 *** lfrRequestedMode is %d, several headers not initialized\n", (unsigned int) lfrRequestedMode) | |
670 | } |
|
703 | } | |
671 |
|
704 | |||
672 |
status = |
|
705 | status = get_message_queue_id_send( &queue_id_send ); | |
673 | if (status != RTEMS_SUCCESSFUL) |
|
706 | if (status != RTEMS_SUCCESSFUL) | |
674 | { |
|
707 | { | |
675 | PRINTF1("in PRC1 *** ERR get_message_queue_id_send %d\n", status) |
|
708 | PRINTF1("in PRC1 *** ERR get_message_queue_id_send %d\n", status) | |
676 | } |
|
709 | } | |
677 | status = get_message_queue_id_prc1( &queue_id_q_p1); |
|
710 | status = get_message_queue_id_prc1( &queue_id_q_p1); | |
678 | if (status != RTEMS_SUCCESSFUL) |
|
711 | if (status != RTEMS_SUCCESSFUL) | |
679 | { |
|
712 | { | |
680 | PRINTF1("in PRC1 *** ERR get_message_queue_id_prc1 %d\n", status) |
|
713 | PRINTF1("in PRC1 *** ERR get_message_queue_id_prc1 %d\n", status) | |
681 | } |
|
714 | } | |
682 |
|
715 | |||
683 | BOOT_PRINTF1("in PRC1 *** lfrRequestedMode = %d\n", (int) lfrRequestedMode) |
|
716 | BOOT_PRINTF1("in PRC1 *** lfrRequestedMode = %d\n", (int) lfrRequestedMode) | |
684 |
|
717 | |||
685 | while(1){ |
|
718 | while(1){ | |
686 | status = rtems_message_queue_receive( queue_id_q_p1, incomingData, &size, //************************************ |
|
719 | status = rtems_message_queue_receive( queue_id_q_p1, incomingData, &size, //************************************ | |
687 | RTEMS_WAIT, RTEMS_NO_TIMEOUT ); // wait for a message coming from AVF0 |
|
720 | RTEMS_WAIT, RTEMS_NO_TIMEOUT ); // wait for a message coming from AVF0 | |
688 |
|
721 | |||
689 | incomingMsg = (asm_msg*) incomingData; |
|
722 | incomingMsg = (asm_msg*) incomingData; | |
690 |
|
723 | |||
691 | localTime = getTimeAsUnsignedLongLongInt( ); |
|
724 | localTime = getTimeAsUnsignedLongLongInt( ); | |
692 | //*********** |
|
725 | //*********** | |
693 | //*********** |
|
726 | //*********** | |
694 | // BURST SBM2 |
|
727 | // BURST SBM2 | |
695 | //*********** |
|
728 | //*********** | |
696 | //*********** |
|
729 | //*********** | |
697 | if (incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP1_F1 ) |
|
730 | if (incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP1_F1 ) | |
698 | { |
|
731 | { | |
699 | // 1) compress the matrix for Basic Parameters calculation |
|
732 | // 1) compress the matrix for Basic Parameters calculation | |
700 | ASM_compress_reorganize_and_divide( incomingMsg->burst_sbm->matrix, compressed_sm_sbm, |
|
733 | ASM_compress_reorganize_and_divide( incomingMsg->burst_sbm->matrix, compressed_sm_sbm_f1, | |
701 | nb_sm_before_f1.burst_sbm_bp1, |
|
734 | nb_sm_before_f1.burst_sbm_bp1, | |
702 | NB_BINS_COMPRESSED_SM_SBM_F1, NB_BINS_TO_AVERAGE_ASM_SBM_F1, |
|
735 | NB_BINS_COMPRESSED_SM_SBM_F1, NB_BINS_TO_AVERAGE_ASM_SBM_F1, | |
703 | ASM_F1_INDICE_START); |
|
736 | ASM_F1_INDICE_START); | |
704 | // 2) compute the BP1 set |
|
737 | // 2) compute the BP1 set | |
705 |
|
738 | |||
706 | // 3) send the BP1 set |
|
739 | // 3) send the BP1 set | |
707 | set_time( packet_sbm_bp1.header.time, (unsigned char *) &incomingMsg->coarseTime ); |
|
740 | set_time( packet_sbm_bp1.header.time, (unsigned char *) &incomingMsg->coarseTime ); | |
708 | set_time( packet_sbm_bp1.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime ); |
|
741 | set_time( packet_sbm_bp1.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime ); | |
709 | BP_send( (char *) &packet_sbm_bp1.header, queue_id, |
|
742 | BP_send( (char *) &packet_sbm_bp1.header, queue_id_send, | |
710 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F1 + PACKET_LENGTH_DELTA); |
|
743 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F1 + PACKET_LENGTH_DELTA); | |
711 | // 4) compute the BP2 set if needed |
|
744 | // 4) compute the BP2 set if needed | |
712 | if ( incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP2_F1 ) |
|
745 | if ( incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP2_F1 ) | |
713 | { |
|
746 | { | |
714 | // 1) compute the BP2 set |
|
747 | // 1) compute the BP2 set | |
715 |
|
748 | |||
716 | // 2) send the BP2 set |
|
749 | // 2) send the BP2 set | |
717 | set_time( packet_sbm_bp2.header.time, (unsigned char *) &incomingMsg->coarseTime ); |
|
750 | set_time( packet_sbm_bp2.header.time, (unsigned char *) &incomingMsg->coarseTime ); | |
718 | set_time( packet_sbm_bp2.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime ); |
|
751 | set_time( packet_sbm_bp2.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime ); | |
719 | BP_send( (char *) &packet_sbm_bp2.header, queue_id, |
|
752 | BP_send( (char *) &packet_sbm_bp2.header, queue_id_send, | |
720 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F1 + PACKET_LENGTH_DELTA); |
|
753 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F1 + PACKET_LENGTH_DELTA); | |
721 | } |
|
754 | } | |
722 | } |
|
755 | } | |
723 |
|
756 | |||
724 | //***** |
|
757 | //***** | |
725 | //***** |
|
758 | //***** | |
726 | // NORM |
|
759 | // NORM | |
727 | //***** |
|
760 | //***** | |
728 | //***** |
|
761 | //***** | |
729 | if (incomingMsg->event & RTEMS_EVENT_NORM_BP1_F1) |
|
762 | if (incomingMsg->event & RTEMS_EVENT_NORM_BP1_F1) | |
730 | { |
|
763 | { | |
731 | // 1) compress the matrix for Basic Parameters calculation |
|
764 | // 1) compress the matrix for Basic Parameters calculation | |
732 |
ASM_compress_reorganize_and_divide( incomingMsg->norm->matrix, compressed_sm_norm_f |
|
765 | ASM_compress_reorganize_and_divide( incomingMsg->norm->matrix, compressed_sm_norm_f1, | |
733 |
nb_sm_before_f0.norm_bp1 |
|
766 | nb_sm_before_f0.norm_bp1, | |
734 | NB_BINS_COMPRESSED_SM_F0, NB_BINS_TO_AVERAGE_ASM_F0, |
|
767 | NB_BINS_COMPRESSED_SM_F0, NB_BINS_TO_AVERAGE_ASM_F0, | |
735 | ASM_F0_INDICE_START ); |
|
768 | ASM_F0_INDICE_START ); | |
736 | // 2) compute the BP1 set |
|
769 | // 2) compute the BP1 set | |
737 |
|
770 | |||
738 | // 3) send the BP1 set |
|
771 | // 3) send the BP1 set | |
739 | set_time( packet_norm_bp1.header.time, (unsigned char *) &incomingMsg->coarseTime ); |
|
772 | set_time( packet_norm_bp1.header.time, (unsigned char *) &incomingMsg->coarseTime ); | |
740 | set_time( packet_norm_bp1.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime ); |
|
773 | set_time( packet_norm_bp1.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime ); | |
741 | BP_send( (char *) &packet_norm_bp1.header, queue_id, |
|
774 | BP_send( (char *) &packet_norm_bp1.header, queue_id_send, | |
742 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F1 + PACKET_LENGTH_DELTA); |
|
775 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F1 + PACKET_LENGTH_DELTA); | |
743 | if (incomingMsg->event & RTEMS_EVENT_NORM_BP2_F1) |
|
776 | if (incomingMsg->event & RTEMS_EVENT_NORM_BP2_F1) | |
744 | { |
|
777 | { | |
745 | // 1) compute the BP2 set |
|
778 | // 1) compute the BP2 set | |
746 |
|
779 | |||
747 | // 2) send the BP2 set |
|
780 | // 2) send the BP2 set | |
748 | set_time( packet_norm_bp2.header.time, (unsigned char *) &incomingMsg->coarseTime ); |
|
781 | set_time( packet_norm_bp2.header.time, (unsigned char *) &incomingMsg->coarseTime ); | |
749 | set_time( packet_norm_bp2.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime ); |
|
782 | set_time( packet_norm_bp2.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime ); | |
750 | BP_send( (char *) &packet_norm_bp2.header, queue_id, |
|
783 | BP_send( (char *) &packet_norm_bp2.header, queue_id_send, | |
751 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F1 + PACKET_LENGTH_DELTA); |
|
784 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F1 + PACKET_LENGTH_DELTA); | |
752 | } |
|
785 | } | |
753 | } |
|
786 | } | |
754 |
|
787 | |||
755 | if (incomingMsg->event & RTEMS_EVENT_NORM_ASM_F1) |
|
788 | if (incomingMsg->event & RTEMS_EVENT_NORM_ASM_F1) | |
756 | { |
|
789 | { | |
757 | // 1) reorganize the ASM and divide |
|
790 | // 1) reorganize the ASM and divide | |
758 |
ASM_reorganize_and_divide( incomingMsg->norm->matrix, |
|
791 | ASM_reorganize_and_divide( incomingMsg->norm->matrix, | |
|
792 | asm_f1_reorganized, | |||
|
793 | nb_sm_before_f0.norm_bp1 ); | |||
759 | // 2) convert the float array in a char array |
|
794 | // 2) convert the float array in a char array | |
760 |
ASM_convert( asm_f |
|
795 | ASM_convert( asm_f1_reorganized, asm_f1_char); | |
761 | // 3) send the spectral matrix packets |
|
796 | // 3) send the spectral matrix packets | |
762 | set_time( headerASM.time , (unsigned char *) &incomingMsg->coarseTime ); |
|
797 | set_time( headerASM.time , (unsigned char *) &incomingMsg->coarseTime ); | |
763 | set_time( headerASM.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime ); |
|
798 | set_time( headerASM.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime ); | |
764 |
ASM_send( &headerASM, asm_f |
|
799 | ASM_send( &headerASM, asm_f1_char, SID_NORM_ASM_F1, &spw_ioctl_send_ASM, queue_id_send); | |
765 | } |
|
800 | } | |
766 |
|
801 | |||
767 | } |
|
802 | } | |
768 | } |
|
803 | } | |
769 |
|
804 | |||
770 | //****************** |
|
805 | //****************** | |
771 | // Spectral Matrices |
|
806 | // Spectral Matrices | |
772 |
|
807 | |||
773 | void SM_init_rings( void ) |
|
808 | void SM_init_rings( void ) | |
774 | { |
|
809 | { | |
775 | unsigned char i; |
|
810 | unsigned char i; | |
776 |
|
811 | |||
777 | // F0 RING |
|
812 | // F0 RING | |
778 | sm_ring_f0[0].next = (ring_node_sm*) &sm_ring_f0[1]; |
|
813 | sm_ring_f0[0].next = (ring_node_sm*) &sm_ring_f0[1]; | |
779 | sm_ring_f0[0].previous = (ring_node_sm*) &sm_ring_f0[NB_RING_NODES_SM_F0-1]; |
|
814 | sm_ring_f0[0].previous = (ring_node_sm*) &sm_ring_f0[NB_RING_NODES_SM_F0-1]; | |
780 | sm_ring_f0[0].buffer_address = |
|
815 | sm_ring_f0[0].buffer_address = | |
781 | (int) &sm_f0[ 0 ]; |
|
816 | (int) &sm_f0[ 0 ]; | |
782 |
|
817 | |||
783 | sm_ring_f0[NB_RING_NODES_SM_F0-1].next = (ring_node_sm*) &sm_ring_f0[0]; |
|
818 | sm_ring_f0[NB_RING_NODES_SM_F0-1].next = (ring_node_sm*) &sm_ring_f0[0]; | |
784 | sm_ring_f0[NB_RING_NODES_SM_F0-1].previous = (ring_node_sm*) &sm_ring_f0[NB_RING_NODES_SM_F0-2]; |
|
819 | sm_ring_f0[NB_RING_NODES_SM_F0-1].previous = (ring_node_sm*) &sm_ring_f0[NB_RING_NODES_SM_F0-2]; | |
785 | sm_ring_f0[NB_RING_NODES_SM_F0-1].buffer_address = |
|
820 | sm_ring_f0[NB_RING_NODES_SM_F0-1].buffer_address = | |
786 | (int) &sm_f0[ (NB_RING_NODES_SM_F0-1) * TOTAL_SIZE_SM ]; |
|
821 | (int) &sm_f0[ (NB_RING_NODES_SM_F0-1) * TOTAL_SIZE_SM ]; | |
787 |
|
822 | |||
788 | for(i=1; i<NB_RING_NODES_SM_F0-1; i++) |
|
823 | for(i=1; i<NB_RING_NODES_SM_F0-1; i++) | |
789 | { |
|
824 | { | |
790 | sm_ring_f0[i].next = (ring_node_sm*) &sm_ring_f0[i+1]; |
|
825 | sm_ring_f0[i].next = (ring_node_sm*) &sm_ring_f0[i+1]; | |
791 | sm_ring_f0[i].previous = (ring_node_sm*) &sm_ring_f0[i-1]; |
|
826 | sm_ring_f0[i].previous = (ring_node_sm*) &sm_ring_f0[i-1]; | |
792 | sm_ring_f0[i].buffer_address = |
|
827 | sm_ring_f0[i].buffer_address = | |
793 | (int) &sm_f0[ i * TOTAL_SIZE_SM ]; |
|
828 | (int) &sm_f0[ i * TOTAL_SIZE_SM ]; | |
794 | } |
|
829 | } | |
795 |
|
830 | |||
796 | // F1 RING |
|
831 | // F1 RING | |
797 | sm_ring_f1[0].next = (ring_node_sm*) &sm_ring_f1[1]; |
|
832 | sm_ring_f1[0].next = (ring_node_sm*) &sm_ring_f1[1]; | |
798 | sm_ring_f1[0].previous = (ring_node_sm*) &sm_ring_f1[NB_RING_NODES_SM_F1-1]; |
|
833 | sm_ring_f1[0].previous = (ring_node_sm*) &sm_ring_f1[NB_RING_NODES_SM_F1-1]; | |
799 | sm_ring_f1[0].buffer_address = |
|
834 | sm_ring_f1[0].buffer_address = | |
800 | (int) &sm_f1[ 0 ]; |
|
835 | (int) &sm_f1[ 0 ]; | |
801 |
|
836 | |||
802 | sm_ring_f1[NB_RING_NODES_SM_F1-1].next = (ring_node_sm*) &sm_ring_f1[0]; |
|
837 | sm_ring_f1[NB_RING_NODES_SM_F1-1].next = (ring_node_sm*) &sm_ring_f1[0]; | |
803 | sm_ring_f1[NB_RING_NODES_SM_F1-1].previous = (ring_node_sm*) &sm_ring_f1[NB_RING_NODES_SM_F1-2]; |
|
838 | sm_ring_f1[NB_RING_NODES_SM_F1-1].previous = (ring_node_sm*) &sm_ring_f1[NB_RING_NODES_SM_F1-2]; | |
804 | sm_ring_f1[NB_RING_NODES_SM_F1-1].buffer_address = |
|
839 | sm_ring_f1[NB_RING_NODES_SM_F1-1].buffer_address = | |
805 | (int) &sm_f1[ (NB_RING_NODES_SM_F1-1) * TOTAL_SIZE_SM ]; |
|
840 | (int) &sm_f1[ (NB_RING_NODES_SM_F1-1) * TOTAL_SIZE_SM ]; | |
806 |
|
841 | |||
807 | for(i=1; i<NB_RING_NODES_SM_F1-1; i++) |
|
842 | for(i=1; i<NB_RING_NODES_SM_F1-1; i++) | |
808 | { |
|
843 | { | |
809 | sm_ring_f1[i].next = (ring_node_sm*) &sm_ring_f1[i+1]; |
|
844 | sm_ring_f1[i].next = (ring_node_sm*) &sm_ring_f1[i+1]; | |
810 | sm_ring_f1[i].previous = (ring_node_sm*) &sm_ring_f1[i-1]; |
|
845 | sm_ring_f1[i].previous = (ring_node_sm*) &sm_ring_f1[i-1]; | |
811 | sm_ring_f1[i].buffer_address = |
|
846 | sm_ring_f1[i].buffer_address = | |
812 | (int) &sm_f1[ i * TOTAL_SIZE_SM ]; |
|
847 | (int) &sm_f1[ i * TOTAL_SIZE_SM ]; | |
813 | } |
|
848 | } | |
814 |
|
849 | |||
815 | // F2 RING |
|
850 | // F2 RING | |
816 | sm_ring_f2[0].next = (ring_node_sm*) &sm_ring_f2[1]; |
|
851 | sm_ring_f2[0].next = (ring_node_sm*) &sm_ring_f2[1]; | |
817 | sm_ring_f2[0].previous = (ring_node_sm*) &sm_ring_f2[NB_RING_NODES_SM_F2-1]; |
|
852 | sm_ring_f2[0].previous = (ring_node_sm*) &sm_ring_f2[NB_RING_NODES_SM_F2-1]; | |
818 | sm_ring_f2[0].buffer_address = |
|
853 | sm_ring_f2[0].buffer_address = | |
819 | (int) &sm_f2[ 0 ]; |
|
854 | (int) &sm_f2[ 0 ]; | |
820 |
|
855 | |||
821 | sm_ring_f2[NB_RING_NODES_SM_F2-1].next = (ring_node_sm*) &sm_ring_f2[0]; |
|
856 | sm_ring_f2[NB_RING_NODES_SM_F2-1].next = (ring_node_sm*) &sm_ring_f2[0]; | |
822 | sm_ring_f2[NB_RING_NODES_SM_F2-1].previous = (ring_node_sm*) &sm_ring_f2[NB_RING_NODES_SM_F2-2]; |
|
857 | sm_ring_f2[NB_RING_NODES_SM_F2-1].previous = (ring_node_sm*) &sm_ring_f2[NB_RING_NODES_SM_F2-2]; | |
823 | sm_ring_f2[NB_RING_NODES_SM_F2-1].buffer_address = |
|
858 | sm_ring_f2[NB_RING_NODES_SM_F2-1].buffer_address = | |
824 | (int) &sm_f2[ (NB_RING_NODES_SM_F2-1) * TOTAL_SIZE_SM ]; |
|
859 | (int) &sm_f2[ (NB_RING_NODES_SM_F2-1) * TOTAL_SIZE_SM ]; | |
825 |
|
860 | |||
826 | for(i=1; i<NB_RING_NODES_SM_F2-1; i++) |
|
861 | for(i=1; i<NB_RING_NODES_SM_F2-1; i++) | |
827 | { |
|
862 | { | |
828 | sm_ring_f2[i].next = (ring_node_sm*) &sm_ring_f2[i+1]; |
|
863 | sm_ring_f2[i].next = (ring_node_sm*) &sm_ring_f2[i+1]; | |
829 | sm_ring_f2[i].previous = (ring_node_sm*) &sm_ring_f2[i-1]; |
|
864 | sm_ring_f2[i].previous = (ring_node_sm*) &sm_ring_f2[i-1]; | |
830 | sm_ring_f2[i].buffer_address = |
|
865 | sm_ring_f2[i].buffer_address = | |
831 | (int) &sm_f2[ i * TOTAL_SIZE_SM ]; |
|
866 | (int) &sm_f2[ i * TOTAL_SIZE_SM ]; | |
832 | } |
|
867 | } | |
833 |
|
868 | |||
834 | DEBUG_PRINTF1("asm_ring_f0 @%x\n", (unsigned int) sm_ring_f0) |
|
869 | DEBUG_PRINTF1("asm_ring_f0 @%x\n", (unsigned int) sm_ring_f0) | |
835 | DEBUG_PRINTF1("asm_ring_f1 @%x\n", (unsigned int) sm_ring_f1) |
|
870 | DEBUG_PRINTF1("asm_ring_f1 @%x\n", (unsigned int) sm_ring_f1) | |
836 | DEBUG_PRINTF1("asm_ring_f2 @%x\n", (unsigned int) sm_ring_f2) |
|
871 | DEBUG_PRINTF1("asm_ring_f2 @%x\n", (unsigned int) sm_ring_f2) | |
837 |
|
872 | |||
838 | spectral_matrix_regs->matrixF0_Address0 = sm_ring_f0[0].buffer_address; |
|
873 | spectral_matrix_regs->matrixF0_Address0 = sm_ring_f0[0].buffer_address; | |
839 | DEBUG_PRINTF1("spectral_matrix_regs->matrixF0_Address0 @%x\n", spectral_matrix_regs->matrixF0_Address0) |
|
874 | DEBUG_PRINTF1("spectral_matrix_regs->matrixF0_Address0 @%x\n", spectral_matrix_regs->matrixF0_Address0) | |
840 | } |
|
875 | } | |
841 |
|
876 | |||
842 | void ASM_init_rings( void ) |
|
877 | void ASM_init_rings( void ) | |
843 | { |
|
878 | { | |
844 | //*** |
|
879 | //*** | |
845 | // F0 |
|
880 | // F0 | |
846 | // NORM |
|
881 | // NORM | |
847 | ASM_generic_init_ring( asm_ring_norm_f0, NB_RING_NODES_ASM_NORM_F0 ); |
|
882 | ASM_generic_init_ring( asm_ring_norm_f0, NB_RING_NODES_ASM_NORM_F0 ); | |
848 | // BURST_SBM |
|
883 | // BURST_SBM | |
849 | ASM_generic_init_ring( asm_ring_burst_sbm_f0, NB_RING_NODES_ASM_BURST_SBM_F0 ); |
|
884 | ASM_generic_init_ring( asm_ring_burst_sbm_f0, NB_RING_NODES_ASM_BURST_SBM_F0 ); | |
850 |
|
885 | |||
851 | //*** |
|
886 | //*** | |
852 | // F1 |
|
887 | // F1 | |
853 | //***** |
|
888 | //***** | |
854 | // NORM |
|
889 | // NORM | |
855 | ASM_generic_init_ring( asm_ring_norm_f1, NB_RING_NODES_ASM_NORM_F1 ); |
|
890 | ASM_generic_init_ring( asm_ring_norm_f1, NB_RING_NODES_ASM_NORM_F1 ); | |
856 | // BURST_SBM |
|
891 | // BURST_SBM | |
857 | ASM_generic_init_ring( asm_ring_burst_sbm_f1, NB_RING_NODES_ASM_BURST_SBM_F1 ); |
|
892 | ASM_generic_init_ring( asm_ring_burst_sbm_f1, NB_RING_NODES_ASM_BURST_SBM_F1 ); | |
858 | } |
|
893 | } | |
859 |
|
894 | |||
860 | void ASM_generic_init_ring( ring_node_asm *ring, unsigned char nbNodes ) |
|
895 | void ASM_generic_init_ring( ring_node_asm *ring, unsigned char nbNodes ) | |
861 | { |
|
896 | { | |
862 | unsigned char i; |
|
897 | unsigned char i; | |
863 |
|
898 | |||
864 | ring[ nbNodes - 1 ].next |
|
899 | ring[ nbNodes - 1 ].next | |
865 | = (ring_node_asm*) &ring[ 0 ]; |
|
900 | = (ring_node_asm*) &ring[ 0 ]; | |
866 |
|
901 | |||
867 | for(i=0; i<nbNodes-1; i++) |
|
902 | for(i=0; i<nbNodes-1; i++) | |
868 | { |
|
903 | { | |
869 | ring[ i ].next = (ring_node_asm*) &ring[ i + 1 ]; |
|
904 | ring[ i ].next = (ring_node_asm*) &ring[ i + 1 ]; | |
870 | } |
|
905 | } | |
871 | } |
|
906 | } | |
872 |
|
907 | |||
873 | void SM_reset_current_ring_nodes( void ) |
|
908 | void SM_reset_current_ring_nodes( void ) | |
874 | { |
|
909 | { | |
875 | current_ring_node_sm_f0 = sm_ring_f0; |
|
910 | current_ring_node_sm_f0 = sm_ring_f0; | |
876 | current_ring_node_sm_f1 = sm_ring_f1; |
|
911 | current_ring_node_sm_f1 = sm_ring_f1; | |
877 | current_ring_node_sm_f2 = sm_ring_f2; |
|
912 | current_ring_node_sm_f2 = sm_ring_f2; | |
878 |
|
913 | |||
879 | ring_node_for_averaging_sm_f0 = sm_ring_f0; |
|
914 | ring_node_for_averaging_sm_f0 = sm_ring_f0; | |
880 | } |
|
915 | } | |
881 |
|
916 | |||
882 | void ASM_reset_current_ring_nodes( void ) |
|
917 | void ASM_reset_current_ring_nodes( void ) | |
883 | { |
|
918 | { | |
884 | current_ring_node_asm_norm_f0 = asm_ring_norm_f0; |
|
919 | current_ring_node_asm_norm_f0 = asm_ring_norm_f0; | |
885 | current_ring_node_asm_burst_sbm_f0 = asm_ring_burst_sbm_f0; |
|
920 | current_ring_node_asm_burst_sbm_f0 = asm_ring_burst_sbm_f0; | |
886 |
|
921 | |||
887 | current_ring_node_asm_norm_f1 = asm_ring_norm_f1; |
|
922 | current_ring_node_asm_norm_f1 = asm_ring_norm_f1; | |
888 | current_ring_node_asm_burst_sbm_f1 = asm_ring_burst_sbm_f1; |
|
923 | current_ring_node_asm_burst_sbm_f1 = asm_ring_burst_sbm_f1; | |
889 | } |
|
924 | } | |
890 |
|
925 | |||
891 | void ASM_init_header( Header_TM_LFR_SCIENCE_ASM_t *header) |
|
926 | void ASM_init_header( Header_TM_LFR_SCIENCE_ASM_t *header) | |
892 | { |
|
927 | { | |
893 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
928 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; | |
894 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
929 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
895 | header->reserved = 0x00; |
|
930 | header->reserved = 0x00; | |
896 | header->userApplication = CCSDS_USER_APP; |
|
931 | header->userApplication = CCSDS_USER_APP; | |
897 | header->packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8); |
|
932 | header->packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8); | |
898 | header->packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST); |
|
933 | header->packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST); | |
899 | header->packetSequenceControl[0] = 0xc0; |
|
934 | header->packetSequenceControl[0] = 0xc0; | |
900 | header->packetSequenceControl[1] = 0x00; |
|
935 | header->packetSequenceControl[1] = 0x00; | |
901 | header->packetLength[0] = 0x00; |
|
936 | header->packetLength[0] = 0x00; | |
902 | header->packetLength[1] = 0x00; |
|
937 | header->packetLength[1] = 0x00; | |
903 | // DATA FIELD HEADER |
|
938 | // DATA FIELD HEADER | |
904 | header->spare1_pusVersion_spare2 = 0x10; |
|
939 | header->spare1_pusVersion_spare2 = 0x10; | |
905 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
940 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
906 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
941 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
907 | header->destinationID = TM_DESTINATION_ID_GROUND; |
|
942 | header->destinationID = TM_DESTINATION_ID_GROUND; | |
908 | // AUXILIARY DATA HEADER |
|
943 | // AUXILIARY DATA HEADER | |
909 | header->sid = 0x00; |
|
944 | header->sid = 0x00; | |
910 | header->biaStatusInfo = 0x00; |
|
945 | header->biaStatusInfo = 0x00; | |
911 | header->pa_lfr_pkt_cnt_asm = 0x00; |
|
946 | header->pa_lfr_pkt_cnt_asm = 0x00; | |
912 | header->pa_lfr_pkt_nr_asm = 0x00; |
|
947 | header->pa_lfr_pkt_nr_asm = 0x00; | |
913 | header->time[0] = 0x00; |
|
948 | header->time[0] = 0x00; | |
914 | header->time[0] = 0x00; |
|
949 | header->time[0] = 0x00; | |
915 | header->time[0] = 0x00; |
|
950 | header->time[0] = 0x00; | |
916 | header->time[0] = 0x00; |
|
951 | header->time[0] = 0x00; | |
917 | header->time[0] = 0x00; |
|
952 | header->time[0] = 0x00; | |
918 | header->time[0] = 0x00; |
|
953 | header->time[0] = 0x00; | |
919 | header->pa_lfr_asm_blk_nr[0] = 0x00; // BLK_NR MSB |
|
954 | header->pa_lfr_asm_blk_nr[0] = 0x00; // BLK_NR MSB | |
920 | header->pa_lfr_asm_blk_nr[1] = 0x00; // BLK_NR LSB |
|
955 | header->pa_lfr_asm_blk_nr[1] = 0x00; // BLK_NR LSB | |
921 | } |
|
956 | } | |
922 |
|
957 | |||
923 | void SM_average( float *averaged_spec_mat_f0, float *averaged_spec_mat_f1, |
|
958 | void SM_average( float *averaged_spec_mat_f0, float *averaged_spec_mat_f1, | |
924 | ring_node_sm *ring_node_tab[], |
|
959 | ring_node_sm *ring_node_tab[], | |
925 | unsigned int nbAverageNormF0, unsigned int nbAverageSBM1F0 ) |
|
960 | unsigned int nbAverageNormF0, unsigned int nbAverageSBM1F0 ) | |
926 | { |
|
961 | { | |
927 | float sum; |
|
962 | float sum; | |
928 | unsigned int i; |
|
963 | unsigned int i; | |
929 |
|
964 | |||
930 | for(i=0; i<TOTAL_SIZE_SM; i++) |
|
965 | for(i=0; i<TOTAL_SIZE_SM; i++) | |
931 | { |
|
966 | { | |
932 | sum = ( (int *) (ring_node_tab[0]->buffer_address) ) [ i ] |
|
967 | sum = ( (int *) (ring_node_tab[0]->buffer_address) ) [ i ] | |
933 | + ( (int *) (ring_node_tab[1]->buffer_address) ) [ i ] |
|
968 | + ( (int *) (ring_node_tab[1]->buffer_address) ) [ i ] | |
934 | + ( (int *) (ring_node_tab[2]->buffer_address) ) [ i ] |
|
969 | + ( (int *) (ring_node_tab[2]->buffer_address) ) [ i ] | |
935 | + ( (int *) (ring_node_tab[3]->buffer_address) ) [ i ] |
|
970 | + ( (int *) (ring_node_tab[3]->buffer_address) ) [ i ] | |
936 | + ( (int *) (ring_node_tab[4]->buffer_address) ) [ i ] |
|
971 | + ( (int *) (ring_node_tab[4]->buffer_address) ) [ i ] | |
937 | + ( (int *) (ring_node_tab[5]->buffer_address) ) [ i ] |
|
972 | + ( (int *) (ring_node_tab[5]->buffer_address) ) [ i ] | |
938 | + ( (int *) (ring_node_tab[6]->buffer_address) ) [ i ] |
|
973 | + ( (int *) (ring_node_tab[6]->buffer_address) ) [ i ] | |
939 | + ( (int *) (ring_node_tab[7]->buffer_address) ) [ i ]; |
|
974 | + ( (int *) (ring_node_tab[7]->buffer_address) ) [ i ]; | |
940 |
|
975 | |||
941 | if ( (nbAverageNormF0 == 0) && (nbAverageSBM1F0 == 0) ) |
|
976 | if ( (nbAverageNormF0 == 0) && (nbAverageSBM1F0 == 0) ) | |
942 | { |
|
977 | { | |
943 | averaged_spec_mat_f0[ i ] = sum; |
|
978 | averaged_spec_mat_f0[ i ] = sum; | |
944 | averaged_spec_mat_f1[ i ] = sum; |
|
979 | averaged_spec_mat_f1[ i ] = sum; | |
945 | } |
|
980 | } | |
946 | else if ( (nbAverageNormF0 != 0) && (nbAverageSBM1F0 != 0) ) |
|
981 | else if ( (nbAverageNormF0 != 0) && (nbAverageSBM1F0 != 0) ) | |
947 | { |
|
982 | { | |
948 | averaged_spec_mat_f0[ i ] = ( averaged_spec_mat_f0[ i ] + sum ); |
|
983 | averaged_spec_mat_f0[ i ] = ( averaged_spec_mat_f0[ i ] + sum ); | |
949 | averaged_spec_mat_f1[ i ] = ( averaged_spec_mat_f1[ i ] + sum ); |
|
984 | averaged_spec_mat_f1[ i ] = ( averaged_spec_mat_f1[ i ] + sum ); | |
950 | } |
|
985 | } | |
951 | else if ( (nbAverageNormF0 != 0) && (nbAverageSBM1F0 == 0) ) |
|
986 | else if ( (nbAverageNormF0 != 0) && (nbAverageSBM1F0 == 0) ) | |
952 | { |
|
987 | { | |
953 | averaged_spec_mat_f0[ i ] = ( averaged_spec_mat_f0[ i ] + sum ); |
|
988 | averaged_spec_mat_f0[ i ] = ( averaged_spec_mat_f0[ i ] + sum ); | |
954 | averaged_spec_mat_f1[ i ] = sum; |
|
989 | averaged_spec_mat_f1[ i ] = sum; | |
955 | } |
|
990 | } | |
956 | else |
|
991 | else | |
957 | { |
|
992 | { | |
958 | PRINTF2("ERR *** in SM_average *** unexpected parameters %d %d\n", nbAverageNormF0, nbAverageSBM1F0) |
|
993 | PRINTF2("ERR *** in SM_average *** unexpected parameters %d %d\n", nbAverageNormF0, nbAverageSBM1F0) | |
959 | } |
|
994 | } | |
960 | } |
|
995 | } | |
961 | } |
|
996 | } | |
962 |
|
997 | |||
963 | void ASM_reorganize_and_divide( float *averaged_spec_mat, float *averaged_spec_mat_reorganized, float divider ) |
|
998 | void ASM_reorganize_and_divide( float *averaged_spec_mat, float *averaged_spec_mat_reorganized, float divider ) | |
964 | { |
|
999 | { | |
965 | int frequencyBin; |
|
1000 | int frequencyBin; | |
966 | int asmComponent; |
|
1001 | int asmComponent; | |
967 | unsigned int offsetAveragedSpecMatReorganized; |
|
1002 | unsigned int offsetAveragedSpecMatReorganized; | |
968 | unsigned int offsetAveragedSpecMat; |
|
1003 | unsigned int offsetAveragedSpecMat; | |
969 |
|
1004 | |||
970 | for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++) |
|
1005 | for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++) | |
971 | { |
|
1006 | { | |
972 | for( frequencyBin = 0; frequencyBin < NB_BINS_PER_SM; frequencyBin++ ) |
|
1007 | for( frequencyBin = 0; frequencyBin < NB_BINS_PER_SM; frequencyBin++ ) | |
973 | { |
|
1008 | { | |
974 | offsetAveragedSpecMatReorganized = |
|
1009 | offsetAveragedSpecMatReorganized = | |
975 | frequencyBin * NB_VALUES_PER_SM |
|
1010 | frequencyBin * NB_VALUES_PER_SM | |
976 | + asmComponent; |
|
1011 | + asmComponent; | |
977 | offsetAveragedSpecMat = |
|
1012 | offsetAveragedSpecMat = | |
978 | asmComponent * NB_BINS_PER_SM |
|
1013 | asmComponent * NB_BINS_PER_SM | |
979 | + frequencyBin; |
|
1014 | + frequencyBin; | |
980 | averaged_spec_mat_reorganized[offsetAveragedSpecMatReorganized ] = |
|
1015 | averaged_spec_mat_reorganized[offsetAveragedSpecMatReorganized ] = | |
981 | averaged_spec_mat[ offsetAveragedSpecMat ] / divider; |
|
1016 | averaged_spec_mat[ offsetAveragedSpecMat ] / divider; | |
982 | } |
|
1017 | } | |
983 | } |
|
1018 | } | |
984 | } |
|
1019 | } | |
985 |
|
1020 | |||
986 | void ASM_compress_reorganize_and_divide(float *averaged_spec_mat, float *compressed_spec_mat , float divider, |
|
1021 | void ASM_compress_reorganize_and_divide(float *averaged_spec_mat, float *compressed_spec_mat , float divider, | |
987 | unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage, unsigned char ASMIndexStart ) |
|
1022 | unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage, unsigned char ASMIndexStart ) | |
988 | { |
|
1023 | { | |
989 | int frequencyBin; |
|
1024 | int frequencyBin; | |
990 | int asmComponent; |
|
1025 | int asmComponent; | |
991 | int offsetASM; |
|
1026 | int offsetASM; | |
992 | int offsetCompressed; |
|
1027 | int offsetCompressed; | |
993 | int k; |
|
1028 | int k; | |
994 |
|
1029 | |||
995 | // build data |
|
1030 | // build data | |
996 | for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++) |
|
1031 | for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++) | |
997 | { |
|
1032 | { | |
998 | for( frequencyBin = 0; frequencyBin < nbBinsCompressedMatrix; frequencyBin++ ) |
|
1033 | for( frequencyBin = 0; frequencyBin < nbBinsCompressedMatrix; frequencyBin++ ) | |
999 | { |
|
1034 | { | |
1000 | offsetCompressed = // NO TIME OFFSET |
|
1035 | offsetCompressed = // NO TIME OFFSET | |
1001 | frequencyBin * NB_VALUES_PER_SM |
|
1036 | frequencyBin * NB_VALUES_PER_SM | |
1002 | + asmComponent; |
|
1037 | + asmComponent; | |
1003 | offsetASM = // NO TIME OFFSET |
|
1038 | offsetASM = // NO TIME OFFSET | |
1004 | asmComponent * NB_BINS_PER_SM |
|
1039 | asmComponent * NB_BINS_PER_SM | |
1005 | + ASMIndexStart |
|
1040 | + ASMIndexStart | |
1006 | + frequencyBin * nbBinsToAverage; |
|
1041 | + frequencyBin * nbBinsToAverage; | |
1007 | compressed_spec_mat[ offsetCompressed ] = 0; |
|
1042 | compressed_spec_mat[ offsetCompressed ] = 0; | |
1008 | for ( k = 0; k < nbBinsToAverage; k++ ) |
|
1043 | for ( k = 0; k < nbBinsToAverage; k++ ) | |
1009 | { |
|
1044 | { | |
1010 | compressed_spec_mat[offsetCompressed ] = |
|
1045 | compressed_spec_mat[offsetCompressed ] = | |
1011 | ( compressed_spec_mat[ offsetCompressed ] |
|
1046 | ( compressed_spec_mat[ offsetCompressed ] | |
1012 | + averaged_spec_mat[ offsetASM + k ] ) / (divider * nbBinsToAverage); |
|
1047 | + averaged_spec_mat[ offsetASM + k ] ) / (divider * nbBinsToAverage); | |
1013 | } |
|
1048 | } | |
1014 | } |
|
1049 | } | |
1015 | } |
|
1050 | } | |
1016 | } |
|
1051 | } | |
1017 |
|
1052 | |||
1018 | void ASM_convert( volatile float *input_matrix, char *output_matrix) |
|
1053 | void ASM_convert( volatile float *input_matrix, char *output_matrix) | |
1019 | { |
|
1054 | { | |
1020 | unsigned int frequencyBin; |
|
1055 | unsigned int frequencyBin; | |
1021 | unsigned int asmComponent; |
|
1056 | unsigned int asmComponent; | |
1022 | char * pt_char_input; |
|
1057 | char * pt_char_input; | |
1023 | char * pt_char_output; |
|
1058 | char * pt_char_output; | |
1024 | unsigned int offsetInput; |
|
1059 | unsigned int offsetInput; | |
1025 | unsigned int offsetOutput; |
|
1060 | unsigned int offsetOutput; | |
1026 |
|
1061 | |||
1027 | pt_char_input = (char*) &input_matrix; |
|
1062 | pt_char_input = (char*) &input_matrix; | |
1028 | pt_char_output = (char*) &output_matrix; |
|
1063 | pt_char_output = (char*) &output_matrix; | |
1029 |
|
1064 | |||
1030 | // convert all other data |
|
1065 | // convert all other data | |
1031 | for( frequencyBin=0; frequencyBin<NB_BINS_PER_SM; frequencyBin++) |
|
1066 | for( frequencyBin=0; frequencyBin<NB_BINS_PER_SM; frequencyBin++) | |
1032 | { |
|
1067 | { | |
1033 | for ( asmComponent=0; asmComponent<NB_VALUES_PER_SM; asmComponent++) |
|
1068 | for ( asmComponent=0; asmComponent<NB_VALUES_PER_SM; asmComponent++) | |
1034 | { |
|
1069 | { | |
1035 | offsetInput = (frequencyBin*NB_VALUES_PER_SM) + asmComponent ; |
|
1070 | offsetInput = (frequencyBin*NB_VALUES_PER_SM) + asmComponent ; | |
1036 | offsetOutput = 2 * ( (frequencyBin*NB_VALUES_PER_SM) + asmComponent ) ; |
|
1071 | offsetOutput = 2 * ( (frequencyBin*NB_VALUES_PER_SM) + asmComponent ) ; | |
1037 | pt_char_input = (char*) &input_matrix [ offsetInput ]; |
|
1072 | pt_char_input = (char*) &input_matrix [ offsetInput ]; | |
1038 | pt_char_output = (char*) &output_matrix[ offsetOutput ]; |
|
1073 | pt_char_output = (char*) &output_matrix[ offsetOutput ]; | |
1039 | pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float |
|
1074 | pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float | |
1040 | pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float |
|
1075 | pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float | |
1041 | } |
|
1076 | } | |
1042 | } |
|
1077 | } | |
1043 | } |
|
1078 | } | |
1044 |
|
1079 | |||
1045 | void ASM_send(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, |
|
1080 | void ASM_send(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, | |
1046 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id) |
|
1081 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id) | |
1047 | { |
|
1082 | { | |
1048 | unsigned int i; |
|
1083 | unsigned int i; | |
1049 | unsigned int length = 0; |
|
1084 | unsigned int length = 0; | |
1050 | rtems_status_code status; |
|
1085 | rtems_status_code status; | |
1051 |
|
1086 | |||
1052 | for (i=0; i<2; i++) |
|
1087 | for (i=0; i<2; i++) | |
1053 | { |
|
1088 | { | |
1054 | // (1) BUILD THE DATA |
|
1089 | // (1) BUILD THE DATA | |
1055 | switch(sid) |
|
1090 | switch(sid) | |
1056 | { |
|
1091 | { | |
1057 | case SID_NORM_ASM_F0: |
|
1092 | case SID_NORM_ASM_F0: | |
1058 | spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F0_IN_BYTES / 2; |
|
1093 | spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F0_IN_BYTES / 2; // 2 packets will be sent | |
1059 | spw_ioctl_send->data = &spectral_matrix[ |
|
1094 | spw_ioctl_send->data = &spectral_matrix[ | |
1060 | ( (ASM_F0_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F0) ) * NB_VALUES_PER_SM ) * 2 |
|
1095 | ( (ASM_F0_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F0) ) * NB_VALUES_PER_SM ) * 2 | |
1061 | ]; |
|
1096 | ]; | |
1062 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0; |
|
1097 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0; | |
1063 | header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F0) >> 8 ); // BLK_NR MSB |
|
1098 | header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F0) >> 8 ); // BLK_NR MSB | |
1064 | header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F0); // BLK_NR LSB |
|
1099 | header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F0); // BLK_NR LSB | |
1065 | break; |
|
1100 | break; | |
1066 | case SID_NORM_ASM_F1: |
|
1101 | case SID_NORM_ASM_F1: | |
|
1102 | spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F1_IN_BYTES / 2; // 2 packets will be sent | |||
|
1103 | spw_ioctl_send->data = &spectral_matrix[ | |||
|
1104 | ( (ASM_F1_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F1) ) * NB_VALUES_PER_SM ) * 2 | |||
|
1105 | ]; | |||
|
1106 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F1; | |||
|
1107 | header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F1) >> 8 ); // BLK_NR MSB | |||
|
1108 | header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F1); // BLK_NR LSB | |||
1067 | break; |
|
1109 | break; | |
1068 | case SID_NORM_ASM_F2: |
|
1110 | case SID_NORM_ASM_F2: | |
1069 | break; |
|
1111 | break; | |
1070 | default: |
|
1112 | default: | |
1071 | PRINTF1("ERR *** in ASM_send *** unexpected sid %d\n", sid) |
|
1113 | PRINTF1("ERR *** in ASM_send *** unexpected sid %d\n", sid) | |
1072 | break; |
|
1114 | break; | |
1073 | } |
|
1115 | } | |
1074 | spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
1116 | spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES; | |
1075 | spw_ioctl_send->hdr = (char *) header; |
|
1117 | spw_ioctl_send->hdr = (char *) header; | |
1076 | spw_ioctl_send->options = 0; |
|
1118 | spw_ioctl_send->options = 0; | |
1077 |
|
1119 | |||
1078 | // (2) BUILD THE HEADER |
|
1120 | // (2) BUILD THE HEADER | |
1079 | header->packetLength[0] = (unsigned char) (length>>8); |
|
1121 | header->packetLength[0] = (unsigned char) (length>>8); | |
1080 | header->packetLength[1] = (unsigned char) (length); |
|
1122 | header->packetLength[1] = (unsigned char) (length); | |
1081 | header->sid = (unsigned char) sid; // SID |
|
1123 | header->sid = (unsigned char) sid; // SID | |
1082 | header->pa_lfr_pkt_cnt_asm = 2; |
|
1124 | header->pa_lfr_pkt_cnt_asm = 2; | |
1083 | header->pa_lfr_pkt_nr_asm = (unsigned char) (i+1); |
|
1125 | header->pa_lfr_pkt_nr_asm = (unsigned char) (i+1); | |
1084 |
|
1126 | |||
1085 | // (3) SET PACKET TIME |
|
1127 | // (3) SET PACKET TIME | |
1086 | header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
1128 | header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
1087 | header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
1129 | header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
1088 | header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
1130 | header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
1089 | header->time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
1131 | header->time[3] = (unsigned char) (time_management_regs->coarse_time); | |
1090 | header->time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
1132 | header->time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
1091 | header->time[5] = (unsigned char) (time_management_regs->fine_time); |
|
1133 | header->time[5] = (unsigned char) (time_management_regs->fine_time); | |
1092 | // |
|
1134 | // | |
1093 | header->acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
1135 | header->acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
1094 | header->acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
1136 | header->acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
1095 | header->acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
1137 | header->acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
1096 | header->acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time); |
|
1138 | header->acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time); | |
1097 | header->acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
1139 | header->acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
1098 | header->acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time); |
|
1140 | header->acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time); | |
1099 |
|
1141 | |||
1100 | // (4) SEND PACKET |
|
1142 | // (4) SEND PACKET | |
1101 | status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE); |
|
1143 | status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE); | |
1102 | if (status != RTEMS_SUCCESSFUL) { |
|
1144 | if (status != RTEMS_SUCCESSFUL) { | |
1103 | printf("in ASM_send *** ERR %d\n", (int) status); |
|
1145 | printf("in ASM_send *** ERR %d\n", (int) status); | |
1104 | } |
|
1146 | } | |
1105 | } |
|
1147 | } | |
1106 | } |
|
1148 | } | |
1107 |
|
1149 | |||
1108 | //***************** |
|
1150 | //***************** | |
1109 | // Basic Parameters |
|
1151 | // Basic Parameters | |
1110 |
|
1152 | |||
1111 | void BP_init_header( Header_TM_LFR_SCIENCE_BP_t *header, |
|
1153 | void BP_init_header( Header_TM_LFR_SCIENCE_BP_t *header, | |
1112 | unsigned int apid, unsigned char sid, |
|
1154 | unsigned int apid, unsigned char sid, | |
1113 | unsigned int packetLength, unsigned char blkNr ) |
|
1155 | unsigned int packetLength, unsigned char blkNr ) | |
1114 | { |
|
1156 | { | |
1115 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
1157 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; | |
1116 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
1158 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
1117 | header->reserved = 0x00; |
|
1159 | header->reserved = 0x00; | |
1118 | header->userApplication = CCSDS_USER_APP; |
|
1160 | header->userApplication = CCSDS_USER_APP; | |
1119 | header->packetID[0] = (unsigned char) (apid >> 8); |
|
1161 | header->packetID[0] = (unsigned char) (apid >> 8); | |
1120 | header->packetID[1] = (unsigned char) (apid); |
|
1162 | header->packetID[1] = (unsigned char) (apid); | |
1121 | header->packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
1163 | header->packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
1122 | header->packetSequenceControl[1] = 0x00; |
|
1164 | header->packetSequenceControl[1] = 0x00; | |
1123 | header->packetLength[0] = (unsigned char) (packetLength >> 8); |
|
1165 | header->packetLength[0] = (unsigned char) (packetLength >> 8); | |
1124 | header->packetLength[1] = (unsigned char) (packetLength); |
|
1166 | header->packetLength[1] = (unsigned char) (packetLength); | |
1125 | // DATA FIELD HEADER |
|
1167 | // DATA FIELD HEADER | |
1126 | header->spare1_pusVersion_spare2 = 0x10; |
|
1168 | header->spare1_pusVersion_spare2 = 0x10; | |
1127 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
1169 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
1128 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
1170 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
1129 | header->destinationID = TM_DESTINATION_ID_GROUND; |
|
1171 | header->destinationID = TM_DESTINATION_ID_GROUND; | |
1130 | // AUXILIARY DATA HEADER |
|
1172 | // AUXILIARY DATA HEADER | |
1131 | header->sid = sid; |
|
1173 | header->sid = sid; | |
1132 | header->biaStatusInfo = 0x00; |
|
1174 | header->biaStatusInfo = 0x00; | |
1133 | header->time[0] = 0x00; |
|
1175 | header->time[0] = 0x00; | |
1134 | header->time[0] = 0x00; |
|
1176 | header->time[0] = 0x00; | |
1135 | header->time[0] = 0x00; |
|
1177 | header->time[0] = 0x00; | |
1136 | header->time[0] = 0x00; |
|
1178 | header->time[0] = 0x00; | |
1137 | header->time[0] = 0x00; |
|
1179 | header->time[0] = 0x00; | |
1138 | header->time[0] = 0x00; |
|
1180 | header->time[0] = 0x00; | |
1139 | header->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB |
|
1181 | header->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB | |
1140 | header->pa_lfr_bp_blk_nr[1] = blkNr; // BLK_NR LSB |
|
1182 | header->pa_lfr_bp_blk_nr[1] = blkNr; // BLK_NR LSB | |
1141 | } |
|
1183 | } | |
1142 |
|
1184 | |||
1143 | void BP_init_header_with_spare(Header_TM_LFR_SCIENCE_BP_with_spare_t *header, |
|
1185 | void BP_init_header_with_spare(Header_TM_LFR_SCIENCE_BP_with_spare_t *header, | |
1144 | unsigned int apid, unsigned char sid, |
|
1186 | unsigned int apid, unsigned char sid, | |
1145 | unsigned int packetLength , unsigned char blkNr) |
|
1187 | unsigned int packetLength , unsigned char blkNr) | |
1146 | { |
|
1188 | { | |
1147 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
1189 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; | |
1148 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
1190 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
1149 | header->reserved = 0x00; |
|
1191 | header->reserved = 0x00; | |
1150 | header->userApplication = CCSDS_USER_APP; |
|
1192 | header->userApplication = CCSDS_USER_APP; | |
1151 | header->packetID[0] = (unsigned char) (apid >> 8); |
|
1193 | header->packetID[0] = (unsigned char) (apid >> 8); | |
1152 | header->packetID[1] = (unsigned char) (apid); |
|
1194 | header->packetID[1] = (unsigned char) (apid); | |
1153 | header->packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
1195 | header->packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
1154 | header->packetSequenceControl[1] = 0x00; |
|
1196 | header->packetSequenceControl[1] = 0x00; | |
1155 | header->packetLength[0] = (unsigned char) (packetLength >> 8); |
|
1197 | header->packetLength[0] = (unsigned char) (packetLength >> 8); | |
1156 | header->packetLength[1] = (unsigned char) (packetLength); |
|
1198 | header->packetLength[1] = (unsigned char) (packetLength); | |
1157 | // DATA FIELD HEADER |
|
1199 | // DATA FIELD HEADER | |
1158 | header->spare1_pusVersion_spare2 = 0x10; |
|
1200 | header->spare1_pusVersion_spare2 = 0x10; | |
1159 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
1201 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
1160 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
1202 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
1161 | header->destinationID = TM_DESTINATION_ID_GROUND; |
|
1203 | header->destinationID = TM_DESTINATION_ID_GROUND; | |
1162 | // AUXILIARY DATA HEADER |
|
1204 | // AUXILIARY DATA HEADER | |
1163 | header->sid = sid; |
|
1205 | header->sid = sid; | |
1164 | header->biaStatusInfo = 0x00; |
|
1206 | header->biaStatusInfo = 0x00; | |
1165 | header->time[0] = 0x00; |
|
1207 | header->time[0] = 0x00; | |
1166 | header->time[0] = 0x00; |
|
1208 | header->time[0] = 0x00; | |
1167 | header->time[0] = 0x00; |
|
1209 | header->time[0] = 0x00; | |
1168 | header->time[0] = 0x00; |
|
1210 | header->time[0] = 0x00; | |
1169 | header->time[0] = 0x00; |
|
1211 | header->time[0] = 0x00; | |
1170 | header->time[0] = 0x00; |
|
1212 | header->time[0] = 0x00; | |
1171 | header->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB |
|
1213 | header->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB | |
1172 | header->pa_lfr_bp_blk_nr[1] = blkNr; // BLK_NR LSB |
|
1214 | header->pa_lfr_bp_blk_nr[1] = blkNr; // BLK_NR LSB | |
1173 | } |
|
1215 | } | |
1174 |
|
1216 | |||
1175 | void BP_send(char *data, rtems_id queue_id, unsigned int nbBytesToSend ) |
|
1217 | void BP_send(char *data, rtems_id queue_id, unsigned int nbBytesToSend ) | |
1176 | { |
|
1218 | { | |
1177 | rtems_status_code status; |
|
1219 | rtems_status_code status; | |
1178 |
|
1220 | |||
1179 | // SEND PACKET |
|
1221 | // SEND PACKET | |
1180 | status = rtems_message_queue_send( queue_id, data, nbBytesToSend); |
|
1222 | status = rtems_message_queue_send( queue_id, data, nbBytesToSend); | |
1181 | if (status != RTEMS_SUCCESSFUL) |
|
1223 | if (status != RTEMS_SUCCESSFUL) | |
1182 | { |
|
1224 | { | |
1183 | printf("ERR *** in BP_send *** ERR %d\n", (int) status); |
|
1225 | printf("ERR *** in BP_send *** ERR %d\n", (int) status); | |
1184 | } |
|
1226 | } | |
1185 | } |
|
1227 | } | |
1186 |
|
1228 | |||
1187 | //****************** |
|
1229 | //****************** | |
1188 | // general functions |
|
1230 | // general functions | |
1189 |
|
1231 | |||
1190 | void reset_spectral_matrix_regs( void ) |
|
1232 | void reset_spectral_matrix_regs( void ) | |
1191 | { |
|
1233 | { | |
1192 | /** This function resets the spectral matrices module registers. |
|
1234 | /** This function resets the spectral matrices module registers. | |
1193 | * |
|
1235 | * | |
1194 | * The registers affected by this function are located at the following offset addresses: |
|
1236 | * The registers affected by this function are located at the following offset addresses: | |
1195 | * |
|
1237 | * | |
1196 | * - 0x00 config |
|
1238 | * - 0x00 config | |
1197 | * - 0x04 status |
|
1239 | * - 0x04 status | |
1198 | * - 0x08 matrixF0_Address0 |
|
1240 | * - 0x08 matrixF0_Address0 | |
1199 | * - 0x10 matrixFO_Address1 |
|
1241 | * - 0x10 matrixFO_Address1 | |
1200 | * - 0x14 matrixF1_Address |
|
1242 | * - 0x14 matrixF1_Address | |
1201 | * - 0x18 matrixF2_Address |
|
1243 | * - 0x18 matrixF2_Address | |
1202 | * |
|
1244 | * | |
1203 | */ |
|
1245 | */ | |
1204 |
|
1246 | |||
1205 | spectral_matrix_regs->config = 0x00; |
|
1247 | spectral_matrix_regs->config = 0x00; | |
1206 | spectral_matrix_regs->status = 0x00; |
|
1248 | spectral_matrix_regs->status = 0x00; | |
1207 |
|
1249 | |||
1208 | spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address; |
|
1250 | spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address; | |
1209 | spectral_matrix_regs->matrixFO_Address1 = current_ring_node_sm_f0->buffer_address; |
|
1251 | spectral_matrix_regs->matrixFO_Address1 = current_ring_node_sm_f0->buffer_address; | |
1210 | spectral_matrix_regs->matrixF1_Address = current_ring_node_sm_f1->buffer_address; |
|
1252 | spectral_matrix_regs->matrixF1_Address = current_ring_node_sm_f1->buffer_address; | |
1211 | spectral_matrix_regs->matrixF2_Address = current_ring_node_sm_f2->buffer_address; |
|
1253 | spectral_matrix_regs->matrixF2_Address = current_ring_node_sm_f2->buffer_address; | |
1212 | } |
|
1254 | } | |
1213 |
|
1255 | |||
1214 | void set_time( unsigned char *time, unsigned char * timeInBuffer ) |
|
1256 | void set_time( unsigned char *time, unsigned char * timeInBuffer ) | |
1215 | { |
|
1257 | { | |
1216 | // time[0] = timeInBuffer[2]; |
|
1258 | // time[0] = timeInBuffer[2]; | |
1217 | // time[1] = timeInBuffer[3]; |
|
1259 | // time[1] = timeInBuffer[3]; | |
1218 | // time[2] = timeInBuffer[0]; |
|
1260 | // time[2] = timeInBuffer[0]; | |
1219 | // time[3] = timeInBuffer[1]; |
|
1261 | // time[3] = timeInBuffer[1]; | |
1220 | // time[4] = timeInBuffer[6]; |
|
1262 | // time[4] = timeInBuffer[6]; | |
1221 | // time[5] = timeInBuffer[7]; |
|
1263 | // time[5] = timeInBuffer[7]; | |
1222 |
|
1264 | |||
1223 | time[0] = timeInBuffer[0]; |
|
1265 | time[0] = timeInBuffer[0]; | |
1224 | time[1] = timeInBuffer[1]; |
|
1266 | time[1] = timeInBuffer[1]; | |
1225 | time[2] = timeInBuffer[2]; |
|
1267 | time[2] = timeInBuffer[2]; | |
1226 | time[3] = timeInBuffer[3]; |
|
1268 | time[3] = timeInBuffer[3]; | |
1227 | time[4] = timeInBuffer[6]; |
|
1269 | time[4] = timeInBuffer[6]; | |
1228 | time[5] = timeInBuffer[7]; |
|
1270 | time[5] = timeInBuffer[7]; | |
1229 | } |
|
1271 | } | |
1230 |
|
1272 | |||
1231 |
|
1273 |
@@ -1,921 +1,921 | |||||
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( mode ); |
|
533 | status = restart_science_tasks( mode ); | |
534 | launch_waveform_picker( mode, transitionCoarseTime ); |
|
534 | launch_waveform_picker( mode, transitionCoarseTime ); | |
535 | // launch_spectral_matrix( ); |
|
535 | // launch_spectral_matrix( ); | |
536 |
|
|
536 | launch_spectral_matrix_simu( ); | |
537 | } |
|
537 | } | |
538 | else if ( mode == LFR_MODE_STANDBY ) |
|
538 | else if ( mode == LFR_MODE_STANDBY ) | |
539 | { |
|
539 | { | |
540 | #ifdef PRINT_TASK_STATISTICS |
|
540 | #ifdef PRINT_TASK_STATISTICS | |
541 | rtems_cpu_usage_report(); |
|
541 | rtems_cpu_usage_report(); | |
542 | #endif |
|
542 | #endif | |
543 |
|
543 | |||
544 | #ifdef PRINT_STACK_REPORT |
|
544 | #ifdef PRINT_STACK_REPORT | |
545 | PRINTF("stack report selected\n") |
|
545 | PRINTF("stack report selected\n") | |
546 | rtems_stack_checker_report_usage(); |
|
546 | rtems_stack_checker_report_usage(); | |
547 | #endif |
|
547 | #endif | |
548 | PRINTF1("maxCount = %d\n", maxCount) |
|
548 | PRINTF1("maxCount = %d\n", maxCount) | |
549 | } |
|
549 | } | |
550 | else |
|
550 | else | |
551 | { |
|
551 | { | |
552 | status = RTEMS_UNSATISFIED; |
|
552 | status = RTEMS_UNSATISFIED; | |
553 | } |
|
553 | } | |
554 |
|
554 | |||
555 | if (status != RTEMS_SUCCESSFUL) |
|
555 | if (status != RTEMS_SUCCESSFUL) | |
556 | { |
|
556 | { | |
557 | PRINTF1("ERR *** in enter_mode *** status = %d\n", status) |
|
557 | PRINTF1("ERR *** in enter_mode *** status = %d\n", status) | |
558 | status = RTEMS_UNSATISFIED; |
|
558 | status = RTEMS_UNSATISFIED; | |
559 | } |
|
559 | } | |
560 |
|
560 | |||
561 | return status; |
|
561 | return status; | |
562 | } |
|
562 | } | |
563 |
|
563 | |||
564 | int restart_science_tasks(unsigned char lfrRequestedMode ) |
|
564 | int restart_science_tasks(unsigned char lfrRequestedMode ) | |
565 | { |
|
565 | { | |
566 | /** This function is used to restart all science tasks. |
|
566 | /** This function is used to restart all science tasks. | |
567 | * |
|
567 | * | |
568 | * @return RTEMS directive status codes: |
|
568 | * @return RTEMS directive status codes: | |
569 | * - RTEMS_SUCCESSFUL - task restarted successfully |
|
569 | * - RTEMS_SUCCESSFUL - task restarted successfully | |
570 | * - RTEMS_INVALID_ID - task id invalid |
|
570 | * - RTEMS_INVALID_ID - task id invalid | |
571 | * - RTEMS_INCORRECT_STATE - task never started |
|
571 | * - RTEMS_INCORRECT_STATE - task never started | |
572 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task |
|
572 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task | |
573 | * |
|
573 | * | |
574 | * Science tasks are AVF0, PRC0, WFRM, CWF3, CW2, CWF1 |
|
574 | * Science tasks are AVF0, PRC0, WFRM, CWF3, CW2, CWF1 | |
575 | * |
|
575 | * | |
576 | */ |
|
576 | */ | |
577 |
|
577 | |||
578 | rtems_status_code status[8]; |
|
578 | rtems_status_code status[8]; | |
579 | rtems_status_code ret; |
|
579 | rtems_status_code ret; | |
580 |
|
580 | |||
581 | ret = RTEMS_SUCCESSFUL; |
|
581 | ret = RTEMS_SUCCESSFUL; | |
582 |
|
582 | |||
583 | status[0] = rtems_task_restart( Task_id[TASKID_AVF0], lfrRequestedMode ); |
|
583 | status[0] = rtems_task_restart( Task_id[TASKID_AVF0], lfrRequestedMode ); | |
584 | if (status[0] != RTEMS_SUCCESSFUL) |
|
584 | if (status[0] != RTEMS_SUCCESSFUL) | |
585 | { |
|
585 | { | |
586 | PRINTF1("in restart_science_task *** AVF0 ERR %d\n", status[0]) |
|
586 | PRINTF1("in restart_science_task *** AVF0 ERR %d\n", status[0]) | |
587 | } |
|
587 | } | |
588 |
|
588 | |||
589 | status[1] = rtems_task_restart( Task_id[TASKID_PRC0], lfrRequestedMode ); |
|
589 | status[1] = rtems_task_restart( Task_id[TASKID_PRC0], lfrRequestedMode ); | |
590 | if (status[1] != RTEMS_SUCCESSFUL) |
|
590 | if (status[1] != RTEMS_SUCCESSFUL) | |
591 | { |
|
591 | { | |
592 | PRINTF1("in restart_science_task *** PRC0 ERR %d\n", status[1]) |
|
592 | PRINTF1("in restart_science_task *** PRC0 ERR %d\n", status[1]) | |
593 | } |
|
593 | } | |
594 |
|
594 | |||
595 | status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 ); |
|
595 | status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 ); | |
596 | if (status[2] != RTEMS_SUCCESSFUL) |
|
596 | if (status[2] != RTEMS_SUCCESSFUL) | |
597 | { |
|
597 | { | |
598 | PRINTF1("in restart_science_task *** WFRM ERR %d\n", status[2]) |
|
598 | PRINTF1("in restart_science_task *** WFRM ERR %d\n", status[2]) | |
599 | } |
|
599 | } | |
600 |
|
600 | |||
601 | status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 ); |
|
601 | status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 ); | |
602 | if (status[3] != RTEMS_SUCCESSFUL) |
|
602 | if (status[3] != RTEMS_SUCCESSFUL) | |
603 | { |
|
603 | { | |
604 | PRINTF1("in restart_science_task *** CWF3 ERR %d\n", status[3]) |
|
604 | PRINTF1("in restart_science_task *** CWF3 ERR %d\n", status[3]) | |
605 | } |
|
605 | } | |
606 |
|
606 | |||
607 | status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 ); |
|
607 | status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 ); | |
608 | if (status[4] != RTEMS_SUCCESSFUL) |
|
608 | if (status[4] != RTEMS_SUCCESSFUL) | |
609 | { |
|
609 | { | |
610 | PRINTF1("in restart_science_task *** CWF2 ERR %d\n", status[4]) |
|
610 | PRINTF1("in restart_science_task *** CWF2 ERR %d\n", status[4]) | |
611 | } |
|
611 | } | |
612 |
|
612 | |||
613 | status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 ); |
|
613 | status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 ); | |
614 | if (status[5] != RTEMS_SUCCESSFUL) |
|
614 | if (status[5] != RTEMS_SUCCESSFUL) | |
615 | { |
|
615 | { | |
616 | PRINTF1("in restart_science_task *** CWF1 ERR %d\n", status[5]) |
|
616 | PRINTF1("in restart_science_task *** CWF1 ERR %d\n", status[5]) | |
617 | } |
|
617 | } | |
618 |
|
618 | |||
619 | status[6] = rtems_task_restart( Task_id[TASKID_AVF1], lfrRequestedMode ); |
|
619 | status[6] = rtems_task_restart( Task_id[TASKID_AVF1], lfrRequestedMode ); | |
620 | if (status[6] != RTEMS_SUCCESSFUL) |
|
620 | if (status[6] != RTEMS_SUCCESSFUL) | |
621 | { |
|
621 | { | |
622 | PRINTF1("in restart_science_task *** AVF1 ERR %d\n", status[6]) |
|
622 | PRINTF1("in restart_science_task *** AVF1 ERR %d\n", status[6]) | |
623 | } |
|
623 | } | |
624 |
|
624 | |||
625 | status[7] = rtems_task_restart( Task_id[TASKID_PRC1],lfrRequestedMode ); |
|
625 | status[7] = rtems_task_restart( Task_id[TASKID_PRC1],lfrRequestedMode ); | |
626 | if (status[7] != RTEMS_SUCCESSFUL) |
|
626 | if (status[7] != RTEMS_SUCCESSFUL) | |
627 | { |
|
627 | { | |
628 | PRINTF1("in restart_science_task *** PRC1 ERR %d\n", status[7]) |
|
628 | PRINTF1("in restart_science_task *** PRC1 ERR %d\n", status[7]) | |
629 | } |
|
629 | } | |
630 |
|
630 | |||
631 | if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) || |
|
631 | if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) || | |
632 | (status[2] != RTEMS_SUCCESSFUL) || (status[3] != RTEMS_SUCCESSFUL) || |
|
632 | (status[2] != RTEMS_SUCCESSFUL) || (status[3] != RTEMS_SUCCESSFUL) || | |
633 | (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) || |
|
633 | (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) || | |
634 | (status[6] != RTEMS_SUCCESSFUL) || (status[7] != RTEMS_SUCCESSFUL) ) |
|
634 | (status[6] != RTEMS_SUCCESSFUL) || (status[7] != RTEMS_SUCCESSFUL) ) | |
635 | { |
|
635 | { | |
636 | ret = RTEMS_UNSATISFIED; |
|
636 | ret = RTEMS_UNSATISFIED; | |
637 | } |
|
637 | } | |
638 |
|
638 | |||
639 | return ret; |
|
639 | return ret; | |
640 | } |
|
640 | } | |
641 |
|
641 | |||
642 | int suspend_science_tasks() |
|
642 | int suspend_science_tasks() | |
643 | { |
|
643 | { | |
644 | /** This function suspends the science tasks. |
|
644 | /** This function suspends the science tasks. | |
645 | * |
|
645 | * | |
646 | * @return RTEMS directive status codes: |
|
646 | * @return RTEMS directive status codes: | |
647 | * - RTEMS_SUCCESSFUL - task restarted successfully |
|
647 | * - RTEMS_SUCCESSFUL - task restarted successfully | |
648 | * - RTEMS_INVALID_ID - task id invalid |
|
648 | * - RTEMS_INVALID_ID - task id invalid | |
649 | * - RTEMS_ALREADY_SUSPENDED - task already suspended |
|
649 | * - RTEMS_ALREADY_SUSPENDED - task already suspended | |
650 | * |
|
650 | * | |
651 | */ |
|
651 | */ | |
652 |
|
652 | |||
653 | rtems_status_code status; |
|
653 | rtems_status_code status; | |
654 |
|
654 | |||
655 | status = rtems_task_suspend( Task_id[TASKID_AVF0] ); // suspend AVF0 |
|
655 | status = rtems_task_suspend( Task_id[TASKID_AVF0] ); // suspend AVF0 | |
656 | if (status != RTEMS_SUCCESSFUL) |
|
656 | if (status != RTEMS_SUCCESSFUL) | |
657 | { |
|
657 | { | |
658 | PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status) |
|
658 | PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status) | |
659 | } |
|
659 | } | |
660 | if (status == RTEMS_SUCCESSFUL) // suspend PRC0 |
|
660 | if (status == RTEMS_SUCCESSFUL) // suspend PRC0 | |
661 | { |
|
661 | { | |
662 | status = rtems_task_suspend( Task_id[TASKID_PRC0] ); |
|
662 | status = rtems_task_suspend( Task_id[TASKID_PRC0] ); | |
663 | if (status != RTEMS_SUCCESSFUL) |
|
663 | if (status != RTEMS_SUCCESSFUL) | |
664 | { |
|
664 | { | |
665 | PRINTF1("in suspend_science_task *** PRC0 ERR %d\n", status) |
|
665 | PRINTF1("in suspend_science_task *** PRC0 ERR %d\n", status) | |
666 | } |
|
666 | } | |
667 | } |
|
667 | } | |
668 | if (status == RTEMS_SUCCESSFUL) // suspend AVF1 |
|
668 | if (status == RTEMS_SUCCESSFUL) // suspend AVF1 | |
669 | { |
|
669 | { | |
670 | status = rtems_task_suspend( Task_id[TASKID_AVF1] ); |
|
670 | status = rtems_task_suspend( Task_id[TASKID_AVF1] ); | |
671 | if (status != RTEMS_SUCCESSFUL) |
|
671 | if (status != RTEMS_SUCCESSFUL) | |
672 | { |
|
672 | { | |
673 | PRINTF1("in suspend_science_task *** AVF1 ERR %d\n", status) |
|
673 | PRINTF1("in suspend_science_task *** AVF1 ERR %d\n", status) | |
674 | } |
|
674 | } | |
675 | } |
|
675 | } | |
676 | if (status == RTEMS_SUCCESSFUL) // suspend PRC1 |
|
676 | if (status == RTEMS_SUCCESSFUL) // suspend PRC1 | |
677 | { |
|
677 | { | |
678 | status = rtems_task_suspend( Task_id[TASKID_PRC1] ); |
|
678 | status = rtems_task_suspend( Task_id[TASKID_PRC1] ); | |
679 | if (status != RTEMS_SUCCESSFUL) |
|
679 | if (status != RTEMS_SUCCESSFUL) | |
680 | { |
|
680 | { | |
681 | PRINTF1("in suspend_science_task *** PRC1 ERR %d\n", status) |
|
681 | PRINTF1("in suspend_science_task *** PRC1 ERR %d\n", status) | |
682 | } |
|
682 | } | |
683 | } |
|
683 | } | |
684 | if (status == RTEMS_SUCCESSFUL) // suspend WFRM |
|
684 | if (status == RTEMS_SUCCESSFUL) // suspend WFRM | |
685 | { |
|
685 | { | |
686 | status = rtems_task_suspend( Task_id[TASKID_WFRM] ); |
|
686 | status = rtems_task_suspend( Task_id[TASKID_WFRM] ); | |
687 | if (status != RTEMS_SUCCESSFUL) |
|
687 | if (status != RTEMS_SUCCESSFUL) | |
688 | { |
|
688 | { | |
689 | PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status) |
|
689 | PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status) | |
690 | } |
|
690 | } | |
691 | } |
|
691 | } | |
692 | if (status == RTEMS_SUCCESSFUL) // suspend CWF3 |
|
692 | if (status == RTEMS_SUCCESSFUL) // suspend CWF3 | |
693 | { |
|
693 | { | |
694 | status = rtems_task_suspend( Task_id[TASKID_CWF3] ); |
|
694 | status = rtems_task_suspend( Task_id[TASKID_CWF3] ); | |
695 | if (status != RTEMS_SUCCESSFUL) |
|
695 | if (status != RTEMS_SUCCESSFUL) | |
696 | { |
|
696 | { | |
697 | PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status) |
|
697 | PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status) | |
698 | } |
|
698 | } | |
699 | } |
|
699 | } | |
700 | if (status == RTEMS_SUCCESSFUL) // suspend CWF2 |
|
700 | if (status == RTEMS_SUCCESSFUL) // suspend CWF2 | |
701 | { |
|
701 | { | |
702 | status = rtems_task_suspend( Task_id[TASKID_CWF2] ); |
|
702 | status = rtems_task_suspend( Task_id[TASKID_CWF2] ); | |
703 | if (status != RTEMS_SUCCESSFUL) |
|
703 | if (status != RTEMS_SUCCESSFUL) | |
704 | { |
|
704 | { | |
705 | PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status) |
|
705 | PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status) | |
706 | } |
|
706 | } | |
707 | } |
|
707 | } | |
708 | if (status == RTEMS_SUCCESSFUL) // suspend CWF1 |
|
708 | if (status == RTEMS_SUCCESSFUL) // suspend CWF1 | |
709 | { |
|
709 | { | |
710 | status = rtems_task_suspend( Task_id[TASKID_CWF1] ); |
|
710 | status = rtems_task_suspend( Task_id[TASKID_CWF1] ); | |
711 | if (status != RTEMS_SUCCESSFUL) |
|
711 | if (status != RTEMS_SUCCESSFUL) | |
712 | { |
|
712 | { | |
713 | PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status) |
|
713 | PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status) | |
714 | } |
|
714 | } | |
715 | } |
|
715 | } | |
716 |
|
716 | |||
717 | return status; |
|
717 | return status; | |
718 | } |
|
718 | } | |
719 |
|
719 | |||
720 | void launch_waveform_picker( unsigned char mode, unsigned int transitionCoarseTime ) |
|
720 | void launch_waveform_picker( unsigned char mode, unsigned int transitionCoarseTime ) | |
721 | { |
|
721 | { | |
722 | reset_current_ring_nodes(); |
|
722 | reset_current_ring_nodes(); | |
723 | reset_waveform_picker_regs(); |
|
723 | reset_waveform_picker_regs(); | |
724 | set_wfp_burst_enable_register( mode ); |
|
724 | set_wfp_burst_enable_register( mode ); | |
725 |
|
725 | |||
726 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); |
|
726 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); | |
727 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); |
|
727 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); | |
728 |
|
728 | |||
729 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x80; // [1000 0000] |
|
729 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x80; // [1000 0000] | |
730 | if (transitionCoarseTime == 0) |
|
730 | if (transitionCoarseTime == 0) | |
731 | { |
|
731 | { | |
732 | waveform_picker_regs->start_date = time_management_regs->coarse_time; |
|
732 | waveform_picker_regs->start_date = time_management_regs->coarse_time; | |
733 | } |
|
733 | } | |
734 | else |
|
734 | else | |
735 | { |
|
735 | { | |
736 | waveform_picker_regs->start_date = transitionCoarseTime; |
|
736 | waveform_picker_regs->start_date = transitionCoarseTime; | |
737 | } |
|
737 | } | |
738 | } |
|
738 | } | |
739 |
|
739 | |||
740 | void launch_spectral_matrix( void ) |
|
740 | void launch_spectral_matrix( void ) | |
741 | { |
|
741 | { | |
742 | SM_reset_current_ring_nodes(); |
|
742 | SM_reset_current_ring_nodes(); | |
743 | ASM_reset_current_ring_nodes(); |
|
743 | ASM_reset_current_ring_nodes(); | |
744 | reset_spectral_matrix_regs(); |
|
744 | reset_spectral_matrix_regs(); | |
745 |
|
745 | |||
746 | struct grgpio_regs_str *grgpio_regs = (struct grgpio_regs_str *) REGS_ADDR_GRGPIO; |
|
746 | struct grgpio_regs_str *grgpio_regs = (struct grgpio_regs_str *) REGS_ADDR_GRGPIO; | |
747 | grgpio_regs->io_port_direction_register = |
|
747 | grgpio_regs->io_port_direction_register = | |
748 | grgpio_regs->io_port_direction_register | 0x01; // [0000 0001], 0 = output disabled, 1 = output enabled |
|
748 | grgpio_regs->io_port_direction_register | 0x01; // [0000 0001], 0 = output disabled, 1 = output enabled | |
749 | grgpio_regs->io_port_output_register = grgpio_regs->io_port_output_register & 0xfffffffe; // set the bit 0 to 0 |
|
749 | grgpio_regs->io_port_output_register = grgpio_regs->io_port_output_register & 0xfffffffe; // set the bit 0 to 0 | |
750 | set_irq_on_new_ready_matrix( 1 ); |
|
750 | set_irq_on_new_ready_matrix( 1 ); | |
751 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); |
|
751 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); | |
752 | LEON_Unmask_interrupt( IRQ_SPECTRAL_MATRIX ); |
|
752 | LEON_Unmask_interrupt( IRQ_SPECTRAL_MATRIX ); | |
753 | set_run_matrix_spectral( 1 ); |
|
753 | set_run_matrix_spectral( 1 ); | |
754 |
|
754 | |||
755 | } |
|
755 | } | |
756 |
|
756 | |||
757 | void launch_spectral_matrix_simu( void ) |
|
757 | void launch_spectral_matrix_simu( void ) | |
758 | { |
|
758 | { | |
759 | SM_reset_current_ring_nodes(); |
|
759 | SM_reset_current_ring_nodes(); | |
760 | ASM_reset_current_ring_nodes(); |
|
760 | ASM_reset_current_ring_nodes(); | |
761 | reset_spectral_matrix_regs(); |
|
761 | reset_spectral_matrix_regs(); | |
762 |
|
762 | |||
763 | // Spectral Matrices simulator |
|
763 | // Spectral Matrices simulator | |
764 | timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); |
|
764 | timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); | |
765 | LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); |
|
765 | LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); | |
766 | LEON_Unmask_interrupt( IRQ_SM_SIMULATOR ); |
|
766 | LEON_Unmask_interrupt( IRQ_SM_SIMULATOR ); | |
767 | set_local_nb_interrupt_f0_MAX(); |
|
767 | set_local_nb_interrupt_f0_MAX(); | |
768 | } |
|
768 | } | |
769 |
|
769 | |||
770 | void set_irq_on_new_ready_matrix( unsigned char value ) |
|
770 | void set_irq_on_new_ready_matrix( unsigned char value ) | |
771 | { |
|
771 | { | |
772 | if (value == 1) |
|
772 | if (value == 1) | |
773 | { |
|
773 | { | |
774 | spectral_matrix_regs->config = spectral_matrix_regs->config | 0x01; |
|
774 | spectral_matrix_regs->config = spectral_matrix_regs->config | 0x01; | |
775 | } |
|
775 | } | |
776 | else |
|
776 | else | |
777 | { |
|
777 | { | |
778 | spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffe; // 1110 |
|
778 | spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffe; // 1110 | |
779 | } |
|
779 | } | |
780 | } |
|
780 | } | |
781 |
|
781 | |||
782 | void set_run_matrix_spectral( unsigned char value ) |
|
782 | void set_run_matrix_spectral( unsigned char value ) | |
783 | { |
|
783 | { | |
784 | if (value == 1) |
|
784 | if (value == 1) | |
785 | { |
|
785 | { | |
786 | spectral_matrix_regs->config = spectral_matrix_regs->config | 0x4; // [0100] set run_matrix spectral to 1 |
|
786 | spectral_matrix_regs->config = spectral_matrix_regs->config | 0x4; // [0100] set run_matrix spectral to 1 | |
787 | } |
|
787 | } | |
788 | else |
|
788 | else | |
789 | { |
|
789 | { | |
790 | spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffb; // [1011] set run_matrix spectral to 0 |
|
790 | spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffb; // [1011] set run_matrix spectral to 0 | |
791 | } |
|
791 | } | |
792 | } |
|
792 | } | |
793 |
|
793 | |||
794 | //**************** |
|
794 | //**************** | |
795 | // CLOSING ACTIONS |
|
795 | // CLOSING ACTIONS | |
796 | void update_last_TC_exe( ccsdsTelecommandPacket_t *TC, unsigned char * time ) |
|
796 | void update_last_TC_exe( ccsdsTelecommandPacket_t *TC, unsigned char * time ) | |
797 | { |
|
797 | { | |
798 | /** This function is used to update the HK packets statistics after a successful TC execution. |
|
798 | /** This function is used to update the HK packets statistics after a successful TC execution. | |
799 | * |
|
799 | * | |
800 | * @param TC points to the TC being processed |
|
800 | * @param TC points to the TC being processed | |
801 | * @param time is the time used to date the TC execution |
|
801 | * @param time is the time used to date the TC execution | |
802 | * |
|
802 | * | |
803 | */ |
|
803 | */ | |
804 |
|
804 | |||
805 | unsigned int val; |
|
805 | unsigned int val; | |
806 |
|
806 | |||
807 | housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0]; |
|
807 | housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0]; | |
808 | housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1]; |
|
808 | housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1]; | |
809 | housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00; |
|
809 | housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00; | |
810 | housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType; |
|
810 | housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType; | |
811 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00; |
|
811 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00; | |
812 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType; |
|
812 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType; | |
813 | housekeeping_packet.hk_lfr_last_exe_tc_time[0] = time[0]; |
|
813 | housekeeping_packet.hk_lfr_last_exe_tc_time[0] = time[0]; | |
814 | housekeeping_packet.hk_lfr_last_exe_tc_time[1] = time[1]; |
|
814 | housekeeping_packet.hk_lfr_last_exe_tc_time[1] = time[1]; | |
815 | housekeeping_packet.hk_lfr_last_exe_tc_time[2] = time[2]; |
|
815 | housekeeping_packet.hk_lfr_last_exe_tc_time[2] = time[2]; | |
816 | housekeeping_packet.hk_lfr_last_exe_tc_time[3] = time[3]; |
|
816 | housekeeping_packet.hk_lfr_last_exe_tc_time[3] = time[3]; | |
817 | housekeeping_packet.hk_lfr_last_exe_tc_time[4] = time[4]; |
|
817 | housekeeping_packet.hk_lfr_last_exe_tc_time[4] = time[4]; | |
818 | housekeeping_packet.hk_lfr_last_exe_tc_time[5] = time[5]; |
|
818 | housekeeping_packet.hk_lfr_last_exe_tc_time[5] = time[5]; | |
819 |
|
819 | |||
820 | val = housekeeping_packet.hk_lfr_exe_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_exe_tc_cnt[1]; |
|
820 | val = housekeeping_packet.hk_lfr_exe_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_exe_tc_cnt[1]; | |
821 | val++; |
|
821 | val++; | |
822 | housekeeping_packet.hk_lfr_exe_tc_cnt[0] = (unsigned char) (val >> 8); |
|
822 | housekeeping_packet.hk_lfr_exe_tc_cnt[0] = (unsigned char) (val >> 8); | |
823 | housekeeping_packet.hk_lfr_exe_tc_cnt[1] = (unsigned char) (val); |
|
823 | housekeeping_packet.hk_lfr_exe_tc_cnt[1] = (unsigned char) (val); | |
824 | } |
|
824 | } | |
825 |
|
825 | |||
826 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char * time ) |
|
826 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char * time ) | |
827 | { |
|
827 | { | |
828 | /** This function is used to update the HK packets statistics after a TC rejection. |
|
828 | /** This function is used to update the HK packets statistics after a TC rejection. | |
829 | * |
|
829 | * | |
830 | * @param TC points to the TC being processed |
|
830 | * @param TC points to the TC being processed | |
831 | * @param time is the time used to date the TC rejection |
|
831 | * @param time is the time used to date the TC rejection | |
832 | * |
|
832 | * | |
833 | */ |
|
833 | */ | |
834 |
|
834 | |||
835 | unsigned int val; |
|
835 | unsigned int val; | |
836 |
|
836 | |||
837 | housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0]; |
|
837 | housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0]; | |
838 | housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1]; |
|
838 | housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1]; | |
839 | housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00; |
|
839 | housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00; | |
840 | housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType; |
|
840 | housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType; | |
841 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00; |
|
841 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00; | |
842 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType; |
|
842 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType; | |
843 | housekeeping_packet.hk_lfr_last_rej_tc_time[0] = time[0]; |
|
843 | housekeeping_packet.hk_lfr_last_rej_tc_time[0] = time[0]; | |
844 | housekeeping_packet.hk_lfr_last_rej_tc_time[1] = time[1]; |
|
844 | housekeeping_packet.hk_lfr_last_rej_tc_time[1] = time[1]; | |
845 | housekeeping_packet.hk_lfr_last_rej_tc_time[2] = time[2]; |
|
845 | housekeeping_packet.hk_lfr_last_rej_tc_time[2] = time[2]; | |
846 | housekeeping_packet.hk_lfr_last_rej_tc_time[3] = time[3]; |
|
846 | housekeeping_packet.hk_lfr_last_rej_tc_time[3] = time[3]; | |
847 | housekeeping_packet.hk_lfr_last_rej_tc_time[4] = time[4]; |
|
847 | housekeeping_packet.hk_lfr_last_rej_tc_time[4] = time[4]; | |
848 | housekeeping_packet.hk_lfr_last_rej_tc_time[5] = time[5]; |
|
848 | housekeeping_packet.hk_lfr_last_rej_tc_time[5] = time[5]; | |
849 |
|
849 | |||
850 | val = housekeeping_packet.hk_lfr_rej_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_rej_tc_cnt[1]; |
|
850 | val = housekeeping_packet.hk_lfr_rej_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_rej_tc_cnt[1]; | |
851 | val++; |
|
851 | val++; | |
852 | housekeeping_packet.hk_lfr_rej_tc_cnt[0] = (unsigned char) (val >> 8); |
|
852 | housekeeping_packet.hk_lfr_rej_tc_cnt[0] = (unsigned char) (val >> 8); | |
853 | housekeeping_packet.hk_lfr_rej_tc_cnt[1] = (unsigned char) (val); |
|
853 | housekeeping_packet.hk_lfr_rej_tc_cnt[1] = (unsigned char) (val); | |
854 | } |
|
854 | } | |
855 |
|
855 | |||
856 | void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id ) |
|
856 | void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id ) | |
857 | { |
|
857 | { | |
858 | /** This function is the last step of the TC execution workflow. |
|
858 | /** This function is the last step of the TC execution workflow. | |
859 | * |
|
859 | * | |
860 | * @param TC points to the TC being processed |
|
860 | * @param TC points to the TC being processed | |
861 | * @param result is the result of the TC execution (LFR_SUCCESSFUL / LFR_DEFAULT) |
|
861 | * @param result is the result of the TC execution (LFR_SUCCESSFUL / LFR_DEFAULT) | |
862 | * @param queue_id is the id of the RTEMS message queue used to send TM packets |
|
862 | * @param queue_id is the id of the RTEMS message queue used to send TM packets | |
863 | * @param time is the time used to date the TC execution |
|
863 | * @param time is the time used to date the TC execution | |
864 | * |
|
864 | * | |
865 | */ |
|
865 | */ | |
866 |
|
866 | |||
867 | unsigned char requestedMode; |
|
867 | unsigned char requestedMode; | |
868 |
|
868 | |||
869 | if (result == LFR_SUCCESSFUL) |
|
869 | if (result == LFR_SUCCESSFUL) | |
870 | { |
|
870 | { | |
871 | if ( !( (TC->serviceType==TC_TYPE_TIME) & (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) ) |
|
871 | if ( !( (TC->serviceType==TC_TYPE_TIME) & (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) ) | |
872 | & |
|
872 | & | |
873 | !( (TC->serviceType==TC_TYPE_GEN) & (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO)) |
|
873 | !( (TC->serviceType==TC_TYPE_GEN) & (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO)) | |
874 | ) |
|
874 | ) | |
875 | { |
|
875 | { | |
876 | send_tm_lfr_tc_exe_success( TC, queue_id ); |
|
876 | send_tm_lfr_tc_exe_success( TC, queue_id ); | |
877 | } |
|
877 | } | |
878 | if ( (TC->serviceType == TC_TYPE_GEN) & (TC->serviceSubType == TC_SUBTYPE_ENTER) ) |
|
878 | if ( (TC->serviceType == TC_TYPE_GEN) & (TC->serviceSubType == TC_SUBTYPE_ENTER) ) | |
879 | { |
|
879 | { | |
880 | //********************************** |
|
880 | //********************************** | |
881 | // UPDATE THE LFRMODE LOCAL VARIABLE |
|
881 | // UPDATE THE LFRMODE LOCAL VARIABLE | |
882 | requestedMode = TC->dataAndCRC[1]; |
|
882 | requestedMode = TC->dataAndCRC[1]; | |
883 | housekeeping_packet.lfr_status_word[0] = (unsigned char) ((requestedMode << 4) + 0x0d); |
|
883 | housekeeping_packet.lfr_status_word[0] = (unsigned char) ((requestedMode << 4) + 0x0d); | |
884 | updateLFRCurrentMode(); |
|
884 | updateLFRCurrentMode(); | |
885 | } |
|
885 | } | |
886 | } |
|
886 | } | |
887 | else if (result == LFR_EXE_ERROR) |
|
887 | else if (result == LFR_EXE_ERROR) | |
888 | { |
|
888 | { | |
889 | send_tm_lfr_tc_exe_error( TC, queue_id ); |
|
889 | send_tm_lfr_tc_exe_error( TC, queue_id ); | |
890 | } |
|
890 | } | |
891 | } |
|
891 | } | |
892 |
|
892 | |||
893 | //*************************** |
|
893 | //*************************** | |
894 | // Interrupt Service Routines |
|
894 | // Interrupt Service Routines | |
895 | rtems_isr commutation_isr1( rtems_vector_number vector ) |
|
895 | rtems_isr commutation_isr1( rtems_vector_number vector ) | |
896 | { |
|
896 | { | |
897 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
897 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { | |
898 | printf("In commutation_isr1 *** Error sending event to DUMB\n"); |
|
898 | printf("In commutation_isr1 *** Error sending event to DUMB\n"); | |
899 | } |
|
899 | } | |
900 | } |
|
900 | } | |
901 |
|
901 | |||
902 | rtems_isr commutation_isr2( rtems_vector_number vector ) |
|
902 | rtems_isr commutation_isr2( rtems_vector_number vector ) | |
903 | { |
|
903 | { | |
904 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
904 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { | |
905 | printf("In commutation_isr2 *** Error sending event to DUMB\n"); |
|
905 | printf("In commutation_isr2 *** Error sending event to DUMB\n"); | |
906 | } |
|
906 | } | |
907 | } |
|
907 | } | |
908 |
|
908 | |||
909 | //**************** |
|
909 | //**************** | |
910 | // OTHER FUNCTIONS |
|
910 | // OTHER FUNCTIONS | |
911 | void updateLFRCurrentMode() |
|
911 | void updateLFRCurrentMode() | |
912 | { |
|
912 | { | |
913 | /** This function updates the value of the global variable lfrCurrentMode. |
|
913 | /** This function updates the value of the global variable lfrCurrentMode. | |
914 | * |
|
914 | * | |
915 | * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running. |
|
915 | * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running. | |
916 | * |
|
916 | * | |
917 | */ |
|
917 | */ | |
918 | // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure |
|
918 | // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure | |
919 | lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
919 | lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
920 | } |
|
920 | } | |
921 |
|
921 |
General Comments 0
You need to be logged in to leave comments.
Login now