@@ -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: Tue Jul 15 15:57:23 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= |
|
13 | DEFINES = -DSW_VERSION_N1=2 -DSW_VERSION_N2=0 -DSW_VERSION_N3=1 -DSW_VERSION_N4=0 -DPRINT_MESSAGES_ON_CONSOLE | |
14 | CFLAGS = -pipe -O3 -Wall $(DEFINES) |
|
14 | CFLAGS = -pipe -O3 -Wall $(DEFINES) | |
15 | CXXFLAGS = -pipe -O3 -Wall $(DEFINES) |
|
15 | CXXFLAGS = -pipe -O3 -Wall $(DEFINES) | |
16 | INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header -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) |
|
19 | LIBS = $(SUBLIBS) | |
20 | AR = sparc-rtems-ar rcs |
|
20 | AR = sparc-rtems-ar rcs | |
21 | RANLIB = |
|
21 | RANLIB = | |
22 | QMAKE = /usr/bin/qmake-qt4 |
|
22 | QMAKE = /usr/bin/qmake-qt4 | |
23 | TAR = tar -cf |
|
23 | TAR = tar -cf | |
24 | COMPRESS = gzip -9f |
|
24 | COMPRESS = gzip -9f | |
25 | COPY = cp -f |
|
25 | COPY = cp -f | |
26 | SED = sed |
|
26 | SED = sed | |
27 | COPY_FILE = $(COPY) |
|
27 | COPY_FILE = $(COPY) | |
28 | COPY_DIR = $(COPY) -r |
|
28 | COPY_DIR = $(COPY) -r | |
29 | STRIP = sparc-rtems-strip |
|
29 | STRIP = sparc-rtems-strip | |
30 | INSTALL_FILE = install -m 644 -p |
|
30 | INSTALL_FILE = install -m 644 -p | |
31 | INSTALL_DIR = $(COPY_DIR) |
|
31 | INSTALL_DIR = $(COPY_DIR) | |
32 | INSTALL_PROGRAM = install -m 755 -p |
|
32 | INSTALL_PROGRAM = install -m 755 -p | |
33 | DEL_FILE = rm -f |
|
33 | DEL_FILE = rm -f | |
34 | SYMLINK = ln -f -s |
|
34 | SYMLINK = ln -f -s | |
35 | DEL_DIR = rmdir |
|
35 | DEL_DIR = rmdir | |
36 | MOVE = mv -f |
|
36 | MOVE = mv -f | |
37 | CHK_DIR_EXISTS= test -d |
|
37 | CHK_DIR_EXISTS= test -d | |
38 | MKDIR = mkdir -p |
|
38 | MKDIR = mkdir -p | |
39 |
|
39 | |||
40 | ####### Output directory |
|
40 | ####### Output directory | |
41 |
|
41 | |||
42 | OBJECTS_DIR = obj/ |
|
42 | OBJECTS_DIR = obj/ | |
43 |
|
43 | |||
44 | ####### Files |
|
44 | ####### Files | |
45 |
|
45 | |||
46 | SOURCES = ../src/wf_handler.c \ |
|
46 | SOURCES = ../src/wf_handler.c \ | |
47 | ../src/tc_handler.c \ |
|
47 | ../src/tc_handler.c \ | |
48 | ../src/fsw_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,95 +1,95 | |||||
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= |
|
11 | DEFINES += SW_VERSION_N1=2 # major | |
12 | DEFINES += SW_VERSION_N2=0 # minor |
|
12 | DEFINES += SW_VERSION_N2=0 # minor | |
13 |
DEFINES += SW_VERSION_N3= |
|
13 | DEFINES += SW_VERSION_N3=1 # patch | |
14 |
DEFINES += SW_VERSION_N4= |
|
14 | DEFINES += SW_VERSION_N4=0 # internal | |
15 |
|
15 | |||
16 | contains( CONFIG, debug_tch ) { |
|
16 | contains( CONFIG, debug_tch ) { | |
17 | DEFINES += DEBUG_TCH |
|
17 | DEFINES += DEBUG_TCH | |
18 | } |
|
18 | } | |
19 |
|
19 | |||
20 | contains( CONFIG, vhdl_dev ) { |
|
20 | contains( CONFIG, vhdl_dev ) { | |
21 | DEFINES += VHDL_DEV |
|
21 | DEFINES += VHDL_DEV | |
22 | } |
|
22 | } | |
23 |
|
23 | |||
24 | contains( CONFIG, verbose ) { |
|
24 | contains( CONFIG, verbose ) { | |
25 | DEFINES += PRINT_MESSAGES_ON_CONSOLE |
|
25 | DEFINES += PRINT_MESSAGES_ON_CONSOLE | |
26 | } |
|
26 | } | |
27 |
|
27 | |||
28 | contains( CONFIG, debug_messages ) { |
|
28 | contains( CONFIG, debug_messages ) { | |
29 | DEFINES += DEBUG_MESSAGES |
|
29 | DEFINES += DEBUG_MESSAGES | |
30 | } |
|
30 | } | |
31 |
|
31 | |||
32 | contains( CONFIG, cpu_usage_report ) { |
|
32 | contains( CONFIG, cpu_usage_report ) { | |
33 | DEFINES += PRINT_TASK_STATISTICS |
|
33 | DEFINES += PRINT_TASK_STATISTICS | |
34 | } |
|
34 | } | |
35 |
|
35 | |||
36 | contains( CONFIG, stack_report ) { |
|
36 | contains( CONFIG, stack_report ) { | |
37 | DEFINES += PRINT_STACK_REPORT |
|
37 | DEFINES += PRINT_STACK_REPORT | |
38 | } |
|
38 | } | |
39 |
|
39 | |||
40 | contains( CONFIG, boot_messages ) { |
|
40 | contains( CONFIG, boot_messages ) { | |
41 | DEFINES += BOOT_MESSAGES |
|
41 | DEFINES += BOOT_MESSAGES | |
42 | } |
|
42 | } | |
43 |
|
43 | |||
44 | #doxygen.target = doxygen |
|
44 | #doxygen.target = doxygen | |
45 | #doxygen.commands = doxygen ../doc/Doxyfile |
|
45 | #doxygen.commands = doxygen ../doc/Doxyfile | |
46 | #QMAKE_EXTRA_TARGETS += doxygen |
|
46 | #QMAKE_EXTRA_TARGETS += doxygen | |
47 |
|
47 | |||
48 | TARGET = fsw |
|
48 | TARGET = fsw | |
49 |
|
49 | |||
50 | INCLUDEPATH += \ |
|
50 | INCLUDEPATH += \ | |
51 | ../src \ |
|
51 | ../src \ | |
52 | ../header \ |
|
52 | ../header \ | |
53 | ../header/processing \ |
|
53 | ../header/processing \ | |
54 | ../src/LFR_basic-parameters |
|
54 | ../src/LFR_basic-parameters | |
55 |
|
55 | |||
56 | SOURCES += \ |
|
56 | SOURCES += \ | |
57 | ../src/wf_handler.c \ |
|
57 | ../src/wf_handler.c \ | |
58 | ../src/tc_handler.c \ |
|
58 | ../src/tc_handler.c \ | |
59 | ../src/fsw_misc.c \ |
|
59 | ../src/fsw_misc.c \ | |
60 | ../src/fsw_init.c \ |
|
60 | ../src/fsw_init.c \ | |
61 | ../src/fsw_globals.c \ |
|
61 | ../src/fsw_globals.c \ | |
62 | ../src/fsw_spacewire.c \ |
|
62 | ../src/fsw_spacewire.c \ | |
63 | ../src/tc_load_dump_parameters.c \ |
|
63 | ../src/tc_load_dump_parameters.c \ | |
64 | ../src/tm_lfr_tc_exe.c \ |
|
64 | ../src/tm_lfr_tc_exe.c \ | |
65 | ../src/tc_acceptance.c \ |
|
65 | ../src/tc_acceptance.c \ | |
66 | ../src/processing/fsw_processing.c \ |
|
66 | ../src/processing/fsw_processing.c \ | |
67 | ../src/processing/avf0_prc0.c \ |
|
67 | ../src/processing/avf0_prc0.c \ | |
68 | ../src/processing/avf1_prc1.c \ |
|
68 | ../src/processing/avf1_prc1.c \ | |
69 | ../src/processing/avf2_prc2.c \ |
|
69 | ../src/processing/avf2_prc2.c \ | |
70 | ../src/lfr_cpu_usage_report.c \ |
|
70 | ../src/lfr_cpu_usage_report.c \ | |
71 | ../src/LFR_basic-parameters/basic_parameters.c |
|
71 | ../src/LFR_basic-parameters/basic_parameters.c | |
72 |
|
72 | |||
73 | HEADERS += \ |
|
73 | HEADERS += \ | |
74 | ../header/wf_handler.h \ |
|
74 | ../header/wf_handler.h \ | |
75 | ../header/tc_handler.h \ |
|
75 | ../header/tc_handler.h \ | |
76 | ../header/grlib_regs.h \ |
|
76 | ../header/grlib_regs.h \ | |
77 | ../header/fsw_params.h \ |
|
77 | ../header/fsw_params.h \ | |
78 | ../header/fsw_misc.h \ |
|
78 | ../header/fsw_misc.h \ | |
79 | ../header/fsw_init.h \ |
|
79 | ../header/fsw_init.h \ | |
80 | ../header/ccsds_types.h \ |
|
80 | ../header/ccsds_types.h \ | |
81 | ../header/fsw_spacewire.h \ |
|
81 | ../header/fsw_spacewire.h \ | |
82 | ../header/tc_load_dump_parameters.h \ |
|
82 | ../header/tc_load_dump_parameters.h \ | |
83 | ../header/tm_lfr_tc_exe.h \ |
|
83 | ../header/tm_lfr_tc_exe.h \ | |
84 | ../header/tc_acceptance.h \ |
|
84 | ../header/tc_acceptance.h \ | |
85 | ../header/fsw_params_nb_bytes.h \ |
|
85 | ../header/fsw_params_nb_bytes.h \ | |
86 | ../header/fsw_params_processing.h \ |
|
86 | ../header/fsw_params_processing.h \ | |
87 | ../header/processing/fsw_processing.h \ |
|
87 | ../header/processing/fsw_processing.h \ | |
88 | ../header/processing/avf0_prc0.h \ |
|
88 | ../header/processing/avf0_prc0.h \ | |
89 | ../header/processing/avf1_prc1.h \ |
|
89 | ../header/processing/avf1_prc1.h \ | |
90 | ../header/processing/avf2_prc2.h \ |
|
90 | ../header/processing/avf2_prc2.h \ | |
91 | ../header/fsw_params_wf_handler.h \ |
|
91 | ../header/fsw_params_wf_handler.h \ | |
92 | ../header/lfr_cpu_usage_report.h \ |
|
92 | ../header/lfr_cpu_usage_report.h \ | |
93 | ../src/LFR_basic-parameters/basic_parameters.h \ |
|
93 | ../src/LFR_basic-parameters/basic_parameters.h \ | |
94 | ../src/LFR_basic-parameters/basic_parameters_params.h |
|
94 | ../src/LFR_basic-parameters/basic_parameters_params.h | |
95 |
|
95 |
@@ -1,201 +1,201 | |||||
1 | <?xml version="1.0" encoding="UTF-8"?> |
|
1 | <?xml version="1.0" encoding="UTF-8"?> | |
2 | <!DOCTYPE QtCreatorProject> |
|
2 | <!DOCTYPE QtCreatorProject> | |
3 |
<!-- Written by QtCreator 3.0.1, 2014-0 |
|
3 | <!-- Written by QtCreator 3.0.1, 2014-07-15T16:01:49. --> | |
4 | <qtcreator> |
|
4 | <qtcreator> | |
5 | <data> |
|
5 | <data> | |
6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
|
6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> | |
7 | <value type="int">0</value> |
|
7 | <value type="int">0</value> | |
8 | </data> |
|
8 | </data> | |
9 | <data> |
|
9 | <data> | |
10 | <variable>ProjectExplorer.Project.EditorSettings</variable> |
|
10 | <variable>ProjectExplorer.Project.EditorSettings</variable> | |
11 | <valuemap type="QVariantMap"> |
|
11 | <valuemap type="QVariantMap"> | |
12 | <value type="bool" key="EditorConfiguration.AutoIndent">true</value> |
|
12 | <value type="bool" key="EditorConfiguration.AutoIndent">true</value> | |
13 | <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value> |
|
13 | <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value> | |
14 | <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value> |
|
14 | <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value> | |
15 | <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0"> |
|
15 | <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0"> | |
16 | <value type="QString" key="language">Cpp</value> |
|
16 | <value type="QString" key="language">Cpp</value> | |
17 | <valuemap type="QVariantMap" key="value"> |
|
17 | <valuemap type="QVariantMap" key="value"> | |
18 | <value type="QByteArray" key="CurrentPreferences">CppGlobal</value> |
|
18 | <value type="QByteArray" key="CurrentPreferences">CppGlobal</value> | |
19 | </valuemap> |
|
19 | </valuemap> | |
20 | </valuemap> |
|
20 | </valuemap> | |
21 | <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1"> |
|
21 | <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1"> | |
22 | <value type="QString" key="language">QmlJS</value> |
|
22 | <value type="QString" key="language">QmlJS</value> | |
23 | <valuemap type="QVariantMap" key="value"> |
|
23 | <valuemap type="QVariantMap" key="value"> | |
24 | <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value> |
|
24 | <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value> | |
25 | </valuemap> |
|
25 | </valuemap> | |
26 | </valuemap> |
|
26 | </valuemap> | |
27 | <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value> |
|
27 | <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value> | |
28 | <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value> |
|
28 | <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value> | |
29 | <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value> |
|
29 | <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value> | |
30 | <value type="int" key="EditorConfiguration.IndentSize">4</value> |
|
30 | <value type="int" key="EditorConfiguration.IndentSize">4</value> | |
31 | <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value> |
|
31 | <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value> | |
32 | <value type="bool" key="EditorConfiguration.MouseNavigation">true</value> |
|
32 | <value type="bool" key="EditorConfiguration.MouseNavigation">true</value> | |
33 | <value type="int" key="EditorConfiguration.PaddingMode">1</value> |
|
33 | <value type="int" key="EditorConfiguration.PaddingMode">1</value> | |
34 | <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value> |
|
34 | <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value> | |
35 | <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value> |
|
35 | <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value> | |
36 | <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value> |
|
36 | <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value> | |
37 | <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value> |
|
37 | <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value> | |
38 | <value type="int" key="EditorConfiguration.TabSize">8</value> |
|
38 | <value type="int" key="EditorConfiguration.TabSize">8</value> | |
39 | <value type="bool" key="EditorConfiguration.UseGlobal">true</value> |
|
39 | <value type="bool" key="EditorConfiguration.UseGlobal">true</value> | |
40 | <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value> |
|
40 | <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value> | |
41 | <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value> |
|
41 | <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value> | |
42 | <value type="bool" key="EditorConfiguration.cleanIndentation">true</value> |
|
42 | <value type="bool" key="EditorConfiguration.cleanIndentation">true</value> | |
43 | <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value> |
|
43 | <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value> | |
44 | <value type="bool" key="EditorConfiguration.inEntireDocument">false</value> |
|
44 | <value type="bool" key="EditorConfiguration.inEntireDocument">false</value> | |
45 | </valuemap> |
|
45 | </valuemap> | |
46 | </data> |
|
46 | </data> | |
47 | <data> |
|
47 | <data> | |
48 | <variable>ProjectExplorer.Project.PluginSettings</variable> |
|
48 | <variable>ProjectExplorer.Project.PluginSettings</variable> | |
49 | <valuemap type="QVariantMap"/> |
|
49 | <valuemap type="QVariantMap"/> | |
50 | </data> |
|
50 | </data> | |
51 | <data> |
|
51 | <data> | |
52 | <variable>ProjectExplorer.Project.Target.0</variable> |
|
52 | <variable>ProjectExplorer.Project.Target.0</variable> | |
53 | <valuemap type="QVariantMap"> |
|
53 | <valuemap type="QVariantMap"> | |
54 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.2 in PATH (System)</value> |
|
54 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.2 in PATH (System)</value> | |
55 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.2 in PATH (System)</value> |
|
55 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.2 in PATH (System)</value> | |
56 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{5289e843-9ef2-45ce-88c6-ad27d8e08def}</value> |
|
56 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{5289e843-9ef2-45ce-88c6-ad27d8e08def}</value> | |
57 | <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value> |
|
57 | <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value> | |
58 | <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> |
|
58 | <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> | |
59 | <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> |
|
59 | <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> | |
60 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> |
|
60 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> | |
61 | <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory"></value> |
|
61 | <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory"></value> | |
62 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|
62 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> | |
63 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
63 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> | |
64 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
64 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> | |
65 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> |
|
65 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> | |
66 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
66 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
67 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> |
|
67 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> | |
68 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> |
|
68 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> | |
69 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value> |
|
69 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value> | |
70 | <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> |
|
70 | <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> | |
71 | <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> |
|
71 | <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> | |
72 | </valuemap> |
|
72 | </valuemap> | |
73 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> |
|
73 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> | |
74 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
74 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> | |
75 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
75 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> | |
76 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
76 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
77 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
77 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> | |
78 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
78 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> | |
79 | <value type="QString">-w</value> |
|
79 | <value type="QString">-w</value> | |
80 | <value type="QString">-r</value> |
|
80 | <value type="QString">-r</value> | |
81 | </valuelist> |
|
81 | </valuelist> | |
82 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> |
|
82 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> | |
83 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> |
|
83 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> | |
84 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
84 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> | |
85 | </valuemap> |
|
85 | </valuemap> | |
86 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> |
|
86 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> | |
87 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> |
|
87 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> | |
88 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
88 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
89 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> |
|
89 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> | |
90 | </valuemap> |
|
90 | </valuemap> | |
91 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> |
|
91 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> | |
92 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
92 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> | |
93 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
93 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> | |
94 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
94 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> | |
95 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
95 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
96 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
96 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> | |
97 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
97 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> | |
98 | <value type="QString">-w</value> |
|
98 | <value type="QString">-w</value> | |
99 | <value type="QString">-r</value> |
|
99 | <value type="QString">-r</value> | |
100 | </valuelist> |
|
100 | </valuelist> | |
101 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> |
|
101 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> | |
102 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> |
|
102 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> | |
103 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
103 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> | |
104 | </valuemap> |
|
104 | </valuemap> | |
105 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> |
|
105 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> | |
106 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> |
|
106 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> | |
107 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
107 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
108 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> |
|
108 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> | |
109 | </valuemap> |
|
109 | </valuemap> | |
110 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> |
|
110 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> | |
111 | <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> |
|
111 | <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> | |
112 | <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> |
|
112 | <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> | |
113 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value> |
|
113 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value> | |
114 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
114 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
115 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> |
|
115 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> | |
116 | <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> |
|
116 | <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> | |
117 | <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> |
|
117 | <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> | |
118 | </valuemap> |
|
118 | </valuemap> | |
119 | <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value> |
|
119 | <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value> | |
120 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0"> |
|
120 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0"> | |
121 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|
121 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> | |
122 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value> |
|
122 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value> | |
123 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value> |
|
123 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value> | |
124 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
124 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
125 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value> |
|
125 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value> | |
126 | </valuemap> |
|
126 | </valuemap> | |
127 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value> |
|
127 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value> | |
128 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value> |
|
128 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value> | |
129 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
129 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
130 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value> |
|
130 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value> | |
131 | </valuemap> |
|
131 | </valuemap> | |
132 | <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> |
|
132 | <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> | |
133 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/> |
|
133 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/> | |
134 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> |
|
134 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> | |
135 | <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> |
|
135 | <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> | |
136 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> |
|
136 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> | |
137 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> |
|
137 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> | |
138 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> |
|
138 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> | |
139 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> |
|
139 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> | |
140 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> |
|
140 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> | |
141 | <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> |
|
141 | <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> | |
142 | <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> |
|
142 | <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> | |
143 | <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> |
|
143 | <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> | |
144 | <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value> |
|
144 | <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value> | |
145 | <value type="int" key="Analyzer.Valgrind.NumCallers">25</value> |
|
145 | <value type="int" key="Analyzer.Valgrind.NumCallers">25</value> | |
146 | <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> |
|
146 | <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> | |
147 | <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value> |
|
147 | <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value> | |
148 | <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value> |
|
148 | <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value> | |
149 | <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value> |
|
149 | <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value> | |
150 | <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> |
|
150 | <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> | |
151 | <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> |
|
151 | <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> | |
152 | <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> |
|
152 | <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> | |
153 | <value type="int">0</value> |
|
153 | <value type="int">0</value> | |
154 | <value type="int">1</value> |
|
154 | <value type="int">1</value> | |
155 | <value type="int">2</value> |
|
155 | <value type="int">2</value> | |
156 | <value type="int">3</value> |
|
156 | <value type="int">3</value> | |
157 | <value type="int">4</value> |
|
157 | <value type="int">4</value> | |
158 | <value type="int">5</value> |
|
158 | <value type="int">5</value> | |
159 | <value type="int">6</value> |
|
159 | <value type="int">6</value> | |
160 | <value type="int">7</value> |
|
160 | <value type="int">7</value> | |
161 | <value type="int">8</value> |
|
161 | <value type="int">8</value> | |
162 | <value type="int">9</value> |
|
162 | <value type="int">9</value> | |
163 | <value type="int">10</value> |
|
163 | <value type="int">10</value> | |
164 | <value type="int">11</value> |
|
164 | <value type="int">11</value> | |
165 | <value type="int">12</value> |
|
165 | <value type="int">12</value> | |
166 | <value type="int">13</value> |
|
166 | <value type="int">13</value> | |
167 | <value type="int">14</value> |
|
167 | <value type="int">14</value> | |
168 | </valuelist> |
|
168 | </valuelist> | |
169 | <value type="int" key="PE.EnvironmentAspect.Base">2</value> |
|
169 | <value type="int" key="PE.EnvironmentAspect.Base">2</value> | |
170 | <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> |
|
170 | <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> | |
171 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value> |
|
171 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value> | |
172 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
172 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
173 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value> |
|
173 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value> | |
174 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value> |
|
174 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value> | |
175 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value> |
|
175 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value> | |
176 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value> |
|
176 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value> | |
177 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value> |
|
177 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value> | |
178 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value> |
|
178 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value> | |
179 | <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> |
|
179 | <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> | |
180 | <value type="bool" key="RunConfiguration.UseCppDebugger">true</value> |
|
180 | <value type="bool" key="RunConfiguration.UseCppDebugger">true</value> | |
181 | <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value> |
|
181 | <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value> | |
182 | <value type="bool" key="RunConfiguration.UseMultiProcess">false</value> |
|
182 | <value type="bool" key="RunConfiguration.UseMultiProcess">false</value> | |
183 | <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> |
|
183 | <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> | |
184 | <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> |
|
184 | <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> | |
185 | </valuemap> |
|
185 | </valuemap> | |
186 | <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value> |
|
186 | <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value> | |
187 | </valuemap> |
|
187 | </valuemap> | |
188 | </data> |
|
188 | </data> | |
189 | <data> |
|
189 | <data> | |
190 | <variable>ProjectExplorer.Project.TargetCount</variable> |
|
190 | <variable>ProjectExplorer.Project.TargetCount</variable> | |
191 | <value type="int">1</value> |
|
191 | <value type="int">1</value> | |
192 | </data> |
|
192 | </data> | |
193 | <data> |
|
193 | <data> | |
194 | <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable> |
|
194 | <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable> | |
195 | <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value> |
|
195 | <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value> | |
196 | </data> |
|
196 | </data> | |
197 | <data> |
|
197 | <data> | |
198 | <variable>ProjectExplorer.Project.Updater.FileVersion</variable> |
|
198 | <variable>ProjectExplorer.Project.Updater.FileVersion</variable> | |
199 | <value type="int">15</value> |
|
199 | <value type="int">15</value> | |
200 | </data> |
|
200 | </data> | |
201 | </qtcreator> |
|
201 | </qtcreator> |
@@ -1,588 +1,529 | |||||
1 | /** General usage functions and RTEMS tasks. |
|
1 | /** General usage functions and RTEMS tasks. | |
2 | * |
|
2 | * | |
3 | * @file |
|
3 | * @file | |
4 | * @author P. LEROY |
|
4 | * @author P. LEROY | |
5 | * |
|
5 | * | |
6 | */ |
|
6 | */ | |
7 |
|
7 | |||
8 | #include "fsw_misc.h" |
|
8 | #include "fsw_misc.h" | |
9 |
|
9 | |||
10 | void configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider, |
|
10 | void configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider, | |
11 | unsigned char interrupt_level, rtems_isr (*timer_isr)() ) |
|
11 | unsigned char interrupt_level, rtems_isr (*timer_isr)() ) | |
12 | { |
|
12 | { | |
13 | /** This function configures a GPTIMER timer instantiated in the VHDL design. |
|
13 | /** This function configures a GPTIMER timer instantiated in the VHDL design. | |
14 | * |
|
14 | * | |
15 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. |
|
15 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. | |
16 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). |
|
16 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). | |
17 | * @param clock_divider is the divider of the 1 MHz clock that will be configured. |
|
17 | * @param clock_divider is the divider of the 1 MHz clock that will be configured. | |
18 | * @param interrupt_level is the interrupt level that the timer drives. |
|
18 | * @param interrupt_level is the interrupt level that the timer drives. | |
19 | * @param timer_isr is the interrupt subroutine that will be attached to the IRQ driven by the timer. |
|
19 | * @param timer_isr is the interrupt subroutine that will be attached to the IRQ driven by the timer. | |
20 | * |
|
20 | * | |
21 | * Interrupt levels are described in the SPARC documentation sparcv8.pdf p.76 |
|
21 | * Interrupt levels are described in the SPARC documentation sparcv8.pdf p.76 | |
22 | * |
|
22 | * | |
23 | */ |
|
23 | */ | |
24 |
|
24 | |||
25 | rtems_status_code status; |
|
25 | rtems_status_code status; | |
26 | rtems_isr_entry old_isr_handler; |
|
26 | rtems_isr_entry old_isr_handler; | |
27 |
|
27 | |||
28 | gptimer_regs->timer[timer].ctrl = 0x00; // reset the control register |
|
28 | gptimer_regs->timer[timer].ctrl = 0x00; // reset the control register | |
29 |
|
29 | |||
30 | status = rtems_interrupt_catch( timer_isr, interrupt_level, &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels |
|
30 | status = rtems_interrupt_catch( timer_isr, interrupt_level, &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels | |
31 | if (status!=RTEMS_SUCCESSFUL) |
|
31 | if (status!=RTEMS_SUCCESSFUL) | |
32 | { |
|
32 | { | |
33 | PRINTF("in configure_timer *** ERR rtems_interrupt_catch\n") |
|
33 | PRINTF("in configure_timer *** ERR rtems_interrupt_catch\n") | |
34 | } |
|
34 | } | |
35 |
|
35 | |||
36 | timer_set_clock_divider( gptimer_regs, timer, clock_divider); |
|
36 | timer_set_clock_divider( gptimer_regs, timer, clock_divider); | |
37 | } |
|
37 | } | |
38 |
|
38 | |||
39 | void timer_start(gptimer_regs_t *gptimer_regs, unsigned char timer) |
|
39 | void timer_start(gptimer_regs_t *gptimer_regs, unsigned char timer) | |
40 | { |
|
40 | { | |
41 | /** This function starts a GPTIMER timer. |
|
41 | /** This function starts a GPTIMER timer. | |
42 | * |
|
42 | * | |
43 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. |
|
43 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. | |
44 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). |
|
44 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). | |
45 | * |
|
45 | * | |
46 | */ |
|
46 | */ | |
47 |
|
47 | |||
48 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any |
|
48 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any | |
49 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000004; // LD load value from the reload register |
|
49 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000004; // LD load value from the reload register | |
50 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000001; // EN enable the timer |
|
50 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000001; // EN enable the timer | |
51 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000002; // RS restart |
|
51 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000002; // RS restart | |
52 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000008; // IE interrupt enable |
|
52 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000008; // IE interrupt enable | |
53 | } |
|
53 | } | |
54 |
|
54 | |||
55 | void timer_stop(gptimer_regs_t *gptimer_regs, unsigned char timer) |
|
55 | void timer_stop(gptimer_regs_t *gptimer_regs, unsigned char timer) | |
56 | { |
|
56 | { | |
57 | /** This function stops a GPTIMER timer. |
|
57 | /** This function stops a GPTIMER timer. | |
58 | * |
|
58 | * | |
59 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. |
|
59 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. | |
60 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). |
|
60 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). | |
61 | * |
|
61 | * | |
62 | */ |
|
62 | */ | |
63 |
|
63 | |||
64 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xfffffffe; // EN enable the timer |
|
64 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xfffffffe; // EN enable the timer | |
65 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xffffffef; // IE interrupt enable |
|
65 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xffffffef; // IE interrupt enable | |
66 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any |
|
66 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any | |
67 | } |
|
67 | } | |
68 |
|
68 | |||
69 | void timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider) |
|
69 | void timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider) | |
70 | { |
|
70 | { | |
71 | /** This function sets the clock divider of a GPTIMER timer. |
|
71 | /** This function sets the clock divider of a GPTIMER timer. | |
72 | * |
|
72 | * | |
73 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. |
|
73 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. | |
74 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). |
|
74 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). | |
75 | * @param clock_divider is the divider of the 1 MHz clock that will be configured. |
|
75 | * @param clock_divider is the divider of the 1 MHz clock that will be configured. | |
76 | * |
|
76 | * | |
77 | */ |
|
77 | */ | |
78 |
|
78 | |||
79 | gptimer_regs->timer[timer].reload = clock_divider; // base clock frequency is 1 MHz |
|
79 | gptimer_regs->timer[timer].reload = clock_divider; // base clock frequency is 1 MHz | |
80 | } |
|
80 | } | |
81 |
|
81 | |||
82 | int send_console_outputs_on_apbuart_port( void ) // Send the console outputs on the apbuart port |
|
82 | int send_console_outputs_on_apbuart_port( void ) // Send the console outputs on the apbuart port | |
83 | { |
|
83 | { | |
84 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART; |
|
84 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART; | |
85 |
|
85 | |||
86 | apbuart_regs->ctrl = APBUART_CTRL_REG_MASK_TE; |
|
86 | apbuart_regs->ctrl = APBUART_CTRL_REG_MASK_TE; | |
87 |
|
87 | |||
88 | return 0; |
|
88 | return 0; | |
89 | } |
|
89 | } | |
90 |
|
90 | |||
91 | int enable_apbuart_transmitter( void ) // set the bit 1, TE Transmitter Enable to 1 in the APBUART control register |
|
91 | int enable_apbuart_transmitter( void ) // set the bit 1, TE Transmitter Enable to 1 in the APBUART control register | |
92 | { |
|
92 | { | |
93 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART; |
|
93 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART; | |
94 |
|
94 | |||
95 | apbuart_regs->ctrl = apbuart_regs->ctrl | APBUART_CTRL_REG_MASK_TE; |
|
95 | apbuart_regs->ctrl = apbuart_regs->ctrl | APBUART_CTRL_REG_MASK_TE; | |
96 |
|
96 | |||
97 | return 0; |
|
97 | return 0; | |
98 | } |
|
98 | } | |
99 |
|
99 | |||
100 | void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value) |
|
100 | void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value) | |
101 | { |
|
101 | { | |
102 | /** This function sets the scaler reload register of the apbuart module |
|
102 | /** This function sets the scaler reload register of the apbuart module | |
103 | * |
|
103 | * | |
104 | * @param regs is the address of the apbuart registers in memory |
|
104 | * @param regs is the address of the apbuart registers in memory | |
105 | * @param value is the value that will be stored in the scaler register |
|
105 | * @param value is the value that will be stored in the scaler register | |
106 | * |
|
106 | * | |
107 | * The value shall be set by the software to get data on the serial interface. |
|
107 | * The value shall be set by the software to get data on the serial interface. | |
108 | * |
|
108 | * | |
109 | */ |
|
109 | */ | |
110 |
|
110 | |||
111 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) regs; |
|
111 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) regs; | |
112 |
|
112 | |||
113 | apbuart_regs->scaler = value; |
|
113 | apbuart_regs->scaler = value; | |
114 | BOOT_PRINTF1("OK *** apbuart port scaler reload register set to 0x%x\n", value) |
|
114 | BOOT_PRINTF1("OK *** apbuart port scaler reload register set to 0x%x\n", value) | |
115 | } |
|
115 | } | |
116 |
|
116 | |||
117 | //************ |
|
117 | //************ | |
118 | // RTEMS TASKS |
|
118 | // RTEMS TASKS | |
119 |
|
119 | |||
120 | rtems_task stat_task(rtems_task_argument argument) |
|
120 | rtems_task stat_task(rtems_task_argument argument) | |
121 | { |
|
121 | { | |
122 | int i; |
|
122 | int i; | |
123 | int j; |
|
123 | int j; | |
124 | i = 0; |
|
124 | i = 0; | |
125 | j = 0; |
|
125 | j = 0; | |
126 | BOOT_PRINTF("in STAT *** \n") |
|
126 | BOOT_PRINTF("in STAT *** \n") | |
127 | while(1){ |
|
127 | while(1){ | |
128 | rtems_task_wake_after(1000); |
|
128 | rtems_task_wake_after(1000); | |
129 | PRINTF1("%d\n", j) |
|
129 | PRINTF1("%d\n", j) | |
130 | if (i == CPU_USAGE_REPORT_PERIOD) { |
|
130 | if (i == CPU_USAGE_REPORT_PERIOD) { | |
131 | // #ifdef PRINT_TASK_STATISTICS |
|
131 | // #ifdef PRINT_TASK_STATISTICS | |
132 | // rtems_cpu_usage_report(); |
|
132 | // rtems_cpu_usage_report(); | |
133 | // rtems_cpu_usage_reset(); |
|
133 | // rtems_cpu_usage_reset(); | |
134 | // #endif |
|
134 | // #endif | |
135 | i = 0; |
|
135 | i = 0; | |
136 | } |
|
136 | } | |
137 | else i++; |
|
137 | else i++; | |
138 | j++; |
|
138 | j++; | |
139 | } |
|
139 | } | |
140 | } |
|
140 | } | |
141 |
|
141 | |||
142 | rtems_task hous_task(rtems_task_argument argument) |
|
142 | rtems_task hous_task(rtems_task_argument argument) | |
143 | { |
|
143 | { | |
144 | rtems_status_code status; |
|
144 | rtems_status_code status; | |
145 | rtems_id queue_id; |
|
145 | rtems_id queue_id; | |
146 | rtems_rate_monotonic_period_status period_status; |
|
146 | rtems_rate_monotonic_period_status period_status; | |
147 |
|
147 | |||
148 | status = get_message_queue_id_send( &queue_id ); |
|
148 | status = get_message_queue_id_send( &queue_id ); | |
149 | if (status != RTEMS_SUCCESSFUL) |
|
149 | if (status != RTEMS_SUCCESSFUL) | |
150 | { |
|
150 | { | |
151 | PRINTF1("in HOUS *** ERR get_message_queue_id_send %d\n", status) |
|
151 | PRINTF1("in HOUS *** ERR get_message_queue_id_send %d\n", status) | |
152 | } |
|
152 | } | |
153 |
|
153 | |||
154 | BOOT_PRINTF("in HOUS ***\n") |
|
154 | BOOT_PRINTF("in HOUS ***\n") | |
155 |
|
155 | |||
156 | if (rtems_rate_monotonic_ident( name_hk_rate_monotonic, &HK_id) != RTEMS_SUCCESSFUL) { |
|
156 | if (rtems_rate_monotonic_ident( name_hk_rate_monotonic, &HK_id) != RTEMS_SUCCESSFUL) { | |
157 | status = rtems_rate_monotonic_create( name_hk_rate_monotonic, &HK_id ); |
|
157 | status = rtems_rate_monotonic_create( name_hk_rate_monotonic, &HK_id ); | |
158 | if( status != RTEMS_SUCCESSFUL ) { |
|
158 | if( status != RTEMS_SUCCESSFUL ) { | |
159 | PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status ) |
|
159 | PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status ) | |
160 | } |
|
160 | } | |
161 | } |
|
161 | } | |
162 |
|
162 | |||
163 | housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
163 | housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; | |
164 | housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
164 | housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
165 | housekeeping_packet.reserved = DEFAULT_RESERVED; |
|
165 | housekeeping_packet.reserved = DEFAULT_RESERVED; | |
166 | housekeeping_packet.userApplication = CCSDS_USER_APP; |
|
166 | housekeeping_packet.userApplication = CCSDS_USER_APP; | |
167 | housekeeping_packet.packetID[0] = (unsigned char) (APID_TM_HK >> 8); |
|
167 | housekeeping_packet.packetID[0] = (unsigned char) (APID_TM_HK >> 8); | |
168 | housekeeping_packet.packetID[1] = (unsigned char) (APID_TM_HK); |
|
168 | housekeeping_packet.packetID[1] = (unsigned char) (APID_TM_HK); | |
169 | housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
169 | housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
170 | housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
170 | housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
171 | housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8); |
|
171 | housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8); | |
172 | housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK ); |
|
172 | housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK ); | |
173 | housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
173 | housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
174 | housekeeping_packet.serviceType = TM_TYPE_HK; |
|
174 | housekeeping_packet.serviceType = TM_TYPE_HK; | |
175 | housekeeping_packet.serviceSubType = TM_SUBTYPE_HK; |
|
175 | housekeeping_packet.serviceSubType = TM_SUBTYPE_HK; | |
176 | housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND; |
|
176 | housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND; | |
177 | housekeeping_packet.sid = SID_HK; |
|
177 | housekeeping_packet.sid = SID_HK; | |
178 |
|
178 | |||
179 | status = rtems_rate_monotonic_cancel(HK_id); |
|
179 | status = rtems_rate_monotonic_cancel(HK_id); | |
180 | if( status != RTEMS_SUCCESSFUL ) { |
|
180 | if( status != RTEMS_SUCCESSFUL ) { | |
181 | PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status ) |
|
181 | PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status ) | |
182 | } |
|
182 | } | |
183 | else { |
|
183 | else { | |
184 | DEBUG_PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n") |
|
184 | DEBUG_PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n") | |
185 | } |
|
185 | } | |
186 |
|
186 | |||
187 | // startup phase |
|
187 | // startup phase | |
188 | status = rtems_rate_monotonic_period( HK_id, SY_LFR_TIME_SYN_TIMEOUT_in_ticks ); |
|
188 | status = rtems_rate_monotonic_period( HK_id, SY_LFR_TIME_SYN_TIMEOUT_in_ticks ); | |
189 | status = rtems_rate_monotonic_get_status( HK_id, &period_status ); |
|
189 | status = rtems_rate_monotonic_get_status( HK_id, &period_status ); | |
190 | DEBUG_PRINTF1("startup HK, HK_id status = %d\n", period_status.state) |
|
190 | DEBUG_PRINTF1("startup HK, HK_id status = %d\n", period_status.state) | |
191 | while(period_status.state != RATE_MONOTONIC_EXPIRED ) // after SY_LFR_TIME_SYN_TIMEOUT ms, starts HK anyway |
|
191 | while(period_status.state != RATE_MONOTONIC_EXPIRED ) // after SY_LFR_TIME_SYN_TIMEOUT ms, starts HK anyway | |
192 | { |
|
192 | { | |
193 | if ((time_management_regs->coarse_time & 0x80000000) == 0x00000000) // check time synchronization |
|
193 | if ((time_management_regs->coarse_time & 0x80000000) == 0x00000000) // check time synchronization | |
194 | { |
|
194 | { | |
195 | break; // break if LFR is synchronized |
|
195 | break; // break if LFR is synchronized | |
196 | } |
|
196 | } | |
197 | else |
|
197 | else | |
198 | { |
|
198 | { | |
199 | status = rtems_rate_monotonic_get_status( HK_id, &period_status ); |
|
199 | status = rtems_rate_monotonic_get_status( HK_id, &period_status ); | |
200 | // sched_yield(); |
|
200 | // sched_yield(); | |
201 | status = rtems_task_wake_after( 10 ); // wait SY_LFR_DPU_CONNECT_TIMEOUT 100 ms = 10 * 10 ms |
|
201 | status = rtems_task_wake_after( 10 ); // wait SY_LFR_DPU_CONNECT_TIMEOUT 100 ms = 10 * 10 ms | |
202 | } |
|
202 | } | |
203 | } |
|
203 | } | |
204 | status = rtems_rate_monotonic_cancel(HK_id); |
|
204 | status = rtems_rate_monotonic_cancel(HK_id); | |
205 | DEBUG_PRINTF1("startup HK, HK_id status = %d\n", period_status.state) |
|
205 | DEBUG_PRINTF1("startup HK, HK_id status = %d\n", period_status.state) | |
206 |
|
206 | |||
207 | while(1){ // launch the rate monotonic task |
|
207 | while(1){ // launch the rate monotonic task | |
208 | status = rtems_rate_monotonic_period( HK_id, HK_PERIOD ); |
|
208 | status = rtems_rate_monotonic_period( HK_id, HK_PERIOD ); | |
209 | if ( status != RTEMS_SUCCESSFUL ) { |
|
209 | if ( status != RTEMS_SUCCESSFUL ) { | |
210 | PRINTF1( "in HOUS *** ERR period: %d\n", status); |
|
210 | PRINTF1( "in HOUS *** ERR period: %d\n", status); | |
211 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_6 ); |
|
211 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_6 ); | |
212 | } |
|
212 | } | |
213 | else { |
|
213 | else { | |
214 | housekeeping_packet.packetSequenceControl[0] = (unsigned char) (sequenceCounterHK >> 8); |
|
214 | housekeeping_packet.packetSequenceControl[0] = (unsigned char) (sequenceCounterHK >> 8); | |
215 | housekeeping_packet.packetSequenceControl[1] = (unsigned char) (sequenceCounterHK ); |
|
215 | housekeeping_packet.packetSequenceControl[1] = (unsigned char) (sequenceCounterHK ); | |
216 | increment_seq_counter( &sequenceCounterHK ); |
|
216 | increment_seq_counter( &sequenceCounterHK ); | |
217 |
|
217 | |||
218 | housekeeping_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
218 | housekeeping_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
219 | housekeeping_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
219 | housekeeping_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
220 | housekeeping_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
220 | housekeeping_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
221 | housekeeping_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
221 | housekeeping_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); | |
222 | housekeeping_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
222 | housekeeping_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
223 | housekeeping_packet.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
223 | housekeeping_packet.time[5] = (unsigned char) (time_management_regs->fine_time); | |
224 |
|
224 | |||
225 | spacewire_update_statistics(); |
|
225 | spacewire_update_statistics(); | |
226 |
|
226 | |||
227 | get_v_e1_e2_f3( housekeeping_packet.hk_lfr_sc_v_f3 ); |
|
227 | get_v_e1_e2_f3( housekeeping_packet.hk_lfr_sc_v_f3 ); | |
228 | get_cpu_load( (unsigned char *) &housekeeping_packet.hk_lfr_cpu_load ); |
|
228 | get_cpu_load( (unsigned char *) &housekeeping_packet.hk_lfr_cpu_load ); | |
229 |
|
229 | |||
230 | // SEND PACKET |
|
230 | // SEND PACKET | |
231 | status = rtems_message_queue_urgent( queue_id, &housekeeping_packet, |
|
231 | status = rtems_message_queue_urgent( queue_id, &housekeeping_packet, | |
232 | PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES); |
|
232 | PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES); | |
233 | if (status != RTEMS_SUCCESSFUL) { |
|
233 | if (status != RTEMS_SUCCESSFUL) { | |
234 | PRINTF1("in HOUS *** ERR send: %d\n", status) |
|
234 | PRINTF1("in HOUS *** ERR send: %d\n", status) | |
235 | } |
|
235 | } | |
236 | } |
|
236 | } | |
237 | } |
|
237 | } | |
238 |
|
238 | |||
239 | PRINTF("in HOUS *** deleting task\n") |
|
239 | PRINTF("in HOUS *** deleting task\n") | |
240 |
|
240 | |||
241 | status = rtems_task_delete( RTEMS_SELF ); // should not return |
|
241 | status = rtems_task_delete( RTEMS_SELF ); // should not return | |
242 | printf( "rtems_task_delete returned with status of %d.\n", status ); |
|
242 | printf( "rtems_task_delete returned with status of %d.\n", status ); | |
243 | return; |
|
243 | return; | |
244 | } |
|
244 | } | |
245 |
|
245 | |||
246 | rtems_task dumb_task( rtems_task_argument unused ) |
|
246 | rtems_task dumb_task( rtems_task_argument unused ) | |
247 | { |
|
247 | { | |
248 | /** This RTEMS taks is used to print messages without affecting the general behaviour of the software. |
|
248 | /** This RTEMS taks is used to print messages without affecting the general behaviour of the software. | |
249 | * |
|
249 | * | |
250 | * @param unused is the starting argument of the RTEMS task |
|
250 | * @param unused is the starting argument of the RTEMS task | |
251 | * |
|
251 | * | |
252 | * The DUMB taks waits for RTEMS events and print messages depending on the incoming events. |
|
252 | * The DUMB taks waits for RTEMS events and print messages depending on the incoming events. | |
253 | * |
|
253 | * | |
254 | */ |
|
254 | */ | |
255 |
|
255 | |||
256 | unsigned int i; |
|
256 | unsigned int i; | |
257 | unsigned int intEventOut; |
|
257 | unsigned int intEventOut; | |
258 | unsigned int coarse_time = 0; |
|
258 | unsigned int coarse_time = 0; | |
259 | unsigned int fine_time = 0; |
|
259 | unsigned int fine_time = 0; | |
260 | rtems_event_set event_out; |
|
260 | rtems_event_set event_out; | |
261 |
|
261 | |||
262 | char *DumbMessages[12] = {"in DUMB *** default", // RTEMS_EVENT_0 |
|
262 | char *DumbMessages[12] = {"in DUMB *** default", // RTEMS_EVENT_0 | |
263 | "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1 |
|
263 | "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1 | |
264 | "in DUMB *** f3 buffer changed", // RTEMS_EVENT_2 |
|
264 | "in DUMB *** f3 buffer changed", // RTEMS_EVENT_2 | |
265 | "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3 |
|
265 | "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3 | |
266 | "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4 |
|
266 | "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4 | |
267 | "in DUMB *** waveforms_simulator_isr", // RTEMS_EVENT_5 |
|
267 | "in DUMB *** waveforms_simulator_isr", // RTEMS_EVENT_5 | |
268 | "ERR HK", // RTEMS_EVENT_6 |
|
268 | "ERR HK", // RTEMS_EVENT_6 | |
269 | "ready for dump", // RTEMS_EVENT_7 |
|
269 | "ready for dump", // RTEMS_EVENT_7 | |
270 | "VHDL ERR *** spectral matrix", // RTEMS_EVENT_8 |
|
270 | "VHDL ERR *** spectral matrix", // RTEMS_EVENT_8 | |
271 | "tick", // RTEMS_EVENT_9 |
|
271 | "tick", // RTEMS_EVENT_9 | |
272 | "VHDL ERR *** waveform picker", // RTEMS_EVENT_10 |
|
272 | "VHDL ERR *** waveform picker", // RTEMS_EVENT_10 | |
273 | "VHDL ERR *** unexpected ready matrix values" // RTEMS_EVENT_11 |
|
273 | "VHDL ERR *** unexpected ready matrix values" // RTEMS_EVENT_11 | |
274 | }; |
|
274 | }; | |
275 |
|
275 | |||
276 | BOOT_PRINTF("in DUMB *** \n") |
|
276 | BOOT_PRINTF("in DUMB *** \n") | |
277 |
|
277 | |||
278 | while(1){ |
|
278 | while(1){ | |
279 | rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3 |
|
279 | rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3 | |
280 | | RTEMS_EVENT_4 | RTEMS_EVENT_5 | RTEMS_EVENT_6 | RTEMS_EVENT_7 |
|
280 | | RTEMS_EVENT_4 | RTEMS_EVENT_5 | RTEMS_EVENT_6 | RTEMS_EVENT_7 | |
281 | | RTEMS_EVENT_8 | RTEMS_EVENT_9, |
|
281 | | RTEMS_EVENT_8 | RTEMS_EVENT_9, | |
282 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT |
|
282 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT | |
283 | intEventOut = (unsigned int) event_out; |
|
283 | intEventOut = (unsigned int) event_out; | |
284 | for ( i=0; i<32; i++) |
|
284 | for ( i=0; i<32; i++) | |
285 | { |
|
285 | { | |
286 | if ( ((intEventOut >> i) & 0x0001) != 0) |
|
286 | if ( ((intEventOut >> i) & 0x0001) != 0) | |
287 | { |
|
287 | { | |
288 | coarse_time = time_management_regs->coarse_time; |
|
288 | coarse_time = time_management_regs->coarse_time; | |
289 | fine_time = time_management_regs->fine_time; |
|
289 | fine_time = time_management_regs->fine_time; | |
290 | printf("in DUMB *** coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]); |
|
290 | printf("in DUMB *** coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]); | |
291 | if (i==8) |
|
291 | if (i==8) | |
292 | { |
|
292 | { | |
293 | PRINTF1("spectral_matrix_regs->status = %x\n", spectral_matrix_regs->status) |
|
293 | PRINTF1("spectral_matrix_regs->status = %x\n", spectral_matrix_regs->status) | |
294 | } |
|
294 | } | |
295 | if (i==10) |
|
295 | if (i==10) | |
296 | { |
|
296 | { | |
297 | PRINTF1("waveform_picker_regs->status = %x\n", waveform_picker_regs->status) |
|
297 | PRINTF1("waveform_picker_regs->status = %x\n", waveform_picker_regs->status) | |
298 | } |
|
298 | } | |
299 | } |
|
299 | } | |
300 | } |
|
300 | } | |
301 | } |
|
301 | } | |
302 | } |
|
302 | } | |
303 |
|
303 | |||
304 | //***************************** |
|
304 | //***************************** | |
305 | // init housekeeping parameters |
|
305 | // init housekeeping parameters | |
306 |
|
306 | |||
307 | void init_housekeeping_parameters( void ) |
|
307 | void init_housekeeping_parameters( void ) | |
308 | { |
|
308 | { | |
309 | /** This function initialize the housekeeping_packet global variable with default values. |
|
309 | /** This function initialize the housekeeping_packet global variable with default values. | |
310 | * |
|
310 | * | |
311 | */ |
|
311 | */ | |
312 |
|
312 | |||
313 | unsigned int i = 0; |
|
313 | unsigned int i = 0; | |
314 | unsigned char *parameters; |
|
314 | unsigned char *parameters; | |
315 |
|
315 | |||
316 | parameters = (unsigned char*) &housekeeping_packet.lfr_status_word; |
|
316 | parameters = (unsigned char*) &housekeeping_packet.lfr_status_word; | |
317 | for(i = 0; i< SIZE_HK_PARAMETERS; i++) |
|
317 | for(i = 0; i< SIZE_HK_PARAMETERS; i++) | |
318 | { |
|
318 | { | |
319 | parameters[i] = 0x00; |
|
319 | parameters[i] = 0x00; | |
320 | } |
|
320 | } | |
321 | // init status word |
|
321 | // init status word | |
322 | housekeeping_packet.lfr_status_word[0] = DEFAULT_STATUS_WORD_BYTE0; |
|
322 | housekeeping_packet.lfr_status_word[0] = DEFAULT_STATUS_WORD_BYTE0; | |
323 | housekeeping_packet.lfr_status_word[1] = DEFAULT_STATUS_WORD_BYTE1; |
|
323 | housekeeping_packet.lfr_status_word[1] = DEFAULT_STATUS_WORD_BYTE1; | |
324 | // init software version |
|
324 | // init software version | |
325 | housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1; |
|
325 | housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1; | |
326 | housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2; |
|
326 | housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2; | |
327 | housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3; |
|
327 | housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3; | |
328 | housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4; |
|
328 | housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4; | |
329 | // init fpga version |
|
329 | // init fpga version | |
330 | parameters = (unsigned char *) (REGS_ADDR_VHDL_VERSION); |
|
330 | parameters = (unsigned char *) (REGS_ADDR_VHDL_VERSION); | |
331 | housekeeping_packet.lfr_fpga_version[0] = parameters[1]; // n1 |
|
331 | housekeeping_packet.lfr_fpga_version[0] = parameters[1]; // n1 | |
332 | housekeeping_packet.lfr_fpga_version[1] = parameters[2]; // n2 |
|
332 | housekeeping_packet.lfr_fpga_version[1] = parameters[2]; // n2 | |
333 | housekeeping_packet.lfr_fpga_version[2] = parameters[3]; // n3 |
|
333 | housekeeping_packet.lfr_fpga_version[2] = parameters[3]; // n3 | |
334 | } |
|
334 | } | |
335 |
|
335 | |||
336 | void increment_seq_counter( unsigned short *packetSequenceControl ) |
|
336 | void increment_seq_counter( unsigned short *packetSequenceControl ) | |
337 | { |
|
337 | { | |
338 | /** This function increment the sequence counter psased in argument. |
|
338 | /** This function increment the sequence counter psased in argument. | |
339 | * |
|
339 | * | |
340 | * The increment does not affect the grouping flag. In case of an overflow, the counter is reset to 0. |
|
340 | * The increment does not affect the grouping flag. In case of an overflow, the counter is reset to 0. | |
341 | * |
|
341 | * | |
342 | */ |
|
342 | */ | |
343 |
|
343 | |||
344 | unsigned short segmentation_grouping_flag; |
|
344 | unsigned short segmentation_grouping_flag; | |
345 | unsigned short sequence_cnt; |
|
345 | unsigned short sequence_cnt; | |
346 |
|
346 | |||
347 | segmentation_grouping_flag = TM_PACKET_SEQ_CTRL_STANDALONE << 8; // keep bits 7 downto 6 |
|
347 | segmentation_grouping_flag = TM_PACKET_SEQ_CTRL_STANDALONE << 8; // keep bits 7 downto 6 | |
348 | sequence_cnt = (*packetSequenceControl) & 0x3fff; // [0011 1111 1111 1111] |
|
348 | sequence_cnt = (*packetSequenceControl) & 0x3fff; // [0011 1111 1111 1111] | |
349 |
|
349 | |||
350 | if ( sequence_cnt < SEQ_CNT_MAX) |
|
350 | if ( sequence_cnt < SEQ_CNT_MAX) | |
351 | { |
|
351 | { | |
352 | sequence_cnt = sequence_cnt + 1; |
|
352 | sequence_cnt = sequence_cnt + 1; | |
353 | } |
|
353 | } | |
354 | else |
|
354 | else | |
355 | { |
|
355 | { | |
356 | sequence_cnt = 0; |
|
356 | sequence_cnt = 0; | |
357 | } |
|
357 | } | |
358 |
|
358 | |||
359 | *packetSequenceControl = segmentation_grouping_flag | sequence_cnt ; |
|
359 | *packetSequenceControl = segmentation_grouping_flag | sequence_cnt ; | |
360 | } |
|
360 | } | |
361 |
|
361 | |||
362 | void getTime( unsigned char *time) |
|
362 | void getTime( unsigned char *time) | |
363 | { |
|
363 | { | |
364 | /** This function write the current local time in the time buffer passed in argument. |
|
364 | /** This function write the current local time in the time buffer passed in argument. | |
365 | * |
|
365 | * | |
366 | */ |
|
366 | */ | |
367 |
|
367 | |||
368 | time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
368 | time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
369 | time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
369 | time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
370 | time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
370 | time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
371 | time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
371 | time[3] = (unsigned char) (time_management_regs->coarse_time); | |
372 | time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
372 | time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
373 | time[5] = (unsigned char) (time_management_regs->fine_time); |
|
373 | time[5] = (unsigned char) (time_management_regs->fine_time); | |
374 | } |
|
374 | } | |
375 |
|
375 | |||
376 | unsigned long long int getTimeAsUnsignedLongLongInt( ) |
|
376 | unsigned long long int getTimeAsUnsignedLongLongInt( ) | |
377 | { |
|
377 | { | |
378 | /** This function write the current local time in the time buffer passed in argument. |
|
378 | /** This function write the current local time in the time buffer passed in argument. | |
379 | * |
|
379 | * | |
380 | */ |
|
380 | */ | |
381 | unsigned long long int time; |
|
381 | unsigned long long int time; | |
382 |
|
382 | |||
383 | time = ( (unsigned long long int) (time_management_regs->coarse_time & 0x7fffffff) << 16 ) |
|
383 | time = ( (unsigned long long int) (time_management_regs->coarse_time & 0x7fffffff) << 16 ) | |
384 | + time_management_regs->fine_time; |
|
384 | + time_management_regs->fine_time; | |
385 |
|
385 | |||
386 | return time; |
|
386 | return time; | |
387 | } |
|
387 | } | |
388 |
|
388 | |||
389 | void send_dumb_hk( void ) |
|
389 | void send_dumb_hk( void ) | |
390 | { |
|
390 | { | |
391 | Packet_TM_LFR_HK_t dummy_hk_packet; |
|
391 | Packet_TM_LFR_HK_t dummy_hk_packet; | |
392 | unsigned char *parameters; |
|
392 | unsigned char *parameters; | |
393 | unsigned int i; |
|
393 | unsigned int i; | |
394 | rtems_id queue_id; |
|
394 | rtems_id queue_id; | |
395 |
|
395 | |||
396 | dummy_hk_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
396 | dummy_hk_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; | |
397 | dummy_hk_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
397 | dummy_hk_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
398 | dummy_hk_packet.reserved = DEFAULT_RESERVED; |
|
398 | dummy_hk_packet.reserved = DEFAULT_RESERVED; | |
399 | dummy_hk_packet.userApplication = CCSDS_USER_APP; |
|
399 | dummy_hk_packet.userApplication = CCSDS_USER_APP; | |
400 | dummy_hk_packet.packetID[0] = (unsigned char) (APID_TM_HK >> 8); |
|
400 | dummy_hk_packet.packetID[0] = (unsigned char) (APID_TM_HK >> 8); | |
401 | dummy_hk_packet.packetID[1] = (unsigned char) (APID_TM_HK); |
|
401 | dummy_hk_packet.packetID[1] = (unsigned char) (APID_TM_HK); | |
402 | dummy_hk_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
402 | dummy_hk_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
403 | dummy_hk_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
403 | dummy_hk_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
404 | dummy_hk_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8); |
|
404 | dummy_hk_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8); | |
405 | dummy_hk_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK ); |
|
405 | dummy_hk_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK ); | |
406 | dummy_hk_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
406 | dummy_hk_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
407 | dummy_hk_packet.serviceType = TM_TYPE_HK; |
|
407 | dummy_hk_packet.serviceType = TM_TYPE_HK; | |
408 | dummy_hk_packet.serviceSubType = TM_SUBTYPE_HK; |
|
408 | dummy_hk_packet.serviceSubType = TM_SUBTYPE_HK; | |
409 | dummy_hk_packet.destinationID = TM_DESTINATION_ID_GROUND; |
|
409 | dummy_hk_packet.destinationID = TM_DESTINATION_ID_GROUND; | |
410 | dummy_hk_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
410 | dummy_hk_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
411 | dummy_hk_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
411 | dummy_hk_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
412 | dummy_hk_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
412 | dummy_hk_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
413 | dummy_hk_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
413 | dummy_hk_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); | |
414 | dummy_hk_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
414 | dummy_hk_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
415 | dummy_hk_packet.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
415 | dummy_hk_packet.time[5] = (unsigned char) (time_management_regs->fine_time); | |
416 | dummy_hk_packet.sid = SID_HK; |
|
416 | dummy_hk_packet.sid = SID_HK; | |
417 |
|
417 | |||
418 | // init status word |
|
418 | // init status word | |
419 | dummy_hk_packet.lfr_status_word[0] = 0xff; |
|
419 | dummy_hk_packet.lfr_status_word[0] = 0xff; | |
420 | dummy_hk_packet.lfr_status_word[1] = 0xff; |
|
420 | dummy_hk_packet.lfr_status_word[1] = 0xff; | |
421 | // init software version |
|
421 | // init software version | |
422 | dummy_hk_packet.lfr_sw_version[0] = SW_VERSION_N1; |
|
422 | dummy_hk_packet.lfr_sw_version[0] = SW_VERSION_N1; | |
423 | dummy_hk_packet.lfr_sw_version[1] = SW_VERSION_N2; |
|
423 | dummy_hk_packet.lfr_sw_version[1] = SW_VERSION_N2; | |
424 | dummy_hk_packet.lfr_sw_version[2] = SW_VERSION_N3; |
|
424 | dummy_hk_packet.lfr_sw_version[2] = SW_VERSION_N3; | |
425 | dummy_hk_packet.lfr_sw_version[3] = SW_VERSION_N4; |
|
425 | dummy_hk_packet.lfr_sw_version[3] = SW_VERSION_N4; | |
426 | // init fpga version |
|
426 | // init fpga version | |
427 | parameters = (unsigned char *) (REGS_ADDR_WAVEFORM_PICKER + 0xb0); |
|
427 | parameters = (unsigned char *) (REGS_ADDR_WAVEFORM_PICKER + 0xb0); | |
428 | dummy_hk_packet.lfr_fpga_version[0] = parameters[1]; // n1 |
|
428 | dummy_hk_packet.lfr_fpga_version[0] = parameters[1]; // n1 | |
429 | dummy_hk_packet.lfr_fpga_version[1] = parameters[2]; // n2 |
|
429 | dummy_hk_packet.lfr_fpga_version[1] = parameters[2]; // n2 | |
430 | dummy_hk_packet.lfr_fpga_version[2] = parameters[3]; // n3 |
|
430 | dummy_hk_packet.lfr_fpga_version[2] = parameters[3]; // n3 | |
431 |
|
431 | |||
432 | parameters = (unsigned char *) &dummy_hk_packet.hk_lfr_cpu_load; |
|
432 | parameters = (unsigned char *) &dummy_hk_packet.hk_lfr_cpu_load; | |
433 |
|
433 | |||
434 | for (i=0; i<100; i++) |
|
434 | for (i=0; i<100; i++) | |
435 | { |
|
435 | { | |
436 | parameters[i] = 0xff; |
|
436 | parameters[i] = 0xff; | |
437 | } |
|
437 | } | |
438 |
|
438 | |||
439 | get_message_queue_id_send( &queue_id ); |
|
439 | get_message_queue_id_send( &queue_id ); | |
440 |
|
440 | |||
441 | rtems_message_queue_urgent( queue_id, &dummy_hk_packet, |
|
441 | rtems_message_queue_urgent( queue_id, &dummy_hk_packet, | |
442 | PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES); |
|
442 | PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES); | |
443 | } |
|
443 | } | |
444 |
|
444 | |||
445 | void get_v_e1_e2_f3_old( unsigned char *spacecraft_potential ) |
|
|||
446 | { |
|
|||
447 | unsigned int coarseTime; |
|
|||
448 | unsigned int acquisitionTime; |
|
|||
449 | unsigned int deltaT = 0; |
|
|||
450 | unsigned char *bufferPtr; |
|
|||
451 |
|
||||
452 | unsigned int offset_in_samples; |
|
|||
453 | unsigned int offset_in_bytes; |
|
|||
454 | unsigned char f3 = 16; // v, e1 and e2 will be picked up each second, f3 = 16 Hz |
|
|||
455 |
|
||||
456 | if (lfrCurrentMode == LFR_MODE_STANDBY) |
|
|||
457 | { |
|
|||
458 | spacecraft_potential[0] = 0x00; |
|
|||
459 | spacecraft_potential[1] = 0x00; |
|
|||
460 | spacecraft_potential[2] = 0x00; |
|
|||
461 | spacecraft_potential[3] = 0x00; |
|
|||
462 | spacecraft_potential[4] = 0x00; |
|
|||
463 | spacecraft_potential[5] = 0x00; |
|
|||
464 | } |
|
|||
465 | else |
|
|||
466 | { |
|
|||
467 | coarseTime = time_management_regs->coarse_time & 0x7fffffff; |
|
|||
468 | bufferPtr = (unsigned char*) current_ring_node_f3->buffer_address; |
|
|||
469 | acquisitionTime = (unsigned int) ( ( bufferPtr[2] & 0x7f ) << 24 ) |
|
|||
470 | + (unsigned int) ( bufferPtr[3] << 16 ) |
|
|||
471 | + (unsigned int) ( bufferPtr[0] << 8 ) |
|
|||
472 | + (unsigned int) ( bufferPtr[1] ); |
|
|||
473 | if ( coarseTime > acquisitionTime ) |
|
|||
474 | { |
|
|||
475 | deltaT = coarseTime - acquisitionTime; |
|
|||
476 | offset_in_samples = (deltaT-1) * f3 ; |
|
|||
477 | } |
|
|||
478 | else if( coarseTime == acquisitionTime ) |
|
|||
479 | { |
|
|||
480 | bufferPtr = (unsigned char*) current_ring_node_f3->previous->buffer_address; // pick up v e1 and e2 in the previous f3 buffer |
|
|||
481 | offset_in_samples = NB_SAMPLES_PER_SNAPSHOT-1; |
|
|||
482 | } |
|
|||
483 | else |
|
|||
484 | { |
|
|||
485 | offset_in_samples = 0; |
|
|||
486 | PRINTF2("ERR *** in get_v_e1_e2_f3 *** coarseTime = %x, acquisitionTime = %x\n", coarseTime, acquisitionTime) |
|
|||
487 | } |
|
|||
488 |
|
||||
489 | if ( offset_in_samples > (NB_SAMPLES_PER_SNAPSHOT - 1) ) |
|
|||
490 | { |
|
|||
491 | PRINTF1("ERR *** in get_v_e1_e2_f3 *** trying to read out of the buffer, counter = %d\n", offset_in_samples) |
|
|||
492 | offset_in_samples = NB_SAMPLES_PER_SNAPSHOT -1; |
|
|||
493 | } |
|
|||
494 | offset_in_bytes = TIME_OFFSET_IN_BYTES + offset_in_samples * NB_WORDS_SWF_BLK * 4; |
|
|||
495 | spacecraft_potential[0] = bufferPtr[ offset_in_bytes + 0]; |
|
|||
496 | spacecraft_potential[1] = bufferPtr[ offset_in_bytes + 1]; |
|
|||
497 | spacecraft_potential[2] = bufferPtr[ offset_in_bytes + 2]; |
|
|||
498 | spacecraft_potential[3] = bufferPtr[ offset_in_bytes + 3]; |
|
|||
499 | spacecraft_potential[4] = bufferPtr[ offset_in_bytes + 4]; |
|
|||
500 | spacecraft_potential[5] = bufferPtr[ offset_in_bytes + 5]; |
|
|||
501 | } |
|
|||
502 | } |
|
|||
503 |
|
||||
504 | void get_v_e1_e2_f3( unsigned char *spacecraft_potential ) |
|
445 | void get_v_e1_e2_f3( unsigned char *spacecraft_potential ) | |
505 | { |
|
446 | { | |
506 | unsigned int coarseTime; |
|
447 | unsigned int coarseTime; | |
507 | unsigned int acquisitionTime; |
|
448 | unsigned int acquisitionTime; | |
508 | unsigned int deltaT = 0; |
|
449 | unsigned int deltaT = 0; | |
509 | unsigned char *bufferPtr; |
|
450 | unsigned char *bufferPtr; | |
510 |
|
451 | |||
511 | unsigned int offset_in_samples; |
|
452 | unsigned int offset_in_samples; | |
512 | unsigned int offset_in_bytes; |
|
453 | unsigned int offset_in_bytes; | |
513 | unsigned char f3 = 16; // v, e1 and e2 will be picked up each second, f3 = 16 Hz |
|
454 | unsigned char f3 = 16; // v, e1 and e2 will be picked up each second, f3 = 16 Hz | |
514 |
|
455 | |||
515 | if (lfrCurrentMode == LFR_MODE_STANDBY) |
|
456 | if (lfrCurrentMode == LFR_MODE_STANDBY) | |
516 | { |
|
457 | { | |
517 | spacecraft_potential[0] = 0x00; |
|
458 | spacecraft_potential[0] = 0x00; | |
518 | spacecraft_potential[1] = 0x00; |
|
459 | spacecraft_potential[1] = 0x00; | |
519 | spacecraft_potential[2] = 0x00; |
|
460 | spacecraft_potential[2] = 0x00; | |
520 | spacecraft_potential[3] = 0x00; |
|
461 | spacecraft_potential[3] = 0x00; | |
521 | spacecraft_potential[4] = 0x00; |
|
462 | spacecraft_potential[4] = 0x00; | |
522 | spacecraft_potential[5] = 0x00; |
|
463 | spacecraft_potential[5] = 0x00; | |
523 | } |
|
464 | } | |
524 | else |
|
465 | else | |
525 | { |
|
466 | { | |
526 | coarseTime = time_management_regs->coarse_time & 0x7fffffff; |
|
467 | coarseTime = time_management_regs->coarse_time & 0x7fffffff; | |
527 | bufferPtr = (unsigned char*) current_ring_node_f3->buffer_address; |
|
468 | bufferPtr = (unsigned char*) current_ring_node_f3->buffer_address; | |
528 | acquisitionTime = (unsigned int) ( ( bufferPtr[0] & 0x7f ) << 24 ) |
|
469 | acquisitionTime = (unsigned int) ( ( bufferPtr[0] & 0x7f ) << 24 ) | |
529 | + (unsigned int) ( bufferPtr[1] << 16 ) |
|
470 | + (unsigned int) ( bufferPtr[1] << 16 ) | |
530 | + (unsigned int) ( bufferPtr[2] << 8 ) |
|
471 | + (unsigned int) ( bufferPtr[2] << 8 ) | |
531 | + (unsigned int) ( bufferPtr[3] ); |
|
472 | + (unsigned int) ( bufferPtr[3] ); | |
532 | if ( coarseTime > acquisitionTime ) |
|
473 | if ( coarseTime > acquisitionTime ) | |
533 | { |
|
474 | { | |
534 | deltaT = coarseTime - acquisitionTime; |
|
475 | deltaT = coarseTime - acquisitionTime; | |
535 | offset_in_samples = (deltaT-1) * f3 ; |
|
476 | offset_in_samples = (deltaT-1) * f3 ; | |
536 | } |
|
477 | } | |
537 | else if( coarseTime == acquisitionTime ) |
|
478 | else if( coarseTime == acquisitionTime ) | |
538 | { |
|
479 | { | |
539 | bufferPtr = (unsigned char*) current_ring_node_f3->previous->buffer_address; // pick up v e1 and e2 in the previous f3 buffer |
|
480 | bufferPtr = (unsigned char*) current_ring_node_f3->previous->buffer_address; // pick up v e1 and e2 in the previous f3 buffer | |
540 | offset_in_samples = NB_SAMPLES_PER_SNAPSHOT-1; |
|
481 | offset_in_samples = NB_SAMPLES_PER_SNAPSHOT-1; | |
541 | } |
|
482 | } | |
542 | else |
|
483 | else | |
543 | { |
|
484 | { | |
544 | offset_in_samples = 0; |
|
485 | offset_in_samples = 0; | |
545 | PRINTF2("ERR *** in get_v_e1_e2_f3 *** coarseTime = %x, acquisitionTime = %x\n", coarseTime, acquisitionTime) |
|
486 | PRINTF2("ERR *** in get_v_e1_e2_f3 *** coarseTime = %x, acquisitionTime = %x\n", coarseTime, acquisitionTime) | |
546 | } |
|
487 | } | |
547 |
|
488 | |||
548 | if ( offset_in_samples > (NB_SAMPLES_PER_SNAPSHOT - 1) ) |
|
489 | if ( offset_in_samples > (NB_SAMPLES_PER_SNAPSHOT - 1) ) | |
549 | { |
|
490 | { | |
550 | PRINTF1("ERR *** in get_v_e1_e2_f3 *** trying to read out of the buffer, counter = %d\n", offset_in_samples) |
|
491 | PRINTF1("ERR *** in get_v_e1_e2_f3 *** trying to read out of the buffer, counter = %d\n", offset_in_samples) | |
551 | offset_in_samples = NB_SAMPLES_PER_SNAPSHOT -1; |
|
492 | offset_in_samples = NB_SAMPLES_PER_SNAPSHOT -1; | |
552 | } |
|
493 | } | |
553 | offset_in_bytes = TIME_OFFSET_IN_BYTES + offset_in_samples * NB_WORDS_SWF_BLK * 4; |
|
494 | offset_in_bytes = TIME_OFFSET_IN_BYTES + offset_in_samples * NB_WORDS_SWF_BLK * 4; | |
554 | spacecraft_potential[0] = bufferPtr[ offset_in_bytes + 0]; |
|
495 | spacecraft_potential[0] = bufferPtr[ offset_in_bytes + 0]; | |
555 | spacecraft_potential[1] = bufferPtr[ offset_in_bytes + 1]; |
|
496 | spacecraft_potential[1] = bufferPtr[ offset_in_bytes + 1]; | |
556 | spacecraft_potential[2] = bufferPtr[ offset_in_bytes + 2]; |
|
497 | spacecraft_potential[2] = bufferPtr[ offset_in_bytes + 2]; | |
557 | spacecraft_potential[3] = bufferPtr[ offset_in_bytes + 3]; |
|
498 | spacecraft_potential[3] = bufferPtr[ offset_in_bytes + 3]; | |
558 | spacecraft_potential[4] = bufferPtr[ offset_in_bytes + 4]; |
|
499 | spacecraft_potential[4] = bufferPtr[ offset_in_bytes + 4]; | |
559 | spacecraft_potential[5] = bufferPtr[ offset_in_bytes + 5]; |
|
500 | spacecraft_potential[5] = bufferPtr[ offset_in_bytes + 5]; | |
560 | } |
|
501 | } | |
561 | } |
|
502 | } | |
562 |
|
503 | |||
563 | void get_cpu_load( unsigned char *resource_statistics ) |
|
504 | void get_cpu_load( unsigned char *resource_statistics ) | |
564 | { |
|
505 | { | |
565 | unsigned char cpu_load; |
|
506 | unsigned char cpu_load; | |
566 |
|
507 | |||
567 | cpu_load = lfr_rtems_cpu_usage_report(); |
|
508 | cpu_load = lfr_rtems_cpu_usage_report(); | |
568 |
|
509 | |||
569 | // HK_LFR_CPU_LOAD |
|
510 | // HK_LFR_CPU_LOAD | |
570 | resource_statistics[0] = cpu_load; |
|
511 | resource_statistics[0] = cpu_load; | |
571 |
|
512 | |||
572 | // HK_LFR_CPU_LOAD_MAX |
|
513 | // HK_LFR_CPU_LOAD_MAX | |
573 | if (cpu_load > resource_statistics[1]) |
|
514 | if (cpu_load > resource_statistics[1]) | |
574 | { |
|
515 | { | |
575 | resource_statistics[1] = cpu_load; |
|
516 | resource_statistics[1] = cpu_load; | |
576 | } |
|
517 | } | |
577 |
|
518 | |||
578 | // CPU_LOAD_AVE |
|
519 | // CPU_LOAD_AVE | |
579 | resource_statistics[2] = 0; |
|
520 | resource_statistics[2] = 0; | |
580 |
|
521 | |||
581 | #ifndef PRINT_TASK_STATISTICS |
|
522 | #ifndef PRINT_TASK_STATISTICS | |
582 | rtems_cpu_usage_reset(); |
|
523 | rtems_cpu_usage_reset(); | |
583 | #endif |
|
524 | #endif | |
584 |
|
525 | |||
585 | } |
|
526 | } | |
586 |
|
527 | |||
587 |
|
528 | |||
588 |
|
529 |
@@ -1,689 +1,689 | |||||
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 |
|
99 | |||
100 | status = (spectral_matrix_regs->status & 0x0c) >> 2; // [1100] get the status_ready_matrix_f0_x bits |
|
100 | status = (spectral_matrix_regs->status & 0x0c) >> 2; // [1100] get the status_ready_matrix_f0_x bits | |
101 |
|
101 | |||
102 | switch(status) |
|
102 | switch(status) | |
103 | { |
|
103 | { | |
104 | case 0: |
|
104 | case 0: | |
105 | break; |
|
105 | break; | |
106 | case 3: |
|
106 | case 3: | |
107 | // UNEXPECTED VALUE |
|
107 | // UNEXPECTED VALUE | |
108 | spectral_matrix_regs->status = 0xc0; // [1100] |
|
108 | spectral_matrix_regs->status = 0xc0; // [1100] | |
109 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_11 ); |
|
109 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_11 ); | |
110 | break; |
|
110 | break; | |
111 | case 1: |
|
111 | case 1: | |
112 | time = get_acquisition_time( (unsigned char *) &spectral_matrix_regs->f1_0_coarse_time ); |
|
112 | time = get_acquisition_time( (unsigned char *) &spectral_matrix_regs->f1_0_coarse_time ); | |
113 | syncBit = ( (unsigned long long int) (spectral_matrix_regs->f1_0_coarse_time & 0x80000000) ) << 16; |
|
113 | syncBit = ( (unsigned long long int) (spectral_matrix_regs->f1_0_coarse_time & 0x80000000) ) << 16; | |
114 | close_matrix_actions( &nb_sm_f1, NB_SM_BEFORE_AVF1, Task_id[TASKID_AVF1], |
|
114 | close_matrix_actions( &nb_sm_f1, NB_SM_BEFORE_AVF1, Task_id[TASKID_AVF1], | |
115 | ring_node_for_averaging_sm_f1, current_ring_node_sm_f1, time | syncBit); |
|
115 | ring_node_for_averaging_sm_f1, current_ring_node_sm_f1, time | syncBit); | |
116 | current_ring_node_sm_f1 = current_ring_node_sm_f1->next; |
|
116 | current_ring_node_sm_f1 = current_ring_node_sm_f1->next; | |
117 | spectral_matrix_regs->f1_0_address = current_ring_node_sm_f1->buffer_address; |
|
117 | spectral_matrix_regs->f1_0_address = current_ring_node_sm_f1->buffer_address; | |
118 | spectral_matrix_regs->status = 0x04; // [0100] |
|
118 | spectral_matrix_regs->status = 0x04; // [0100] | |
119 | break; |
|
119 | break; | |
120 | case 2: |
|
120 | case 2: | |
121 | time = get_acquisition_time( (unsigned char *) &spectral_matrix_regs->f1_1_coarse_time ); |
|
121 | time = get_acquisition_time( (unsigned char *) &spectral_matrix_regs->f1_1_coarse_time ); | |
122 | syncBit = ( (unsigned long long int) (spectral_matrix_regs->f1_1_coarse_time & 0x80000000) ) << 16; |
|
122 | syncBit = ( (unsigned long long int) (spectral_matrix_regs->f1_1_coarse_time & 0x80000000) ) << 16; | |
123 | close_matrix_actions( &nb_sm_f1, NB_SM_BEFORE_AVF1, Task_id[TASKID_AVF1], |
|
123 | close_matrix_actions( &nb_sm_f1, NB_SM_BEFORE_AVF1, Task_id[TASKID_AVF1], | |
124 | ring_node_for_averaging_sm_f1, current_ring_node_sm_f1, time | syncBit); |
|
124 | ring_node_for_averaging_sm_f1, current_ring_node_sm_f1, time | syncBit); | |
125 | current_ring_node_sm_f1 = current_ring_node_sm_f1->next; |
|
125 | current_ring_node_sm_f1 = current_ring_node_sm_f1->next; | |
126 | spectral_matrix_regs->f1_1_address = current_ring_node_sm_f1->buffer_address; |
|
126 | spectral_matrix_regs->f1_1_address = current_ring_node_sm_f1->buffer_address; | |
127 | spectral_matrix_regs->status = 0x08; // [1000] |
|
127 | spectral_matrix_regs->status = 0x08; // [1000] | |
128 | break; |
|
128 | break; | |
129 | } |
|
129 | } | |
130 | } |
|
130 | } | |
131 |
|
131 | |||
132 | void spectral_matrices_isr_f2( void ) |
|
132 | void spectral_matrices_isr_f2( void ) | |
133 | { |
|
133 | { | |
134 | unsigned char status; |
|
134 | unsigned char status; | |
135 |
|
135 | |||
136 | status = (spectral_matrix_regs->status & 0x30) >> 4; // [0011 0000] get the status_ready_matrix_f0_x bits |
|
136 | status = (spectral_matrix_regs->status & 0x30) >> 4; // [0011 0000] get the status_ready_matrix_f0_x bits | |
137 |
|
137 | |||
138 | ring_node_for_averaging_sm_f2 = current_ring_node_sm_f2; |
|
138 | ring_node_for_averaging_sm_f2 = current_ring_node_sm_f2; | |
139 |
|
139 | |||
140 | current_ring_node_sm_f2 = current_ring_node_sm_f2->next; |
|
140 | current_ring_node_sm_f2 = current_ring_node_sm_f2->next; | |
141 |
|
141 | |||
142 | switch(status) |
|
142 | switch(status) | |
143 | { |
|
143 | { | |
144 | case 0: |
|
144 | case 0: | |
145 | break; |
|
145 | break; | |
146 | case 3: |
|
146 | case 3: | |
147 | // UNEXPECTED VALUE |
|
147 | // UNEXPECTED VALUE | |
148 | spectral_matrix_regs->status = 0x30; // [0011 0000] |
|
148 | spectral_matrix_regs->status = 0x30; // [0011 0000] | |
149 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_11 ); |
|
149 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_11 ); | |
150 | break; |
|
150 | break; | |
151 | case 1: |
|
151 | case 1: | |
152 | ring_node_for_averaging_sm_f2->coarseTime = spectral_matrix_regs->f2_0_coarse_time; |
|
152 | ring_node_for_averaging_sm_f2->coarseTime = spectral_matrix_regs->f2_0_coarse_time; | |
153 | ring_node_for_averaging_sm_f2->fineTime = spectral_matrix_regs->f2_0_fine_time; |
|
153 | ring_node_for_averaging_sm_f2->fineTime = spectral_matrix_regs->f2_0_fine_time; | |
154 | spectral_matrix_regs->f2_0_address = current_ring_node_sm_f2->buffer_address; |
|
154 | spectral_matrix_regs->f2_0_address = current_ring_node_sm_f2->buffer_address; | |
155 | spectral_matrix_regs->status = 0x10; // [0001 0000] |
|
155 | spectral_matrix_regs->status = 0x10; // [0001 0000] | |
156 | if (rtems_event_send( Task_id[TASKID_AVF2], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
156 | if (rtems_event_send( Task_id[TASKID_AVF2], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |
157 | { |
|
157 | { | |
158 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
158 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |
159 | } |
|
159 | } | |
160 | break; |
|
160 | break; | |
161 | case 2: |
|
161 | case 2: | |
162 | ring_node_for_averaging_sm_f2->coarseTime = spectral_matrix_regs->f2_1_coarse_time; |
|
162 | ring_node_for_averaging_sm_f2->coarseTime = spectral_matrix_regs->f2_1_coarse_time; | |
163 | ring_node_for_averaging_sm_f2->fineTime = spectral_matrix_regs->f2_1_fine_time; |
|
163 | ring_node_for_averaging_sm_f2->fineTime = spectral_matrix_regs->f2_1_fine_time; | |
164 | spectral_matrix_regs->f2_1_address = current_ring_node_sm_f2->buffer_address; |
|
164 | spectral_matrix_regs->f2_1_address = current_ring_node_sm_f2->buffer_address; | |
165 | spectral_matrix_regs->status = 0x20; // [0010 0000] |
|
165 | spectral_matrix_regs->status = 0x20; // [0010 0000] | |
166 | if (rtems_event_send( Task_id[TASKID_AVF2], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
166 | if (rtems_event_send( Task_id[TASKID_AVF2], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |
167 | { |
|
167 | { | |
168 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
168 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |
169 | } |
|
169 | } | |
170 | break; |
|
170 | break; | |
171 | } |
|
171 | } | |
172 | } |
|
172 | } | |
173 |
|
173 | |||
174 | void spectral_matrix_isr_error_handler( void ) |
|
174 | void spectral_matrix_isr_error_handler( void ) | |
175 | { |
|
175 | { | |
176 | if (spectral_matrix_regs->status & 0x7c0) // [0111 1100 0000] |
|
176 | if (spectral_matrix_regs->status & 0x7c0) // [0111 1100 0000] | |
177 | { |
|
177 | { | |
178 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); |
|
178 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); | |
179 | } |
|
179 | } | |
180 | } |
|
180 | } | |
181 |
|
181 | |||
182 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ) |
|
182 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ) | |
183 | { |
|
183 | { | |
184 | // STATUS REGISTER |
|
184 | // STATUS REGISTER | |
185 | // input_fifo_write(2) *** input_fifo_write(1) *** input_fifo_write(0) |
|
185 | // input_fifo_write(2) *** input_fifo_write(1) *** input_fifo_write(0) | |
186 | // 10 9 8 |
|
186 | // 10 9 8 | |
187 | // buffer_full ** bad_component_err ** f2_1 ** f2_0 ** f1_1 ** f1_0 ** f0_1 ** f0_0 |
|
187 | // buffer_full ** bad_component_err ** f2_1 ** f2_0 ** f1_1 ** f1_0 ** f0_1 ** f0_0 | |
188 | // 7 6 5 4 3 2 1 0 |
|
188 | // 7 6 5 4 3 2 1 0 | |
189 |
|
189 | |||
190 | spectral_matrices_isr_f0(); |
|
190 | spectral_matrices_isr_f0(); | |
191 |
|
191 | |||
192 | spectral_matrices_isr_f1(); |
|
192 | spectral_matrices_isr_f1(); | |
193 |
|
193 | |||
194 | spectral_matrices_isr_f2(); |
|
194 | spectral_matrices_isr_f2(); | |
195 |
|
195 | |||
196 | // spectral_matrix_isr_error_handler(); |
|
196 | // spectral_matrix_isr_error_handler(); | |
197 | } |
|
197 | } | |
198 |
|
198 | |||
199 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ) |
|
199 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ) | |
200 | { |
|
200 | { | |
201 | //*** |
|
201 | //*** | |
202 | // F0 |
|
202 | // F0 | |
203 | nb_sm_f0 = nb_sm_f0 + 1; |
|
203 | nb_sm_f0 = nb_sm_f0 + 1; | |
204 | if (nb_sm_f0 == NB_SM_BEFORE_AVF0 ) |
|
204 | if (nb_sm_f0 == NB_SM_BEFORE_AVF0 ) | |
205 | { |
|
205 | { | |
206 | ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0; |
|
206 | ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0; | |
207 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
207 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |
208 | { |
|
208 | { | |
209 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
209 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |
210 | } |
|
210 | } | |
211 | nb_sm_f0 = 0; |
|
211 | nb_sm_f0 = 0; | |
212 | } |
|
212 | } | |
213 |
|
213 | |||
214 | //*** |
|
214 | //*** | |
215 | // F1 |
|
215 | // F1 | |
216 | nb_sm_f0_aux_f1 = nb_sm_f0_aux_f1 + 1; |
|
216 | nb_sm_f0_aux_f1 = nb_sm_f0_aux_f1 + 1; | |
217 | if (nb_sm_f0_aux_f1 == 6) |
|
217 | if (nb_sm_f0_aux_f1 == 6) | |
218 | { |
|
218 | { | |
219 | nb_sm_f0_aux_f1 = 0; |
|
219 | nb_sm_f0_aux_f1 = 0; | |
220 | nb_sm_f1 = nb_sm_f1 + 1; |
|
220 | nb_sm_f1 = nb_sm_f1 + 1; | |
221 | } |
|
221 | } | |
222 | if (nb_sm_f1 == NB_SM_BEFORE_AVF1 ) |
|
222 | if (nb_sm_f1 == NB_SM_BEFORE_AVF1 ) | |
223 | { |
|
223 | { | |
224 | ring_node_for_averaging_sm_f1 = current_ring_node_sm_f1; |
|
224 | ring_node_for_averaging_sm_f1 = current_ring_node_sm_f1; | |
225 | if (rtems_event_send( Task_id[TASKID_AVF1], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
225 | if (rtems_event_send( Task_id[TASKID_AVF1], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |
226 | { |
|
226 | { | |
227 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
227 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |
228 | } |
|
228 | } | |
229 | nb_sm_f1 = 0; |
|
229 | nb_sm_f1 = 0; | |
230 | } |
|
230 | } | |
231 |
|
231 | |||
232 | //*** |
|
232 | //*** | |
233 | // F2 |
|
233 | // F2 | |
234 | nb_sm_f0_aux_f2 = nb_sm_f0_aux_f2 + 1; |
|
234 | nb_sm_f0_aux_f2 = nb_sm_f0_aux_f2 + 1; | |
235 | if (nb_sm_f0_aux_f2 == 96) |
|
235 | if (nb_sm_f0_aux_f2 == 96) | |
236 | { |
|
236 | { | |
237 | nb_sm_f0_aux_f2 = 0; |
|
237 | nb_sm_f0_aux_f2 = 0; | |
238 | ring_node_for_averaging_sm_f2 = current_ring_node_sm_f2; |
|
238 | ring_node_for_averaging_sm_f2 = current_ring_node_sm_f2; | |
239 | if (rtems_event_send( Task_id[TASKID_AVF2], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
239 | if (rtems_event_send( Task_id[TASKID_AVF2], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |
240 | { |
|
240 | { | |
241 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
241 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |
242 | } |
|
242 | } | |
243 | } |
|
243 | } | |
244 | } |
|
244 | } | |
245 |
|
245 | |||
246 | //****************** |
|
246 | //****************** | |
247 | // Spectral Matrices |
|
247 | // Spectral Matrices | |
248 |
|
248 | |||
249 | void reset_nb_sm( void ) |
|
249 | void reset_nb_sm( void ) | |
250 | { |
|
250 | { | |
251 | nb_sm_f0 = 0; |
|
251 | nb_sm_f0 = 0; | |
252 | nb_sm_f0_aux_f1 = 0; |
|
252 | nb_sm_f0_aux_f1 = 0; | |
253 | nb_sm_f0_aux_f2 = 0; |
|
253 | nb_sm_f0_aux_f2 = 0; | |
254 |
|
254 | |||
255 | nb_sm_f1 = 0; |
|
255 | nb_sm_f1 = 0; | |
256 | } |
|
256 | } | |
257 |
|
257 | |||
258 | void SM_init_rings( void ) |
|
258 | void SM_init_rings( void ) | |
259 | { |
|
259 | { | |
260 | unsigned char i; |
|
260 | unsigned char i; | |
261 |
|
261 | |||
262 | // F0 RING |
|
262 | // F0 RING | |
263 | sm_ring_f0[0].next = (ring_node_sm*) &sm_ring_f0[1]; |
|
263 | sm_ring_f0[0].next = (ring_node_sm*) &sm_ring_f0[1]; | |
264 | sm_ring_f0[0].previous = (ring_node_sm*) &sm_ring_f0[NB_RING_NODES_SM_F0-1]; |
|
264 | sm_ring_f0[0].previous = (ring_node_sm*) &sm_ring_f0[NB_RING_NODES_SM_F0-1]; | |
265 | sm_ring_f0[0].buffer_address = |
|
265 | sm_ring_f0[0].buffer_address = | |
266 | (int) &sm_f0[ 0 ]; |
|
266 | (int) &sm_f0[ 0 ]; | |
267 |
|
267 | |||
268 | sm_ring_f0[NB_RING_NODES_SM_F0-1].next = (ring_node_sm*) &sm_ring_f0[0]; |
|
268 | sm_ring_f0[NB_RING_NODES_SM_F0-1].next = (ring_node_sm*) &sm_ring_f0[0]; | |
269 | sm_ring_f0[NB_RING_NODES_SM_F0-1].previous = (ring_node_sm*) &sm_ring_f0[NB_RING_NODES_SM_F0-2]; |
|
269 | sm_ring_f0[NB_RING_NODES_SM_F0-1].previous = (ring_node_sm*) &sm_ring_f0[NB_RING_NODES_SM_F0-2]; | |
270 | sm_ring_f0[NB_RING_NODES_SM_F0-1].buffer_address = |
|
270 | sm_ring_f0[NB_RING_NODES_SM_F0-1].buffer_address = | |
271 | (int) &sm_f0[ (NB_RING_NODES_SM_F0-1) * TOTAL_SIZE_SM ]; |
|
271 | (int) &sm_f0[ (NB_RING_NODES_SM_F0-1) * TOTAL_SIZE_SM ]; | |
272 |
|
272 | |||
273 | for(i=1; i<NB_RING_NODES_SM_F0-1; i++) |
|
273 | for(i=1; i<NB_RING_NODES_SM_F0-1; i++) | |
274 | { |
|
274 | { | |
275 | sm_ring_f0[i].next = (ring_node_sm*) &sm_ring_f0[i+1]; |
|
275 | sm_ring_f0[i].next = (ring_node_sm*) &sm_ring_f0[i+1]; | |
276 | sm_ring_f0[i].previous = (ring_node_sm*) &sm_ring_f0[i-1]; |
|
276 | sm_ring_f0[i].previous = (ring_node_sm*) &sm_ring_f0[i-1]; | |
277 | sm_ring_f0[i].buffer_address = |
|
277 | sm_ring_f0[i].buffer_address = | |
278 | (int) &sm_f0[ i * TOTAL_SIZE_SM ]; |
|
278 | (int) &sm_f0[ i * TOTAL_SIZE_SM ]; | |
279 | } |
|
279 | } | |
280 |
|
280 | |||
281 | // F1 RING |
|
281 | // F1 RING | |
282 | sm_ring_f1[0].next = (ring_node_sm*) &sm_ring_f1[1]; |
|
282 | sm_ring_f1[0].next = (ring_node_sm*) &sm_ring_f1[1]; | |
283 | sm_ring_f1[0].previous = (ring_node_sm*) &sm_ring_f1[NB_RING_NODES_SM_F1-1]; |
|
283 | sm_ring_f1[0].previous = (ring_node_sm*) &sm_ring_f1[NB_RING_NODES_SM_F1-1]; | |
284 | sm_ring_f1[0].buffer_address = |
|
284 | sm_ring_f1[0].buffer_address = | |
285 | (int) &sm_f1[ 0 ]; |
|
285 | (int) &sm_f1[ 0 ]; | |
286 |
|
286 | |||
287 | sm_ring_f1[NB_RING_NODES_SM_F1-1].next = (ring_node_sm*) &sm_ring_f1[0]; |
|
287 | sm_ring_f1[NB_RING_NODES_SM_F1-1].next = (ring_node_sm*) &sm_ring_f1[0]; | |
288 | sm_ring_f1[NB_RING_NODES_SM_F1-1].previous = (ring_node_sm*) &sm_ring_f1[NB_RING_NODES_SM_F1-2]; |
|
288 | sm_ring_f1[NB_RING_NODES_SM_F1-1].previous = (ring_node_sm*) &sm_ring_f1[NB_RING_NODES_SM_F1-2]; | |
289 | sm_ring_f1[NB_RING_NODES_SM_F1-1].buffer_address = |
|
289 | sm_ring_f1[NB_RING_NODES_SM_F1-1].buffer_address = | |
290 | (int) &sm_f1[ (NB_RING_NODES_SM_F1-1) * TOTAL_SIZE_SM ]; |
|
290 | (int) &sm_f1[ (NB_RING_NODES_SM_F1-1) * TOTAL_SIZE_SM ]; | |
291 |
|
291 | |||
292 | for(i=1; i<NB_RING_NODES_SM_F1-1; i++) |
|
292 | for(i=1; i<NB_RING_NODES_SM_F1-1; i++) | |
293 | { |
|
293 | { | |
294 | sm_ring_f1[i].next = (ring_node_sm*) &sm_ring_f1[i+1]; |
|
294 | sm_ring_f1[i].next = (ring_node_sm*) &sm_ring_f1[i+1]; | |
295 | sm_ring_f1[i].previous = (ring_node_sm*) &sm_ring_f1[i-1]; |
|
295 | sm_ring_f1[i].previous = (ring_node_sm*) &sm_ring_f1[i-1]; | |
296 | sm_ring_f1[i].buffer_address = |
|
296 | sm_ring_f1[i].buffer_address = | |
297 | (int) &sm_f1[ i * TOTAL_SIZE_SM ]; |
|
297 | (int) &sm_f1[ i * TOTAL_SIZE_SM ]; | |
298 | } |
|
298 | } | |
299 |
|
299 | |||
300 | // F2 RING |
|
300 | // F2 RING | |
301 | sm_ring_f2[0].next = (ring_node_sm*) &sm_ring_f2[1]; |
|
301 | sm_ring_f2[0].next = (ring_node_sm*) &sm_ring_f2[1]; | |
302 | sm_ring_f2[0].previous = (ring_node_sm*) &sm_ring_f2[NB_RING_NODES_SM_F2-1]; |
|
302 | sm_ring_f2[0].previous = (ring_node_sm*) &sm_ring_f2[NB_RING_NODES_SM_F2-1]; | |
303 | sm_ring_f2[0].buffer_address = |
|
303 | sm_ring_f2[0].buffer_address = | |
304 | (int) &sm_f2[ 0 ]; |
|
304 | (int) &sm_f2[ 0 ]; | |
305 |
|
305 | |||
306 | sm_ring_f2[NB_RING_NODES_SM_F2-1].next = (ring_node_sm*) &sm_ring_f2[0]; |
|
306 | sm_ring_f2[NB_RING_NODES_SM_F2-1].next = (ring_node_sm*) &sm_ring_f2[0]; | |
307 | sm_ring_f2[NB_RING_NODES_SM_F2-1].previous = (ring_node_sm*) &sm_ring_f2[NB_RING_NODES_SM_F2-2]; |
|
307 | sm_ring_f2[NB_RING_NODES_SM_F2-1].previous = (ring_node_sm*) &sm_ring_f2[NB_RING_NODES_SM_F2-2]; | |
308 | sm_ring_f2[NB_RING_NODES_SM_F2-1].buffer_address = |
|
308 | sm_ring_f2[NB_RING_NODES_SM_F2-1].buffer_address = | |
309 | (int) &sm_f2[ (NB_RING_NODES_SM_F2-1) * TOTAL_SIZE_SM ]; |
|
309 | (int) &sm_f2[ (NB_RING_NODES_SM_F2-1) * TOTAL_SIZE_SM ]; | |
310 |
|
310 | |||
311 | for(i=1; i<NB_RING_NODES_SM_F2-1; i++) |
|
311 | for(i=1; i<NB_RING_NODES_SM_F2-1; i++) | |
312 | { |
|
312 | { | |
313 | sm_ring_f2[i].next = (ring_node_sm*) &sm_ring_f2[i+1]; |
|
313 | sm_ring_f2[i].next = (ring_node_sm*) &sm_ring_f2[i+1]; | |
314 | sm_ring_f2[i].previous = (ring_node_sm*) &sm_ring_f2[i-1]; |
|
314 | sm_ring_f2[i].previous = (ring_node_sm*) &sm_ring_f2[i-1]; | |
315 | sm_ring_f2[i].buffer_address = |
|
315 | sm_ring_f2[i].buffer_address = | |
316 | (int) &sm_f2[ i * TOTAL_SIZE_SM ]; |
|
316 | (int) &sm_f2[ i * TOTAL_SIZE_SM ]; | |
317 | } |
|
317 | } | |
318 |
|
318 | |||
319 | DEBUG_PRINTF1("asm_ring_f0 @%x\n", (unsigned int) sm_ring_f0) |
|
319 | DEBUG_PRINTF1("asm_ring_f0 @%x\n", (unsigned int) sm_ring_f0) | |
320 | DEBUG_PRINTF1("asm_ring_f1 @%x\n", (unsigned int) sm_ring_f1) |
|
320 | DEBUG_PRINTF1("asm_ring_f1 @%x\n", (unsigned int) sm_ring_f1) | |
321 | DEBUG_PRINTF1("asm_ring_f2 @%x\n", (unsigned int) sm_ring_f2) |
|
321 | DEBUG_PRINTF1("asm_ring_f2 @%x\n", (unsigned int) sm_ring_f2) | |
322 |
|
322 | |||
323 | spectral_matrix_regs->f0_0_address = sm_ring_f0[0].buffer_address; |
|
323 | spectral_matrix_regs->f0_0_address = sm_ring_f0[0].buffer_address; | |
324 | DEBUG_PRINTF1("spectral_matrix_regs->matrixF0_Address0 @%x\n", spectral_matrix_regs->f0_0_address) |
|
324 | DEBUG_PRINTF1("spectral_matrix_regs->matrixF0_Address0 @%x\n", spectral_matrix_regs->f0_0_address) | |
325 | } |
|
325 | } | |
326 |
|
326 | |||
327 | void SM_generic_init_ring( ring_node_sm *ring, unsigned char nbNodes, volatile int sm_f[] ) |
|
327 | void SM_generic_init_ring( ring_node_sm *ring, unsigned char nbNodes, volatile int sm_f[] ) | |
328 | { |
|
328 | { | |
329 | unsigned char i; |
|
329 | unsigned char i; | |
330 |
|
330 | |||
331 | //*************** |
|
331 | //*************** | |
332 | // BUFFER ADDRESS |
|
332 | // BUFFER ADDRESS | |
333 | for(i=0; i<nbNodes; i++) |
|
333 | for(i=0; i<nbNodes; i++) | |
334 | { |
|
334 | { | |
335 | ring[ i ].buffer_address = (int) &sm_f[ i * TOTAL_SIZE_SM ]; |
|
335 | ring[ i ].buffer_address = (int) &sm_f[ i * TOTAL_SIZE_SM ]; | |
336 | } |
|
336 | } | |
337 |
|
337 | |||
338 | //***** |
|
338 | //***** | |
339 | // NEXT |
|
339 | // NEXT | |
340 | ring[ nbNodes - 1 ].next = (ring_node_sm*) &ring[ 0 ]; |
|
340 | ring[ nbNodes - 1 ].next = (ring_node_sm*) &ring[ 0 ]; | |
341 | for(i=0; i<nbNodes-1; i++) |
|
341 | for(i=0; i<nbNodes-1; i++) | |
342 | { |
|
342 | { | |
343 | ring[ i ].next = (ring_node_sm*) &ring[ i + 1 ]; |
|
343 | ring[ i ].next = (ring_node_sm*) &ring[ i + 1 ]; | |
344 | } |
|
344 | } | |
345 |
|
345 | |||
346 | //********* |
|
346 | //********* | |
347 | // PREVIOUS |
|
347 | // PREVIOUS | |
348 | ring[ 0 ].previous = (ring_node_sm*) &ring[ nbNodes -1 ]; |
|
348 | ring[ 0 ].previous = (ring_node_sm*) &ring[ nbNodes -1 ]; | |
349 | for(i=1; i<nbNodes; i++) |
|
349 | for(i=1; i<nbNodes; i++) | |
350 | { |
|
350 | { | |
351 | ring[ i ].previous = (ring_node_sm*) &ring[ i - 1 ]; |
|
351 | ring[ i ].previous = (ring_node_sm*) &ring[ i - 1 ]; | |
352 | } |
|
352 | } | |
353 | } |
|
353 | } | |
354 |
|
354 | |||
355 | void ASM_generic_init_ring( ring_node_asm *ring, unsigned char nbNodes ) |
|
355 | void ASM_generic_init_ring( ring_node_asm *ring, unsigned char nbNodes ) | |
356 | { |
|
356 | { | |
357 | unsigned char i; |
|
357 | unsigned char i; | |
358 |
|
358 | |||
359 | ring[ nbNodes - 1 ].next |
|
359 | ring[ nbNodes - 1 ].next | |
360 | = (ring_node_asm*) &ring[ 0 ]; |
|
360 | = (ring_node_asm*) &ring[ 0 ]; | |
361 |
|
361 | |||
362 | for(i=0; i<nbNodes-1; i++) |
|
362 | for(i=0; i<nbNodes-1; i++) | |
363 | { |
|
363 | { | |
364 | ring[ i ].next = (ring_node_asm*) &ring[ i + 1 ]; |
|
364 | ring[ i ].next = (ring_node_asm*) &ring[ i + 1 ]; | |
365 | } |
|
365 | } | |
366 | } |
|
366 | } | |
367 |
|
367 | |||
368 | void SM_reset_current_ring_nodes( void ) |
|
368 | void SM_reset_current_ring_nodes( void ) | |
369 | { |
|
369 | { | |
370 | current_ring_node_sm_f0 = sm_ring_f0[0].next; |
|
370 | current_ring_node_sm_f0 = sm_ring_f0[0].next; | |
371 | current_ring_node_sm_f1 = sm_ring_f1[0].next; |
|
371 | current_ring_node_sm_f1 = sm_ring_f1[0].next; | |
372 | current_ring_node_sm_f2 = sm_ring_f2[0].next; |
|
372 | current_ring_node_sm_f2 = sm_ring_f2[0].next; | |
373 |
|
373 | |||
374 | ring_node_for_averaging_sm_f0 = sm_ring_f0; |
|
374 | ring_node_for_averaging_sm_f0 = sm_ring_f0; | |
375 | ring_node_for_averaging_sm_f1 = sm_ring_f1; |
|
375 | ring_node_for_averaging_sm_f1 = sm_ring_f1; | |
376 | ring_node_for_averaging_sm_f2 = sm_ring_f2; |
|
376 | ring_node_for_averaging_sm_f2 = sm_ring_f2; | |
377 | } |
|
377 | } | |
378 |
|
378 | |||
379 | void ASM_init_header( Header_TM_LFR_SCIENCE_ASM_t *header) |
|
379 | void ASM_init_header( Header_TM_LFR_SCIENCE_ASM_t *header) | |
380 | { |
|
380 | { | |
381 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
381 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; | |
382 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
382 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
383 | header->reserved = 0x00; |
|
383 | header->reserved = 0x00; | |
384 | header->userApplication = CCSDS_USER_APP; |
|
384 | header->userApplication = CCSDS_USER_APP; | |
385 | header->packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8); |
|
385 | header->packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8); | |
386 | header->packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST); |
|
386 | header->packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST); | |
387 | header->packetSequenceControl[0] = 0xc0; |
|
387 | header->packetSequenceControl[0] = 0xc0; | |
388 | header->packetSequenceControl[1] = 0x00; |
|
388 | header->packetSequenceControl[1] = 0x00; | |
389 | header->packetLength[0] = 0x00; |
|
389 | header->packetLength[0] = 0x00; | |
390 | header->packetLength[1] = 0x00; |
|
390 | header->packetLength[1] = 0x00; | |
391 | // DATA FIELD HEADER |
|
391 | // DATA FIELD HEADER | |
392 | header->spare1_pusVersion_spare2 = 0x10; |
|
392 | header->spare1_pusVersion_spare2 = 0x10; | |
393 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
393 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
394 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
394 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
395 | header->destinationID = TM_DESTINATION_ID_GROUND; |
|
395 | header->destinationID = TM_DESTINATION_ID_GROUND; | |
396 | // AUXILIARY DATA HEADER |
|
396 | // AUXILIARY DATA HEADER | |
397 | header->sid = 0x00; |
|
397 | header->sid = 0x00; | |
398 | header->biaStatusInfo = 0x00; |
|
398 | header->biaStatusInfo = 0x00; | |
399 | header->pa_lfr_pkt_cnt_asm = 0x00; |
|
399 | header->pa_lfr_pkt_cnt_asm = 0x00; | |
400 | header->pa_lfr_pkt_nr_asm = 0x00; |
|
400 | header->pa_lfr_pkt_nr_asm = 0x00; | |
401 | header->time[0] = 0x00; |
|
401 | header->time[0] = 0x00; | |
402 | header->time[0] = 0x00; |
|
402 | header->time[0] = 0x00; | |
403 | header->time[0] = 0x00; |
|
403 | header->time[0] = 0x00; | |
404 | header->time[0] = 0x00; |
|
404 | header->time[0] = 0x00; | |
405 | header->time[0] = 0x00; |
|
405 | header->time[0] = 0x00; | |
406 | header->time[0] = 0x00; |
|
406 | header->time[0] = 0x00; | |
407 | header->pa_lfr_asm_blk_nr[0] = 0x00; // BLK_NR MSB |
|
407 | header->pa_lfr_asm_blk_nr[0] = 0x00; // BLK_NR MSB | |
408 | header->pa_lfr_asm_blk_nr[1] = 0x00; // BLK_NR LSB |
|
408 | header->pa_lfr_asm_blk_nr[1] = 0x00; // BLK_NR LSB | |
409 | } |
|
409 | } | |
410 |
|
410 | |||
411 | void ASM_send(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, |
|
411 | void ASM_send(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, | |
412 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id) |
|
412 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id) | |
413 | { |
|
413 | { | |
414 | unsigned int i; |
|
414 | unsigned int i; | |
415 | unsigned int length = 0; |
|
415 | unsigned int length = 0; | |
416 | rtems_status_code status; |
|
416 | rtems_status_code status; | |
417 |
|
417 | |||
418 | for (i=0; i<2; i++) |
|
418 | for (i=0; i<2; i++) | |
419 | { |
|
419 | { | |
420 | // (1) BUILD THE DATA |
|
420 | // (1) BUILD THE DATA | |
421 | switch(sid) |
|
421 | switch(sid) | |
422 | { |
|
422 | { | |
423 | case SID_NORM_ASM_F0: |
|
423 | case SID_NORM_ASM_F0: | |
424 | spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F0_IN_BYTES / 2; // 2 packets will be sent |
|
424 | spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F0_IN_BYTES / 2; // 2 packets will be sent | |
425 | spw_ioctl_send->data = &spectral_matrix[ |
|
425 | spw_ioctl_send->data = &spectral_matrix[ | |
426 | ( (ASM_F0_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F0) ) * NB_VALUES_PER_SM ) * 2 |
|
426 | ( (ASM_F0_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F0) ) * NB_VALUES_PER_SM ) * 2 | |
427 | ]; |
|
427 | ]; | |
428 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0; |
|
428 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0; | |
429 | header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F0) >> 8 ); // BLK_NR MSB |
|
429 | header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F0) >> 8 ); // BLK_NR MSB | |
430 | header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F0); // BLK_NR LSB |
|
430 | header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F0); // BLK_NR LSB | |
431 | break; |
|
431 | break; | |
432 | case SID_NORM_ASM_F1: |
|
432 | case SID_NORM_ASM_F1: | |
433 | spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F1_IN_BYTES / 2; // 2 packets will be sent |
|
433 | spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F1_IN_BYTES / 2; // 2 packets will be sent | |
434 | spw_ioctl_send->data = &spectral_matrix[ |
|
434 | spw_ioctl_send->data = &spectral_matrix[ | |
435 | ( (ASM_F1_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F1) ) * NB_VALUES_PER_SM ) * 2 |
|
435 | ( (ASM_F1_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F1) ) * NB_VALUES_PER_SM ) * 2 | |
436 | ]; |
|
436 | ]; | |
437 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F1; |
|
437 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F1; | |
438 | header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F1) >> 8 ); // BLK_NR MSB |
|
438 | header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F1) >> 8 ); // BLK_NR MSB | |
439 | header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F1); // BLK_NR LSB |
|
439 | header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F1); // BLK_NR LSB | |
440 | break; |
|
440 | break; | |
441 | case SID_NORM_ASM_F2: |
|
441 | case SID_NORM_ASM_F2: | |
442 | spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F2_IN_BYTES / 2; // 2 packets will be sent |
|
442 | spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F2_IN_BYTES / 2; // 2 packets will be sent | |
443 | spw_ioctl_send->data = &spectral_matrix[ |
|
443 | spw_ioctl_send->data = &spectral_matrix[ | |
444 | ( (ASM_F2_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F2) ) * NB_VALUES_PER_SM ) * 2 |
|
444 | ( (ASM_F2_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F2) ) * NB_VALUES_PER_SM ) * 2 | |
445 | ]; |
|
445 | ]; | |
446 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F2; |
|
446 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F2; | |
447 | header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F2) >> 8 ); // BLK_NR MSB |
|
447 | header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F2) >> 8 ); // BLK_NR MSB | |
448 | header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F2); // BLK_NR LSB |
|
448 | header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F2); // BLK_NR LSB | |
449 | break; |
|
449 | break; | |
450 | default: |
|
450 | default: | |
451 | PRINTF1("ERR *** in ASM_send *** unexpected sid %d\n", sid) |
|
451 | PRINTF1("ERR *** in ASM_send *** unexpected sid %d\n", sid) | |
452 | break; |
|
452 | break; | |
453 | } |
|
453 | } | |
454 | spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
454 | spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES; | |
455 | spw_ioctl_send->hdr = (char *) header; |
|
455 | spw_ioctl_send->hdr = (char *) header; | |
456 | spw_ioctl_send->options = 0; |
|
456 | spw_ioctl_send->options = 0; | |
457 |
|
457 | |||
458 | // (2) BUILD THE HEADER |
|
458 | // (2) BUILD THE HEADER | |
459 | increment_seq_counter_source_id( header->packetSequenceControl, sid ); |
|
459 | increment_seq_counter_source_id( header->packetSequenceControl, sid ); | |
460 | header->packetLength[0] = (unsigned char) (length>>8); |
|
460 | header->packetLength[0] = (unsigned char) (length>>8); | |
461 | header->packetLength[1] = (unsigned char) (length); |
|
461 | header->packetLength[1] = (unsigned char) (length); | |
462 | header->sid = (unsigned char) sid; // SID |
|
462 | header->sid = (unsigned char) sid; // SID | |
463 | header->pa_lfr_pkt_cnt_asm = 2; |
|
463 | header->pa_lfr_pkt_cnt_asm = 2; | |
464 | header->pa_lfr_pkt_nr_asm = (unsigned char) (i+1); |
|
464 | header->pa_lfr_pkt_nr_asm = (unsigned char) (i+1); | |
465 |
|
465 | |||
466 | // (3) SET PACKET TIME |
|
466 | // (3) SET PACKET TIME | |
467 | header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
467 | header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
468 | header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
468 | header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
469 | header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
469 | header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
470 | header->time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
470 | header->time[3] = (unsigned char) (time_management_regs->coarse_time); | |
471 | header->time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
471 | header->time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
472 | header->time[5] = (unsigned char) (time_management_regs->fine_time); |
|
472 | header->time[5] = (unsigned char) (time_management_regs->fine_time); | |
473 | // |
|
473 | // | |
474 | header->acquisitionTime[0] = header->time[0]; |
|
474 | header->acquisitionTime[0] = header->time[0]; | |
475 | header->acquisitionTime[1] = header->time[1]; |
|
475 | header->acquisitionTime[1] = header->time[1]; | |
476 | header->acquisitionTime[2] = header->time[2]; |
|
476 | header->acquisitionTime[2] = header->time[2]; | |
477 | header->acquisitionTime[3] = header->time[3]; |
|
477 | header->acquisitionTime[3] = header->time[3]; | |
478 | header->acquisitionTime[4] = header->time[4]; |
|
478 | header->acquisitionTime[4] = header->time[4]; | |
479 | header->acquisitionTime[5] = header->time[5]; |
|
479 | header->acquisitionTime[5] = header->time[5]; | |
480 |
|
480 | |||
481 | // (4) SEND PACKET |
|
481 | // (4) SEND PACKET | |
482 | status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE); |
|
482 | status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE); | |
483 | if (status != RTEMS_SUCCESSFUL) { |
|
483 | if (status != RTEMS_SUCCESSFUL) { | |
484 | printf("in ASM_send *** ERR %d\n", (int) status); |
|
484 | printf("in ASM_send *** ERR %d\n", (int) status); | |
485 | } |
|
485 | } | |
486 | } |
|
486 | } | |
487 | } |
|
487 | } | |
488 |
|
488 | |||
489 | //***************** |
|
489 | //***************** | |
490 | // Basic Parameters |
|
490 | // Basic Parameters | |
491 |
|
491 | |||
492 | void BP_init_header( Header_TM_LFR_SCIENCE_BP_t *header, |
|
492 | void BP_init_header( Header_TM_LFR_SCIENCE_BP_t *header, | |
493 | unsigned int apid, unsigned char sid, |
|
493 | unsigned int apid, unsigned char sid, | |
494 | unsigned int packetLength, unsigned char blkNr ) |
|
494 | unsigned int packetLength, unsigned char blkNr ) | |
495 | { |
|
495 | { | |
496 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
496 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; | |
497 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
497 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
498 | header->reserved = 0x00; |
|
498 | header->reserved = 0x00; | |
499 | header->userApplication = CCSDS_USER_APP; |
|
499 | header->userApplication = CCSDS_USER_APP; | |
500 | header->packetID[0] = (unsigned char) (apid >> 8); |
|
500 | header->packetID[0] = (unsigned char) (apid >> 8); | |
501 | header->packetID[1] = (unsigned char) (apid); |
|
501 | header->packetID[1] = (unsigned char) (apid); | |
502 | header->packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
502 | header->packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
503 | header->packetSequenceControl[1] = 0x00; |
|
503 | header->packetSequenceControl[1] = 0x00; | |
504 | header->packetLength[0] = (unsigned char) (packetLength >> 8); |
|
504 | header->packetLength[0] = (unsigned char) (packetLength >> 8); | |
505 | header->packetLength[1] = (unsigned char) (packetLength); |
|
505 | header->packetLength[1] = (unsigned char) (packetLength); | |
506 | // DATA FIELD HEADER |
|
506 | // DATA FIELD HEADER | |
507 | header->spare1_pusVersion_spare2 = 0x10; |
|
507 | header->spare1_pusVersion_spare2 = 0x10; | |
508 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
508 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
509 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
509 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
510 | header->destinationID = TM_DESTINATION_ID_GROUND; |
|
510 | header->destinationID = TM_DESTINATION_ID_GROUND; | |
511 | // AUXILIARY DATA HEADER |
|
511 | // AUXILIARY DATA HEADER | |
512 | header->sid = sid; |
|
512 | header->sid = sid; | |
513 | header->biaStatusInfo = 0x00; |
|
513 | header->biaStatusInfo = 0x00; | |
514 | header->time[0] = 0x00; |
|
514 | header->time[0] = 0x00; | |
515 | header->time[0] = 0x00; |
|
515 | header->time[0] = 0x00; | |
516 | header->time[0] = 0x00; |
|
516 | header->time[0] = 0x00; | |
517 | header->time[0] = 0x00; |
|
517 | header->time[0] = 0x00; | |
518 | header->time[0] = 0x00; |
|
518 | header->time[0] = 0x00; | |
519 | header->time[0] = 0x00; |
|
519 | header->time[0] = 0x00; | |
520 | header->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB |
|
520 | header->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB | |
521 | header->pa_lfr_bp_blk_nr[1] = blkNr; // BLK_NR LSB |
|
521 | header->pa_lfr_bp_blk_nr[1] = blkNr; // BLK_NR LSB | |
522 | } |
|
522 | } | |
523 |
|
523 | |||
524 | void BP_init_header_with_spare(Header_TM_LFR_SCIENCE_BP_with_spare_t *header, |
|
524 | void BP_init_header_with_spare(Header_TM_LFR_SCIENCE_BP_with_spare_t *header, | |
525 | unsigned int apid, unsigned char sid, |
|
525 | unsigned int apid, unsigned char sid, | |
526 | unsigned int packetLength , unsigned char blkNr) |
|
526 | unsigned int packetLength , unsigned char blkNr) | |
527 | { |
|
527 | { | |
528 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
528 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; | |
529 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
529 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
530 | header->reserved = 0x00; |
|
530 | header->reserved = 0x00; | |
531 | header->userApplication = CCSDS_USER_APP; |
|
531 | header->userApplication = CCSDS_USER_APP; | |
532 | header->packetID[0] = (unsigned char) (apid >> 8); |
|
532 | header->packetID[0] = (unsigned char) (apid >> 8); | |
533 | header->packetID[1] = (unsigned char) (apid); |
|
533 | header->packetID[1] = (unsigned char) (apid); | |
534 | header->packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
534 | header->packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
535 | header->packetSequenceControl[1] = 0x00; |
|
535 | header->packetSequenceControl[1] = 0x00; | |
536 | header->packetLength[0] = (unsigned char) (packetLength >> 8); |
|
536 | header->packetLength[0] = (unsigned char) (packetLength >> 8); | |
537 | header->packetLength[1] = (unsigned char) (packetLength); |
|
537 | header->packetLength[1] = (unsigned char) (packetLength); | |
538 | // DATA FIELD HEADER |
|
538 | // DATA FIELD HEADER | |
539 | header->spare1_pusVersion_spare2 = 0x10; |
|
539 | header->spare1_pusVersion_spare2 = 0x10; | |
540 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
540 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
541 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
541 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
542 | header->destinationID = TM_DESTINATION_ID_GROUND; |
|
542 | header->destinationID = TM_DESTINATION_ID_GROUND; | |
543 | // AUXILIARY DATA HEADER |
|
543 | // AUXILIARY DATA HEADER | |
544 | header->sid = sid; |
|
544 | header->sid = sid; | |
545 | header->biaStatusInfo = 0x00; |
|
545 | header->biaStatusInfo = 0x00; | |
546 | header->time[0] = 0x00; |
|
546 | header->time[0] = 0x00; | |
547 | header->time[0] = 0x00; |
|
547 | header->time[0] = 0x00; | |
548 | header->time[0] = 0x00; |
|
548 | header->time[0] = 0x00; | |
549 | header->time[0] = 0x00; |
|
549 | header->time[0] = 0x00; | |
550 | header->time[0] = 0x00; |
|
550 | header->time[0] = 0x00; | |
551 | header->time[0] = 0x00; |
|
551 | header->time[0] = 0x00; | |
552 | header->source_data_spare = 0x00; |
|
552 | header->source_data_spare = 0x00; | |
553 | header->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB |
|
553 | header->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB | |
554 | header->pa_lfr_bp_blk_nr[1] = blkNr; // BLK_NR LSB |
|
554 | header->pa_lfr_bp_blk_nr[1] = blkNr; // BLK_NR LSB | |
555 | } |
|
555 | } | |
556 |
|
556 | |||
557 | void BP_send(char *data, rtems_id queue_id, unsigned int nbBytesToSend, unsigned int sid ) |
|
557 | void BP_send(char *data, rtems_id queue_id, unsigned int nbBytesToSend, unsigned int sid ) | |
558 | { |
|
558 | { | |
559 | rtems_status_code status; |
|
559 | rtems_status_code status; | |
560 |
|
560 | |||
561 | // SET THE SEQUENCE_CNT PARAMETER |
|
561 | // SET THE SEQUENCE_CNT PARAMETER | |
562 | increment_seq_counter_source_id( (unsigned char*) &data[ PACKET_POS_SEQUENCE_CNT ], sid ); |
|
562 | increment_seq_counter_source_id( (unsigned char*) &data[ PACKET_POS_SEQUENCE_CNT ], sid ); | |
563 | // SEND PACKET |
|
563 | // SEND PACKET | |
564 | status = rtems_message_queue_send( queue_id, data, nbBytesToSend); |
|
564 | status = rtems_message_queue_send( queue_id, data, nbBytesToSend); | |
565 | if (status != RTEMS_SUCCESSFUL) |
|
565 | if (status != RTEMS_SUCCESSFUL) | |
566 | { |
|
566 | { | |
567 | printf("ERR *** in BP_send *** ERR %d\n", (int) status); |
|
567 | printf("ERR *** in BP_send *** ERR %d\n", (int) status); | |
568 | } |
|
568 | } | |
569 | } |
|
569 | } | |
570 |
|
570 | |||
571 | //****************** |
|
571 | //****************** | |
572 | // general functions |
|
572 | // general functions | |
573 |
|
573 | |||
574 | void reset_spectral_matrix_regs( void ) |
|
574 | void reset_spectral_matrix_regs( void ) | |
575 | { |
|
575 | { | |
576 | /** This function resets the spectral matrices module registers. |
|
576 | /** This function resets the spectral matrices module registers. | |
577 | * |
|
577 | * | |
578 | * The registers affected by this function are located at the following offset addresses: |
|
578 | * The registers affected by this function are located at the following offset addresses: | |
579 | * |
|
579 | * | |
580 | * - 0x00 config |
|
580 | * - 0x00 config | |
581 | * - 0x04 status |
|
581 | * - 0x04 status | |
582 | * - 0x08 matrixF0_Address0 |
|
582 | * - 0x08 matrixF0_Address0 | |
583 | * - 0x10 matrixFO_Address1 |
|
583 | * - 0x10 matrixFO_Address1 | |
584 | * - 0x14 matrixF1_Address |
|
584 | * - 0x14 matrixF1_Address | |
585 | * - 0x18 matrixF2_Address |
|
585 | * - 0x18 matrixF2_Address | |
586 | * |
|
586 | * | |
587 | */ |
|
587 | */ | |
588 |
|
588 | |||
589 | spectral_matrix_regs->config = 0x00; |
|
589 | spectral_matrix_regs->config = 0x00; | |
590 | spectral_matrix_regs->status = 0x00; |
|
590 | spectral_matrix_regs->status = 0x00; | |
591 |
|
591 | |||
592 | spectral_matrix_regs->f0_0_address = current_ring_node_sm_f0->previous->buffer_address; |
|
592 | spectral_matrix_regs->f0_0_address = current_ring_node_sm_f0->previous->buffer_address; | |
593 | spectral_matrix_regs->f0_1_address = current_ring_node_sm_f0->buffer_address; |
|
593 | spectral_matrix_regs->f0_1_address = current_ring_node_sm_f0->buffer_address; | |
594 | spectral_matrix_regs->f1_0_address = current_ring_node_sm_f1->previous->buffer_address; |
|
594 | spectral_matrix_regs->f1_0_address = current_ring_node_sm_f1->previous->buffer_address; | |
595 | spectral_matrix_regs->f1_1_address = current_ring_node_sm_f1->buffer_address; |
|
595 | spectral_matrix_regs->f1_1_address = current_ring_node_sm_f1->buffer_address; | |
596 | spectral_matrix_regs->f2_0_address = current_ring_node_sm_f2->previous->buffer_address; |
|
596 | spectral_matrix_regs->f2_0_address = current_ring_node_sm_f2->previous->buffer_address; | |
597 | spectral_matrix_regs->f2_1_address = current_ring_node_sm_f2->buffer_address; |
|
597 | spectral_matrix_regs->f2_1_address = current_ring_node_sm_f2->buffer_address; | |
598 | } |
|
598 | } | |
599 |
|
599 | |||
600 | void set_time( unsigned char *time, unsigned char * timeInBuffer ) |
|
600 | void set_time( unsigned char *time, unsigned char * timeInBuffer ) | |
601 | { |
|
601 | { | |
602 | time[0] = timeInBuffer[0]; |
|
602 | time[0] = timeInBuffer[0]; | |
603 | time[1] = timeInBuffer[1]; |
|
603 | time[1] = timeInBuffer[1]; | |
604 | time[2] = timeInBuffer[2]; |
|
604 | time[2] = timeInBuffer[2]; | |
605 | time[3] = timeInBuffer[3]; |
|
605 | time[3] = timeInBuffer[3]; | |
606 | time[4] = timeInBuffer[6]; |
|
606 | time[4] = timeInBuffer[6]; | |
607 | time[5] = timeInBuffer[7]; |
|
607 | time[5] = timeInBuffer[7]; | |
608 | } |
|
608 | } | |
609 |
|
609 | |||
610 | unsigned long long int get_acquisition_time( unsigned char *timePtr ) |
|
610 | unsigned long long int get_acquisition_time( unsigned char *timePtr ) | |
611 | { |
|
611 | { | |
612 | unsigned long long int acquisitionTimeAslong; |
|
612 | unsigned long long int acquisitionTimeAslong; | |
613 | acquisitionTimeAslong = 0x00; |
|
613 | acquisitionTimeAslong = 0x00; | |
614 | acquisitionTimeAslong = ( (unsigned long long int) (timePtr[0] & 0x7f) << 40 ) // [0111 1111] mask the synchronization bit |
|
614 | acquisitionTimeAslong = ( (unsigned long long int) (timePtr[0] & 0x7f) << 40 ) // [0111 1111] mask the synchronization bit | |
615 | + ( (unsigned long long int) timePtr[1] << 32 ) |
|
615 | + ( (unsigned long long int) timePtr[1] << 32 ) | |
616 | + ( timePtr[2] << 24 ) |
|
616 | + ( (unsigned long long int) timePtr[2] << 24 ) | |
617 | + ( timePtr[3] << 16 ) |
|
617 | + ( (unsigned long long int) timePtr[3] << 16 ) | |
618 | + ( timePtr[6] << 8 ) |
|
618 | + ( (unsigned long long int) timePtr[6] << 8 ) | |
619 | + ( timePtr[7] ); |
|
619 | + ( (unsigned long long int) timePtr[7] ); | |
620 | return acquisitionTimeAslong; |
|
620 | return acquisitionTimeAslong; | |
621 | } |
|
621 | } | |
622 |
|
622 | |||
623 | void close_matrix_actions(unsigned int *nb_sm, unsigned int nb_sm_before_avf, rtems_id task_id, |
|
623 | void close_matrix_actions(unsigned int *nb_sm, unsigned int nb_sm_before_avf, rtems_id task_id, | |
624 | ring_node_sm *node_for_averaging, ring_node_sm *ringNode, |
|
624 | ring_node_sm *node_for_averaging, ring_node_sm *ringNode, | |
625 | unsigned long long int time ) |
|
625 | unsigned long long int time ) | |
626 | { |
|
626 | { | |
627 | unsigned char *timePtr; |
|
627 | unsigned char *timePtr; | |
628 | unsigned char *coarseTimePtr; |
|
628 | unsigned char *coarseTimePtr; | |
629 | unsigned char *fineTimePtr; |
|
629 | unsigned char *fineTimePtr; | |
630 |
|
630 | |||
631 | timePtr = (unsigned char *) &time; |
|
631 | timePtr = (unsigned char *) &time; | |
632 | coarseTimePtr = (unsigned char *) &node_for_averaging->coarseTime; |
|
632 | coarseTimePtr = (unsigned char *) &node_for_averaging->coarseTime; | |
633 | fineTimePtr = (unsigned char *) &node_for_averaging->fineTime; |
|
633 | fineTimePtr = (unsigned char *) &node_for_averaging->fineTime; | |
634 |
|
634 | |||
635 | *nb_sm = *nb_sm + 1; |
|
635 | *nb_sm = *nb_sm + 1; | |
636 | if (*nb_sm == nb_sm_before_avf) |
|
636 | if (*nb_sm == nb_sm_before_avf) | |
637 | { |
|
637 | { | |
638 | node_for_averaging = ringNode; |
|
638 | node_for_averaging = ringNode; | |
639 | coarseTimePtr[0] = timePtr[2]; |
|
639 | coarseTimePtr[0] = timePtr[2]; | |
640 | coarseTimePtr[1] = timePtr[3]; |
|
640 | coarseTimePtr[1] = timePtr[3]; | |
641 | coarseTimePtr[2] = timePtr[4]; |
|
641 | coarseTimePtr[2] = timePtr[4]; | |
642 | coarseTimePtr[3] = timePtr[5]; |
|
642 | coarseTimePtr[3] = timePtr[5]; | |
643 | fineTimePtr[2] = timePtr[6]; |
|
643 | fineTimePtr[2] = timePtr[6]; | |
644 | fineTimePtr[3] = timePtr[7]; |
|
644 | fineTimePtr[3] = timePtr[7]; | |
645 | if (rtems_event_send( task_id, RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
645 | if (rtems_event_send( task_id, RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |
646 | { |
|
646 | { | |
647 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
647 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |
648 | } |
|
648 | } | |
649 | *nb_sm = 0; |
|
649 | *nb_sm = 0; | |
650 | } |
|
650 | } | |
651 | } |
|
651 | } | |
652 |
|
652 | |||
653 | unsigned char getSID( rtems_event_set event ) |
|
653 | unsigned char getSID( rtems_event_set event ) | |
654 | { |
|
654 | { | |
655 | unsigned char sid; |
|
655 | unsigned char sid; | |
656 |
|
656 | |||
657 | rtems_event_set eventSetBURST; |
|
657 | rtems_event_set eventSetBURST; | |
658 | rtems_event_set eventSetSBM; |
|
658 | rtems_event_set eventSetSBM; | |
659 |
|
659 | |||
660 | //****** |
|
660 | //****** | |
661 | // BURST |
|
661 | // BURST | |
662 | eventSetBURST = RTEMS_EVENT_BURST_BP1_F0 |
|
662 | eventSetBURST = RTEMS_EVENT_BURST_BP1_F0 | |
663 | | RTEMS_EVENT_BURST_BP1_F1 |
|
663 | | RTEMS_EVENT_BURST_BP1_F1 | |
664 | | RTEMS_EVENT_BURST_BP2_F0 |
|
664 | | RTEMS_EVENT_BURST_BP2_F0 | |
665 | | RTEMS_EVENT_BURST_BP2_F1; |
|
665 | | RTEMS_EVENT_BURST_BP2_F1; | |
666 |
|
666 | |||
667 | //**** |
|
667 | //**** | |
668 | // SBM |
|
668 | // SBM | |
669 | eventSetSBM = RTEMS_EVENT_SBM_BP1_F0 |
|
669 | eventSetSBM = RTEMS_EVENT_SBM_BP1_F0 | |
670 | | RTEMS_EVENT_SBM_BP1_F1 |
|
670 | | RTEMS_EVENT_SBM_BP1_F1 | |
671 | | RTEMS_EVENT_SBM_BP2_F0 |
|
671 | | RTEMS_EVENT_SBM_BP2_F0 | |
672 | | RTEMS_EVENT_SBM_BP2_F1; |
|
672 | | RTEMS_EVENT_SBM_BP2_F1; | |
673 |
|
673 | |||
674 | if (event & eventSetBURST) |
|
674 | if (event & eventSetBURST) | |
675 | { |
|
675 | { | |
676 | sid = SID_BURST_BP1_F0; |
|
676 | sid = SID_BURST_BP1_F0; | |
677 | } |
|
677 | } | |
678 | else if (event & eventSetSBM) |
|
678 | else if (event & eventSetSBM) | |
679 | { |
|
679 | { | |
680 | sid = SID_SBM1_BP1_F0; |
|
680 | sid = SID_SBM1_BP1_F0; | |
681 | } |
|
681 | } | |
682 | else |
|
682 | else | |
683 | { |
|
683 | { | |
684 | sid = 0; |
|
684 | sid = 0; | |
685 | } |
|
685 | } | |
686 |
|
686 | |||
687 | return sid; |
|
687 | return sid; | |
688 | } |
|
688 | } | |
689 |
|
689 |
@@ -1,1399 +1,1310 | |||||
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 | rtems_isr waveforms_isr( rtems_vector_number vector ) |
|
60 | rtems_isr waveforms_isr( rtems_vector_number vector ) | |
61 | { |
|
61 | { | |
62 | /** This is the interrupt sub routine called by the waveform picker core. |
|
62 | /** This is the interrupt sub routine called by the waveform picker core. | |
63 | * |
|
63 | * | |
64 | * This ISR launch different actions depending mainly on two pieces of information: |
|
64 | * This ISR launch different actions depending mainly on two pieces of information: | |
65 | * 1. the values read in the registers of the waveform picker. |
|
65 | * 1. the values read in the registers of the waveform picker. | |
66 | * 2. the current LFR mode. |
|
66 | * 2. the current LFR mode. | |
67 | * |
|
67 | * | |
68 | */ |
|
68 | */ | |
69 |
|
69 | |||
70 | rtems_status_code status; |
|
70 | rtems_status_code status; | |
71 |
|
71 | |||
72 | 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 |
|
72 | 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 | |
73 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
73 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) | |
74 | { // in modes other than STANDBY and BURST, send the CWF_F3 data |
|
74 | { // in modes other than STANDBY and BURST, send the CWF_F3 data | |
75 | if ((waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full |
|
75 | if ((waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full | |
76 | // (1) change the receiving buffer for the waveform picker |
|
76 | // (1) change the receiving buffer for the waveform picker | |
77 | ring_node_to_send_cwf_f3 = current_ring_node_f3; |
|
77 | ring_node_to_send_cwf_f3 = current_ring_node_f3; | |
78 | current_ring_node_f3 = current_ring_node_f3->next; |
|
78 | current_ring_node_f3 = current_ring_node_f3->next; | |
79 | waveform_picker_regs->addr_data_f3 = current_ring_node_f3->buffer_address; |
|
79 | waveform_picker_regs->addr_data_f3 = current_ring_node_f3->buffer_address; | |
80 | // (2) send an event for the waveforms transmission |
|
80 | // (2) send an event for the waveforms transmission | |
81 | if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
81 | if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { | |
82 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
82 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
83 | } |
|
83 | } | |
84 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2); |
|
84 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2); | |
85 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff777; // reset f3 bits to 0, [1111 0111 0111 0111] |
|
85 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff777; // reset f3 bits to 0, [1111 0111 0111 0111] | |
86 | } |
|
86 | } | |
87 | } |
|
87 | } | |
88 |
|
88 | |||
89 | switch(lfrCurrentMode) |
|
89 | switch(lfrCurrentMode) | |
90 | { |
|
90 | { | |
91 | //******** |
|
91 | //******** | |
92 | // STANDBY |
|
92 | // STANDBY | |
93 | case(LFR_MODE_STANDBY): |
|
93 | case(LFR_MODE_STANDBY): | |
94 | break; |
|
94 | break; | |
95 |
|
95 | |||
96 | //****** |
|
96 | //****** | |
97 | // NORMAL |
|
97 | // NORMAL | |
98 | case(LFR_MODE_NORMAL): |
|
98 | case(LFR_MODE_NORMAL): | |
99 | if ( (waveform_picker_regs->status & 0xff8) != 0x00) // [1000] check the error bits |
|
99 | if ( (waveform_picker_regs->status & 0xff8) != 0x00) // [1000] check the error bits | |
100 | { |
|
100 | { | |
101 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
101 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
102 | } |
|
102 | } | |
103 | if ( (waveform_picker_regs->status & 0x07) == 0x07) // [0111] check the f2, f1, f0 full bits |
|
103 | if ( (waveform_picker_regs->status & 0x07) == 0x07) // [0111] check the f2, f1, f0 full bits | |
104 | { |
|
104 | { | |
105 | // change F0 ring node |
|
105 | // change F0 ring node | |
106 | ring_node_to_send_swf_f0 = current_ring_node_f0; |
|
106 | ring_node_to_send_swf_f0 = current_ring_node_f0; | |
107 | current_ring_node_f0 = current_ring_node_f0->next; |
|
107 | current_ring_node_f0 = current_ring_node_f0->next; | |
108 | waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address; |
|
108 | waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address; | |
109 | // change F1 ring node |
|
109 | // change F1 ring node | |
110 | ring_node_to_send_swf_f1 = current_ring_node_f1; |
|
110 | ring_node_to_send_swf_f1 = current_ring_node_f1; | |
111 | current_ring_node_f1 = current_ring_node_f1->next; |
|
111 | current_ring_node_f1 = current_ring_node_f1->next; | |
112 | waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; |
|
112 | waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; | |
113 | // change F2 ring node |
|
113 | // change F2 ring node | |
114 | ring_node_to_send_swf_f2 = current_ring_node_f2; |
|
114 | ring_node_to_send_swf_f2 = current_ring_node_f2; | |
115 | current_ring_node_f2 = current_ring_node_f2->next; |
|
115 | current_ring_node_f2 = current_ring_node_f2->next; | |
116 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; |
|
116 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; | |
117 | // |
|
117 | // | |
118 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) |
|
118 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) | |
119 | { |
|
119 | { | |
120 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
120 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
121 | } |
|
121 | } | |
122 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff888; // [1000 1000 1000] |
|
122 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff888; // [1000 1000 1000] | |
123 | } |
|
123 | } | |
124 | break; |
|
124 | break; | |
125 |
|
125 | |||
126 | //****** |
|
126 | //****** | |
127 | // BURST |
|
127 | // BURST | |
128 | case(LFR_MODE_BURST): |
|
128 | case(LFR_MODE_BURST): | |
129 | if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit |
|
129 | if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit | |
130 | // (1) change the receiving buffer for the waveform picker |
|
130 | // (1) change the receiving buffer for the waveform picker | |
131 | ring_node_to_send_cwf_f2 = current_ring_node_f2; |
|
131 | ring_node_to_send_cwf_f2 = current_ring_node_f2; | |
132 | current_ring_node_f2 = current_ring_node_f2->next; |
|
132 | current_ring_node_f2 = current_ring_node_f2->next; | |
133 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; |
|
133 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; | |
134 | // (2) send an event for the waveforms transmission |
|
134 | // (2) send an event for the waveforms transmission | |
135 | if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) { |
|
135 | if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) { | |
136 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
136 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
137 | } |
|
137 | } | |
138 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0 |
|
138 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0 | |
139 | } |
|
139 | } | |
140 | break; |
|
140 | break; | |
141 |
|
141 | |||
142 | //***** |
|
142 | //***** | |
143 | // SBM1 |
|
143 | // SBM1 | |
144 | case(LFR_MODE_SBM1): |
|
144 | case(LFR_MODE_SBM1): | |
145 | if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit |
|
145 | if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit | |
146 | // (1) change the receiving buffer for the waveform picker |
|
146 | // (1) change the receiving buffer for the waveform picker | |
147 | ring_node_to_send_cwf_f1 = current_ring_node_f1; |
|
147 | ring_node_to_send_cwf_f1 = current_ring_node_f1; | |
148 | current_ring_node_f1 = current_ring_node_f1->next; |
|
148 | current_ring_node_f1 = current_ring_node_f1->next; | |
149 | waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; |
|
149 | waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; | |
150 | // (2) send an event for the the CWF1 task for transmission (and snapshot extraction if needed) |
|
150 | // (2) send an event for the the CWF1 task for transmission (and snapshot extraction if needed) | |
151 | status = rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 ); |
|
151 | status = rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 ); | |
152 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bits = 0 |
|
152 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bits = 0 | |
153 | } |
|
153 | } | |
154 | if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit |
|
154 | if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit | |
155 | swf_f0_ready = true; |
|
155 | swf_f0_ready = true; | |
156 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffeee; // [1111 1110 1110 1110] f0 bits = 0 |
|
156 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffeee; // [1111 1110 1110 1110] f0 bits = 0 | |
157 | } |
|
157 | } | |
158 | if ( (waveform_picker_regs->status & 0x04) == 0x04 ) { // [0100] check the f2 full bit |
|
158 | if ( (waveform_picker_regs->status & 0x04) == 0x04 ) { // [0100] check the f2 full bit | |
159 | swf_f2_ready = true; |
|
159 | swf_f2_ready = true; | |
160 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bits = 0 |
|
160 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bits = 0 | |
161 | } |
|
161 | } | |
162 | break; |
|
162 | break; | |
163 |
|
163 | |||
164 | //***** |
|
164 | //***** | |
165 | // SBM2 |
|
165 | // SBM2 | |
166 | case(LFR_MODE_SBM2): |
|
166 | case(LFR_MODE_SBM2): | |
167 | if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit |
|
167 | if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit | |
168 | // (1) change the receiving buffer for the waveform picker |
|
168 | // (1) change the receiving buffer for the waveform picker | |
169 | ring_node_to_send_cwf_f2 = current_ring_node_f2; |
|
169 | ring_node_to_send_cwf_f2 = current_ring_node_f2; | |
170 | current_ring_node_f2 = current_ring_node_f2->next; |
|
170 | current_ring_node_f2 = current_ring_node_f2->next; | |
171 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; |
|
171 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; | |
172 | // (2) send an event for the waveforms transmission |
|
172 | // (2) send an event for the waveforms transmission | |
173 | status = rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 ); |
|
173 | status = rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 ); | |
174 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0 |
|
174 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0 | |
175 | } |
|
175 | } | |
176 | if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit |
|
176 | if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit | |
177 | swf_f0_ready = true; |
|
177 | swf_f0_ready = true; | |
178 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffeee; // [1111 1110 1110 1110] f0 bits = 0 |
|
178 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffeee; // [1111 1110 1110 1110] f0 bits = 0 | |
179 | } |
|
179 | } | |
180 | if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit |
|
180 | if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit | |
181 | swf_f1_ready = true; |
|
181 | swf_f1_ready = true; | |
182 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1, f0 bits = 0 |
|
182 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1, f0 bits = 0 | |
183 | } |
|
183 | } | |
184 | break; |
|
184 | break; | |
185 |
|
185 | |||
186 | //******** |
|
186 | //******** | |
187 | // DEFAULT |
|
187 | // DEFAULT | |
188 | default: |
|
188 | default: | |
189 | break; |
|
189 | break; | |
190 | } |
|
190 | } | |
191 | } |
|
191 | } | |
192 |
|
192 | |||
193 | //************ |
|
193 | //************ | |
194 | // RTEMS TASKS |
|
194 | // RTEMS TASKS | |
195 |
|
195 | |||
196 | rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP |
|
196 | rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP | |
197 | { |
|
197 | { | |
198 | /** This RTEMS task is dedicated to the transmission of snapshots of the NORMAL mode. |
|
198 | /** This RTEMS task is dedicated to the transmission of snapshots of the NORMAL mode. | |
199 | * |
|
199 | * | |
200 | * @param unused is the starting argument of the RTEMS task |
|
200 | * @param unused is the starting argument of the RTEMS task | |
201 | * |
|
201 | * | |
202 | * The following data packets are sent by this task: |
|
202 | * The following data packets are sent by this task: | |
203 | * - TM_LFR_SCIENCE_NORMAL_SWF_F0 |
|
203 | * - TM_LFR_SCIENCE_NORMAL_SWF_F0 | |
204 | * - TM_LFR_SCIENCE_NORMAL_SWF_F1 |
|
204 | * - TM_LFR_SCIENCE_NORMAL_SWF_F1 | |
205 | * - TM_LFR_SCIENCE_NORMAL_SWF_F2 |
|
205 | * - TM_LFR_SCIENCE_NORMAL_SWF_F2 | |
206 | * |
|
206 | * | |
207 | */ |
|
207 | */ | |
208 |
|
208 | |||
209 | rtems_event_set event_out; |
|
209 | rtems_event_set event_out; | |
210 | rtems_id queue_id; |
|
210 | rtems_id queue_id; | |
211 | rtems_status_code status; |
|
211 | rtems_status_code status; | |
212 |
|
212 | |||
213 | init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 ); |
|
213 | init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 ); | |
214 | init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 ); |
|
214 | init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 ); | |
215 | init_header_snapshot_wf_table( SID_NORM_SWF_F2, headerSWF_F2 ); |
|
215 | init_header_snapshot_wf_table( SID_NORM_SWF_F2, headerSWF_F2 ); | |
216 |
|
216 | |||
217 | status = get_message_queue_id_send( &queue_id ); |
|
217 | status = get_message_queue_id_send( &queue_id ); | |
218 | if (status != RTEMS_SUCCESSFUL) |
|
218 | if (status != RTEMS_SUCCESSFUL) | |
219 | { |
|
219 | { | |
220 | PRINTF1("in WFRM *** ERR get_message_queue_id_send %d\n", status) |
|
220 | PRINTF1("in WFRM *** ERR get_message_queue_id_send %d\n", status) | |
221 | } |
|
221 | } | |
222 |
|
222 | |||
223 | BOOT_PRINTF("in WFRM ***\n") |
|
223 | BOOT_PRINTF("in WFRM ***\n") | |
224 |
|
224 | |||
225 | while(1){ |
|
225 | while(1){ | |
226 | // wait for an RTEMS_EVENT |
|
226 | // wait for an RTEMS_EVENT | |
227 | rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1 |
|
227 | rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1 | |
228 | | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM, |
|
228 | | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM, | |
229 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
229 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
230 | if (event_out == RTEMS_EVENT_MODE_NORMAL) |
|
230 | if (event_out == RTEMS_EVENT_MODE_NORMAL) | |
231 | { |
|
231 | { | |
232 | DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_NORMAL\n") |
|
232 | DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_NORMAL\n") | |
233 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id); |
|
233 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id); | |
234 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id); |
|
234 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id); | |
235 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id); |
|
235 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id); | |
236 | } |
|
236 | } | |
237 | if (event_out == RTEMS_EVENT_MODE_SBM1) |
|
237 | if (event_out == RTEMS_EVENT_MODE_SBM1) | |
238 | { |
|
238 | { | |
239 | DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM1\n") |
|
239 | DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM1\n") | |
240 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id); |
|
240 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id); | |
241 | send_waveform_SWF((volatile int*) wf_snap_extracted , SID_NORM_SWF_F1, headerSWF_F1, queue_id); |
|
241 | send_waveform_SWF((volatile int*) wf_snap_extracted , SID_NORM_SWF_F1, headerSWF_F1, queue_id); | |
242 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id); |
|
242 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id); | |
243 | } |
|
243 | } | |
244 | if (event_out == RTEMS_EVENT_MODE_SBM2) |
|
244 | if (event_out == RTEMS_EVENT_MODE_SBM2) | |
245 | { |
|
245 | { | |
246 | DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM2\n") |
|
246 | DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM2\n") | |
247 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id); |
|
247 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id); | |
248 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id); |
|
248 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id); | |
249 | send_waveform_SWF((volatile int*) wf_snap_extracted , SID_NORM_SWF_F2, headerSWF_F2, queue_id); |
|
249 | send_waveform_SWF((volatile int*) wf_snap_extracted , SID_NORM_SWF_F2, headerSWF_F2, queue_id); | |
250 | } |
|
250 | } | |
251 | } |
|
251 | } | |
252 | } |
|
252 | } | |
253 |
|
253 | |||
254 | rtems_task cwf3_task(rtems_task_argument argument) //used with the waveform picker VHDL IP |
|
254 | rtems_task cwf3_task(rtems_task_argument argument) //used with the waveform picker VHDL IP | |
255 | { |
|
255 | { | |
256 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f3. |
|
256 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f3. | |
257 | * |
|
257 | * | |
258 | * @param unused is the starting argument of the RTEMS task |
|
258 | * @param unused is the starting argument of the RTEMS task | |
259 | * |
|
259 | * | |
260 | * The following data packet is sent by this task: |
|
260 | * The following data packet is sent by this task: | |
261 | * - TM_LFR_SCIENCE_NORMAL_CWF_F3 |
|
261 | * - TM_LFR_SCIENCE_NORMAL_CWF_F3 | |
262 | * |
|
262 | * | |
263 | */ |
|
263 | */ | |
264 |
|
264 | |||
265 | rtems_event_set event_out; |
|
265 | rtems_event_set event_out; | |
266 | rtems_id queue_id; |
|
266 | rtems_id queue_id; | |
267 | rtems_status_code status; |
|
267 | rtems_status_code status; | |
268 |
|
268 | |||
269 | init_header_continuous_wf_table( SID_NORM_CWF_LONG_F3, headerCWF_F3 ); |
|
269 | init_header_continuous_wf_table( SID_NORM_CWF_LONG_F3, headerCWF_F3 ); | |
270 | init_header_continuous_cwf3_light_table( headerCWF_F3_light ); |
|
270 | init_header_continuous_cwf3_light_table( headerCWF_F3_light ); | |
271 |
|
271 | |||
272 | status = get_message_queue_id_send( &queue_id ); |
|
272 | status = get_message_queue_id_send( &queue_id ); | |
273 | if (status != RTEMS_SUCCESSFUL) |
|
273 | if (status != RTEMS_SUCCESSFUL) | |
274 | { |
|
274 | { | |
275 | PRINTF1("in CWF3 *** ERR get_message_queue_id_send %d\n", status) |
|
275 | PRINTF1("in CWF3 *** ERR get_message_queue_id_send %d\n", status) | |
276 | } |
|
276 | } | |
277 |
|
277 | |||
278 | BOOT_PRINTF("in CWF3 ***\n") |
|
278 | BOOT_PRINTF("in CWF3 ***\n") | |
279 |
|
279 | |||
280 | while(1){ |
|
280 | while(1){ | |
281 | // wait for an RTEMS_EVENT |
|
281 | // wait for an RTEMS_EVENT | |
282 | rtems_event_receive( RTEMS_EVENT_0, |
|
282 | rtems_event_receive( RTEMS_EVENT_0, | |
283 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
283 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
284 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) |
|
284 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) | |
285 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode==LFR_MODE_SBM2) ) |
|
285 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode==LFR_MODE_SBM2) ) | |
286 | { |
|
286 | { | |
287 | if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01) |
|
287 | if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01) | |
288 | { |
|
288 | { | |
289 | PRINTF("send CWF_LONG_F3\n") |
|
289 | PRINTF("send CWF_LONG_F3\n") | |
290 | send_waveform_CWF( |
|
290 | send_waveform_CWF( | |
291 | (volatile int*) ring_node_to_send_cwf_f3->buffer_address, |
|
291 | (volatile int*) ring_node_to_send_cwf_f3->buffer_address, | |
292 | SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id ); |
|
292 | SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id ); | |
293 | } |
|
293 | } | |
294 | else |
|
294 | else | |
295 | { |
|
295 | { | |
296 | PRINTF("send CWF_F3 (light)\n") |
|
296 | PRINTF("send CWF_F3 (light)\n") | |
297 | send_waveform_CWF3_light( |
|
297 | send_waveform_CWF3_light( | |
298 | (volatile int*) ring_node_to_send_cwf_f3->buffer_address, |
|
298 | (volatile int*) ring_node_to_send_cwf_f3->buffer_address, | |
299 | headerCWF_F3_light, queue_id ); |
|
299 | headerCWF_F3_light, queue_id ); | |
300 | } |
|
300 | } | |
301 |
|
301 | |||
302 | } |
|
302 | } | |
303 | else |
|
303 | else | |
304 | { |
|
304 | { | |
305 | PRINTF1("in CWF3 *** lfrCurrentMode is %d, no data will be sent\n", lfrCurrentMode) |
|
305 | PRINTF1("in CWF3 *** lfrCurrentMode is %d, no data will be sent\n", lfrCurrentMode) | |
306 | } |
|
306 | } | |
307 | } |
|
307 | } | |
308 | } |
|
308 | } | |
309 |
|
309 | |||
310 | rtems_task cwf2_task(rtems_task_argument argument) // ONLY USED IN BURST AND SBM2 |
|
310 | rtems_task cwf2_task(rtems_task_argument argument) // ONLY USED IN BURST AND SBM2 | |
311 | { |
|
311 | { | |
312 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f2. |
|
312 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f2. | |
313 | * |
|
313 | * | |
314 | * @param unused is the starting argument of the RTEMS task |
|
314 | * @param unused is the starting argument of the RTEMS task | |
315 | * |
|
315 | * | |
316 | * The following data packet is sent by this function: |
|
316 | * The following data packet is sent by this function: | |
317 | * - TM_LFR_SCIENCE_BURST_CWF_F2 |
|
317 | * - TM_LFR_SCIENCE_BURST_CWF_F2 | |
318 | * - TM_LFR_SCIENCE_SBM2_CWF_F2 |
|
318 | * - TM_LFR_SCIENCE_SBM2_CWF_F2 | |
319 | * |
|
319 | * | |
320 | */ |
|
320 | */ | |
321 |
|
321 | |||
322 | rtems_event_set event_out; |
|
322 | rtems_event_set event_out; | |
323 | rtems_id queue_id; |
|
323 | rtems_id queue_id; | |
324 | rtems_status_code status; |
|
324 | rtems_status_code status; | |
325 |
|
325 | |||
326 | init_header_continuous_wf_table( SID_BURST_CWF_F2, headerCWF_F2_BURST ); |
|
326 | init_header_continuous_wf_table( SID_BURST_CWF_F2, headerCWF_F2_BURST ); | |
327 | init_header_continuous_wf_table( SID_SBM2_CWF_F2, headerCWF_F2_SBM2 ); |
|
327 | init_header_continuous_wf_table( SID_SBM2_CWF_F2, headerCWF_F2_SBM2 ); | |
328 |
|
328 | |||
329 | status = get_message_queue_id_send( &queue_id ); |
|
329 | status = get_message_queue_id_send( &queue_id ); | |
330 | if (status != RTEMS_SUCCESSFUL) |
|
330 | if (status != RTEMS_SUCCESSFUL) | |
331 | { |
|
331 | { | |
332 | PRINTF1("in CWF2 *** ERR get_message_queue_id_send %d\n", status) |
|
332 | PRINTF1("in CWF2 *** ERR get_message_queue_id_send %d\n", status) | |
333 | } |
|
333 | } | |
334 |
|
334 | |||
335 | BOOT_PRINTF("in CWF2 ***\n") |
|
335 | BOOT_PRINTF("in CWF2 ***\n") | |
336 |
|
336 | |||
337 | while(1){ |
|
337 | while(1){ | |
338 | // wait for an RTEMS_EVENT |
|
338 | // wait for an RTEMS_EVENT | |
339 | rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2, |
|
339 | rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2, | |
340 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
340 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
341 | if (event_out == RTEMS_EVENT_MODE_BURST) |
|
341 | if (event_out == RTEMS_EVENT_MODE_BURST) | |
342 | { |
|
342 | { | |
343 | send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id ); |
|
343 | send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id ); | |
344 | } |
|
344 | } | |
345 | if (event_out == RTEMS_EVENT_MODE_SBM2) |
|
345 | if (event_out == RTEMS_EVENT_MODE_SBM2) | |
346 | { |
|
346 | { | |
347 | send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id ); |
|
347 | send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id ); | |
348 | // launch snapshot extraction if needed |
|
348 | // launch snapshot extraction if needed | |
349 | if (extractSWF == true) |
|
349 | if (extractSWF == true) | |
350 | { |
|
350 | { | |
351 | ring_node_to_send_swf_f2 = ring_node_to_send_cwf_f2; |
|
351 | ring_node_to_send_swf_f2 = ring_node_to_send_cwf_f2; | |
352 | // extract the snapshot |
|
352 | // extract the snapshot | |
353 | build_snapshot_from_ring( ring_node_to_send_swf_f2, 2 ); |
|
353 | build_snapshot_from_ring( ring_node_to_send_swf_f2, 2 ); | |
354 | // send the snapshot when built |
|
354 | // send the snapshot when built | |
355 | status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 ); |
|
355 | status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 ); | |
356 | extractSWF = false; |
|
356 | extractSWF = false; | |
357 | } |
|
357 | } | |
358 | if (swf_f0_ready && swf_f1_ready) |
|
358 | if (swf_f0_ready && swf_f1_ready) | |
359 | { |
|
359 | { | |
360 | extractSWF = true; |
|
360 | extractSWF = true; | |
361 | swf_f0_ready = false; |
|
361 | swf_f0_ready = false; | |
362 | swf_f1_ready = false; |
|
362 | swf_f1_ready = false; | |
363 | } |
|
363 | } | |
364 | } |
|
364 | } | |
365 | } |
|
365 | } | |
366 | } |
|
366 | } | |
367 |
|
367 | |||
368 | rtems_task cwf1_task(rtems_task_argument argument) // ONLY USED IN SBM1 |
|
368 | rtems_task cwf1_task(rtems_task_argument argument) // ONLY USED IN SBM1 | |
369 | { |
|
369 | { | |
370 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f1. |
|
370 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f1. | |
371 | * |
|
371 | * | |
372 | * @param unused is the starting argument of the RTEMS task |
|
372 | * @param unused is the starting argument of the RTEMS task | |
373 | * |
|
373 | * | |
374 | * The following data packet is sent by this function: |
|
374 | * The following data packet is sent by this function: | |
375 | * - TM_LFR_SCIENCE_SBM1_CWF_F1 |
|
375 | * - TM_LFR_SCIENCE_SBM1_CWF_F1 | |
376 | * |
|
376 | * | |
377 | */ |
|
377 | */ | |
378 |
|
378 | |||
379 | rtems_event_set event_out; |
|
379 | rtems_event_set event_out; | |
380 | rtems_id queue_id; |
|
380 | rtems_id queue_id; | |
381 | rtems_status_code status; |
|
381 | rtems_status_code status; | |
382 |
|
382 | |||
383 | init_header_continuous_wf_table( SID_SBM1_CWF_F1, headerCWF_F1 ); |
|
383 | init_header_continuous_wf_table( SID_SBM1_CWF_F1, headerCWF_F1 ); | |
384 |
|
384 | |||
385 | status = get_message_queue_id_send( &queue_id ); |
|
385 | status = get_message_queue_id_send( &queue_id ); | |
386 | if (status != RTEMS_SUCCESSFUL) |
|
386 | if (status != RTEMS_SUCCESSFUL) | |
387 | { |
|
387 | { | |
388 | PRINTF1("in CWF1 *** ERR get_message_queue_id_send %d\n", status) |
|
388 | PRINTF1("in CWF1 *** ERR get_message_queue_id_send %d\n", status) | |
389 | } |
|
389 | } | |
390 |
|
390 | |||
391 | BOOT_PRINTF("in CWF1 ***\n") |
|
391 | BOOT_PRINTF("in CWF1 ***\n") | |
392 |
|
392 | |||
393 | while(1){ |
|
393 | while(1){ | |
394 | // wait for an RTEMS_EVENT |
|
394 | // wait for an RTEMS_EVENT | |
395 | rtems_event_receive( RTEMS_EVENT_MODE_SBM1, |
|
395 | rtems_event_receive( RTEMS_EVENT_MODE_SBM1, | |
396 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
396 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
397 | send_waveform_CWF( (volatile int*) ring_node_to_send_cwf_f1->buffer_address, SID_SBM1_CWF_F1, headerCWF_F1, queue_id ); |
|
397 | send_waveform_CWF( (volatile int*) ring_node_to_send_cwf_f1->buffer_address, SID_SBM1_CWF_F1, headerCWF_F1, queue_id ); | |
398 | // launch snapshot extraction if needed |
|
398 | // launch snapshot extraction if needed | |
399 | if (extractSWF == true) |
|
399 | if (extractSWF == true) | |
400 | { |
|
400 | { | |
401 | ring_node_to_send_swf_f1 = ring_node_to_send_cwf_f1; |
|
401 | ring_node_to_send_swf_f1 = ring_node_to_send_cwf_f1; | |
402 | // launch the snapshot extraction |
|
402 | // launch the snapshot extraction | |
403 | status = rtems_event_send( Task_id[TASKID_SWBD], RTEMS_EVENT_MODE_SBM1 ); |
|
403 | status = rtems_event_send( Task_id[TASKID_SWBD], RTEMS_EVENT_MODE_SBM1 ); | |
404 | extractSWF = false; |
|
404 | extractSWF = false; | |
405 | } |
|
405 | } | |
406 | if (swf_f0_ready == true) |
|
406 | if (swf_f0_ready == true) | |
407 | { |
|
407 | { | |
408 | extractSWF = true; |
|
408 | extractSWF = true; | |
409 | swf_f0_ready = false; // this step shall be executed only one time |
|
409 | swf_f0_ready = false; // this step shall be executed only one time | |
410 | } |
|
410 | } | |
411 | if ((swf_f1_ready == true) && (swf_f2_ready == true)) // swf_f1 is ready after the extraction |
|
411 | if ((swf_f1_ready == true) && (swf_f2_ready == true)) // swf_f1 is ready after the extraction | |
412 | { |
|
412 | { | |
413 | status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM1 ); |
|
413 | status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM1 ); | |
414 | swf_f1_ready = false; |
|
414 | swf_f1_ready = false; | |
415 | swf_f2_ready = false; |
|
415 | swf_f2_ready = false; | |
416 | } |
|
416 | } | |
417 | } |
|
417 | } | |
418 | } |
|
418 | } | |
419 |
|
419 | |||
420 | rtems_task swbd_task(rtems_task_argument argument) |
|
420 | rtems_task swbd_task(rtems_task_argument argument) | |
421 | { |
|
421 | { | |
422 | /** This RTEMS task is dedicated to the building of snapshots from different continuous waveforms buffers. |
|
422 | /** This RTEMS task is dedicated to the building of snapshots from different continuous waveforms buffers. | |
423 | * |
|
423 | * | |
424 | * @param unused is the starting argument of the RTEMS task |
|
424 | * @param unused is the starting argument of the RTEMS task | |
425 | * |
|
425 | * | |
426 | */ |
|
426 | */ | |
427 |
|
427 | |||
428 | rtems_event_set event_out; |
|
428 | rtems_event_set event_out; | |
429 |
|
429 | |||
430 | BOOT_PRINTF("in SWBD ***\n") |
|
430 | BOOT_PRINTF("in SWBD ***\n") | |
431 |
|
431 | |||
432 | while(1){ |
|
432 | while(1){ | |
433 | // wait for an RTEMS_EVENT |
|
433 | // wait for an RTEMS_EVENT | |
434 | rtems_event_receive( RTEMS_EVENT_MODE_SBM1 | RTEMS_EVENT_MODE_SBM2, |
|
434 | rtems_event_receive( RTEMS_EVENT_MODE_SBM1 | RTEMS_EVENT_MODE_SBM2, | |
435 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
435 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
436 | if (event_out == RTEMS_EVENT_MODE_SBM1) |
|
436 | if (event_out == RTEMS_EVENT_MODE_SBM1) | |
437 | { |
|
437 | { | |
438 | build_snapshot_from_ring( ring_node_to_send_swf_f1, 1 ); |
|
438 | build_snapshot_from_ring( ring_node_to_send_swf_f1, 1 ); | |
439 | swf_f1_ready = true; // the snapshot has been extracted and is ready to be sent |
|
439 | swf_f1_ready = true; // the snapshot has been extracted and is ready to be sent | |
440 | } |
|
440 | } | |
441 | else |
|
441 | else | |
442 | { |
|
442 | { | |
443 | PRINTF1("in SWBD *** unexpected rtems event received %x\n", (int) event_out) |
|
443 | PRINTF1("in SWBD *** unexpected rtems event received %x\n", (int) event_out) | |
444 | } |
|
444 | } | |
445 | } |
|
445 | } | |
446 | } |
|
446 | } | |
447 |
|
447 | |||
448 | //****************** |
|
448 | //****************** | |
449 | // general functions |
|
449 | // general functions | |
450 |
|
450 | |||
451 | void WFP_init_rings( void ) |
|
451 | void WFP_init_rings( void ) | |
452 | { |
|
452 | { | |
453 | // F0 RING |
|
453 | // F0 RING | |
454 | init_waveform_ring( waveform_ring_f0, NB_RING_NODES_F0, wf_snap_f0 ); |
|
454 | init_waveform_ring( waveform_ring_f0, NB_RING_NODES_F0, wf_snap_f0 ); | |
455 | // F1 RING |
|
455 | // F1 RING | |
456 | init_waveform_ring( waveform_ring_f1, NB_RING_NODES_F1, wf_snap_f1 ); |
|
456 | init_waveform_ring( waveform_ring_f1, NB_RING_NODES_F1, wf_snap_f1 ); | |
457 | // F2 RING |
|
457 | // F2 RING | |
458 | init_waveform_ring( waveform_ring_f2, NB_RING_NODES_F2, wf_snap_f2 ); |
|
458 | init_waveform_ring( waveform_ring_f2, NB_RING_NODES_F2, wf_snap_f2 ); | |
459 | // F3 RING |
|
459 | // F3 RING | |
460 | init_waveform_ring( waveform_ring_f3, NB_RING_NODES_F3, wf_cont_f3 ); |
|
460 | init_waveform_ring( waveform_ring_f3, NB_RING_NODES_F3, wf_cont_f3 ); | |
461 |
|
461 | |||
462 | DEBUG_PRINTF1("waveform_ring_f0 @%x\n", (unsigned int) waveform_ring_f0) |
|
462 | DEBUG_PRINTF1("waveform_ring_f0 @%x\n", (unsigned int) waveform_ring_f0) | |
463 | DEBUG_PRINTF1("waveform_ring_f1 @%x\n", (unsigned int) waveform_ring_f1) |
|
463 | DEBUG_PRINTF1("waveform_ring_f1 @%x\n", (unsigned int) waveform_ring_f1) | |
464 | DEBUG_PRINTF1("waveform_ring_f2 @%x\n", (unsigned int) waveform_ring_f2) |
|
464 | DEBUG_PRINTF1("waveform_ring_f2 @%x\n", (unsigned int) waveform_ring_f2) | |
465 | DEBUG_PRINTF1("waveform_ring_f3 @%x\n", (unsigned int) waveform_ring_f3) |
|
465 | DEBUG_PRINTF1("waveform_ring_f3 @%x\n", (unsigned int) waveform_ring_f3) | |
466 | } |
|
466 | } | |
467 |
|
467 | |||
468 | void init_waveform_ring(ring_node waveform_ring[], unsigned char nbNodes, volatile int wfrm[] ) |
|
468 | void init_waveform_ring(ring_node waveform_ring[], unsigned char nbNodes, volatile int wfrm[] ) | |
469 | { |
|
469 | { | |
470 | unsigned char i; |
|
470 | unsigned char i; | |
471 |
|
471 | |||
472 | waveform_ring[0].next = (ring_node*) &waveform_ring[ 1 ]; |
|
472 | waveform_ring[0].next = (ring_node*) &waveform_ring[ 1 ]; | |
473 | waveform_ring[0].previous = (ring_node*) &waveform_ring[ nbNodes - 1 ]; |
|
473 | waveform_ring[0].previous = (ring_node*) &waveform_ring[ nbNodes - 1 ]; | |
474 | waveform_ring[0].buffer_address = (int) &wfrm[0]; |
|
474 | waveform_ring[0].buffer_address = (int) &wfrm[0]; | |
475 |
|
475 | |||
476 | waveform_ring[nbNodes-1].next = (ring_node*) &waveform_ring[ 0 ]; |
|
476 | waveform_ring[nbNodes-1].next = (ring_node*) &waveform_ring[ 0 ]; | |
477 | waveform_ring[nbNodes-1].previous = (ring_node*) &waveform_ring[ nbNodes - 2 ]; |
|
477 | waveform_ring[nbNodes-1].previous = (ring_node*) &waveform_ring[ nbNodes - 2 ]; | |
478 | waveform_ring[nbNodes-1].buffer_address = (int) &wfrm[ (nbNodes-1) * WFRM_BUFFER ]; |
|
478 | waveform_ring[nbNodes-1].buffer_address = (int) &wfrm[ (nbNodes-1) * WFRM_BUFFER ]; | |
479 |
|
479 | |||
480 | for(i=1; i<nbNodes-1; i++) |
|
480 | for(i=1; i<nbNodes-1; i++) | |
481 | { |
|
481 | { | |
482 | waveform_ring[i].next = (ring_node*) &waveform_ring[ i + 1 ]; |
|
482 | waveform_ring[i].next = (ring_node*) &waveform_ring[ i + 1 ]; | |
483 | waveform_ring[i].previous = (ring_node*) &waveform_ring[ i - 1 ]; |
|
483 | waveform_ring[i].previous = (ring_node*) &waveform_ring[ i - 1 ]; | |
484 | waveform_ring[i].buffer_address = (int) &wfrm[ i * WFRM_BUFFER ]; |
|
484 | waveform_ring[i].buffer_address = (int) &wfrm[ i * WFRM_BUFFER ]; | |
485 | } |
|
485 | } | |
486 | } |
|
486 | } | |
487 |
|
487 | |||
488 | void WFP_reset_current_ring_nodes( void ) |
|
488 | void WFP_reset_current_ring_nodes( void ) | |
489 | { |
|
489 | { | |
490 | current_ring_node_f0 = waveform_ring_f0; |
|
490 | current_ring_node_f0 = waveform_ring_f0; | |
491 | ring_node_to_send_swf_f0 = waveform_ring_f0; |
|
491 | ring_node_to_send_swf_f0 = waveform_ring_f0; | |
492 |
|
492 | |||
493 | current_ring_node_f1 = waveform_ring_f1; |
|
493 | current_ring_node_f1 = waveform_ring_f1; | |
494 | ring_node_to_send_cwf_f1 = waveform_ring_f1; |
|
494 | ring_node_to_send_cwf_f1 = waveform_ring_f1; | |
495 | ring_node_to_send_swf_f1 = waveform_ring_f1; |
|
495 | ring_node_to_send_swf_f1 = waveform_ring_f1; | |
496 |
|
496 | |||
497 | current_ring_node_f2 = waveform_ring_f2; |
|
497 | current_ring_node_f2 = waveform_ring_f2; | |
498 | ring_node_to_send_cwf_f2 = waveform_ring_f2; |
|
498 | ring_node_to_send_cwf_f2 = waveform_ring_f2; | |
499 | ring_node_to_send_swf_f2 = waveform_ring_f2; |
|
499 | ring_node_to_send_swf_f2 = waveform_ring_f2; | |
500 |
|
500 | |||
501 | current_ring_node_f3 = waveform_ring_f3; |
|
501 | current_ring_node_f3 = waveform_ring_f3; | |
502 | ring_node_to_send_cwf_f3 = waveform_ring_f3; |
|
502 | ring_node_to_send_cwf_f3 = waveform_ring_f3; | |
503 | } |
|
503 | } | |
504 |
|
504 | |||
505 | int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF) |
|
505 | int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF) | |
506 | { |
|
506 | { | |
507 | unsigned char i; |
|
507 | unsigned char i; | |
508 |
|
508 | |||
509 | for (i=0; i<7; i++) |
|
509 | for (i=0; i<7; i++) | |
510 | { |
|
510 | { | |
511 | headerSWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
511 | headerSWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; | |
512 | headerSWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
512 | headerSWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
513 | headerSWF[ i ].reserved = DEFAULT_RESERVED; |
|
513 | headerSWF[ i ].reserved = DEFAULT_RESERVED; | |
514 | headerSWF[ i ].userApplication = CCSDS_USER_APP; |
|
514 | headerSWF[ i ].userApplication = CCSDS_USER_APP; | |
515 | headerSWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8); |
|
515 | headerSWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8); | |
516 | headerSWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST); |
|
516 | headerSWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST); | |
517 | headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
517 | headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
518 | if (i == 6) |
|
518 | if (i == 6) | |
519 | { |
|
519 | { | |
520 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_224 >> 8); |
|
520 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_224 >> 8); | |
521 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_224 ); |
|
521 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_224 ); | |
522 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_224 >> 8); |
|
522 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_224 >> 8); | |
523 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_224 ); |
|
523 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_224 ); | |
524 | } |
|
524 | } | |
525 | else |
|
525 | else | |
526 | { |
|
526 | { | |
527 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_304 >> 8); |
|
527 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_304 >> 8); | |
528 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_304 ); |
|
528 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_304 ); | |
529 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_304 >> 8); |
|
529 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_304 >> 8); | |
530 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_304 ); |
|
530 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_304 ); | |
531 | } |
|
531 | } | |
532 | headerSWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
532 | headerSWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
533 | headerSWF[ i ].pktCnt = DEFAULT_PKTCNT; // PKT_CNT |
|
533 | headerSWF[ i ].pktCnt = DEFAULT_PKTCNT; // PKT_CNT | |
534 | headerSWF[ i ].pktNr = i+1; // PKT_NR |
|
534 | headerSWF[ i ].pktNr = i+1; // PKT_NR | |
535 | // DATA FIELD HEADER |
|
535 | // DATA FIELD HEADER | |
536 | headerSWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
536 | headerSWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
537 | headerSWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
537 | headerSWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
538 | headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
538 | headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
539 | headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; |
|
539 | headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; | |
540 | // AUXILIARY DATA HEADER |
|
540 | // AUXILIARY DATA HEADER | |
541 | headerSWF[ i ].time[0] = 0x00; |
|
541 | headerSWF[ i ].time[0] = 0x00; | |
542 | headerSWF[ i ].time[0] = 0x00; |
|
542 | headerSWF[ i ].time[0] = 0x00; | |
543 | headerSWF[ i ].time[0] = 0x00; |
|
543 | headerSWF[ i ].time[0] = 0x00; | |
544 | headerSWF[ i ].time[0] = 0x00; |
|
544 | headerSWF[ i ].time[0] = 0x00; | |
545 | headerSWF[ i ].time[0] = 0x00; |
|
545 | headerSWF[ i ].time[0] = 0x00; | |
546 | headerSWF[ i ].time[0] = 0x00; |
|
546 | headerSWF[ i ].time[0] = 0x00; | |
547 | headerSWF[ i ].sid = sid; |
|
547 | headerSWF[ i ].sid = sid; | |
548 | headerSWF[ i ].hkBIA = DEFAULT_HKBIA; |
|
548 | headerSWF[ i ].hkBIA = DEFAULT_HKBIA; | |
549 | } |
|
549 | } | |
550 | return LFR_SUCCESSFUL; |
|
550 | return LFR_SUCCESSFUL; | |
551 | } |
|
551 | } | |
552 |
|
552 | |||
553 | int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF ) |
|
553 | int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF ) | |
554 | { |
|
554 | { | |
555 | unsigned int i; |
|
555 | unsigned int i; | |
556 |
|
556 | |||
557 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF; i++) |
|
557 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF; i++) | |
558 | { |
|
558 | { | |
559 | headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
559 | headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; | |
560 | headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
560 | headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
561 | headerCWF[ i ].reserved = DEFAULT_RESERVED; |
|
561 | headerCWF[ i ].reserved = DEFAULT_RESERVED; | |
562 | headerCWF[ i ].userApplication = CCSDS_USER_APP; |
|
562 | headerCWF[ i ].userApplication = CCSDS_USER_APP; | |
563 | if ( (sid == SID_SBM1_CWF_F1) || (sid == SID_SBM2_CWF_F2) ) |
|
563 | if ( (sid == SID_SBM1_CWF_F1) || (sid == SID_SBM2_CWF_F2) ) | |
564 | { |
|
564 | { | |
565 | headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_SBM1_SBM2 >> 8); |
|
565 | headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_SBM1_SBM2 >> 8); | |
566 | headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_SBM1_SBM2); |
|
566 | headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_SBM1_SBM2); | |
567 | } |
|
567 | } | |
568 | else |
|
568 | else | |
569 | { |
|
569 | { | |
570 | headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8); |
|
570 | headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8); | |
571 | headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST); |
|
571 | headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST); | |
572 | } |
|
572 | } | |
573 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
573 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
574 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_336 >> 8); |
|
574 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_336 >> 8); | |
575 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_336 ); |
|
575 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_336 ); | |
576 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF >> 8); |
|
576 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF >> 8); | |
577 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF ); |
|
577 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF ); | |
578 | headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
578 | headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
579 | // DATA FIELD HEADER |
|
579 | // DATA FIELD HEADER | |
580 | headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
580 | headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
581 | headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
581 | headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
582 | headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
582 | headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
583 | headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; |
|
583 | headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; | |
584 | // AUXILIARY DATA HEADER |
|
584 | // AUXILIARY DATA HEADER | |
585 | headerCWF[ i ].sid = sid; |
|
585 | headerCWF[ i ].sid = sid; | |
586 | headerCWF[ i ].hkBIA = DEFAULT_HKBIA; |
|
586 | headerCWF[ i ].hkBIA = DEFAULT_HKBIA; | |
587 | headerCWF[ i ].time[0] = 0x00; |
|
587 | headerCWF[ i ].time[0] = 0x00; | |
588 | headerCWF[ i ].time[0] = 0x00; |
|
588 | headerCWF[ i ].time[0] = 0x00; | |
589 | headerCWF[ i ].time[0] = 0x00; |
|
589 | headerCWF[ i ].time[0] = 0x00; | |
590 | headerCWF[ i ].time[0] = 0x00; |
|
590 | headerCWF[ i ].time[0] = 0x00; | |
591 | headerCWF[ i ].time[0] = 0x00; |
|
591 | headerCWF[ i ].time[0] = 0x00; | |
592 | headerCWF[ i ].time[0] = 0x00; |
|
592 | headerCWF[ i ].time[0] = 0x00; | |
593 | } |
|
593 | } | |
594 | return LFR_SUCCESSFUL; |
|
594 | return LFR_SUCCESSFUL; | |
595 | } |
|
595 | } | |
596 |
|
596 | |||
597 | int init_header_continuous_cwf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF ) |
|
597 | int init_header_continuous_cwf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF ) | |
598 | { |
|
598 | { | |
599 | unsigned int i; |
|
599 | unsigned int i; | |
600 |
|
600 | |||
601 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF_LIGHT; i++) |
|
601 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF_LIGHT; i++) | |
602 | { |
|
602 | { | |
603 | headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
603 | headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; | |
604 | headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
604 | headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
605 | headerCWF[ i ].reserved = DEFAULT_RESERVED; |
|
605 | headerCWF[ i ].reserved = DEFAULT_RESERVED; | |
606 | headerCWF[ i ].userApplication = CCSDS_USER_APP; |
|
606 | headerCWF[ i ].userApplication = CCSDS_USER_APP; | |
607 |
|
607 | |||
608 | headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8); |
|
608 | headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8); | |
609 | headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST); |
|
609 | headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST); | |
610 |
|
610 | |||
611 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
611 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
612 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_672 >> 8); |
|
612 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_672 >> 8); | |
613 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_672 ); |
|
613 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_672 ); | |
614 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF_SHORT_F3 >> 8); |
|
614 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF_SHORT_F3 >> 8); | |
615 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF_SHORT_F3 ); |
|
615 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF_SHORT_F3 ); | |
616 |
|
616 | |||
617 | headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
617 | headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
618 | // DATA FIELD HEADER |
|
618 | // DATA FIELD HEADER | |
619 | headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
619 | headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
620 | headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
620 | headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
621 | headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
621 | headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
622 | headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; |
|
622 | headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; | |
623 | // AUXILIARY DATA HEADER |
|
623 | // AUXILIARY DATA HEADER | |
624 | headerCWF[ i ].sid = SID_NORM_CWF_F3; |
|
624 | headerCWF[ i ].sid = SID_NORM_CWF_F3; | |
625 | headerCWF[ i ].hkBIA = DEFAULT_HKBIA; |
|
625 | headerCWF[ i ].hkBIA = DEFAULT_HKBIA; | |
626 | headerCWF[ i ].time[0] = 0x00; |
|
626 | headerCWF[ i ].time[0] = 0x00; | |
627 | headerCWF[ i ].time[0] = 0x00; |
|
627 | headerCWF[ i ].time[0] = 0x00; | |
628 | headerCWF[ i ].time[0] = 0x00; |
|
628 | headerCWF[ i ].time[0] = 0x00; | |
629 | headerCWF[ i ].time[0] = 0x00; |
|
629 | headerCWF[ i ].time[0] = 0x00; | |
630 | headerCWF[ i ].time[0] = 0x00; |
|
630 | headerCWF[ i ].time[0] = 0x00; | |
631 | headerCWF[ i ].time[0] = 0x00; |
|
631 | headerCWF[ i ].time[0] = 0x00; | |
632 | } |
|
632 | } | |
633 | return LFR_SUCCESSFUL; |
|
633 | return LFR_SUCCESSFUL; | |
634 | } |
|
634 | } | |
635 |
|
635 | |||
636 | int send_waveform_SWF( volatile int *waveform, unsigned int sid, |
|
636 | int send_waveform_SWF( volatile int *waveform, unsigned int sid, | |
637 | Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id ) |
|
637 | Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id ) | |
638 | { |
|
638 | { | |
639 | /** This function sends SWF CCSDS packets (F2, F1 or F0). |
|
639 | /** This function sends SWF CCSDS packets (F2, F1 or F0). | |
640 | * |
|
640 | * | |
641 | * @param waveform points to the buffer containing the data that will be send. |
|
641 | * @param waveform points to the buffer containing the data that will be send. | |
642 | * @param sid is the source identifier of the data that will be sent. |
|
642 | * @param sid is the source identifier of the data that will be sent. | |
643 | * @param headerSWF points to a table of headers that have been prepared for the data transmission. |
|
643 | * @param headerSWF points to a table of headers that have been prepared for the data transmission. | |
644 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures |
|
644 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures | |
645 | * contain information to setup the transmission of the data packets. |
|
645 | * contain information to setup the transmission of the data packets. | |
646 | * |
|
646 | * | |
647 | * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks. |
|
647 | * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks. | |
648 | * |
|
648 | * | |
649 | */ |
|
649 | */ | |
650 |
|
650 | |||
651 | unsigned int i; |
|
651 | unsigned int i; | |
652 | int ret; |
|
652 | int ret; | |
653 | unsigned int coarseTime; |
|
653 | unsigned int coarseTime; | |
654 | unsigned int fineTime; |
|
654 | unsigned int fineTime; | |
655 | rtems_status_code status; |
|
655 | rtems_status_code status; | |
656 | spw_ioctl_pkt_send spw_ioctl_send_SWF; |
|
656 | spw_ioctl_pkt_send spw_ioctl_send_SWF; | |
657 |
|
657 | |||
658 | spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header |
|
658 | spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header | |
659 | spw_ioctl_send_SWF.options = 0; |
|
659 | spw_ioctl_send_SWF.options = 0; | |
660 |
|
660 | |||
661 | ret = LFR_DEFAULT; |
|
661 | ret = LFR_DEFAULT; | |
662 |
|
662 | |||
663 | coarseTime = waveform[0]; |
|
663 | coarseTime = waveform[0]; | |
664 | fineTime = waveform[1]; |
|
664 | fineTime = waveform[1]; | |
665 |
|
665 | |||
666 | for (i=0; i<7; i++) // send waveform |
|
666 | for (i=0; i<7; i++) // send waveform | |
667 | { |
|
667 | { | |
668 | spw_ioctl_send_SWF.data = (char*) &waveform[ (i * BLK_NR_304 * NB_WORDS_SWF_BLK) + TIME_OFFSET]; |
|
668 | spw_ioctl_send_SWF.data = (char*) &waveform[ (i * BLK_NR_304 * NB_WORDS_SWF_BLK) + TIME_OFFSET]; | |
669 | spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ]; |
|
669 | spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ]; | |
670 | // BUILD THE DATA |
|
670 | // BUILD THE DATA | |
671 | if (i==6) { |
|
671 | if (i==6) { | |
672 | spw_ioctl_send_SWF.dlen = BLK_NR_224 * NB_BYTES_SWF_BLK; |
|
672 | spw_ioctl_send_SWF.dlen = BLK_NR_224 * NB_BYTES_SWF_BLK; | |
673 | } |
|
673 | } | |
674 | else { |
|
674 | else { | |
675 | spw_ioctl_send_SWF.dlen = BLK_NR_304 * NB_BYTES_SWF_BLK; |
|
675 | spw_ioctl_send_SWF.dlen = BLK_NR_304 * NB_BYTES_SWF_BLK; | |
676 | } |
|
676 | } | |
677 | // SET PACKET SEQUENCE COUNTER |
|
677 | // SET PACKET SEQUENCE COUNTER | |
678 | increment_seq_counter_source_id( headerSWF[ i ].packetSequenceControl, sid ); |
|
678 | increment_seq_counter_source_id( headerSWF[ i ].packetSequenceControl, sid ); | |
679 | // SET PACKET TIME |
|
679 | // SET PACKET TIME | |
680 | compute_acquisition_time( coarseTime, fineTime, sid, i, headerSWF[ i ].acquisitionTime ); |
|
680 | compute_acquisition_time( coarseTime, fineTime, sid, i, headerSWF[ i ].acquisitionTime ); | |
681 | // |
|
681 | // | |
682 | headerSWF[ i ].time[0] = headerSWF[ i ].acquisitionTime[0]; |
|
682 | headerSWF[ i ].time[0] = headerSWF[ i ].acquisitionTime[0]; | |
683 | headerSWF[ i ].time[1] = headerSWF[ i ].acquisitionTime[1]; |
|
683 | headerSWF[ i ].time[1] = headerSWF[ i ].acquisitionTime[1]; | |
684 | headerSWF[ i ].time[2] = headerSWF[ i ].acquisitionTime[2]; |
|
684 | headerSWF[ i ].time[2] = headerSWF[ i ].acquisitionTime[2]; | |
685 | headerSWF[ i ].time[3] = headerSWF[ i ].acquisitionTime[3]; |
|
685 | headerSWF[ i ].time[3] = headerSWF[ i ].acquisitionTime[3]; | |
686 | headerSWF[ i ].time[4] = headerSWF[ i ].acquisitionTime[4]; |
|
686 | headerSWF[ i ].time[4] = headerSWF[ i ].acquisitionTime[4]; | |
687 | headerSWF[ i ].time[5] = headerSWF[ i ].acquisitionTime[5]; |
|
687 | headerSWF[ i ].time[5] = headerSWF[ i ].acquisitionTime[5]; | |
688 | // SEND PACKET |
|
688 | // SEND PACKET | |
689 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_SWF, ACTION_MSG_SPW_IOCTL_SEND_SIZE); |
|
689 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_SWF, ACTION_MSG_SPW_IOCTL_SEND_SIZE); | |
690 | if (status != RTEMS_SUCCESSFUL) { |
|
690 | if (status != RTEMS_SUCCESSFUL) { | |
691 | printf("%d-%d, ERR %d\n", sid, i, (int) status); |
|
691 | printf("%d-%d, ERR %d\n", sid, i, (int) status); | |
692 | ret = LFR_DEFAULT; |
|
692 | ret = LFR_DEFAULT; | |
693 | } |
|
693 | } | |
694 | rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds |
|
694 | rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds | |
695 | } |
|
695 | } | |
696 |
|
696 | |||
697 | return ret; |
|
697 | return ret; | |
698 | } |
|
698 | } | |
699 |
|
699 | |||
700 | int send_waveform_CWF(volatile int *waveform, unsigned int sid, |
|
700 | int send_waveform_CWF(volatile int *waveform, unsigned int sid, | |
701 | Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id) |
|
701 | Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id) | |
702 | { |
|
702 | { | |
703 | /** This function sends CWF CCSDS packets (F2, F1 or F0). |
|
703 | /** This function sends CWF CCSDS packets (F2, F1 or F0). | |
704 | * |
|
704 | * | |
705 | * @param waveform points to the buffer containing the data that will be send. |
|
705 | * @param waveform points to the buffer containing the data that will be send. | |
706 | * @param sid is the source identifier of the data that will be sent. |
|
706 | * @param sid is the source identifier of the data that will be sent. | |
707 | * @param headerCWF points to a table of headers that have been prepared for the data transmission. |
|
707 | * @param headerCWF points to a table of headers that have been prepared for the data transmission. | |
708 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures |
|
708 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures | |
709 | * contain information to setup the transmission of the data packets. |
|
709 | * contain information to setup the transmission of the data packets. | |
710 | * |
|
710 | * | |
711 | * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks. |
|
711 | * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks. | |
712 | * |
|
712 | * | |
713 | */ |
|
713 | */ | |
714 |
|
714 | |||
715 | unsigned int i; |
|
715 | unsigned int i; | |
716 | int ret; |
|
716 | int ret; | |
717 | unsigned int coarseTime; |
|
717 | unsigned int coarseTime; | |
718 | unsigned int fineTime; |
|
718 | unsigned int fineTime; | |
719 | rtems_status_code status; |
|
719 | rtems_status_code status; | |
720 | spw_ioctl_pkt_send spw_ioctl_send_CWF; |
|
720 | spw_ioctl_pkt_send spw_ioctl_send_CWF; | |
721 |
|
721 | |||
722 | spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header |
|
722 | spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header | |
723 | spw_ioctl_send_CWF.options = 0; |
|
723 | spw_ioctl_send_CWF.options = 0; | |
724 |
|
724 | |||
725 | ret = LFR_DEFAULT; |
|
725 | ret = LFR_DEFAULT; | |
726 |
|
726 | |||
727 | coarseTime = waveform[0]; |
|
727 | coarseTime = waveform[0]; | |
728 | fineTime = waveform[1]; |
|
728 | fineTime = waveform[1]; | |
729 |
|
729 | |||
730 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF; i++) // send waveform |
|
730 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF; i++) // send waveform | |
731 | { |
|
731 | { | |
732 | spw_ioctl_send_CWF.data = (char*) &waveform[ (i * BLK_NR_CWF * NB_WORDS_SWF_BLK) + TIME_OFFSET]; |
|
732 | spw_ioctl_send_CWF.data = (char*) &waveform[ (i * BLK_NR_CWF * NB_WORDS_SWF_BLK) + TIME_OFFSET]; | |
733 | spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ]; |
|
733 | spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ]; | |
734 | // BUILD THE DATA |
|
734 | // BUILD THE DATA | |
735 | spw_ioctl_send_CWF.dlen = BLK_NR_CWF * NB_BYTES_SWF_BLK; |
|
735 | spw_ioctl_send_CWF.dlen = BLK_NR_CWF * NB_BYTES_SWF_BLK; | |
736 | // SET PACKET SEQUENCE COUNTER |
|
736 | // SET PACKET SEQUENCE COUNTER | |
737 | increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, sid ); |
|
737 | increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, sid ); | |
738 | // SET PACKET TIME |
|
738 | // SET PACKET TIME | |
739 | compute_acquisition_time( coarseTime, fineTime, sid, i, headerCWF[ i ].acquisitionTime); |
|
739 | compute_acquisition_time( coarseTime, fineTime, sid, i, headerCWF[ i ].acquisitionTime); | |
740 | // |
|
740 | // | |
741 | headerCWF[ i ].time[0] = headerCWF[ i ].acquisitionTime[0]; |
|
741 | headerCWF[ i ].time[0] = headerCWF[ i ].acquisitionTime[0]; | |
742 | headerCWF[ i ].time[1] = headerCWF[ i ].acquisitionTime[1]; |
|
742 | headerCWF[ i ].time[1] = headerCWF[ i ].acquisitionTime[1]; | |
743 | headerCWF[ i ].time[2] = headerCWF[ i ].acquisitionTime[2]; |
|
743 | headerCWF[ i ].time[2] = headerCWF[ i ].acquisitionTime[2]; | |
744 | headerCWF[ i ].time[3] = headerCWF[ i ].acquisitionTime[3]; |
|
744 | headerCWF[ i ].time[3] = headerCWF[ i ].acquisitionTime[3]; | |
745 | headerCWF[ i ].time[4] = headerCWF[ i ].acquisitionTime[4]; |
|
745 | headerCWF[ i ].time[4] = headerCWF[ i ].acquisitionTime[4]; | |
746 | headerCWF[ i ].time[5] = headerCWF[ i ].acquisitionTime[5]; |
|
746 | headerCWF[ i ].time[5] = headerCWF[ i ].acquisitionTime[5]; | |
747 | // SEND PACKET |
|
747 | // SEND PACKET | |
748 | if (sid == SID_NORM_CWF_LONG_F3) |
|
748 | if (sid == SID_NORM_CWF_LONG_F3) | |
749 | { |
|
749 | { | |
750 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); |
|
750 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); | |
751 | if (status != RTEMS_SUCCESSFUL) { |
|
751 | if (status != RTEMS_SUCCESSFUL) { | |
752 | printf("%d-%d, ERR %d\n", sid, i, (int) status); |
|
752 | printf("%d-%d, ERR %d\n", sid, i, (int) status); | |
753 | ret = LFR_DEFAULT; |
|
753 | ret = LFR_DEFAULT; | |
754 | } |
|
754 | } | |
755 | rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS); |
|
755 | rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS); | |
756 | } |
|
756 | } | |
757 | else |
|
757 | else | |
758 | { |
|
758 | { | |
759 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); |
|
759 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); | |
760 | if (status != RTEMS_SUCCESSFUL) { |
|
760 | if (status != RTEMS_SUCCESSFUL) { | |
761 | printf("%d-%d, ERR %d\n", sid, i, (int) status); |
|
761 | printf("%d-%d, ERR %d\n", sid, i, (int) status); | |
762 | ret = LFR_DEFAULT; |
|
762 | ret = LFR_DEFAULT; | |
763 | } |
|
763 | } | |
764 | } |
|
764 | } | |
765 | } |
|
765 | } | |
766 |
|
766 | |||
767 | return ret; |
|
767 | return ret; | |
768 | } |
|
768 | } | |
769 |
|
769 | |||
770 | int send_waveform_CWF3_light(volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id) |
|
770 | int send_waveform_CWF3_light(volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id) | |
771 | { |
|
771 | { | |
772 | /** This function sends CWF_F3 CCSDS packets without the b1, b2 and b3 data. |
|
772 | /** This function sends CWF_F3 CCSDS packets without the b1, b2 and b3 data. | |
773 | * |
|
773 | * | |
774 | * @param waveform points to the buffer containing the data that will be send. |
|
774 | * @param waveform points to the buffer containing the data that will be send. | |
775 | * @param headerCWF points to a table of headers that have been prepared for the data transmission. |
|
775 | * @param headerCWF points to a table of headers that have been prepared for the data transmission. | |
776 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures |
|
776 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures | |
777 | * contain information to setup the transmission of the data packets. |
|
777 | * contain information to setup the transmission of the data packets. | |
778 | * |
|
778 | * | |
779 | * By default, CWF_F3 packet are send without the b1, b2 and b3 data. This function rebuilds a data buffer |
|
779 | * By default, CWF_F3 packet are send without the b1, b2 and b3 data. This function rebuilds a data buffer | |
780 | * from the incoming data and sends it in 7 packets, 6 containing 340 blocks and 1 one containing 8 blocks. |
|
780 | * from the incoming data and sends it in 7 packets, 6 containing 340 blocks and 1 one containing 8 blocks. | |
781 | * |
|
781 | * | |
782 | */ |
|
782 | */ | |
783 |
|
783 | |||
784 | unsigned int i; |
|
784 | unsigned int i; | |
785 | int ret; |
|
785 | int ret; | |
786 | unsigned int coarseTime; |
|
786 | unsigned int coarseTime; | |
787 | unsigned int fineTime; |
|
787 | unsigned int fineTime; | |
788 | rtems_status_code status; |
|
788 | rtems_status_code status; | |
789 | spw_ioctl_pkt_send spw_ioctl_send_CWF; |
|
789 | spw_ioctl_pkt_send spw_ioctl_send_CWF; | |
790 | char *sample; |
|
790 | char *sample; | |
791 |
|
791 | |||
792 | spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header |
|
792 | spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header | |
793 | spw_ioctl_send_CWF.options = 0; |
|
793 | spw_ioctl_send_CWF.options = 0; | |
794 |
|
794 | |||
795 | ret = LFR_DEFAULT; |
|
795 | ret = LFR_DEFAULT; | |
796 |
|
796 | |||
797 | //********************** |
|
797 | //********************** | |
798 | // BUILD CWF3_light DATA |
|
798 | // BUILD CWF3_light DATA | |
799 | for ( i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++) |
|
799 | for ( i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++) | |
800 | { |
|
800 | { | |
801 | sample = (char*) &waveform[ (i * NB_WORDS_SWF_BLK) + TIME_OFFSET ]; |
|
801 | sample = (char*) &waveform[ (i * NB_WORDS_SWF_BLK) + TIME_OFFSET ]; | |
802 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + TIME_OFFSET_IN_BYTES ] = sample[ 0 ]; |
|
802 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + TIME_OFFSET_IN_BYTES ] = sample[ 0 ]; | |
803 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 + TIME_OFFSET_IN_BYTES ] = sample[ 1 ]; |
|
803 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 + TIME_OFFSET_IN_BYTES ] = sample[ 1 ]; | |
804 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 + TIME_OFFSET_IN_BYTES ] = sample[ 2 ]; |
|
804 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 + TIME_OFFSET_IN_BYTES ] = sample[ 2 ]; | |
805 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 + TIME_OFFSET_IN_BYTES ] = sample[ 3 ]; |
|
805 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 + TIME_OFFSET_IN_BYTES ] = sample[ 3 ]; | |
806 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 + TIME_OFFSET_IN_BYTES ] = sample[ 4 ]; |
|
806 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 + TIME_OFFSET_IN_BYTES ] = sample[ 4 ]; | |
807 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 + TIME_OFFSET_IN_BYTES ] = sample[ 5 ]; |
|
807 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 + TIME_OFFSET_IN_BYTES ] = sample[ 5 ]; | |
808 | } |
|
808 | } | |
809 |
|
809 | |||
810 | coarseTime = waveform[0]; |
|
810 | coarseTime = waveform[0]; | |
811 | fineTime = waveform[1]; |
|
811 | fineTime = waveform[1]; | |
812 |
|
812 | |||
813 | //********************* |
|
813 | //********************* | |
814 | // SEND CWF3_light DATA |
|
814 | // SEND CWF3_light DATA | |
815 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF_LIGHT; i++) // send waveform |
|
815 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF_LIGHT; i++) // send waveform | |
816 | { |
|
816 | { | |
817 | 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]; |
|
817 | 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]; | |
818 | spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ]; |
|
818 | spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ]; | |
819 | // BUILD THE DATA |
|
819 | // BUILD THE DATA | |
820 | spw_ioctl_send_CWF.dlen = BLK_NR_CWF_SHORT_F3 * NB_BYTES_CWF3_LIGHT_BLK; |
|
820 | spw_ioctl_send_CWF.dlen = BLK_NR_CWF_SHORT_F3 * NB_BYTES_CWF3_LIGHT_BLK; | |
821 | // SET PACKET SEQUENCE COUNTER |
|
821 | // SET PACKET SEQUENCE COUNTER | |
822 | increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, SID_NORM_CWF_F3 ); |
|
822 | increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, SID_NORM_CWF_F3 ); | |
823 | // SET PACKET TIME |
|
823 | // SET PACKET TIME | |
824 | compute_acquisition_time( coarseTime, fineTime, SID_NORM_CWF_F3, i, headerCWF[ i ].acquisitionTime ); |
|
824 | compute_acquisition_time( coarseTime, fineTime, SID_NORM_CWF_F3, i, headerCWF[ i ].acquisitionTime ); | |
825 | // |
|
825 | // | |
826 | headerCWF[ i ].time[0] = headerCWF[ i ].acquisitionTime[0]; |
|
826 | headerCWF[ i ].time[0] = headerCWF[ i ].acquisitionTime[0]; | |
827 | headerCWF[ i ].time[1] = headerCWF[ i ].acquisitionTime[1]; |
|
827 | headerCWF[ i ].time[1] = headerCWF[ i ].acquisitionTime[1]; | |
828 | headerCWF[ i ].time[2] = headerCWF[ i ].acquisitionTime[2]; |
|
828 | headerCWF[ i ].time[2] = headerCWF[ i ].acquisitionTime[2]; | |
829 | headerCWF[ i ].time[3] = headerCWF[ i ].acquisitionTime[3]; |
|
829 | headerCWF[ i ].time[3] = headerCWF[ i ].acquisitionTime[3]; | |
830 | headerCWF[ i ].time[4] = headerCWF[ i ].acquisitionTime[4]; |
|
830 | headerCWF[ i ].time[4] = headerCWF[ i ].acquisitionTime[4]; | |
831 | headerCWF[ i ].time[5] = headerCWF[ i ].acquisitionTime[5]; |
|
831 | headerCWF[ i ].time[5] = headerCWF[ i ].acquisitionTime[5]; | |
832 | // SEND PACKET |
|
832 | // SEND PACKET | |
833 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); |
|
833 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); | |
834 | if (status != RTEMS_SUCCESSFUL) { |
|
834 | if (status != RTEMS_SUCCESSFUL) { | |
835 | printf("%d-%d, ERR %d\n", SID_NORM_CWF_F3, i, (int) status); |
|
835 | printf("%d-%d, ERR %d\n", SID_NORM_CWF_F3, i, (int) status); | |
836 | ret = LFR_DEFAULT; |
|
836 | ret = LFR_DEFAULT; | |
837 | } |
|
837 | } | |
838 | rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS); |
|
838 | rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS); | |
839 | } |
|
839 | } | |
840 |
|
840 | |||
841 | return ret; |
|
841 | return ret; | |
842 | } |
|
842 | } | |
843 |
|
843 | |||
844 | void compute_acquisition_time_old( unsigned int coarseTime, unsigned int fineTime, |
|
|||
845 | unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char * acquisitionTime ) |
|
|||
846 | { |
|
|||
847 | unsigned long long int acquisitionTimeAsLong; |
|
|||
848 | unsigned char localAcquisitionTime[6]; |
|
|||
849 | double deltaT; |
|
|||
850 |
|
||||
851 | deltaT = 0.; |
|
|||
852 |
|
||||
853 | localAcquisitionTime[0] = (unsigned char) ( coarseTime >> 8 ); |
|
|||
854 | localAcquisitionTime[1] = (unsigned char) ( coarseTime ); |
|
|||
855 | localAcquisitionTime[2] = (unsigned char) ( coarseTime >> 24 ); |
|
|||
856 | localAcquisitionTime[3] = (unsigned char) ( coarseTime >> 16 ); |
|
|||
857 | localAcquisitionTime[4] = (unsigned char) ( fineTime >> 24 ); |
|
|||
858 | localAcquisitionTime[5] = (unsigned char) ( fineTime >> 16 ); |
|
|||
859 |
|
||||
860 | acquisitionTimeAsLong = ( (unsigned long long int) localAcquisitionTime[0] << 40 ) |
|
|||
861 | + ( (unsigned long long int) localAcquisitionTime[1] << 32 ) |
|
|||
862 | + ( localAcquisitionTime[2] << 24 ) |
|
|||
863 | + ( localAcquisitionTime[3] << 16 ) |
|
|||
864 | + ( localAcquisitionTime[4] << 8 ) |
|
|||
865 | + ( localAcquisitionTime[5] ); |
|
|||
866 |
|
||||
867 | switch( sid ) |
|
|||
868 | { |
|
|||
869 | case SID_NORM_SWF_F0: |
|
|||
870 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 24576. ; |
|
|||
871 | break; |
|
|||
872 |
|
||||
873 | case SID_NORM_SWF_F1: |
|
|||
874 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 4096. ; |
|
|||
875 | break; |
|
|||
876 |
|
||||
877 | case SID_NORM_SWF_F2: |
|
|||
878 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 256. ; |
|
|||
879 | break; |
|
|||
880 |
|
||||
881 | case SID_SBM1_CWF_F1: |
|
|||
882 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 4096. ; |
|
|||
883 | break; |
|
|||
884 |
|
||||
885 | case SID_SBM2_CWF_F2: |
|
|||
886 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ; |
|
|||
887 | break; |
|
|||
888 |
|
||||
889 | case SID_BURST_CWF_F2: |
|
|||
890 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ; |
|
|||
891 | break; |
|
|||
892 |
|
||||
893 | case SID_NORM_CWF_F3: |
|
|||
894 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF_SHORT_F3 * 65536. / 16. ; |
|
|||
895 | break; |
|
|||
896 |
|
||||
897 | case SID_NORM_CWF_LONG_F3: |
|
|||
898 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 16. ; |
|
|||
899 | break; |
|
|||
900 |
|
||||
901 | default: |
|
|||
902 | PRINTF1("in compute_acquisition_time *** ERR unexpected sid %d", sid) |
|
|||
903 | deltaT = 0.; |
|
|||
904 | break; |
|
|||
905 | } |
|
|||
906 |
|
||||
907 | acquisitionTimeAsLong = acquisitionTimeAsLong + (unsigned long long int) deltaT; |
|
|||
908 | // |
|
|||
909 | acquisitionTime[0] = (unsigned char) (acquisitionTimeAsLong >> 40); |
|
|||
910 | acquisitionTime[1] = (unsigned char) (acquisitionTimeAsLong >> 32); |
|
|||
911 | acquisitionTime[2] = (unsigned char) (acquisitionTimeAsLong >> 24); |
|
|||
912 | acquisitionTime[3] = (unsigned char) (acquisitionTimeAsLong >> 16); |
|
|||
913 | acquisitionTime[4] = (unsigned char) (acquisitionTimeAsLong >> 8 ); |
|
|||
914 | acquisitionTime[5] = (unsigned char) (acquisitionTimeAsLong ); |
|
|||
915 |
|
||||
916 | } |
|
|||
917 |
|
||||
918 | void compute_acquisition_time( unsigned int coarseTime, unsigned int fineTime, |
|
844 | void compute_acquisition_time( unsigned int coarseTime, unsigned int fineTime, | |
919 | unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char * acquisitionTime ) |
|
845 | unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char * acquisitionTime ) | |
920 | { |
|
846 | { | |
921 | unsigned long long int acquisitionTimeAsLong; |
|
847 | unsigned long long int acquisitionTimeAsLong; | |
922 | unsigned char localAcquisitionTime[6]; |
|
848 | unsigned char localAcquisitionTime[6]; | |
923 | double deltaT; |
|
849 | double deltaT; | |
924 |
|
850 | |||
925 | deltaT = 0.; |
|
851 | deltaT = 0.; | |
926 |
|
852 | |||
927 | localAcquisitionTime[0] = (unsigned char) ( coarseTime >> 24 ); |
|
853 | localAcquisitionTime[0] = (unsigned char) ( coarseTime >> 24 ); | |
928 | localAcquisitionTime[1] = (unsigned char) ( coarseTime >> 16 ); |
|
854 | localAcquisitionTime[1] = (unsigned char) ( coarseTime >> 16 ); | |
929 | localAcquisitionTime[2] = (unsigned char) ( coarseTime >> 8 ); |
|
855 | localAcquisitionTime[2] = (unsigned char) ( coarseTime >> 8 ); | |
930 | localAcquisitionTime[3] = (unsigned char) ( coarseTime ); |
|
856 | localAcquisitionTime[3] = (unsigned char) ( coarseTime ); | |
931 | localAcquisitionTime[4] = (unsigned char) ( fineTime >> 8 ); |
|
857 | localAcquisitionTime[4] = (unsigned char) ( fineTime >> 8 ); | |
932 | localAcquisitionTime[5] = (unsigned char) ( fineTime ); |
|
858 | localAcquisitionTime[5] = (unsigned char) ( fineTime ); | |
933 |
|
859 | |||
934 | acquisitionTimeAsLong = ( (unsigned long long int) localAcquisitionTime[0] << 40 ) |
|
860 | acquisitionTimeAsLong = ( (unsigned long long int) localAcquisitionTime[0] << 40 ) | |
935 | + ( (unsigned long long int) localAcquisitionTime[1] << 32 ) |
|
861 | + ( (unsigned long long int) localAcquisitionTime[1] << 32 ) | |
936 | + ( localAcquisitionTime[2] << 24 ) |
|
862 | + ( (unsigned long long int) localAcquisitionTime[2] << 24 ) | |
937 | + ( localAcquisitionTime[3] << 16 ) |
|
863 | + ( (unsigned long long int) localAcquisitionTime[3] << 16 ) | |
938 | + ( localAcquisitionTime[4] << 8 ) |
|
864 | + ( (unsigned long long int) localAcquisitionTime[4] << 8 ) | |
939 | + ( localAcquisitionTime[5] ); |
|
865 | + ( (unsigned long long int) localAcquisitionTime[5] ); | |
940 |
|
866 | |||
941 | switch( sid ) |
|
867 | switch( sid ) | |
942 | { |
|
868 | { | |
943 | case SID_NORM_SWF_F0: |
|
869 | case SID_NORM_SWF_F0: | |
944 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 24576. ; |
|
870 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 24576. ; | |
945 | break; |
|
871 | break; | |
946 |
|
872 | |||
947 | case SID_NORM_SWF_F1: |
|
873 | case SID_NORM_SWF_F1: | |
948 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 4096. ; |
|
874 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 4096. ; | |
949 | break; |
|
875 | break; | |
950 |
|
876 | |||
951 | case SID_NORM_SWF_F2: |
|
877 | case SID_NORM_SWF_F2: | |
952 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 256. ; |
|
878 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 256. ; | |
953 | break; |
|
879 | break; | |
954 |
|
880 | |||
955 | case SID_SBM1_CWF_F1: |
|
881 | case SID_SBM1_CWF_F1: | |
956 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 4096. ; |
|
882 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 4096. ; | |
957 | break; |
|
883 | break; | |
958 |
|
884 | |||
959 | case SID_SBM2_CWF_F2: |
|
885 | case SID_SBM2_CWF_F2: | |
960 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ; |
|
886 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ; | |
961 | break; |
|
887 | break; | |
962 |
|
888 | |||
963 | case SID_BURST_CWF_F2: |
|
889 | case SID_BURST_CWF_F2: | |
964 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ; |
|
890 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ; | |
965 | break; |
|
891 | break; | |
966 |
|
892 | |||
967 | case SID_NORM_CWF_F3: |
|
893 | case SID_NORM_CWF_F3: | |
968 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF_SHORT_F3 * 65536. / 16. ; |
|
894 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF_SHORT_F3 * 65536. / 16. ; | |
969 | break; |
|
895 | break; | |
970 |
|
896 | |||
971 | case SID_NORM_CWF_LONG_F3: |
|
897 | case SID_NORM_CWF_LONG_F3: | |
972 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 16. ; |
|
898 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 16. ; | |
973 | break; |
|
899 | break; | |
974 |
|
900 | |||
975 | default: |
|
901 | default: | |
976 | PRINTF1("in compute_acquisition_time *** ERR unexpected sid %d", sid) |
|
902 | PRINTF1("in compute_acquisition_time *** ERR unexpected sid %d", sid) | |
977 | deltaT = 0.; |
|
903 | deltaT = 0.; | |
978 | break; |
|
904 | break; | |
979 | } |
|
905 | } | |
980 |
|
906 | |||
981 | acquisitionTimeAsLong = acquisitionTimeAsLong + (unsigned long long int) deltaT; |
|
907 | acquisitionTimeAsLong = acquisitionTimeAsLong + (unsigned long long int) deltaT; | |
982 | // |
|
908 | // | |
983 | acquisitionTime[0] = (unsigned char) (acquisitionTimeAsLong >> 40); |
|
909 | acquisitionTime[0] = (unsigned char) (acquisitionTimeAsLong >> 40); | |
984 | acquisitionTime[1] = (unsigned char) (acquisitionTimeAsLong >> 32); |
|
910 | acquisitionTime[1] = (unsigned char) (acquisitionTimeAsLong >> 32); | |
985 | acquisitionTime[2] = (unsigned char) (acquisitionTimeAsLong >> 24); |
|
911 | acquisitionTime[2] = (unsigned char) (acquisitionTimeAsLong >> 24); | |
986 | acquisitionTime[3] = (unsigned char) (acquisitionTimeAsLong >> 16); |
|
912 | acquisitionTime[3] = (unsigned char) (acquisitionTimeAsLong >> 16); | |
987 | acquisitionTime[4] = (unsigned char) (acquisitionTimeAsLong >> 8 ); |
|
913 | acquisitionTime[4] = (unsigned char) (acquisitionTimeAsLong >> 8 ); | |
988 | acquisitionTime[5] = (unsigned char) (acquisitionTimeAsLong ); |
|
914 | acquisitionTime[5] = (unsigned char) (acquisitionTimeAsLong ); | |
989 |
|
915 | |||
990 | } |
|
916 | } | |
991 |
|
917 | |||
992 | void build_snapshot_from_ring( ring_node *ring_node_to_send, unsigned char frequencyChannel ) |
|
918 | void build_snapshot_from_ring( ring_node *ring_node_to_send, unsigned char frequencyChannel ) | |
993 | { |
|
919 | { | |
994 | unsigned int i; |
|
920 | unsigned int i; | |
995 | unsigned long long int centerTime_asLong; |
|
921 | unsigned long long int centerTime_asLong; | |
996 | unsigned long long int acquisitionTimeF0_asLong; |
|
922 | unsigned long long int acquisitionTimeF0_asLong; | |
997 | unsigned long long int acquisitionTime_asLong; |
|
923 | unsigned long long int acquisitionTime_asLong; | |
998 | unsigned long long int bufferAcquisitionTime_asLong; |
|
924 | unsigned long long int bufferAcquisitionTime_asLong; | |
999 | unsigned char *ptr1; |
|
925 | unsigned char *ptr1; | |
1000 | unsigned char *ptr2; |
|
926 | unsigned char *ptr2; | |
1001 | unsigned char *timeCharPtr; |
|
927 | unsigned char *timeCharPtr; | |
1002 | unsigned char nb_ring_nodes; |
|
928 | unsigned char nb_ring_nodes; | |
1003 | unsigned long long int frequency_asLong; |
|
929 | unsigned long long int frequency_asLong; | |
1004 | unsigned long long int nbTicksPerSample_asLong; |
|
930 | unsigned long long int nbTicksPerSample_asLong; | |
1005 | unsigned long long int nbSamplesPart1_asLong; |
|
931 | unsigned long long int nbSamplesPart1_asLong; | |
1006 | unsigned long long int sampleOffset_asLong; |
|
932 | unsigned long long int sampleOffset_asLong; | |
1007 |
|
933 | |||
1008 | unsigned int deltaT_F0; |
|
934 | unsigned int deltaT_F0; | |
1009 | unsigned int deltaT_F1; |
|
935 | unsigned int deltaT_F1; | |
1010 | unsigned long long int deltaT_F2; |
|
936 | unsigned long long int deltaT_F2; | |
1011 |
|
937 | |||
1012 | deltaT_F0 = 2731; // (2048. / 24576. / 2.) * 65536. = 2730.667; |
|
938 | deltaT_F0 = 2731; // (2048. / 24576. / 2.) * 65536. = 2730.667; | |
1013 | deltaT_F1 = 16384; // (2048. / 4096. / 2.) * 65536. = 16384; |
|
939 | deltaT_F1 = 16384; // (2048. / 4096. / 2.) * 65536. = 16384; | |
1014 | deltaT_F2 = 262144; // (2048. / 256. / 2.) * 65536. = 262144; |
|
940 | deltaT_F2 = 262144; // (2048. / 256. / 2.) * 65536. = 262144; | |
1015 | sampleOffset_asLong = 0x00; |
|
941 | sampleOffset_asLong = 0x00; | |
1016 |
|
942 | |||
1017 | // (1) get the f0 acquisition time |
|
943 | // (1) get the f0 acquisition time | |
1018 | build_acquisition_time( &acquisitionTimeF0_asLong, current_ring_node_f0 ); |
|
944 | build_acquisition_time( &acquisitionTimeF0_asLong, current_ring_node_f0 ); | |
1019 |
|
945 | |||
1020 | // (2) compute the central reference time |
|
946 | // (2) compute the central reference time | |
1021 | centerTime_asLong = acquisitionTimeF0_asLong + deltaT_F0; |
|
947 | centerTime_asLong = acquisitionTimeF0_asLong + deltaT_F0; | |
1022 |
|
948 | |||
1023 | // (3) compute the acquisition time of the current snapshot |
|
949 | // (3) compute the acquisition time of the current snapshot | |
1024 | switch(frequencyChannel) |
|
950 | switch(frequencyChannel) | |
1025 | { |
|
951 | { | |
1026 | case 1: // 1 is for F1 = 4096 Hz |
|
952 | case 1: // 1 is for F1 = 4096 Hz | |
1027 | acquisitionTime_asLong = centerTime_asLong - deltaT_F1; |
|
953 | acquisitionTime_asLong = centerTime_asLong - deltaT_F1; | |
1028 | nb_ring_nodes = NB_RING_NODES_F1; |
|
954 | nb_ring_nodes = NB_RING_NODES_F1; | |
1029 | frequency_asLong = 4096; |
|
955 | frequency_asLong = 4096; | |
1030 | nbTicksPerSample_asLong = 16; // 65536 / 4096; |
|
956 | nbTicksPerSample_asLong = 16; // 65536 / 4096; | |
1031 | break; |
|
957 | break; | |
1032 | case 2: // 2 is for F2 = 256 Hz |
|
958 | case 2: // 2 is for F2 = 256 Hz | |
1033 | acquisitionTime_asLong = centerTime_asLong - deltaT_F2; |
|
959 | acquisitionTime_asLong = centerTime_asLong - deltaT_F2; | |
1034 | nb_ring_nodes = NB_RING_NODES_F2; |
|
960 | nb_ring_nodes = NB_RING_NODES_F2; | |
1035 | frequency_asLong = 256; |
|
961 | frequency_asLong = 256; | |
1036 | nbTicksPerSample_asLong = 256; // 65536 / 256; |
|
962 | nbTicksPerSample_asLong = 256; // 65536 / 256; | |
1037 | break; |
|
963 | break; | |
1038 | default: |
|
964 | default: | |
1039 | acquisitionTime_asLong = centerTime_asLong; |
|
965 | acquisitionTime_asLong = centerTime_asLong; | |
1040 | frequency_asLong = 256; |
|
966 | frequency_asLong = 256; | |
1041 | nbTicksPerSample_asLong = 256; |
|
967 | nbTicksPerSample_asLong = 256; | |
1042 | break; |
|
968 | break; | |
1043 | } |
|
969 | } | |
1044 |
|
970 | |||
1045 | //**************************************************************************** |
|
971 | //**************************************************************************** | |
1046 | // (4) search the ring_node with the acquisition time <= acquisitionTime_asLong |
|
972 | // (4) search the ring_node with the acquisition time <= acquisitionTime_asLong | |
1047 | for (i=0; i<nb_ring_nodes; i++) |
|
973 | for (i=0; i<nb_ring_nodes; i++) | |
1048 | { |
|
974 | { | |
1049 | PRINTF1("%d ... ", i) |
|
975 | PRINTF1("%d ... ", i) | |
1050 | build_acquisition_time( &bufferAcquisitionTime_asLong, ring_node_to_send ); |
|
976 | build_acquisition_time( &bufferAcquisitionTime_asLong, ring_node_to_send ); | |
1051 | if (bufferAcquisitionTime_asLong <= acquisitionTime_asLong) |
|
977 | if (bufferAcquisitionTime_asLong <= acquisitionTime_asLong) | |
1052 | { |
|
978 | { | |
1053 | PRINTF1("buffer found with acquisition time = %llx\n", bufferAcquisitionTime_asLong) |
|
979 | PRINTF1("buffer found with acquisition time = %llx\n", bufferAcquisitionTime_asLong) | |
1054 | break; |
|
980 | break; | |
1055 | } |
|
981 | } | |
1056 | ring_node_to_send = ring_node_to_send->previous; |
|
982 | ring_node_to_send = ring_node_to_send->previous; | |
1057 | } |
|
983 | } | |
1058 |
|
984 | |||
1059 | // (5) compute the number of samples to take in the current buffer |
|
985 | // (5) compute the number of samples to take in the current buffer | |
1060 | sampleOffset_asLong = ((acquisitionTime_asLong - bufferAcquisitionTime_asLong) * frequency_asLong ) >> 16; |
|
986 | sampleOffset_asLong = ((acquisitionTime_asLong - bufferAcquisitionTime_asLong) * frequency_asLong ) >> 16; | |
1061 | nbSamplesPart1_asLong = NB_SAMPLES_PER_SNAPSHOT - sampleOffset_asLong; |
|
987 | nbSamplesPart1_asLong = NB_SAMPLES_PER_SNAPSHOT - sampleOffset_asLong; | |
1062 | PRINTF2("sampleOffset_asLong = %llx, nbSamplesPart1_asLong = %llx\n", sampleOffset_asLong, nbSamplesPart1_asLong) |
|
988 | PRINTF2("sampleOffset_asLong = %llx, nbSamplesPart1_asLong = %llx\n", sampleOffset_asLong, nbSamplesPart1_asLong) | |
1063 |
|
989 | |||
1064 | // (6) compute the final acquisition time |
|
990 | // (6) compute the final acquisition time | |
1065 | acquisitionTime_asLong = bufferAcquisitionTime_asLong + |
|
991 | acquisitionTime_asLong = bufferAcquisitionTime_asLong + | |
1066 | sampleOffset_asLong * nbTicksPerSample_asLong; |
|
992 | sampleOffset_asLong * nbTicksPerSample_asLong; | |
1067 |
|
993 | |||
1068 | // (7) copy the acquisition time at the beginning of the extrated snapshot |
|
994 | // (7) copy the acquisition time at the beginning of the extrated snapshot | |
1069 | ptr1 = (unsigned char*) &acquisitionTime_asLong; |
|
995 | ptr1 = (unsigned char*) &acquisitionTime_asLong; | |
1070 | ptr2 = (unsigned char*) wf_snap_extracted; |
|
996 | ptr2 = (unsigned char*) wf_snap_extracted; | |
1071 | ptr2[0] = ptr1[ 0 + 2 ]; |
|
997 | ptr2[0] = ptr1[ 0 + 2 ]; | |
1072 | ptr2[1] = ptr1[ 1 + 2 ]; |
|
998 | ptr2[1] = ptr1[ 1 + 2 ]; | |
1073 | ptr2[2] = ptr1[ 2 + 2 ]; |
|
999 | ptr2[2] = ptr1[ 2 + 2 ]; | |
1074 | ptr2[3] = ptr1[ 3 + 2 ]; |
|
1000 | ptr2[3] = ptr1[ 3 + 2 ]; | |
1075 | ptr2[6] = ptr1[ 4 + 2 ]; |
|
1001 | ptr2[6] = ptr1[ 4 + 2 ]; | |
1076 | ptr2[7] = ptr1[ 5 + 2 ]; |
|
1002 | ptr2[7] = ptr1[ 5 + 2 ]; | |
1077 |
|
1003 | |||
1078 | // re set the synchronization bit |
|
1004 | // re set the synchronization bit | |
1079 | timeCharPtr = (unsigned char*) ring_node_to_send->buffer_address; |
|
1005 | timeCharPtr = (unsigned char*) ring_node_to_send->buffer_address; | |
1080 | ptr2[0] = ptr2[0] | (timeCharPtr[0] & 0x80); // [1000 0000] |
|
1006 | ptr2[0] = ptr2[0] | (timeCharPtr[0] & 0x80); // [1000 0000] | |
1081 |
|
1007 | |||
1082 | if ( (nbSamplesPart1_asLong >= NB_SAMPLES_PER_SNAPSHOT) | (nbSamplesPart1_asLong < 0) ) |
|
1008 | if ( (nbSamplesPart1_asLong >= NB_SAMPLES_PER_SNAPSHOT) | (nbSamplesPart1_asLong < 0) ) | |
1083 | { |
|
1009 | { | |
1084 | nbSamplesPart1_asLong = 0; |
|
1010 | nbSamplesPart1_asLong = 0; | |
1085 | } |
|
1011 | } | |
1086 | // copy the part 1 of the snapshot in the extracted buffer |
|
1012 | // copy the part 1 of the snapshot in the extracted buffer | |
1087 | for ( i = 0; i < (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i++ ) |
|
1013 | for ( i = 0; i < (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i++ ) | |
1088 | { |
|
1014 | { | |
1089 | wf_snap_extracted[i + TIME_OFFSET] = |
|
1015 | wf_snap_extracted[i + TIME_OFFSET] = | |
1090 | ((int*) ring_node_to_send->buffer_address)[i + (sampleOffset_asLong * NB_WORDS_SWF_BLK) + TIME_OFFSET]; |
|
1016 | ((int*) ring_node_to_send->buffer_address)[i + (sampleOffset_asLong * NB_WORDS_SWF_BLK) + TIME_OFFSET]; | |
1091 | } |
|
1017 | } | |
1092 | // copy the part 2 of the snapshot in the extracted buffer |
|
1018 | // copy the part 2 of the snapshot in the extracted buffer | |
1093 | ring_node_to_send = ring_node_to_send->next; |
|
1019 | ring_node_to_send = ring_node_to_send->next; | |
1094 | for ( i = (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i < (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK); i++ ) |
|
1020 | for ( i = (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i < (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK); i++ ) | |
1095 | { |
|
1021 | { | |
1096 | wf_snap_extracted[i + TIME_OFFSET] = |
|
1022 | wf_snap_extracted[i + TIME_OFFSET] = | |
1097 | ((int*) ring_node_to_send->buffer_address)[(i-(nbSamplesPart1_asLong * NB_WORDS_SWF_BLK)) + TIME_OFFSET]; |
|
1023 | ((int*) ring_node_to_send->buffer_address)[(i-(nbSamplesPart1_asLong * NB_WORDS_SWF_BLK)) + TIME_OFFSET]; | |
1098 | } |
|
1024 | } | |
1099 | } |
|
1025 | } | |
1100 |
|
1026 | |||
1101 | void build_acquisition_time_old( unsigned long long int *acquisitionTimeAslong, ring_node *current_ring_node ) |
|
|||
1102 | { |
|
|||
1103 | unsigned char *acquisitionTimeCharPtr; |
|
|||
1104 |
|
||||
1105 | acquisitionTimeCharPtr = (unsigned char*) current_ring_node->buffer_address; |
|
|||
1106 |
|
||||
1107 | *acquisitionTimeAslong = 0x00; |
|
|||
1108 | *acquisitionTimeAslong = ( acquisitionTimeCharPtr[0] << 24 ) |
|
|||
1109 | + ( acquisitionTimeCharPtr[1] << 16 ) |
|
|||
1110 | + ( (unsigned long long int) (acquisitionTimeCharPtr[2] & 0x7f) << 40 ) // [0111 1111] mask the synchronization bit |
|
|||
1111 | + ( (unsigned long long int) acquisitionTimeCharPtr[3] << 32 ) |
|
|||
1112 | + ( acquisitionTimeCharPtr[4] << 8 ) |
|
|||
1113 | + ( acquisitionTimeCharPtr[5] ); |
|
|||
1114 | } |
|
|||
1115 |
|
||||
1116 | void build_acquisition_time( unsigned long long int *acquisitionTimeAslong, ring_node *current_ring_node ) |
|
1027 | void build_acquisition_time( unsigned long long int *acquisitionTimeAslong, ring_node *current_ring_node ) | |
1117 | { |
|
1028 | { | |
1118 | unsigned char *acquisitionTimeCharPtr; |
|
1029 | unsigned char *acquisitionTimeCharPtr; | |
1119 |
|
1030 | |||
1120 | acquisitionTimeCharPtr = (unsigned char*) current_ring_node->buffer_address; |
|
1031 | acquisitionTimeCharPtr = (unsigned char*) current_ring_node->buffer_address; | |
1121 |
|
1032 | |||
1122 | *acquisitionTimeAslong = 0x00; |
|
1033 | *acquisitionTimeAslong = 0x00; | |
1123 | *acquisitionTimeAslong = ( (unsigned long long int) (acquisitionTimeCharPtr[0] & 0x7f) << 40 ) // [0111 1111] mask the synchronization bit |
|
1034 | *acquisitionTimeAslong = ( (unsigned long long int) (acquisitionTimeCharPtr[0] & 0x7f) << 40 ) // [0111 1111] mask the synchronization bit | |
1124 | + ( (unsigned long long int) acquisitionTimeCharPtr[1] << 32 ) |
|
1035 | + ( (unsigned long long int) acquisitionTimeCharPtr[1] << 32 ) | |
1125 | + ( acquisitionTimeCharPtr[2] << 24 ) |
|
1036 | + ( (unsigned long long int) acquisitionTimeCharPtr[2] << 24 ) | |
1126 | + ( acquisitionTimeCharPtr[3] << 16 ) |
|
1037 | + ( (unsigned long long int) acquisitionTimeCharPtr[3] << 16 ) | |
1127 | + ( acquisitionTimeCharPtr[6] << 8 ) |
|
1038 | + ( (unsigned long long int) acquisitionTimeCharPtr[6] << 8 ) | |
1128 | + ( acquisitionTimeCharPtr[7] ); |
|
1039 | + ( (unsigned long long int) acquisitionTimeCharPtr[7] ); | |
1129 | } |
|
1040 | } | |
1130 |
|
1041 | |||
1131 | //************** |
|
1042 | //************** | |
1132 | // wfp registers |
|
1043 | // wfp registers | |
1133 | void reset_wfp_burst_enable(void) |
|
1044 | void reset_wfp_burst_enable(void) | |
1134 | { |
|
1045 | { | |
1135 | /** This function resets the waveform picker burst_enable register. |
|
1046 | /** This function resets the waveform picker burst_enable register. | |
1136 | * |
|
1047 | * | |
1137 | * The burst bits [f2 f1 f0] and the enable bits [f3 f2 f1 f0] are set to 0. |
|
1048 | * The burst bits [f2 f1 f0] and the enable bits [f3 f2 f1 f0] are set to 0. | |
1138 | * |
|
1049 | * | |
1139 | */ |
|
1050 | */ | |
1140 |
|
1051 | |||
1141 | waveform_picker_regs->run_burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 |
|
1052 | waveform_picker_regs->run_burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 | |
1142 | } |
|
1053 | } | |
1143 |
|
1054 | |||
1144 | void reset_wfp_status( void ) |
|
1055 | void reset_wfp_status( void ) | |
1145 | { |
|
1056 | { | |
1146 | /** This function resets the waveform picker status register. |
|
1057 | /** This function resets the waveform picker status register. | |
1147 | * |
|
1058 | * | |
1148 | * All status bits are set to 0 [new_err full_err full]. |
|
1059 | * All status bits are set to 0 [new_err full_err full]. | |
1149 | * |
|
1060 | * | |
1150 | */ |
|
1061 | */ | |
1151 |
|
1062 | |||
1152 | waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 |
|
1063 | waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 | |
1153 | } |
|
1064 | } | |
1154 |
|
1065 | |||
1155 | void reset_waveform_picker_regs(void) |
|
1066 | void reset_waveform_picker_regs(void) | |
1156 | { |
|
1067 | { | |
1157 | /** This function resets the waveform picker module registers. |
|
1068 | /** This function resets the waveform picker module registers. | |
1158 | * |
|
1069 | * | |
1159 | * The registers affected by this function are located at the following offset addresses: |
|
1070 | * The registers affected by this function are located at the following offset addresses: | |
1160 | * - 0x00 data_shaping |
|
1071 | * - 0x00 data_shaping | |
1161 | * - 0x04 run_burst_enable |
|
1072 | * - 0x04 run_burst_enable | |
1162 | * - 0x08 addr_data_f0 |
|
1073 | * - 0x08 addr_data_f0 | |
1163 | * - 0x0C addr_data_f1 |
|
1074 | * - 0x0C addr_data_f1 | |
1164 | * - 0x10 addr_data_f2 |
|
1075 | * - 0x10 addr_data_f2 | |
1165 | * - 0x14 addr_data_f3 |
|
1076 | * - 0x14 addr_data_f3 | |
1166 | * - 0x18 status |
|
1077 | * - 0x18 status | |
1167 | * - 0x1C delta_snapshot |
|
1078 | * - 0x1C delta_snapshot | |
1168 | * - 0x20 delta_f0 |
|
1079 | * - 0x20 delta_f0 | |
1169 | * - 0x24 delta_f0_2 |
|
1080 | * - 0x24 delta_f0_2 | |
1170 | * - 0x28 delta_f1 |
|
1081 | * - 0x28 delta_f1 | |
1171 | * - 0x2c delta_f2 |
|
1082 | * - 0x2c delta_f2 | |
1172 | * - 0x30 nb_data_by_buffer |
|
1083 | * - 0x30 nb_data_by_buffer | |
1173 | * - 0x34 nb_snapshot_param |
|
1084 | * - 0x34 nb_snapshot_param | |
1174 | * - 0x38 start_date |
|
1085 | * - 0x38 start_date | |
1175 | * - 0x3c nb_word_in_buffer |
|
1086 | * - 0x3c nb_word_in_buffer | |
1176 | * |
|
1087 | * | |
1177 | */ |
|
1088 | */ | |
1178 |
|
1089 | |||
1179 | set_wfp_data_shaping(); // 0x00 *** R1 R0 SP1 SP0 BW |
|
1090 | set_wfp_data_shaping(); // 0x00 *** R1 R0 SP1 SP0 BW | |
1180 | reset_wfp_burst_enable(); // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ] |
|
1091 | reset_wfp_burst_enable(); // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ] | |
1181 | waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address; // 0x08 |
|
1092 | waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address; // 0x08 | |
1182 | waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; // 0x0c |
|
1093 | waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; // 0x0c | |
1183 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; // 0x10 |
|
1094 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; // 0x10 | |
1184 | waveform_picker_regs->addr_data_f3 = current_ring_node_f3->buffer_address; // 0x14 |
|
1095 | waveform_picker_regs->addr_data_f3 = current_ring_node_f3->buffer_address; // 0x14 | |
1185 | reset_wfp_status(); // 0x18 |
|
1096 | reset_wfp_status(); // 0x18 | |
1186 | // |
|
1097 | // | |
1187 | set_wfp_delta_snapshot(); // 0x1c |
|
1098 | set_wfp_delta_snapshot(); // 0x1c | |
1188 | set_wfp_delta_f0_f0_2(); // 0x20, 0x24 |
|
1099 | set_wfp_delta_f0_f0_2(); // 0x20, 0x24 | |
1189 | set_wfp_delta_f1(); // 0x28 |
|
1100 | set_wfp_delta_f1(); // 0x28 | |
1190 | set_wfp_delta_f2(); // 0x2c |
|
1101 | set_wfp_delta_f2(); // 0x2c | |
1191 | DEBUG_PRINTF1("delta_snapshot %x\n", waveform_picker_regs->delta_snapshot) |
|
1102 | DEBUG_PRINTF1("delta_snapshot %x\n", waveform_picker_regs->delta_snapshot) | |
1192 | DEBUG_PRINTF1("delta_f0 %x\n", waveform_picker_regs->delta_f0) |
|
1103 | DEBUG_PRINTF1("delta_f0 %x\n", waveform_picker_regs->delta_f0) | |
1193 | DEBUG_PRINTF1("delta_f0_2 %x\n", waveform_picker_regs->delta_f0_2) |
|
1104 | DEBUG_PRINTF1("delta_f0_2 %x\n", waveform_picker_regs->delta_f0_2) | |
1194 | DEBUG_PRINTF1("delta_f1 %x\n", waveform_picker_regs->delta_f1) |
|
1105 | DEBUG_PRINTF1("delta_f1 %x\n", waveform_picker_regs->delta_f1) | |
1195 | DEBUG_PRINTF1("delta_f2 %x\n", waveform_picker_regs->delta_f2) |
|
1106 | DEBUG_PRINTF1("delta_f2 %x\n", waveform_picker_regs->delta_f2) | |
1196 | // 2688 = 8 * 336 |
|
1107 | // 2688 = 8 * 336 | |
1197 | waveform_picker_regs->nb_data_by_buffer = 0xa7f; // 0x30 *** 2688 - 1 => nb samples -1 |
|
1108 | waveform_picker_regs->nb_data_by_buffer = 0xa7f; // 0x30 *** 2688 - 1 => nb samples -1 | |
1198 | waveform_picker_regs->snapshot_param = 0xa80; // 0x34 *** 2688 => nb samples |
|
1109 | waveform_picker_regs->snapshot_param = 0xa80; // 0x34 *** 2688 => nb samples | |
1199 | waveform_picker_regs->start_date = 0x00; // 0x38 |
|
1110 | waveform_picker_regs->start_date = 0x00; // 0x38 | |
1200 | waveform_picker_regs->nb_word_in_buffer = 0x1f82; // 0x3c *** 2688 * 3 + 2 = 8066 |
|
1111 | waveform_picker_regs->nb_word_in_buffer = 0x1f82; // 0x3c *** 2688 * 3 + 2 = 8066 | |
1201 | } |
|
1112 | } | |
1202 |
|
1113 | |||
1203 | void set_wfp_data_shaping( void ) |
|
1114 | void set_wfp_data_shaping( void ) | |
1204 | { |
|
1115 | { | |
1205 | /** This function sets the data_shaping register of the waveform picker module. |
|
1116 | /** This function sets the data_shaping register of the waveform picker module. | |
1206 | * |
|
1117 | * | |
1207 | * The value is read from one field of the parameter_dump_packet structure:\n |
|
1118 | * The value is read from one field of the parameter_dump_packet structure:\n | |
1208 | * bw_sp0_sp1_r0_r1 |
|
1119 | * bw_sp0_sp1_r0_r1 | |
1209 | * |
|
1120 | * | |
1210 | */ |
|
1121 | */ | |
1211 |
|
1122 | |||
1212 | unsigned char data_shaping; |
|
1123 | unsigned char data_shaping; | |
1213 |
|
1124 | |||
1214 | // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register |
|
1125 | // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register | |
1215 | // waveform picker : [R1 R0 SP1 SP0 BW] |
|
1126 | // waveform picker : [R1 R0 SP1 SP0 BW] | |
1216 |
|
1127 | |||
1217 | data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1; |
|
1128 | data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1; | |
1218 |
|
1129 | |||
1219 | waveform_picker_regs->data_shaping = |
|
1130 | waveform_picker_regs->data_shaping = | |
1220 | ( (data_shaping & 0x10) >> 4 ) // BW |
|
1131 | ( (data_shaping & 0x10) >> 4 ) // BW | |
1221 | + ( (data_shaping & 0x08) >> 2 ) // SP0 |
|
1132 | + ( (data_shaping & 0x08) >> 2 ) // SP0 | |
1222 | + ( (data_shaping & 0x04) ) // SP1 |
|
1133 | + ( (data_shaping & 0x04) ) // SP1 | |
1223 | + ( (data_shaping & 0x02) << 2 ) // R0 |
|
1134 | + ( (data_shaping & 0x02) << 2 ) // R0 | |
1224 | + ( (data_shaping & 0x01) << 4 ); // R1 |
|
1135 | + ( (data_shaping & 0x01) << 4 ); // R1 | |
1225 | } |
|
1136 | } | |
1226 |
|
1137 | |||
1227 | void set_wfp_burst_enable_register( unsigned char mode ) |
|
1138 | void set_wfp_burst_enable_register( unsigned char mode ) | |
1228 | { |
|
1139 | { | |
1229 | /** This function sets the waveform picker burst_enable register depending on the mode. |
|
1140 | /** This function sets the waveform picker burst_enable register depending on the mode. | |
1230 | * |
|
1141 | * | |
1231 | * @param mode is the LFR mode to launch. |
|
1142 | * @param mode is the LFR mode to launch. | |
1232 | * |
|
1143 | * | |
1233 | * The burst bits shall be before the enable bits. |
|
1144 | * The burst bits shall be before the enable bits. | |
1234 | * |
|
1145 | * | |
1235 | */ |
|
1146 | */ | |
1236 |
|
1147 | |||
1237 | // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0 |
|
1148 | // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0 | |
1238 | // the burst bits shall be set first, before the enable bits |
|
1149 | // the burst bits shall be set first, before the enable bits | |
1239 | switch(mode) { |
|
1150 | switch(mode) { | |
1240 | case(LFR_MODE_NORMAL): |
|
1151 | case(LFR_MODE_NORMAL): | |
1241 | waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enable |
|
1152 | waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enable | |
1242 | waveform_picker_regs->run_burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0 |
|
1153 | waveform_picker_regs->run_burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0 | |
1243 | break; |
|
1154 | break; | |
1244 | case(LFR_MODE_BURST): |
|
1155 | case(LFR_MODE_BURST): | |
1245 | waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled |
|
1156 | waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled | |
1246 | // waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x04; // [0100] enable f2 |
|
1157 | // waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x04; // [0100] enable f2 | |
1247 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0c; // [1100] enable f3 AND f2 |
|
1158 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0c; // [1100] enable f3 AND f2 | |
1248 | break; |
|
1159 | break; | |
1249 | case(LFR_MODE_SBM1): |
|
1160 | case(LFR_MODE_SBM1): | |
1250 | waveform_picker_regs->run_burst_enable = 0x20; // [0010 0000] f1 burst enabled |
|
1161 | waveform_picker_regs->run_burst_enable = 0x20; // [0010 0000] f1 burst enabled | |
1251 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 |
|
1162 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 | |
1252 | break; |
|
1163 | break; | |
1253 | case(LFR_MODE_SBM2): |
|
1164 | case(LFR_MODE_SBM2): | |
1254 | waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled |
|
1165 | waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled | |
1255 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 |
|
1166 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 | |
1256 | break; |
|
1167 | break; | |
1257 | default: |
|
1168 | default: | |
1258 | waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled |
|
1169 | waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled | |
1259 | break; |
|
1170 | break; | |
1260 | } |
|
1171 | } | |
1261 | } |
|
1172 | } | |
1262 |
|
1173 | |||
1263 | void set_wfp_delta_snapshot( void ) |
|
1174 | void set_wfp_delta_snapshot( void ) | |
1264 | { |
|
1175 | { | |
1265 | /** This function sets the delta_snapshot register of the waveform picker module. |
|
1176 | /** This function sets the delta_snapshot register of the waveform picker module. | |
1266 | * |
|
1177 | * | |
1267 | * The value is read from two (unsigned char) of the parameter_dump_packet structure: |
|
1178 | * The value is read from two (unsigned char) of the parameter_dump_packet structure: | |
1268 | * - sy_lfr_n_swf_p[0] |
|
1179 | * - sy_lfr_n_swf_p[0] | |
1269 | * - sy_lfr_n_swf_p[1] |
|
1180 | * - sy_lfr_n_swf_p[1] | |
1270 | * |
|
1181 | * | |
1271 | */ |
|
1182 | */ | |
1272 |
|
1183 | |||
1273 | unsigned int delta_snapshot; |
|
1184 | unsigned int delta_snapshot; | |
1274 | unsigned int delta_snapshot_in_T2; |
|
1185 | unsigned int delta_snapshot_in_T2; | |
1275 |
|
1186 | |||
1276 | delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256 |
|
1187 | delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256 | |
1277 | + parameter_dump_packet.sy_lfr_n_swf_p[1]; |
|
1188 | + parameter_dump_packet.sy_lfr_n_swf_p[1]; | |
1278 |
|
1189 | |||
1279 | delta_snapshot_in_T2 = delta_snapshot * 256; |
|
1190 | delta_snapshot_in_T2 = delta_snapshot * 256; | |
1280 | waveform_picker_regs->delta_snapshot = delta_snapshot_in_T2 - 1; // max 4 bytes |
|
1191 | waveform_picker_regs->delta_snapshot = delta_snapshot_in_T2 - 1; // max 4 bytes | |
1281 | } |
|
1192 | } | |
1282 |
|
1193 | |||
1283 | void set_wfp_delta_f0_f0_2( void ) |
|
1194 | void set_wfp_delta_f0_f0_2( void ) | |
1284 | { |
|
1195 | { | |
1285 | unsigned int delta_snapshot; |
|
1196 | unsigned int delta_snapshot; | |
1286 | unsigned int nb_samples_per_snapshot; |
|
1197 | unsigned int nb_samples_per_snapshot; | |
1287 | float delta_f0_in_float; |
|
1198 | float delta_f0_in_float; | |
1288 |
|
1199 | |||
1289 | delta_snapshot = waveform_picker_regs->delta_snapshot; |
|
1200 | delta_snapshot = waveform_picker_regs->delta_snapshot; | |
1290 | nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1]; |
|
1201 | nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1]; | |
1291 | delta_f0_in_float =nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 24576.) * 256.; |
|
1202 | delta_f0_in_float =nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 24576.) * 256.; | |
1292 |
|
1203 | |||
1293 | waveform_picker_regs->delta_f0 = delta_snapshot - floor( delta_f0_in_float ); |
|
1204 | waveform_picker_regs->delta_f0 = delta_snapshot - floor( delta_f0_in_float ); | |
1294 | waveform_picker_regs->delta_f0_2 = 0x7; // max 7 bits |
|
1205 | waveform_picker_regs->delta_f0_2 = 0x7; // max 7 bits | |
1295 | } |
|
1206 | } | |
1296 |
|
1207 | |||
1297 | void set_wfp_delta_f1( void ) |
|
1208 | void set_wfp_delta_f1( void ) | |
1298 | { |
|
1209 | { | |
1299 | unsigned int delta_snapshot; |
|
1210 | unsigned int delta_snapshot; | |
1300 | unsigned int nb_samples_per_snapshot; |
|
1211 | unsigned int nb_samples_per_snapshot; | |
1301 | float delta_f1_in_float; |
|
1212 | float delta_f1_in_float; | |
1302 |
|
1213 | |||
1303 | delta_snapshot = waveform_picker_regs->delta_snapshot; |
|
1214 | delta_snapshot = waveform_picker_regs->delta_snapshot; | |
1304 | nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1]; |
|
1215 | nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1]; | |
1305 | delta_f1_in_float = nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 4096.) * 256.; |
|
1216 | delta_f1_in_float = nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 4096.) * 256.; | |
1306 |
|
1217 | |||
1307 | waveform_picker_regs->delta_f1 = delta_snapshot - floor( delta_f1_in_float ); |
|
1218 | waveform_picker_regs->delta_f1 = delta_snapshot - floor( delta_f1_in_float ); | |
1308 | } |
|
1219 | } | |
1309 |
|
1220 | |||
1310 | void set_wfp_delta_f2() |
|
1221 | void set_wfp_delta_f2() | |
1311 | { |
|
1222 | { | |
1312 | unsigned int delta_snapshot; |
|
1223 | unsigned int delta_snapshot; | |
1313 | unsigned int nb_samples_per_snapshot; |
|
1224 | unsigned int nb_samples_per_snapshot; | |
1314 |
|
1225 | |||
1315 | delta_snapshot = waveform_picker_regs->delta_snapshot; |
|
1226 | delta_snapshot = waveform_picker_regs->delta_snapshot; | |
1316 | nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1]; |
|
1227 | nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1]; | |
1317 |
|
1228 | |||
1318 | waveform_picker_regs->delta_f2 = delta_snapshot - nb_samples_per_snapshot / 2; |
|
1229 | waveform_picker_regs->delta_f2 = delta_snapshot - nb_samples_per_snapshot / 2; | |
1319 | } |
|
1230 | } | |
1320 |
|
1231 | |||
1321 | //***************** |
|
1232 | //***************** | |
1322 | // local parameters |
|
1233 | // local parameters | |
1323 |
|
1234 | |||
1324 | void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid ) |
|
1235 | void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid ) | |
1325 | { |
|
1236 | { | |
1326 | /** This function increments the parameter "sequence_cnt" depending on the sid passed in argument. |
|
1237 | /** This function increments the parameter "sequence_cnt" depending on the sid passed in argument. | |
1327 | * |
|
1238 | * | |
1328 | * @param packet_sequence_control is a pointer toward the parameter sequence_cnt to update. |
|
1239 | * @param packet_sequence_control is a pointer toward the parameter sequence_cnt to update. | |
1329 | * @param sid is the source identifier of the packet being updated. |
|
1240 | * @param sid is the source identifier of the packet being updated. | |
1330 | * |
|
1241 | * | |
1331 | * REQ-LFR-SRS-5240 / SSS-CP-FS-590 |
|
1242 | * REQ-LFR-SRS-5240 / SSS-CP-FS-590 | |
1332 | * The sequence counters shall wrap around from 2^14 to zero. |
|
1243 | * The sequence counters shall wrap around from 2^14 to zero. | |
1333 | * The sequence counter shall start at zero at startup. |
|
1244 | * The sequence counter shall start at zero at startup. | |
1334 | * |
|
1245 | * | |
1335 | * REQ-LFR-SRS-5239 / SSS-CP-FS-580 |
|
1246 | * REQ-LFR-SRS-5239 / SSS-CP-FS-580 | |
1336 | * All TM_LFR_SCIENCE_ packets are sent to ground, i.e. destination id = 0 |
|
1247 | * All TM_LFR_SCIENCE_ packets are sent to ground, i.e. destination id = 0 | |
1337 | * |
|
1248 | * | |
1338 | */ |
|
1249 | */ | |
1339 |
|
1250 | |||
1340 | unsigned short *sequence_cnt; |
|
1251 | unsigned short *sequence_cnt; | |
1341 | unsigned short segmentation_grouping_flag; |
|
1252 | unsigned short segmentation_grouping_flag; | |
1342 | unsigned short new_packet_sequence_control; |
|
1253 | unsigned short new_packet_sequence_control; | |
1343 | rtems_mode initial_mode_set; |
|
1254 | rtems_mode initial_mode_set; | |
1344 | rtems_mode current_mode_set; |
|
1255 | rtems_mode current_mode_set; | |
1345 | rtems_status_code status; |
|
1256 | rtems_status_code status; | |
1346 |
|
1257 | |||
1347 | //****************************************** |
|
1258 | //****************************************** | |
1348 | // CHANGE THE MODE OF THE CALLING RTEMS TASK |
|
1259 | // CHANGE THE MODE OF THE CALLING RTEMS TASK | |
1349 | status = rtems_task_mode( RTEMS_NO_PREEMPT, RTEMS_PREEMPT_MASK, &initial_mode_set ); |
|
1260 | status = rtems_task_mode( RTEMS_NO_PREEMPT, RTEMS_PREEMPT_MASK, &initial_mode_set ); | |
1350 |
|
1261 | |||
1351 | if ( (sid == SID_NORM_SWF_F0) || (sid == SID_NORM_SWF_F1) || (sid == SID_NORM_SWF_F2) |
|
1262 | if ( (sid == SID_NORM_SWF_F0) || (sid == SID_NORM_SWF_F1) || (sid == SID_NORM_SWF_F2) | |
1352 | || (sid == SID_NORM_CWF_F3) || (sid == SID_NORM_CWF_LONG_F3) |
|
1263 | || (sid == SID_NORM_CWF_F3) || (sid == SID_NORM_CWF_LONG_F3) | |
1353 | || (sid == SID_BURST_CWF_F2) |
|
1264 | || (sid == SID_BURST_CWF_F2) | |
1354 | || (sid == SID_NORM_ASM_F0) || (sid == SID_NORM_ASM_F1) || (sid == SID_NORM_ASM_F2) |
|
1265 | || (sid == SID_NORM_ASM_F0) || (sid == SID_NORM_ASM_F1) || (sid == SID_NORM_ASM_F2) | |
1355 | || (sid == SID_NORM_BP1_F0) || (sid == SID_NORM_BP1_F1) || (sid == SID_NORM_BP1_F2) |
|
1266 | || (sid == SID_NORM_BP1_F0) || (sid == SID_NORM_BP1_F1) || (sid == SID_NORM_BP1_F2) | |
1356 | || (sid == SID_NORM_BP2_F0) || (sid == SID_NORM_BP2_F1) || (sid == SID_NORM_BP2_F2) |
|
1267 | || (sid == SID_NORM_BP2_F0) || (sid == SID_NORM_BP2_F1) || (sid == SID_NORM_BP2_F2) | |
1357 | || (sid == SID_BURST_BP1_F0) || (sid == SID_BURST_BP2_F0) |
|
1268 | || (sid == SID_BURST_BP1_F0) || (sid == SID_BURST_BP2_F0) | |
1358 | || (sid == SID_BURST_BP1_F1) || (sid == SID_BURST_BP2_F1) ) |
|
1269 | || (sid == SID_BURST_BP1_F1) || (sid == SID_BURST_BP2_F1) ) | |
1359 | { |
|
1270 | { | |
1360 | sequence_cnt = (unsigned short *) &sequenceCounters_SCIENCE_NORMAL_BURST; |
|
1271 | sequence_cnt = (unsigned short *) &sequenceCounters_SCIENCE_NORMAL_BURST; | |
1361 | } |
|
1272 | } | |
1362 | else if ( (sid ==SID_SBM1_CWF_F1) || (sid ==SID_SBM2_CWF_F2) |
|
1273 | else if ( (sid ==SID_SBM1_CWF_F1) || (sid ==SID_SBM2_CWF_F2) | |
1363 | || (sid == SID_SBM1_BP1_F0) || (sid == SID_SBM1_BP2_F0) |
|
1274 | || (sid == SID_SBM1_BP1_F0) || (sid == SID_SBM1_BP2_F0) | |
1364 | || (sid == SID_SBM2_BP1_F0) || (sid == SID_SBM2_BP2_F0) |
|
1275 | || (sid == SID_SBM2_BP1_F0) || (sid == SID_SBM2_BP2_F0) | |
1365 | || (sid == SID_SBM2_BP1_F1) || (sid == SID_SBM2_BP2_F1) ) |
|
1276 | || (sid == SID_SBM2_BP1_F1) || (sid == SID_SBM2_BP2_F1) ) | |
1366 | { |
|
1277 | { | |
1367 | sequence_cnt = (unsigned short *) &sequenceCounters_SCIENCE_SBM1_SBM2; |
|
1278 | sequence_cnt = (unsigned short *) &sequenceCounters_SCIENCE_SBM1_SBM2; | |
1368 | } |
|
1279 | } | |
1369 | else |
|
1280 | else | |
1370 | { |
|
1281 | { | |
1371 | sequence_cnt = (unsigned short *) NULL; |
|
1282 | sequence_cnt = (unsigned short *) NULL; | |
1372 | PRINTF1("in increment_seq_counter_source_id *** ERR apid_destid %d not known\n", sid) |
|
1283 | PRINTF1("in increment_seq_counter_source_id *** ERR apid_destid %d not known\n", sid) | |
1373 | } |
|
1284 | } | |
1374 |
|
1285 | |||
1375 | if (sequence_cnt != NULL) |
|
1286 | if (sequence_cnt != NULL) | |
1376 | { |
|
1287 | { | |
1377 | segmentation_grouping_flag = TM_PACKET_SEQ_CTRL_STANDALONE << 8; |
|
1288 | segmentation_grouping_flag = TM_PACKET_SEQ_CTRL_STANDALONE << 8; | |
1378 | *sequence_cnt = (*sequence_cnt) & 0x3fff; |
|
1289 | *sequence_cnt = (*sequence_cnt) & 0x3fff; | |
1379 |
|
1290 | |||
1380 | new_packet_sequence_control = segmentation_grouping_flag | (*sequence_cnt) ; |
|
1291 | new_packet_sequence_control = segmentation_grouping_flag | (*sequence_cnt) ; | |
1381 |
|
1292 | |||
1382 | packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8); |
|
1293 | packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8); | |
1383 | packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control ); |
|
1294 | packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control ); | |
1384 |
|
1295 | |||
1385 | // increment the sequence counter |
|
1296 | // increment the sequence counter | |
1386 | if ( *sequence_cnt < SEQ_CNT_MAX) |
|
1297 | if ( *sequence_cnt < SEQ_CNT_MAX) | |
1387 | { |
|
1298 | { | |
1388 | *sequence_cnt = *sequence_cnt + 1; |
|
1299 | *sequence_cnt = *sequence_cnt + 1; | |
1389 | } |
|
1300 | } | |
1390 | else |
|
1301 | else | |
1391 | { |
|
1302 | { | |
1392 | *sequence_cnt = 0; |
|
1303 | *sequence_cnt = 0; | |
1393 | } |
|
1304 | } | |
1394 | } |
|
1305 | } | |
1395 |
|
1306 | |||
1396 | //*********************************** |
|
1307 | //*********************************** | |
1397 | // RESET THE MODE OF THE CALLING TASK |
|
1308 | // RESET THE MODE OF THE CALLING TASK | |
1398 | status = rtems_task_mode( initial_mode_set, RTEMS_PREEMPT_MASK, ¤t_mode_set ); |
|
1309 | status = rtems_task_mode( initial_mode_set, RTEMS_PREEMPT_MASK, ¤t_mode_set ); | |
1399 | } |
|
1310 | } |
General Comments 0
You need to be logged in to leave comments.
Login now