@@ -1,273 +1,273 | |||||
1 | ############################################################################# |
|
1 | ############################################################################# | |
2 | # Makefile for building: bin/fsw |
|
2 | # Makefile for building: bin/fsw | |
3 |
# Generated by qmake (2.01a) (Qt 4.8.6) on: |
|
3 | # Generated by qmake (2.01a) (Qt 4.8.6) on: Fri Oct 24 13:25:08 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=2 -DSW_VERSION_N2=0 -DSW_VERSION_N3=1 -DSW_VERSION_N4=1 -DLPP_DPU_DESTID -DPRINT_MESSAGES_ON_CONSOLE |
|
13 | DEFINES = -DSW_VERSION_N1=2 -DSW_VERSION_N2=0 -DSW_VERSION_N3=1 -DSW_VERSION_N4=1 -DLPP_DPU_DESTID -DPRINT_MESSAGES_ON_CONSOLE | |
14 | CFLAGS = -pipe -O3 -fprofile-arcs -ftest-coverage -Wall $(DEFINES) |
|
14 | CFLAGS = -pipe -O3 -fprofile-arcs -ftest-coverage -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../header/processing -I../src/LFR_basic-parameters |
|
16 | INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header -I../header/processing -I../src/LFR_basic-parameters | |
17 | LINK = sparc-rtems-g++ |
|
17 | LINK = sparc-rtems-g++ | |
18 | LFLAGS = |
|
18 | LFLAGS = | |
19 | LIBS = $(SUBLIBS) -lgcov /opt/GCOV/01A/lib/overload.o -lc |
|
19 | LIBS = $(SUBLIBS) -lgcov /opt/GCOV/01A/lib/overload.o -lc | |
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_misc.c \ |
|
48 | ../src/fsw_misc.c \ | |
49 | ../src/fsw_init.c \ |
|
49 | ../src/fsw_init.c \ | |
50 | ../src/fsw_globals.c \ |
|
50 | ../src/fsw_globals.c \ | |
51 | ../src/fsw_spacewire.c \ |
|
51 | ../src/fsw_spacewire.c \ | |
52 | ../src/tc_load_dump_parameters.c \ |
|
52 | ../src/tc_load_dump_parameters.c \ | |
53 | ../src/tm_lfr_tc_exe.c \ |
|
53 | ../src/tm_lfr_tc_exe.c \ | |
54 | ../src/tc_acceptance.c \ |
|
54 | ../src/tc_acceptance.c \ | |
55 | ../src/processing/fsw_processing.c \ |
|
55 | ../src/processing/fsw_processing.c \ | |
56 | ../src/processing/avf0_prc0.c \ |
|
56 | ../src/processing/avf0_prc0.c \ | |
57 | ../src/processing/avf1_prc1.c \ |
|
57 | ../src/processing/avf1_prc1.c \ | |
58 | ../src/processing/avf2_prc2.c \ |
|
58 | ../src/processing/avf2_prc2.c \ | |
59 | ../src/lfr_cpu_usage_report.c \ |
|
59 | ../src/lfr_cpu_usage_report.c \ | |
60 | ../src/LFR_basic-parameters/basic_parameters.c |
|
60 | ../src/LFR_basic-parameters/basic_parameters.c | |
61 | OBJECTS = obj/wf_handler.o \ |
|
61 | OBJECTS = obj/wf_handler.o \ | |
62 | obj/tc_handler.o \ |
|
62 | obj/tc_handler.o \ | |
63 | obj/fsw_misc.o \ |
|
63 | obj/fsw_misc.o \ | |
64 | obj/fsw_init.o \ |
|
64 | obj/fsw_init.o \ | |
65 | obj/fsw_globals.o \ |
|
65 | obj/fsw_globals.o \ | |
66 | obj/fsw_spacewire.o \ |
|
66 | obj/fsw_spacewire.o \ | |
67 | obj/tc_load_dump_parameters.o \ |
|
67 | obj/tc_load_dump_parameters.o \ | |
68 | obj/tm_lfr_tc_exe.o \ |
|
68 | obj/tm_lfr_tc_exe.o \ | |
69 | obj/tc_acceptance.o \ |
|
69 | obj/tc_acceptance.o \ | |
70 | obj/fsw_processing.o \ |
|
70 | obj/fsw_processing.o \ | |
71 | obj/avf0_prc0.o \ |
|
71 | obj/avf0_prc0.o \ | |
72 | obj/avf1_prc1.o \ |
|
72 | obj/avf1_prc1.o \ | |
73 | obj/avf2_prc2.o \ |
|
73 | obj/avf2_prc2.o \ | |
74 | obj/lfr_cpu_usage_report.o \ |
|
74 | obj/lfr_cpu_usage_report.o \ | |
75 | obj/basic_parameters.o |
|
75 | obj/basic_parameters.o | |
76 | DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \ |
|
76 | DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \ | |
77 | /usr/lib64/qt4/mkspecs/common/linux.conf \ |
|
77 | /usr/lib64/qt4/mkspecs/common/linux.conf \ | |
78 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ |
|
78 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ | |
79 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ |
|
79 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ | |
80 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ |
|
80 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ | |
81 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ |
|
81 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ | |
82 | /usr/lib64/qt4/mkspecs/qconfig.pri \ |
|
82 | /usr/lib64/qt4/mkspecs/qconfig.pri \ | |
83 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ |
|
83 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ | |
84 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ |
|
84 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ | |
85 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ |
|
85 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ | |
86 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ |
|
86 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ | |
87 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ |
|
87 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ | |
88 | sparc.pri \ |
|
88 | sparc.pri \ | |
89 | /usr/lib64/qt4/mkspecs/features/release.prf \ |
|
89 | /usr/lib64/qt4/mkspecs/features/release.prf \ | |
90 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ |
|
90 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ | |
91 | /usr/lib64/qt4/mkspecs/features/shared.prf \ |
|
91 | /usr/lib64/qt4/mkspecs/features/shared.prf \ | |
92 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ |
|
92 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ | |
93 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ |
|
93 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ | |
94 | /usr/lib64/qt4/mkspecs/features/resources.prf \ |
|
94 | /usr/lib64/qt4/mkspecs/features/resources.prf \ | |
95 | /usr/lib64/qt4/mkspecs/features/uic.prf \ |
|
95 | /usr/lib64/qt4/mkspecs/features/uic.prf \ | |
96 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ |
|
96 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ | |
97 | /usr/lib64/qt4/mkspecs/features/lex.prf \ |
|
97 | /usr/lib64/qt4/mkspecs/features/lex.prf \ | |
98 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \ |
|
98 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \ | |
99 | fsw-qt.pro |
|
99 | fsw-qt.pro | |
100 | QMAKE_TARGET = fsw |
|
100 | QMAKE_TARGET = fsw | |
101 | DESTDIR = bin/ |
|
101 | DESTDIR = bin/ | |
102 | TARGET = bin/fsw |
|
102 | TARGET = bin/fsw | |
103 |
|
103 | |||
104 | first: all |
|
104 | first: all | |
105 | ####### Implicit rules |
|
105 | ####### Implicit rules | |
106 |
|
106 | |||
107 | .SUFFIXES: .o .c .cpp .cc .cxx .C |
|
107 | .SUFFIXES: .o .c .cpp .cc .cxx .C | |
108 |
|
108 | |||
109 | .cpp.o: |
|
109 | .cpp.o: | |
110 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
110 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" | |
111 |
|
111 | |||
112 | .cc.o: |
|
112 | .cc.o: | |
113 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
113 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" | |
114 |
|
114 | |||
115 | .cxx.o: |
|
115 | .cxx.o: | |
116 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
116 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" | |
117 |
|
117 | |||
118 | .C.o: |
|
118 | .C.o: | |
119 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
119 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" | |
120 |
|
120 | |||
121 | .c.o: |
|
121 | .c.o: | |
122 | $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<" |
|
122 | $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<" | |
123 |
|
123 | |||
124 | ####### Build rules |
|
124 | ####### Build rules | |
125 |
|
125 | |||
126 | all: Makefile $(TARGET) |
|
126 | all: Makefile $(TARGET) | |
127 |
|
127 | |||
128 | $(TARGET): $(OBJECTS) |
|
128 | $(TARGET): $(OBJECTS) | |
129 | @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/ |
|
129 | @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/ | |
130 | $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) |
|
130 | $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) | |
131 |
|
131 | |||
132 | Makefile: fsw-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \ |
|
132 | Makefile: fsw-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \ | |
133 | /usr/lib64/qt4/mkspecs/common/linux.conf \ |
|
133 | /usr/lib64/qt4/mkspecs/common/linux.conf \ | |
134 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ |
|
134 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ | |
135 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ |
|
135 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ | |
136 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ |
|
136 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ | |
137 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ |
|
137 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ | |
138 | /usr/lib64/qt4/mkspecs/qconfig.pri \ |
|
138 | /usr/lib64/qt4/mkspecs/qconfig.pri \ | |
139 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ |
|
139 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ | |
140 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ |
|
140 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ | |
141 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ |
|
141 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ | |
142 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ |
|
142 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ | |
143 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ |
|
143 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ | |
144 | sparc.pri \ |
|
144 | sparc.pri \ | |
145 | /usr/lib64/qt4/mkspecs/features/release.prf \ |
|
145 | /usr/lib64/qt4/mkspecs/features/release.prf \ | |
146 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ |
|
146 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ | |
147 | /usr/lib64/qt4/mkspecs/features/shared.prf \ |
|
147 | /usr/lib64/qt4/mkspecs/features/shared.prf \ | |
148 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ |
|
148 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ | |
149 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ |
|
149 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ | |
150 | /usr/lib64/qt4/mkspecs/features/resources.prf \ |
|
150 | /usr/lib64/qt4/mkspecs/features/resources.prf \ | |
151 | /usr/lib64/qt4/mkspecs/features/uic.prf \ |
|
151 | /usr/lib64/qt4/mkspecs/features/uic.prf \ | |
152 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ |
|
152 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ | |
153 | /usr/lib64/qt4/mkspecs/features/lex.prf \ |
|
153 | /usr/lib64/qt4/mkspecs/features/lex.prf \ | |
154 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf |
|
154 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf | |
155 | $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro |
|
155 | $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro | |
156 | /usr/lib64/qt4/mkspecs/common/unix.conf: |
|
156 | /usr/lib64/qt4/mkspecs/common/unix.conf: | |
157 | /usr/lib64/qt4/mkspecs/common/linux.conf: |
|
157 | /usr/lib64/qt4/mkspecs/common/linux.conf: | |
158 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf: |
|
158 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf: | |
159 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf: |
|
159 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf: | |
160 | /usr/lib64/qt4/mkspecs/common/g++-base.conf: |
|
160 | /usr/lib64/qt4/mkspecs/common/g++-base.conf: | |
161 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf: |
|
161 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf: | |
162 | /usr/lib64/qt4/mkspecs/qconfig.pri: |
|
162 | /usr/lib64/qt4/mkspecs/qconfig.pri: | |
163 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri: |
|
163 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri: | |
164 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf: |
|
164 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf: | |
165 | /usr/lib64/qt4/mkspecs/features/qt_config.prf: |
|
165 | /usr/lib64/qt4/mkspecs/features/qt_config.prf: | |
166 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf: |
|
166 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf: | |
167 | /usr/lib64/qt4/mkspecs/features/default_pre.prf: |
|
167 | /usr/lib64/qt4/mkspecs/features/default_pre.prf: | |
168 | sparc.pri: |
|
168 | sparc.pri: | |
169 | /usr/lib64/qt4/mkspecs/features/release.prf: |
|
169 | /usr/lib64/qt4/mkspecs/features/release.prf: | |
170 | /usr/lib64/qt4/mkspecs/features/default_post.prf: |
|
170 | /usr/lib64/qt4/mkspecs/features/default_post.prf: | |
171 | /usr/lib64/qt4/mkspecs/features/shared.prf: |
|
171 | /usr/lib64/qt4/mkspecs/features/shared.prf: | |
172 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf: |
|
172 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf: | |
173 | /usr/lib64/qt4/mkspecs/features/warn_on.prf: |
|
173 | /usr/lib64/qt4/mkspecs/features/warn_on.prf: | |
174 | /usr/lib64/qt4/mkspecs/features/resources.prf: |
|
174 | /usr/lib64/qt4/mkspecs/features/resources.prf: | |
175 | /usr/lib64/qt4/mkspecs/features/uic.prf: |
|
175 | /usr/lib64/qt4/mkspecs/features/uic.prf: | |
176 | /usr/lib64/qt4/mkspecs/features/yacc.prf: |
|
176 | /usr/lib64/qt4/mkspecs/features/yacc.prf: | |
177 | /usr/lib64/qt4/mkspecs/features/lex.prf: |
|
177 | /usr/lib64/qt4/mkspecs/features/lex.prf: | |
178 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf: |
|
178 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf: | |
179 | qmake: FORCE |
|
179 | qmake: FORCE | |
180 | @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro |
|
180 | @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro | |
181 |
|
181 | |||
182 | dist: |
|
182 | dist: | |
183 | @$(CHK_DIR_EXISTS) obj/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0 |
|
183 | @$(CHK_DIR_EXISTS) obj/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0 | |
184 | $(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 |
|
184 | $(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 | |
185 |
|
185 | |||
186 |
|
186 | |||
187 | clean:compiler_clean |
|
187 | clean:compiler_clean | |
188 | -$(DEL_FILE) $(OBJECTS) |
|
188 | -$(DEL_FILE) $(OBJECTS) | |
189 | -$(DEL_FILE) *~ core *.core |
|
189 | -$(DEL_FILE) *~ core *.core | |
190 |
|
190 | |||
191 |
|
191 | |||
192 | ####### Sub-libraries |
|
192 | ####### Sub-libraries | |
193 |
|
193 | |||
194 | distclean: clean |
|
194 | distclean: clean | |
195 | -$(DEL_FILE) $(TARGET) |
|
195 | -$(DEL_FILE) $(TARGET) | |
196 | -$(DEL_FILE) Makefile |
|
196 | -$(DEL_FILE) Makefile | |
197 |
|
197 | |||
198 |
|
198 | |||
199 | grmon: |
|
199 | grmon: | |
200 | cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u |
|
200 | cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u | |
201 |
|
201 | |||
202 | check: first |
|
202 | check: first | |
203 |
|
203 | |||
204 | compiler_rcc_make_all: |
|
204 | compiler_rcc_make_all: | |
205 | compiler_rcc_clean: |
|
205 | compiler_rcc_clean: | |
206 | compiler_uic_make_all: |
|
206 | compiler_uic_make_all: | |
207 | compiler_uic_clean: |
|
207 | compiler_uic_clean: | |
208 | compiler_image_collection_make_all: qmake_image_collection.cpp |
|
208 | compiler_image_collection_make_all: qmake_image_collection.cpp | |
209 | compiler_image_collection_clean: |
|
209 | compiler_image_collection_clean: | |
210 | -$(DEL_FILE) qmake_image_collection.cpp |
|
210 | -$(DEL_FILE) qmake_image_collection.cpp | |
211 | compiler_yacc_decl_make_all: |
|
211 | compiler_yacc_decl_make_all: | |
212 | compiler_yacc_decl_clean: |
|
212 | compiler_yacc_decl_clean: | |
213 | compiler_yacc_impl_make_all: |
|
213 | compiler_yacc_impl_make_all: | |
214 | compiler_yacc_impl_clean: |
|
214 | compiler_yacc_impl_clean: | |
215 | compiler_lex_make_all: |
|
215 | compiler_lex_make_all: | |
216 | compiler_lex_clean: |
|
216 | compiler_lex_clean: | |
217 | compiler_clean: |
|
217 | compiler_clean: | |
218 |
|
218 | |||
219 | ####### Compile |
|
219 | ####### Compile | |
220 |
|
220 | |||
221 | obj/wf_handler.o: ../src/wf_handler.c |
|
221 | obj/wf_handler.o: ../src/wf_handler.c | |
222 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/wf_handler.o ../src/wf_handler.c |
|
222 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/wf_handler.o ../src/wf_handler.c | |
223 |
|
223 | |||
224 | obj/tc_handler.o: ../src/tc_handler.c |
|
224 | obj/tc_handler.o: ../src/tc_handler.c | |
225 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o ../src/tc_handler.c |
|
225 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o ../src/tc_handler.c | |
226 |
|
226 | |||
227 | obj/fsw_misc.o: ../src/fsw_misc.c |
|
227 | obj/fsw_misc.o: ../src/fsw_misc.c | |
228 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c |
|
228 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c | |
229 |
|
229 | |||
230 | obj/fsw_init.o: ../src/fsw_init.c ../src/fsw_config.c |
|
230 | obj/fsw_init.o: ../src/fsw_init.c ../src/fsw_config.c | |
231 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o ../src/fsw_init.c |
|
231 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o ../src/fsw_init.c | |
232 |
|
232 | |||
233 | obj/fsw_globals.o: ../src/fsw_globals.c |
|
233 | obj/fsw_globals.o: ../src/fsw_globals.c | |
234 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c |
|
234 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c | |
235 |
|
235 | |||
236 | obj/fsw_spacewire.o: ../src/fsw_spacewire.c |
|
236 | obj/fsw_spacewire.o: ../src/fsw_spacewire.c | |
237 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spacewire.o ../src/fsw_spacewire.c |
|
237 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spacewire.o ../src/fsw_spacewire.c | |
238 |
|
238 | |||
239 | obj/tc_load_dump_parameters.o: ../src/tc_load_dump_parameters.c |
|
239 | obj/tc_load_dump_parameters.o: ../src/tc_load_dump_parameters.c | |
240 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_load_dump_parameters.o ../src/tc_load_dump_parameters.c |
|
240 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_load_dump_parameters.o ../src/tc_load_dump_parameters.c | |
241 |
|
241 | |||
242 | obj/tm_lfr_tc_exe.o: ../src/tm_lfr_tc_exe.c |
|
242 | obj/tm_lfr_tc_exe.o: ../src/tm_lfr_tc_exe.c | |
243 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tm_lfr_tc_exe.o ../src/tm_lfr_tc_exe.c |
|
243 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tm_lfr_tc_exe.o ../src/tm_lfr_tc_exe.c | |
244 |
|
244 | |||
245 | obj/tc_acceptance.o: ../src/tc_acceptance.c |
|
245 | obj/tc_acceptance.o: ../src/tc_acceptance.c | |
246 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_acceptance.o ../src/tc_acceptance.c |
|
246 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_acceptance.o ../src/tc_acceptance.c | |
247 |
|
247 | |||
248 | obj/fsw_processing.o: ../src/processing/fsw_processing.c |
|
248 | obj/fsw_processing.o: ../src/processing/fsw_processing.c | |
249 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/processing/fsw_processing.c |
|
249 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/processing/fsw_processing.c | |
250 |
|
250 | |||
251 | obj/avf0_prc0.o: ../src/processing/avf0_prc0.c |
|
251 | obj/avf0_prc0.o: ../src/processing/avf0_prc0.c | |
252 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf0_prc0.o ../src/processing/avf0_prc0.c |
|
252 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf0_prc0.o ../src/processing/avf0_prc0.c | |
253 |
|
253 | |||
254 | obj/avf1_prc1.o: ../src/processing/avf1_prc1.c |
|
254 | obj/avf1_prc1.o: ../src/processing/avf1_prc1.c | |
255 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf1_prc1.o ../src/processing/avf1_prc1.c |
|
255 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf1_prc1.o ../src/processing/avf1_prc1.c | |
256 |
|
256 | |||
257 | obj/avf2_prc2.o: ../src/processing/avf2_prc2.c |
|
257 | obj/avf2_prc2.o: ../src/processing/avf2_prc2.c | |
258 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf2_prc2.o ../src/processing/avf2_prc2.c |
|
258 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf2_prc2.o ../src/processing/avf2_prc2.c | |
259 |
|
259 | |||
260 | obj/lfr_cpu_usage_report.o: ../src/lfr_cpu_usage_report.c |
|
260 | obj/lfr_cpu_usage_report.o: ../src/lfr_cpu_usage_report.c | |
261 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/lfr_cpu_usage_report.o ../src/lfr_cpu_usage_report.c |
|
261 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/lfr_cpu_usage_report.o ../src/lfr_cpu_usage_report.c | |
262 |
|
262 | |||
263 | obj/basic_parameters.o: ../src/LFR_basic-parameters/basic_parameters.c |
|
263 | obj/basic_parameters.o: ../src/LFR_basic-parameters/basic_parameters.c | |
264 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/basic_parameters.o ../src/LFR_basic-parameters/basic_parameters.c |
|
264 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/basic_parameters.o ../src/LFR_basic-parameters/basic_parameters.c | |
265 |
|
265 | |||
266 | ####### Install |
|
266 | ####### Install | |
267 |
|
267 | |||
268 | install: FORCE |
|
268 | install: FORCE | |
269 |
|
269 | |||
270 | uninstall: FORCE |
|
270 | uninstall: FORCE | |
271 |
|
271 | |||
272 | FORCE: |
|
272 | FORCE: | |
273 |
|
273 |
@@ -1,256 +1,259 | |||||
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 | unsigned coarseTime; | |||
|
20 | unsigned int fineTime; | |||
19 | } ring_node; |
|
21 | } ring_node; | |
20 |
|
22 | |||
21 | //************************ |
|
23 | //************************ | |
22 | // flight software version |
|
24 | // flight software version | |
23 | // this parameters is handled by the Qt project options |
|
25 | // this parameters is handled by the Qt project options | |
24 |
|
26 | |||
25 | #define NB_PACKETS_PER_GROUP_OF_CWF 8 // 8 packets containing 336 blk |
|
27 | #define NB_PACKETS_PER_GROUP_OF_CWF 8 // 8 packets containing 336 blk | |
26 | #define NB_PACKETS_PER_GROUP_OF_CWF_LIGHT 4 // 4 packets containing 672 blk |
|
28 | #define NB_PACKETS_PER_GROUP_OF_CWF_LIGHT 4 // 4 packets containing 672 blk | |
27 | #define NB_SAMPLES_PER_SNAPSHOT 2688 // 336 * 8 = 672 * 4 = 2688 |
|
29 | #define NB_SAMPLES_PER_SNAPSHOT 2688 // 336 * 8 = 672 * 4 = 2688 | |
28 | #define TIME_OFFSET 2 |
|
30 | #define TIME_OFFSET 2 | |
29 | #define TIME_OFFSET_IN_BYTES 8 |
|
31 | #define TIME_OFFSET_IN_BYTES 8 | |
30 | //#define WAVEFORM_EXTENDED_HEADER_OFFSET 22 |
|
32 | //#define WAVEFORM_EXTENDED_HEADER_OFFSET 22 | |
31 | #define NB_BYTES_SWF_BLK (2 * 6) |
|
33 | #define NB_BYTES_SWF_BLK (2 * 6) | |
32 | #define NB_WORDS_SWF_BLK 3 |
|
34 | #define NB_WORDS_SWF_BLK 3 | |
33 | #define NB_BYTES_CWF3_LIGHT_BLK 6 |
|
35 | #define NB_BYTES_CWF3_LIGHT_BLK 6 | |
34 | //#define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8 |
|
36 | //#define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8 | |
35 | #define NB_RING_NODES_F0 3 // AT LEAST 3 |
|
37 | #define NB_RING_NODES_F0 3 // AT LEAST 3 | |
36 | #define NB_RING_NODES_F1 5 // AT LEAST 3 |
|
38 | #define NB_RING_NODES_F1 5 // AT LEAST 3 | |
37 | #define NB_RING_NODES_F2 5 // AT LEAST 3 |
|
39 | #define NB_RING_NODES_F2 5 // AT LEAST 3 | |
38 | #define NB_RING_NODES_F3 3 // AT LEAST 3 |
|
40 | #define NB_RING_NODES_F3 3 // AT LEAST 3 | |
39 |
|
41 | |||
40 | //********** |
|
42 | //********** | |
41 | // LFR MODES |
|
43 | // LFR MODES | |
42 | #define LFR_MODE_STANDBY 0 |
|
44 | #define LFR_MODE_STANDBY 0 | |
43 | #define LFR_MODE_NORMAL 1 |
|
45 | #define LFR_MODE_NORMAL 1 | |
44 | #define LFR_MODE_BURST 2 |
|
46 | #define LFR_MODE_BURST 2 | |
45 | #define LFR_MODE_SBM1 3 |
|
47 | #define LFR_MODE_SBM1 3 | |
46 | #define LFR_MODE_SBM2 4 |
|
48 | #define LFR_MODE_SBM2 4 | |
47 |
|
49 | |||
48 | #define TDS_MODE_LFM 5 |
|
50 | #define TDS_MODE_LFM 5 | |
49 | #define TDS_MODE_STANDBY 0 |
|
51 | #define TDS_MODE_STANDBY 0 | |
50 | #define TDS_MODE_NORMAL 1 |
|
52 | #define TDS_MODE_NORMAL 1 | |
51 | #define TDS_MODE_BURST 2 |
|
53 | #define TDS_MODE_BURST 2 | |
52 | #define TDS_MODE_SBM1 3 |
|
54 | #define TDS_MODE_SBM1 3 | |
53 | #define TDS_MODE_SBM2 4 |
|
55 | #define TDS_MODE_SBM2 4 | |
54 |
|
56 | |||
55 | #define THR_MODE_STANDBY 0 |
|
57 | #define THR_MODE_STANDBY 0 | |
56 | #define THR_MODE_NORMAL 1 |
|
58 | #define THR_MODE_NORMAL 1 | |
57 | #define THR_MODE_BURST 2 |
|
59 | #define THR_MODE_BURST 2 | |
58 |
|
60 | |||
59 | #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0 |
|
61 | #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0 | |
60 | #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1 |
|
62 | #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1 | |
61 | #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2 |
|
63 | #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2 | |
62 | #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3 |
|
64 | #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3 | |
63 | #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4 |
|
65 | #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4 | |
64 | #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5 |
|
66 | #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5 | |
65 | #define RTEMS_EVENT_NORM_BP1_F0 RTEMS_EVENT_6 |
|
67 | #define RTEMS_EVENT_NORM_BP1_F0 RTEMS_EVENT_6 | |
66 | #define RTEMS_EVENT_NORM_BP2_F0 RTEMS_EVENT_7 |
|
68 | #define RTEMS_EVENT_NORM_BP2_F0 RTEMS_EVENT_7 | |
67 | #define RTEMS_EVENT_NORM_ASM_F0 RTEMS_EVENT_8 // ASM only in NORM mode |
|
69 | #define RTEMS_EVENT_NORM_ASM_F0 RTEMS_EVENT_8 // ASM only in NORM mode | |
68 | #define RTEMS_EVENT_NORM_BP1_F1 RTEMS_EVENT_9 |
|
70 | #define RTEMS_EVENT_NORM_BP1_F1 RTEMS_EVENT_9 | |
69 | #define RTEMS_EVENT_NORM_BP2_F1 RTEMS_EVENT_10 |
|
71 | #define RTEMS_EVENT_NORM_BP2_F1 RTEMS_EVENT_10 | |
70 | #define RTEMS_EVENT_NORM_ASM_F1 RTEMS_EVENT_11 // ASM only in NORM mode |
|
72 | #define RTEMS_EVENT_NORM_ASM_F1 RTEMS_EVENT_11 // ASM only in NORM mode | |
71 | #define RTEMS_EVENT_NORM_BP1_F2 RTEMS_EVENT_12 |
|
73 | #define RTEMS_EVENT_NORM_BP1_F2 RTEMS_EVENT_12 | |
72 | #define RTEMS_EVENT_NORM_BP2_F2 RTEMS_EVENT_13 |
|
74 | #define RTEMS_EVENT_NORM_BP2_F2 RTEMS_EVENT_13 | |
73 | #define RTEMS_EVENT_NORM_ASM_F2 RTEMS_EVENT_14 // ASM only in NORM mode |
|
75 | #define RTEMS_EVENT_NORM_ASM_F2 RTEMS_EVENT_14 // ASM only in NORM mode | |
74 | #define RTEMS_EVENT_SBM_BP1_F0 RTEMS_EVENT_15 |
|
76 | #define RTEMS_EVENT_SBM_BP1_F0 RTEMS_EVENT_15 | |
75 | #define RTEMS_EVENT_SBM_BP2_F0 RTEMS_EVENT_16 |
|
77 | #define RTEMS_EVENT_SBM_BP2_F0 RTEMS_EVENT_16 | |
76 | #define RTEMS_EVENT_SBM_BP1_F1 RTEMS_EVENT_17 |
|
78 | #define RTEMS_EVENT_SBM_BP1_F1 RTEMS_EVENT_17 | |
77 | #define RTEMS_EVENT_SBM_BP2_F1 RTEMS_EVENT_18 |
|
79 | #define RTEMS_EVENT_SBM_BP2_F1 RTEMS_EVENT_18 | |
78 | #define RTEMS_EVENT_BURST_BP1_F0 RTEMS_EVENT_19 |
|
80 | #define RTEMS_EVENT_BURST_BP1_F0 RTEMS_EVENT_19 | |
79 | #define RTEMS_EVENT_BURST_BP2_F0 RTEMS_EVENT_20 |
|
81 | #define RTEMS_EVENT_BURST_BP2_F0 RTEMS_EVENT_20 | |
80 | #define RTEMS_EVENT_BURST_BP1_F1 RTEMS_EVENT_21 |
|
82 | #define RTEMS_EVENT_BURST_BP1_F1 RTEMS_EVENT_21 | |
81 | #define RTEMS_EVENT_BURST_BP2_F1 RTEMS_EVENT_22 |
|
83 | #define RTEMS_EVENT_BURST_BP2_F1 RTEMS_EVENT_22 | |
82 |
|
84 | |||
83 | //**************************** |
|
85 | //**************************** | |
84 | // LFR DEFAULT MODE PARAMETERS |
|
86 | // LFR DEFAULT MODE PARAMETERS | |
85 | // COMMON |
|
87 | // COMMON | |
86 | #define DEFAULT_SY_LFR_COMMON0 0x00 |
|
88 | #define DEFAULT_SY_LFR_COMMON0 0x00 | |
87 | #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0 |
|
89 | #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0 | |
88 | // NORM |
|
90 | // NORM | |
89 | #define DFLT_SY_LFR_N_SWF_L 2048 // nb sample |
|
91 | #define DFLT_SY_LFR_N_SWF_L 2048 // nb sample | |
90 | #define DFLT_SY_LFR_N_SWF_P 300 // sec |
|
92 | #define DFLT_SY_LFR_N_SWF_P 300 // sec | |
91 | #define DFLT_SY_LFR_N_ASM_P 3600 // sec |
|
93 | #define DFLT_SY_LFR_N_ASM_P 3600 // sec | |
92 | #define DFLT_SY_LFR_N_BP_P0 4 // sec |
|
94 | #define DFLT_SY_LFR_N_BP_P0 4 // sec | |
93 | #define DFLT_SY_LFR_N_BP_P1 20 // sec |
|
95 | #define DFLT_SY_LFR_N_BP_P1 20 // sec | |
94 | #define DFLT_SY_LFR_N_CWF_LONG_F3 0 // 0 => production of light continuous waveforms at f3 |
|
96 | #define DFLT_SY_LFR_N_CWF_LONG_F3 0 // 0 => production of light continuous waveforms at f3 | |
95 | #define MIN_DELTA_SNAPSHOT 16 // sec |
|
97 | #define MIN_DELTA_SNAPSHOT 16 // sec | |
96 | // BURST |
|
98 | // BURST | |
97 | #define DEFAULT_SY_LFR_B_BP_P0 1 // sec |
|
99 | #define DEFAULT_SY_LFR_B_BP_P0 1 // sec | |
98 | #define DEFAULT_SY_LFR_B_BP_P1 5 // sec |
|
100 | #define DEFAULT_SY_LFR_B_BP_P1 5 // sec | |
99 | // SBM1 |
|
101 | // SBM1 | |
100 | #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec |
|
102 | #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec | |
101 | #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec |
|
103 | #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec | |
102 | // SBM2 |
|
104 | // SBM2 | |
103 | #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec |
|
105 | #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec | |
104 | #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec |
|
106 | #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec | |
105 | // ADDITIONAL PARAMETERS |
|
107 | // ADDITIONAL PARAMETERS | |
106 | #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms |
|
108 | #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms | |
107 | #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s |
|
109 | #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s | |
108 | // STATUS WORD |
|
110 | // STATUS WORD | |
109 | #define DEFAULT_STATUS_WORD_BYTE0 0x0d // [0000] [1] [101] mode 4 bits / SPW enabled 1 bit / state is run 3 bits |
|
111 | #define DEFAULT_STATUS_WORD_BYTE0 0x0d // [0000] [1] [101] mode 4 bits / SPW enabled 1 bit / state is run 3 bits | |
110 | #define DEFAULT_STATUS_WORD_BYTE1 0x00 |
|
112 | #define DEFAULT_STATUS_WORD_BYTE1 0x00 | |
111 | // |
|
113 | // | |
112 | #define SY_LFR_DPU_CONNECT_TIMEOUT 100 // 100 * 10 ms = 1 s |
|
114 | #define SY_LFR_DPU_CONNECT_TIMEOUT 100 // 100 * 10 ms = 1 s | |
113 | #define SY_LFR_DPU_CONNECT_ATTEMPT 3 |
|
115 | #define SY_LFR_DPU_CONNECT_ATTEMPT 3 | |
114 | //**************************** |
|
116 | //**************************** | |
115 |
|
117 | |||
116 | //***************************** |
|
118 | //***************************** | |
117 | // APB REGISTERS BASE ADDRESSES |
|
119 | // APB REGISTERS BASE ADDRESSES | |
118 | #define REGS_ADDR_APBUART 0x80000100 |
|
120 | #define REGS_ADDR_APBUART 0x80000100 | |
119 | #define REGS_ADDR_GPTIMER 0x80000300 |
|
121 | #define REGS_ADDR_GPTIMER 0x80000300 | |
120 | #define REGS_ADDR_GRSPW 0x80000500 |
|
122 | #define REGS_ADDR_GRSPW 0x80000500 | |
121 | #define REGS_ADDR_TIME_MANAGEMENT 0x80000600 |
|
123 | #define REGS_ADDR_TIME_MANAGEMENT 0x80000600 | |
122 | #define REGS_ADDR_GRGPIO 0x80000b00 |
|
124 | #define REGS_ADDR_GRGPIO 0x80000b00 | |
123 |
|
125 | |||
124 | #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00 |
|
126 | #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00 | |
125 | #define REGS_ADDR_WAVEFORM_PICKER 0x80000f50 |
|
127 | //#define REGS_ADDR_WAVEFORM_PICKER 0x80000f50 | |
|
128 | #define REGS_ADDR_WAVEFORM_PICKER 0x80000f54 // PDB >= 0.1.28 | |||
126 | #define REGS_ADDR_VHDL_VERSION 0x80000ff0 |
|
129 | #define REGS_ADDR_VHDL_VERSION 0x80000ff0 | |
127 |
|
130 | |||
128 | #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff |
|
131 | #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff | |
129 | #define APBUART_CTRL_REG_MASK_TE 0x00000002 |
|
132 | #define APBUART_CTRL_REG_MASK_TE 0x00000002 | |
130 | // scaler value = system_clock_frequency / ( baud_rate * 8 ) - 1 |
|
133 | // scaler value = system_clock_frequency / ( baud_rate * 8 ) - 1 | |
131 | #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 |
|
134 | #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 | |
132 |
|
135 | |||
133 | //********** |
|
136 | //********** | |
134 | // IRQ LINES |
|
137 | // IRQ LINES | |
135 | #define IRQ_SM_SIMULATOR 9 |
|
138 | #define IRQ_SM_SIMULATOR 9 | |
136 | #define IRQ_SPARC_SM_SIMULATOR 0x19 // see sparcv8.pdf p.76 for interrupt levels |
|
139 | #define IRQ_SPARC_SM_SIMULATOR 0x19 // see sparcv8.pdf p.76 for interrupt levels | |
137 | #define IRQ_WAVEFORM_PICKER 14 |
|
140 | #define IRQ_WAVEFORM_PICKER 14 | |
138 | #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels |
|
141 | #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels | |
139 | #define IRQ_SPECTRAL_MATRIX 6 |
|
142 | #define IRQ_SPECTRAL_MATRIX 6 | |
140 | #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels |
|
143 | #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels | |
141 |
|
144 | |||
142 | //***** |
|
145 | //***** | |
143 | // TIME |
|
146 | // TIME | |
144 | #define CLKDIV_SM_SIMULATOR (10416 - 1) // 10 ms => nominal is 1/96 = 0.010416667, 10417 - 1 = 10416 |
|
147 | #define CLKDIV_SM_SIMULATOR (10416 - 1) // 10 ms => nominal is 1/96 = 0.010416667, 10417 - 1 = 10416 | |
145 | #define TIMER_SM_SIMULATOR 1 |
|
148 | #define TIMER_SM_SIMULATOR 1 | |
146 | #define HK_PERIOD 100 // 100 * 10ms => 1s |
|
149 | #define HK_PERIOD 100 // 100 * 10ms => 1s | |
147 | #define SY_LFR_TIME_SYN_TIMEOUT_in_ms 2000 |
|
150 | #define SY_LFR_TIME_SYN_TIMEOUT_in_ms 2000 | |
148 | #define SY_LFR_TIME_SYN_TIMEOUT_in_ticks 200 // 200 * 10 ms = 2 s |
|
151 | #define SY_LFR_TIME_SYN_TIMEOUT_in_ticks 200 // 200 * 10 ms = 2 s | |
149 |
|
152 | |||
150 | //********** |
|
153 | //********** | |
151 | // LPP CODES |
|
154 | // LPP CODES | |
152 | #define LFR_SUCCESSFUL 0 |
|
155 | #define LFR_SUCCESSFUL 0 | |
153 | #define LFR_DEFAULT 1 |
|
156 | #define LFR_DEFAULT 1 | |
154 | #define LFR_EXE_ERROR 2 |
|
157 | #define LFR_EXE_ERROR 2 | |
155 |
|
158 | |||
156 | //****** |
|
159 | //****** | |
157 | // RTEMS |
|
160 | // RTEMS | |
158 | #define TASKID_RECV 1 |
|
161 | #define TASKID_RECV 1 | |
159 | #define TASKID_ACTN 2 |
|
162 | #define TASKID_ACTN 2 | |
160 | #define TASKID_SPIQ 3 |
|
163 | #define TASKID_SPIQ 3 | |
161 | #define TASKID_STAT 4 |
|
164 | #define TASKID_STAT 4 | |
162 | #define TASKID_AVF0 5 |
|
165 | #define TASKID_AVF0 5 | |
163 | #define TASKID_SWBD 6 |
|
166 | #define TASKID_SWBD 6 | |
164 | #define TASKID_WFRM 7 |
|
167 | #define TASKID_WFRM 7 | |
165 | #define TASKID_DUMB 8 |
|
168 | #define TASKID_DUMB 8 | |
166 | #define TASKID_HOUS 9 |
|
169 | #define TASKID_HOUS 9 | |
167 | #define TASKID_PRC0 10 |
|
170 | #define TASKID_PRC0 10 | |
168 | #define TASKID_CWF3 11 |
|
171 | #define TASKID_CWF3 11 | |
169 | #define TASKID_CWF2 12 |
|
172 | #define TASKID_CWF2 12 | |
170 | #define TASKID_CWF1 13 |
|
173 | #define TASKID_CWF1 13 | |
171 | #define TASKID_SEND 14 |
|
174 | #define TASKID_SEND 14 | |
172 | #define TASKID_WTDG 15 |
|
175 | #define TASKID_WTDG 15 | |
173 | #define TASKID_AVF1 16 |
|
176 | #define TASKID_AVF1 16 | |
174 | #define TASKID_PRC1 17 |
|
177 | #define TASKID_PRC1 17 | |
175 | #define TASKID_AVF2 18 |
|
178 | #define TASKID_AVF2 18 | |
176 | #define TASKID_PRC2 19 |
|
179 | #define TASKID_PRC2 19 | |
177 |
|
180 | |||
178 | #define TASK_PRIORITY_SPIQ 5 |
|
181 | #define TASK_PRIORITY_SPIQ 5 | |
179 | #define TASK_PRIORITY_WTDG 20 |
|
182 | #define TASK_PRIORITY_WTDG 20 | |
180 | #define TASK_PRIORITY_HOUS 30 |
|
183 | #define TASK_PRIORITY_HOUS 30 | |
181 | #define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together |
|
184 | #define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together | |
182 | #define TASK_PRIORITY_CWF2 35 // |
|
185 | #define TASK_PRIORITY_CWF2 35 // | |
183 | #define TASK_PRIORITY_SWBD 37 // SWBD has a lower priority than WFRM, this is to extract the snapshot before sending it |
|
186 | #define TASK_PRIORITY_SWBD 37 // SWBD has a lower priority than WFRM, this is to extract the snapshot before sending it | |
184 | #define TASK_PRIORITY_WFRM 40 |
|
187 | #define TASK_PRIORITY_WFRM 40 | |
185 | #define TASK_PRIORITY_CWF3 40 // there is a printf in this function, be careful with its priority wrt CWF1 |
|
188 | #define TASK_PRIORITY_CWF3 40 // there is a printf in this function, be careful with its priority wrt CWF1 | |
186 | #define TASK_PRIORITY_SEND 45 |
|
189 | #define TASK_PRIORITY_SEND 45 | |
187 | #define TASK_PRIORITY_RECV 50 |
|
190 | #define TASK_PRIORITY_RECV 50 | |
188 | #define TASK_PRIORITY_ACTN 50 |
|
191 | #define TASK_PRIORITY_ACTN 50 | |
189 | #define TASK_PRIORITY_AVF0 60 |
|
192 | #define TASK_PRIORITY_AVF0 60 | |
190 | #define TASK_PRIORITY_AVF1 70 |
|
193 | #define TASK_PRIORITY_AVF1 70 | |
191 | #define TASK_PRIORITY_PRC0 100 |
|
194 | #define TASK_PRIORITY_PRC0 100 | |
192 | #define TASK_PRIORITY_PRC1 100 |
|
195 | #define TASK_PRIORITY_PRC1 100 | |
193 | #define TASK_PRIORITY_AVF2 110 |
|
196 | #define TASK_PRIORITY_AVF2 110 | |
194 | #define TASK_PRIORITY_PRC2 110 |
|
197 | #define TASK_PRIORITY_PRC2 110 | |
195 | #define TASK_PRIORITY_STAT 200 |
|
198 | #define TASK_PRIORITY_STAT 200 | |
196 | #define TASK_PRIORITY_DUMB 200 |
|
199 | #define TASK_PRIORITY_DUMB 200 | |
197 |
|
200 | |||
198 | #define MSG_QUEUE_COUNT_RECV 10 |
|
201 | #define MSG_QUEUE_COUNT_RECV 10 | |
199 | #define MSG_QUEUE_COUNT_SEND 50 |
|
202 | #define MSG_QUEUE_COUNT_SEND 50 | |
200 | #define MSG_QUEUE_COUNT_PRC0 10 |
|
203 | #define MSG_QUEUE_COUNT_PRC0 10 | |
201 | #define MSG_QUEUE_COUNT_PRC1 10 |
|
204 | #define MSG_QUEUE_COUNT_PRC1 10 | |
202 | #define MSG_QUEUE_COUNT_PRC2 5 |
|
205 | #define MSG_QUEUE_COUNT_PRC2 5 | |
203 | #define MSG_QUEUE_SIZE_SEND 810 // 806 + 4 => TM_LFR_SCIENCE_BURST_BP2_F1 |
|
206 | #define MSG_QUEUE_SIZE_SEND 810 // 806 + 4 => TM_LFR_SCIENCE_BURST_BP2_F1 | |
204 | #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options |
|
207 | #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options | |
205 | #define MSG_QUEUE_SIZE_PRC0 20 // two pointers and one rtems_event + 2 integers |
|
208 | #define MSG_QUEUE_SIZE_PRC0 20 // two pointers and one rtems_event + 2 integers | |
206 | #define MSG_QUEUE_SIZE_PRC1 20 // two pointers and one rtems_event + 2 integers |
|
209 | #define MSG_QUEUE_SIZE_PRC1 20 // two pointers and one rtems_event + 2 integers | |
207 | #define MSG_QUEUE_SIZE_PRC2 20 // two pointers and one rtems_event + 2 integers |
|
210 | #define MSG_QUEUE_SIZE_PRC2 20 // two pointers and one rtems_event + 2 integers | |
208 |
|
211 | |||
209 | #define QUEUE_RECV 0 |
|
212 | #define QUEUE_RECV 0 | |
210 | #define QUEUE_SEND 1 |
|
213 | #define QUEUE_SEND 1 | |
211 | #define QUEUE_PRC0 2 |
|
214 | #define QUEUE_PRC0 2 | |
212 | #define QUEUE_PRC1 3 |
|
215 | #define QUEUE_PRC1 3 | |
213 | #define QUEUE_PRC2 4 |
|
216 | #define QUEUE_PRC2 4 | |
214 |
|
217 | |||
215 | //******* |
|
218 | //******* | |
216 | // MACROS |
|
219 | // MACROS | |
217 | #ifdef PRINT_MESSAGES_ON_CONSOLE |
|
220 | #ifdef PRINT_MESSAGES_ON_CONSOLE | |
218 | #define PRINTF(x) printf(x); |
|
221 | #define PRINTF(x) printf(x); | |
219 | #define PRINTF1(x,y) printf(x,y); |
|
222 | #define PRINTF1(x,y) printf(x,y); | |
220 | #define PRINTF2(x,y,z) printf(x,y,z); |
|
223 | #define PRINTF2(x,y,z) printf(x,y,z); | |
221 | #else |
|
224 | #else | |
222 | #define PRINTF(x) ; |
|
225 | #define PRINTF(x) ; | |
223 | #define PRINTF1(x,y) ; |
|
226 | #define PRINTF1(x,y) ; | |
224 | #define PRINTF2(x,y,z) ; |
|
227 | #define PRINTF2(x,y,z) ; | |
225 | #endif |
|
228 | #endif | |
226 |
|
229 | |||
227 | #ifdef BOOT_MESSAGES |
|
230 | #ifdef BOOT_MESSAGES | |
228 | #define BOOT_PRINTF(x) printf(x); |
|
231 | #define BOOT_PRINTF(x) printf(x); | |
229 | #define BOOT_PRINTF1(x,y) printf(x,y); |
|
232 | #define BOOT_PRINTF1(x,y) printf(x,y); | |
230 | #define BOOT_PRINTF2(x,y,z) printf(x,y,z); |
|
233 | #define BOOT_PRINTF2(x,y,z) printf(x,y,z); | |
231 | #else |
|
234 | #else | |
232 | #define BOOT_PRINTF(x) ; |
|
235 | #define BOOT_PRINTF(x) ; | |
233 | #define BOOT_PRINTF1(x,y) ; |
|
236 | #define BOOT_PRINTF1(x,y) ; | |
234 | #define BOOT_PRINTF2(x,y,z) ; |
|
237 | #define BOOT_PRINTF2(x,y,z) ; | |
235 | #endif |
|
238 | #endif | |
236 |
|
239 | |||
237 | #ifdef DEBUG_MESSAGES |
|
240 | #ifdef DEBUG_MESSAGES | |
238 | #define DEBUG_PRINTF(x) printf(x); |
|
241 | #define DEBUG_PRINTF(x) printf(x); | |
239 | #define DEBUG_PRINTF1(x,y) printf(x,y); |
|
242 | #define DEBUG_PRINTF1(x,y) printf(x,y); | |
240 | #define DEBUG_PRINTF2(x,y,z) printf(x,y,z); |
|
243 | #define DEBUG_PRINTF2(x,y,z) printf(x,y,z); | |
241 | #else |
|
244 | #else | |
242 | #define DEBUG_PRINTF(x) ; |
|
245 | #define DEBUG_PRINTF(x) ; | |
243 | #define DEBUG_PRINTF1(x,y) ; |
|
246 | #define DEBUG_PRINTF1(x,y) ; | |
244 | #define DEBUG_PRINTF2(x,y,z) ; |
|
247 | #define DEBUG_PRINTF2(x,y,z) ; | |
245 | #endif |
|
248 | #endif | |
246 |
|
249 | |||
247 | #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period |
|
250 | #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period | |
248 |
|
251 | |||
249 | struct param_local_str{ |
|
252 | struct param_local_str{ | |
250 | unsigned int local_sbm1_nb_cwf_sent; |
|
253 | unsigned int local_sbm1_nb_cwf_sent; | |
251 | unsigned int local_sbm1_nb_cwf_max; |
|
254 | unsigned int local_sbm1_nb_cwf_max; | |
252 | unsigned int local_sbm2_nb_cwf_sent; |
|
255 | unsigned int local_sbm2_nb_cwf_sent; | |
253 | unsigned int local_sbm2_nb_cwf_max; |
|
256 | unsigned int local_sbm2_nb_cwf_max; | |
254 | }; |
|
257 | }; | |
255 |
|
258 | |||
256 | #endif // FSW_PARAMS_H_INCLUDED |
|
259 | #endif // FSW_PARAMS_H_INCLUDED |
@@ -1,109 +1,122 | |||||
1 | #ifndef GRLIB_REGS_H_INCLUDED |
|
1 | #ifndef GRLIB_REGS_H_INCLUDED | |
2 | #define GRLIB_REGS_H_INCLUDED |
|
2 | #define GRLIB_REGS_H_INCLUDED | |
3 |
|
3 | |||
4 | #define NB_GPTIMER 3 |
|
4 | #define NB_GPTIMER 3 | |
5 |
|
5 | |||
6 | struct apbuart_regs_str{ |
|
6 | struct apbuart_regs_str{ | |
7 | volatile unsigned int data; |
|
7 | volatile unsigned int data; | |
8 | volatile unsigned int status; |
|
8 | volatile unsigned int status; | |
9 | volatile unsigned int ctrl; |
|
9 | volatile unsigned int ctrl; | |
10 | volatile unsigned int scaler; |
|
10 | volatile unsigned int scaler; | |
11 | volatile unsigned int fifoDebug; |
|
11 | volatile unsigned int fifoDebug; | |
12 | }; |
|
12 | }; | |
13 |
|
13 | |||
14 | struct grgpio_regs_str{ |
|
14 | struct grgpio_regs_str{ | |
15 | volatile int io_port_data_register; |
|
15 | volatile int io_port_data_register; | |
16 | int io_port_output_register; |
|
16 | int io_port_output_register; | |
17 | int io_port_direction_register; |
|
17 | int io_port_direction_register; | |
18 | int interrupt_mak_register; |
|
18 | int interrupt_mak_register; | |
19 | int interrupt_polarity_register; |
|
19 | int interrupt_polarity_register; | |
20 | int interrupt_edge_register; |
|
20 | int interrupt_edge_register; | |
21 | int bypass_register; |
|
21 | int bypass_register; | |
22 | int reserved; |
|
22 | int reserved; | |
23 | // 0x20-0x3c interrupt map register(s) |
|
23 | // 0x20-0x3c interrupt map register(s) | |
24 | }; |
|
24 | }; | |
25 |
|
25 | |||
26 | typedef struct { |
|
26 | typedef struct { | |
27 | volatile unsigned int counter; |
|
27 | volatile unsigned int counter; | |
28 | volatile unsigned int reload; |
|
28 | volatile unsigned int reload; | |
29 | volatile unsigned int ctrl; |
|
29 | volatile unsigned int ctrl; | |
30 | volatile unsigned int unused; |
|
30 | volatile unsigned int unused; | |
31 | } timer_regs_t; |
|
31 | } timer_regs_t; | |
32 |
|
32 | |||
33 | typedef struct { |
|
33 | typedef struct { | |
34 | volatile unsigned int scaler_value; |
|
34 | volatile unsigned int scaler_value; | |
35 | volatile unsigned int scaler_reload; |
|
35 | volatile unsigned int scaler_reload; | |
36 | volatile unsigned int conf; |
|
36 | volatile unsigned int conf; | |
37 | volatile unsigned int unused0; |
|
37 | volatile unsigned int unused0; | |
38 | timer_regs_t timer[NB_GPTIMER]; |
|
38 | timer_regs_t timer[NB_GPTIMER]; | |
39 | } gptimer_regs_t; |
|
39 | } gptimer_regs_t; | |
40 |
|
40 | |||
41 | typedef struct { |
|
41 | typedef struct { | |
42 | volatile int ctrl; // bit 0 forces the load of the coarse_time_load value and resets the fine_time |
|
42 | volatile int ctrl; // bit 0 forces the load of the coarse_time_load value and resets the fine_time | |
43 | volatile int coarse_time_load; |
|
43 | volatile int coarse_time_load; | |
44 | volatile int coarse_time; |
|
44 | volatile int coarse_time; | |
45 | volatile int fine_time; |
|
45 | volatile int fine_time; | |
46 | } time_management_regs_t; |
|
46 | } time_management_regs_t; | |
47 |
|
47 | |||
48 | typedef struct { |
|
48 | // PDB >= 0.1.28 | |
49 | volatile int data_shaping; // 0x00 00 *** R1 R0 SP1 SP0 BW |
|
|||
50 | volatile int burst_enable; // 0x04 01 *** burst f2, f1, f0 enable f3, f2, f1, f0 |
|
|||
51 | volatile int addr_data_f0; // 0x08 10 *** |
|
|||
52 | volatile int addr_data_f1; // 0x0c 11 *** |
|
|||
53 | volatile int addr_data_f2; // 0x10 100 *** |
|
|||
54 | volatile int addr_data_f3; // 0x14 101 *** |
|
|||
55 | volatile int status; // 0x18 110 *** |
|
|||
56 | volatile int delta_snapshot; // 0x1c 111 *** |
|
|||
57 | volatile int delta_f2_f1; // 0x20 0000 *** |
|
|||
58 | volatile int delta_f2_f0; // 0x24 0001 *** |
|
|||
59 | volatile int nb_burst_available;// 0x28 0010 *** |
|
|||
60 | volatile int nb_snapshot_param; // 0x2c 0011 *** |
|
|||
61 | } waveform_picker_regs_t; |
|
|||
62 |
|
||||
63 | typedef struct{ |
|
49 | typedef struct{ | |
64 | int data_shaping; // 0x00 00 *** R1 R0 SP1 SP0 BW |
|
50 | int data_shaping; // 0x00 00 *** R1 R0 SP1 SP0 BW | |
65 | int run_burst_enable; // 0x04 01 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ] |
|
51 | int run_burst_enable; // 0x04 01 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ] | |
66 | int addr_data_f0; // 0x08 |
|
52 | int addr_data_f0_0; // 0x08 | |
67 | int addr_data_f1; // 0x0c |
|
53 | int addr_data_f0_1; // 0x0c | |
68 |
int addr_data_f |
|
54 | int addr_data_f1_0; // 0x10 | |
69 |
int addr_data_f |
|
55 | int addr_data_f1_1; // 0x14 | |
70 | volatile int status; // 0x18 |
|
56 | int addr_data_f2_0; // 0x18 | |
71 |
int |
|
57 | int addr_data_f2_1; // 0x1c | |
72 |
int |
|
58 | int addr_data_f3_0; // 0x20 | |
73 |
int |
|
59 | int addr_data_f3_1; // 0x24 | |
74 |
int |
|
60 | volatile int status; // 0x28 | |
75 |
int delta_ |
|
61 | int delta_snapshot; // 0x2c | |
76 |
int |
|
62 | int delta_f0; // 0x30 | |
77 | int snapshot_param; // 0x34 |
|
63 | int delta_f0_2; // 0x34 | |
78 |
int |
|
64 | int delta_f1; // 0x38 | |
79 | int nb_word_in_buffer; // 0x3c |
|
65 | int delta_f2; // 0x3c | |
80 | } waveform_picker_regs_new_t; |
|
66 | int nb_data_by_buffer; // 0x40 number of samples in a buffer = 2688 | |
|
67 | int snapshot_param; // 0x44 | |||
|
68 | int start_date; // 0x48 | |||
|
69 | // | |||
|
70 | volatile unsigned int f0_0_coarse_time; // 0x4c | |||
|
71 | volatile unsigned int f0_0_fine_time; // 0x50 | |||
|
72 | volatile unsigned int f0_1_coarse_time; // 0x54 | |||
|
73 | volatile unsigned int f0_1_fine_time; // 0x58 | |||
|
74 | // | |||
|
75 | volatile unsigned int f1_0_coarse_time; // 0x5c | |||
|
76 | volatile unsigned int f1_0_fine_time; // 0x60 | |||
|
77 | volatile unsigned int f1_1_coarse_time; // 0x64 | |||
|
78 | volatile unsigned int f1_1_fine_time; // 0x68 | |||
|
79 | // | |||
|
80 | volatile unsigned int f2_0_coarse_time; // 0x6c | |||
|
81 | volatile unsigned int f2_0_fine_time; // 0x70 | |||
|
82 | volatile unsigned int f2_1_coarse_time; // 0x74 | |||
|
83 | volatile unsigned int f2_1_fine_time; // 0x78 | |||
|
84 | // | |||
|
85 | volatile unsigned int f3_0_coarse_time; // 0x7c | |||
|
86 | volatile unsigned int f3_0_fine_time; // 0x80 | |||
|
87 | volatile unsigned int f3_1_coarse_time; // 0x84 | |||
|
88 | volatile unsigned int f3_1_fine_time; // 0x88 | |||
|
89 | // | |||
|
90 | unsigned int buffer_length; // 0x8c = buffer length in burst 2688 / 16 = 168 | |||
|
91 | } waveform_picker_regs_0_1_18_t; | |||
81 |
|
92 | |||
82 | typedef struct { |
|
93 | typedef struct { | |
83 | volatile int config; // 0x00 |
|
94 | volatile int config; // 0x00 | |
84 | volatile int status; // 0x04 |
|
95 | volatile int status; // 0x04 | |
85 | volatile int f0_0_address; // 0x08 |
|
96 | volatile int f0_0_address; // 0x08 | |
86 | volatile int f0_1_address; // 0x0C |
|
97 | volatile int f0_1_address; // 0x0C | |
87 | // |
|
98 | // | |
88 | volatile int f1_0_address; // 0x10 |
|
99 | volatile int f1_0_address; // 0x10 | |
89 | volatile int f1_1_address; // 0x14 |
|
100 | volatile int f1_1_address; // 0x14 | |
90 | volatile int f2_0_address; // 0x18 |
|
101 | volatile int f2_0_address; // 0x18 | |
91 | volatile int f2_1_address; // 0x1C |
|
102 | volatile int f2_1_address; // 0x1C | |
92 | // |
|
103 | // | |
93 |
volatile unsigned int f0_0_coarse_time; |
|
104 | volatile unsigned int f0_0_coarse_time; // 0x20 | |
94 |
volatile unsigned int f0_0_fine_time; |
|
105 | volatile unsigned int f0_0_fine_time; // 0x24 | |
95 |
volatile unsigned int f0_1_coarse_time; |
|
106 | volatile unsigned int f0_1_coarse_time; // 0x28 | |
96 |
volatile unsigned int f0_1_fine_time; |
|
107 | volatile unsigned int f0_1_fine_time; // 0x2C | |
97 | // |
|
108 | // | |
98 |
volatile unsigned int f1_0_coarse_time; |
|
109 | volatile unsigned int f1_0_coarse_time; // 0x30 | |
99 |
volatile unsigned int f1_0_fine_time; |
|
110 | volatile unsigned int f1_0_fine_time; // 0x34 | |
100 |
volatile unsigned int f1_1_coarse_time; |
|
111 | volatile unsigned int f1_1_coarse_time; // 0x38 | |
101 |
volatile unsigned int f1_1_time_time; |
|
112 | volatile unsigned int f1_1_time_time; // 0x3C | |
102 | // |
|
113 | // | |
103 |
volatile unsigned int f2_0_coarse_time; |
|
114 | volatile unsigned int f2_0_coarse_time; // 0x40 | |
104 |
volatile unsigned int f2_0_fine_time; |
|
115 | volatile unsigned int f2_0_fine_time; // 0x44 | |
105 |
volatile unsigned int f2_1_coarse_time; |
|
116 | volatile unsigned int f2_1_coarse_time; // 0x48 | |
106 |
volatile unsigned int f2_1_fine_time; |
|
117 | volatile unsigned int f2_1_fine_time; // 0x4C | |
|
118 | // | |||
|
119 | unsigned int matrix_length; // 0x50, length of a spectral matrix in burst 3200 / 16 = 200 = 0xc8 | |||
107 | } spectral_matrix_regs_t; |
|
120 | } spectral_matrix_regs_t; | |
108 |
|
121 | |||
109 | #endif // GRLIB_REGS_H_INCLUDED |
|
122 | #endif // GRLIB_REGS_H_INCLUDED |
@@ -1,92 +1,92 | |||||
1 | #ifndef WF_HANDLER_H_INCLUDED |
|
1 | #ifndef WF_HANDLER_H_INCLUDED | |
2 | #define WF_HANDLER_H_INCLUDED |
|
2 | #define WF_HANDLER_H_INCLUDED | |
3 |
|
3 | |||
4 | #include <rtems.h> |
|
4 | #include <rtems.h> | |
5 | #include <grspw.h> |
|
5 | #include <grspw.h> | |
6 | #include <stdio.h> |
|
6 | #include <stdio.h> | |
7 | #include <math.h> |
|
7 | #include <math.h> | |
8 |
|
8 | |||
9 | #include "fsw_params.h" |
|
9 | #include "fsw_params.h" | |
10 | #include "fsw_spacewire.h" |
|
10 | #include "fsw_spacewire.h" | |
11 | #include "fsw_misc.h" |
|
11 | #include "fsw_misc.h" | |
12 | #include "fsw_params_wf_handler.h" |
|
12 | #include "fsw_params_wf_handler.h" | |
13 |
|
13 | |||
14 | #define pi 3.1415 |
|
14 | #define pi 3.1415 | |
15 |
|
15 | |||
16 | extern int fdSPW; |
|
16 | extern int fdSPW; | |
17 |
|
17 | |||
18 | //***************** |
|
18 | //***************** | |
19 | // waveform buffers |
|
19 | // waveform buffers | |
20 | extern volatile int wf_snap_f0[ ]; |
|
20 | extern volatile int wf_snap_f0[ ]; | |
21 | extern volatile int wf_snap_f1[ ]; |
|
21 | extern volatile int wf_snap_f1[ ]; | |
22 | extern volatile int wf_snap_f2[ ]; |
|
22 | extern volatile int wf_snap_f2[ ]; | |
23 | extern volatile int wf_cont_f3[ ]; |
|
23 | extern volatile int wf_cont_f3[ ]; | |
24 | extern char wf_cont_f3_light[ ]; |
|
24 | extern char wf_cont_f3_light[ ]; | |
25 |
|
25 | |||
26 |
extern waveform_picker_regs_ |
|
26 | extern waveform_picker_regs_0_1_18_t *waveform_picker_regs; | |
27 | extern time_management_regs_t *time_management_regs; |
|
27 | extern time_management_regs_t *time_management_regs; | |
28 | extern Packet_TM_LFR_HK_t housekeeping_packet; |
|
28 | extern Packet_TM_LFR_HK_t housekeeping_packet; | |
29 | extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet; |
|
29 | extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet; | |
30 | extern struct param_local_str param_local; |
|
30 | extern struct param_local_str param_local; | |
31 |
|
31 | |||
32 | extern unsigned short sequenceCounters_SCIENCE_NORMAL_BURST; |
|
32 | extern unsigned short sequenceCounters_SCIENCE_NORMAL_BURST; | |
33 | extern unsigned short sequenceCounters_SCIENCE_SBM1_SBM2; |
|
33 | extern unsigned short sequenceCounters_SCIENCE_SBM1_SBM2; | |
34 |
|
34 | |||
35 | extern rtems_id Task_id[20]; /* array of task ids */ |
|
35 | extern rtems_id Task_id[20]; /* array of task ids */ | |
36 |
|
36 | |||
37 | extern unsigned char lfrCurrentMode; |
|
37 | extern unsigned char lfrCurrentMode; | |
38 |
|
38 | |||
39 | //********** |
|
39 | //********** | |
40 | // RTEMS_ISR |
|
40 | // RTEMS_ISR | |
41 | void reset_extractSWF( void ); |
|
41 | void reset_extractSWF( void ); | |
42 | rtems_isr waveforms_isr( rtems_vector_number vector ); |
|
42 | rtems_isr waveforms_isr( rtems_vector_number vector ); | |
43 |
|
43 | |||
44 | //*********** |
|
44 | //*********** | |
45 | // RTEMS_TASK |
|
45 | // RTEMS_TASK | |
46 | rtems_task wfrm_task( rtems_task_argument argument ); |
|
46 | rtems_task wfrm_task( rtems_task_argument argument ); | |
47 | rtems_task cwf3_task( rtems_task_argument argument ); |
|
47 | rtems_task cwf3_task( rtems_task_argument argument ); | |
48 | rtems_task cwf2_task( rtems_task_argument argument ); |
|
48 | rtems_task cwf2_task( rtems_task_argument argument ); | |
49 | rtems_task cwf1_task( rtems_task_argument argument ); |
|
49 | rtems_task cwf1_task( rtems_task_argument argument ); | |
50 | rtems_task swbd_task( rtems_task_argument argument ); |
|
50 | rtems_task swbd_task( rtems_task_argument argument ); | |
51 |
|
51 | |||
52 | //****************** |
|
52 | //****************** | |
53 | // general functions |
|
53 | // general functions | |
54 | void WFP_init_rings( void ); |
|
54 | void WFP_init_rings( void ); | |
55 | void init_waveform_ring( ring_node waveform_ring[], unsigned char nbNodes, volatile int wfrm[] ); |
|
55 | void init_waveform_ring( ring_node waveform_ring[], unsigned char nbNodes, volatile int wfrm[] ); | |
56 | void WFP_reset_current_ring_nodes( void ); |
|
56 | void WFP_reset_current_ring_nodes( void ); | |
57 | // |
|
57 | // | |
58 | int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF ); |
|
58 | int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF ); | |
59 | int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF ); |
|
59 | int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF ); | |
60 | int init_header_continuous_cwf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF ); |
|
60 | int init_header_continuous_cwf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF ); | |
61 | // |
|
61 | // | |
62 | int send_waveform_SWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id ); |
|
62 | int send_waveform_SWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id ); | |
63 | int send_waveform_CWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id ); |
|
63 | int send_waveform_CWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id ); | |
64 | int send_waveform_CWF3( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id ); |
|
64 | int send_waveform_CWF3( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id ); | |
65 | int send_waveform_CWF3_light( volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id ); |
|
65 | int send_waveform_CWF3_light( volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id ); | |
66 | // |
|
66 | // | |
67 | void compute_acquisition_time(unsigned int coarseTime, unsigned int fineTime, |
|
67 | void compute_acquisition_time(unsigned int coarseTime, unsigned int fineTime, | |
68 | unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char *acquisitionTime ); |
|
68 | unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char *acquisitionTime ); | |
69 | void build_snapshot_from_ring(ring_node *ring_node_to_send , unsigned char frequencyChannel ); |
|
69 | void build_snapshot_from_ring(ring_node *ring_node_to_send , unsigned char frequencyChannel ); | |
70 | void snapshot_resynchronization( unsigned char *timePtr ); |
|
70 | void snapshot_resynchronization( unsigned char *timePtr ); | |
71 | // |
|
71 | // | |
72 | rtems_id get_pkts_queue_id( void ); |
|
72 | rtems_id get_pkts_queue_id( void ); | |
73 |
|
73 | |||
74 | //************** |
|
74 | //************** | |
75 | // wfp registers |
|
75 | // wfp registers | |
76 | // RESET |
|
76 | // RESET | |
77 | void reset_wfp_burst_enable( void ); |
|
77 | void reset_wfp_burst_enable( void ); | |
78 | void reset_wfp_status(void); |
|
78 | void reset_wfp_status(void); | |
79 | void reset_waveform_picker_regs( void ); |
|
79 | void reset_waveform_picker_regs( void ); | |
80 | // SET |
|
80 | // SET | |
81 | void set_wfp_data_shaping(void); |
|
81 | void set_wfp_data_shaping(void); | |
82 | void set_wfp_burst_enable_register( unsigned char mode ); |
|
82 | void set_wfp_burst_enable_register( unsigned char mode ); | |
83 | void set_wfp_delta_snapshot( void ); |
|
83 | void set_wfp_delta_snapshot( void ); | |
84 | void set_wfp_delta_f0_f0_2( void ); |
|
84 | void set_wfp_delta_f0_f0_2( void ); | |
85 | void set_wfp_delta_f1( void ); |
|
85 | void set_wfp_delta_f1( void ); | |
86 | void set_wfp_delta_f2( void ); |
|
86 | void set_wfp_delta_f2( void ); | |
87 |
|
87 | |||
88 | //***************** |
|
88 | //***************** | |
89 | // local parameters |
|
89 | // local parameters | |
90 | void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid ); |
|
90 | void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid ); | |
91 |
|
91 | |||
92 | #endif // WF_HANDLER_H_INCLUDED |
|
92 | #endif // WF_HANDLER_H_INCLUDED |
@@ -1,75 +1,75 | |||||
1 | /** Global variables of the LFR flight software. |
|
1 | /** Global variables of the LFR flight software. | |
2 | * |
|
2 | * | |
3 | * @file |
|
3 | * @file | |
4 | * @author P. LEROY |
|
4 | * @author P. LEROY | |
5 | * |
|
5 | * | |
6 | * Among global variables, there are: |
|
6 | * Among global variables, there are: | |
7 | * - RTEMS names and id. |
|
7 | * - RTEMS names and id. | |
8 | * - APB configuration registers. |
|
8 | * - APB configuration registers. | |
9 | * - waveforms global buffers, used by the waveform picker hardware module to store data. |
|
9 | * - waveforms global buffers, used by the waveform picker hardware module to store data. | |
10 | * - spectral matrices buffesr, used by the hardware module to store data. |
|
10 | * - spectral matrices buffesr, used by the hardware module to store data. | |
11 | * - variable related to LFR modes parameters. |
|
11 | * - variable related to LFR modes parameters. | |
12 | * - the global HK packet buffer. |
|
12 | * - the global HK packet buffer. | |
13 | * - the global dump parameter buffer. |
|
13 | * - the global dump parameter buffer. | |
14 | * |
|
14 | * | |
15 | */ |
|
15 | */ | |
16 |
|
16 | |||
17 | #include <rtems.h> |
|
17 | #include <rtems.h> | |
18 | #include <grspw.h> |
|
18 | #include <grspw.h> | |
19 |
|
19 | |||
20 | #include "ccsds_types.h" |
|
20 | #include "ccsds_types.h" | |
21 | #include "grlib_regs.h" |
|
21 | #include "grlib_regs.h" | |
22 | #include "fsw_params.h" |
|
22 | #include "fsw_params.h" | |
23 | #include "fsw_params_wf_handler.h" |
|
23 | #include "fsw_params_wf_handler.h" | |
24 |
|
24 | |||
25 | // RTEMS GLOBAL VARIABLES |
|
25 | // RTEMS GLOBAL VARIABLES | |
26 | rtems_name misc_name[5]; |
|
26 | rtems_name misc_name[5]; | |
27 | rtems_id misc_id[5]; |
|
27 | rtems_id misc_id[5]; | |
28 | rtems_name Task_name[20]; /* array of task names */ |
|
28 | rtems_name Task_name[20]; /* array of task names */ | |
29 | rtems_id Task_id[20]; /* array of task ids */ |
|
29 | rtems_id Task_id[20]; /* array of task ids */ | |
30 | unsigned int maxCount; |
|
30 | unsigned int maxCount; | |
31 | int fdSPW = 0; |
|
31 | int fdSPW = 0; | |
32 | int fdUART = 0; |
|
32 | int fdUART = 0; | |
33 | unsigned char lfrCurrentMode; |
|
33 | unsigned char lfrCurrentMode; | |
34 |
|
34 | |||
35 | // WAVEFORMS GLOBAL VARIABLES // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes = 24584 |
|
35 | // WAVEFORMS GLOBAL VARIABLES // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes = 24584 | |
36 | // 97 * 256 = 24832 => delta = 248 bytes = 62 words |
|
36 | // 97 * 256 = 24832 => delta = 248 bytes = 62 words | |
37 | // WAVEFORMS GLOBAL VARIABLES // 2688 * 3 * 4 + 2 * 4 = 32256 + 8 bytes = 32264 |
|
37 | // WAVEFORMS GLOBAL VARIABLES // 2688 * 3 * 4 + 2 * 4 = 32256 + 8 bytes = 32264 | |
38 | // 127 * 256 = 32512 => delta = 248 bytes = 62 words |
|
38 | // 127 * 256 = 32512 => delta = 248 bytes = 62 words | |
39 | // F0 F1 F2 F3 |
|
39 | // F0 F1 F2 F3 | |
40 | volatile int wf_snap_f0[ NB_RING_NODES_F0 * WFRM_BUFFER ] __attribute__((aligned(0x100))); |
|
40 | volatile int wf_snap_f0[ NB_RING_NODES_F0 * WFRM_BUFFER ] __attribute__((aligned(0x100))); | |
41 | volatile int wf_snap_f1[ NB_RING_NODES_F1 * WFRM_BUFFER ] __attribute__((aligned(0x100))); |
|
41 | volatile int wf_snap_f1[ NB_RING_NODES_F1 * WFRM_BUFFER ] __attribute__((aligned(0x100))); | |
42 | volatile int wf_snap_f2[ NB_RING_NODES_F2 * WFRM_BUFFER ] __attribute__((aligned(0x100))); |
|
42 | volatile int wf_snap_f2[ NB_RING_NODES_F2 * WFRM_BUFFER ] __attribute__((aligned(0x100))); | |
43 | volatile int wf_cont_f3[ NB_RING_NODES_F3 * WFRM_BUFFER ] __attribute__((aligned(0x100))); |
|
43 | volatile int wf_cont_f3[ NB_RING_NODES_F3 * WFRM_BUFFER ] __attribute__((aligned(0x100))); | |
44 | char wf_cont_f3_light[ (NB_SAMPLES_PER_SNAPSHOT) * NB_BYTES_CWF3_LIGHT_BLK + TIME_OFFSET_IN_BYTES ] __attribute__((aligned(0x100))); |
|
44 | char wf_cont_f3_light[ (NB_SAMPLES_PER_SNAPSHOT) * NB_BYTES_CWF3_LIGHT_BLK + TIME_OFFSET_IN_BYTES ] __attribute__((aligned(0x100))); | |
45 |
|
45 | |||
46 | //*********************************** |
|
46 | //*********************************** | |
47 | // SPECTRAL MATRICES GLOBAL VARIABLES |
|
47 | // SPECTRAL MATRICES GLOBAL VARIABLES | |
48 |
|
48 | |||
49 | // alignment constraints for the spectral matrices buffers => the first data after the time (8 bytes) shall be aligned on 0x00 |
|
49 | // alignment constraints for the spectral matrices buffers => the first data after the time (8 bytes) shall be aligned on 0x00 | |
50 | volatile int sm_f0[ NB_RING_NODES_SM_F0 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100))); |
|
50 | volatile int sm_f0[ NB_RING_NODES_SM_F0 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100))); | |
51 | volatile int sm_f1[ NB_RING_NODES_SM_F1 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100))); |
|
51 | volatile int sm_f1[ NB_RING_NODES_SM_F1 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100))); | |
52 | volatile int sm_f2[ NB_RING_NODES_SM_F2 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100))); |
|
52 | volatile int sm_f2[ NB_RING_NODES_SM_F2 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100))); | |
53 |
|
53 | |||
54 | // APB CONFIGURATION REGISTERS |
|
54 | // APB CONFIGURATION REGISTERS | |
55 | time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT; |
|
55 | time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT; | |
56 | gptimer_regs_t *gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER; |
|
56 | gptimer_regs_t *gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER; | |
57 |
waveform_picker_regs_ |
|
57 | waveform_picker_regs_0_1_18_t *waveform_picker_regs = (waveform_picker_regs_0_1_18_t*) REGS_ADDR_WAVEFORM_PICKER; | |
58 | spectral_matrix_regs_t *spectral_matrix_regs = (spectral_matrix_regs_t*) REGS_ADDR_SPECTRAL_MATRIX; |
|
58 | spectral_matrix_regs_t *spectral_matrix_regs = (spectral_matrix_regs_t*) REGS_ADDR_SPECTRAL_MATRIX; | |
59 |
|
59 | |||
60 | // MODE PARAMETERS |
|
60 | // MODE PARAMETERS | |
61 | Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet; |
|
61 | Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet; | |
62 | struct param_local_str param_local; |
|
62 | struct param_local_str param_local; | |
63 |
|
63 | |||
64 | // HK PACKETS |
|
64 | // HK PACKETS | |
65 | Packet_TM_LFR_HK_t housekeeping_packet; |
|
65 | Packet_TM_LFR_HK_t housekeeping_packet; | |
66 | // sequence counters are incremented by APID (PID + CAT) and destination ID |
|
66 | // sequence counters are incremented by APID (PID + CAT) and destination ID | |
67 | unsigned short sequenceCounters_SCIENCE_NORMAL_BURST; |
|
67 | unsigned short sequenceCounters_SCIENCE_NORMAL_BURST; | |
68 | unsigned short sequenceCounters_SCIENCE_SBM1_SBM2; |
|
68 | unsigned short sequenceCounters_SCIENCE_SBM1_SBM2; | |
69 | unsigned short sequenceCounters_TC_EXE[SEQ_CNT_NB_DEST_ID]; |
|
69 | unsigned short sequenceCounters_TC_EXE[SEQ_CNT_NB_DEST_ID]; | |
70 | unsigned short sequenceCounterHK; |
|
70 | unsigned short sequenceCounterHK; | |
71 | unsigned short sequenceCounterParameterDump; |
|
71 | unsigned short sequenceCounterParameterDump; | |
72 | spw_stats spacewire_stats; |
|
72 | spw_stats spacewire_stats; | |
73 | spw_stats spacewire_stats_backup; |
|
73 | spw_stats spacewire_stats_backup; | |
74 |
|
74 | |||
75 |
|
75 |
@@ -1,696 +1,698 | |||||
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 | #include "fsw_processing_globals.c" |
|
11 | #include "fsw_processing_globals.c" | |
12 |
|
12 | |||
13 | unsigned int nb_sm_f0; |
|
13 | unsigned int nb_sm_f0; | |
14 | unsigned int nb_sm_f0_aux_f1; |
|
14 | unsigned int nb_sm_f0_aux_f1; | |
15 | unsigned int nb_sm_f1; |
|
15 | unsigned int nb_sm_f1; | |
16 | unsigned int nb_sm_f0_aux_f2; |
|
16 | unsigned int nb_sm_f0_aux_f2; | |
17 |
|
17 | |||
18 | //************************ |
|
18 | //************************ | |
19 | // spectral matrices rings |
|
19 | // spectral matrices rings | |
20 | ring_node_sm sm_ring_f0[ NB_RING_NODES_SM_F0 ]; |
|
20 | ring_node_sm sm_ring_f0[ NB_RING_NODES_SM_F0 ]; | |
21 | ring_node_sm sm_ring_f1[ NB_RING_NODES_SM_F1 ]; |
|
21 | ring_node_sm sm_ring_f1[ NB_RING_NODES_SM_F1 ]; | |
22 | ring_node_sm sm_ring_f2[ NB_RING_NODES_SM_F2 ]; |
|
22 | ring_node_sm sm_ring_f2[ NB_RING_NODES_SM_F2 ]; | |
23 | ring_node_sm *current_ring_node_sm_f0; |
|
23 | ring_node_sm *current_ring_node_sm_f0; | |
24 | ring_node_sm *current_ring_node_sm_f1; |
|
24 | ring_node_sm *current_ring_node_sm_f1; | |
25 | ring_node_sm *current_ring_node_sm_f2; |
|
25 | ring_node_sm *current_ring_node_sm_f2; | |
26 | ring_node_sm *ring_node_for_averaging_sm_f0; |
|
26 | ring_node_sm *ring_node_for_averaging_sm_f0; | |
27 | ring_node_sm *ring_node_for_averaging_sm_f1; |
|
27 | ring_node_sm *ring_node_for_averaging_sm_f1; | |
28 | ring_node_sm *ring_node_for_averaging_sm_f2; |
|
28 | ring_node_sm *ring_node_for_averaging_sm_f2; | |
29 |
|
29 | |||
30 | //*********************************************************** |
|
30 | //*********************************************************** | |
31 | // Interrupt Service Routine for spectral matrices processing |
|
31 | // Interrupt Service Routine for spectral matrices processing | |
32 |
|
32 | |||
33 | void spectral_matrices_isr_f0( void ) |
|
33 | void spectral_matrices_isr_f0( void ) | |
34 | { |
|
34 | { | |
35 | unsigned char status; |
|
35 | unsigned char status; | |
36 | unsigned long long int time_0; |
|
36 | unsigned long long int time_0; | |
37 | unsigned long long int time_1; |
|
37 | unsigned long long int time_1; | |
38 | unsigned long long int syncBit0; |
|
38 | unsigned long long int syncBit0; | |
39 | unsigned long long int syncBit1; |
|
39 | unsigned long long int syncBit1; | |
40 |
|
40 | |||
41 | status = spectral_matrix_regs->status & 0x03; // [0011] get the status_ready_matrix_f0_x bits |
|
41 | status = spectral_matrix_regs->status & 0x03; // [0011] get the status_ready_matrix_f0_x bits | |
42 |
|
42 | |||
43 | time_0 = get_acquisition_time( (unsigned char *) &spectral_matrix_regs->f0_0_coarse_time ); |
|
43 | time_0 = get_acquisition_time( (unsigned char *) &spectral_matrix_regs->f0_0_coarse_time ); | |
44 | time_1 = get_acquisition_time( (unsigned char *) &spectral_matrix_regs->f0_1_coarse_time ); |
|
44 | time_1 = get_acquisition_time( (unsigned char *) &spectral_matrix_regs->f0_1_coarse_time ); | |
45 | syncBit0 = ( (unsigned long long int) (spectral_matrix_regs->f0_0_coarse_time & 0x80000000) ) << 16; |
|
45 | syncBit0 = ( (unsigned long long int) (spectral_matrix_regs->f0_0_coarse_time & 0x80000000) ) << 16; | |
46 | syncBit1 = ( (unsigned long long int) (spectral_matrix_regs->f0_1_coarse_time & 0x80000000) ) << 16; |
|
46 | syncBit1 = ( (unsigned long long int) (spectral_matrix_regs->f0_1_coarse_time & 0x80000000) ) << 16; | |
47 |
|
47 | |||
48 | switch(status) |
|
48 | switch(status) | |
49 | { |
|
49 | { | |
50 | case 0: |
|
50 | case 0: | |
51 | break; |
|
51 | break; | |
52 | case 3: |
|
52 | case 3: | |
53 | if ( time_0 < time_1 ) |
|
53 | if ( time_0 < time_1 ) | |
54 | { |
|
54 | { | |
55 | close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], |
|
55 | close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], | |
56 | ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_0 | syncBit0); |
|
56 | ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_0 | syncBit0); | |
57 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; |
|
57 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; | |
58 | spectral_matrix_regs->f0_0_address = current_ring_node_sm_f0->buffer_address; |
|
58 | spectral_matrix_regs->f0_0_address = current_ring_node_sm_f0->buffer_address; | |
59 | close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], |
|
59 | close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], | |
60 | ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_1 | syncBit1); |
|
60 | ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_1 | syncBit1); | |
61 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; |
|
61 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; | |
62 | spectral_matrix_regs->f0_1_address = current_ring_node_sm_f0->buffer_address; |
|
62 | spectral_matrix_regs->f0_1_address = current_ring_node_sm_f0->buffer_address; | |
63 | } |
|
63 | } | |
64 | else |
|
64 | else | |
65 | { |
|
65 | { | |
66 | close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], |
|
66 | close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], | |
67 | ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_1 | syncBit1); |
|
67 | ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_1 | syncBit1); | |
68 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; |
|
68 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; | |
69 | spectral_matrix_regs->f0_1_address = current_ring_node_sm_f0->buffer_address; |
|
69 | spectral_matrix_regs->f0_1_address = current_ring_node_sm_f0->buffer_address; | |
70 | close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], |
|
70 | close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], | |
71 | ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_0 | syncBit0); |
|
71 | ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_0 | syncBit0); | |
72 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; |
|
72 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; | |
73 | spectral_matrix_regs->f0_0_address = current_ring_node_sm_f0->buffer_address; |
|
73 | spectral_matrix_regs->f0_0_address = current_ring_node_sm_f0->buffer_address; | |
74 | } |
|
74 | } | |
75 | spectral_matrix_regs->status = 0x03; // [0011] |
|
75 | spectral_matrix_regs->status = 0x03; // [0011] | |
76 | break; |
|
76 | break; | |
77 | case 1: |
|
77 | case 1: | |
78 | close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], |
|
78 | close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], | |
79 | ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_0 | syncBit0); |
|
79 | ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_0 | syncBit0); | |
80 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; |
|
80 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; | |
81 | spectral_matrix_regs->f0_0_address = current_ring_node_sm_f0->buffer_address; |
|
81 | spectral_matrix_regs->f0_0_address = current_ring_node_sm_f0->buffer_address; | |
82 | spectral_matrix_regs->status = 0x01; // [0001] |
|
82 | spectral_matrix_regs->status = 0x01; // [0001] | |
83 | break; |
|
83 | break; | |
84 | case 2: |
|
84 | case 2: | |
85 | close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], |
|
85 | close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], | |
86 | ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_1 | syncBit1); |
|
86 | ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_1 | syncBit1); | |
87 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; |
|
87 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; | |
88 | spectral_matrix_regs->f0_1_address = current_ring_node_sm_f0->buffer_address; |
|
88 | spectral_matrix_regs->f0_1_address = current_ring_node_sm_f0->buffer_address; | |
89 | spectral_matrix_regs->status = 0x02; // [0010] |
|
89 | spectral_matrix_regs->status = 0x02; // [0010] | |
90 | break; |
|
90 | break; | |
91 | } |
|
91 | } | |
92 | } |
|
92 | } | |
93 |
|
93 | |||
94 | void spectral_matrices_isr_f1( void ) |
|
94 | void spectral_matrices_isr_f1( void ) | |
95 | { |
|
95 | { | |
96 | unsigned char status; |
|
96 | unsigned char status; | |
97 | unsigned long long int time; |
|
97 | unsigned long long int time; | |
98 | unsigned long long int syncBit; |
|
98 | unsigned long long int syncBit; | |
99 | rtems_status_code status_code; |
|
99 | rtems_status_code status_code; | |
100 |
|
100 | |||
101 | status = (spectral_matrix_regs->status & 0x0c) >> 2; // [1100] get the status_ready_matrix_f0_x bits |
|
101 | status = (spectral_matrix_regs->status & 0x0c) >> 2; // [1100] get the status_ready_matrix_f0_x bits | |
102 |
|
102 | |||
103 | switch(status) |
|
103 | switch(status) | |
104 | { |
|
104 | { | |
105 | case 0: |
|
105 | case 0: | |
106 | break; |
|
106 | break; | |
107 | case 3: |
|
107 | case 3: | |
108 | // UNEXPECTED VALUE |
|
108 | // UNEXPECTED VALUE | |
109 | spectral_matrix_regs->status = 0xc0; // [1100] |
|
109 | spectral_matrix_regs->status = 0xc0; // [1100] | |
110 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_11 ); |
|
110 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_11 ); | |
111 | break; |
|
111 | break; | |
112 | case 1: |
|
112 | case 1: | |
113 | time = get_acquisition_time( (unsigned char *) &spectral_matrix_regs->f1_0_coarse_time ); |
|
113 | time = get_acquisition_time( (unsigned char *) &spectral_matrix_regs->f1_0_coarse_time ); | |
114 | syncBit = ( (unsigned long long int) (spectral_matrix_regs->f1_0_coarse_time & 0x80000000) ) << 16; |
|
114 | syncBit = ( (unsigned long long int) (spectral_matrix_regs->f1_0_coarse_time & 0x80000000) ) << 16; | |
115 | close_matrix_actions( &nb_sm_f1, NB_SM_BEFORE_AVF1, Task_id[TASKID_AVF1], |
|
115 | close_matrix_actions( &nb_sm_f1, NB_SM_BEFORE_AVF1, Task_id[TASKID_AVF1], | |
116 | ring_node_for_averaging_sm_f1, current_ring_node_sm_f1, time | syncBit); |
|
116 | ring_node_for_averaging_sm_f1, current_ring_node_sm_f1, time | syncBit); | |
117 | current_ring_node_sm_f1 = current_ring_node_sm_f1->next; |
|
117 | current_ring_node_sm_f1 = current_ring_node_sm_f1->next; | |
118 | spectral_matrix_regs->f1_0_address = current_ring_node_sm_f1->buffer_address; |
|
118 | spectral_matrix_regs->f1_0_address = current_ring_node_sm_f1->buffer_address; | |
119 | spectral_matrix_regs->status = 0x04; // [0100] |
|
119 | spectral_matrix_regs->status = 0x04; // [0100] | |
120 | break; |
|
120 | break; | |
121 | case 2: |
|
121 | case 2: | |
122 | time = get_acquisition_time( (unsigned char *) &spectral_matrix_regs->f1_1_coarse_time ); |
|
122 | time = get_acquisition_time( (unsigned char *) &spectral_matrix_regs->f1_1_coarse_time ); | |
123 | syncBit = ( (unsigned long long int) (spectral_matrix_regs->f1_1_coarse_time & 0x80000000) ) << 16; |
|
123 | syncBit = ( (unsigned long long int) (spectral_matrix_regs->f1_1_coarse_time & 0x80000000) ) << 16; | |
124 | close_matrix_actions( &nb_sm_f1, NB_SM_BEFORE_AVF1, Task_id[TASKID_AVF1], |
|
124 | close_matrix_actions( &nb_sm_f1, NB_SM_BEFORE_AVF1, Task_id[TASKID_AVF1], | |
125 | ring_node_for_averaging_sm_f1, current_ring_node_sm_f1, time | syncBit); |
|
125 | ring_node_for_averaging_sm_f1, current_ring_node_sm_f1, time | syncBit); | |
126 | current_ring_node_sm_f1 = current_ring_node_sm_f1->next; |
|
126 | current_ring_node_sm_f1 = current_ring_node_sm_f1->next; | |
127 | spectral_matrix_regs->f1_1_address = current_ring_node_sm_f1->buffer_address; |
|
127 | spectral_matrix_regs->f1_1_address = current_ring_node_sm_f1->buffer_address; | |
128 | spectral_matrix_regs->status = 0x08; // [1000] |
|
128 | spectral_matrix_regs->status = 0x08; // [1000] | |
129 | break; |
|
129 | break; | |
130 | } |
|
130 | } | |
131 | } |
|
131 | } | |
132 |
|
132 | |||
133 | void spectral_matrices_isr_f2( void ) |
|
133 | void spectral_matrices_isr_f2( void ) | |
134 | { |
|
134 | { | |
135 | unsigned char status; |
|
135 | unsigned char status; | |
136 | rtems_status_code status_code; |
|
136 | rtems_status_code status_code; | |
137 |
|
137 | |||
138 | status = (spectral_matrix_regs->status & 0x30) >> 4; // [0011 0000] get the status_ready_matrix_f0_x bits |
|
138 | status = (spectral_matrix_regs->status & 0x30) >> 4; // [0011 0000] get the status_ready_matrix_f0_x bits | |
139 |
|
139 | |||
140 | ring_node_for_averaging_sm_f2 = current_ring_node_sm_f2; |
|
140 | ring_node_for_averaging_sm_f2 = current_ring_node_sm_f2; | |
141 |
|
141 | |||
142 | current_ring_node_sm_f2 = current_ring_node_sm_f2->next; |
|
142 | current_ring_node_sm_f2 = current_ring_node_sm_f2->next; | |
143 |
|
143 | |||
144 | switch(status) |
|
144 | switch(status) | |
145 | { |
|
145 | { | |
146 | case 0: |
|
146 | case 0: | |
147 | break; |
|
147 | break; | |
148 | case 3: |
|
148 | case 3: | |
149 | // UNEXPECTED VALUE |
|
149 | // UNEXPECTED VALUE | |
150 | spectral_matrix_regs->status = 0x30; // [0011 0000] |
|
150 | spectral_matrix_regs->status = 0x30; // [0011 0000] | |
151 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_11 ); |
|
151 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_11 ); | |
152 | break; |
|
152 | break; | |
153 | case 1: |
|
153 | case 1: | |
154 | ring_node_for_averaging_sm_f2->coarseTime = spectral_matrix_regs->f2_0_coarse_time; |
|
154 | ring_node_for_averaging_sm_f2->coarseTime = spectral_matrix_regs->f2_0_coarse_time; | |
155 | ring_node_for_averaging_sm_f2->fineTime = spectral_matrix_regs->f2_0_fine_time; |
|
155 | ring_node_for_averaging_sm_f2->fineTime = spectral_matrix_regs->f2_0_fine_time; | |
156 | spectral_matrix_regs->f2_0_address = current_ring_node_sm_f2->buffer_address; |
|
156 | spectral_matrix_regs->f2_0_address = current_ring_node_sm_f2->buffer_address; | |
157 | spectral_matrix_regs->status = 0x10; // [0001 0000] |
|
157 | spectral_matrix_regs->status = 0x10; // [0001 0000] | |
158 | if (rtems_event_send( Task_id[TASKID_AVF2], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
158 | if (rtems_event_send( Task_id[TASKID_AVF2], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |
159 | { |
|
159 | { | |
160 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
160 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |
161 | } |
|
161 | } | |
162 | break; |
|
162 | break; | |
163 | case 2: |
|
163 | case 2: | |
164 | ring_node_for_averaging_sm_f2->coarseTime = spectral_matrix_regs->f2_1_coarse_time; |
|
164 | ring_node_for_averaging_sm_f2->coarseTime = spectral_matrix_regs->f2_1_coarse_time; | |
165 | ring_node_for_averaging_sm_f2->fineTime = spectral_matrix_regs->f2_1_fine_time; |
|
165 | ring_node_for_averaging_sm_f2->fineTime = spectral_matrix_regs->f2_1_fine_time; | |
166 | spectral_matrix_regs->f2_1_address = current_ring_node_sm_f2->buffer_address; |
|
166 | spectral_matrix_regs->f2_1_address = current_ring_node_sm_f2->buffer_address; | |
167 | spectral_matrix_regs->status = 0x20; // [0010 0000] |
|
167 | spectral_matrix_regs->status = 0x20; // [0010 0000] | |
168 | if (rtems_event_send( Task_id[TASKID_AVF2], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
168 | if (rtems_event_send( Task_id[TASKID_AVF2], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |
169 | { |
|
169 | { | |
170 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
170 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |
171 | } |
|
171 | } | |
172 | break; |
|
172 | break; | |
173 | } |
|
173 | } | |
174 | } |
|
174 | } | |
175 |
|
175 | |||
176 | void spectral_matrix_isr_error_handler( void ) |
|
176 | void spectral_matrix_isr_error_handler( void ) | |
177 | { |
|
177 | { | |
178 | rtems_status_code status_code; |
|
178 | rtems_status_code status_code; | |
179 |
|
179 | |||
180 | if (spectral_matrix_regs->status & 0x7c0) // [0111 1100 0000] |
|
180 | if (spectral_matrix_regs->status & 0x7c0) // [0111 1100 0000] | |
181 | { |
|
181 | { | |
182 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); |
|
182 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); | |
183 | } |
|
183 | } | |
184 | } |
|
184 | } | |
185 |
|
185 | |||
186 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ) |
|
186 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ) | |
187 | { |
|
187 | { | |
188 | // STATUS REGISTER |
|
188 | // STATUS REGISTER | |
189 | // input_fifo_write(2) *** input_fifo_write(1) *** input_fifo_write(0) |
|
189 | // input_fifo_write(2) *** input_fifo_write(1) *** input_fifo_write(0) | |
190 | // 10 9 8 |
|
190 | // 10 9 8 | |
191 | // buffer_full ** bad_component_err ** f2_1 ** f2_0 ** f1_1 ** f1_0 ** f0_1 ** f0_0 |
|
191 | // buffer_full ** bad_component_err ** f2_1 ** f2_0 ** f1_1 ** f1_0 ** f0_1 ** f0_0 | |
192 | // 7 6 5 4 3 2 1 0 |
|
192 | // 7 6 5 4 3 2 1 0 | |
193 |
|
193 | |||
194 | spectral_matrices_isr_f0(); |
|
194 | spectral_matrices_isr_f0(); | |
195 |
|
195 | |||
196 | spectral_matrices_isr_f1(); |
|
196 | spectral_matrices_isr_f1(); | |
197 |
|
197 | |||
198 | spectral_matrices_isr_f2(); |
|
198 | spectral_matrices_isr_f2(); | |
199 |
|
199 | |||
200 | // spectral_matrix_isr_error_handler(); |
|
200 | // spectral_matrix_isr_error_handler(); | |
201 | } |
|
201 | } | |
202 |
|
202 | |||
203 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ) |
|
203 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ) | |
204 | { |
|
204 | { | |
205 | rtems_status_code status_code; |
|
205 | rtems_status_code status_code; | |
206 |
|
206 | |||
207 | //*** |
|
207 | //*** | |
208 | // F0 |
|
208 | // F0 | |
209 | nb_sm_f0 = nb_sm_f0 + 1; |
|
209 | nb_sm_f0 = nb_sm_f0 + 1; | |
210 | if (nb_sm_f0 == NB_SM_BEFORE_AVF0 ) |
|
210 | if (nb_sm_f0 == NB_SM_BEFORE_AVF0 ) | |
211 | { |
|
211 | { | |
212 | ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0; |
|
212 | ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0; | |
213 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
213 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |
214 | { |
|
214 | { | |
215 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
215 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |
216 | } |
|
216 | } | |
217 | nb_sm_f0 = 0; |
|
217 | nb_sm_f0 = 0; | |
218 | } |
|
218 | } | |
219 |
|
219 | |||
220 | //*** |
|
220 | //*** | |
221 | // F1 |
|
221 | // F1 | |
222 | nb_sm_f0_aux_f1 = nb_sm_f0_aux_f1 + 1; |
|
222 | nb_sm_f0_aux_f1 = nb_sm_f0_aux_f1 + 1; | |
223 | if (nb_sm_f0_aux_f1 == 6) |
|
223 | if (nb_sm_f0_aux_f1 == 6) | |
224 | { |
|
224 | { | |
225 | nb_sm_f0_aux_f1 = 0; |
|
225 | nb_sm_f0_aux_f1 = 0; | |
226 | nb_sm_f1 = nb_sm_f1 + 1; |
|
226 | nb_sm_f1 = nb_sm_f1 + 1; | |
227 | } |
|
227 | } | |
228 | if (nb_sm_f1 == NB_SM_BEFORE_AVF1 ) |
|
228 | if (nb_sm_f1 == NB_SM_BEFORE_AVF1 ) | |
229 | { |
|
229 | { | |
230 | ring_node_for_averaging_sm_f1 = current_ring_node_sm_f1; |
|
230 | ring_node_for_averaging_sm_f1 = current_ring_node_sm_f1; | |
231 | if (rtems_event_send( Task_id[TASKID_AVF1], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
231 | if (rtems_event_send( Task_id[TASKID_AVF1], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |
232 | { |
|
232 | { | |
233 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
233 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |
234 | } |
|
234 | } | |
235 | nb_sm_f1 = 0; |
|
235 | nb_sm_f1 = 0; | |
236 | } |
|
236 | } | |
237 |
|
237 | |||
238 | //*** |
|
238 | //*** | |
239 | // F2 |
|
239 | // F2 | |
240 | nb_sm_f0_aux_f2 = nb_sm_f0_aux_f2 + 1; |
|
240 | nb_sm_f0_aux_f2 = nb_sm_f0_aux_f2 + 1; | |
241 | if (nb_sm_f0_aux_f2 == 96) |
|
241 | if (nb_sm_f0_aux_f2 == 96) | |
242 | { |
|
242 | { | |
243 | nb_sm_f0_aux_f2 = 0; |
|
243 | nb_sm_f0_aux_f2 = 0; | |
244 | ring_node_for_averaging_sm_f2 = current_ring_node_sm_f2; |
|
244 | ring_node_for_averaging_sm_f2 = current_ring_node_sm_f2; | |
245 | if (rtems_event_send( Task_id[TASKID_AVF2], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
245 | if (rtems_event_send( Task_id[TASKID_AVF2], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |
246 | { |
|
246 | { | |
247 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
247 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |
248 | } |
|
248 | } | |
249 | } |
|
249 | } | |
250 | } |
|
250 | } | |
251 |
|
251 | |||
252 | //****************** |
|
252 | //****************** | |
253 | // Spectral Matrices |
|
253 | // Spectral Matrices | |
254 |
|
254 | |||
255 | void reset_nb_sm( void ) |
|
255 | void reset_nb_sm( void ) | |
256 | { |
|
256 | { | |
257 | nb_sm_f0 = 0; |
|
257 | nb_sm_f0 = 0; | |
258 | nb_sm_f0_aux_f1 = 0; |
|
258 | nb_sm_f0_aux_f1 = 0; | |
259 | nb_sm_f0_aux_f2 = 0; |
|
259 | nb_sm_f0_aux_f2 = 0; | |
260 |
|
260 | |||
261 | nb_sm_f1 = 0; |
|
261 | nb_sm_f1 = 0; | |
262 | } |
|
262 | } | |
263 |
|
263 | |||
264 | void SM_init_rings( void ) |
|
264 | void SM_init_rings( void ) | |
265 | { |
|
265 | { | |
266 | unsigned char i; |
|
266 | unsigned char i; | |
267 |
|
267 | |||
268 | // F0 RING |
|
268 | // F0 RING | |
269 | sm_ring_f0[0].next = (ring_node_sm*) &sm_ring_f0[1]; |
|
269 | sm_ring_f0[0].next = (ring_node_sm*) &sm_ring_f0[1]; | |
270 | sm_ring_f0[0].previous = (ring_node_sm*) &sm_ring_f0[NB_RING_NODES_SM_F0-1]; |
|
270 | sm_ring_f0[0].previous = (ring_node_sm*) &sm_ring_f0[NB_RING_NODES_SM_F0-1]; | |
271 | sm_ring_f0[0].buffer_address = |
|
271 | sm_ring_f0[0].buffer_address = | |
272 | (int) &sm_f0[ 0 ]; |
|
272 | (int) &sm_f0[ 0 ]; | |
273 |
|
273 | |||
274 | sm_ring_f0[NB_RING_NODES_SM_F0-1].next = (ring_node_sm*) &sm_ring_f0[0]; |
|
274 | sm_ring_f0[NB_RING_NODES_SM_F0-1].next = (ring_node_sm*) &sm_ring_f0[0]; | |
275 | sm_ring_f0[NB_RING_NODES_SM_F0-1].previous = (ring_node_sm*) &sm_ring_f0[NB_RING_NODES_SM_F0-2]; |
|
275 | sm_ring_f0[NB_RING_NODES_SM_F0-1].previous = (ring_node_sm*) &sm_ring_f0[NB_RING_NODES_SM_F0-2]; | |
276 | sm_ring_f0[NB_RING_NODES_SM_F0-1].buffer_address = |
|
276 | sm_ring_f0[NB_RING_NODES_SM_F0-1].buffer_address = | |
277 | (int) &sm_f0[ (NB_RING_NODES_SM_F0-1) * TOTAL_SIZE_SM ]; |
|
277 | (int) &sm_f0[ (NB_RING_NODES_SM_F0-1) * TOTAL_SIZE_SM ]; | |
278 |
|
278 | |||
279 | for(i=1; i<NB_RING_NODES_SM_F0-1; i++) |
|
279 | for(i=1; i<NB_RING_NODES_SM_F0-1; i++) | |
280 | { |
|
280 | { | |
281 | sm_ring_f0[i].next = (ring_node_sm*) &sm_ring_f0[i+1]; |
|
281 | sm_ring_f0[i].next = (ring_node_sm*) &sm_ring_f0[i+1]; | |
282 | sm_ring_f0[i].previous = (ring_node_sm*) &sm_ring_f0[i-1]; |
|
282 | sm_ring_f0[i].previous = (ring_node_sm*) &sm_ring_f0[i-1]; | |
283 | sm_ring_f0[i].buffer_address = |
|
283 | sm_ring_f0[i].buffer_address = | |
284 | (int) &sm_f0[ i * TOTAL_SIZE_SM ]; |
|
284 | (int) &sm_f0[ i * TOTAL_SIZE_SM ]; | |
285 | } |
|
285 | } | |
286 |
|
286 | |||
287 | // F1 RING |
|
287 | // F1 RING | |
288 | sm_ring_f1[0].next = (ring_node_sm*) &sm_ring_f1[1]; |
|
288 | sm_ring_f1[0].next = (ring_node_sm*) &sm_ring_f1[1]; | |
289 | sm_ring_f1[0].previous = (ring_node_sm*) &sm_ring_f1[NB_RING_NODES_SM_F1-1]; |
|
289 | sm_ring_f1[0].previous = (ring_node_sm*) &sm_ring_f1[NB_RING_NODES_SM_F1-1]; | |
290 | sm_ring_f1[0].buffer_address = |
|
290 | sm_ring_f1[0].buffer_address = | |
291 | (int) &sm_f1[ 0 ]; |
|
291 | (int) &sm_f1[ 0 ]; | |
292 |
|
292 | |||
293 | sm_ring_f1[NB_RING_NODES_SM_F1-1].next = (ring_node_sm*) &sm_ring_f1[0]; |
|
293 | sm_ring_f1[NB_RING_NODES_SM_F1-1].next = (ring_node_sm*) &sm_ring_f1[0]; | |
294 | sm_ring_f1[NB_RING_NODES_SM_F1-1].previous = (ring_node_sm*) &sm_ring_f1[NB_RING_NODES_SM_F1-2]; |
|
294 | sm_ring_f1[NB_RING_NODES_SM_F1-1].previous = (ring_node_sm*) &sm_ring_f1[NB_RING_NODES_SM_F1-2]; | |
295 | sm_ring_f1[NB_RING_NODES_SM_F1-1].buffer_address = |
|
295 | sm_ring_f1[NB_RING_NODES_SM_F1-1].buffer_address = | |
296 | (int) &sm_f1[ (NB_RING_NODES_SM_F1-1) * TOTAL_SIZE_SM ]; |
|
296 | (int) &sm_f1[ (NB_RING_NODES_SM_F1-1) * TOTAL_SIZE_SM ]; | |
297 |
|
297 | |||
298 | for(i=1; i<NB_RING_NODES_SM_F1-1; i++) |
|
298 | for(i=1; i<NB_RING_NODES_SM_F1-1; i++) | |
299 | { |
|
299 | { | |
300 | sm_ring_f1[i].next = (ring_node_sm*) &sm_ring_f1[i+1]; |
|
300 | sm_ring_f1[i].next = (ring_node_sm*) &sm_ring_f1[i+1]; | |
301 | sm_ring_f1[i].previous = (ring_node_sm*) &sm_ring_f1[i-1]; |
|
301 | sm_ring_f1[i].previous = (ring_node_sm*) &sm_ring_f1[i-1]; | |
302 | sm_ring_f1[i].buffer_address = |
|
302 | sm_ring_f1[i].buffer_address = | |
303 | (int) &sm_f1[ i * TOTAL_SIZE_SM ]; |
|
303 | (int) &sm_f1[ i * TOTAL_SIZE_SM ]; | |
304 | } |
|
304 | } | |
305 |
|
305 | |||
306 | // F2 RING |
|
306 | // F2 RING | |
307 | sm_ring_f2[0].next = (ring_node_sm*) &sm_ring_f2[1]; |
|
307 | sm_ring_f2[0].next = (ring_node_sm*) &sm_ring_f2[1]; | |
308 | sm_ring_f2[0].previous = (ring_node_sm*) &sm_ring_f2[NB_RING_NODES_SM_F2-1]; |
|
308 | sm_ring_f2[0].previous = (ring_node_sm*) &sm_ring_f2[NB_RING_NODES_SM_F2-1]; | |
309 | sm_ring_f2[0].buffer_address = |
|
309 | sm_ring_f2[0].buffer_address = | |
310 | (int) &sm_f2[ 0 ]; |
|
310 | (int) &sm_f2[ 0 ]; | |
311 |
|
311 | |||
312 | sm_ring_f2[NB_RING_NODES_SM_F2-1].next = (ring_node_sm*) &sm_ring_f2[0]; |
|
312 | sm_ring_f2[NB_RING_NODES_SM_F2-1].next = (ring_node_sm*) &sm_ring_f2[0]; | |
313 | sm_ring_f2[NB_RING_NODES_SM_F2-1].previous = (ring_node_sm*) &sm_ring_f2[NB_RING_NODES_SM_F2-2]; |
|
313 | sm_ring_f2[NB_RING_NODES_SM_F2-1].previous = (ring_node_sm*) &sm_ring_f2[NB_RING_NODES_SM_F2-2]; | |
314 | sm_ring_f2[NB_RING_NODES_SM_F2-1].buffer_address = |
|
314 | sm_ring_f2[NB_RING_NODES_SM_F2-1].buffer_address = | |
315 | (int) &sm_f2[ (NB_RING_NODES_SM_F2-1) * TOTAL_SIZE_SM ]; |
|
315 | (int) &sm_f2[ (NB_RING_NODES_SM_F2-1) * TOTAL_SIZE_SM ]; | |
316 |
|
316 | |||
317 | for(i=1; i<NB_RING_NODES_SM_F2-1; i++) |
|
317 | for(i=1; i<NB_RING_NODES_SM_F2-1; i++) | |
318 | { |
|
318 | { | |
319 | sm_ring_f2[i].next = (ring_node_sm*) &sm_ring_f2[i+1]; |
|
319 | sm_ring_f2[i].next = (ring_node_sm*) &sm_ring_f2[i+1]; | |
320 | sm_ring_f2[i].previous = (ring_node_sm*) &sm_ring_f2[i-1]; |
|
320 | sm_ring_f2[i].previous = (ring_node_sm*) &sm_ring_f2[i-1]; | |
321 | sm_ring_f2[i].buffer_address = |
|
321 | sm_ring_f2[i].buffer_address = | |
322 | (int) &sm_f2[ i * TOTAL_SIZE_SM ]; |
|
322 | (int) &sm_f2[ i * TOTAL_SIZE_SM ]; | |
323 | } |
|
323 | } | |
324 |
|
324 | |||
325 | DEBUG_PRINTF1("asm_ring_f0 @%x\n", (unsigned int) sm_ring_f0) |
|
325 | DEBUG_PRINTF1("asm_ring_f0 @%x\n", (unsigned int) sm_ring_f0) | |
326 | DEBUG_PRINTF1("asm_ring_f1 @%x\n", (unsigned int) sm_ring_f1) |
|
326 | DEBUG_PRINTF1("asm_ring_f1 @%x\n", (unsigned int) sm_ring_f1) | |
327 | DEBUG_PRINTF1("asm_ring_f2 @%x\n", (unsigned int) sm_ring_f2) |
|
327 | DEBUG_PRINTF1("asm_ring_f2 @%x\n", (unsigned int) sm_ring_f2) | |
328 |
|
328 | |||
329 | spectral_matrix_regs->f0_0_address = sm_ring_f0[0].buffer_address; |
|
329 | spectral_matrix_regs->f0_0_address = sm_ring_f0[0].buffer_address; | |
330 | DEBUG_PRINTF1("spectral_matrix_regs->matrixF0_Address0 @%x\n", spectral_matrix_regs->f0_0_address) |
|
330 | DEBUG_PRINTF1("spectral_matrix_regs->matrixF0_Address0 @%x\n", spectral_matrix_regs->f0_0_address) | |
331 | } |
|
331 | } | |
332 |
|
332 | |||
333 | void SM_generic_init_ring( ring_node_sm *ring, unsigned char nbNodes, volatile int sm_f[] ) |
|
333 | void SM_generic_init_ring( ring_node_sm *ring, unsigned char nbNodes, volatile int sm_f[] ) | |
334 | { |
|
334 | { | |
335 | unsigned char i; |
|
335 | unsigned char i; | |
336 |
|
336 | |||
337 | //*************** |
|
337 | //*************** | |
338 | // BUFFER ADDRESS |
|
338 | // BUFFER ADDRESS | |
339 | for(i=0; i<nbNodes; i++) |
|
339 | for(i=0; i<nbNodes; i++) | |
340 | { |
|
340 | { | |
341 | ring[ i ].buffer_address = (int) &sm_f[ i * TOTAL_SIZE_SM ]; |
|
341 | ring[ i ].buffer_address = (int) &sm_f[ i * TOTAL_SIZE_SM ]; | |
342 | } |
|
342 | } | |
343 |
|
343 | |||
344 | //***** |
|
344 | //***** | |
345 | // NEXT |
|
345 | // NEXT | |
346 | ring[ nbNodes - 1 ].next = (ring_node_sm*) &ring[ 0 ]; |
|
346 | ring[ nbNodes - 1 ].next = (ring_node_sm*) &ring[ 0 ]; | |
347 | for(i=0; i<nbNodes-1; i++) |
|
347 | for(i=0; i<nbNodes-1; i++) | |
348 | { |
|
348 | { | |
349 | ring[ i ].next = (ring_node_sm*) &ring[ i + 1 ]; |
|
349 | ring[ i ].next = (ring_node_sm*) &ring[ i + 1 ]; | |
350 | } |
|
350 | } | |
351 |
|
351 | |||
352 | //********* |
|
352 | //********* | |
353 | // PREVIOUS |
|
353 | // PREVIOUS | |
354 | ring[ 0 ].previous = (ring_node_sm*) &ring[ nbNodes -1 ]; |
|
354 | ring[ 0 ].previous = (ring_node_sm*) &ring[ nbNodes -1 ]; | |
355 | for(i=1; i<nbNodes; i++) |
|
355 | for(i=1; i<nbNodes; i++) | |
356 | { |
|
356 | { | |
357 | ring[ i ].previous = (ring_node_sm*) &ring[ i - 1 ]; |
|
357 | ring[ i ].previous = (ring_node_sm*) &ring[ i - 1 ]; | |
358 | } |
|
358 | } | |
359 | } |
|
359 | } | |
360 |
|
360 | |||
361 | void ASM_generic_init_ring( ring_node_asm *ring, unsigned char nbNodes ) |
|
361 | void ASM_generic_init_ring( ring_node_asm *ring, unsigned char nbNodes ) | |
362 | { |
|
362 | { | |
363 | unsigned char i; |
|
363 | unsigned char i; | |
364 |
|
364 | |||
365 | ring[ nbNodes - 1 ].next |
|
365 | ring[ nbNodes - 1 ].next | |
366 | = (ring_node_asm*) &ring[ 0 ]; |
|
366 | = (ring_node_asm*) &ring[ 0 ]; | |
367 |
|
367 | |||
368 | for(i=0; i<nbNodes-1; i++) |
|
368 | for(i=0; i<nbNodes-1; i++) | |
369 | { |
|
369 | { | |
370 | ring[ i ].next = (ring_node_asm*) &ring[ i + 1 ]; |
|
370 | ring[ i ].next = (ring_node_asm*) &ring[ i + 1 ]; | |
371 | } |
|
371 | } | |
372 | } |
|
372 | } | |
373 |
|
373 | |||
374 | void SM_reset_current_ring_nodes( void ) |
|
374 | void SM_reset_current_ring_nodes( void ) | |
375 | { |
|
375 | { | |
376 | current_ring_node_sm_f0 = sm_ring_f0[0].next; |
|
376 | current_ring_node_sm_f0 = sm_ring_f0[0].next; | |
377 | current_ring_node_sm_f1 = sm_ring_f1[0].next; |
|
377 | current_ring_node_sm_f1 = sm_ring_f1[0].next; | |
378 | current_ring_node_sm_f2 = sm_ring_f2[0].next; |
|
378 | current_ring_node_sm_f2 = sm_ring_f2[0].next; | |
379 |
|
379 | |||
380 | ring_node_for_averaging_sm_f0 = sm_ring_f0; |
|
380 | ring_node_for_averaging_sm_f0 = sm_ring_f0; | |
381 | ring_node_for_averaging_sm_f1 = sm_ring_f1; |
|
381 | ring_node_for_averaging_sm_f1 = sm_ring_f1; | |
382 | ring_node_for_averaging_sm_f2 = sm_ring_f2; |
|
382 | ring_node_for_averaging_sm_f2 = sm_ring_f2; | |
383 | } |
|
383 | } | |
384 |
|
384 | |||
385 | void ASM_init_header( Header_TM_LFR_SCIENCE_ASM_t *header) |
|
385 | void ASM_init_header( Header_TM_LFR_SCIENCE_ASM_t *header) | |
386 | { |
|
386 | { | |
387 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
387 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; | |
388 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
388 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
389 | header->reserved = 0x00; |
|
389 | header->reserved = 0x00; | |
390 | header->userApplication = CCSDS_USER_APP; |
|
390 | header->userApplication = CCSDS_USER_APP; | |
391 | header->packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8); |
|
391 | header->packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8); | |
392 | header->packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST); |
|
392 | header->packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST); | |
393 | header->packetSequenceControl[0] = 0xc0; |
|
393 | header->packetSequenceControl[0] = 0xc0; | |
394 | header->packetSequenceControl[1] = 0x00; |
|
394 | header->packetSequenceControl[1] = 0x00; | |
395 | header->packetLength[0] = 0x00; |
|
395 | header->packetLength[0] = 0x00; | |
396 | header->packetLength[1] = 0x00; |
|
396 | header->packetLength[1] = 0x00; | |
397 | // DATA FIELD HEADER |
|
397 | // DATA FIELD HEADER | |
398 | header->spare1_pusVersion_spare2 = 0x10; |
|
398 | header->spare1_pusVersion_spare2 = 0x10; | |
399 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
399 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
400 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
400 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
401 | header->destinationID = TM_DESTINATION_ID_GROUND; |
|
401 | header->destinationID = TM_DESTINATION_ID_GROUND; | |
402 | // AUXILIARY DATA HEADER |
|
402 | // AUXILIARY DATA HEADER | |
403 | header->sid = 0x00; |
|
403 | header->sid = 0x00; | |
404 | header->biaStatusInfo = 0x00; |
|
404 | header->biaStatusInfo = 0x00; | |
405 | header->pa_lfr_pkt_cnt_asm = 0x00; |
|
405 | header->pa_lfr_pkt_cnt_asm = 0x00; | |
406 | header->pa_lfr_pkt_nr_asm = 0x00; |
|
406 | header->pa_lfr_pkt_nr_asm = 0x00; | |
407 | header->time[0] = 0x00; |
|
407 | header->time[0] = 0x00; | |
408 | header->time[0] = 0x00; |
|
408 | header->time[0] = 0x00; | |
409 | header->time[0] = 0x00; |
|
409 | header->time[0] = 0x00; | |
410 | header->time[0] = 0x00; |
|
410 | header->time[0] = 0x00; | |
411 | header->time[0] = 0x00; |
|
411 | header->time[0] = 0x00; | |
412 | header->time[0] = 0x00; |
|
412 | header->time[0] = 0x00; | |
413 | header->pa_lfr_asm_blk_nr[0] = 0x00; // BLK_NR MSB |
|
413 | header->pa_lfr_asm_blk_nr[0] = 0x00; // BLK_NR MSB | |
414 | header->pa_lfr_asm_blk_nr[1] = 0x00; // BLK_NR LSB |
|
414 | header->pa_lfr_asm_blk_nr[1] = 0x00; // BLK_NR LSB | |
415 | } |
|
415 | } | |
416 |
|
416 | |||
417 | void ASM_send(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, |
|
417 | void ASM_send(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, | |
418 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id) |
|
418 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id) | |
419 | { |
|
419 | { | |
420 | unsigned int i; |
|
420 | unsigned int i; | |
421 | unsigned int length = 0; |
|
421 | unsigned int length = 0; | |
422 | rtems_status_code status; |
|
422 | rtems_status_code status; | |
423 |
|
423 | |||
424 | for (i=0; i<2; i++) |
|
424 | for (i=0; i<2; i++) | |
425 | { |
|
425 | { | |
426 | // (1) BUILD THE DATA |
|
426 | // (1) BUILD THE DATA | |
427 | switch(sid) |
|
427 | switch(sid) | |
428 | { |
|
428 | { | |
429 | case SID_NORM_ASM_F0: |
|
429 | case SID_NORM_ASM_F0: | |
430 | spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F0_IN_BYTES / 2; // 2 packets will be sent |
|
430 | spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F0_IN_BYTES / 2; // 2 packets will be sent | |
431 | spw_ioctl_send->data = &spectral_matrix[ |
|
431 | spw_ioctl_send->data = &spectral_matrix[ | |
432 | ( (ASM_F0_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F0) ) * NB_VALUES_PER_SM ) * 2 |
|
432 | ( (ASM_F0_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F0) ) * NB_VALUES_PER_SM ) * 2 | |
433 | ]; |
|
433 | ]; | |
434 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0; |
|
434 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0; | |
435 | header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F0) >> 8 ); // BLK_NR MSB |
|
435 | header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F0) >> 8 ); // BLK_NR MSB | |
436 | header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F0); // BLK_NR LSB |
|
436 | header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F0); // BLK_NR LSB | |
437 | break; |
|
437 | break; | |
438 | case SID_NORM_ASM_F1: |
|
438 | case SID_NORM_ASM_F1: | |
439 | spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F1_IN_BYTES / 2; // 2 packets will be sent |
|
439 | spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F1_IN_BYTES / 2; // 2 packets will be sent | |
440 | spw_ioctl_send->data = &spectral_matrix[ |
|
440 | spw_ioctl_send->data = &spectral_matrix[ | |
441 | ( (ASM_F1_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F1) ) * NB_VALUES_PER_SM ) * 2 |
|
441 | ( (ASM_F1_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F1) ) * NB_VALUES_PER_SM ) * 2 | |
442 | ]; |
|
442 | ]; | |
443 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F1; |
|
443 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F1; | |
444 | header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F1) >> 8 ); // BLK_NR MSB |
|
444 | header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F1) >> 8 ); // BLK_NR MSB | |
445 | header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F1); // BLK_NR LSB |
|
445 | header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F1); // BLK_NR LSB | |
446 | break; |
|
446 | break; | |
447 | case SID_NORM_ASM_F2: |
|
447 | case SID_NORM_ASM_F2: | |
448 | spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F2_IN_BYTES / 2; // 2 packets will be sent |
|
448 | spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F2_IN_BYTES / 2; // 2 packets will be sent | |
449 | spw_ioctl_send->data = &spectral_matrix[ |
|
449 | spw_ioctl_send->data = &spectral_matrix[ | |
450 | ( (ASM_F2_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F2) ) * NB_VALUES_PER_SM ) * 2 |
|
450 | ( (ASM_F2_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F2) ) * NB_VALUES_PER_SM ) * 2 | |
451 | ]; |
|
451 | ]; | |
452 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F2; |
|
452 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F2; | |
453 | header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F2) >> 8 ); // BLK_NR MSB |
|
453 | header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F2) >> 8 ); // BLK_NR MSB | |
454 | header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F2); // BLK_NR LSB |
|
454 | header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F2); // BLK_NR LSB | |
455 | break; |
|
455 | break; | |
456 | default: |
|
456 | default: | |
457 | PRINTF1("ERR *** in ASM_send *** unexpected sid %d\n", sid) |
|
457 | PRINTF1("ERR *** in ASM_send *** unexpected sid %d\n", sid) | |
458 | break; |
|
458 | break; | |
459 | } |
|
459 | } | |
460 | spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
460 | spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES; | |
461 | spw_ioctl_send->hdr = (char *) header; |
|
461 | spw_ioctl_send->hdr = (char *) header; | |
462 | spw_ioctl_send->options = 0; |
|
462 | spw_ioctl_send->options = 0; | |
463 |
|
463 | |||
464 | // (2) BUILD THE HEADER |
|
464 | // (2) BUILD THE HEADER | |
465 | increment_seq_counter_source_id( header->packetSequenceControl, sid ); |
|
465 | increment_seq_counter_source_id( header->packetSequenceControl, sid ); | |
466 | header->packetLength[0] = (unsigned char) (length>>8); |
|
466 | header->packetLength[0] = (unsigned char) (length>>8); | |
467 | header->packetLength[1] = (unsigned char) (length); |
|
467 | header->packetLength[1] = (unsigned char) (length); | |
468 | header->sid = (unsigned char) sid; // SID |
|
468 | header->sid = (unsigned char) sid; // SID | |
469 | header->pa_lfr_pkt_cnt_asm = 2; |
|
469 | header->pa_lfr_pkt_cnt_asm = 2; | |
470 | header->pa_lfr_pkt_nr_asm = (unsigned char) (i+1); |
|
470 | header->pa_lfr_pkt_nr_asm = (unsigned char) (i+1); | |
471 |
|
471 | |||
472 | // (3) SET PACKET TIME |
|
472 | // (3) SET PACKET TIME | |
473 | header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
473 | header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
474 | header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
474 | header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
475 | header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
475 | header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
476 | header->time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
476 | header->time[3] = (unsigned char) (time_management_regs->coarse_time); | |
477 | header->time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
477 | header->time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
478 | header->time[5] = (unsigned char) (time_management_regs->fine_time); |
|
478 | header->time[5] = (unsigned char) (time_management_regs->fine_time); | |
479 | // |
|
479 | // | |
480 | header->acquisitionTime[0] = header->time[0]; |
|
480 | header->acquisitionTime[0] = header->time[0]; | |
481 | header->acquisitionTime[1] = header->time[1]; |
|
481 | header->acquisitionTime[1] = header->time[1]; | |
482 | header->acquisitionTime[2] = header->time[2]; |
|
482 | header->acquisitionTime[2] = header->time[2]; | |
483 | header->acquisitionTime[3] = header->time[3]; |
|
483 | header->acquisitionTime[3] = header->time[3]; | |
484 | header->acquisitionTime[4] = header->time[4]; |
|
484 | header->acquisitionTime[4] = header->time[4]; | |
485 | header->acquisitionTime[5] = header->time[5]; |
|
485 | header->acquisitionTime[5] = header->time[5]; | |
486 |
|
486 | |||
487 | // (4) SEND PACKET |
|
487 | // (4) SEND PACKET | |
488 | status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE); |
|
488 | status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE); | |
489 | if (status != RTEMS_SUCCESSFUL) { |
|
489 | if (status != RTEMS_SUCCESSFUL) { | |
490 | printf("in ASM_send *** ERR %d\n", (int) status); |
|
490 | printf("in ASM_send *** ERR %d\n", (int) status); | |
491 | } |
|
491 | } | |
492 | } |
|
492 | } | |
493 | } |
|
493 | } | |
494 |
|
494 | |||
495 | //***************** |
|
495 | //***************** | |
496 | // Basic Parameters |
|
496 | // Basic Parameters | |
497 |
|
497 | |||
498 | void BP_init_header( Header_TM_LFR_SCIENCE_BP_t *header, |
|
498 | void BP_init_header( Header_TM_LFR_SCIENCE_BP_t *header, | |
499 | unsigned int apid, unsigned char sid, |
|
499 | unsigned int apid, unsigned char sid, | |
500 | unsigned int packetLength, unsigned char blkNr ) |
|
500 | unsigned int packetLength, unsigned char blkNr ) | |
501 | { |
|
501 | { | |
502 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
502 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; | |
503 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
503 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
504 | header->reserved = 0x00; |
|
504 | header->reserved = 0x00; | |
505 | header->userApplication = CCSDS_USER_APP; |
|
505 | header->userApplication = CCSDS_USER_APP; | |
506 | header->packetID[0] = (unsigned char) (apid >> 8); |
|
506 | header->packetID[0] = (unsigned char) (apid >> 8); | |
507 | header->packetID[1] = (unsigned char) (apid); |
|
507 | header->packetID[1] = (unsigned char) (apid); | |
508 | header->packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
508 | header->packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
509 | header->packetSequenceControl[1] = 0x00; |
|
509 | header->packetSequenceControl[1] = 0x00; | |
510 | header->packetLength[0] = (unsigned char) (packetLength >> 8); |
|
510 | header->packetLength[0] = (unsigned char) (packetLength >> 8); | |
511 | header->packetLength[1] = (unsigned char) (packetLength); |
|
511 | header->packetLength[1] = (unsigned char) (packetLength); | |
512 | // DATA FIELD HEADER |
|
512 | // DATA FIELD HEADER | |
513 | header->spare1_pusVersion_spare2 = 0x10; |
|
513 | header->spare1_pusVersion_spare2 = 0x10; | |
514 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
514 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
515 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
515 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
516 | header->destinationID = TM_DESTINATION_ID_GROUND; |
|
516 | header->destinationID = TM_DESTINATION_ID_GROUND; | |
517 | // AUXILIARY DATA HEADER |
|
517 | // AUXILIARY DATA HEADER | |
518 | header->sid = sid; |
|
518 | header->sid = sid; | |
519 | header->biaStatusInfo = 0x00; |
|
519 | header->biaStatusInfo = 0x00; | |
520 | header->time[0] = 0x00; |
|
520 | header->time[0] = 0x00; | |
521 | header->time[0] = 0x00; |
|
521 | header->time[0] = 0x00; | |
522 | header->time[0] = 0x00; |
|
522 | header->time[0] = 0x00; | |
523 | header->time[0] = 0x00; |
|
523 | header->time[0] = 0x00; | |
524 | header->time[0] = 0x00; |
|
524 | header->time[0] = 0x00; | |
525 | header->time[0] = 0x00; |
|
525 | header->time[0] = 0x00; | |
526 | header->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB |
|
526 | header->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB | |
527 | header->pa_lfr_bp_blk_nr[1] = blkNr; // BLK_NR LSB |
|
527 | header->pa_lfr_bp_blk_nr[1] = blkNr; // BLK_NR LSB | |
528 | } |
|
528 | } | |
529 |
|
529 | |||
530 | void BP_init_header_with_spare(Header_TM_LFR_SCIENCE_BP_with_spare_t *header, |
|
530 | void BP_init_header_with_spare(Header_TM_LFR_SCIENCE_BP_with_spare_t *header, | |
531 | unsigned int apid, unsigned char sid, |
|
531 | unsigned int apid, unsigned char sid, | |
532 | unsigned int packetLength , unsigned char blkNr) |
|
532 | unsigned int packetLength , unsigned char blkNr) | |
533 | { |
|
533 | { | |
534 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
534 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; | |
535 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
535 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
536 | header->reserved = 0x00; |
|
536 | header->reserved = 0x00; | |
537 | header->userApplication = CCSDS_USER_APP; |
|
537 | header->userApplication = CCSDS_USER_APP; | |
538 | header->packetID[0] = (unsigned char) (apid >> 8); |
|
538 | header->packetID[0] = (unsigned char) (apid >> 8); | |
539 | header->packetID[1] = (unsigned char) (apid); |
|
539 | header->packetID[1] = (unsigned char) (apid); | |
540 | header->packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
540 | header->packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
541 | header->packetSequenceControl[1] = 0x00; |
|
541 | header->packetSequenceControl[1] = 0x00; | |
542 | header->packetLength[0] = (unsigned char) (packetLength >> 8); |
|
542 | header->packetLength[0] = (unsigned char) (packetLength >> 8); | |
543 | header->packetLength[1] = (unsigned char) (packetLength); |
|
543 | header->packetLength[1] = (unsigned char) (packetLength); | |
544 | // DATA FIELD HEADER |
|
544 | // DATA FIELD HEADER | |
545 | header->spare1_pusVersion_spare2 = 0x10; |
|
545 | header->spare1_pusVersion_spare2 = 0x10; | |
546 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
546 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
547 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
547 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
548 | header->destinationID = TM_DESTINATION_ID_GROUND; |
|
548 | header->destinationID = TM_DESTINATION_ID_GROUND; | |
549 | // AUXILIARY DATA HEADER |
|
549 | // AUXILIARY DATA HEADER | |
550 | header->sid = sid; |
|
550 | header->sid = sid; | |
551 | header->biaStatusInfo = 0x00; |
|
551 | header->biaStatusInfo = 0x00; | |
552 | header->time[0] = 0x00; |
|
552 | header->time[0] = 0x00; | |
553 | header->time[0] = 0x00; |
|
553 | header->time[0] = 0x00; | |
554 | header->time[0] = 0x00; |
|
554 | header->time[0] = 0x00; | |
555 | header->time[0] = 0x00; |
|
555 | header->time[0] = 0x00; | |
556 | header->time[0] = 0x00; |
|
556 | header->time[0] = 0x00; | |
557 | header->time[0] = 0x00; |
|
557 | header->time[0] = 0x00; | |
558 | header->source_data_spare = 0x00; |
|
558 | header->source_data_spare = 0x00; | |
559 | header->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB |
|
559 | header->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB | |
560 | header->pa_lfr_bp_blk_nr[1] = blkNr; // BLK_NR LSB |
|
560 | header->pa_lfr_bp_blk_nr[1] = blkNr; // BLK_NR LSB | |
561 | } |
|
561 | } | |
562 |
|
562 | |||
563 | void BP_send(char *data, rtems_id queue_id, unsigned int nbBytesToSend, unsigned int sid ) |
|
563 | void BP_send(char *data, rtems_id queue_id, unsigned int nbBytesToSend, unsigned int sid ) | |
564 | { |
|
564 | { | |
565 | rtems_status_code status; |
|
565 | rtems_status_code status; | |
566 |
|
566 | |||
567 | // SET THE SEQUENCE_CNT PARAMETER |
|
567 | // SET THE SEQUENCE_CNT PARAMETER | |
568 | increment_seq_counter_source_id( (unsigned char*) &data[ PACKET_POS_SEQUENCE_CNT ], sid ); |
|
568 | increment_seq_counter_source_id( (unsigned char*) &data[ PACKET_POS_SEQUENCE_CNT ], sid ); | |
569 | // SEND PACKET |
|
569 | // SEND PACKET | |
570 | status = rtems_message_queue_send( queue_id, data, nbBytesToSend); |
|
570 | status = rtems_message_queue_send( queue_id, data, nbBytesToSend); | |
571 | if (status != RTEMS_SUCCESSFUL) |
|
571 | if (status != RTEMS_SUCCESSFUL) | |
572 | { |
|
572 | { | |
573 | printf("ERR *** in BP_send *** ERR %d\n", (int) status); |
|
573 | printf("ERR *** in BP_send *** ERR %d\n", (int) status); | |
574 | } |
|
574 | } | |
575 | } |
|
575 | } | |
576 |
|
576 | |||
577 | //****************** |
|
577 | //****************** | |
578 | // general functions |
|
578 | // general functions | |
579 |
|
579 | |||
580 | void reset_spectral_matrix_regs( void ) |
|
580 | void reset_spectral_matrix_regs( void ) | |
581 | { |
|
581 | { | |
582 | /** This function resets the spectral matrices module registers. |
|
582 | /** This function resets the spectral matrices module registers. | |
583 | * |
|
583 | * | |
584 | * The registers affected by this function are located at the following offset addresses: |
|
584 | * The registers affected by this function are located at the following offset addresses: | |
585 | * |
|
585 | * | |
586 | * - 0x00 config |
|
586 | * - 0x00 config | |
587 | * - 0x04 status |
|
587 | * - 0x04 status | |
588 | * - 0x08 matrixF0_Address0 |
|
588 | * - 0x08 matrixF0_Address0 | |
589 | * - 0x10 matrixFO_Address1 |
|
589 | * - 0x10 matrixFO_Address1 | |
590 | * - 0x14 matrixF1_Address |
|
590 | * - 0x14 matrixF1_Address | |
591 | * - 0x18 matrixF2_Address |
|
591 | * - 0x18 matrixF2_Address | |
592 | * |
|
592 | * | |
593 | */ |
|
593 | */ | |
594 |
|
594 | |||
595 | spectral_matrix_regs->config = 0x00; |
|
595 | spectral_matrix_regs->config = 0x00; | |
596 | spectral_matrix_regs->status = 0x00; |
|
596 | spectral_matrix_regs->status = 0x00; | |
597 |
|
597 | |||
598 | spectral_matrix_regs->f0_0_address = current_ring_node_sm_f0->previous->buffer_address; |
|
598 | spectral_matrix_regs->f0_0_address = current_ring_node_sm_f0->previous->buffer_address; | |
599 | spectral_matrix_regs->f0_1_address = current_ring_node_sm_f0->buffer_address; |
|
599 | spectral_matrix_regs->f0_1_address = current_ring_node_sm_f0->buffer_address; | |
600 | spectral_matrix_regs->f1_0_address = current_ring_node_sm_f1->previous->buffer_address; |
|
600 | spectral_matrix_regs->f1_0_address = current_ring_node_sm_f1->previous->buffer_address; | |
601 | spectral_matrix_regs->f1_1_address = current_ring_node_sm_f1->buffer_address; |
|
601 | spectral_matrix_regs->f1_1_address = current_ring_node_sm_f1->buffer_address; | |
602 | spectral_matrix_regs->f2_0_address = current_ring_node_sm_f2->previous->buffer_address; |
|
602 | spectral_matrix_regs->f2_0_address = current_ring_node_sm_f2->previous->buffer_address; | |
603 | spectral_matrix_regs->f2_1_address = current_ring_node_sm_f2->buffer_address; |
|
603 | spectral_matrix_regs->f2_1_address = current_ring_node_sm_f2->buffer_address; | |
|
604 | ||||
|
605 | spectral_matrix_regs->matrix_length = 0xc8; // 25 * 128 / 16 = 200 = 0xc8 | |||
604 | } |
|
606 | } | |
605 |
|
607 | |||
606 | void set_time( unsigned char *time, unsigned char * timeInBuffer ) |
|
608 | void set_time( unsigned char *time, unsigned char * timeInBuffer ) | |
607 | { |
|
609 | { | |
608 | time[0] = timeInBuffer[0]; |
|
610 | time[0] = timeInBuffer[0]; | |
609 | time[1] = timeInBuffer[1]; |
|
611 | time[1] = timeInBuffer[1]; | |
610 | time[2] = timeInBuffer[2]; |
|
612 | time[2] = timeInBuffer[2]; | |
611 | time[3] = timeInBuffer[3]; |
|
613 | time[3] = timeInBuffer[3]; | |
612 | time[4] = timeInBuffer[6]; |
|
614 | time[4] = timeInBuffer[6]; | |
613 | time[5] = timeInBuffer[7]; |
|
615 | time[5] = timeInBuffer[7]; | |
614 | } |
|
616 | } | |
615 |
|
617 | |||
616 | unsigned long long int get_acquisition_time( unsigned char *timePtr ) |
|
618 | unsigned long long int get_acquisition_time( unsigned char *timePtr ) | |
617 | { |
|
619 | { | |
618 | unsigned long long int acquisitionTimeAslong; |
|
620 | unsigned long long int acquisitionTimeAslong; | |
619 | acquisitionTimeAslong = 0x00; |
|
621 | acquisitionTimeAslong = 0x00; | |
620 | acquisitionTimeAslong = ( (unsigned long long int) (timePtr[0] & 0x7f) << 40 ) // [0111 1111] mask the synchronization bit |
|
622 | acquisitionTimeAslong = ( (unsigned long long int) (timePtr[0] & 0x7f) << 40 ) // [0111 1111] mask the synchronization bit | |
621 | + ( (unsigned long long int) timePtr[1] << 32 ) |
|
623 | + ( (unsigned long long int) timePtr[1] << 32 ) | |
622 | + ( (unsigned long long int) timePtr[2] << 24 ) |
|
624 | + ( (unsigned long long int) timePtr[2] << 24 ) | |
623 | + ( (unsigned long long int) timePtr[3] << 16 ) |
|
625 | + ( (unsigned long long int) timePtr[3] << 16 ) | |
624 | + ( (unsigned long long int) timePtr[6] << 8 ) |
|
626 | + ( (unsigned long long int) timePtr[6] << 8 ) | |
625 | + ( (unsigned long long int) timePtr[7] ); |
|
627 | + ( (unsigned long long int) timePtr[7] ); | |
626 | return acquisitionTimeAslong; |
|
628 | return acquisitionTimeAslong; | |
627 | } |
|
629 | } | |
628 |
|
630 | |||
629 | void close_matrix_actions(unsigned int *nb_sm, unsigned int nb_sm_before_avf, rtems_id avf_task_id, |
|
631 | void close_matrix_actions(unsigned int *nb_sm, unsigned int nb_sm_before_avf, rtems_id avf_task_id, | |
630 | ring_node_sm *node_for_averaging, ring_node_sm *ringNode, |
|
632 | ring_node_sm *node_for_averaging, ring_node_sm *ringNode, | |
631 | unsigned long long int time ) |
|
633 | unsigned long long int time ) | |
632 | { |
|
634 | { | |
633 | unsigned char *timePtr; |
|
635 | unsigned char *timePtr; | |
634 | unsigned char *coarseTimePtr; |
|
636 | unsigned char *coarseTimePtr; | |
635 | unsigned char *fineTimePtr; |
|
637 | unsigned char *fineTimePtr; | |
636 | rtems_status_code status_code; |
|
638 | rtems_status_code status_code; | |
637 |
|
639 | |||
638 | timePtr = (unsigned char *) &time; |
|
640 | timePtr = (unsigned char *) &time; | |
639 | coarseTimePtr = (unsigned char *) &node_for_averaging->coarseTime; |
|
641 | coarseTimePtr = (unsigned char *) &node_for_averaging->coarseTime; | |
640 | fineTimePtr = (unsigned char *) &node_for_averaging->fineTime; |
|
642 | fineTimePtr = (unsigned char *) &node_for_averaging->fineTime; | |
641 |
|
643 | |||
642 | *nb_sm = *nb_sm + 1; |
|
644 | *nb_sm = *nb_sm + 1; | |
643 | if (*nb_sm == nb_sm_before_avf) |
|
645 | if (*nb_sm == nb_sm_before_avf) | |
644 | { |
|
646 | { | |
645 | node_for_averaging = ringNode; |
|
647 | node_for_averaging = ringNode; | |
646 | coarseTimePtr[0] = timePtr[2]; |
|
648 | coarseTimePtr[0] = timePtr[2]; | |
647 | coarseTimePtr[1] = timePtr[3]; |
|
649 | coarseTimePtr[1] = timePtr[3]; | |
648 | coarseTimePtr[2] = timePtr[4]; |
|
650 | coarseTimePtr[2] = timePtr[4]; | |
649 | coarseTimePtr[3] = timePtr[5]; |
|
651 | coarseTimePtr[3] = timePtr[5]; | |
650 | fineTimePtr[2] = timePtr[6]; |
|
652 | fineTimePtr[2] = timePtr[6]; | |
651 | fineTimePtr[3] = timePtr[7]; |
|
653 | fineTimePtr[3] = timePtr[7]; | |
652 | if (rtems_event_send( avf_task_id, RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
654 | if (rtems_event_send( avf_task_id, RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |
653 | { |
|
655 | { | |
654 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
656 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |
655 | } |
|
657 | } | |
656 | *nb_sm = 0; |
|
658 | *nb_sm = 0; | |
657 | } |
|
659 | } | |
658 | } |
|
660 | } | |
659 |
|
661 | |||
660 | unsigned char getSID( rtems_event_set event ) |
|
662 | unsigned char getSID( rtems_event_set event ) | |
661 | { |
|
663 | { | |
662 | unsigned char sid; |
|
664 | unsigned char sid; | |
663 |
|
665 | |||
664 | rtems_event_set eventSetBURST; |
|
666 | rtems_event_set eventSetBURST; | |
665 | rtems_event_set eventSetSBM; |
|
667 | rtems_event_set eventSetSBM; | |
666 |
|
668 | |||
667 | //****** |
|
669 | //****** | |
668 | // BURST |
|
670 | // BURST | |
669 | eventSetBURST = RTEMS_EVENT_BURST_BP1_F0 |
|
671 | eventSetBURST = RTEMS_EVENT_BURST_BP1_F0 | |
670 | | RTEMS_EVENT_BURST_BP1_F1 |
|
672 | | RTEMS_EVENT_BURST_BP1_F1 | |
671 | | RTEMS_EVENT_BURST_BP2_F0 |
|
673 | | RTEMS_EVENT_BURST_BP2_F0 | |
672 | | RTEMS_EVENT_BURST_BP2_F1; |
|
674 | | RTEMS_EVENT_BURST_BP2_F1; | |
673 |
|
675 | |||
674 | //**** |
|
676 | //**** | |
675 | // SBM |
|
677 | // SBM | |
676 | eventSetSBM = RTEMS_EVENT_SBM_BP1_F0 |
|
678 | eventSetSBM = RTEMS_EVENT_SBM_BP1_F0 | |
677 | | RTEMS_EVENT_SBM_BP1_F1 |
|
679 | | RTEMS_EVENT_SBM_BP1_F1 | |
678 | | RTEMS_EVENT_SBM_BP2_F0 |
|
680 | | RTEMS_EVENT_SBM_BP2_F0 | |
679 | | RTEMS_EVENT_SBM_BP2_F1; |
|
681 | | RTEMS_EVENT_SBM_BP2_F1; | |
680 |
|
682 | |||
681 | if (event & eventSetBURST) |
|
683 | if (event & eventSetBURST) | |
682 | { |
|
684 | { | |
683 | sid = SID_BURST_BP1_F0; |
|
685 | sid = SID_BURST_BP1_F0; | |
684 | } |
|
686 | } | |
685 | else if (event & eventSetSBM) |
|
687 | else if (event & eventSetSBM) | |
686 | { |
|
688 | { | |
687 | sid = SID_SBM1_BP1_F0; |
|
689 | sid = SID_SBM1_BP1_F0; | |
688 | } |
|
690 | } | |
689 | else |
|
691 | else | |
690 | { |
|
692 | { | |
691 | sid = 0; |
|
693 | sid = 0; | |
692 | } |
|
694 | } | |
693 |
|
695 | |||
694 | return sid; |
|
696 | return sid; | |
695 | } |
|
697 | } | |
696 |
|
698 |
@@ -1,949 +1,949 | |||||
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 | printf("this is the end!!!\n"); |
|
148 | printf("this is the end!!!\n"); | |
149 | exit(0); |
|
149 | exit(0); | |
150 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); |
|
150 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); | |
151 | return LFR_DEFAULT; |
|
151 | return LFR_DEFAULT; | |
152 | } |
|
152 | } | |
153 |
|
153 | |||
154 | int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) |
|
154 | int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) | |
155 | { |
|
155 | { | |
156 | /** This function executes specific actions when a TC_LFR_ENTER_MODE TeleCommand has been received. |
|
156 | /** This function executes specific actions when a TC_LFR_ENTER_MODE TeleCommand has been received. | |
157 | * |
|
157 | * | |
158 | * @param TC points to the TeleCommand packet that is being processed |
|
158 | * @param TC points to the TeleCommand packet that is being processed | |
159 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
159 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver | |
160 | * |
|
160 | * | |
161 | */ |
|
161 | */ | |
162 |
|
162 | |||
163 | rtems_status_code status; |
|
163 | rtems_status_code status; | |
164 | unsigned char requestedMode; |
|
164 | unsigned char requestedMode; | |
165 | unsigned int *transitionCoarseTime_ptr; |
|
165 | unsigned int *transitionCoarseTime_ptr; | |
166 | unsigned int transitionCoarseTime; |
|
166 | unsigned int transitionCoarseTime; | |
167 | unsigned char * bytePosPtr; |
|
167 | unsigned char * bytePosPtr; | |
168 |
|
168 | |||
169 | bytePosPtr = (unsigned char *) &TC->packetID; |
|
169 | bytePosPtr = (unsigned char *) &TC->packetID; | |
170 |
|
170 | |||
171 | requestedMode = bytePosPtr[ BYTE_POS_CP_MODE_LFR_SET ]; |
|
171 | requestedMode = bytePosPtr[ BYTE_POS_CP_MODE_LFR_SET ]; | |
172 | transitionCoarseTime_ptr = (unsigned int *) ( &bytePosPtr[ BYTE_POS_CP_LFR_ENTER_MODE_TIME ] ); |
|
172 | transitionCoarseTime_ptr = (unsigned int *) ( &bytePosPtr[ BYTE_POS_CP_LFR_ENTER_MODE_TIME ] ); | |
173 | transitionCoarseTime = (*transitionCoarseTime_ptr) & 0x7fffffff; |
|
173 | transitionCoarseTime = (*transitionCoarseTime_ptr) & 0x7fffffff; | |
174 |
|
174 | |||
175 | status = check_mode_value( requestedMode ); |
|
175 | status = check_mode_value( requestedMode ); | |
176 |
|
176 | |||
177 | if ( status != LFR_SUCCESSFUL ) // the mode value is inconsistent |
|
177 | if ( status != LFR_SUCCESSFUL ) // the mode value is inconsistent | |
178 | { |
|
178 | { | |
179 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_MODE_LFR_SET, requestedMode ); |
|
179 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_MODE_LFR_SET, requestedMode ); | |
180 | } |
|
180 | } | |
181 | else // the mode value is consistent, check the transition |
|
181 | else // the mode value is consistent, check the transition | |
182 | { |
|
182 | { | |
183 | status = check_mode_transition(requestedMode); |
|
183 | status = check_mode_transition(requestedMode); | |
184 | if (status != LFR_SUCCESSFUL) |
|
184 | if (status != LFR_SUCCESSFUL) | |
185 | { |
|
185 | { | |
186 | PRINTF("ERR *** in action_enter_mode *** check_mode_transition\n") |
|
186 | PRINTF("ERR *** in action_enter_mode *** check_mode_transition\n") | |
187 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); |
|
187 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); | |
188 | } |
|
188 | } | |
189 | } |
|
189 | } | |
190 |
|
190 | |||
191 | if ( status == LFR_SUCCESSFUL ) // the transition is valid, enter the mode |
|
191 | if ( status == LFR_SUCCESSFUL ) // the transition is valid, enter the mode | |
192 | { |
|
192 | { | |
193 | status = check_transition_date( transitionCoarseTime ); |
|
193 | status = check_transition_date( transitionCoarseTime ); | |
194 | if (status != LFR_SUCCESSFUL) |
|
194 | if (status != LFR_SUCCESSFUL) | |
195 | { |
|
195 | { | |
196 | PRINTF("ERR *** in action_enter_mode *** check_transition_date\n") |
|
196 | PRINTF("ERR *** in action_enter_mode *** check_transition_date\n") | |
197 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, |
|
197 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, | |
198 | BYTE_POS_CP_LFR_ENTER_MODE_TIME, |
|
198 | BYTE_POS_CP_LFR_ENTER_MODE_TIME, | |
199 | bytePosPtr[ BYTE_POS_CP_LFR_ENTER_MODE_TIME + 3 ] ); |
|
199 | bytePosPtr[ BYTE_POS_CP_LFR_ENTER_MODE_TIME + 3 ] ); | |
200 | } |
|
200 | } | |
201 | } |
|
201 | } | |
202 |
|
202 | |||
203 | if ( status == LFR_SUCCESSFUL ) // the date is valid, enter the mode |
|
203 | if ( status == LFR_SUCCESSFUL ) // the date is valid, enter the mode | |
204 | { |
|
204 | { | |
205 | PRINTF1("OK *** in action_enter_mode *** enter mode %d\n", requestedMode); |
|
205 | PRINTF1("OK *** in action_enter_mode *** enter mode %d\n", requestedMode); | |
206 | status = enter_mode( requestedMode, transitionCoarseTime ); |
|
206 | status = enter_mode( requestedMode, transitionCoarseTime ); | |
207 | } |
|
207 | } | |
208 |
|
208 | |||
209 | return status; |
|
209 | return status; | |
210 | } |
|
210 | } | |
211 |
|
211 | |||
212 | int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
212 | int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) | |
213 | { |
|
213 | { | |
214 | /** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received. |
|
214 | /** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received. | |
215 | * |
|
215 | * | |
216 | * @param TC points to the TeleCommand packet that is being processed |
|
216 | * @param TC points to the TeleCommand packet that is being processed | |
217 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
217 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver | |
218 | * |
|
218 | * | |
219 | * @return LFR directive status code: |
|
219 | * @return LFR directive status code: | |
220 | * - LFR_DEFAULT |
|
220 | * - LFR_DEFAULT | |
221 | * - LFR_SUCCESSFUL |
|
221 | * - LFR_SUCCESSFUL | |
222 | * |
|
222 | * | |
223 | */ |
|
223 | */ | |
224 |
|
224 | |||
225 | unsigned int val; |
|
225 | unsigned int val; | |
226 | int result; |
|
226 | int result; | |
227 | unsigned int status; |
|
227 | unsigned int status; | |
228 | unsigned char mode; |
|
228 | unsigned char mode; | |
229 | unsigned char * bytePosPtr; |
|
229 | unsigned char * bytePosPtr; | |
230 |
|
230 | |||
231 | bytePosPtr = (unsigned char *) &TC->packetID; |
|
231 | bytePosPtr = (unsigned char *) &TC->packetID; | |
232 |
|
232 | |||
233 | // check LFR mode |
|
233 | // check LFR mode | |
234 | mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET5 ] & 0x1e) >> 1; |
|
234 | mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET5 ] & 0x1e) >> 1; | |
235 | status = check_update_info_hk_lfr_mode( mode ); |
|
235 | status = check_update_info_hk_lfr_mode( mode ); | |
236 | if (status == LFR_SUCCESSFUL) // check TDS mode |
|
236 | if (status == LFR_SUCCESSFUL) // check TDS mode | |
237 | { |
|
237 | { | |
238 | mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 ] & 0xf0) >> 4; |
|
238 | mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 ] & 0xf0) >> 4; | |
239 | status = check_update_info_hk_tds_mode( mode ); |
|
239 | status = check_update_info_hk_tds_mode( mode ); | |
240 | } |
|
240 | } | |
241 | if (status == LFR_SUCCESSFUL) // check THR mode |
|
241 | if (status == LFR_SUCCESSFUL) // check THR mode | |
242 | { |
|
242 | { | |
243 | mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 ] & 0x0f); |
|
243 | mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 ] & 0x0f); | |
244 | status = check_update_info_hk_thr_mode( mode ); |
|
244 | status = check_update_info_hk_thr_mode( mode ); | |
245 | } |
|
245 | } | |
246 | if (status == LFR_SUCCESSFUL) // if the parameter check is successful |
|
246 | if (status == LFR_SUCCESSFUL) // if the parameter check is successful | |
247 | { |
|
247 | { | |
248 | val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256 |
|
248 | val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256 | |
249 | + housekeeping_packet.hk_lfr_update_info_tc_cnt[1]; |
|
249 | + housekeeping_packet.hk_lfr_update_info_tc_cnt[1]; | |
250 | val++; |
|
250 | val++; | |
251 | housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8); |
|
251 | housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8); | |
252 | housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val); |
|
252 | housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val); | |
253 | } |
|
253 | } | |
254 |
|
254 | |||
255 | result = status; |
|
255 | result = status; | |
256 |
|
256 | |||
257 | return result; |
|
257 | return result; | |
258 | } |
|
258 | } | |
259 |
|
259 | |||
260 | int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
260 | int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) | |
261 | { |
|
261 | { | |
262 | /** This function executes specific actions when a TC_LFR_ENABLE_CALIBRATION TeleCommand has been received. |
|
262 | /** This function executes specific actions when a TC_LFR_ENABLE_CALIBRATION TeleCommand has been received. | |
263 | * |
|
263 | * | |
264 | * @param TC points to the TeleCommand packet that is being processed |
|
264 | * @param TC points to the TeleCommand packet that is being processed | |
265 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
265 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver | |
266 | * |
|
266 | * | |
267 | */ |
|
267 | */ | |
268 |
|
268 | |||
269 | int result; |
|
269 | int result; | |
270 | unsigned char lfrMode; |
|
270 | unsigned char lfrMode; | |
271 |
|
271 | |||
272 | result = LFR_DEFAULT; |
|
272 | result = LFR_DEFAULT; | |
273 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
273 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
274 |
|
274 | |||
275 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); |
|
275 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); | |
276 | result = LFR_DEFAULT; |
|
276 | result = LFR_DEFAULT; | |
277 |
|
277 | |||
278 | return result; |
|
278 | return result; | |
279 | } |
|
279 | } | |
280 |
|
280 | |||
281 | int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
281 | int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) | |
282 | { |
|
282 | { | |
283 | /** This function executes specific actions when a TC_LFR_DISABLE_CALIBRATION TeleCommand has been received. |
|
283 | /** This function executes specific actions when a TC_LFR_DISABLE_CALIBRATION TeleCommand has been received. | |
284 | * |
|
284 | * | |
285 | * @param TC points to the TeleCommand packet that is being processed |
|
285 | * @param TC points to the TeleCommand packet that is being processed | |
286 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
286 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver | |
287 | * |
|
287 | * | |
288 | */ |
|
288 | */ | |
289 |
|
289 | |||
290 | int result; |
|
290 | int result; | |
291 | unsigned char lfrMode; |
|
291 | unsigned char lfrMode; | |
292 |
|
292 | |||
293 | result = LFR_DEFAULT; |
|
293 | result = LFR_DEFAULT; | |
294 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
294 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
295 |
|
295 | |||
296 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); |
|
296 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); | |
297 | result = LFR_DEFAULT; |
|
297 | result = LFR_DEFAULT; | |
298 |
|
298 | |||
299 | return result; |
|
299 | return result; | |
300 | } |
|
300 | } | |
301 |
|
301 | |||
302 | int action_update_time(ccsdsTelecommandPacket_t *TC) |
|
302 | int action_update_time(ccsdsTelecommandPacket_t *TC) | |
303 | { |
|
303 | { | |
304 | /** This function executes specific actions when a TC_LFR_UPDATE_TIME TeleCommand has been received. |
|
304 | /** This function executes specific actions when a TC_LFR_UPDATE_TIME TeleCommand has been received. | |
305 | * |
|
305 | * | |
306 | * @param TC points to the TeleCommand packet that is being processed |
|
306 | * @param TC points to the TeleCommand packet that is being processed | |
307 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
307 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver | |
308 | * |
|
308 | * | |
309 | * @return LFR_SUCCESSFUL |
|
309 | * @return LFR_SUCCESSFUL | |
310 | * |
|
310 | * | |
311 | */ |
|
311 | */ | |
312 |
|
312 | |||
313 | unsigned int val; |
|
313 | unsigned int val; | |
314 |
|
314 | |||
315 | time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24) |
|
315 | time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24) | |
316 | + (TC->dataAndCRC[1] << 16) |
|
316 | + (TC->dataAndCRC[1] << 16) | |
317 | + (TC->dataAndCRC[2] << 8) |
|
317 | + (TC->dataAndCRC[2] << 8) | |
318 | + TC->dataAndCRC[3]; |
|
318 | + TC->dataAndCRC[3]; | |
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 |
|
325 | |||
326 | return LFR_SUCCESSFUL; |
|
326 | return LFR_SUCCESSFUL; | |
327 | } |
|
327 | } | |
328 |
|
328 | |||
329 | //******************* |
|
329 | //******************* | |
330 | // ENTERING THE MODES |
|
330 | // ENTERING THE MODES | |
331 | int check_mode_value( unsigned char requestedMode ) |
|
331 | int check_mode_value( unsigned char requestedMode ) | |
332 | { |
|
332 | { | |
333 | int status; |
|
333 | int status; | |
334 |
|
334 | |||
335 | if ( (requestedMode != LFR_MODE_STANDBY) |
|
335 | if ( (requestedMode != LFR_MODE_STANDBY) | |
336 | && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST) |
|
336 | && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST) | |
337 | && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) ) |
|
337 | && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) ) | |
338 | { |
|
338 | { | |
339 | status = LFR_DEFAULT; |
|
339 | status = LFR_DEFAULT; | |
340 | } |
|
340 | } | |
341 | else |
|
341 | else | |
342 | { |
|
342 | { | |
343 | status = LFR_SUCCESSFUL; |
|
343 | status = LFR_SUCCESSFUL; | |
344 | } |
|
344 | } | |
345 |
|
345 | |||
346 | return status; |
|
346 | return status; | |
347 | } |
|
347 | } | |
348 |
|
348 | |||
349 | int check_mode_transition( unsigned char requestedMode ) |
|
349 | int check_mode_transition( unsigned char requestedMode ) | |
350 | { |
|
350 | { | |
351 | /** This function checks the validity of the transition requested by the TC_LFR_ENTER_MODE. |
|
351 | /** This function checks the validity of the transition requested by the TC_LFR_ENTER_MODE. | |
352 | * |
|
352 | * | |
353 | * @param requestedMode is the mode requested by the TC_LFR_ENTER_MODE |
|
353 | * @param requestedMode is the mode requested by the TC_LFR_ENTER_MODE | |
354 | * |
|
354 | * | |
355 | * @return LFR directive status codes: |
|
355 | * @return LFR directive status codes: | |
356 | * - LFR_SUCCESSFUL - the transition is authorized |
|
356 | * - LFR_SUCCESSFUL - the transition is authorized | |
357 | * - LFR_DEFAULT - the transition is not authorized |
|
357 | * - LFR_DEFAULT - the transition is not authorized | |
358 | * |
|
358 | * | |
359 | */ |
|
359 | */ | |
360 |
|
360 | |||
361 | int status; |
|
361 | int status; | |
362 |
|
362 | |||
363 | switch (requestedMode) |
|
363 | switch (requestedMode) | |
364 | { |
|
364 | { | |
365 | case LFR_MODE_STANDBY: |
|
365 | case LFR_MODE_STANDBY: | |
366 | if ( lfrCurrentMode == LFR_MODE_STANDBY ) { |
|
366 | if ( lfrCurrentMode == LFR_MODE_STANDBY ) { | |
367 | status = LFR_DEFAULT; |
|
367 | status = LFR_DEFAULT; | |
368 | } |
|
368 | } | |
369 | else |
|
369 | else | |
370 | { |
|
370 | { | |
371 | status = LFR_SUCCESSFUL; |
|
371 | status = LFR_SUCCESSFUL; | |
372 | } |
|
372 | } | |
373 | break; |
|
373 | break; | |
374 | case LFR_MODE_NORMAL: |
|
374 | case LFR_MODE_NORMAL: | |
375 | if ( lfrCurrentMode == LFR_MODE_NORMAL ) { |
|
375 | if ( lfrCurrentMode == LFR_MODE_NORMAL ) { | |
376 | status = LFR_DEFAULT; |
|
376 | status = LFR_DEFAULT; | |
377 | } |
|
377 | } | |
378 | else { |
|
378 | else { | |
379 | status = LFR_SUCCESSFUL; |
|
379 | status = LFR_SUCCESSFUL; | |
380 | } |
|
380 | } | |
381 | break; |
|
381 | break; | |
382 | case LFR_MODE_BURST: |
|
382 | case LFR_MODE_BURST: | |
383 | if ( lfrCurrentMode == LFR_MODE_BURST ) { |
|
383 | if ( lfrCurrentMode == LFR_MODE_BURST ) { | |
384 | status = LFR_DEFAULT; |
|
384 | status = LFR_DEFAULT; | |
385 | } |
|
385 | } | |
386 | else { |
|
386 | else { | |
387 | status = LFR_SUCCESSFUL; |
|
387 | status = LFR_SUCCESSFUL; | |
388 | } |
|
388 | } | |
389 | break; |
|
389 | break; | |
390 | case LFR_MODE_SBM1: |
|
390 | case LFR_MODE_SBM1: | |
391 | if ( lfrCurrentMode == LFR_MODE_SBM1 ) { |
|
391 | if ( lfrCurrentMode == LFR_MODE_SBM1 ) { | |
392 | status = LFR_DEFAULT; |
|
392 | status = LFR_DEFAULT; | |
393 | } |
|
393 | } | |
394 | else { |
|
394 | else { | |
395 | status = LFR_SUCCESSFUL; |
|
395 | status = LFR_SUCCESSFUL; | |
396 | } |
|
396 | } | |
397 | break; |
|
397 | break; | |
398 | case LFR_MODE_SBM2: |
|
398 | case LFR_MODE_SBM2: | |
399 | if ( lfrCurrentMode == LFR_MODE_SBM2 ) { |
|
399 | if ( lfrCurrentMode == LFR_MODE_SBM2 ) { | |
400 | status = LFR_DEFAULT; |
|
400 | status = LFR_DEFAULT; | |
401 | } |
|
401 | } | |
402 | else { |
|
402 | else { | |
403 | status = LFR_SUCCESSFUL; |
|
403 | status = LFR_SUCCESSFUL; | |
404 | } |
|
404 | } | |
405 | break; |
|
405 | break; | |
406 | default: |
|
406 | default: | |
407 | status = LFR_DEFAULT; |
|
407 | status = LFR_DEFAULT; | |
408 | break; |
|
408 | break; | |
409 | } |
|
409 | } | |
410 |
|
410 | |||
411 | return status; |
|
411 | return status; | |
412 | } |
|
412 | } | |
413 |
|
413 | |||
414 | int check_transition_date( unsigned int transitionCoarseTime ) |
|
414 | int check_transition_date( unsigned int transitionCoarseTime ) | |
415 | { |
|
415 | { | |
416 | int status; |
|
416 | int status; | |
417 | unsigned int localCoarseTime; |
|
417 | unsigned int localCoarseTime; | |
418 | unsigned int deltaCoarseTime; |
|
418 | unsigned int deltaCoarseTime; | |
419 |
|
419 | |||
420 | status = LFR_SUCCESSFUL; |
|
420 | status = LFR_SUCCESSFUL; | |
421 |
|
421 | |||
422 | if (transitionCoarseTime == 0) // transition time = 0 means an instant transition |
|
422 | if (transitionCoarseTime == 0) // transition time = 0 means an instant transition | |
423 | { |
|
423 | { | |
424 | status = LFR_SUCCESSFUL; |
|
424 | status = LFR_SUCCESSFUL; | |
425 | } |
|
425 | } | |
426 | else |
|
426 | else | |
427 | { |
|
427 | { | |
428 | localCoarseTime = time_management_regs->coarse_time & 0x7fffffff; |
|
428 | localCoarseTime = time_management_regs->coarse_time & 0x7fffffff; | |
429 |
|
429 | |||
430 | if ( transitionCoarseTime <= localCoarseTime ) // SSS-CP-EQS-322 |
|
430 | if ( transitionCoarseTime <= localCoarseTime ) // SSS-CP-EQS-322 | |
431 | { |
|
431 | { | |
432 | status = LFR_DEFAULT; |
|
432 | status = LFR_DEFAULT; | |
433 | PRINTF2("ERR *** in check_transition_date *** transition = %x, local = %x\n", transitionCoarseTime, localCoarseTime) |
|
433 | PRINTF2("ERR *** in check_transition_date *** transition = %x, local = %x\n", transitionCoarseTime, localCoarseTime) | |
434 | } |
|
434 | } | |
435 |
|
435 | |||
436 | if (status == LFR_SUCCESSFUL) |
|
436 | if (status == LFR_SUCCESSFUL) | |
437 | { |
|
437 | { | |
438 | deltaCoarseTime = transitionCoarseTime - localCoarseTime; |
|
438 | deltaCoarseTime = transitionCoarseTime - localCoarseTime; | |
439 | if ( deltaCoarseTime > 3 ) // SSS-CP-EQS-323 |
|
439 | if ( deltaCoarseTime > 3 ) // SSS-CP-EQS-323 | |
440 | { |
|
440 | { | |
441 | status = LFR_DEFAULT; |
|
441 | status = LFR_DEFAULT; | |
442 | PRINTF1("ERR *** in check_transition_date *** deltaCoarseTime = %x\n", deltaCoarseTime) |
|
442 | PRINTF1("ERR *** in check_transition_date *** deltaCoarseTime = %x\n", deltaCoarseTime) | |
443 | } |
|
443 | } | |
444 | } |
|
444 | } | |
445 | } |
|
445 | } | |
446 |
|
446 | |||
447 | return status; |
|
447 | return status; | |
448 | } |
|
448 | } | |
449 |
|
449 | |||
450 | int stop_current_mode( void ) |
|
450 | int stop_current_mode( void ) | |
451 | { |
|
451 | { | |
452 | /** This function stops the current mode by masking interrupt lines and suspending science tasks. |
|
452 | /** This function stops the current mode by masking interrupt lines and suspending science tasks. | |
453 | * |
|
453 | * | |
454 | * @return RTEMS directive status codes: |
|
454 | * @return RTEMS directive status codes: | |
455 | * - RTEMS_SUCCESSFUL - task restarted successfully |
|
455 | * - RTEMS_SUCCESSFUL - task restarted successfully | |
456 | * - RTEMS_INVALID_ID - task id invalid |
|
456 | * - RTEMS_INVALID_ID - task id invalid | |
457 | * - RTEMS_ALREADY_SUSPENDED - task already suspended |
|
457 | * - RTEMS_ALREADY_SUSPENDED - task already suspended | |
458 | * |
|
458 | * | |
459 | */ |
|
459 | */ | |
460 |
|
460 | |||
461 | rtems_status_code status; |
|
461 | rtems_status_code status; | |
462 |
|
462 | |||
463 | status = RTEMS_SUCCESSFUL; |
|
463 | status = RTEMS_SUCCESSFUL; | |
464 |
|
464 | |||
465 | // (1) mask interruptions |
|
465 | // (1) mask interruptions | |
466 | LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt |
|
466 | LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt | |
467 | LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt |
|
467 | LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt | |
468 |
|
468 | |||
469 | // (2) clear interruptions |
|
469 | // (2) clear interruptions | |
470 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt |
|
470 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt | |
471 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt |
|
471 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt | |
472 |
|
472 | |||
473 | // (3) reset waveform picker registers |
|
473 | // (3) reset waveform picker registers | |
474 | reset_wfp_burst_enable(); // reset burst and enable bits |
|
474 | reset_wfp_burst_enable(); // reset burst and enable bits | |
475 | reset_wfp_status(); // reset all the status bits |
|
475 | reset_wfp_status(); // reset all the status bits | |
476 |
|
476 | |||
477 | // (4) reset spectral matrices registers |
|
477 | // (4) reset spectral matrices registers | |
478 | set_irq_on_new_ready_matrix( 0 ); // stop the spectral matrices |
|
478 | set_irq_on_new_ready_matrix( 0 ); // stop the spectral matrices | |
479 | set_run_matrix_spectral( 0 ); // run_matrix_spectral is set to 0 |
|
479 | set_run_matrix_spectral( 0 ); // run_matrix_spectral is set to 0 | |
480 | reset_extractSWF(); // reset the extractSWF flag to false |
|
480 | reset_extractSWF(); // reset the extractSWF flag to false | |
481 |
|
481 | |||
482 | // <Spectral Matrices simulator> |
|
482 | // <Spectral Matrices simulator> | |
483 | LEON_Mask_interrupt( IRQ_SM_SIMULATOR ); // mask spectral matrix interrupt simulator |
|
483 | LEON_Mask_interrupt( IRQ_SM_SIMULATOR ); // mask spectral matrix interrupt simulator | |
484 | timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); |
|
484 | timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); | |
485 | LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); // clear spectral matrix interrupt simulator |
|
485 | LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); // clear spectral matrix interrupt simulator | |
486 | // </Spectral Matrices simulator> |
|
486 | // </Spectral Matrices simulator> | |
487 |
|
487 | |||
488 | // suspend several tasks |
|
488 | // suspend several tasks | |
489 | if (lfrCurrentMode != LFR_MODE_STANDBY) { |
|
489 | if (lfrCurrentMode != LFR_MODE_STANDBY) { | |
490 | status = suspend_science_tasks(); |
|
490 | status = suspend_science_tasks(); | |
491 | } |
|
491 | } | |
492 |
|
492 | |||
493 | if (status != RTEMS_SUCCESSFUL) |
|
493 | if (status != RTEMS_SUCCESSFUL) | |
494 | { |
|
494 | { | |
495 | PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status) |
|
495 | PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status) | |
496 | } |
|
496 | } | |
497 |
|
497 | |||
498 | return status; |
|
498 | return status; | |
499 | } |
|
499 | } | |
500 |
|
500 | |||
501 | int enter_mode( unsigned char mode, unsigned int transitionCoarseTime ) |
|
501 | int enter_mode( unsigned char mode, unsigned int transitionCoarseTime ) | |
502 | { |
|
502 | { | |
503 | /** This function is launched after a mode transition validation. |
|
503 | /** This function is launched after a mode transition validation. | |
504 | * |
|
504 | * | |
505 | * @param mode is the mode in which LFR will be put. |
|
505 | * @param mode is the mode in which LFR will be put. | |
506 | * |
|
506 | * | |
507 | * @return RTEMS directive status codes: |
|
507 | * @return RTEMS directive status codes: | |
508 | * - RTEMS_SUCCESSFUL - the mode has been entered successfully |
|
508 | * - RTEMS_SUCCESSFUL - the mode has been entered successfully | |
509 | * - RTEMS_NOT_SATISFIED - the mode has not been entered successfully |
|
509 | * - RTEMS_NOT_SATISFIED - the mode has not been entered successfully | |
510 | * |
|
510 | * | |
511 | */ |
|
511 | */ | |
512 |
|
512 | |||
513 | rtems_status_code status; |
|
513 | rtems_status_code status; | |
514 |
|
514 | |||
515 | //********************** |
|
515 | //********************** | |
516 | // STOP THE CURRENT MODE |
|
516 | // STOP THE CURRENT MODE | |
517 | status = stop_current_mode(); |
|
517 | status = stop_current_mode(); | |
518 | if (status != RTEMS_SUCCESSFUL) |
|
518 | if (status != RTEMS_SUCCESSFUL) | |
519 | { |
|
519 | { | |
520 | PRINTF1("ERR *** in enter_mode *** stop_current_mode with mode = %d\n", mode) |
|
520 | PRINTF1("ERR *** in enter_mode *** stop_current_mode with mode = %d\n", mode) | |
521 | } |
|
521 | } | |
522 |
|
522 | |||
523 | //************************* |
|
523 | //************************* | |
524 | // ENTER THE REQUESTED MODE |
|
524 | // ENTER THE REQUESTED MODE | |
525 | if ( (mode == LFR_MODE_NORMAL) || (mode == LFR_MODE_BURST) |
|
525 | if ( (mode == LFR_MODE_NORMAL) || (mode == LFR_MODE_BURST) | |
526 | || (mode == LFR_MODE_SBM1) || (mode == LFR_MODE_SBM2) ) |
|
526 | || (mode == LFR_MODE_SBM1) || (mode == LFR_MODE_SBM2) ) | |
527 | { |
|
527 | { | |
528 | #ifdef PRINT_TASK_STATISTICS |
|
528 | #ifdef PRINT_TASK_STATISTICS | |
529 | rtems_cpu_usage_reset(); |
|
529 | rtems_cpu_usage_reset(); | |
530 | maxCount = 0; |
|
530 | maxCount = 0; | |
531 | #endif |
|
531 | #endif | |
532 | status = restart_science_tasks( mode ); |
|
532 | status = restart_science_tasks( mode ); | |
|
533 | launch_spectral_matrix( ); | |||
533 | launch_waveform_picker( mode, transitionCoarseTime ); |
|
534 | launch_waveform_picker( mode, transitionCoarseTime ); | |
534 | launch_spectral_matrix( ); |
|
|||
535 | // launch_spectral_matrix_simu( ); |
|
535 | // launch_spectral_matrix_simu( ); | |
536 | } |
|
536 | } | |
537 | else if ( mode == LFR_MODE_STANDBY ) |
|
537 | else if ( mode == LFR_MODE_STANDBY ) | |
538 | { |
|
538 | { | |
539 | #ifdef PRINT_TASK_STATISTICS |
|
539 | #ifdef PRINT_TASK_STATISTICS | |
540 | rtems_cpu_usage_report(); |
|
540 | rtems_cpu_usage_report(); | |
541 | #endif |
|
541 | #endif | |
542 |
|
542 | |||
543 | #ifdef PRINT_STACK_REPORT |
|
543 | #ifdef PRINT_STACK_REPORT | |
544 | PRINTF("stack report selected\n") |
|
544 | PRINTF("stack report selected\n") | |
545 | rtems_stack_checker_report_usage(); |
|
545 | rtems_stack_checker_report_usage(); | |
546 | #endif |
|
546 | #endif | |
547 | PRINTF1("maxCount = %d\n", maxCount) |
|
547 | PRINTF1("maxCount = %d\n", maxCount) | |
548 | } |
|
548 | } | |
549 | else |
|
549 | else | |
550 | { |
|
550 | { | |
551 | status = RTEMS_UNSATISFIED; |
|
551 | status = RTEMS_UNSATISFIED; | |
552 | } |
|
552 | } | |
553 |
|
553 | |||
554 | if (status != RTEMS_SUCCESSFUL) |
|
554 | if (status != RTEMS_SUCCESSFUL) | |
555 | { |
|
555 | { | |
556 | PRINTF1("ERR *** in enter_mode *** status = %d\n", status) |
|
556 | PRINTF1("ERR *** in enter_mode *** status = %d\n", status) | |
557 | status = RTEMS_UNSATISFIED; |
|
557 | status = RTEMS_UNSATISFIED; | |
558 | } |
|
558 | } | |
559 |
|
559 | |||
560 | return status; |
|
560 | return status; | |
561 | } |
|
561 | } | |
562 |
|
562 | |||
563 | int restart_science_tasks(unsigned char lfrRequestedMode ) |
|
563 | int restart_science_tasks(unsigned char lfrRequestedMode ) | |
564 | { |
|
564 | { | |
565 | /** This function is used to restart all science tasks. |
|
565 | /** This function is used to restart all science tasks. | |
566 | * |
|
566 | * | |
567 | * @return RTEMS directive status codes: |
|
567 | * @return RTEMS directive status codes: | |
568 | * - RTEMS_SUCCESSFUL - task restarted successfully |
|
568 | * - RTEMS_SUCCESSFUL - task restarted successfully | |
569 | * - RTEMS_INVALID_ID - task id invalid |
|
569 | * - RTEMS_INVALID_ID - task id invalid | |
570 | * - RTEMS_INCORRECT_STATE - task never started |
|
570 | * - RTEMS_INCORRECT_STATE - task never started | |
571 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task |
|
571 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task | |
572 | * |
|
572 | * | |
573 | * Science tasks are AVF0, PRC0, WFRM, CWF3, CW2, CWF1 |
|
573 | * Science tasks are AVF0, PRC0, WFRM, CWF3, CW2, CWF1 | |
574 | * |
|
574 | * | |
575 | */ |
|
575 | */ | |
576 |
|
576 | |||
577 | rtems_status_code status[10]; |
|
577 | rtems_status_code status[10]; | |
578 | rtems_status_code ret; |
|
578 | rtems_status_code ret; | |
579 |
|
579 | |||
580 | ret = RTEMS_SUCCESSFUL; |
|
580 | ret = RTEMS_SUCCESSFUL; | |
581 |
|
581 | |||
582 | status[0] = rtems_task_restart( Task_id[TASKID_AVF0], lfrRequestedMode ); |
|
582 | status[0] = rtems_task_restart( Task_id[TASKID_AVF0], lfrRequestedMode ); | |
583 | if (status[0] != RTEMS_SUCCESSFUL) |
|
583 | if (status[0] != RTEMS_SUCCESSFUL) | |
584 | { |
|
584 | { | |
585 | PRINTF1("in restart_science_task *** AVF0 ERR %d\n", status[0]) |
|
585 | PRINTF1("in restart_science_task *** AVF0 ERR %d\n", status[0]) | |
586 | } |
|
586 | } | |
587 |
|
587 | |||
588 | status[1] = rtems_task_restart( Task_id[TASKID_PRC0], lfrRequestedMode ); |
|
588 | status[1] = rtems_task_restart( Task_id[TASKID_PRC0], lfrRequestedMode ); | |
589 | if (status[1] != RTEMS_SUCCESSFUL) |
|
589 | if (status[1] != RTEMS_SUCCESSFUL) | |
590 | { |
|
590 | { | |
591 | PRINTF1("in restart_science_task *** PRC0 ERR %d\n", status[1]) |
|
591 | PRINTF1("in restart_science_task *** PRC0 ERR %d\n", status[1]) | |
592 | } |
|
592 | } | |
593 |
|
593 | |||
594 | status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 ); |
|
594 | status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 ); | |
595 | if (status[2] != RTEMS_SUCCESSFUL) |
|
595 | if (status[2] != RTEMS_SUCCESSFUL) | |
596 | { |
|
596 | { | |
597 | PRINTF1("in restart_science_task *** WFRM ERR %d\n", status[2]) |
|
597 | PRINTF1("in restart_science_task *** WFRM ERR %d\n", status[2]) | |
598 | } |
|
598 | } | |
599 |
|
599 | |||
600 | status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 ); |
|
600 | status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 ); | |
601 | if (status[3] != RTEMS_SUCCESSFUL) |
|
601 | if (status[3] != RTEMS_SUCCESSFUL) | |
602 | { |
|
602 | { | |
603 | PRINTF1("in restart_science_task *** CWF3 ERR %d\n", status[3]) |
|
603 | PRINTF1("in restart_science_task *** CWF3 ERR %d\n", status[3]) | |
604 | } |
|
604 | } | |
605 |
|
605 | |||
606 | status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 ); |
|
606 | status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 ); | |
607 | if (status[4] != RTEMS_SUCCESSFUL) |
|
607 | if (status[4] != RTEMS_SUCCESSFUL) | |
608 | { |
|
608 | { | |
609 | PRINTF1("in restart_science_task *** CWF2 ERR %d\n", status[4]) |
|
609 | PRINTF1("in restart_science_task *** CWF2 ERR %d\n", status[4]) | |
610 | } |
|
610 | } | |
611 |
|
611 | |||
612 | status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 ); |
|
612 | status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 ); | |
613 | if (status[5] != RTEMS_SUCCESSFUL) |
|
613 | if (status[5] != RTEMS_SUCCESSFUL) | |
614 | { |
|
614 | { | |
615 | PRINTF1("in restart_science_task *** CWF1 ERR %d\n", status[5]) |
|
615 | PRINTF1("in restart_science_task *** CWF1 ERR %d\n", status[5]) | |
616 | } |
|
616 | } | |
617 |
|
617 | |||
618 | status[6] = rtems_task_restart( Task_id[TASKID_AVF1], lfrRequestedMode ); |
|
618 | status[6] = rtems_task_restart( Task_id[TASKID_AVF1], lfrRequestedMode ); | |
619 | if (status[6] != RTEMS_SUCCESSFUL) |
|
619 | if (status[6] != RTEMS_SUCCESSFUL) | |
620 | { |
|
620 | { | |
621 | PRINTF1("in restart_science_task *** AVF1 ERR %d\n", status[6]) |
|
621 | PRINTF1("in restart_science_task *** AVF1 ERR %d\n", status[6]) | |
622 | } |
|
622 | } | |
623 |
|
623 | |||
624 | status[7] = rtems_task_restart( Task_id[TASKID_PRC1],lfrRequestedMode ); |
|
624 | status[7] = rtems_task_restart( Task_id[TASKID_PRC1],lfrRequestedMode ); | |
625 | if (status[7] != RTEMS_SUCCESSFUL) |
|
625 | if (status[7] != RTEMS_SUCCESSFUL) | |
626 | { |
|
626 | { | |
627 | PRINTF1("in restart_science_task *** PRC1 ERR %d\n", status[7]) |
|
627 | PRINTF1("in restart_science_task *** PRC1 ERR %d\n", status[7]) | |
628 | } |
|
628 | } | |
629 |
|
629 | |||
630 | status[8] = rtems_task_restart( Task_id[TASKID_AVF2], 1 ); |
|
630 | status[8] = rtems_task_restart( Task_id[TASKID_AVF2], 1 ); | |
631 | if (status[8] != RTEMS_SUCCESSFUL) |
|
631 | if (status[8] != RTEMS_SUCCESSFUL) | |
632 | { |
|
632 | { | |
633 | PRINTF1("in restart_science_task *** AVF2 ERR %d\n", status[8]) |
|
633 | PRINTF1("in restart_science_task *** AVF2 ERR %d\n", status[8]) | |
634 | } |
|
634 | } | |
635 |
|
635 | |||
636 | status[9] = rtems_task_restart( Task_id[TASKID_PRC2], 1 ); |
|
636 | status[9] = rtems_task_restart( Task_id[TASKID_PRC2], 1 ); | |
637 | if (status[9] != RTEMS_SUCCESSFUL) |
|
637 | if (status[9] != RTEMS_SUCCESSFUL) | |
638 | { |
|
638 | { | |
639 | PRINTF1("in restart_science_task *** PRC2 ERR %d\n", status[9]) |
|
639 | PRINTF1("in restart_science_task *** PRC2 ERR %d\n", status[9]) | |
640 | } |
|
640 | } | |
641 |
|
641 | |||
642 | if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) || |
|
642 | if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) || | |
643 | (status[2] != RTEMS_SUCCESSFUL) || (status[3] != RTEMS_SUCCESSFUL) || |
|
643 | (status[2] != RTEMS_SUCCESSFUL) || (status[3] != RTEMS_SUCCESSFUL) || | |
644 | (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) || |
|
644 | (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) || | |
645 | (status[6] != RTEMS_SUCCESSFUL) || (status[7] != RTEMS_SUCCESSFUL) || |
|
645 | (status[6] != RTEMS_SUCCESSFUL) || (status[7] != RTEMS_SUCCESSFUL) || | |
646 | (status[8] != RTEMS_SUCCESSFUL) || (status[9] != RTEMS_SUCCESSFUL) ) |
|
646 | (status[8] != RTEMS_SUCCESSFUL) || (status[9] != RTEMS_SUCCESSFUL) ) | |
647 | { |
|
647 | { | |
648 | ret = RTEMS_UNSATISFIED; |
|
648 | ret = RTEMS_UNSATISFIED; | |
649 | } |
|
649 | } | |
650 |
|
650 | |||
651 | return ret; |
|
651 | return ret; | |
652 | } |
|
652 | } | |
653 |
|
653 | |||
654 | int suspend_science_tasks() |
|
654 | int suspend_science_tasks() | |
655 | { |
|
655 | { | |
656 | /** This function suspends the science tasks. |
|
656 | /** This function suspends the science tasks. | |
657 | * |
|
657 | * | |
658 | * @return RTEMS directive status codes: |
|
658 | * @return RTEMS directive status codes: | |
659 | * - RTEMS_SUCCESSFUL - task restarted successfully |
|
659 | * - RTEMS_SUCCESSFUL - task restarted successfully | |
660 | * - RTEMS_INVALID_ID - task id invalid |
|
660 | * - RTEMS_INVALID_ID - task id invalid | |
661 | * - RTEMS_ALREADY_SUSPENDED - task already suspended |
|
661 | * - RTEMS_ALREADY_SUSPENDED - task already suspended | |
662 | * |
|
662 | * | |
663 | */ |
|
663 | */ | |
664 |
|
664 | |||
665 | rtems_status_code status; |
|
665 | rtems_status_code status; | |
666 |
|
666 | |||
667 | status = rtems_task_suspend( Task_id[TASKID_AVF0] ); // suspend AVF0 |
|
667 | status = rtems_task_suspend( Task_id[TASKID_AVF0] ); // suspend AVF0 | |
668 | if (status != RTEMS_SUCCESSFUL) |
|
668 | if (status != RTEMS_SUCCESSFUL) | |
669 | { |
|
669 | { | |
670 | PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status) |
|
670 | PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status) | |
671 | } |
|
671 | } | |
672 | if (status == RTEMS_SUCCESSFUL) // suspend PRC0 |
|
672 | if (status == RTEMS_SUCCESSFUL) // suspend PRC0 | |
673 | { |
|
673 | { | |
674 | status = rtems_task_suspend( Task_id[TASKID_PRC0] ); |
|
674 | status = rtems_task_suspend( Task_id[TASKID_PRC0] ); | |
675 | if (status != RTEMS_SUCCESSFUL) |
|
675 | if (status != RTEMS_SUCCESSFUL) | |
676 | { |
|
676 | { | |
677 | PRINTF1("in suspend_science_task *** PRC0 ERR %d\n", status) |
|
677 | PRINTF1("in suspend_science_task *** PRC0 ERR %d\n", status) | |
678 | } |
|
678 | } | |
679 | } |
|
679 | } | |
680 | if (status == RTEMS_SUCCESSFUL) // suspend AVF1 |
|
680 | if (status == RTEMS_SUCCESSFUL) // suspend AVF1 | |
681 | { |
|
681 | { | |
682 | status = rtems_task_suspend( Task_id[TASKID_AVF1] ); |
|
682 | status = rtems_task_suspend( Task_id[TASKID_AVF1] ); | |
683 | if (status != RTEMS_SUCCESSFUL) |
|
683 | if (status != RTEMS_SUCCESSFUL) | |
684 | { |
|
684 | { | |
685 | PRINTF1("in suspend_science_task *** AVF1 ERR %d\n", status) |
|
685 | PRINTF1("in suspend_science_task *** AVF1 ERR %d\n", status) | |
686 | } |
|
686 | } | |
687 | } |
|
687 | } | |
688 | if (status == RTEMS_SUCCESSFUL) // suspend PRC1 |
|
688 | if (status == RTEMS_SUCCESSFUL) // suspend PRC1 | |
689 | { |
|
689 | { | |
690 | status = rtems_task_suspend( Task_id[TASKID_PRC1] ); |
|
690 | status = rtems_task_suspend( Task_id[TASKID_PRC1] ); | |
691 | if (status != RTEMS_SUCCESSFUL) |
|
691 | if (status != RTEMS_SUCCESSFUL) | |
692 | { |
|
692 | { | |
693 | PRINTF1("in suspend_science_task *** PRC1 ERR %d\n", status) |
|
693 | PRINTF1("in suspend_science_task *** PRC1 ERR %d\n", status) | |
694 | } |
|
694 | } | |
695 | } |
|
695 | } | |
696 | if (status == RTEMS_SUCCESSFUL) // suspend AVF2 |
|
696 | if (status == RTEMS_SUCCESSFUL) // suspend AVF2 | |
697 | { |
|
697 | { | |
698 | status = rtems_task_suspend( Task_id[TASKID_AVF2] ); |
|
698 | status = rtems_task_suspend( Task_id[TASKID_AVF2] ); | |
699 | if (status != RTEMS_SUCCESSFUL) |
|
699 | if (status != RTEMS_SUCCESSFUL) | |
700 | { |
|
700 | { | |
701 | PRINTF1("in suspend_science_task *** AVF2 ERR %d\n", status) |
|
701 | PRINTF1("in suspend_science_task *** AVF2 ERR %d\n", status) | |
702 | } |
|
702 | } | |
703 | } |
|
703 | } | |
704 | if (status == RTEMS_SUCCESSFUL) // suspend PRC2 |
|
704 | if (status == RTEMS_SUCCESSFUL) // suspend PRC2 | |
705 | { |
|
705 | { | |
706 | status = rtems_task_suspend( Task_id[TASKID_PRC2] ); |
|
706 | status = rtems_task_suspend( Task_id[TASKID_PRC2] ); | |
707 | if (status != RTEMS_SUCCESSFUL) |
|
707 | if (status != RTEMS_SUCCESSFUL) | |
708 | { |
|
708 | { | |
709 | PRINTF1("in suspend_science_task *** PRC2 ERR %d\n", status) |
|
709 | PRINTF1("in suspend_science_task *** PRC2 ERR %d\n", status) | |
710 | } |
|
710 | } | |
711 | } |
|
711 | } | |
712 | if (status == RTEMS_SUCCESSFUL) // suspend WFRM |
|
712 | if (status == RTEMS_SUCCESSFUL) // suspend WFRM | |
713 | { |
|
713 | { | |
714 | status = rtems_task_suspend( Task_id[TASKID_WFRM] ); |
|
714 | status = rtems_task_suspend( Task_id[TASKID_WFRM] ); | |
715 | if (status != RTEMS_SUCCESSFUL) |
|
715 | if (status != RTEMS_SUCCESSFUL) | |
716 | { |
|
716 | { | |
717 | PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status) |
|
717 | PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status) | |
718 | } |
|
718 | } | |
719 | } |
|
719 | } | |
720 | if (status == RTEMS_SUCCESSFUL) // suspend CWF3 |
|
720 | if (status == RTEMS_SUCCESSFUL) // suspend CWF3 | |
721 | { |
|
721 | { | |
722 | status = rtems_task_suspend( Task_id[TASKID_CWF3] ); |
|
722 | status = rtems_task_suspend( Task_id[TASKID_CWF3] ); | |
723 | if (status != RTEMS_SUCCESSFUL) |
|
723 | if (status != RTEMS_SUCCESSFUL) | |
724 | { |
|
724 | { | |
725 | PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status) |
|
725 | PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status) | |
726 | } |
|
726 | } | |
727 | } |
|
727 | } | |
728 | if (status == RTEMS_SUCCESSFUL) // suspend CWF2 |
|
728 | if (status == RTEMS_SUCCESSFUL) // suspend CWF2 | |
729 | { |
|
729 | { | |
730 | status = rtems_task_suspend( Task_id[TASKID_CWF2] ); |
|
730 | status = rtems_task_suspend( Task_id[TASKID_CWF2] ); | |
731 | if (status != RTEMS_SUCCESSFUL) |
|
731 | if (status != RTEMS_SUCCESSFUL) | |
732 | { |
|
732 | { | |
733 | PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status) |
|
733 | PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status) | |
734 | } |
|
734 | } | |
735 | } |
|
735 | } | |
736 | if (status == RTEMS_SUCCESSFUL) // suspend CWF1 |
|
736 | if (status == RTEMS_SUCCESSFUL) // suspend CWF1 | |
737 | { |
|
737 | { | |
738 | status = rtems_task_suspend( Task_id[TASKID_CWF1] ); |
|
738 | status = rtems_task_suspend( Task_id[TASKID_CWF1] ); | |
739 | if (status != RTEMS_SUCCESSFUL) |
|
739 | if (status != RTEMS_SUCCESSFUL) | |
740 | { |
|
740 | { | |
741 | PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status) |
|
741 | PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status) | |
742 | } |
|
742 | } | |
743 | } |
|
743 | } | |
744 |
|
744 | |||
745 | return status; |
|
745 | return status; | |
746 | } |
|
746 | } | |
747 |
|
747 | |||
748 | void launch_waveform_picker( unsigned char mode, unsigned int transitionCoarseTime ) |
|
748 | void launch_waveform_picker( unsigned char mode, unsigned int transitionCoarseTime ) | |
749 | { |
|
749 | { | |
750 | WFP_reset_current_ring_nodes(); |
|
750 | WFP_reset_current_ring_nodes(); | |
751 | reset_waveform_picker_regs(); |
|
751 | reset_waveform_picker_regs(); | |
752 | set_wfp_burst_enable_register( mode ); |
|
752 | set_wfp_burst_enable_register( mode ); | |
753 |
|
753 | |||
754 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); |
|
754 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); | |
755 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); |
|
755 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); | |
756 |
|
756 | |||
757 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x80; // [1000 0000] |
|
757 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x80; // [1000 0000] | |
758 | if (transitionCoarseTime == 0) |
|
758 | if (transitionCoarseTime == 0) | |
759 | { |
|
759 | { | |
760 | waveform_picker_regs->start_date = time_management_regs->coarse_time; |
|
760 | waveform_picker_regs->start_date = time_management_regs->coarse_time; | |
761 | } |
|
761 | } | |
762 | else |
|
762 | else | |
763 | { |
|
763 | { | |
764 | waveform_picker_regs->start_date = transitionCoarseTime; |
|
764 | waveform_picker_regs->start_date = transitionCoarseTime; | |
765 | } |
|
765 | } | |
766 |
|
766 | |||
767 | PRINTF1("commutation coarse time = %d\n", transitionCoarseTime) |
|
767 | PRINTF1("commutation coarse time = %d\n", transitionCoarseTime) | |
768 | } |
|
768 | } | |
769 |
|
769 | |||
770 | void launch_spectral_matrix( void ) |
|
770 | void launch_spectral_matrix( void ) | |
771 | { |
|
771 | { | |
772 | SM_reset_current_ring_nodes(); |
|
772 | SM_reset_current_ring_nodes(); | |
773 | reset_spectral_matrix_regs(); |
|
773 | reset_spectral_matrix_regs(); | |
774 | reset_nb_sm(); |
|
774 | reset_nb_sm(); | |
775 |
|
775 | |||
776 | struct grgpio_regs_str *grgpio_regs = (struct grgpio_regs_str *) REGS_ADDR_GRGPIO; |
|
776 | struct grgpio_regs_str *grgpio_regs = (struct grgpio_regs_str *) REGS_ADDR_GRGPIO; | |
777 | grgpio_regs->io_port_direction_register = |
|
777 | grgpio_regs->io_port_direction_register = | |
778 | grgpio_regs->io_port_direction_register | 0x01; // [0000 0001], 0 = output disabled, 1 = output enabled |
|
778 | grgpio_regs->io_port_direction_register | 0x01; // [0000 0001], 0 = output disabled, 1 = output enabled | |
779 | grgpio_regs->io_port_output_register = grgpio_regs->io_port_output_register & 0xfffffffe; // set the bit 0 to 0 |
|
779 | grgpio_regs->io_port_output_register = grgpio_regs->io_port_output_register & 0xfffffffe; // set the bit 0 to 0 | |
780 | set_irq_on_new_ready_matrix( 1 ); |
|
780 | set_irq_on_new_ready_matrix( 1 ); | |
781 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); |
|
781 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); | |
782 | LEON_Unmask_interrupt( IRQ_SPECTRAL_MATRIX ); |
|
782 | LEON_Unmask_interrupt( IRQ_SPECTRAL_MATRIX ); | |
783 | set_run_matrix_spectral( 1 ); |
|
783 | set_run_matrix_spectral( 1 ); | |
784 | } |
|
784 | } | |
785 |
|
785 | |||
786 | void launch_spectral_matrix_simu( void ) |
|
786 | void launch_spectral_matrix_simu( void ) | |
787 | { |
|
787 | { | |
788 | SM_reset_current_ring_nodes(); |
|
788 | SM_reset_current_ring_nodes(); | |
789 | reset_spectral_matrix_regs(); |
|
789 | reset_spectral_matrix_regs(); | |
790 | reset_nb_sm(); |
|
790 | reset_nb_sm(); | |
791 |
|
791 | |||
792 | // Spectral Matrices simulator |
|
792 | // Spectral Matrices simulator | |
793 | timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); |
|
793 | timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); | |
794 | LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); |
|
794 | LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); | |
795 | LEON_Unmask_interrupt( IRQ_SM_SIMULATOR ); |
|
795 | LEON_Unmask_interrupt( IRQ_SM_SIMULATOR ); | |
796 | } |
|
796 | } | |
797 |
|
797 | |||
798 | void set_irq_on_new_ready_matrix( unsigned char value ) |
|
798 | void set_irq_on_new_ready_matrix( unsigned char value ) | |
799 | { |
|
799 | { | |
800 | if (value == 1) |
|
800 | if (value == 1) | |
801 | { |
|
801 | { | |
802 | spectral_matrix_regs->config = spectral_matrix_regs->config | 0x01; |
|
802 | spectral_matrix_regs->config = spectral_matrix_regs->config | 0x01; | |
803 | } |
|
803 | } | |
804 | else |
|
804 | else | |
805 | { |
|
805 | { | |
806 | spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffe; // 1110 |
|
806 | spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffe; // 1110 | |
807 | } |
|
807 | } | |
808 | } |
|
808 | } | |
809 |
|
809 | |||
810 | void set_run_matrix_spectral( unsigned char value ) |
|
810 | void set_run_matrix_spectral( unsigned char value ) | |
811 | { |
|
811 | { | |
812 | if (value == 1) |
|
812 | if (value == 1) | |
813 | { |
|
813 | { | |
814 | spectral_matrix_regs->config = spectral_matrix_regs->config | 0x4; // [0100] set run_matrix spectral to 1 |
|
814 | spectral_matrix_regs->config = spectral_matrix_regs->config | 0x4; // [0100] set run_matrix spectral to 1 | |
815 | } |
|
815 | } | |
816 | else |
|
816 | else | |
817 | { |
|
817 | { | |
818 | spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffb; // [1011] set run_matrix spectral to 0 |
|
818 | spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffb; // [1011] set run_matrix spectral to 0 | |
819 | } |
|
819 | } | |
820 | } |
|
820 | } | |
821 |
|
821 | |||
822 | //**************** |
|
822 | //**************** | |
823 | // CLOSING ACTIONS |
|
823 | // CLOSING ACTIONS | |
824 | void update_last_TC_exe( ccsdsTelecommandPacket_t *TC, unsigned char * time ) |
|
824 | void update_last_TC_exe( ccsdsTelecommandPacket_t *TC, unsigned char * time ) | |
825 | { |
|
825 | { | |
826 | /** This function is used to update the HK packets statistics after a successful TC execution. |
|
826 | /** This function is used to update the HK packets statistics after a successful TC execution. | |
827 | * |
|
827 | * | |
828 | * @param TC points to the TC being processed |
|
828 | * @param TC points to the TC being processed | |
829 | * @param time is the time used to date the TC execution |
|
829 | * @param time is the time used to date the TC execution | |
830 | * |
|
830 | * | |
831 | */ |
|
831 | */ | |
832 |
|
832 | |||
833 | unsigned int val; |
|
833 | unsigned int val; | |
834 |
|
834 | |||
835 | housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0]; |
|
835 | housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0]; | |
836 | housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1]; |
|
836 | housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1]; | |
837 | housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00; |
|
837 | housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00; | |
838 | housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType; |
|
838 | housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType; | |
839 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00; |
|
839 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00; | |
840 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType; |
|
840 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType; | |
841 | housekeeping_packet.hk_lfr_last_exe_tc_time[0] = time[0]; |
|
841 | housekeeping_packet.hk_lfr_last_exe_tc_time[0] = time[0]; | |
842 | housekeeping_packet.hk_lfr_last_exe_tc_time[1] = time[1]; |
|
842 | housekeeping_packet.hk_lfr_last_exe_tc_time[1] = time[1]; | |
843 | housekeeping_packet.hk_lfr_last_exe_tc_time[2] = time[2]; |
|
843 | housekeeping_packet.hk_lfr_last_exe_tc_time[2] = time[2]; | |
844 | housekeeping_packet.hk_lfr_last_exe_tc_time[3] = time[3]; |
|
844 | housekeeping_packet.hk_lfr_last_exe_tc_time[3] = time[3]; | |
845 | housekeeping_packet.hk_lfr_last_exe_tc_time[4] = time[4]; |
|
845 | housekeeping_packet.hk_lfr_last_exe_tc_time[4] = time[4]; | |
846 | housekeeping_packet.hk_lfr_last_exe_tc_time[5] = time[5]; |
|
846 | housekeeping_packet.hk_lfr_last_exe_tc_time[5] = time[5]; | |
847 |
|
847 | |||
848 | val = housekeeping_packet.hk_lfr_exe_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_exe_tc_cnt[1]; |
|
848 | val = housekeeping_packet.hk_lfr_exe_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_exe_tc_cnt[1]; | |
849 | val++; |
|
849 | val++; | |
850 | housekeeping_packet.hk_lfr_exe_tc_cnt[0] = (unsigned char) (val >> 8); |
|
850 | housekeeping_packet.hk_lfr_exe_tc_cnt[0] = (unsigned char) (val >> 8); | |
851 | housekeeping_packet.hk_lfr_exe_tc_cnt[1] = (unsigned char) (val); |
|
851 | housekeeping_packet.hk_lfr_exe_tc_cnt[1] = (unsigned char) (val); | |
852 | } |
|
852 | } | |
853 |
|
853 | |||
854 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char * time ) |
|
854 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char * time ) | |
855 | { |
|
855 | { | |
856 | /** This function is used to update the HK packets statistics after a TC rejection. |
|
856 | /** This function is used to update the HK packets statistics after a TC rejection. | |
857 | * |
|
857 | * | |
858 | * @param TC points to the TC being processed |
|
858 | * @param TC points to the TC being processed | |
859 | * @param time is the time used to date the TC rejection |
|
859 | * @param time is the time used to date the TC rejection | |
860 | * |
|
860 | * | |
861 | */ |
|
861 | */ | |
862 |
|
862 | |||
863 | unsigned int val; |
|
863 | unsigned int val; | |
864 |
|
864 | |||
865 | housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0]; |
|
865 | housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0]; | |
866 | housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1]; |
|
866 | housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1]; | |
867 | housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00; |
|
867 | housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00; | |
868 | housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType; |
|
868 | housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType; | |
869 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00; |
|
869 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00; | |
870 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType; |
|
870 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType; | |
871 | housekeeping_packet.hk_lfr_last_rej_tc_time[0] = time[0]; |
|
871 | housekeeping_packet.hk_lfr_last_rej_tc_time[0] = time[0]; | |
872 | housekeeping_packet.hk_lfr_last_rej_tc_time[1] = time[1]; |
|
872 | housekeeping_packet.hk_lfr_last_rej_tc_time[1] = time[1]; | |
873 | housekeeping_packet.hk_lfr_last_rej_tc_time[2] = time[2]; |
|
873 | housekeeping_packet.hk_lfr_last_rej_tc_time[2] = time[2]; | |
874 | housekeeping_packet.hk_lfr_last_rej_tc_time[3] = time[3]; |
|
874 | housekeeping_packet.hk_lfr_last_rej_tc_time[3] = time[3]; | |
875 | housekeeping_packet.hk_lfr_last_rej_tc_time[4] = time[4]; |
|
875 | housekeeping_packet.hk_lfr_last_rej_tc_time[4] = time[4]; | |
876 | housekeeping_packet.hk_lfr_last_rej_tc_time[5] = time[5]; |
|
876 | housekeeping_packet.hk_lfr_last_rej_tc_time[5] = time[5]; | |
877 |
|
877 | |||
878 | val = housekeeping_packet.hk_lfr_rej_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_rej_tc_cnt[1]; |
|
878 | val = housekeeping_packet.hk_lfr_rej_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_rej_tc_cnt[1]; | |
879 | val++; |
|
879 | val++; | |
880 | housekeeping_packet.hk_lfr_rej_tc_cnt[0] = (unsigned char) (val >> 8); |
|
880 | housekeeping_packet.hk_lfr_rej_tc_cnt[0] = (unsigned char) (val >> 8); | |
881 | housekeeping_packet.hk_lfr_rej_tc_cnt[1] = (unsigned char) (val); |
|
881 | housekeeping_packet.hk_lfr_rej_tc_cnt[1] = (unsigned char) (val); | |
882 | } |
|
882 | } | |
883 |
|
883 | |||
884 | void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id ) |
|
884 | void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id ) | |
885 | { |
|
885 | { | |
886 | /** This function is the last step of the TC execution workflow. |
|
886 | /** This function is the last step of the TC execution workflow. | |
887 | * |
|
887 | * | |
888 | * @param TC points to the TC being processed |
|
888 | * @param TC points to the TC being processed | |
889 | * @param result is the result of the TC execution (LFR_SUCCESSFUL / LFR_DEFAULT) |
|
889 | * @param result is the result of the TC execution (LFR_SUCCESSFUL / LFR_DEFAULT) | |
890 | * @param queue_id is the id of the RTEMS message queue used to send TM packets |
|
890 | * @param queue_id is the id of the RTEMS message queue used to send TM packets | |
891 | * @param time is the time used to date the TC execution |
|
891 | * @param time is the time used to date the TC execution | |
892 | * |
|
892 | * | |
893 | */ |
|
893 | */ | |
894 |
|
894 | |||
895 | unsigned char requestedMode; |
|
895 | unsigned char requestedMode; | |
896 |
|
896 | |||
897 | if (result == LFR_SUCCESSFUL) |
|
897 | if (result == LFR_SUCCESSFUL) | |
898 | { |
|
898 | { | |
899 | if ( !( (TC->serviceType==TC_TYPE_TIME) & (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) ) |
|
899 | if ( !( (TC->serviceType==TC_TYPE_TIME) & (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) ) | |
900 | & |
|
900 | & | |
901 | !( (TC->serviceType==TC_TYPE_GEN) & (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO)) |
|
901 | !( (TC->serviceType==TC_TYPE_GEN) & (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO)) | |
902 | ) |
|
902 | ) | |
903 | { |
|
903 | { | |
904 | send_tm_lfr_tc_exe_success( TC, queue_id ); |
|
904 | send_tm_lfr_tc_exe_success( TC, queue_id ); | |
905 | } |
|
905 | } | |
906 | if ( (TC->serviceType == TC_TYPE_GEN) & (TC->serviceSubType == TC_SUBTYPE_ENTER) ) |
|
906 | if ( (TC->serviceType == TC_TYPE_GEN) & (TC->serviceSubType == TC_SUBTYPE_ENTER) ) | |
907 | { |
|
907 | { | |
908 | //********************************** |
|
908 | //********************************** | |
909 | // UPDATE THE LFRMODE LOCAL VARIABLE |
|
909 | // UPDATE THE LFRMODE LOCAL VARIABLE | |
910 | requestedMode = TC->dataAndCRC[1]; |
|
910 | requestedMode = TC->dataAndCRC[1]; | |
911 | housekeeping_packet.lfr_status_word[0] = (unsigned char) ((requestedMode << 4) + 0x0d); |
|
911 | housekeeping_packet.lfr_status_word[0] = (unsigned char) ((requestedMode << 4) + 0x0d); | |
912 | updateLFRCurrentMode(); |
|
912 | updateLFRCurrentMode(); | |
913 | } |
|
913 | } | |
914 | } |
|
914 | } | |
915 | else if (result == LFR_EXE_ERROR) |
|
915 | else if (result == LFR_EXE_ERROR) | |
916 | { |
|
916 | { | |
917 | send_tm_lfr_tc_exe_error( TC, queue_id ); |
|
917 | send_tm_lfr_tc_exe_error( TC, queue_id ); | |
918 | } |
|
918 | } | |
919 | } |
|
919 | } | |
920 |
|
920 | |||
921 | //*************************** |
|
921 | //*************************** | |
922 | // Interrupt Service Routines |
|
922 | // Interrupt Service Routines | |
923 | rtems_isr commutation_isr1( rtems_vector_number vector ) |
|
923 | rtems_isr commutation_isr1( rtems_vector_number vector ) | |
924 | { |
|
924 | { | |
925 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
925 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { | |
926 | printf("In commutation_isr1 *** Error sending event to DUMB\n"); |
|
926 | printf("In commutation_isr1 *** Error sending event to DUMB\n"); | |
927 | } |
|
927 | } | |
928 | } |
|
928 | } | |
929 |
|
929 | |||
930 | rtems_isr commutation_isr2( rtems_vector_number vector ) |
|
930 | rtems_isr commutation_isr2( rtems_vector_number vector ) | |
931 | { |
|
931 | { | |
932 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
932 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { | |
933 | printf("In commutation_isr2 *** Error sending event to DUMB\n"); |
|
933 | printf("In commutation_isr2 *** Error sending event to DUMB\n"); | |
934 | } |
|
934 | } | |
935 | } |
|
935 | } | |
936 |
|
936 | |||
937 | //**************** |
|
937 | //**************** | |
938 | // OTHER FUNCTIONS |
|
938 | // OTHER FUNCTIONS | |
939 | void updateLFRCurrentMode() |
|
939 | void updateLFRCurrentMode() | |
940 | { |
|
940 | { | |
941 | /** This function updates the value of the global variable lfrCurrentMode. |
|
941 | /** This function updates the value of the global variable lfrCurrentMode. | |
942 | * |
|
942 | * | |
943 | * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running. |
|
943 | * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running. | |
944 | * |
|
944 | * | |
945 | */ |
|
945 | */ | |
946 | // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure |
|
946 | // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure | |
947 | lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
947 | lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
948 | } |
|
948 | } | |
949 |
|
949 |
@@ -1,1367 +1,1489 | |||||
1 | /** Functions and tasks related to waveform packet generation. |
|
1 | /** Functions and tasks related to waveform packet generation. | |
2 | * |
|
2 | * | |
3 | * @file |
|
3 | * @file | |
4 | * @author P. LEROY |
|
4 | * @author P. LEROY | |
5 | * |
|
5 | * | |
6 | * A group of functions to handle waveforms, in snapshot or continuous format.\n |
|
6 | * A group of functions to handle waveforms, in snapshot or continuous format.\n | |
7 | * |
|
7 | * | |
8 | */ |
|
8 | */ | |
9 |
|
9 | |||
10 | #include "wf_handler.h" |
|
10 | #include "wf_handler.h" | |
11 |
|
11 | |||
12 | //***************** |
|
12 | //***************** | |
13 | // waveform headers |
|
13 | // waveform headers | |
14 | // SWF |
|
14 | // SWF | |
15 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F0[7]; |
|
15 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F0[7]; | |
16 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F1[7]; |
|
16 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F1[7]; | |
17 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F2[7]; |
|
17 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F2[7]; | |
18 | // CWF |
|
18 | // CWF | |
19 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F1[ NB_PACKETS_PER_GROUP_OF_CWF ]; |
|
19 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F1[ NB_PACKETS_PER_GROUP_OF_CWF ]; | |
20 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_BURST[ NB_PACKETS_PER_GROUP_OF_CWF ]; |
|
20 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_BURST[ NB_PACKETS_PER_GROUP_OF_CWF ]; | |
21 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_SBM2[ NB_PACKETS_PER_GROUP_OF_CWF ]; |
|
21 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_SBM2[ NB_PACKETS_PER_GROUP_OF_CWF ]; | |
22 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3[ NB_PACKETS_PER_GROUP_OF_CWF ]; |
|
22 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3[ NB_PACKETS_PER_GROUP_OF_CWF ]; | |
23 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3_light[ NB_PACKETS_PER_GROUP_OF_CWF_LIGHT ]; |
|
23 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3_light[ NB_PACKETS_PER_GROUP_OF_CWF_LIGHT ]; | |
24 |
|
24 | |||
25 | //************** |
|
25 | //************** | |
26 | // waveform ring |
|
26 | // waveform ring | |
27 | ring_node waveform_ring_f0[NB_RING_NODES_F0]; |
|
27 | ring_node waveform_ring_f0[NB_RING_NODES_F0]; | |
28 | ring_node waveform_ring_f1[NB_RING_NODES_F1]; |
|
28 | ring_node waveform_ring_f1[NB_RING_NODES_F1]; | |
29 | ring_node waveform_ring_f2[NB_RING_NODES_F2]; |
|
29 | ring_node waveform_ring_f2[NB_RING_NODES_F2]; | |
30 | ring_node waveform_ring_f3[NB_RING_NODES_F3]; |
|
30 | ring_node waveform_ring_f3[NB_RING_NODES_F3]; | |
31 | ring_node *current_ring_node_f0; |
|
31 | ring_node *current_ring_node_f0; | |
32 | ring_node *ring_node_to_send_swf_f0; |
|
32 | ring_node *ring_node_to_send_swf_f0; | |
33 | ring_node *current_ring_node_f1; |
|
33 | ring_node *current_ring_node_f1; | |
34 | ring_node *ring_node_to_send_swf_f1; |
|
34 | ring_node *ring_node_to_send_swf_f1; | |
35 | ring_node *ring_node_to_send_cwf_f1; |
|
35 | ring_node *ring_node_to_send_cwf_f1; | |
36 | ring_node *current_ring_node_f2; |
|
36 | ring_node *current_ring_node_f2; | |
37 | ring_node *ring_node_to_send_swf_f2; |
|
37 | ring_node *ring_node_to_send_swf_f2; | |
38 | ring_node *ring_node_to_send_cwf_f2; |
|
38 | ring_node *ring_node_to_send_cwf_f2; | |
39 | ring_node *current_ring_node_f3; |
|
39 | ring_node *current_ring_node_f3; | |
40 | ring_node *ring_node_to_send_cwf_f3; |
|
40 | ring_node *ring_node_to_send_cwf_f3; | |
41 |
|
41 | |||
42 | bool extractSWF = false; |
|
42 | bool extractSWF = false; | |
43 | bool swf_f0_ready = false; |
|
43 | bool swf_f0_ready = false; | |
44 | bool swf_f1_ready = false; |
|
44 | bool swf_f1_ready = false; | |
45 | bool swf_f2_ready = false; |
|
45 | bool swf_f2_ready = false; | |
46 |
|
46 | |||
47 | int wf_snap_extracted[ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET ]; |
|
47 | int wf_snap_extracted[ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET ]; | |
48 |
|
48 | |||
49 | //********************* |
|
49 | //********************* | |
50 | // Interrupt SubRoutine |
|
50 | // Interrupt SubRoutine | |
51 |
|
51 | |||
52 | void reset_extractSWF( void ) |
|
52 | void reset_extractSWF( void ) | |
53 | { |
|
53 | { | |
54 | extractSWF = false; |
|
54 | extractSWF = false; | |
55 | swf_f0_ready = false; |
|
55 | swf_f0_ready = false; | |
56 | swf_f1_ready = false; |
|
56 | swf_f1_ready = false; | |
57 | swf_f2_ready = false; |
|
57 | swf_f2_ready = false; | |
58 | } |
|
58 | } | |
59 |
|
59 | |||
|
60 | void change_f0_buffer( void ) | |||
|
61 | { | |||
|
62 | ring_node_to_send_swf_f0 = current_ring_node_f0; | |||
|
63 | current_ring_node_f0 = current_ring_node_f0->next; | |||
|
64 | if ( (waveform_picker_regs->status & 0x01) == 0x01) | |||
|
65 | { | |||
|
66 | ring_node_to_send_swf_f0->coarseTime = waveform_picker_regs->f0_0_coarse_time; | |||
|
67 | ring_node_to_send_swf_f0->fineTime = waveform_picker_regs->f0_0_fine_time; | |||
|
68 | waveform_picker_regs->addr_data_f0_0 = current_ring_node_f0->buffer_address; | |||
|
69 | } | |||
|
70 | else if ( (waveform_picker_regs->status & 0x02) == 0x02) | |||
|
71 | { | |||
|
72 | ring_node_to_send_swf_f0->coarseTime = waveform_picker_regs->f0_1_coarse_time; | |||
|
73 | ring_node_to_send_swf_f0->fineTime = waveform_picker_regs->f0_1_fine_time; | |||
|
74 | waveform_picker_regs->addr_data_f0_1 = current_ring_node_f0->buffer_address; | |||
|
75 | } | |||
|
76 | } | |||
|
77 | ||||
|
78 | void change_f1_buffer( ring_node *ring_node_to_send ) | |||
|
79 | { | |||
|
80 | ring_node_to_send = current_ring_node_f1; | |||
|
81 | current_ring_node_f1 = current_ring_node_f1->next; | |||
|
82 | if ( (waveform_picker_regs->status & 0x04) == 0x04) | |||
|
83 | { | |||
|
84 | ring_node_to_send->coarseTime = waveform_picker_regs->f1_0_coarse_time; | |||
|
85 | ring_node_to_send->fineTime = waveform_picker_regs->f1_0_fine_time; | |||
|
86 | waveform_picker_regs->addr_data_f1_0 = current_ring_node_f1->buffer_address; | |||
|
87 | } | |||
|
88 | else if ( (waveform_picker_regs->status & 0x08) == 0x08) | |||
|
89 | { | |||
|
90 | ring_node_to_send->coarseTime = waveform_picker_regs->f1_1_coarse_time; | |||
|
91 | ring_node_to_send->fineTime = waveform_picker_regs->f1_1_fine_time; | |||
|
92 | waveform_picker_regs->addr_data_f1_1 = current_ring_node_f1->buffer_address; | |||
|
93 | } | |||
|
94 | } | |||
|
95 | ||||
|
96 | void change_f2_buffer( ring_node *ring_node_to_send ) | |||
|
97 | { | |||
|
98 | ring_node_to_send = current_ring_node_f2; | |||
|
99 | current_ring_node_f2 = current_ring_node_f2->next; | |||
|
100 | if ( (waveform_picker_regs->status & 0x10) == 0x10) | |||
|
101 | { | |||
|
102 | ring_node_to_send->coarseTime = waveform_picker_regs->f2_0_coarse_time; | |||
|
103 | ring_node_to_send->fineTime = waveform_picker_regs->f2_0_fine_time; | |||
|
104 | waveform_picker_regs->addr_data_f2_0 = current_ring_node_f2->buffer_address; | |||
|
105 | } | |||
|
106 | else if ( (waveform_picker_regs->status & 0x20) == 0x20) | |||
|
107 | { | |||
|
108 | ring_node_to_send->coarseTime = waveform_picker_regs->f2_1_coarse_time; | |||
|
109 | ring_node_to_send->fineTime = waveform_picker_regs->f2_1_fine_time; | |||
|
110 | waveform_picker_regs->addr_data_f2_1 = current_ring_node_f2->buffer_address; | |||
|
111 | } | |||
|
112 | } | |||
|
113 | ||||
|
114 | void waveforms_isr_f3( void ) | |||
|
115 | { | |||
|
116 | rtems_status_code spare_status; | |||
|
117 | ||||
|
118 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) || (lfrCurrentMode == LFR_MODE_BURST) // in BURST the data are used to place v, e1 and e2 in the HK packet | |||
|
119 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) | |||
|
120 | { // in modes other than STANDBY and BURST, send the CWF_F3 data | |||
|
121 | if ((waveform_picker_regs->status & 0x40) == 0x40){ // [0100 0000] f3 buffer 0 is full | |||
|
122 | // (1) change the receiving buffer for the waveform picker | |||
|
123 | ring_node_to_send_cwf_f3 = current_ring_node_f3; | |||
|
124 | current_ring_node_f3 = current_ring_node_f3->next; | |||
|
125 | waveform_picker_regs->addr_data_f3_0 = current_ring_node_f3->buffer_address; | |||
|
126 | // (2) send an event for the waveforms transmission | |||
|
127 | if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { | |||
|
128 | spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |||
|
129 | } | |||
|
130 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2); | |||
|
131 | waveform_picker_regs->status = waveform_picker_regs->status & 0xffff77bf; // reset f3 bits to 0, [0111 0111 1011 1111] | |||
|
132 | } | |||
|
133 | else if ((waveform_picker_regs->status & 0x80) == 0x80){ // [1000 0000] f3 buffer 1 is full | |||
|
134 | // (1) change the receiving buffer for the waveform picker | |||
|
135 | ring_node_to_send_cwf_f3 = current_ring_node_f3; | |||
|
136 | current_ring_node_f3 = current_ring_node_f3->next; | |||
|
137 | waveform_picker_regs->addr_data_f3_1 = current_ring_node_f3->buffer_address; | |||
|
138 | // (2) send an event for the waveforms transmission | |||
|
139 | if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { | |||
|
140 | spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |||
|
141 | } | |||
|
142 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2); | |||
|
143 | waveform_picker_regs->status = waveform_picker_regs->status & 0xffff777f; // reset f3 bits to 0, [0111 0111 0111 1111] | |||
|
144 | } | |||
|
145 | } | |||
|
146 | } | |||
|
147 | ||||
|
148 | void waveforms_isr_normal( void ) | |||
|
149 | { | |||
|
150 | rtems_status_code status; | |||
|
151 | ||||
|
152 | if ( ( (waveform_picker_regs->status & 0x30) != 0x00 ) // [0011 0000] check the f2 full bits | |||
|
153 | || ( (waveform_picker_regs->status & 0x0c) != 0x00 ) // [0000 1100] check the f1 full bits | |||
|
154 | || ( (waveform_picker_regs->status & 0x03) != 0x00 )) // [0000 0011] check the f0 full bits | |||
|
155 | { | |||
|
156 | // change F0 ring node | |||
|
157 | change_f0_buffer(); | |||
|
158 | // change F1 ring node | |||
|
159 | change_f1_buffer( ring_node_to_send_swf_f1 ); | |||
|
160 | // change F2 ring node | |||
|
161 | change_f2_buffer( ring_node_to_send_swf_f2 ); | |||
|
162 | // | |||
|
163 | status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ); | |||
|
164 | if ( status != RTEMS_SUCCESSFUL) | |||
|
165 | { | |||
|
166 | status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |||
|
167 | } | |||
|
168 | // update status bits except f3 bits | |||
|
169 | waveform_picker_regs->status = waveform_picker_regs->status & 0xffff00c0; // [1000 1000 1100 0000] | |||
|
170 | } | |||
|
171 | } | |||
|
172 | ||||
|
173 | void waveforms_isr_burst( void ) | |||
|
174 | { | |||
|
175 | rtems_status_code spare_status; | |||
|
176 | ||||
|
177 | if ( (waveform_picker_regs->status & 0x30) != 0 ){ // [0100] check the f2 full bit | |||
|
178 | // (1) change the receiving buffer for the waveform picker | |||
|
179 | change_f2_buffer( ring_node_to_send_cwf_f2 ); | |||
|
180 | // (2) send an event for the waveforms transmission | |||
|
181 | if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) { | |||
|
182 | spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |||
|
183 | } | |||
|
184 | // update f2 status bits only | |||
|
185 | waveform_picker_regs->status = waveform_picker_regs->status & 0xffffbbcf; // [1011 1011 1100 1111] f2 bit = 0 | |||
|
186 | } | |||
|
187 | } | |||
|
188 | ||||
|
189 | void waveforms_isr_sbm1( void ) | |||
|
190 | { | |||
|
191 | rtems_status_code status; | |||
|
192 | rtems_status_code spare_status; | |||
|
193 | ||||
|
194 | //*** | |||
|
195 | // F1 | |||
|
196 | if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit | |||
|
197 | // (1) change the receiving buffer for the waveform picker | |||
|
198 | change_f1_buffer( ring_node_to_send_cwf_f1 ); | |||
|
199 | // (2) send an event for the the CWF1 task for transmission (and snapshot extraction if needed) | |||
|
200 | status = rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 ); | |||
|
201 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bits = 0 | |||
|
202 | } | |||
|
203 | ||||
|
204 | //*** | |||
|
205 | // F0 | |||
|
206 | if ( (waveform_picker_regs->status & 0x03) != 0x00 ) { // [0000 0011] one f0 buffer is full | |||
|
207 | swf_f0_ready = true; | |||
|
208 | change_f0_buffer(); | |||
|
209 | } | |||
|
210 | ||||
|
211 | //*** | |||
|
212 | // F2 | |||
|
213 | if ( (waveform_picker_regs->status & 0x04) == 0x04 ) { // [0100] check the f2 full bit | |||
|
214 | swf_f2_ready = true; | |||
|
215 | change_f2_buffer( ring_node_to_send_swf_f2 ); | |||
|
216 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) | |||
|
217 | { | |||
|
218 | spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |||
|
219 | } | |||
|
220 | } | |||
|
221 | } | |||
|
222 | ||||
|
223 | void waveforms_isr_sbm2( void ) | |||
|
224 | { | |||
|
225 | rtems_status_code status; | |||
|
226 | ||||
|
227 | if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit | |||
|
228 | // (1) change the receiving buffer for the waveform picker | |||
|
229 | change_f2_buffer( ring_node_to_send_cwf_f2 ); | |||
|
230 | // (2) send an event for the waveforms transmission | |||
|
231 | status = rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 ); | |||
|
232 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0 | |||
|
233 | } | |||
|
234 | if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit | |||
|
235 | swf_f0_ready = true; | |||
|
236 | change_f0_buffer(); | |||
|
237 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffeee; // [1111 1110 1110 1110] f0 bits = 0 | |||
|
238 | } | |||
|
239 | if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit | |||
|
240 | swf_f1_ready = true; | |||
|
241 | change_f1_buffer( ring_node_to_send_swf_f1 ); | |||
|
242 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1, f0 bits = 0 | |||
|
243 | } | |||
|
244 | } | |||
|
245 | ||||
60 | rtems_isr waveforms_isr( rtems_vector_number vector ) |
|
246 | rtems_isr waveforms_isr( rtems_vector_number vector ) | |
61 | { |
|
247 | { | |
62 | /** This is the interrupt sub routine called by the waveform picker core. |
|
248 | /** This is the interrupt sub routine called by the waveform picker core. | |
63 | * |
|
249 | * | |
64 | * This ISR launch different actions depending mainly on two pieces of information: |
|
250 | * This ISR launch different actions depending mainly on two pieces of information: | |
65 | * 1. the values read in the registers of the waveform picker. |
|
251 | * 1. the values read in the registers of the waveform picker. | |
66 | * 2. the current LFR mode. |
|
252 | * 2. the current LFR mode. | |
67 | * |
|
253 | * | |
68 | */ |
|
254 | */ | |
69 |
|
255 | |||
70 | rtems_status_code status; |
|
256 | // STATUS | |
|
257 | // new error error buffer full | |||
|
258 | // 15 14 13 12 11 10 9 8 | |||
|
259 | // f3 f2 f1 f0 f3 f2 f1 f0 | |||
|
260 | // | |||
|
261 | // ready buffer | |||
|
262 | // 7 6 5 4 3 2 1 0 | |||
|
263 | // f3_1 f3_0 f2_1 f2_0 f1_1 f1_0 f0_1 f0_0 | |||
|
264 | ||||
71 | rtems_status_code spare_status; |
|
265 | rtems_status_code spare_status; | |
72 |
|
266 | |||
73 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) || (lfrCurrentMode == LFR_MODE_BURST) // in BURST the data are used to place v, e1 and e2 in the HK packet |
|
267 | waveforms_isr_f3(); | |
74 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
268 | ||
75 | { // in modes other than STANDBY and BURST, send the CWF_F3 data |
|
269 | if ( (waveform_picker_regs->status & 0xff8) != 0x00) // [1000] check the error bits | |
76 | if ((waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full |
|
270 | { | |
77 | // (1) change the receiving buffer for the waveform picker |
|
271 | spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
78 | ring_node_to_send_cwf_f3 = current_ring_node_f3; |
|
|||
79 | current_ring_node_f3 = current_ring_node_f3->next; |
|
|||
80 | waveform_picker_regs->addr_data_f3 = current_ring_node_f3->buffer_address; |
|
|||
81 | // (2) send an event for the waveforms transmission |
|
|||
82 | if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
|||
83 | spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
|||
84 | } |
|
|||
85 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2); |
|
|||
86 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff777; // reset f3 bits to 0, [1111 0111 0111 0111] |
|
|||
87 | } |
|
|||
88 | } |
|
272 | } | |
89 |
|
273 | |||
90 | switch(lfrCurrentMode) |
|
274 | switch(lfrCurrentMode) | |
91 | { |
|
275 | { | |
92 | //******** |
|
276 | //******** | |
93 | // STANDBY |
|
277 | // STANDBY | |
94 | case(LFR_MODE_STANDBY): |
|
278 | case(LFR_MODE_STANDBY): | |
95 | break; |
|
279 | break; | |
96 |
|
280 | |||
97 | //****** |
|
281 | //****** | |
98 | // NORMAL |
|
282 | // NORMAL | |
99 | case(LFR_MODE_NORMAL): |
|
283 | case(LFR_MODE_NORMAL): | |
100 | if ( (waveform_picker_regs->status & 0xff8) != 0x00) // [1000] check the error bits |
|
284 | waveforms_isr_normal(); | |
101 | { |
|
|||
102 | spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
|||
103 | } |
|
|||
104 | if ( (waveform_picker_regs->status & 0x07) == 0x07) // [0111] check the f2, f1, f0 full bits |
|
|||
105 | { |
|
|||
106 | // change F0 ring node |
|
|||
107 | ring_node_to_send_swf_f0 = current_ring_node_f0; |
|
|||
108 | current_ring_node_f0 = current_ring_node_f0->next; |
|
|||
109 | waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address; |
|
|||
110 | // change F1 ring node |
|
|||
111 | ring_node_to_send_swf_f1 = current_ring_node_f1; |
|
|||
112 | current_ring_node_f1 = current_ring_node_f1->next; |
|
|||
113 | waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; |
|
|||
114 | // change F2 ring node |
|
|||
115 | ring_node_to_send_swf_f2 = current_ring_node_f2; |
|
|||
116 | current_ring_node_f2 = current_ring_node_f2->next; |
|
|||
117 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; |
|
|||
118 | // |
|
|||
119 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) |
|
|||
120 | { |
|
|||
121 | spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
|||
122 | } |
|
|||
123 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff888; // [1000 1000 1000] |
|
|||
124 | } |
|
|||
125 | break; |
|
285 | break; | |
126 |
|
286 | |||
127 | //****** |
|
287 | //****** | |
128 | // BURST |
|
288 | // BURST | |
129 | case(LFR_MODE_BURST): |
|
289 | case(LFR_MODE_BURST): | |
130 | if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit |
|
290 | waveforms_isr_burst(); | |
131 | // (1) change the receiving buffer for the waveform picker |
|
|||
132 | ring_node_to_send_cwf_f2 = current_ring_node_f2; |
|
|||
133 | current_ring_node_f2 = current_ring_node_f2->next; |
|
|||
134 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; |
|
|||
135 | // (2) send an event for the waveforms transmission |
|
|||
136 | if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) { |
|
|||
137 | spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
|||
138 | } |
|
|||
139 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0 |
|
|||
140 | } |
|
|||
141 | break; |
|
291 | break; | |
142 |
|
292 | |||
143 | //***** |
|
293 | //***** | |
144 | // SBM1 |
|
294 | // SBM1 | |
145 | case(LFR_MODE_SBM1): |
|
295 | case(LFR_MODE_SBM1): | |
146 | if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit |
|
296 | waveforms_isr_sbm1(); | |
147 | // (1) change the receiving buffer for the waveform picker |
|
|||
148 | ring_node_to_send_cwf_f1 = current_ring_node_f1; |
|
|||
149 | current_ring_node_f1 = current_ring_node_f1->next; |
|
|||
150 | waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; |
|
|||
151 | // (2) send an event for the the CWF1 task for transmission (and snapshot extraction if needed) |
|
|||
152 | status = rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 ); |
|
|||
153 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bits = 0 |
|
|||
154 | } |
|
|||
155 | if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit |
|
|||
156 | swf_f0_ready = true; |
|
|||
157 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffeee; // [1111 1110 1110 1110] f0 bits = 0 |
|
|||
158 | } |
|
|||
159 | if ( (waveform_picker_regs->status & 0x04) == 0x04 ) { // [0100] check the f2 full bit |
|
|||
160 | swf_f2_ready = true; |
|
|||
161 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bits = 0 |
|
|||
162 | } |
|
|||
163 | break; |
|
297 | break; | |
164 |
|
298 | |||
165 | //***** |
|
299 | //***** | |
166 | // SBM2 |
|
300 | // SBM2 | |
167 | case(LFR_MODE_SBM2): |
|
301 | case(LFR_MODE_SBM2): | |
168 | if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit |
|
302 | waveforms_isr_sbm2(); | |
169 | // (1) change the receiving buffer for the waveform picker |
|
|||
170 | ring_node_to_send_cwf_f2 = current_ring_node_f2; |
|
|||
171 | current_ring_node_f2 = current_ring_node_f2->next; |
|
|||
172 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; |
|
|||
173 | // (2) send an event for the waveforms transmission |
|
|||
174 | status = rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 ); |
|
|||
175 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0 |
|
|||
176 | } |
|
|||
177 | if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit |
|
|||
178 | swf_f0_ready = true; |
|
|||
179 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffeee; // [1111 1110 1110 1110] f0 bits = 0 |
|
|||
180 | } |
|
|||
181 | if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit |
|
|||
182 | swf_f1_ready = true; |
|
|||
183 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1, f0 bits = 0 |
|
|||
184 | } |
|
|||
185 | break; |
|
303 | break; | |
186 |
|
304 | |||
187 | //******** |
|
305 | //******** | |
188 | // DEFAULT |
|
306 | // DEFAULT | |
189 | default: |
|
307 | default: | |
190 | break; |
|
308 | break; | |
191 | } |
|
309 | } | |
192 | } |
|
310 | } | |
193 |
|
311 | |||
194 | //************ |
|
312 | //************ | |
195 | // RTEMS TASKS |
|
313 | // RTEMS TASKS | |
196 |
|
314 | |||
197 | rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP |
|
315 | rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP | |
198 | { |
|
316 | { | |
199 | /** This RTEMS task is dedicated to the transmission of snapshots of the NORMAL mode. |
|
317 | /** This RTEMS task is dedicated to the transmission of snapshots of the NORMAL mode. | |
200 | * |
|
318 | * | |
201 | * @param unused is the starting argument of the RTEMS task |
|
319 | * @param unused is the starting argument of the RTEMS task | |
202 | * |
|
320 | * | |
203 | * The following data packets are sent by this task: |
|
321 | * The following data packets are sent by this task: | |
204 | * - TM_LFR_SCIENCE_NORMAL_SWF_F0 |
|
322 | * - TM_LFR_SCIENCE_NORMAL_SWF_F0 | |
205 | * - TM_LFR_SCIENCE_NORMAL_SWF_F1 |
|
323 | * - TM_LFR_SCIENCE_NORMAL_SWF_F1 | |
206 | * - TM_LFR_SCIENCE_NORMAL_SWF_F2 |
|
324 | * - TM_LFR_SCIENCE_NORMAL_SWF_F2 | |
207 | * |
|
325 | * | |
208 | */ |
|
326 | */ | |
209 |
|
327 | |||
210 | rtems_event_set event_out; |
|
328 | rtems_event_set event_out; | |
211 | rtems_id queue_id; |
|
329 | rtems_id queue_id; | |
212 | rtems_status_code status; |
|
330 | rtems_status_code status; | |
213 | bool resynchronisationEngaged; |
|
331 | bool resynchronisationEngaged; | |
214 |
|
332 | |||
215 | resynchronisationEngaged = false; |
|
333 | resynchronisationEngaged = false; | |
216 |
|
334 | |||
217 | init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 ); |
|
335 | init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 ); | |
218 | init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 ); |
|
336 | init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 ); | |
219 | init_header_snapshot_wf_table( SID_NORM_SWF_F2, headerSWF_F2 ); |
|
337 | init_header_snapshot_wf_table( SID_NORM_SWF_F2, headerSWF_F2 ); | |
220 |
|
338 | |||
221 | status = get_message_queue_id_send( &queue_id ); |
|
339 | status = get_message_queue_id_send( &queue_id ); | |
222 | if (status != RTEMS_SUCCESSFUL) |
|
340 | if (status != RTEMS_SUCCESSFUL) | |
223 | { |
|
341 | { | |
224 | PRINTF1("in WFRM *** ERR get_message_queue_id_send %d\n", status) |
|
342 | PRINTF1("in WFRM *** ERR get_message_queue_id_send %d\n", status) | |
225 | } |
|
343 | } | |
226 |
|
344 | |||
227 | BOOT_PRINTF("in WFRM ***\n") |
|
345 | BOOT_PRINTF("in WFRM ***\n") | |
228 |
|
346 | |||
229 | while(1){ |
|
347 | while(1){ | |
230 | // wait for an RTEMS_EVENT |
|
348 | // wait for an RTEMS_EVENT | |
231 | rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1 |
|
349 | rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1 | |
232 | | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM, |
|
350 | | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM, | |
233 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
351 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
234 | if(resynchronisationEngaged == false) |
|
352 | if(resynchronisationEngaged == false) | |
235 | { // engage resynchronisation |
|
353 | { // engage resynchronisation | |
236 | snapshot_resynchronization( (unsigned char *) ring_node_to_send_swf_f0->buffer_address); |
|
354 | snapshot_resynchronization( (unsigned char *) ring_node_to_send_swf_f0->buffer_address); | |
237 | resynchronisationEngaged = true; |
|
355 | resynchronisationEngaged = true; | |
238 | } |
|
356 | } | |
239 | else |
|
357 | else | |
240 | { // reset delta_snapshot to the nominal value |
|
358 | { // reset delta_snapshot to the nominal value | |
241 | PRINTF("no resynchronisation, reset delta_snapshot to the nominal value\n") |
|
359 | PRINTF("no resynchronisation, reset delta_snapshot to the nominal value\n") | |
242 | set_wfp_delta_snapshot(); |
|
360 | set_wfp_delta_snapshot(); | |
243 | resynchronisationEngaged = false; |
|
361 | resynchronisationEngaged = false; | |
244 | } |
|
362 | } | |
245 | // |
|
363 | // | |
246 |
|
364 | |||
247 | if (event_out == RTEMS_EVENT_MODE_NORMAL) |
|
365 | if (event_out == RTEMS_EVENT_MODE_NORMAL) | |
248 | { |
|
366 | { | |
249 | DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_NORMAL\n") |
|
367 | DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_NORMAL\n") | |
250 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id); |
|
368 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id); | |
251 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id); |
|
369 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id); | |
252 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id); |
|
370 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id); | |
253 | } |
|
371 | } | |
254 | if (event_out == RTEMS_EVENT_MODE_SBM1) |
|
372 | if (event_out == RTEMS_EVENT_MODE_SBM1) | |
255 | { |
|
373 | { | |
256 | DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM1\n") |
|
374 | DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM1\n") | |
257 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id); |
|
375 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id); | |
258 | send_waveform_SWF((volatile int*) wf_snap_extracted , SID_NORM_SWF_F1, headerSWF_F1, queue_id); |
|
376 | send_waveform_SWF((volatile int*) wf_snap_extracted , SID_NORM_SWF_F1, headerSWF_F1, queue_id); | |
259 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id); |
|
377 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id); | |
260 | } |
|
378 | } | |
261 | if (event_out == RTEMS_EVENT_MODE_SBM2) |
|
379 | if (event_out == RTEMS_EVENT_MODE_SBM2) | |
262 | { |
|
380 | { | |
263 | DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM2\n") |
|
381 | DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM2\n") | |
264 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id); |
|
382 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id); | |
265 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id); |
|
383 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id); | |
266 | send_waveform_SWF((volatile int*) wf_snap_extracted , SID_NORM_SWF_F2, headerSWF_F2, queue_id); |
|
384 | send_waveform_SWF((volatile int*) wf_snap_extracted , SID_NORM_SWF_F2, headerSWF_F2, queue_id); | |
267 | } |
|
385 | } | |
268 | } |
|
386 | } | |
269 | } |
|
387 | } | |
270 |
|
388 | |||
271 | rtems_task cwf3_task(rtems_task_argument argument) //used with the waveform picker VHDL IP |
|
389 | rtems_task cwf3_task(rtems_task_argument argument) //used with the waveform picker VHDL IP | |
272 | { |
|
390 | { | |
273 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f3. |
|
391 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f3. | |
274 | * |
|
392 | * | |
275 | * @param unused is the starting argument of the RTEMS task |
|
393 | * @param unused is the starting argument of the RTEMS task | |
276 | * |
|
394 | * | |
277 | * The following data packet is sent by this task: |
|
395 | * The following data packet is sent by this task: | |
278 | * - TM_LFR_SCIENCE_NORMAL_CWF_F3 |
|
396 | * - TM_LFR_SCIENCE_NORMAL_CWF_F3 | |
279 | * |
|
397 | * | |
280 | */ |
|
398 | */ | |
281 |
|
399 | |||
282 | rtems_event_set event_out; |
|
400 | rtems_event_set event_out; | |
283 | rtems_id queue_id; |
|
401 | rtems_id queue_id; | |
284 | rtems_status_code status; |
|
402 | rtems_status_code status; | |
285 |
|
403 | |||
286 | init_header_continuous_wf_table( SID_NORM_CWF_LONG_F3, headerCWF_F3 ); |
|
404 | init_header_continuous_wf_table( SID_NORM_CWF_LONG_F3, headerCWF_F3 ); | |
287 | init_header_continuous_cwf3_light_table( headerCWF_F3_light ); |
|
405 | init_header_continuous_cwf3_light_table( headerCWF_F3_light ); | |
288 |
|
406 | |||
289 | status = get_message_queue_id_send( &queue_id ); |
|
407 | status = get_message_queue_id_send( &queue_id ); | |
290 | if (status != RTEMS_SUCCESSFUL) |
|
408 | if (status != RTEMS_SUCCESSFUL) | |
291 | { |
|
409 | { | |
292 | PRINTF1("in CWF3 *** ERR get_message_queue_id_send %d\n", status) |
|
410 | PRINTF1("in CWF3 *** ERR get_message_queue_id_send %d\n", status) | |
293 | } |
|
411 | } | |
294 |
|
412 | |||
295 | BOOT_PRINTF("in CWF3 ***\n") |
|
413 | BOOT_PRINTF("in CWF3 ***\n") | |
296 |
|
414 | |||
297 | while(1){ |
|
415 | while(1){ | |
298 | // wait for an RTEMS_EVENT |
|
416 | // wait for an RTEMS_EVENT | |
299 | rtems_event_receive( RTEMS_EVENT_0, |
|
417 | rtems_event_receive( RTEMS_EVENT_0, | |
300 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
418 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
301 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) |
|
419 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) | |
302 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode==LFR_MODE_SBM2) ) |
|
420 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode==LFR_MODE_SBM2) ) | |
303 | { |
|
421 | { | |
304 | if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01) |
|
422 | if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01) | |
305 | { |
|
423 | { | |
306 | PRINTF("send CWF_LONG_F3\n") |
|
424 | PRINTF("send CWF_LONG_F3\n") | |
307 | send_waveform_CWF( |
|
425 | send_waveform_CWF( | |
308 | (volatile int*) ring_node_to_send_cwf_f3->buffer_address, |
|
426 | (volatile int*) ring_node_to_send_cwf_f3->buffer_address, | |
309 | SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id ); |
|
427 | SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id ); | |
310 | } |
|
428 | } | |
311 | else |
|
429 | else | |
312 | { |
|
430 | { | |
313 | PRINTF("send CWF_F3 (light)\n") |
|
431 | PRINTF("send CWF_F3 (light)\n") | |
314 | send_waveform_CWF3_light( |
|
432 | send_waveform_CWF3_light( | |
315 | (volatile int*) ring_node_to_send_cwf_f3->buffer_address, |
|
433 | (volatile int*) ring_node_to_send_cwf_f3->buffer_address, | |
316 | headerCWF_F3_light, queue_id ); |
|
434 | headerCWF_F3_light, queue_id ); | |
317 | } |
|
435 | } | |
318 |
|
436 | |||
319 | } |
|
437 | } | |
320 | else |
|
438 | else | |
321 | { |
|
439 | { | |
322 | PRINTF1("in CWF3 *** lfrCurrentMode is %d, no data will be sent\n", lfrCurrentMode) |
|
440 | PRINTF1("in CWF3 *** lfrCurrentMode is %d, no data will be sent\n", lfrCurrentMode) | |
323 | } |
|
441 | } | |
324 | } |
|
442 | } | |
325 | } |
|
443 | } | |
326 |
|
444 | |||
327 | rtems_task cwf2_task(rtems_task_argument argument) // ONLY USED IN BURST AND SBM2 |
|
445 | rtems_task cwf2_task(rtems_task_argument argument) // ONLY USED IN BURST AND SBM2 | |
328 | { |
|
446 | { | |
329 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f2. |
|
447 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f2. | |
330 | * |
|
448 | * | |
331 | * @param unused is the starting argument of the RTEMS task |
|
449 | * @param unused is the starting argument of the RTEMS task | |
332 | * |
|
450 | * | |
333 | * The following data packet is sent by this function: |
|
451 | * The following data packet is sent by this function: | |
334 | * - TM_LFR_SCIENCE_BURST_CWF_F2 |
|
452 | * - TM_LFR_SCIENCE_BURST_CWF_F2 | |
335 | * - TM_LFR_SCIENCE_SBM2_CWF_F2 |
|
453 | * - TM_LFR_SCIENCE_SBM2_CWF_F2 | |
336 | * |
|
454 | * | |
337 | */ |
|
455 | */ | |
338 |
|
456 | |||
339 | rtems_event_set event_out; |
|
457 | rtems_event_set event_out; | |
340 | rtems_id queue_id; |
|
458 | rtems_id queue_id; | |
341 | rtems_status_code status; |
|
459 | rtems_status_code status; | |
342 |
|
460 | |||
343 | init_header_continuous_wf_table( SID_BURST_CWF_F2, headerCWF_F2_BURST ); |
|
461 | init_header_continuous_wf_table( SID_BURST_CWF_F2, headerCWF_F2_BURST ); | |
344 | init_header_continuous_wf_table( SID_SBM2_CWF_F2, headerCWF_F2_SBM2 ); |
|
462 | init_header_continuous_wf_table( SID_SBM2_CWF_F2, headerCWF_F2_SBM2 ); | |
345 |
|
463 | |||
346 | status = get_message_queue_id_send( &queue_id ); |
|
464 | status = get_message_queue_id_send( &queue_id ); | |
347 | if (status != RTEMS_SUCCESSFUL) |
|
465 | if (status != RTEMS_SUCCESSFUL) | |
348 | { |
|
466 | { | |
349 | PRINTF1("in CWF2 *** ERR get_message_queue_id_send %d\n", status) |
|
467 | PRINTF1("in CWF2 *** ERR get_message_queue_id_send %d\n", status) | |
350 | } |
|
468 | } | |
351 |
|
469 | |||
352 | BOOT_PRINTF("in CWF2 ***\n") |
|
470 | BOOT_PRINTF("in CWF2 ***\n") | |
353 |
|
471 | |||
354 | while(1){ |
|
472 | while(1){ | |
355 | // wait for an RTEMS_EVENT |
|
473 | // wait for an RTEMS_EVENT | |
356 | rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2, |
|
474 | rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2, | |
357 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
475 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
358 | if (event_out == RTEMS_EVENT_MODE_BURST) |
|
476 | if (event_out == RTEMS_EVENT_MODE_BURST) | |
359 | { |
|
477 | { | |
360 | send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id ); |
|
478 | send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id ); | |
361 | } |
|
479 | } | |
362 | if (event_out == RTEMS_EVENT_MODE_SBM2) |
|
480 | if (event_out == RTEMS_EVENT_MODE_SBM2) | |
363 | { |
|
481 | { | |
364 | send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id ); |
|
482 | send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id ); | |
365 | // launch snapshot extraction if needed |
|
483 | // launch snapshot extraction if needed | |
366 | if (extractSWF == true) |
|
484 | if (extractSWF == true) | |
367 | { |
|
485 | { | |
368 | ring_node_to_send_swf_f2 = ring_node_to_send_cwf_f2; |
|
486 | ring_node_to_send_swf_f2 = ring_node_to_send_cwf_f2; | |
369 | // extract the snapshot |
|
487 | // extract the snapshot | |
370 | build_snapshot_from_ring( ring_node_to_send_swf_f2, 2 ); |
|
488 | build_snapshot_from_ring( ring_node_to_send_swf_f2, 2 ); | |
371 | // send the snapshot when built |
|
489 | // send the snapshot when built | |
372 | status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 ); |
|
490 | status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 ); | |
373 | extractSWF = false; |
|
491 | extractSWF = false; | |
374 | } |
|
492 | } | |
375 | if (swf_f0_ready && swf_f1_ready) |
|
493 | if (swf_f0_ready && swf_f1_ready) | |
376 | { |
|
494 | { | |
377 | extractSWF = true; |
|
495 | extractSWF = true; | |
378 | swf_f0_ready = false; |
|
496 | swf_f0_ready = false; | |
379 | swf_f1_ready = false; |
|
497 | swf_f1_ready = false; | |
380 | } |
|
498 | } | |
381 | } |
|
499 | } | |
382 | } |
|
500 | } | |
383 | } |
|
501 | } | |
384 |
|
502 | |||
385 | rtems_task cwf1_task(rtems_task_argument argument) // ONLY USED IN SBM1 |
|
503 | rtems_task cwf1_task(rtems_task_argument argument) // ONLY USED IN SBM1 | |
386 | { |
|
504 | { | |
387 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f1. |
|
505 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f1. | |
388 | * |
|
506 | * | |
389 | * @param unused is the starting argument of the RTEMS task |
|
507 | * @param unused is the starting argument of the RTEMS task | |
390 | * |
|
508 | * | |
391 | * The following data packet is sent by this function: |
|
509 | * The following data packet is sent by this function: | |
392 | * - TM_LFR_SCIENCE_SBM1_CWF_F1 |
|
510 | * - TM_LFR_SCIENCE_SBM1_CWF_F1 | |
393 | * |
|
511 | * | |
394 | */ |
|
512 | */ | |
395 |
|
513 | |||
396 | rtems_event_set event_out; |
|
514 | rtems_event_set event_out; | |
397 | rtems_id queue_id; |
|
515 | rtems_id queue_id; | |
398 | rtems_status_code status; |
|
516 | rtems_status_code status; | |
399 |
|
517 | |||
400 | init_header_continuous_wf_table( SID_SBM1_CWF_F1, headerCWF_F1 ); |
|
518 | init_header_continuous_wf_table( SID_SBM1_CWF_F1, headerCWF_F1 ); | |
401 |
|
519 | |||
402 | status = get_message_queue_id_send( &queue_id ); |
|
520 | status = get_message_queue_id_send( &queue_id ); | |
403 | if (status != RTEMS_SUCCESSFUL) |
|
521 | if (status != RTEMS_SUCCESSFUL) | |
404 | { |
|
522 | { | |
405 | PRINTF1("in CWF1 *** ERR get_message_queue_id_send %d\n", status) |
|
523 | PRINTF1("in CWF1 *** ERR get_message_queue_id_send %d\n", status) | |
406 | } |
|
524 | } | |
407 |
|
525 | |||
408 | BOOT_PRINTF("in CWF1 ***\n") |
|
526 | BOOT_PRINTF("in CWF1 ***\n") | |
409 |
|
527 | |||
410 | while(1){ |
|
528 | while(1){ | |
411 | // wait for an RTEMS_EVENT |
|
529 | // wait for an RTEMS_EVENT | |
412 | rtems_event_receive( RTEMS_EVENT_MODE_SBM1, |
|
530 | rtems_event_receive( RTEMS_EVENT_MODE_SBM1, | |
413 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
531 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
414 | send_waveform_CWF( (volatile int*) ring_node_to_send_cwf_f1->buffer_address, SID_SBM1_CWF_F1, headerCWF_F1, queue_id ); |
|
532 | send_waveform_CWF( (volatile int*) ring_node_to_send_cwf_f1->buffer_address, SID_SBM1_CWF_F1, headerCWF_F1, queue_id ); | |
415 | // launch snapshot extraction if needed |
|
533 | // launch snapshot extraction if needed | |
416 | if (extractSWF == true) |
|
534 | if (extractSWF == true) | |
417 | { |
|
535 | { | |
418 | ring_node_to_send_swf_f1 = ring_node_to_send_cwf_f1; |
|
536 | ring_node_to_send_swf_f1 = ring_node_to_send_cwf_f1; | |
419 | // launch the snapshot extraction |
|
537 | // launch the snapshot extraction | |
420 | status = rtems_event_send( Task_id[TASKID_SWBD], RTEMS_EVENT_MODE_SBM1 ); |
|
538 | status = rtems_event_send( Task_id[TASKID_SWBD], RTEMS_EVENT_MODE_SBM1 ); | |
421 | extractSWF = false; |
|
539 | extractSWF = false; | |
422 | } |
|
540 | } | |
423 | if (swf_f0_ready == true) |
|
541 | if (swf_f0_ready == true) | |
424 | { |
|
542 | { | |
425 | extractSWF = true; |
|
543 | extractSWF = true; | |
426 | swf_f0_ready = false; // this step shall be executed only one time |
|
544 | swf_f0_ready = false; // this step shall be executed only one time | |
427 | } |
|
545 | } | |
428 | if ((swf_f1_ready == true) && (swf_f2_ready == true)) // swf_f1 is ready after the extraction |
|
546 | if ((swf_f1_ready == true) && (swf_f2_ready == true)) // swf_f1 is ready after the extraction | |
429 | { |
|
547 | { | |
430 | status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM1 ); |
|
548 | status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM1 ); | |
431 | swf_f1_ready = false; |
|
549 | swf_f1_ready = false; | |
432 | swf_f2_ready = false; |
|
550 | swf_f2_ready = false; | |
433 | } |
|
551 | } | |
434 | } |
|
552 | } | |
435 | } |
|
553 | } | |
436 |
|
554 | |||
437 | rtems_task swbd_task(rtems_task_argument argument) |
|
555 | rtems_task swbd_task(rtems_task_argument argument) | |
438 | { |
|
556 | { | |
439 | /** This RTEMS task is dedicated to the building of snapshots from different continuous waveforms buffers. |
|
557 | /** This RTEMS task is dedicated to the building of snapshots from different continuous waveforms buffers. | |
440 | * |
|
558 | * | |
441 | * @param unused is the starting argument of the RTEMS task |
|
559 | * @param unused is the starting argument of the RTEMS task | |
442 | * |
|
560 | * | |
443 | */ |
|
561 | */ | |
444 |
|
562 | |||
445 | rtems_event_set event_out; |
|
563 | rtems_event_set event_out; | |
446 |
|
564 | |||
447 | BOOT_PRINTF("in SWBD ***\n") |
|
565 | BOOT_PRINTF("in SWBD ***\n") | |
448 |
|
566 | |||
449 | while(1){ |
|
567 | while(1){ | |
450 | // wait for an RTEMS_EVENT |
|
568 | // wait for an RTEMS_EVENT | |
451 | rtems_event_receive( RTEMS_EVENT_MODE_SBM1 | RTEMS_EVENT_MODE_SBM2, |
|
569 | rtems_event_receive( RTEMS_EVENT_MODE_SBM1 | RTEMS_EVENT_MODE_SBM2, | |
452 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
570 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
453 | if (event_out == RTEMS_EVENT_MODE_SBM1) |
|
571 | if (event_out == RTEMS_EVENT_MODE_SBM1) | |
454 | { |
|
572 | { | |
455 | build_snapshot_from_ring( ring_node_to_send_swf_f1, 1 ); |
|
573 | build_snapshot_from_ring( ring_node_to_send_swf_f1, 1 ); | |
456 | swf_f1_ready = true; // the snapshot has been extracted and is ready to be sent |
|
574 | swf_f1_ready = true; // the snapshot has been extracted and is ready to be sent | |
457 | } |
|
575 | } | |
458 | else |
|
576 | else | |
459 | { |
|
577 | { | |
460 | PRINTF1("in SWBD *** unexpected rtems event received %x\n", (int) event_out) |
|
578 | PRINTF1("in SWBD *** unexpected rtems event received %x\n", (int) event_out) | |
461 | } |
|
579 | } | |
462 | } |
|
580 | } | |
463 | } |
|
581 | } | |
464 |
|
582 | |||
465 | //****************** |
|
583 | //****************** | |
466 | // general functions |
|
584 | // general functions | |
467 |
|
585 | |||
468 | void WFP_init_rings( void ) |
|
586 | void WFP_init_rings( void ) | |
469 | { |
|
587 | { | |
470 | // F0 RING |
|
588 | // F0 RING | |
471 | init_waveform_ring( waveform_ring_f0, NB_RING_NODES_F0, wf_snap_f0 ); |
|
589 | init_waveform_ring( waveform_ring_f0, NB_RING_NODES_F0, wf_snap_f0 ); | |
472 | // F1 RING |
|
590 | // F1 RING | |
473 | init_waveform_ring( waveform_ring_f1, NB_RING_NODES_F1, wf_snap_f1 ); |
|
591 | init_waveform_ring( waveform_ring_f1, NB_RING_NODES_F1, wf_snap_f1 ); | |
474 | // F2 RING |
|
592 | // F2 RING | |
475 | init_waveform_ring( waveform_ring_f2, NB_RING_NODES_F2, wf_snap_f2 ); |
|
593 | init_waveform_ring( waveform_ring_f2, NB_RING_NODES_F2, wf_snap_f2 ); | |
476 | // F3 RING |
|
594 | // F3 RING | |
477 | init_waveform_ring( waveform_ring_f3, NB_RING_NODES_F3, wf_cont_f3 ); |
|
595 | init_waveform_ring( waveform_ring_f3, NB_RING_NODES_F3, wf_cont_f3 ); | |
478 |
|
596 | |||
479 | DEBUG_PRINTF1("waveform_ring_f0 @%x\n", (unsigned int) waveform_ring_f0) |
|
597 | DEBUG_PRINTF1("waveform_ring_f0 @%x\n", (unsigned int) waveform_ring_f0) | |
480 | DEBUG_PRINTF1("waveform_ring_f1 @%x\n", (unsigned int) waveform_ring_f1) |
|
598 | DEBUG_PRINTF1("waveform_ring_f1 @%x\n", (unsigned int) waveform_ring_f1) | |
481 | DEBUG_PRINTF1("waveform_ring_f2 @%x\n", (unsigned int) waveform_ring_f2) |
|
599 | DEBUG_PRINTF1("waveform_ring_f2 @%x\n", (unsigned int) waveform_ring_f2) | |
482 | DEBUG_PRINTF1("waveform_ring_f3 @%x\n", (unsigned int) waveform_ring_f3) |
|
600 | DEBUG_PRINTF1("waveform_ring_f3 @%x\n", (unsigned int) waveform_ring_f3) | |
483 | } |
|
601 | } | |
484 |
|
602 | |||
485 | void init_waveform_ring(ring_node waveform_ring[], unsigned char nbNodes, volatile int wfrm[] ) |
|
603 | void init_waveform_ring(ring_node waveform_ring[], unsigned char nbNodes, volatile int wfrm[] ) | |
486 | { |
|
604 | { | |
487 | unsigned char i; |
|
605 | unsigned char i; | |
488 |
|
606 | |||
489 | waveform_ring[0].next = (ring_node*) &waveform_ring[ 1 ]; |
|
607 | waveform_ring[0].next = (ring_node*) &waveform_ring[ 1 ]; | |
490 | waveform_ring[0].previous = (ring_node*) &waveform_ring[ nbNodes - 1 ]; |
|
608 | waveform_ring[0].previous = (ring_node*) &waveform_ring[ nbNodes - 1 ]; | |
491 | waveform_ring[0].buffer_address = (int) &wfrm[0]; |
|
609 | waveform_ring[0].buffer_address = (int) &wfrm[0]; | |
492 |
|
610 | |||
493 | waveform_ring[nbNodes-1].next = (ring_node*) &waveform_ring[ 0 ]; |
|
611 | waveform_ring[nbNodes-1].next = (ring_node*) &waveform_ring[ 0 ]; | |
494 | waveform_ring[nbNodes-1].previous = (ring_node*) &waveform_ring[ nbNodes - 2 ]; |
|
612 | waveform_ring[nbNodes-1].previous = (ring_node*) &waveform_ring[ nbNodes - 2 ]; | |
495 | waveform_ring[nbNodes-1].buffer_address = (int) &wfrm[ (nbNodes-1) * WFRM_BUFFER ]; |
|
613 | waveform_ring[nbNodes-1].buffer_address = (int) &wfrm[ (nbNodes-1) * WFRM_BUFFER ]; | |
496 |
|
614 | |||
497 | for(i=1; i<nbNodes-1; i++) |
|
615 | for(i=1; i<nbNodes-1; i++) | |
498 | { |
|
616 | { | |
499 | waveform_ring[i].next = (ring_node*) &waveform_ring[ i + 1 ]; |
|
617 | waveform_ring[i].next = (ring_node*) &waveform_ring[ i + 1 ]; | |
500 | waveform_ring[i].previous = (ring_node*) &waveform_ring[ i - 1 ]; |
|
618 | waveform_ring[i].previous = (ring_node*) &waveform_ring[ i - 1 ]; | |
501 | waveform_ring[i].buffer_address = (int) &wfrm[ i * WFRM_BUFFER ]; |
|
619 | waveform_ring[i].buffer_address = (int) &wfrm[ i * WFRM_BUFFER ]; | |
502 | } |
|
620 | } | |
503 | } |
|
621 | } | |
504 |
|
622 | |||
505 | void WFP_reset_current_ring_nodes( void ) |
|
623 | void WFP_reset_current_ring_nodes( void ) | |
506 | { |
|
624 | { | |
507 | current_ring_node_f0 = waveform_ring_f0; |
|
625 | current_ring_node_f0 = waveform_ring_f0; | |
508 | ring_node_to_send_swf_f0 = waveform_ring_f0; |
|
626 | ring_node_to_send_swf_f0 = waveform_ring_f0; | |
509 |
|
627 | |||
510 | current_ring_node_f1 = waveform_ring_f1; |
|
628 | current_ring_node_f1 = waveform_ring_f1; | |
511 | ring_node_to_send_cwf_f1 = waveform_ring_f1; |
|
629 | ring_node_to_send_cwf_f1 = waveform_ring_f1; | |
512 | ring_node_to_send_swf_f1 = waveform_ring_f1; |
|
630 | ring_node_to_send_swf_f1 = waveform_ring_f1; | |
513 |
|
631 | |||
514 | current_ring_node_f2 = waveform_ring_f2; |
|
632 | current_ring_node_f2 = waveform_ring_f2; | |
515 | ring_node_to_send_cwf_f2 = waveform_ring_f2; |
|
633 | ring_node_to_send_cwf_f2 = waveform_ring_f2; | |
516 | ring_node_to_send_swf_f2 = waveform_ring_f2; |
|
634 | ring_node_to_send_swf_f2 = waveform_ring_f2; | |
517 |
|
635 | |||
518 | current_ring_node_f3 = waveform_ring_f3; |
|
636 | current_ring_node_f3 = waveform_ring_f3; | |
519 | ring_node_to_send_cwf_f3 = waveform_ring_f3; |
|
637 | ring_node_to_send_cwf_f3 = waveform_ring_f3; | |
520 | } |
|
638 | } | |
521 |
|
639 | |||
522 | int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF) |
|
640 | int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF) | |
523 | { |
|
641 | { | |
524 | unsigned char i; |
|
642 | unsigned char i; | |
525 | int return_value; |
|
643 | int return_value; | |
526 |
|
644 | |||
527 | return_value = LFR_SUCCESSFUL; |
|
645 | return_value = LFR_SUCCESSFUL; | |
528 |
|
646 | |||
529 | for (i=0; i<7; i++) |
|
647 | for (i=0; i<7; i++) | |
530 | { |
|
648 | { | |
531 | headerSWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
649 | headerSWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; | |
532 | headerSWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
650 | headerSWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
533 | headerSWF[ i ].reserved = DEFAULT_RESERVED; |
|
651 | headerSWF[ i ].reserved = DEFAULT_RESERVED; | |
534 | headerSWF[ i ].userApplication = CCSDS_USER_APP; |
|
652 | headerSWF[ i ].userApplication = CCSDS_USER_APP; | |
535 | headerSWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8); |
|
653 | headerSWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8); | |
536 | headerSWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST); |
|
654 | headerSWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST); | |
537 | headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
655 | headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
538 | if (i == 6) |
|
656 | if (i == 6) | |
539 | { |
|
657 | { | |
540 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_224 >> 8); |
|
658 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_224 >> 8); | |
541 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_224 ); |
|
659 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_224 ); | |
542 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_224 >> 8); |
|
660 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_224 >> 8); | |
543 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_224 ); |
|
661 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_224 ); | |
544 | } |
|
662 | } | |
545 | else |
|
663 | else | |
546 | { |
|
664 | { | |
547 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_304 >> 8); |
|
665 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_304 >> 8); | |
548 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_304 ); |
|
666 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_304 ); | |
549 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_304 >> 8); |
|
667 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_304 >> 8); | |
550 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_304 ); |
|
668 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_304 ); | |
551 | } |
|
669 | } | |
552 | headerSWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
670 | headerSWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
553 | headerSWF[ i ].pktCnt = DEFAULT_PKTCNT; // PKT_CNT |
|
671 | headerSWF[ i ].pktCnt = DEFAULT_PKTCNT; // PKT_CNT | |
554 | headerSWF[ i ].pktNr = i+1; // PKT_NR |
|
672 | headerSWF[ i ].pktNr = i+1; // PKT_NR | |
555 | // DATA FIELD HEADER |
|
673 | // DATA FIELD HEADER | |
556 | headerSWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
674 | headerSWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
557 | headerSWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
675 | headerSWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
558 | headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
676 | headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
559 | headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; |
|
677 | headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; | |
560 | // AUXILIARY DATA HEADER |
|
678 | // AUXILIARY DATA HEADER | |
561 | headerSWF[ i ].time[0] = 0x00; |
|
679 | headerSWF[ i ].time[0] = 0x00; | |
562 | headerSWF[ i ].time[0] = 0x00; |
|
680 | headerSWF[ i ].time[0] = 0x00; | |
563 | headerSWF[ i ].time[0] = 0x00; |
|
681 | headerSWF[ i ].time[0] = 0x00; | |
564 | headerSWF[ i ].time[0] = 0x00; |
|
682 | headerSWF[ i ].time[0] = 0x00; | |
565 | headerSWF[ i ].time[0] = 0x00; |
|
683 | headerSWF[ i ].time[0] = 0x00; | |
566 | headerSWF[ i ].time[0] = 0x00; |
|
684 | headerSWF[ i ].time[0] = 0x00; | |
567 | headerSWF[ i ].sid = sid; |
|
685 | headerSWF[ i ].sid = sid; | |
568 | headerSWF[ i ].hkBIA = DEFAULT_HKBIA; |
|
686 | headerSWF[ i ].hkBIA = DEFAULT_HKBIA; | |
569 | } |
|
687 | } | |
570 |
|
688 | |||
571 | return return_value; |
|
689 | return return_value; | |
572 | } |
|
690 | } | |
573 |
|
691 | |||
574 | int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF ) |
|
692 | int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF ) | |
575 | { |
|
693 | { | |
576 | unsigned int i; |
|
694 | unsigned int i; | |
577 | int return_value; |
|
695 | int return_value; | |
578 |
|
696 | |||
579 | return_value = LFR_SUCCESSFUL; |
|
697 | return_value = LFR_SUCCESSFUL; | |
580 |
|
698 | |||
581 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF; i++) |
|
699 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF; i++) | |
582 | { |
|
700 | { | |
583 | headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
701 | headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; | |
584 | headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
702 | headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
585 | headerCWF[ i ].reserved = DEFAULT_RESERVED; |
|
703 | headerCWF[ i ].reserved = DEFAULT_RESERVED; | |
586 | headerCWF[ i ].userApplication = CCSDS_USER_APP; |
|
704 | headerCWF[ i ].userApplication = CCSDS_USER_APP; | |
587 | if ( (sid == SID_SBM1_CWF_F1) || (sid == SID_SBM2_CWF_F2) ) |
|
705 | if ( (sid == SID_SBM1_CWF_F1) || (sid == SID_SBM2_CWF_F2) ) | |
588 | { |
|
706 | { | |
589 | headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_SBM1_SBM2 >> 8); |
|
707 | headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_SBM1_SBM2 >> 8); | |
590 | headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_SBM1_SBM2); |
|
708 | headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_SBM1_SBM2); | |
591 | } |
|
709 | } | |
592 | else |
|
710 | else | |
593 | { |
|
711 | { | |
594 | headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8); |
|
712 | headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8); | |
595 | headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST); |
|
713 | headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST); | |
596 | } |
|
714 | } | |
597 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
715 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
598 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_336 >> 8); |
|
716 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_336 >> 8); | |
599 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_336 ); |
|
717 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_336 ); | |
600 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF >> 8); |
|
718 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF >> 8); | |
601 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF ); |
|
719 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF ); | |
602 | headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
720 | headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
603 | // DATA FIELD HEADER |
|
721 | // DATA FIELD HEADER | |
604 | headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
722 | headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
605 | headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
723 | headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
606 | headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
724 | headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
607 | headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; |
|
725 | headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; | |
608 | // AUXILIARY DATA HEADER |
|
726 | // AUXILIARY DATA HEADER | |
609 | headerCWF[ i ].sid = sid; |
|
727 | headerCWF[ i ].sid = sid; | |
610 | headerCWF[ i ].hkBIA = DEFAULT_HKBIA; |
|
728 | headerCWF[ i ].hkBIA = DEFAULT_HKBIA; | |
611 | headerCWF[ i ].time[0] = 0x00; |
|
729 | headerCWF[ i ].time[0] = 0x00; | |
612 | headerCWF[ i ].time[0] = 0x00; |
|
730 | headerCWF[ i ].time[0] = 0x00; | |
613 | headerCWF[ i ].time[0] = 0x00; |
|
731 | headerCWF[ i ].time[0] = 0x00; | |
614 | headerCWF[ i ].time[0] = 0x00; |
|
732 | headerCWF[ i ].time[0] = 0x00; | |
615 | headerCWF[ i ].time[0] = 0x00; |
|
733 | headerCWF[ i ].time[0] = 0x00; | |
616 | headerCWF[ i ].time[0] = 0x00; |
|
734 | headerCWF[ i ].time[0] = 0x00; | |
617 | } |
|
735 | } | |
618 |
|
736 | |||
619 | return return_value; |
|
737 | return return_value; | |
620 | } |
|
738 | } | |
621 |
|
739 | |||
622 | int init_header_continuous_cwf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF ) |
|
740 | int init_header_continuous_cwf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF ) | |
623 | { |
|
741 | { | |
624 | unsigned int i; |
|
742 | unsigned int i; | |
625 | int return_value; |
|
743 | int return_value; | |
626 |
|
744 | |||
627 | return_value = LFR_SUCCESSFUL; |
|
745 | return_value = LFR_SUCCESSFUL; | |
628 |
|
746 | |||
629 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF_LIGHT; i++) |
|
747 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF_LIGHT; i++) | |
630 | { |
|
748 | { | |
631 | headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
749 | headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; | |
632 | headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
750 | headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
633 | headerCWF[ i ].reserved = DEFAULT_RESERVED; |
|
751 | headerCWF[ i ].reserved = DEFAULT_RESERVED; | |
634 | headerCWF[ i ].userApplication = CCSDS_USER_APP; |
|
752 | headerCWF[ i ].userApplication = CCSDS_USER_APP; | |
635 |
|
753 | |||
636 | headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8); |
|
754 | headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8); | |
637 | headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST); |
|
755 | headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST); | |
638 |
|
756 | |||
639 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
757 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
640 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_672 >> 8); |
|
758 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_672 >> 8); | |
641 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_672 ); |
|
759 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_672 ); | |
642 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF_SHORT_F3 >> 8); |
|
760 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF_SHORT_F3 >> 8); | |
643 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF_SHORT_F3 ); |
|
761 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF_SHORT_F3 ); | |
644 |
|
762 | |||
645 | headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
763 | headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
646 | // DATA FIELD HEADER |
|
764 | // DATA FIELD HEADER | |
647 | headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
765 | headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
648 | headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
766 | headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
649 | headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
767 | headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
650 | headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; |
|
768 | headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; | |
651 | // AUXILIARY DATA HEADER |
|
769 | // AUXILIARY DATA HEADER | |
652 | headerCWF[ i ].sid = SID_NORM_CWF_F3; |
|
770 | headerCWF[ i ].sid = SID_NORM_CWF_F3; | |
653 | headerCWF[ i ].hkBIA = DEFAULT_HKBIA; |
|
771 | headerCWF[ i ].hkBIA = DEFAULT_HKBIA; | |
654 | headerCWF[ i ].time[0] = 0x00; |
|
772 | headerCWF[ i ].time[0] = 0x00; | |
655 | headerCWF[ i ].time[0] = 0x00; |
|
773 | headerCWF[ i ].time[0] = 0x00; | |
656 | headerCWF[ i ].time[0] = 0x00; |
|
774 | headerCWF[ i ].time[0] = 0x00; | |
657 | headerCWF[ i ].time[0] = 0x00; |
|
775 | headerCWF[ i ].time[0] = 0x00; | |
658 | headerCWF[ i ].time[0] = 0x00; |
|
776 | headerCWF[ i ].time[0] = 0x00; | |
659 | headerCWF[ i ].time[0] = 0x00; |
|
777 | headerCWF[ i ].time[0] = 0x00; | |
660 | } |
|
778 | } | |
661 |
|
779 | |||
662 | return return_value; |
|
780 | return return_value; | |
663 | } |
|
781 | } | |
664 |
|
782 | |||
665 | int send_waveform_SWF( volatile int *waveform, unsigned int sid, |
|
783 | int send_waveform_SWF( volatile int *waveform, unsigned int sid, | |
666 | Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id ) |
|
784 | Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id ) | |
667 | { |
|
785 | { | |
668 | /** This function sends SWF CCSDS packets (F2, F1 or F0). |
|
786 | /** This function sends SWF CCSDS packets (F2, F1 or F0). | |
669 | * |
|
787 | * | |
670 | * @param waveform points to the buffer containing the data that will be send. |
|
788 | * @param waveform points to the buffer containing the data that will be send. | |
671 | * @param sid is the source identifier of the data that will be sent. |
|
789 | * @param sid is the source identifier of the data that will be sent. | |
672 | * @param headerSWF points to a table of headers that have been prepared for the data transmission. |
|
790 | * @param headerSWF points to a table of headers that have been prepared for the data transmission. | |
673 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures |
|
791 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures | |
674 | * contain information to setup the transmission of the data packets. |
|
792 | * contain information to setup the transmission of the data packets. | |
675 | * |
|
793 | * | |
676 | * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks. |
|
794 | * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks. | |
677 | * |
|
795 | * | |
678 | */ |
|
796 | */ | |
679 |
|
797 | |||
680 | unsigned int i; |
|
798 | unsigned int i; | |
681 | int ret; |
|
799 | int ret; | |
682 | unsigned int coarseTime; |
|
800 | unsigned int coarseTime; | |
683 | unsigned int fineTime; |
|
801 | unsigned int fineTime; | |
684 | rtems_status_code status; |
|
802 | rtems_status_code status; | |
685 | spw_ioctl_pkt_send spw_ioctl_send_SWF; |
|
803 | spw_ioctl_pkt_send spw_ioctl_send_SWF; | |
686 |
|
804 | |||
687 | spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header |
|
805 | spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header | |
688 | spw_ioctl_send_SWF.options = 0; |
|
806 | spw_ioctl_send_SWF.options = 0; | |
689 |
|
807 | |||
690 | ret = LFR_DEFAULT; |
|
808 | ret = LFR_DEFAULT; | |
691 |
|
809 | |||
692 | coarseTime = waveform[0]; |
|
810 | coarseTime = waveform[0]; | |
693 | fineTime = waveform[1]; |
|
811 | fineTime = waveform[1]; | |
694 |
|
812 | |||
695 | for (i=0; i<7; i++) // send waveform |
|
813 | for (i=0; i<7; i++) // send waveform | |
696 | { |
|
814 | { | |
697 | spw_ioctl_send_SWF.data = (char*) &waveform[ (i * BLK_NR_304 * NB_WORDS_SWF_BLK) + TIME_OFFSET]; |
|
815 | spw_ioctl_send_SWF.data = (char*) &waveform[ (i * BLK_NR_304 * NB_WORDS_SWF_BLK) + TIME_OFFSET]; | |
698 | spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ]; |
|
816 | spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ]; | |
699 | // BUILD THE DATA |
|
817 | // BUILD THE DATA | |
700 | if (i==6) { |
|
818 | if (i==6) { | |
701 | spw_ioctl_send_SWF.dlen = BLK_NR_224 * NB_BYTES_SWF_BLK; |
|
819 | spw_ioctl_send_SWF.dlen = BLK_NR_224 * NB_BYTES_SWF_BLK; | |
702 | } |
|
820 | } | |
703 | else { |
|
821 | else { | |
704 | spw_ioctl_send_SWF.dlen = BLK_NR_304 * NB_BYTES_SWF_BLK; |
|
822 | spw_ioctl_send_SWF.dlen = BLK_NR_304 * NB_BYTES_SWF_BLK; | |
705 | } |
|
823 | } | |
706 | // SET PACKET SEQUENCE COUNTER |
|
824 | // SET PACKET SEQUENCE COUNTER | |
707 | increment_seq_counter_source_id( headerSWF[ i ].packetSequenceControl, sid ); |
|
825 | increment_seq_counter_source_id( headerSWF[ i ].packetSequenceControl, sid ); | |
708 | // SET PACKET TIME |
|
826 | // SET PACKET TIME | |
709 | compute_acquisition_time( coarseTime, fineTime, sid, i, headerSWF[ i ].acquisitionTime ); |
|
827 | compute_acquisition_time( coarseTime, fineTime, sid, i, headerSWF[ i ].acquisitionTime ); | |
710 | // |
|
828 | // | |
711 | headerSWF[ i ].time[0] = headerSWF[ i ].acquisitionTime[0]; |
|
829 | headerSWF[ i ].time[0] = headerSWF[ i ].acquisitionTime[0]; | |
712 | headerSWF[ i ].time[1] = headerSWF[ i ].acquisitionTime[1]; |
|
830 | headerSWF[ i ].time[1] = headerSWF[ i ].acquisitionTime[1]; | |
713 | headerSWF[ i ].time[2] = headerSWF[ i ].acquisitionTime[2]; |
|
831 | headerSWF[ i ].time[2] = headerSWF[ i ].acquisitionTime[2]; | |
714 | headerSWF[ i ].time[3] = headerSWF[ i ].acquisitionTime[3]; |
|
832 | headerSWF[ i ].time[3] = headerSWF[ i ].acquisitionTime[3]; | |
715 | headerSWF[ i ].time[4] = headerSWF[ i ].acquisitionTime[4]; |
|
833 | headerSWF[ i ].time[4] = headerSWF[ i ].acquisitionTime[4]; | |
716 | headerSWF[ i ].time[5] = headerSWF[ i ].acquisitionTime[5]; |
|
834 | headerSWF[ i ].time[5] = headerSWF[ i ].acquisitionTime[5]; | |
717 | // SEND PACKET |
|
835 | // SEND PACKET | |
718 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_SWF, ACTION_MSG_SPW_IOCTL_SEND_SIZE); |
|
836 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_SWF, ACTION_MSG_SPW_IOCTL_SEND_SIZE); | |
719 | if (status != RTEMS_SUCCESSFUL) { |
|
837 | if (status != RTEMS_SUCCESSFUL) { | |
720 | printf("%d-%d, ERR %d\n", sid, i, (int) status); |
|
838 | printf("%d-%d, ERR %d\n", sid, i, (int) status); | |
721 | ret = LFR_DEFAULT; |
|
839 | ret = LFR_DEFAULT; | |
722 | } |
|
840 | } | |
723 | rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds |
|
841 | rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds | |
724 | } |
|
842 | } | |
725 |
|
843 | |||
726 | return ret; |
|
844 | return ret; | |
727 | } |
|
845 | } | |
728 |
|
846 | |||
729 | int send_waveform_CWF(volatile int *waveform, unsigned int sid, |
|
847 | int send_waveform_CWF(volatile int *waveform, unsigned int sid, | |
730 | Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id) |
|
848 | Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id) | |
731 | { |
|
849 | { | |
732 | /** This function sends CWF CCSDS packets (F2, F1 or F0). |
|
850 | /** This function sends CWF CCSDS packets (F2, F1 or F0). | |
733 | * |
|
851 | * | |
734 | * @param waveform points to the buffer containing the data that will be send. |
|
852 | * @param waveform points to the buffer containing the data that will be send. | |
735 | * @param sid is the source identifier of the data that will be sent. |
|
853 | * @param sid is the source identifier of the data that will be sent. | |
736 | * @param headerCWF points to a table of headers that have been prepared for the data transmission. |
|
854 | * @param headerCWF points to a table of headers that have been prepared for the data transmission. | |
737 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures |
|
855 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures | |
738 | * contain information to setup the transmission of the data packets. |
|
856 | * contain information to setup the transmission of the data packets. | |
739 | * |
|
857 | * | |
740 | * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks. |
|
858 | * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks. | |
741 | * |
|
859 | * | |
742 | */ |
|
860 | */ | |
743 |
|
861 | |||
744 | unsigned int i; |
|
862 | unsigned int i; | |
745 | int ret; |
|
863 | int ret; | |
746 | unsigned int coarseTime; |
|
864 | unsigned int coarseTime; | |
747 | unsigned int fineTime; |
|
865 | unsigned int fineTime; | |
748 | rtems_status_code status; |
|
866 | rtems_status_code status; | |
749 | spw_ioctl_pkt_send spw_ioctl_send_CWF; |
|
867 | spw_ioctl_pkt_send spw_ioctl_send_CWF; | |
750 |
|
868 | |||
751 | spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header |
|
869 | spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header | |
752 | spw_ioctl_send_CWF.options = 0; |
|
870 | spw_ioctl_send_CWF.options = 0; | |
753 |
|
871 | |||
754 | ret = LFR_DEFAULT; |
|
872 | ret = LFR_DEFAULT; | |
755 |
|
873 | |||
756 | coarseTime = waveform[0]; |
|
874 | coarseTime = waveform[0]; | |
757 | fineTime = waveform[1]; |
|
875 | fineTime = waveform[1]; | |
758 |
|
876 | |||
759 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF; i++) // send waveform |
|
877 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF; i++) // send waveform | |
760 | { |
|
878 | { | |
761 | spw_ioctl_send_CWF.data = (char*) &waveform[ (i * BLK_NR_CWF * NB_WORDS_SWF_BLK) + TIME_OFFSET]; |
|
879 | spw_ioctl_send_CWF.data = (char*) &waveform[ (i * BLK_NR_CWF * NB_WORDS_SWF_BLK) + TIME_OFFSET]; | |
762 | spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ]; |
|
880 | spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ]; | |
763 | // BUILD THE DATA |
|
881 | // BUILD THE DATA | |
764 | spw_ioctl_send_CWF.dlen = BLK_NR_CWF * NB_BYTES_SWF_BLK; |
|
882 | spw_ioctl_send_CWF.dlen = BLK_NR_CWF * NB_BYTES_SWF_BLK; | |
765 | // SET PACKET SEQUENCE COUNTER |
|
883 | // SET PACKET SEQUENCE COUNTER | |
766 | increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, sid ); |
|
884 | increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, sid ); | |
767 | // SET PACKET TIME |
|
885 | // SET PACKET TIME | |
768 | compute_acquisition_time( coarseTime, fineTime, sid, i, headerCWF[ i ].acquisitionTime); |
|
886 | compute_acquisition_time( coarseTime, fineTime, sid, i, headerCWF[ i ].acquisitionTime); | |
769 | // |
|
887 | // | |
770 | headerCWF[ i ].time[0] = headerCWF[ i ].acquisitionTime[0]; |
|
888 | headerCWF[ i ].time[0] = headerCWF[ i ].acquisitionTime[0]; | |
771 | headerCWF[ i ].time[1] = headerCWF[ i ].acquisitionTime[1]; |
|
889 | headerCWF[ i ].time[1] = headerCWF[ i ].acquisitionTime[1]; | |
772 | headerCWF[ i ].time[2] = headerCWF[ i ].acquisitionTime[2]; |
|
890 | headerCWF[ i ].time[2] = headerCWF[ i ].acquisitionTime[2]; | |
773 | headerCWF[ i ].time[3] = headerCWF[ i ].acquisitionTime[3]; |
|
891 | headerCWF[ i ].time[3] = headerCWF[ i ].acquisitionTime[3]; | |
774 | headerCWF[ i ].time[4] = headerCWF[ i ].acquisitionTime[4]; |
|
892 | headerCWF[ i ].time[4] = headerCWF[ i ].acquisitionTime[4]; | |
775 | headerCWF[ i ].time[5] = headerCWF[ i ].acquisitionTime[5]; |
|
893 | headerCWF[ i ].time[5] = headerCWF[ i ].acquisitionTime[5]; | |
776 | // SEND PACKET |
|
894 | // SEND PACKET | |
777 | if (sid == SID_NORM_CWF_LONG_F3) |
|
895 | if (sid == SID_NORM_CWF_LONG_F3) | |
778 | { |
|
896 | { | |
779 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); |
|
897 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); | |
780 | if (status != RTEMS_SUCCESSFUL) { |
|
898 | if (status != RTEMS_SUCCESSFUL) { | |
781 | printf("%d-%d, ERR %d\n", sid, i, (int) status); |
|
899 | printf("%d-%d, ERR %d\n", sid, i, (int) status); | |
782 | ret = LFR_DEFAULT; |
|
900 | ret = LFR_DEFAULT; | |
783 | } |
|
901 | } | |
784 | rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS); |
|
902 | rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS); | |
785 | } |
|
903 | } | |
786 | else |
|
904 | else | |
787 | { |
|
905 | { | |
788 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); |
|
906 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); | |
789 | if (status != RTEMS_SUCCESSFUL) { |
|
907 | if (status != RTEMS_SUCCESSFUL) { | |
790 | printf("%d-%d, ERR %d\n", sid, i, (int) status); |
|
908 | printf("%d-%d, ERR %d\n", sid, i, (int) status); | |
791 | ret = LFR_DEFAULT; |
|
909 | ret = LFR_DEFAULT; | |
792 | } |
|
910 | } | |
793 | } |
|
911 | } | |
794 | } |
|
912 | } | |
795 |
|
913 | |||
796 | return ret; |
|
914 | return ret; | |
797 | } |
|
915 | } | |
798 |
|
916 | |||
799 | int send_waveform_CWF3_light(volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id) |
|
917 | int send_waveform_CWF3_light(volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id) | |
800 | { |
|
918 | { | |
801 | /** This function sends CWF_F3 CCSDS packets without the b1, b2 and b3 data. |
|
919 | /** This function sends CWF_F3 CCSDS packets without the b1, b2 and b3 data. | |
802 | * |
|
920 | * | |
803 | * @param waveform points to the buffer containing the data that will be send. |
|
921 | * @param waveform points to the buffer containing the data that will be send. | |
804 | * @param headerCWF points to a table of headers that have been prepared for the data transmission. |
|
922 | * @param headerCWF points to a table of headers that have been prepared for the data transmission. | |
805 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures |
|
923 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures | |
806 | * contain information to setup the transmission of the data packets. |
|
924 | * contain information to setup the transmission of the data packets. | |
807 | * |
|
925 | * | |
808 | * By default, CWF_F3 packet are send without the b1, b2 and b3 data. This function rebuilds a data buffer |
|
926 | * By default, CWF_F3 packet are send without the b1, b2 and b3 data. This function rebuilds a data buffer | |
809 | * from the incoming data and sends it in 7 packets, 6 containing 340 blocks and 1 one containing 8 blocks. |
|
927 | * from the incoming data and sends it in 7 packets, 6 containing 340 blocks and 1 one containing 8 blocks. | |
810 | * |
|
928 | * | |
811 | */ |
|
929 | */ | |
812 |
|
930 | |||
813 | unsigned int i; |
|
931 | unsigned int i; | |
814 | int ret; |
|
932 | int ret; | |
815 | unsigned int coarseTime; |
|
933 | unsigned int coarseTime; | |
816 | unsigned int fineTime; |
|
934 | unsigned int fineTime; | |
817 | rtems_status_code status; |
|
935 | rtems_status_code status; | |
818 | spw_ioctl_pkt_send spw_ioctl_send_CWF; |
|
936 | spw_ioctl_pkt_send spw_ioctl_send_CWF; | |
819 | char *sample; |
|
937 | char *sample; | |
820 |
|
938 | |||
821 | spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header |
|
939 | spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header | |
822 | spw_ioctl_send_CWF.options = 0; |
|
940 | spw_ioctl_send_CWF.options = 0; | |
823 |
|
941 | |||
824 | ret = LFR_DEFAULT; |
|
942 | ret = LFR_DEFAULT; | |
825 |
|
943 | |||
826 | //********************** |
|
944 | //********************** | |
827 | // BUILD CWF3_light DATA |
|
945 | // BUILD CWF3_light DATA | |
828 | for ( i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++) |
|
946 | for ( i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++) | |
829 | { |
|
947 | { | |
830 | sample = (char*) &waveform[ (i * NB_WORDS_SWF_BLK) + TIME_OFFSET ]; |
|
948 | sample = (char*) &waveform[ (i * NB_WORDS_SWF_BLK) + TIME_OFFSET ]; | |
831 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + TIME_OFFSET_IN_BYTES ] = sample[ 0 ]; |
|
949 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + TIME_OFFSET_IN_BYTES ] = sample[ 0 ]; | |
832 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 + TIME_OFFSET_IN_BYTES ] = sample[ 1 ]; |
|
950 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 + TIME_OFFSET_IN_BYTES ] = sample[ 1 ]; | |
833 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 + TIME_OFFSET_IN_BYTES ] = sample[ 2 ]; |
|
951 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 + TIME_OFFSET_IN_BYTES ] = sample[ 2 ]; | |
834 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 + TIME_OFFSET_IN_BYTES ] = sample[ 3 ]; |
|
952 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 + TIME_OFFSET_IN_BYTES ] = sample[ 3 ]; | |
835 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 + TIME_OFFSET_IN_BYTES ] = sample[ 4 ]; |
|
953 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 + TIME_OFFSET_IN_BYTES ] = sample[ 4 ]; | |
836 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 + TIME_OFFSET_IN_BYTES ] = sample[ 5 ]; |
|
954 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 + TIME_OFFSET_IN_BYTES ] = sample[ 5 ]; | |
837 | } |
|
955 | } | |
838 |
|
956 | |||
839 | coarseTime = waveform[0]; |
|
957 | coarseTime = waveform[0]; | |
840 | fineTime = waveform[1]; |
|
958 | fineTime = waveform[1]; | |
841 |
|
959 | |||
842 | //********************* |
|
960 | //********************* | |
843 | // SEND CWF3_light DATA |
|
961 | // SEND CWF3_light DATA | |
844 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF_LIGHT; i++) // send waveform |
|
962 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF_LIGHT; i++) // send waveform | |
845 | { |
|
963 | { | |
846 | spw_ioctl_send_CWF.data = (char*) &wf_cont_f3_light[ (i * BLK_NR_CWF_SHORT_F3 * NB_BYTES_CWF3_LIGHT_BLK) + TIME_OFFSET_IN_BYTES]; |
|
964 | spw_ioctl_send_CWF.data = (char*) &wf_cont_f3_light[ (i * BLK_NR_CWF_SHORT_F3 * NB_BYTES_CWF3_LIGHT_BLK) + TIME_OFFSET_IN_BYTES]; | |
847 | spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ]; |
|
965 | spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ]; | |
848 | // BUILD THE DATA |
|
966 | // BUILD THE DATA | |
849 | spw_ioctl_send_CWF.dlen = BLK_NR_CWF_SHORT_F3 * NB_BYTES_CWF3_LIGHT_BLK; |
|
967 | spw_ioctl_send_CWF.dlen = BLK_NR_CWF_SHORT_F3 * NB_BYTES_CWF3_LIGHT_BLK; | |
850 | // SET PACKET SEQUENCE COUNTER |
|
968 | // SET PACKET SEQUENCE COUNTER | |
851 | increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, SID_NORM_CWF_F3 ); |
|
969 | increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, SID_NORM_CWF_F3 ); | |
852 | // SET PACKET TIME |
|
970 | // SET PACKET TIME | |
853 | compute_acquisition_time( coarseTime, fineTime, SID_NORM_CWF_F3, i, headerCWF[ i ].acquisitionTime ); |
|
971 | compute_acquisition_time( coarseTime, fineTime, SID_NORM_CWF_F3, i, headerCWF[ i ].acquisitionTime ); | |
854 | // |
|
972 | // | |
855 | headerCWF[ i ].time[0] = headerCWF[ i ].acquisitionTime[0]; |
|
973 | headerCWF[ i ].time[0] = headerCWF[ i ].acquisitionTime[0]; | |
856 | headerCWF[ i ].time[1] = headerCWF[ i ].acquisitionTime[1]; |
|
974 | headerCWF[ i ].time[1] = headerCWF[ i ].acquisitionTime[1]; | |
857 | headerCWF[ i ].time[2] = headerCWF[ i ].acquisitionTime[2]; |
|
975 | headerCWF[ i ].time[2] = headerCWF[ i ].acquisitionTime[2]; | |
858 | headerCWF[ i ].time[3] = headerCWF[ i ].acquisitionTime[3]; |
|
976 | headerCWF[ i ].time[3] = headerCWF[ i ].acquisitionTime[3]; | |
859 | headerCWF[ i ].time[4] = headerCWF[ i ].acquisitionTime[4]; |
|
977 | headerCWF[ i ].time[4] = headerCWF[ i ].acquisitionTime[4]; | |
860 | headerCWF[ i ].time[5] = headerCWF[ i ].acquisitionTime[5]; |
|
978 | headerCWF[ i ].time[5] = headerCWF[ i ].acquisitionTime[5]; | |
861 | // SEND PACKET |
|
979 | // SEND PACKET | |
862 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); |
|
980 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); | |
863 | if (status != RTEMS_SUCCESSFUL) { |
|
981 | if (status != RTEMS_SUCCESSFUL) { | |
864 | printf("%d-%d, ERR %d\n", SID_NORM_CWF_F3, i, (int) status); |
|
982 | printf("%d-%d, ERR %d\n", SID_NORM_CWF_F3, i, (int) status); | |
865 | ret = LFR_DEFAULT; |
|
983 | ret = LFR_DEFAULT; | |
866 | } |
|
984 | } | |
867 | rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS); |
|
985 | rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS); | |
868 | } |
|
986 | } | |
869 |
|
987 | |||
870 | return ret; |
|
988 | return ret; | |
871 | } |
|
989 | } | |
872 |
|
990 | |||
873 | void compute_acquisition_time( unsigned int coarseTime, unsigned int fineTime, |
|
991 | void compute_acquisition_time( unsigned int coarseTime, unsigned int fineTime, | |
874 | unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char * acquisitionTime ) |
|
992 | unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char * acquisitionTime ) | |
875 | { |
|
993 | { | |
876 | unsigned long long int acquisitionTimeAsLong; |
|
994 | unsigned long long int acquisitionTimeAsLong; | |
877 | unsigned char localAcquisitionTime[6]; |
|
995 | unsigned char localAcquisitionTime[6]; | |
878 | double deltaT; |
|
996 | double deltaT; | |
879 |
|
997 | |||
880 | deltaT = 0.; |
|
998 | deltaT = 0.; | |
881 |
|
999 | |||
882 | localAcquisitionTime[0] = (unsigned char) ( coarseTime >> 24 ); |
|
1000 | localAcquisitionTime[0] = (unsigned char) ( coarseTime >> 24 ); | |
883 | localAcquisitionTime[1] = (unsigned char) ( coarseTime >> 16 ); |
|
1001 | localAcquisitionTime[1] = (unsigned char) ( coarseTime >> 16 ); | |
884 | localAcquisitionTime[2] = (unsigned char) ( coarseTime >> 8 ); |
|
1002 | localAcquisitionTime[2] = (unsigned char) ( coarseTime >> 8 ); | |
885 | localAcquisitionTime[3] = (unsigned char) ( coarseTime ); |
|
1003 | localAcquisitionTime[3] = (unsigned char) ( coarseTime ); | |
886 | localAcquisitionTime[4] = (unsigned char) ( fineTime >> 8 ); |
|
1004 | localAcquisitionTime[4] = (unsigned char) ( fineTime >> 8 ); | |
887 | localAcquisitionTime[5] = (unsigned char) ( fineTime ); |
|
1005 | localAcquisitionTime[5] = (unsigned char) ( fineTime ); | |
888 |
|
1006 | |||
889 | acquisitionTimeAsLong = ( (unsigned long long int) localAcquisitionTime[0] << 40 ) |
|
1007 | acquisitionTimeAsLong = ( (unsigned long long int) localAcquisitionTime[0] << 40 ) | |
890 | + ( (unsigned long long int) localAcquisitionTime[1] << 32 ) |
|
1008 | + ( (unsigned long long int) localAcquisitionTime[1] << 32 ) | |
891 | + ( (unsigned long long int) localAcquisitionTime[2] << 24 ) |
|
1009 | + ( (unsigned long long int) localAcquisitionTime[2] << 24 ) | |
892 | + ( (unsigned long long int) localAcquisitionTime[3] << 16 ) |
|
1010 | + ( (unsigned long long int) localAcquisitionTime[3] << 16 ) | |
893 | + ( (unsigned long long int) localAcquisitionTime[4] << 8 ) |
|
1011 | + ( (unsigned long long int) localAcquisitionTime[4] << 8 ) | |
894 | + ( (unsigned long long int) localAcquisitionTime[5] ); |
|
1012 | + ( (unsigned long long int) localAcquisitionTime[5] ); | |
895 |
|
1013 | |||
896 | switch( sid ) |
|
1014 | switch( sid ) | |
897 | { |
|
1015 | { | |
898 | case SID_NORM_SWF_F0: |
|
1016 | case SID_NORM_SWF_F0: | |
899 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 24576. ; |
|
1017 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 24576. ; | |
900 | break; |
|
1018 | break; | |
901 |
|
1019 | |||
902 | case SID_NORM_SWF_F1: |
|
1020 | case SID_NORM_SWF_F1: | |
903 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 4096. ; |
|
1021 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 4096. ; | |
904 | break; |
|
1022 | break; | |
905 |
|
1023 | |||
906 | case SID_NORM_SWF_F2: |
|
1024 | case SID_NORM_SWF_F2: | |
907 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 256. ; |
|
1025 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 256. ; | |
908 | break; |
|
1026 | break; | |
909 |
|
1027 | |||
910 | case SID_SBM1_CWF_F1: |
|
1028 | case SID_SBM1_CWF_F1: | |
911 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 4096. ; |
|
1029 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 4096. ; | |
912 | break; |
|
1030 | break; | |
913 |
|
1031 | |||
914 | case SID_SBM2_CWF_F2: |
|
1032 | case SID_SBM2_CWF_F2: | |
915 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ; |
|
1033 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ; | |
916 | break; |
|
1034 | break; | |
917 |
|
1035 | |||
918 | case SID_BURST_CWF_F2: |
|
1036 | case SID_BURST_CWF_F2: | |
919 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ; |
|
1037 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ; | |
920 | break; |
|
1038 | break; | |
921 |
|
1039 | |||
922 | case SID_NORM_CWF_F3: |
|
1040 | case SID_NORM_CWF_F3: | |
923 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF_SHORT_F3 * 65536. / 16. ; |
|
1041 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF_SHORT_F3 * 65536. / 16. ; | |
924 | break; |
|
1042 | break; | |
925 |
|
1043 | |||
926 | case SID_NORM_CWF_LONG_F3: |
|
1044 | case SID_NORM_CWF_LONG_F3: | |
927 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 16. ; |
|
1045 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 16. ; | |
928 | break; |
|
1046 | break; | |
929 |
|
1047 | |||
930 | default: |
|
1048 | default: | |
931 | PRINTF1("in compute_acquisition_time *** ERR unexpected sid %d", sid) |
|
1049 | PRINTF1("in compute_acquisition_time *** ERR unexpected sid %d", sid) | |
932 | deltaT = 0.; |
|
1050 | deltaT = 0.; | |
933 | break; |
|
1051 | break; | |
934 | } |
|
1052 | } | |
935 |
|
1053 | |||
936 | acquisitionTimeAsLong = acquisitionTimeAsLong + (unsigned long long int) deltaT; |
|
1054 | acquisitionTimeAsLong = acquisitionTimeAsLong + (unsigned long long int) deltaT; | |
937 | // |
|
1055 | // | |
938 | acquisitionTime[0] = (unsigned char) (acquisitionTimeAsLong >> 40); |
|
1056 | acquisitionTime[0] = (unsigned char) (acquisitionTimeAsLong >> 40); | |
939 | acquisitionTime[1] = (unsigned char) (acquisitionTimeAsLong >> 32); |
|
1057 | acquisitionTime[1] = (unsigned char) (acquisitionTimeAsLong >> 32); | |
940 | acquisitionTime[2] = (unsigned char) (acquisitionTimeAsLong >> 24); |
|
1058 | acquisitionTime[2] = (unsigned char) (acquisitionTimeAsLong >> 24); | |
941 | acquisitionTime[3] = (unsigned char) (acquisitionTimeAsLong >> 16); |
|
1059 | acquisitionTime[3] = (unsigned char) (acquisitionTimeAsLong >> 16); | |
942 | acquisitionTime[4] = (unsigned char) (acquisitionTimeAsLong >> 8 ); |
|
1060 | acquisitionTime[4] = (unsigned char) (acquisitionTimeAsLong >> 8 ); | |
943 | acquisitionTime[5] = (unsigned char) (acquisitionTimeAsLong ); |
|
1061 | acquisitionTime[5] = (unsigned char) (acquisitionTimeAsLong ); | |
944 |
|
1062 | |||
945 | } |
|
1063 | } | |
946 |
|
1064 | |||
947 | void build_snapshot_from_ring( ring_node *ring_node_to_send, unsigned char frequencyChannel ) |
|
1065 | void build_snapshot_from_ring( ring_node *ring_node_to_send, unsigned char frequencyChannel ) | |
948 | { |
|
1066 | { | |
949 | unsigned int i; |
|
1067 | unsigned int i; | |
950 | unsigned long long int centerTime_asLong; |
|
1068 | unsigned long long int centerTime_asLong; | |
951 | unsigned long long int acquisitionTimeF0_asLong; |
|
1069 | unsigned long long int acquisitionTimeF0_asLong; | |
952 | unsigned long long int acquisitionTime_asLong; |
|
1070 | unsigned long long int acquisitionTime_asLong; | |
953 | unsigned long long int bufferAcquisitionTime_asLong; |
|
1071 | unsigned long long int bufferAcquisitionTime_asLong; | |
954 | unsigned char *ptr1; |
|
1072 | unsigned char *ptr1; | |
955 | unsigned char *ptr2; |
|
1073 | unsigned char *ptr2; | |
956 | unsigned char *timeCharPtr; |
|
1074 | unsigned char *timeCharPtr; | |
957 | unsigned char nb_ring_nodes; |
|
1075 | unsigned char nb_ring_nodes; | |
958 | unsigned long long int frequency_asLong; |
|
1076 | unsigned long long int frequency_asLong; | |
959 | unsigned long long int nbTicksPerSample_asLong; |
|
1077 | unsigned long long int nbTicksPerSample_asLong; | |
960 | unsigned long long int nbSamplesPart1_asLong; |
|
1078 | unsigned long long int nbSamplesPart1_asLong; | |
961 | unsigned long long int sampleOffset_asLong; |
|
1079 | unsigned long long int sampleOffset_asLong; | |
962 |
|
1080 | |||
963 | unsigned int deltaT_F0; |
|
1081 | unsigned int deltaT_F0; | |
964 | unsigned int deltaT_F1; |
|
1082 | unsigned int deltaT_F1; | |
965 | unsigned long long int deltaT_F2; |
|
1083 | unsigned long long int deltaT_F2; | |
966 |
|
1084 | |||
967 | deltaT_F0 = 2731; // (2048. / 24576. / 2.) * 65536. = 2730.667; |
|
1085 | deltaT_F0 = 2731; // (2048. / 24576. / 2.) * 65536. = 2730.667; | |
968 | deltaT_F1 = 16384; // (2048. / 4096. / 2.) * 65536. = 16384; |
|
1086 | deltaT_F1 = 16384; // (2048. / 4096. / 2.) * 65536. = 16384; | |
969 | deltaT_F2 = 262144; // (2048. / 256. / 2.) * 65536. = 262144; |
|
1087 | deltaT_F2 = 262144; // (2048. / 256. / 2.) * 65536. = 262144; | |
970 | sampleOffset_asLong = 0x00; |
|
1088 | sampleOffset_asLong = 0x00; | |
971 |
|
1089 | |||
972 | // (1) get the f0 acquisition time |
|
1090 | // (1) get the f0 acquisition time | |
973 | acquisitionTimeF0_asLong = get_acquisition_time( (unsigned char *) current_ring_node_f0->buffer_address ); |
|
1091 | acquisitionTimeF0_asLong = get_acquisition_time( (unsigned char *) current_ring_node_f0->buffer_address ); | |
974 |
|
1092 | |||
975 | // (2) compute the central reference time |
|
1093 | // (2) compute the central reference time | |
976 | centerTime_asLong = acquisitionTimeF0_asLong + deltaT_F0; |
|
1094 | centerTime_asLong = acquisitionTimeF0_asLong + deltaT_F0; | |
977 |
|
1095 | |||
978 | // (3) compute the acquisition time of the current snapshot |
|
1096 | // (3) compute the acquisition time of the current snapshot | |
979 | switch(frequencyChannel) |
|
1097 | switch(frequencyChannel) | |
980 | { |
|
1098 | { | |
981 | case 1: // 1 is for F1 = 4096 Hz |
|
1099 | case 1: // 1 is for F1 = 4096 Hz | |
982 | acquisitionTime_asLong = centerTime_asLong - deltaT_F1; |
|
1100 | acquisitionTime_asLong = centerTime_asLong - deltaT_F1; | |
983 | nb_ring_nodes = NB_RING_NODES_F1; |
|
1101 | nb_ring_nodes = NB_RING_NODES_F1; | |
984 | frequency_asLong = 4096; |
|
1102 | frequency_asLong = 4096; | |
985 | nbTicksPerSample_asLong = 16; // 65536 / 4096; |
|
1103 | nbTicksPerSample_asLong = 16; // 65536 / 4096; | |
986 | break; |
|
1104 | break; | |
987 | case 2: // 2 is for F2 = 256 Hz |
|
1105 | case 2: // 2 is for F2 = 256 Hz | |
988 | acquisitionTime_asLong = centerTime_asLong - deltaT_F2; |
|
1106 | acquisitionTime_asLong = centerTime_asLong - deltaT_F2; | |
989 | nb_ring_nodes = NB_RING_NODES_F2; |
|
1107 | nb_ring_nodes = NB_RING_NODES_F2; | |
990 | frequency_asLong = 256; |
|
1108 | frequency_asLong = 256; | |
991 | nbTicksPerSample_asLong = 256; // 65536 / 256; |
|
1109 | nbTicksPerSample_asLong = 256; // 65536 / 256; | |
992 | break; |
|
1110 | break; | |
993 | default: |
|
1111 | default: | |
994 | acquisitionTime_asLong = centerTime_asLong; |
|
1112 | acquisitionTime_asLong = centerTime_asLong; | |
995 | frequency_asLong = 256; |
|
1113 | frequency_asLong = 256; | |
996 | nbTicksPerSample_asLong = 256; |
|
1114 | nbTicksPerSample_asLong = 256; | |
997 | break; |
|
1115 | break; | |
998 | } |
|
1116 | } | |
999 |
|
1117 | |||
1000 | //**************************************************************************** |
|
1118 | //**************************************************************************** | |
1001 | // (4) search the ring_node with the acquisition time <= acquisitionTime_asLong |
|
1119 | // (4) search the ring_node with the acquisition time <= acquisitionTime_asLong | |
1002 | for (i=0; i<nb_ring_nodes; i++) |
|
1120 | for (i=0; i<nb_ring_nodes; i++) | |
1003 | { |
|
1121 | { | |
1004 | PRINTF1("%d ... ", i) |
|
1122 | PRINTF1("%d ... ", i) | |
1005 | bufferAcquisitionTime_asLong = get_acquisition_time( (unsigned char *) ring_node_to_send->buffer_address ); |
|
1123 | bufferAcquisitionTime_asLong = get_acquisition_time( (unsigned char *) ring_node_to_send->buffer_address ); | |
1006 | if (bufferAcquisitionTime_asLong <= acquisitionTime_asLong) |
|
1124 | if (bufferAcquisitionTime_asLong <= acquisitionTime_asLong) | |
1007 | { |
|
1125 | { | |
1008 | PRINTF1("buffer found with acquisition time = %llx\n", bufferAcquisitionTime_asLong) |
|
1126 | PRINTF1("buffer found with acquisition time = %llx\n", bufferAcquisitionTime_asLong) | |
1009 | break; |
|
1127 | break; | |
1010 | } |
|
1128 | } | |
1011 | ring_node_to_send = ring_node_to_send->previous; |
|
1129 | ring_node_to_send = ring_node_to_send->previous; | |
1012 | } |
|
1130 | } | |
1013 |
|
1131 | |||
1014 | // (5) compute the number of samples to take in the current buffer |
|
1132 | // (5) compute the number of samples to take in the current buffer | |
1015 | sampleOffset_asLong = ((acquisitionTime_asLong - bufferAcquisitionTime_asLong) * frequency_asLong ) >> 16; |
|
1133 | sampleOffset_asLong = ((acquisitionTime_asLong - bufferAcquisitionTime_asLong) * frequency_asLong ) >> 16; | |
1016 | nbSamplesPart1_asLong = NB_SAMPLES_PER_SNAPSHOT - sampleOffset_asLong; |
|
1134 | nbSamplesPart1_asLong = NB_SAMPLES_PER_SNAPSHOT - sampleOffset_asLong; | |
1017 | PRINTF2("sampleOffset_asLong = %llx, nbSamplesPart1_asLong = %llx\n", sampleOffset_asLong, nbSamplesPart1_asLong) |
|
1135 | PRINTF2("sampleOffset_asLong = %llx, nbSamplesPart1_asLong = %llx\n", sampleOffset_asLong, nbSamplesPart1_asLong) | |
1018 |
|
1136 | |||
1019 | // (6) compute the final acquisition time |
|
1137 | // (6) compute the final acquisition time | |
1020 | acquisitionTime_asLong = bufferAcquisitionTime_asLong + |
|
1138 | acquisitionTime_asLong = bufferAcquisitionTime_asLong + | |
1021 | sampleOffset_asLong * nbTicksPerSample_asLong; |
|
1139 | sampleOffset_asLong * nbTicksPerSample_asLong; | |
1022 |
|
1140 | |||
1023 | // (7) copy the acquisition time at the beginning of the extrated snapshot |
|
1141 | // (7) copy the acquisition time at the beginning of the extrated snapshot | |
1024 | ptr1 = (unsigned char*) &acquisitionTime_asLong; |
|
1142 | ptr1 = (unsigned char*) &acquisitionTime_asLong; | |
1025 | ptr2 = (unsigned char*) wf_snap_extracted; |
|
1143 | ptr2 = (unsigned char*) wf_snap_extracted; | |
1026 | ptr2[0] = ptr1[ 0 + 2 ]; |
|
1144 | ptr2[0] = ptr1[ 0 + 2 ]; | |
1027 | ptr2[1] = ptr1[ 1 + 2 ]; |
|
1145 | ptr2[1] = ptr1[ 1 + 2 ]; | |
1028 | ptr2[2] = ptr1[ 2 + 2 ]; |
|
1146 | ptr2[2] = ptr1[ 2 + 2 ]; | |
1029 | ptr2[3] = ptr1[ 3 + 2 ]; |
|
1147 | ptr2[3] = ptr1[ 3 + 2 ]; | |
1030 | ptr2[6] = ptr1[ 4 + 2 ]; |
|
1148 | ptr2[6] = ptr1[ 4 + 2 ]; | |
1031 | ptr2[7] = ptr1[ 5 + 2 ]; |
|
1149 | ptr2[7] = ptr1[ 5 + 2 ]; | |
1032 |
|
1150 | |||
1033 | // re set the synchronization bit |
|
1151 | // re set the synchronization bit | |
1034 | timeCharPtr = (unsigned char*) ring_node_to_send->buffer_address; |
|
1152 | timeCharPtr = (unsigned char*) ring_node_to_send->buffer_address; | |
1035 | ptr2[0] = ptr2[0] | (timeCharPtr[0] & 0x80); // [1000 0000] |
|
1153 | ptr2[0] = ptr2[0] | (timeCharPtr[0] & 0x80); // [1000 0000] | |
1036 |
|
1154 | |||
1037 | if ( (nbSamplesPart1_asLong >= NB_SAMPLES_PER_SNAPSHOT) | (nbSamplesPart1_asLong < 0) ) |
|
1155 | if ( (nbSamplesPart1_asLong >= NB_SAMPLES_PER_SNAPSHOT) | (nbSamplesPart1_asLong < 0) ) | |
1038 | { |
|
1156 | { | |
1039 | nbSamplesPart1_asLong = 0; |
|
1157 | nbSamplesPart1_asLong = 0; | |
1040 | } |
|
1158 | } | |
1041 | // copy the part 1 of the snapshot in the extracted buffer |
|
1159 | // copy the part 1 of the snapshot in the extracted buffer | |
1042 | for ( i = 0; i < (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i++ ) |
|
1160 | for ( i = 0; i < (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i++ ) | |
1043 | { |
|
1161 | { | |
1044 | wf_snap_extracted[i + TIME_OFFSET] = |
|
1162 | wf_snap_extracted[i + TIME_OFFSET] = | |
1045 | ((int*) ring_node_to_send->buffer_address)[i + (sampleOffset_asLong * NB_WORDS_SWF_BLK) + TIME_OFFSET]; |
|
1163 | ((int*) ring_node_to_send->buffer_address)[i + (sampleOffset_asLong * NB_WORDS_SWF_BLK) + TIME_OFFSET]; | |
1046 | } |
|
1164 | } | |
1047 | // copy the part 2 of the snapshot in the extracted buffer |
|
1165 | // copy the part 2 of the snapshot in the extracted buffer | |
1048 | ring_node_to_send = ring_node_to_send->next; |
|
1166 | ring_node_to_send = ring_node_to_send->next; | |
1049 | for ( i = (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i < (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK); i++ ) |
|
1167 | for ( i = (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i < (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK); i++ ) | |
1050 | { |
|
1168 | { | |
1051 | wf_snap_extracted[i + TIME_OFFSET] = |
|
1169 | wf_snap_extracted[i + TIME_OFFSET] = | |
1052 | ((int*) ring_node_to_send->buffer_address)[(i-(nbSamplesPart1_asLong * NB_WORDS_SWF_BLK)) + TIME_OFFSET]; |
|
1170 | ((int*) ring_node_to_send->buffer_address)[(i-(nbSamplesPart1_asLong * NB_WORDS_SWF_BLK)) + TIME_OFFSET]; | |
1053 | } |
|
1171 | } | |
1054 | } |
|
1172 | } | |
1055 |
|
1173 | |||
1056 | void snapshot_resynchronization( unsigned char *timePtr ) |
|
1174 | void snapshot_resynchronization( unsigned char *timePtr ) | |
1057 | { |
|
1175 | { | |
1058 | unsigned long long int acquisitionTime; |
|
1176 | unsigned long long int acquisitionTime; | |
1059 | unsigned long long int centerTime; |
|
1177 | unsigned long long int centerTime; | |
1060 | unsigned long long int previousTick; |
|
1178 | unsigned long long int previousTick; | |
1061 | unsigned long long int nextTick; |
|
1179 | unsigned long long int nextTick; | |
1062 | unsigned long long int deltaPreviousTick; |
|
1180 | unsigned long long int deltaPreviousTick; | |
1063 | unsigned long long int deltaNextTick; |
|
1181 | unsigned long long int deltaNextTick; | |
1064 | unsigned int deltaTickInF2; |
|
1182 | unsigned int deltaTickInF2; | |
1065 | double deltaPrevious; |
|
1183 | double deltaPrevious; | |
1066 | double deltaNext; |
|
1184 | double deltaNext; | |
1067 |
|
1185 | |||
1068 | acquisitionTime = get_acquisition_time( timePtr ); |
|
1186 | acquisitionTime = get_acquisition_time( timePtr ); | |
1069 |
|
1187 | |||
1070 | // compute center time |
|
1188 | // compute center time | |
1071 | centerTime = acquisitionTime + 2731; // (2048. / 24576. / 2.) * 65536. = 2730.667; |
|
1189 | centerTime = acquisitionTime + 2731; // (2048. / 24576. / 2.) * 65536. = 2730.667; | |
1072 | previousTick = centerTime - (centerTime & 0xffff); |
|
1190 | previousTick = centerTime - (centerTime & 0xffff); | |
1073 | nextTick = previousTick + 65536; |
|
1191 | nextTick = previousTick + 65536; | |
1074 |
|
1192 | |||
1075 | deltaPreviousTick = centerTime - previousTick; |
|
1193 | deltaPreviousTick = centerTime - previousTick; | |
1076 | deltaNextTick = nextTick - centerTime; |
|
1194 | deltaNextTick = nextTick - centerTime; | |
1077 |
|
1195 | |||
1078 | deltaPrevious = ((double) deltaPreviousTick) / 65536. * 1000.; |
|
1196 | deltaPrevious = ((double) deltaPreviousTick) / 65536. * 1000.; | |
1079 | deltaNext = ((double) deltaNextTick) / 65536. * 1000.; |
|
1197 | deltaNext = ((double) deltaNextTick) / 65536. * 1000.; | |
1080 |
|
1198 | |||
1081 | printf("delta previous = %f ms, delta next = %f ms\n", deltaPrevious, deltaNext); |
|
1199 | printf("delta previous = %f ms, delta next = %f ms\n", deltaPrevious, deltaNext); | |
1082 | printf("delta previous = %llu, delta next = %llu\n", deltaPreviousTick, deltaNextTick); |
|
1200 | printf("delta previous = %llu, delta next = %llu\n", deltaPreviousTick, deltaNextTick); | |
1083 |
|
1201 | |||
1084 | // which tick is the closest |
|
1202 | // which tick is the closest | |
1085 | if (deltaPreviousTick > deltaNextTick) |
|
1203 | if (deltaPreviousTick > deltaNextTick) | |
1086 | { |
|
1204 | { | |
1087 | deltaTickInF2 = floor( (deltaNext * 256. / 1000.) ); // the division by 2 is important here |
|
1205 | deltaTickInF2 = floor( (deltaNext * 256. / 1000.) ); // the division by 2 is important here | |
1088 | waveform_picker_regs->delta_snapshot = waveform_picker_regs->delta_snapshot + deltaTickInF2; |
|
1206 | waveform_picker_regs->delta_snapshot = waveform_picker_regs->delta_snapshot + deltaTickInF2; | |
1089 | printf("correction of = + %u\n", deltaTickInF2); |
|
1207 | printf("correction of = + %u\n", deltaTickInF2); | |
1090 | } |
|
1208 | } | |
1091 | else |
|
1209 | else | |
1092 | { |
|
1210 | { | |
1093 | deltaTickInF2 = floor( (deltaPrevious * 256. / 1000.) ); // the division by 2 is important here |
|
1211 | deltaTickInF2 = floor( (deltaPrevious * 256. / 1000.) ); // the division by 2 is important here | |
1094 | waveform_picker_regs->delta_snapshot = waveform_picker_regs->delta_snapshot - deltaTickInF2; |
|
1212 | waveform_picker_regs->delta_snapshot = waveform_picker_regs->delta_snapshot - deltaTickInF2; | |
1095 | printf("correction of = - %u\n", deltaTickInF2); |
|
1213 | printf("correction of = - %u\n", deltaTickInF2); | |
1096 | } |
|
1214 | } | |
1097 | } |
|
1215 | } | |
1098 |
|
1216 | |||
1099 | //************** |
|
1217 | //************** | |
1100 | // wfp registers |
|
1218 | // wfp registers | |
1101 | void reset_wfp_burst_enable(void) |
|
1219 | void reset_wfp_burst_enable(void) | |
1102 | { |
|
1220 | { | |
1103 | /** This function resets the waveform picker burst_enable register. |
|
1221 | /** This function resets the waveform picker burst_enable register. | |
1104 | * |
|
1222 | * | |
1105 | * The burst bits [f2 f1 f0] and the enable bits [f3 f2 f1 f0] are set to 0. |
|
1223 | * The burst bits [f2 f1 f0] and the enable bits [f3 f2 f1 f0] are set to 0. | |
1106 | * |
|
1224 | * | |
1107 | */ |
|
1225 | */ | |
1108 |
|
1226 | |||
1109 | waveform_picker_regs->run_burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 |
|
1227 | waveform_picker_regs->run_burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 | |
1110 | } |
|
1228 | } | |
1111 |
|
1229 | |||
1112 | void reset_wfp_status( void ) |
|
1230 | void reset_wfp_status( void ) | |
1113 | { |
|
1231 | { | |
1114 | /** This function resets the waveform picker status register. |
|
1232 | /** This function resets the waveform picker status register. | |
1115 | * |
|
1233 | * | |
1116 | * All status bits are set to 0 [new_err full_err full]. |
|
1234 | * All status bits are set to 0 [new_err full_err full]. | |
1117 | * |
|
1235 | * | |
1118 | */ |
|
1236 | */ | |
1119 |
|
1237 | |||
1120 | waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 |
|
1238 | waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 | |
1121 | } |
|
1239 | } | |
1122 |
|
1240 | |||
1123 | void reset_waveform_picker_regs(void) |
|
1241 | void reset_waveform_picker_regs(void) | |
1124 | { |
|
1242 | { | |
1125 | /** This function resets the waveform picker module registers. |
|
1243 | /** This function resets the waveform picker module registers. | |
1126 | * |
|
1244 | * | |
1127 | * The registers affected by this function are located at the following offset addresses: |
|
1245 | * The registers affected by this function are located at the following offset addresses: | |
1128 | * - 0x00 data_shaping |
|
1246 | * - 0x00 data_shaping | |
1129 | * - 0x04 run_burst_enable |
|
1247 | * - 0x04 run_burst_enable | |
1130 | * - 0x08 addr_data_f0 |
|
1248 | * - 0x08 addr_data_f0 | |
1131 | * - 0x0C addr_data_f1 |
|
1249 | * - 0x0C addr_data_f1 | |
1132 | * - 0x10 addr_data_f2 |
|
1250 | * - 0x10 addr_data_f2 | |
1133 | * - 0x14 addr_data_f3 |
|
1251 | * - 0x14 addr_data_f3 | |
1134 | * - 0x18 status |
|
1252 | * - 0x18 status | |
1135 | * - 0x1C delta_snapshot |
|
1253 | * - 0x1C delta_snapshot | |
1136 | * - 0x20 delta_f0 |
|
1254 | * - 0x20 delta_f0 | |
1137 | * - 0x24 delta_f0_2 |
|
1255 | * - 0x24 delta_f0_2 | |
1138 | * - 0x28 delta_f1 |
|
1256 | * - 0x28 delta_f1 | |
1139 | * - 0x2c delta_f2 |
|
1257 | * - 0x2c delta_f2 | |
1140 | * - 0x30 nb_data_by_buffer |
|
1258 | * - 0x30 nb_data_by_buffer | |
1141 | * - 0x34 nb_snapshot_param |
|
1259 | * - 0x34 nb_snapshot_param | |
1142 | * - 0x38 start_date |
|
1260 | * - 0x38 start_date | |
1143 | * - 0x3c nb_word_in_buffer |
|
1261 | * - 0x3c nb_word_in_buffer | |
1144 | * |
|
1262 | * | |
1145 | */ |
|
1263 | */ | |
1146 |
|
1264 | |||
1147 | set_wfp_data_shaping(); // 0x00 *** R1 R0 SP1 SP0 BW |
|
1265 | set_wfp_data_shaping(); // 0x00 *** R1 R0 SP1 SP0 BW | |
1148 | reset_wfp_burst_enable(); // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ] |
|
1266 | reset_wfp_burst_enable(); // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ] | |
1149 | waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address; // 0x08 |
|
1267 | waveform_picker_regs->addr_data_f0_0 = current_ring_node_f0->buffer_address; // 0x08 | |
1150 |
waveform_picker_regs->addr_data_f1 = current_ring_node_f |
|
1268 | waveform_picker_regs->addr_data_f0_1 = current_ring_node_f0->buffer_address; // 0x0c | |
1151 |
waveform_picker_regs->addr_data_f |
|
1269 | waveform_picker_regs->addr_data_f1_0 = current_ring_node_f1->buffer_address; // 0x10 | |
1152 |
waveform_picker_regs->addr_data_f |
|
1270 | waveform_picker_regs->addr_data_f1_1 = current_ring_node_f1->buffer_address; // 0x14 | |
|
1271 | waveform_picker_regs->addr_data_f2_0 = current_ring_node_f2->buffer_address; // 0x18 | |||
|
1272 | waveform_picker_regs->addr_data_f2_1 = current_ring_node_f2->buffer_address; // 0x1c | |||
|
1273 | waveform_picker_regs->addr_data_f3_0 = current_ring_node_f3->buffer_address; // 0x20 | |||
|
1274 | waveform_picker_regs->addr_data_f3_1 = current_ring_node_f3->buffer_address; // 0x24 | |||
1153 | reset_wfp_status(); // 0x18 |
|
1275 | reset_wfp_status(); // 0x18 | |
1154 | // |
|
1276 | // | |
1155 | set_wfp_delta_snapshot(); // 0x1c |
|
1277 | set_wfp_delta_snapshot(); // 0x1c | |
1156 | set_wfp_delta_f0_f0_2(); // 0x20, 0x24 |
|
1278 | set_wfp_delta_f0_f0_2(); // 0x20, 0x24 | |
1157 | set_wfp_delta_f1(); // 0x28 |
|
1279 | set_wfp_delta_f1(); // 0x28 | |
1158 | set_wfp_delta_f2(); // 0x2c |
|
1280 | set_wfp_delta_f2(); // 0x2c | |
1159 | DEBUG_PRINTF1("delta_snapshot %x\n", waveform_picker_regs->delta_snapshot) |
|
1281 | DEBUG_PRINTF1("delta_snapshot %x\n", waveform_picker_regs->delta_snapshot) | |
1160 | DEBUG_PRINTF1("delta_f0 %x\n", waveform_picker_regs->delta_f0) |
|
1282 | DEBUG_PRINTF1("delta_f0 %x\n", waveform_picker_regs->delta_f0) | |
1161 | DEBUG_PRINTF1("delta_f0_2 %x\n", waveform_picker_regs->delta_f0_2) |
|
1283 | DEBUG_PRINTF1("delta_f0_2 %x\n", waveform_picker_regs->delta_f0_2) | |
1162 | DEBUG_PRINTF1("delta_f1 %x\n", waveform_picker_regs->delta_f1) |
|
1284 | DEBUG_PRINTF1("delta_f1 %x\n", waveform_picker_regs->delta_f1) | |
1163 | DEBUG_PRINTF1("delta_f2 %x\n", waveform_picker_regs->delta_f2) |
|
1285 | DEBUG_PRINTF1("delta_f2 %x\n", waveform_picker_regs->delta_f2) | |
1164 | // 2688 = 8 * 336 |
|
1286 | // 2688 = 8 * 336 | |
1165 | waveform_picker_regs->nb_data_by_buffer = 0xa7f; // 0x30 *** 2688 - 1 => nb samples -1 |
|
1287 | waveform_picker_regs->nb_data_by_buffer = 0xa7f; // 0x30 *** 2688 - 1 => nb samples -1 | |
1166 | waveform_picker_regs->snapshot_param = 0xa80; // 0x34 *** 2688 => nb samples |
|
1288 | waveform_picker_regs->snapshot_param = 0xa80; // 0x34 *** 2688 => nb samples | |
1167 | waveform_picker_regs->start_date = 0x00; // 0x38 |
|
1289 | waveform_picker_regs->start_date = 0x00; // 0x38 | |
1168 |
waveform_picker_regs-> |
|
1290 | waveform_picker_regs->buffer_length = 0x1f8; // buffer length in burst = 3 * 2688 / 16 = 504 = 0x1f8 | |
1169 | } |
|
1291 | } | |
1170 |
|
1292 | |||
1171 | void set_wfp_data_shaping( void ) |
|
1293 | void set_wfp_data_shaping( void ) | |
1172 | { |
|
1294 | { | |
1173 | /** This function sets the data_shaping register of the waveform picker module. |
|
1295 | /** This function sets the data_shaping register of the waveform picker module. | |
1174 | * |
|
1296 | * | |
1175 | * The value is read from one field of the parameter_dump_packet structure:\n |
|
1297 | * The value is read from one field of the parameter_dump_packet structure:\n | |
1176 | * bw_sp0_sp1_r0_r1 |
|
1298 | * bw_sp0_sp1_r0_r1 | |
1177 | * |
|
1299 | * | |
1178 | */ |
|
1300 | */ | |
1179 |
|
1301 | |||
1180 | unsigned char data_shaping; |
|
1302 | unsigned char data_shaping; | |
1181 |
|
1303 | |||
1182 | // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register |
|
1304 | // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register | |
1183 | // waveform picker : [R1 R0 SP1 SP0 BW] |
|
1305 | // waveform picker : [R1 R0 SP1 SP0 BW] | |
1184 |
|
1306 | |||
1185 | data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1; |
|
1307 | data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1; | |
1186 |
|
1308 | |||
1187 | waveform_picker_regs->data_shaping = |
|
1309 | waveform_picker_regs->data_shaping = | |
1188 | ( (data_shaping & 0x10) >> 4 ) // BW |
|
1310 | ( (data_shaping & 0x10) >> 4 ) // BW | |
1189 | + ( (data_shaping & 0x08) >> 2 ) // SP0 |
|
1311 | + ( (data_shaping & 0x08) >> 2 ) // SP0 | |
1190 | + ( (data_shaping & 0x04) ) // SP1 |
|
1312 | + ( (data_shaping & 0x04) ) // SP1 | |
1191 | + ( (data_shaping & 0x02) << 2 ) // R0 |
|
1313 | + ( (data_shaping & 0x02) << 2 ) // R0 | |
1192 | + ( (data_shaping & 0x01) << 4 ); // R1 |
|
1314 | + ( (data_shaping & 0x01) << 4 ); // R1 | |
1193 | } |
|
1315 | } | |
1194 |
|
1316 | |||
1195 | void set_wfp_burst_enable_register( unsigned char mode ) |
|
1317 | void set_wfp_burst_enable_register( unsigned char mode ) | |
1196 | { |
|
1318 | { | |
1197 | /** This function sets the waveform picker burst_enable register depending on the mode. |
|
1319 | /** This function sets the waveform picker burst_enable register depending on the mode. | |
1198 | * |
|
1320 | * | |
1199 | * @param mode is the LFR mode to launch. |
|
1321 | * @param mode is the LFR mode to launch. | |
1200 | * |
|
1322 | * | |
1201 | * The burst bits shall be before the enable bits. |
|
1323 | * The burst bits shall be before the enable bits. | |
1202 | * |
|
1324 | * | |
1203 | */ |
|
1325 | */ | |
1204 |
|
1326 | |||
1205 | // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0 |
|
1327 | // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0 | |
1206 | // the burst bits shall be set first, before the enable bits |
|
1328 | // the burst bits shall be set first, before the enable bits | |
1207 | switch(mode) { |
|
1329 | switch(mode) { | |
1208 | case(LFR_MODE_NORMAL): |
|
1330 | case(LFR_MODE_NORMAL): | |
1209 | waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enable |
|
1331 | waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enable | |
1210 | waveform_picker_regs->run_burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0 |
|
1332 | waveform_picker_regs->run_burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0 | |
1211 | break; |
|
1333 | break; | |
1212 | case(LFR_MODE_BURST): |
|
1334 | case(LFR_MODE_BURST): | |
1213 | waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled |
|
1335 | waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled | |
1214 | // waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x04; // [0100] enable f2 |
|
1336 | // waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x04; // [0100] enable f2 | |
1215 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0c; // [1100] enable f3 AND f2 |
|
1337 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0c; // [1100] enable f3 AND f2 | |
1216 | break; |
|
1338 | break; | |
1217 | case(LFR_MODE_SBM1): |
|
1339 | case(LFR_MODE_SBM1): | |
1218 | waveform_picker_regs->run_burst_enable = 0x20; // [0010 0000] f1 burst enabled |
|
1340 | waveform_picker_regs->run_burst_enable = 0x20; // [0010 0000] f1 burst enabled | |
1219 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 |
|
1341 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 | |
1220 | break; |
|
1342 | break; | |
1221 | case(LFR_MODE_SBM2): |
|
1343 | case(LFR_MODE_SBM2): | |
1222 | waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled |
|
1344 | waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled | |
1223 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 |
|
1345 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 | |
1224 | break; |
|
1346 | break; | |
1225 | default: |
|
1347 | default: | |
1226 | waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled |
|
1348 | waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled | |
1227 | break; |
|
1349 | break; | |
1228 | } |
|
1350 | } | |
1229 | } |
|
1351 | } | |
1230 |
|
1352 | |||
1231 | void set_wfp_delta_snapshot( void ) |
|
1353 | void set_wfp_delta_snapshot( void ) | |
1232 | { |
|
1354 | { | |
1233 | /** This function sets the delta_snapshot register of the waveform picker module. |
|
1355 | /** This function sets the delta_snapshot register of the waveform picker module. | |
1234 | * |
|
1356 | * | |
1235 | * The value is read from two (unsigned char) of the parameter_dump_packet structure: |
|
1357 | * The value is read from two (unsigned char) of the parameter_dump_packet structure: | |
1236 | * - sy_lfr_n_swf_p[0] |
|
1358 | * - sy_lfr_n_swf_p[0] | |
1237 | * - sy_lfr_n_swf_p[1] |
|
1359 | * - sy_lfr_n_swf_p[1] | |
1238 | * |
|
1360 | * | |
1239 | */ |
|
1361 | */ | |
1240 |
|
1362 | |||
1241 | unsigned int delta_snapshot; |
|
1363 | unsigned int delta_snapshot; | |
1242 | unsigned int delta_snapshot_in_T2; |
|
1364 | unsigned int delta_snapshot_in_T2; | |
1243 |
|
1365 | |||
1244 | delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256 |
|
1366 | delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256 | |
1245 | + parameter_dump_packet.sy_lfr_n_swf_p[1]; |
|
1367 | + parameter_dump_packet.sy_lfr_n_swf_p[1]; | |
1246 |
|
1368 | |||
1247 | delta_snapshot_in_T2 = delta_snapshot * 256; |
|
1369 | delta_snapshot_in_T2 = delta_snapshot * 256; | |
1248 | waveform_picker_regs->delta_snapshot = delta_snapshot_in_T2 - 1; // max 4 bytes |
|
1370 | waveform_picker_regs->delta_snapshot = delta_snapshot_in_T2 - 1; // max 4 bytes | |
1249 | } |
|
1371 | } | |
1250 |
|
1372 | |||
1251 | void set_wfp_delta_f0_f0_2( void ) |
|
1373 | void set_wfp_delta_f0_f0_2( void ) | |
1252 | { |
|
1374 | { | |
1253 | unsigned int delta_snapshot; |
|
1375 | unsigned int delta_snapshot; | |
1254 | unsigned int nb_samples_per_snapshot; |
|
1376 | unsigned int nb_samples_per_snapshot; | |
1255 | float delta_f0_in_float; |
|
1377 | float delta_f0_in_float; | |
1256 |
|
1378 | |||
1257 | delta_snapshot = waveform_picker_regs->delta_snapshot; |
|
1379 | delta_snapshot = waveform_picker_regs->delta_snapshot; | |
1258 | nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1]; |
|
1380 | nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1]; | |
1259 | delta_f0_in_float =nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 24576.) * 256.; |
|
1381 | delta_f0_in_float =nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 24576.) * 256.; | |
1260 |
|
1382 | |||
1261 | waveform_picker_regs->delta_f0 = delta_snapshot - floor( delta_f0_in_float ); |
|
1383 | waveform_picker_regs->delta_f0 = delta_snapshot - floor( delta_f0_in_float ); | |
1262 | waveform_picker_regs->delta_f0_2 = 0x7; // max 7 bits |
|
1384 | waveform_picker_regs->delta_f0_2 = 0x7; // max 7 bits | |
1263 | } |
|
1385 | } | |
1264 |
|
1386 | |||
1265 | void set_wfp_delta_f1( void ) |
|
1387 | void set_wfp_delta_f1( void ) | |
1266 | { |
|
1388 | { | |
1267 | unsigned int delta_snapshot; |
|
1389 | unsigned int delta_snapshot; | |
1268 | unsigned int nb_samples_per_snapshot; |
|
1390 | unsigned int nb_samples_per_snapshot; | |
1269 | float delta_f1_in_float; |
|
1391 | float delta_f1_in_float; | |
1270 |
|
1392 | |||
1271 | delta_snapshot = waveform_picker_regs->delta_snapshot; |
|
1393 | delta_snapshot = waveform_picker_regs->delta_snapshot; | |
1272 | nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1]; |
|
1394 | nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1]; | |
1273 | delta_f1_in_float = nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 4096.) * 256.; |
|
1395 | delta_f1_in_float = nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 4096.) * 256.; | |
1274 |
|
1396 | |||
1275 | waveform_picker_regs->delta_f1 = delta_snapshot - floor( delta_f1_in_float ); |
|
1397 | waveform_picker_regs->delta_f1 = delta_snapshot - floor( delta_f1_in_float ); | |
1276 | } |
|
1398 | } | |
1277 |
|
1399 | |||
1278 | void set_wfp_delta_f2() |
|
1400 | void set_wfp_delta_f2() | |
1279 | { |
|
1401 | { | |
1280 | unsigned int delta_snapshot; |
|
1402 | unsigned int delta_snapshot; | |
1281 | unsigned int nb_samples_per_snapshot; |
|
1403 | unsigned int nb_samples_per_snapshot; | |
1282 |
|
1404 | |||
1283 | delta_snapshot = waveform_picker_regs->delta_snapshot; |
|
1405 | delta_snapshot = waveform_picker_regs->delta_snapshot; | |
1284 | nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1]; |
|
1406 | nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1]; | |
1285 |
|
1407 | |||
1286 | waveform_picker_regs->delta_f2 = delta_snapshot - nb_samples_per_snapshot / 2; |
|
1408 | waveform_picker_regs->delta_f2 = delta_snapshot - nb_samples_per_snapshot / 2; | |
1287 | } |
|
1409 | } | |
1288 |
|
1410 | |||
1289 | //***************** |
|
1411 | //***************** | |
1290 | // local parameters |
|
1412 | // local parameters | |
1291 |
|
1413 | |||
1292 | void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid ) |
|
1414 | void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid ) | |
1293 | { |
|
1415 | { | |
1294 | /** This function increments the parameter "sequence_cnt" depending on the sid passed in argument. |
|
1416 | /** This function increments the parameter "sequence_cnt" depending on the sid passed in argument. | |
1295 | * |
|
1417 | * | |
1296 | * @param packet_sequence_control is a pointer toward the parameter sequence_cnt to update. |
|
1418 | * @param packet_sequence_control is a pointer toward the parameter sequence_cnt to update. | |
1297 | * @param sid is the source identifier of the packet being updated. |
|
1419 | * @param sid is the source identifier of the packet being updated. | |
1298 | * |
|
1420 | * | |
1299 | * REQ-LFR-SRS-5240 / SSS-CP-FS-590 |
|
1421 | * REQ-LFR-SRS-5240 / SSS-CP-FS-590 | |
1300 | * The sequence counters shall wrap around from 2^14 to zero. |
|
1422 | * The sequence counters shall wrap around from 2^14 to zero. | |
1301 | * The sequence counter shall start at zero at startup. |
|
1423 | * The sequence counter shall start at zero at startup. | |
1302 | * |
|
1424 | * | |
1303 | * REQ-LFR-SRS-5239 / SSS-CP-FS-580 |
|
1425 | * REQ-LFR-SRS-5239 / SSS-CP-FS-580 | |
1304 | * All TM_LFR_SCIENCE_ packets are sent to ground, i.e. destination id = 0 |
|
1426 | * All TM_LFR_SCIENCE_ packets are sent to ground, i.e. destination id = 0 | |
1305 | * |
|
1427 | * | |
1306 | */ |
|
1428 | */ | |
1307 |
|
1429 | |||
1308 | unsigned short *sequence_cnt; |
|
1430 | unsigned short *sequence_cnt; | |
1309 | unsigned short segmentation_grouping_flag; |
|
1431 | unsigned short segmentation_grouping_flag; | |
1310 | unsigned short new_packet_sequence_control; |
|
1432 | unsigned short new_packet_sequence_control; | |
1311 | rtems_mode initial_mode_set; |
|
1433 | rtems_mode initial_mode_set; | |
1312 | rtems_mode current_mode_set; |
|
1434 | rtems_mode current_mode_set; | |
1313 | rtems_status_code status; |
|
1435 | rtems_status_code status; | |
1314 |
|
1436 | |||
1315 | //****************************************** |
|
1437 | //****************************************** | |
1316 | // CHANGE THE MODE OF THE CALLING RTEMS TASK |
|
1438 | // CHANGE THE MODE OF THE CALLING RTEMS TASK | |
1317 | status = rtems_task_mode( RTEMS_NO_PREEMPT, RTEMS_PREEMPT_MASK, &initial_mode_set ); |
|
1439 | status = rtems_task_mode( RTEMS_NO_PREEMPT, RTEMS_PREEMPT_MASK, &initial_mode_set ); | |
1318 |
|
1440 | |||
1319 | if ( (sid == SID_NORM_SWF_F0) || (sid == SID_NORM_SWF_F1) || (sid == SID_NORM_SWF_F2) |
|
1441 | if ( (sid == SID_NORM_SWF_F0) || (sid == SID_NORM_SWF_F1) || (sid == SID_NORM_SWF_F2) | |
1320 | || (sid == SID_NORM_CWF_F3) || (sid == SID_NORM_CWF_LONG_F3) |
|
1442 | || (sid == SID_NORM_CWF_F3) || (sid == SID_NORM_CWF_LONG_F3) | |
1321 | || (sid == SID_BURST_CWF_F2) |
|
1443 | || (sid == SID_BURST_CWF_F2) | |
1322 | || (sid == SID_NORM_ASM_F0) || (sid == SID_NORM_ASM_F1) || (sid == SID_NORM_ASM_F2) |
|
1444 | || (sid == SID_NORM_ASM_F0) || (sid == SID_NORM_ASM_F1) || (sid == SID_NORM_ASM_F2) | |
1323 | || (sid == SID_NORM_BP1_F0) || (sid == SID_NORM_BP1_F1) || (sid == SID_NORM_BP1_F2) |
|
1445 | || (sid == SID_NORM_BP1_F0) || (sid == SID_NORM_BP1_F1) || (sid == SID_NORM_BP1_F2) | |
1324 | || (sid == SID_NORM_BP2_F0) || (sid == SID_NORM_BP2_F1) || (sid == SID_NORM_BP2_F2) |
|
1446 | || (sid == SID_NORM_BP2_F0) || (sid == SID_NORM_BP2_F1) || (sid == SID_NORM_BP2_F2) | |
1325 | || (sid == SID_BURST_BP1_F0) || (sid == SID_BURST_BP2_F0) |
|
1447 | || (sid == SID_BURST_BP1_F0) || (sid == SID_BURST_BP2_F0) | |
1326 | || (sid == SID_BURST_BP1_F1) || (sid == SID_BURST_BP2_F1) ) |
|
1448 | || (sid == SID_BURST_BP1_F1) || (sid == SID_BURST_BP2_F1) ) | |
1327 | { |
|
1449 | { | |
1328 | sequence_cnt = (unsigned short *) &sequenceCounters_SCIENCE_NORMAL_BURST; |
|
1450 | sequence_cnt = (unsigned short *) &sequenceCounters_SCIENCE_NORMAL_BURST; | |
1329 | } |
|
1451 | } | |
1330 | else if ( (sid ==SID_SBM1_CWF_F1) || (sid ==SID_SBM2_CWF_F2) |
|
1452 | else if ( (sid ==SID_SBM1_CWF_F1) || (sid ==SID_SBM2_CWF_F2) | |
1331 | || (sid == SID_SBM1_BP1_F0) || (sid == SID_SBM1_BP2_F0) |
|
1453 | || (sid == SID_SBM1_BP1_F0) || (sid == SID_SBM1_BP2_F0) | |
1332 | || (sid == SID_SBM2_BP1_F0) || (sid == SID_SBM2_BP2_F0) |
|
1454 | || (sid == SID_SBM2_BP1_F0) || (sid == SID_SBM2_BP2_F0) | |
1333 | || (sid == SID_SBM2_BP1_F1) || (sid == SID_SBM2_BP2_F1) ) |
|
1455 | || (sid == SID_SBM2_BP1_F1) || (sid == SID_SBM2_BP2_F1) ) | |
1334 | { |
|
1456 | { | |
1335 | sequence_cnt = (unsigned short *) &sequenceCounters_SCIENCE_SBM1_SBM2; |
|
1457 | sequence_cnt = (unsigned short *) &sequenceCounters_SCIENCE_SBM1_SBM2; | |
1336 | } |
|
1458 | } | |
1337 | else |
|
1459 | else | |
1338 | { |
|
1460 | { | |
1339 | sequence_cnt = (unsigned short *) NULL; |
|
1461 | sequence_cnt = (unsigned short *) NULL; | |
1340 | PRINTF1("in increment_seq_counter_source_id *** ERR apid_destid %d not known\n", sid) |
|
1462 | PRINTF1("in increment_seq_counter_source_id *** ERR apid_destid %d not known\n", sid) | |
1341 | } |
|
1463 | } | |
1342 |
|
1464 | |||
1343 | if (sequence_cnt != NULL) |
|
1465 | if (sequence_cnt != NULL) | |
1344 | { |
|
1466 | { | |
1345 | segmentation_grouping_flag = TM_PACKET_SEQ_CTRL_STANDALONE << 8; |
|
1467 | segmentation_grouping_flag = TM_PACKET_SEQ_CTRL_STANDALONE << 8; | |
1346 | *sequence_cnt = (*sequence_cnt) & 0x3fff; |
|
1468 | *sequence_cnt = (*sequence_cnt) & 0x3fff; | |
1347 |
|
1469 | |||
1348 | new_packet_sequence_control = segmentation_grouping_flag | (*sequence_cnt) ; |
|
1470 | new_packet_sequence_control = segmentation_grouping_flag | (*sequence_cnt) ; | |
1349 |
|
1471 | |||
1350 | packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8); |
|
1472 | packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8); | |
1351 | packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control ); |
|
1473 | packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control ); | |
1352 |
|
1474 | |||
1353 | // increment the sequence counter |
|
1475 | // increment the sequence counter | |
1354 | if ( *sequence_cnt < SEQ_CNT_MAX) |
|
1476 | if ( *sequence_cnt < SEQ_CNT_MAX) | |
1355 | { |
|
1477 | { | |
1356 | *sequence_cnt = *sequence_cnt + 1; |
|
1478 | *sequence_cnt = *sequence_cnt + 1; | |
1357 | } |
|
1479 | } | |
1358 | else |
|
1480 | else | |
1359 | { |
|
1481 | { | |
1360 | *sequence_cnt = 0; |
|
1482 | *sequence_cnt = 0; | |
1361 | } |
|
1483 | } | |
1362 | } |
|
1484 | } | |
1363 |
|
1485 | |||
1364 | //*********************************** |
|
1486 | //*********************************** | |
1365 | // RESET THE MODE OF THE CALLING TASK |
|
1487 | // RESET THE MODE OF THE CALLING TASK | |
1366 | status = rtems_task_mode( initial_mode_set, RTEMS_PREEMPT_MASK, ¤t_mode_set ); |
|
1488 | status = rtems_task_mode( initial_mode_set, RTEMS_PREEMPT_MASK, ¤t_mode_set ); | |
1367 | } |
|
1489 | } |
@@ -1,234 +1,234 | |||||
1 | ############################################################################# |
|
1 | ############################################################################# | |
2 | # Makefile for building: bin/timegen |
|
2 | # Makefile for building: bin/timegen | |
3 |
# Generated by qmake (2.01a) (Qt 4.8.6) on: |
|
3 | # Generated by qmake (2.01a) (Qt 4.8.6) on: Fri Oct 24 13:36:54 2014 | |
4 | # Project: timegen-qt.pro |
|
4 | # Project: timegen-qt.pro | |
5 | # Template: app |
|
5 | # Template: app | |
6 | # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ CONFIG+=debug -o Makefile timegen-qt.pro |
|
6 | # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ CONFIG+=debug -o Makefile timegen-qt.pro | |
7 | ############################################################################# |
|
7 | ############################################################################# | |
8 |
|
8 | |||
9 | ####### Compiler, tools and options |
|
9 | ####### Compiler, tools and options | |
10 |
|
10 | |||
11 | CC = sparc-rtems-gcc |
|
11 | CC = sparc-rtems-gcc | |
12 | CXX = sparc-rtems-g++ |
|
12 | CXX = sparc-rtems-g++ | |
13 |
DEFINES = -DSW_VERSION_N1=0 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4= |
|
13 | DEFINES = -DSW_VERSION_N1=0 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=1 -DPRINT_MESSAGES_ON_CONSOLE | |
14 | CFLAGS = -pipe -g -O3 -Wall $(DEFINES) |
|
14 | CFLAGS = -pipe -g -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. -Isrc -Iheader -Iheader/processing -Isrc/LFR_basic-parameters |
|
16 | INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -Isrc -Iheader -Iheader/processing -Isrc/LFR_basic-parameters | |
17 | LINK = sparc-rtems-g++ |
|
17 | LINK = sparc-rtems-g++ | |
18 | LFLAGS = -g |
|
18 | LFLAGS = -g | |
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/tc_handler.c \ |
|
46 | SOURCES = src/tc_handler.c \ | |
47 | src/fsw_misc.c \ |
|
47 | src/fsw_misc.c \ | |
48 | src/fsw_init.c \ |
|
48 | src/fsw_init.c \ | |
49 | src/fsw_globals.c \ |
|
49 | src/fsw_globals.c \ | |
50 | src/fsw_spacewire.c \ |
|
50 | src/fsw_spacewire.c \ | |
51 | src/tc_acceptance.c \ |
|
51 | src/tc_acceptance.c \ | |
52 | src/LFR_basic-parameters/basic_parameters.c |
|
52 | src/LFR_basic-parameters/basic_parameters.c | |
53 | OBJECTS = obj/tc_handler.o \ |
|
53 | OBJECTS = obj/tc_handler.o \ | |
54 | obj/fsw_misc.o \ |
|
54 | obj/fsw_misc.o \ | |
55 | obj/fsw_init.o \ |
|
55 | obj/fsw_init.o \ | |
56 | obj/fsw_globals.o \ |
|
56 | obj/fsw_globals.o \ | |
57 | obj/fsw_spacewire.o \ |
|
57 | obj/fsw_spacewire.o \ | |
58 | obj/tc_acceptance.o \ |
|
58 | obj/tc_acceptance.o \ | |
59 | obj/basic_parameters.o |
|
59 | obj/basic_parameters.o | |
60 | DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \ |
|
60 | DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \ | |
61 | /usr/lib64/qt4/mkspecs/common/linux.conf \ |
|
61 | /usr/lib64/qt4/mkspecs/common/linux.conf \ | |
62 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ |
|
62 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ | |
63 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ |
|
63 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ | |
64 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ |
|
64 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ | |
65 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ |
|
65 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ | |
66 | /usr/lib64/qt4/mkspecs/qconfig.pri \ |
|
66 | /usr/lib64/qt4/mkspecs/qconfig.pri \ | |
67 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ |
|
67 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ | |
68 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ |
|
68 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ | |
69 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ |
|
69 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ | |
70 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ |
|
70 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ | |
71 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ |
|
71 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ | |
72 | sparc.pri \ |
|
72 | sparc.pri \ | |
73 | /usr/lib64/qt4/mkspecs/features/debug.prf \ |
|
73 | /usr/lib64/qt4/mkspecs/features/debug.prf \ | |
74 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ |
|
74 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ | |
75 | /usr/lib64/qt4/mkspecs/features/shared.prf \ |
|
75 | /usr/lib64/qt4/mkspecs/features/shared.prf \ | |
76 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ |
|
76 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ | |
77 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ |
|
77 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ | |
78 | /usr/lib64/qt4/mkspecs/features/resources.prf \ |
|
78 | /usr/lib64/qt4/mkspecs/features/resources.prf \ | |
79 | /usr/lib64/qt4/mkspecs/features/uic.prf \ |
|
79 | /usr/lib64/qt4/mkspecs/features/uic.prf \ | |
80 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ |
|
80 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ | |
81 | /usr/lib64/qt4/mkspecs/features/lex.prf \ |
|
81 | /usr/lib64/qt4/mkspecs/features/lex.prf \ | |
82 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \ |
|
82 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \ | |
83 | timegen-qt.pro |
|
83 | timegen-qt.pro | |
84 | QMAKE_TARGET = timegen |
|
84 | QMAKE_TARGET = timegen | |
85 | DESTDIR = bin/ |
|
85 | DESTDIR = bin/ | |
86 | TARGET = bin/timegen |
|
86 | TARGET = bin/timegen | |
87 |
|
87 | |||
88 | first: all |
|
88 | first: all | |
89 | ####### Implicit rules |
|
89 | ####### Implicit rules | |
90 |
|
90 | |||
91 | .SUFFIXES: .o .c .cpp .cc .cxx .C |
|
91 | .SUFFIXES: .o .c .cpp .cc .cxx .C | |
92 |
|
92 | |||
93 | .cpp.o: |
|
93 | .cpp.o: | |
94 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
94 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" | |
95 |
|
95 | |||
96 | .cc.o: |
|
96 | .cc.o: | |
97 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
97 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" | |
98 |
|
98 | |||
99 | .cxx.o: |
|
99 | .cxx.o: | |
100 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
100 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" | |
101 |
|
101 | |||
102 | .C.o: |
|
102 | .C.o: | |
103 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
103 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" | |
104 |
|
104 | |||
105 | .c.o: |
|
105 | .c.o: | |
106 | $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<" |
|
106 | $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<" | |
107 |
|
107 | |||
108 | ####### Build rules |
|
108 | ####### Build rules | |
109 |
|
109 | |||
110 | all: Makefile $(TARGET) |
|
110 | all: Makefile $(TARGET) | |
111 |
|
111 | |||
112 | $(TARGET): $(OBJECTS) |
|
112 | $(TARGET): $(OBJECTS) | |
113 | @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/ |
|
113 | @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/ | |
114 | $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) |
|
114 | $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) | |
115 | { test -n "$(DESTDIR)" && DESTDIR="$(DESTDIR)" || DESTDIR=.; } && test $$(gdb --version | sed -e 's,[^0-9][^0-9]*\([0-9]\)\.\([0-9]\).*,\1\2,;q') -gt 72 && gdb --nx --batch --quiet -ex 'set confirm off' -ex "save gdb-index $$DESTDIR" -ex quit '$(TARGET)' && test -f $(TARGET).gdb-index && sparc-rtems-objcopy --add-section '.gdb_index=$(TARGET).gdb-index' --set-section-flags '.gdb_index=readonly' '$(TARGET)' '$(TARGET)' && rm -f $(TARGET).gdb-index || true |
|
115 | { test -n "$(DESTDIR)" && DESTDIR="$(DESTDIR)" || DESTDIR=.; } && test $$(gdb --version | sed -e 's,[^0-9][^0-9]*\([0-9]\)\.\([0-9]\).*,\1\2,;q') -gt 72 && gdb --nx --batch --quiet -ex 'set confirm off' -ex "save gdb-index $$DESTDIR" -ex quit '$(TARGET)' && test -f $(TARGET).gdb-index && sparc-rtems-objcopy --add-section '.gdb_index=$(TARGET).gdb-index' --set-section-flags '.gdb_index=readonly' '$(TARGET)' '$(TARGET)' && rm -f $(TARGET).gdb-index || true | |
116 |
|
116 | |||
117 | Makefile: timegen-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \ |
|
117 | Makefile: timegen-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \ | |
118 | /usr/lib64/qt4/mkspecs/common/linux.conf \ |
|
118 | /usr/lib64/qt4/mkspecs/common/linux.conf \ | |
119 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ |
|
119 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ | |
120 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ |
|
120 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ | |
121 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ |
|
121 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ | |
122 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ |
|
122 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ | |
123 | /usr/lib64/qt4/mkspecs/qconfig.pri \ |
|
123 | /usr/lib64/qt4/mkspecs/qconfig.pri \ | |
124 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ |
|
124 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ | |
125 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ |
|
125 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ | |
126 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ |
|
126 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ | |
127 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ |
|
127 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ | |
128 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ |
|
128 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ | |
129 | sparc.pri \ |
|
129 | sparc.pri \ | |
130 | /usr/lib64/qt4/mkspecs/features/debug.prf \ |
|
130 | /usr/lib64/qt4/mkspecs/features/debug.prf \ | |
131 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ |
|
131 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ | |
132 | /usr/lib64/qt4/mkspecs/features/shared.prf \ |
|
132 | /usr/lib64/qt4/mkspecs/features/shared.prf \ | |
133 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ |
|
133 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ | |
134 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ |
|
134 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ | |
135 | /usr/lib64/qt4/mkspecs/features/resources.prf \ |
|
135 | /usr/lib64/qt4/mkspecs/features/resources.prf \ | |
136 | /usr/lib64/qt4/mkspecs/features/uic.prf \ |
|
136 | /usr/lib64/qt4/mkspecs/features/uic.prf \ | |
137 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ |
|
137 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ | |
138 | /usr/lib64/qt4/mkspecs/features/lex.prf \ |
|
138 | /usr/lib64/qt4/mkspecs/features/lex.prf \ | |
139 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf |
|
139 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf | |
140 | $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ CONFIG+=debug -o Makefile timegen-qt.pro |
|
140 | $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ CONFIG+=debug -o Makefile timegen-qt.pro | |
141 | /usr/lib64/qt4/mkspecs/common/unix.conf: |
|
141 | /usr/lib64/qt4/mkspecs/common/unix.conf: | |
142 | /usr/lib64/qt4/mkspecs/common/linux.conf: |
|
142 | /usr/lib64/qt4/mkspecs/common/linux.conf: | |
143 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf: |
|
143 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf: | |
144 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf: |
|
144 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf: | |
145 | /usr/lib64/qt4/mkspecs/common/g++-base.conf: |
|
145 | /usr/lib64/qt4/mkspecs/common/g++-base.conf: | |
146 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf: |
|
146 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf: | |
147 | /usr/lib64/qt4/mkspecs/qconfig.pri: |
|
147 | /usr/lib64/qt4/mkspecs/qconfig.pri: | |
148 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri: |
|
148 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri: | |
149 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf: |
|
149 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf: | |
150 | /usr/lib64/qt4/mkspecs/features/qt_config.prf: |
|
150 | /usr/lib64/qt4/mkspecs/features/qt_config.prf: | |
151 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf: |
|
151 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf: | |
152 | /usr/lib64/qt4/mkspecs/features/default_pre.prf: |
|
152 | /usr/lib64/qt4/mkspecs/features/default_pre.prf: | |
153 | sparc.pri: |
|
153 | sparc.pri: | |
154 | /usr/lib64/qt4/mkspecs/features/debug.prf: |
|
154 | /usr/lib64/qt4/mkspecs/features/debug.prf: | |
155 | /usr/lib64/qt4/mkspecs/features/default_post.prf: |
|
155 | /usr/lib64/qt4/mkspecs/features/default_post.prf: | |
156 | /usr/lib64/qt4/mkspecs/features/shared.prf: |
|
156 | /usr/lib64/qt4/mkspecs/features/shared.prf: | |
157 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf: |
|
157 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf: | |
158 | /usr/lib64/qt4/mkspecs/features/warn_on.prf: |
|
158 | /usr/lib64/qt4/mkspecs/features/warn_on.prf: | |
159 | /usr/lib64/qt4/mkspecs/features/resources.prf: |
|
159 | /usr/lib64/qt4/mkspecs/features/resources.prf: | |
160 | /usr/lib64/qt4/mkspecs/features/uic.prf: |
|
160 | /usr/lib64/qt4/mkspecs/features/uic.prf: | |
161 | /usr/lib64/qt4/mkspecs/features/yacc.prf: |
|
161 | /usr/lib64/qt4/mkspecs/features/yacc.prf: | |
162 | /usr/lib64/qt4/mkspecs/features/lex.prf: |
|
162 | /usr/lib64/qt4/mkspecs/features/lex.prf: | |
163 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf: |
|
163 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf: | |
164 | qmake: FORCE |
|
164 | qmake: FORCE | |
165 | @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ CONFIG+=debug -o Makefile timegen-qt.pro |
|
165 | @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ CONFIG+=debug -o Makefile timegen-qt.pro | |
166 |
|
166 | |||
167 | dist: |
|
167 | dist: | |
168 | @$(CHK_DIR_EXISTS) obj/timegen1.0.0 || $(MKDIR) obj/timegen1.0.0 |
|
168 | @$(CHK_DIR_EXISTS) obj/timegen1.0.0 || $(MKDIR) obj/timegen1.0.0 | |
169 | $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/timegen1.0.0/ && (cd `dirname obj/timegen1.0.0` && $(TAR) timegen1.0.0.tar timegen1.0.0 && $(COMPRESS) timegen1.0.0.tar) && $(MOVE) `dirname obj/timegen1.0.0`/timegen1.0.0.tar.gz . && $(DEL_FILE) -r obj/timegen1.0.0 |
|
169 | $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/timegen1.0.0/ && (cd `dirname obj/timegen1.0.0` && $(TAR) timegen1.0.0.tar timegen1.0.0 && $(COMPRESS) timegen1.0.0.tar) && $(MOVE) `dirname obj/timegen1.0.0`/timegen1.0.0.tar.gz . && $(DEL_FILE) -r obj/timegen1.0.0 | |
170 |
|
170 | |||
171 |
|
171 | |||
172 | clean:compiler_clean |
|
172 | clean:compiler_clean | |
173 | -$(DEL_FILE) $(OBJECTS) |
|
173 | -$(DEL_FILE) $(OBJECTS) | |
174 | -$(DEL_FILE) *~ core *.core |
|
174 | -$(DEL_FILE) *~ core *.core | |
175 |
|
175 | |||
176 |
|
176 | |||
177 | ####### Sub-libraries |
|
177 | ####### Sub-libraries | |
178 |
|
178 | |||
179 | distclean: clean |
|
179 | distclean: clean | |
180 | -$(DEL_FILE) $(TARGET) |
|
180 | -$(DEL_FILE) $(TARGET) | |
181 | -$(DEL_FILE) Makefile |
|
181 | -$(DEL_FILE) Makefile | |
182 |
|
182 | |||
183 |
|
183 | |||
184 | grmon: |
|
184 | grmon: | |
185 | cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u |
|
185 | cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u | |
186 |
|
186 | |||
187 | check: first |
|
187 | check: first | |
188 |
|
188 | |||
189 | compiler_rcc_make_all: |
|
189 | compiler_rcc_make_all: | |
190 | compiler_rcc_clean: |
|
190 | compiler_rcc_clean: | |
191 | compiler_uic_make_all: |
|
191 | compiler_uic_make_all: | |
192 | compiler_uic_clean: |
|
192 | compiler_uic_clean: | |
193 | compiler_image_collection_make_all: qmake_image_collection.cpp |
|
193 | compiler_image_collection_make_all: qmake_image_collection.cpp | |
194 | compiler_image_collection_clean: |
|
194 | compiler_image_collection_clean: | |
195 | -$(DEL_FILE) qmake_image_collection.cpp |
|
195 | -$(DEL_FILE) qmake_image_collection.cpp | |
196 | compiler_yacc_decl_make_all: |
|
196 | compiler_yacc_decl_make_all: | |
197 | compiler_yacc_decl_clean: |
|
197 | compiler_yacc_decl_clean: | |
198 | compiler_yacc_impl_make_all: |
|
198 | compiler_yacc_impl_make_all: | |
199 | compiler_yacc_impl_clean: |
|
199 | compiler_yacc_impl_clean: | |
200 | compiler_lex_make_all: |
|
200 | compiler_lex_make_all: | |
201 | compiler_lex_clean: |
|
201 | compiler_lex_clean: | |
202 | compiler_clean: |
|
202 | compiler_clean: | |
203 |
|
203 | |||
204 | ####### Compile |
|
204 | ####### Compile | |
205 |
|
205 | |||
206 | obj/tc_handler.o: src/tc_handler.c |
|
206 | obj/tc_handler.o: src/tc_handler.c | |
207 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o src/tc_handler.c |
|
207 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o src/tc_handler.c | |
208 |
|
208 | |||
209 | obj/fsw_misc.o: src/fsw_misc.c |
|
209 | obj/fsw_misc.o: src/fsw_misc.c | |
210 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o src/fsw_misc.c |
|
210 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o src/fsw_misc.c | |
211 |
|
211 | |||
212 | obj/fsw_init.o: src/fsw_init.c src/fsw_config.c |
|
212 | obj/fsw_init.o: src/fsw_init.c src/fsw_config.c | |
213 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o src/fsw_init.c |
|
213 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o src/fsw_init.c | |
214 |
|
214 | |||
215 | obj/fsw_globals.o: src/fsw_globals.c |
|
215 | obj/fsw_globals.o: src/fsw_globals.c | |
216 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o src/fsw_globals.c |
|
216 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o src/fsw_globals.c | |
217 |
|
217 | |||
218 | obj/fsw_spacewire.o: src/fsw_spacewire.c |
|
218 | obj/fsw_spacewire.o: src/fsw_spacewire.c | |
219 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spacewire.o src/fsw_spacewire.c |
|
219 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spacewire.o src/fsw_spacewire.c | |
220 |
|
220 | |||
221 | obj/tc_acceptance.o: src/tc_acceptance.c |
|
221 | obj/tc_acceptance.o: src/tc_acceptance.c | |
222 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_acceptance.o src/tc_acceptance.c |
|
222 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_acceptance.o src/tc_acceptance.c | |
223 |
|
223 | |||
224 | obj/basic_parameters.o: src/LFR_basic-parameters/basic_parameters.c |
|
224 | obj/basic_parameters.o: src/LFR_basic-parameters/basic_parameters.c | |
225 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/basic_parameters.o src/LFR_basic-parameters/basic_parameters.c |
|
225 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/basic_parameters.o src/LFR_basic-parameters/basic_parameters.c | |
226 |
|
226 | |||
227 | ####### Install |
|
227 | ####### Install | |
228 |
|
228 | |||
229 | install: FORCE |
|
229 | install: FORCE | |
230 |
|
230 | |||
231 | uninstall: FORCE |
|
231 | uninstall: FORCE | |
232 |
|
232 | |||
233 | FORCE: |
|
233 | FORCE: | |
234 |
|
234 |
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
@@ -1,81 +1,81 | |||||
1 | TEMPLATE = app |
|
1 | TEMPLATE = app | |
2 | # CONFIG += console v8 sim |
|
2 | # CONFIG += console v8 sim | |
3 | # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** vhdl_dev *** debug_tch |
|
3 | # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** vhdl_dev *** debug_tch | |
4 | CONFIG += console verbose |
|
4 | CONFIG += console verbose | |
5 | CONFIG -= qt |
|
5 | CONFIG -= qt | |
6 |
|
6 | |||
7 | include(./sparc.pri) |
|
7 | include(./sparc.pri) | |
8 |
|
8 | |||
9 | # flight software version |
|
9 | # flight software version | |
10 | SWVERSION=-1-0 |
|
10 | SWVERSION=-1-0 | |
11 | DEFINES += SW_VERSION_N1=0 # major |
|
11 | DEFINES += SW_VERSION_N1=0 # major | |
12 | DEFINES += SW_VERSION_N2=0 # minor |
|
12 | DEFINES += SW_VERSION_N2=0 # minor | |
13 | DEFINES += SW_VERSION_N3=0 # patch |
|
13 | DEFINES += SW_VERSION_N3=0 # patch | |
14 |
DEFINES += SW_VERSION_N4= |
|
14 | DEFINES += SW_VERSION_N4=1 # internal | |
15 |
|
15 | |||
16 | contains( CONFIG, debug_tch ) { |
|
16 | contains( CONFIG, debug_tch ) { | |
17 | DEFINES += DEBUG_TCH |
|
17 | DEFINES += DEBUG_TCH | |
18 | } |
|
18 | } | |
19 |
|
19 | |||
20 | contains( CONFIG, vhdl_dev ) { |
|
20 | contains( CONFIG, vhdl_dev ) { | |
21 | DEFINES += VHDL_DEV |
|
21 | DEFINES += VHDL_DEV | |
22 | } |
|
22 | } | |
23 |
|
23 | |||
24 | contains( CONFIG, verbose ) { |
|
24 | contains( CONFIG, verbose ) { | |
25 | DEFINES += PRINT_MESSAGES_ON_CONSOLE |
|
25 | DEFINES += PRINT_MESSAGES_ON_CONSOLE | |
26 | } |
|
26 | } | |
27 |
|
27 | |||
28 | contains( CONFIG, debug_messages ) { |
|
28 | contains( CONFIG, debug_messages ) { | |
29 | DEFINES += DEBUG_MESSAGES |
|
29 | DEFINES += DEBUG_MESSAGES | |
30 | } |
|
30 | } | |
31 |
|
31 | |||
32 | contains( CONFIG, cpu_usage_report ) { |
|
32 | contains( CONFIG, cpu_usage_report ) { | |
33 | DEFINES += PRINT_TASK_STATISTICS |
|
33 | DEFINES += PRINT_TASK_STATISTICS | |
34 | } |
|
34 | } | |
35 |
|
35 | |||
36 | contains( CONFIG, stack_report ) { |
|
36 | contains( CONFIG, stack_report ) { | |
37 | DEFINES += PRINT_STACK_REPORT |
|
37 | DEFINES += PRINT_STACK_REPORT | |
38 | } |
|
38 | } | |
39 |
|
39 | |||
40 | contains( CONFIG, boot_messages ) { |
|
40 | contains( CONFIG, boot_messages ) { | |
41 | DEFINES += BOOT_MESSAGES |
|
41 | DEFINES += BOOT_MESSAGES | |
42 | } |
|
42 | } | |
43 |
|
43 | |||
44 | #doxygen.target = doxygen |
|
44 | #doxygen.target = doxygen | |
45 | #doxygen.commands = doxygen ../doc/Doxyfile |
|
45 | #doxygen.commands = doxygen ../doc/Doxyfile | |
46 | #QMAKE_EXTRA_TARGETS += doxygen |
|
46 | #QMAKE_EXTRA_TARGETS += doxygen | |
47 |
|
47 | |||
48 | TARGET = timegen |
|
48 | TARGET = timegen | |
49 |
|
49 | |||
50 | INCLUDEPATH += \ |
|
50 | INCLUDEPATH += \ | |
51 | ./src \ |
|
51 | ./src \ | |
52 | ./header \ |
|
52 | ./header \ | |
53 | ./header/processing \ |
|
53 | ./header/processing \ | |
54 | ./src/LFR_basic-parameters |
|
54 | ./src/LFR_basic-parameters | |
55 |
|
55 | |||
56 | SOURCES += \ |
|
56 | SOURCES += \ | |
57 | ./src/tc_handler.c \ |
|
57 | ./src/tc_handler.c \ | |
58 | ./src/fsw_misc.c \ |
|
58 | ./src/fsw_misc.c \ | |
59 | ./src/fsw_init.c \ |
|
59 | ./src/fsw_init.c \ | |
60 | ./src/fsw_globals.c \ |
|
60 | ./src/fsw_globals.c \ | |
61 | ./src/fsw_spacewire.c \ |
|
61 | ./src/fsw_spacewire.c \ | |
62 | ./src/tc_acceptance.c \ |
|
62 | ./src/tc_acceptance.c \ | |
63 | ./src/LFR_basic-parameters/basic_parameters.c |
|
63 | ./src/LFR_basic-parameters/basic_parameters.c | |
64 |
|
64 | |||
65 | HEADERS += \ |
|
65 | HEADERS += \ | |
66 | ./header/tc_handler.h \ |
|
66 | ./header/tc_handler.h \ | |
67 | ./header/grlib_regs.h \ |
|
67 | ./header/grlib_regs.h \ | |
68 | ./header/fsw_params.h \ |
|
68 | ./header/fsw_params.h \ | |
69 | ./header/fsw_misc.h \ |
|
69 | ./header/fsw_misc.h \ | |
70 | ./header/fsw_init.h \ |
|
70 | ./header/fsw_init.h \ | |
71 | ./header/ccsds_types.h \ |
|
71 | ./header/ccsds_types.h \ | |
72 | ./header/fsw_spacewire.h \ |
|
72 | ./header/fsw_spacewire.h \ | |
73 | ./header/tc_acceptance.h \ |
|
73 | ./header/tc_acceptance.h \ | |
74 | ./header/fsw_params_nb_bytes.h \ |
|
74 | ./header/fsw_params_nb_bytes.h \ | |
75 | ./header/fsw_params_processing.h \ |
|
75 | ./header/fsw_params_processing.h \ | |
76 | ./header/fsw_params_wf_handler.h \ |
|
76 | ./header/fsw_params_wf_handler.h \ | |
77 | ./header/lfr_cpu_usage_report.h \ |
|
77 | ./header/lfr_cpu_usage_report.h \ | |
78 | ./src/LFR_basic-parameters/basic_parameters.h \ |
|
78 | ./src/LFR_basic-parameters/basic_parameters.h \ | |
79 | ./src/LFR_basic-parameters/basic_parameters_params.h \ |
|
79 | ./src/LFR_basic-parameters/basic_parameters_params.h \ | |
80 | ../header/TC_types.h |
|
80 | ../header/TC_types.h | |
81 |
|
81 |
General Comments 0
You need to be logged in to leave comments.
Login now