##// END OF EJS Templates
snapshot extraction for the waveform ring is operational...
paul -
r105:ecfd2ffe3033 VHDLib206
parent child
Show More
@@ -1,253 +1,253
1 1 #############################################################################
2 2 # Makefile for building: bin/fsw
3 # Generated by qmake (2.01a) (Qt 4.8.5) on: Tue Mar 4 09:15:37 2014
3 # Generated by qmake (2.01a) (Qt 4.8.5) on: Tue Mar 4 13:06:39 2014
4 4 # Project: fsw-qt.pro
5 5 # Template: app
6 6 # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
7 7 #############################################################################
8 8
9 9 ####### Compiler, tools and options
10 10
11 11 CC = sparc-rtems-gcc
12 12 CXX = sparc-rtems-g++
13 DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=2 -DPRINT_MESSAGES_ON_CONSOLE -DDEBUG_MESSAGES
13 DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=3 -DPRINT_MESSAGES_ON_CONSOLE
14 14 CFLAGS = -pipe -O3 -Wall $(DEFINES)
15 15 CXXFLAGS = -pipe -O3 -Wall $(DEFINES)
16 16 INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header -I../../LFR_basic-parameters
17 17 LINK = sparc-rtems-g++
18 18 LFLAGS =
19 19 LIBS = $(SUBLIBS)
20 20 AR = sparc-rtems-ar rcs
21 21 RANLIB =
22 22 QMAKE = /usr/bin/qmake-qt4
23 23 TAR = tar -cf
24 24 COMPRESS = gzip -9f
25 25 COPY = cp -f
26 26 SED = sed
27 27 COPY_FILE = $(COPY)
28 28 COPY_DIR = $(COPY) -r
29 29 STRIP = sparc-rtems-strip
30 30 INSTALL_FILE = install -m 644 -p
31 31 INSTALL_DIR = $(COPY_DIR)
32 32 INSTALL_PROGRAM = install -m 755 -p
33 33 DEL_FILE = rm -f
34 34 SYMLINK = ln -f -s
35 35 DEL_DIR = rmdir
36 36 MOVE = mv -f
37 37 CHK_DIR_EXISTS= test -d
38 38 MKDIR = mkdir -p
39 39
40 40 ####### Output directory
41 41
42 42 OBJECTS_DIR = obj/
43 43
44 44 ####### Files
45 45
46 46 SOURCES = ../src/wf_handler.c \
47 47 ../src/tc_handler.c \
48 48 ../src/fsw_processing.c \
49 49 ../src/fsw_misc.c \
50 50 ../src/fsw_init.c \
51 51 ../src/fsw_globals.c \
52 52 ../src/fsw_spacewire.c \
53 53 ../src/tc_load_dump_parameters.c \
54 54 ../src/tm_lfr_tc_exe.c \
55 55 ../src/tc_acceptance.c \
56 56 ../../LFR_basic-parameters/basic_parameters.c
57 57 OBJECTS = obj/wf_handler.o \
58 58 obj/tc_handler.o \
59 59 obj/fsw_processing.o \
60 60 obj/fsw_misc.o \
61 61 obj/fsw_init.o \
62 62 obj/fsw_globals.o \
63 63 obj/fsw_spacewire.o \
64 64 obj/tc_load_dump_parameters.o \
65 65 obj/tm_lfr_tc_exe.o \
66 66 obj/tc_acceptance.o \
67 67 obj/basic_parameters.o
68 68 DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \
69 69 /usr/lib64/qt4/mkspecs/common/linux.conf \
70 70 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
71 71 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
72 72 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
73 73 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
74 74 /usr/lib64/qt4/mkspecs/qconfig.pri \
75 75 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
76 76 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
77 77 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
78 78 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
79 79 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
80 80 sparc.pri \
81 81 /usr/lib64/qt4/mkspecs/features/release.prf \
82 82 /usr/lib64/qt4/mkspecs/features/default_post.prf \
83 83 /usr/lib64/qt4/mkspecs/features/shared.prf \
84 84 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
85 85 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
86 86 /usr/lib64/qt4/mkspecs/features/resources.prf \
87 87 /usr/lib64/qt4/mkspecs/features/uic.prf \
88 88 /usr/lib64/qt4/mkspecs/features/yacc.prf \
89 89 /usr/lib64/qt4/mkspecs/features/lex.prf \
90 90 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \
91 91 fsw-qt.pro
92 92 QMAKE_TARGET = fsw
93 93 DESTDIR = bin/
94 94 TARGET = bin/fsw
95 95
96 96 first: all
97 97 ####### Implicit rules
98 98
99 99 .SUFFIXES: .o .c .cpp .cc .cxx .C
100 100
101 101 .cpp.o:
102 102 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
103 103
104 104 .cc.o:
105 105 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
106 106
107 107 .cxx.o:
108 108 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
109 109
110 110 .C.o:
111 111 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
112 112
113 113 .c.o:
114 114 $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
115 115
116 116 ####### Build rules
117 117
118 118 all: Makefile $(TARGET)
119 119
120 120 $(TARGET): $(OBJECTS)
121 121 @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/
122 122 $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
123 123
124 124 Makefile: fsw-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \
125 125 /usr/lib64/qt4/mkspecs/common/linux.conf \
126 126 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
127 127 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
128 128 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
129 129 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
130 130 /usr/lib64/qt4/mkspecs/qconfig.pri \
131 131 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
132 132 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
133 133 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
134 134 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
135 135 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
136 136 sparc.pri \
137 137 /usr/lib64/qt4/mkspecs/features/release.prf \
138 138 /usr/lib64/qt4/mkspecs/features/default_post.prf \
139 139 /usr/lib64/qt4/mkspecs/features/shared.prf \
140 140 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
141 141 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
142 142 /usr/lib64/qt4/mkspecs/features/resources.prf \
143 143 /usr/lib64/qt4/mkspecs/features/uic.prf \
144 144 /usr/lib64/qt4/mkspecs/features/yacc.prf \
145 145 /usr/lib64/qt4/mkspecs/features/lex.prf \
146 146 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf
147 147 $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
148 148 /usr/lib64/qt4/mkspecs/common/unix.conf:
149 149 /usr/lib64/qt4/mkspecs/common/linux.conf:
150 150 /usr/lib64/qt4/mkspecs/common/gcc-base.conf:
151 151 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf:
152 152 /usr/lib64/qt4/mkspecs/common/g++-base.conf:
153 153 /usr/lib64/qt4/mkspecs/common/g++-unix.conf:
154 154 /usr/lib64/qt4/mkspecs/qconfig.pri:
155 155 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri:
156 156 /usr/lib64/qt4/mkspecs/features/qt_functions.prf:
157 157 /usr/lib64/qt4/mkspecs/features/qt_config.prf:
158 158 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf:
159 159 /usr/lib64/qt4/mkspecs/features/default_pre.prf:
160 160 sparc.pri:
161 161 /usr/lib64/qt4/mkspecs/features/release.prf:
162 162 /usr/lib64/qt4/mkspecs/features/default_post.prf:
163 163 /usr/lib64/qt4/mkspecs/features/shared.prf:
164 164 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf:
165 165 /usr/lib64/qt4/mkspecs/features/warn_on.prf:
166 166 /usr/lib64/qt4/mkspecs/features/resources.prf:
167 167 /usr/lib64/qt4/mkspecs/features/uic.prf:
168 168 /usr/lib64/qt4/mkspecs/features/yacc.prf:
169 169 /usr/lib64/qt4/mkspecs/features/lex.prf:
170 170 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf:
171 171 qmake: FORCE
172 172 @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
173 173
174 174 dist:
175 175 @$(CHK_DIR_EXISTS) obj/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0
176 176 $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/fsw1.0.0/ && (cd `dirname obj/fsw1.0.0` && $(TAR) fsw1.0.0.tar fsw1.0.0 && $(COMPRESS) fsw1.0.0.tar) && $(MOVE) `dirname obj/fsw1.0.0`/fsw1.0.0.tar.gz . && $(DEL_FILE) -r obj/fsw1.0.0
177 177
178 178
179 179 clean:compiler_clean
180 180 -$(DEL_FILE) $(OBJECTS)
181 181 -$(DEL_FILE) *~ core *.core
182 182
183 183
184 184 ####### Sub-libraries
185 185
186 186 distclean: clean
187 187 -$(DEL_FILE) $(TARGET)
188 188 -$(DEL_FILE) Makefile
189 189
190 190
191 191 grmon:
192 192 cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u
193 193
194 194 check: first
195 195
196 196 compiler_rcc_make_all:
197 197 compiler_rcc_clean:
198 198 compiler_uic_make_all:
199 199 compiler_uic_clean:
200 200 compiler_image_collection_make_all: qmake_image_collection.cpp
201 201 compiler_image_collection_clean:
202 202 -$(DEL_FILE) qmake_image_collection.cpp
203 203 compiler_yacc_decl_make_all:
204 204 compiler_yacc_decl_clean:
205 205 compiler_yacc_impl_make_all:
206 206 compiler_yacc_impl_clean:
207 207 compiler_lex_make_all:
208 208 compiler_lex_clean:
209 209 compiler_clean:
210 210
211 211 ####### Compile
212 212
213 213 obj/wf_handler.o: ../src/wf_handler.c
214 214 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/wf_handler.o ../src/wf_handler.c
215 215
216 216 obj/tc_handler.o: ../src/tc_handler.c
217 217 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o ../src/tc_handler.c
218 218
219 219 obj/fsw_processing.o: ../src/fsw_processing.c ../src/fsw_processing_globals.c
220 220 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/fsw_processing.c
221 221
222 222 obj/fsw_misc.o: ../src/fsw_misc.c
223 223 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c
224 224
225 225 obj/fsw_init.o: ../src/fsw_init.c ../src/fsw_config.c
226 226 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o ../src/fsw_init.c
227 227
228 228 obj/fsw_globals.o: ../src/fsw_globals.c
229 229 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c
230 230
231 231 obj/fsw_spacewire.o: ../src/fsw_spacewire.c
232 232 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spacewire.o ../src/fsw_spacewire.c
233 233
234 234 obj/tc_load_dump_parameters.o: ../src/tc_load_dump_parameters.c
235 235 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_load_dump_parameters.o ../src/tc_load_dump_parameters.c
236 236
237 237 obj/tm_lfr_tc_exe.o: ../src/tm_lfr_tc_exe.c
238 238 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tm_lfr_tc_exe.o ../src/tm_lfr_tc_exe.c
239 239
240 240 obj/tc_acceptance.o: ../src/tc_acceptance.c
241 241 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_acceptance.o ../src/tc_acceptance.c
242 242
243 243 obj/basic_parameters.o: ../../LFR_basic-parameters/basic_parameters.c ../../LFR_basic-parameters/basic_parameters.h
244 244 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/basic_parameters.o ../../LFR_basic-parameters/basic_parameters.c
245 245
246 246 ####### Install
247 247
248 248 install: FORCE
249 249
250 250 uninstall: FORCE
251 251
252 252 FORCE:
253 253
@@ -1,77 +1,77
1 1 TEMPLATE = app
2 2 # CONFIG += console v8 sim
3 3 # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report
4 CONFIG += console verbose debug_messages
4 CONFIG += console verbose
5 5 CONFIG -= qt
6 6
7 7 include(./sparc.pri)
8 8
9 9 # flight software version
10 10 SWVERSION=-1-0
11 11 DEFINES += SW_VERSION_N1=1 # major
12 12 DEFINES += SW_VERSION_N2=0 # minor
13 13 DEFINES += SW_VERSION_N3=0 # patch
14 DEFINES += SW_VERSION_N4=2 # internal
14 DEFINES += SW_VERSION_N4=3 # internal
15 15
16 16 contains( CONFIG, verbose ) {
17 17 DEFINES += PRINT_MESSAGES_ON_CONSOLE
18 18 }
19 19
20 20 contains( CONFIG, debug_messages ) {
21 21 DEFINES += DEBUG_MESSAGES
22 22 }
23 23
24 24 contains( CONFIG, cpu_usage_report ) {
25 25 DEFINES += PRINT_TASK_STATISTICS
26 26 }
27 27
28 28 contains( CONFIG, stack_report ) {
29 29 DEFINES += PRINT_STACK_REPORT
30 30 }
31 31
32 32 contains( CONFIG, boot_messages ) {
33 33 DEFINES += BOOT_MESSAGES
34 34 }
35 35
36 36 #doxygen.target = doxygen
37 37 #doxygen.commands = doxygen ../doc/Doxyfile
38 38 #QMAKE_EXTRA_TARGETS += doxygen
39 39
40 40 TARGET = fsw
41 41
42 42 INCLUDEPATH += \
43 43 ../src \
44 44 ../header \
45 45 ../../LFR_basic-parameters
46 46
47 47 SOURCES += \
48 48 ../src/wf_handler.c \
49 49 ../src/tc_handler.c \
50 50 ../src/fsw_processing.c \
51 51 ../src/fsw_misc.c \
52 52 ../src/fsw_init.c \
53 53 ../src/fsw_globals.c \
54 54 ../src/fsw_spacewire.c \
55 55 ../src/tc_load_dump_parameters.c \
56 56 ../src/tm_lfr_tc_exe.c \
57 57 ../src/tc_acceptance.c \
58 58 ../../LFR_basic-parameters/basic_parameters.c
59 59
60 60
61 61 HEADERS += \
62 62 ../header/wf_handler.h \
63 63 ../header/tc_handler.h \
64 64 ../header/grlib_regs.h \
65 65 ../header/fsw_processing.h \
66 66 ../header/fsw_params.h \
67 67 ../header/fsw_misc.h \
68 68 ../header/fsw_init.h \
69 69 ../header/ccsds_types.h \
70 70 ../header/fsw_params_processing.h \
71 71 ../header/fsw_spacewire.h \
72 72 ../header/tc_load_dump_parameters.h \
73 73 ../header/tm_lfr_tc_exe.h \
74 74 ../header/tc_acceptance.h \
75 75 ../header/fsw_params_nb_bytes.h \
76 76 ../../LFR_basic-parameters/basic_parameters.h
77 77
@@ -1,339 +1,339
1 1 <?xml version="1.0" encoding="UTF-8"?>
2 2 <!DOCTYPE QtCreatorProject>
3 <!-- Written by QtCreator 3.0.0, 2014-03-04T07:03:18. -->
3 <!-- Written by QtCreator 3.0.0, 2014-03-06T15:56:18. -->
4 4 <qtcreator>
5 5 <data>
6 6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
7 7 <value type="int">1</value>
8 8 </data>
9 9 <data>
10 10 <variable>ProjectExplorer.Project.EditorSettings</variable>
11 11 <valuemap type="QVariantMap">
12 12 <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
13 13 <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
14 14 <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
15 15 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
16 16 <value type="QString" key="language">Cpp</value>
17 17 <valuemap type="QVariantMap" key="value">
18 18 <value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
19 19 </valuemap>
20 20 </valuemap>
21 21 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
22 22 <value type="QString" key="language">QmlJS</value>
23 23 <valuemap type="QVariantMap" key="value">
24 24 <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
25 25 </valuemap>
26 26 </valuemap>
27 27 <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
28 28 <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
29 29 <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
30 30 <value type="int" key="EditorConfiguration.IndentSize">4</value>
31 31 <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
32 32 <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
33 33 <value type="int" key="EditorConfiguration.PaddingMode">1</value>
34 34 <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
35 35 <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
36 36 <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
37 37 <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
38 38 <value type="int" key="EditorConfiguration.TabSize">8</value>
39 39 <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
40 40 <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
41 41 <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
42 42 <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
43 43 <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
44 44 <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
45 45 </valuemap>
46 46 </data>
47 47 <data>
48 48 <variable>ProjectExplorer.Project.PluginSettings</variable>
49 49 <valuemap type="QVariantMap"/>
50 50 </data>
51 51 <data>
52 52 <variable>ProjectExplorer.Project.Target.0</variable>
53 53 <valuemap type="QVariantMap">
54 54 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
55 55 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
56 56 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{e04e3924-0bd8-4708-be18-f1474e45608e}</value>
57 57 <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
58 58 <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
59 59 <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
60 60 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
61 61 <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory"></value>
62 62 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
63 63 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
64 64 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
65 65 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
66 66 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
67 67 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
68 68 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
69 69 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value>
70 70 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
71 71 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
72 72 </valuemap>
73 73 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
74 74 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
75 75 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
76 76 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
77 77 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
78 78 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
79 79 <value type="QString">-w</value>
80 80 <value type="QString">-r</value>
81 81 </valuelist>
82 82 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
83 83 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
84 84 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
85 85 </valuemap>
86 86 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
87 87 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
88 88 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
89 89 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
90 90 </valuemap>
91 91 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
92 92 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
93 93 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
94 94 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
95 95 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
96 96 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
97 97 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
98 98 <value type="QString">-w</value>
99 99 <value type="QString">-r</value>
100 100 </valuelist>
101 101 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
102 102 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
103 103 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
104 104 </valuemap>
105 105 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
106 106 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
107 107 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
108 108 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
109 109 </valuemap>
110 110 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
111 111 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
112 112 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
113 113 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
114 114 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
115 115 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
116 116 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
117 117 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
118 118 </valuemap>
119 119 <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value>
120 120 <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
121 121 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
122 122 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
123 123 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
124 124 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
125 125 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
126 126 </valuemap>
127 127 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
128 128 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
129 129 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
130 130 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
131 131 </valuemap>
132 132 <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
133 133 <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
134 134 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
135 135 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
136 136 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
137 137 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
138 138 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
139 139 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
140 140 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
141 141 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
142 142 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
143 143 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
144 144 <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
145 145 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
146 146 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
147 147 <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
148 148 <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
149 149 <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
150 150 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
151 151 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
152 152 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
153 153 <value type="int">0</value>
154 154 <value type="int">1</value>
155 155 <value type="int">2</value>
156 156 <value type="int">3</value>
157 157 <value type="int">4</value>
158 158 <value type="int">5</value>
159 159 <value type="int">6</value>
160 160 <value type="int">7</value>
161 161 <value type="int">8</value>
162 162 <value type="int">9</value>
163 163 <value type="int">10</value>
164 164 <value type="int">11</value>
165 165 <value type="int">12</value>
166 166 <value type="int">13</value>
167 167 <value type="int">14</value>
168 168 </valuelist>
169 169 <value type="int" key="PE.EnvironmentAspect.Base">2</value>
170 170 <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
171 171 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value>
172 172 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
173 173 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value>
174 174 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
175 175 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value>
176 176 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
177 177 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>
178 178 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
179 179 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
180 180 <value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
181 181 <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
182 182 <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
183 183 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
184 184 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
185 185 </valuemap>
186 186 <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
187 187 </valuemap>
188 188 </data>
189 189 <data>
190 190 <variable>ProjectExplorer.Project.Target.1</variable>
191 191 <valuemap type="QVariantMap">
192 192 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.2 in PATH (System)</value>
193 193 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.2 in PATH (System)</value>
194 194 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{5289e843-9ef2-45ce-88c6-ad27d8e08def}</value>
195 195 <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
196 196 <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
197 197 <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
198 198 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
199 199 <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory"></value>
200 200 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
201 201 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
202 202 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
203 203 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
204 204 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
205 205 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
206 206 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
207 207 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value>
208 208 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
209 209 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
210 210 </valuemap>
211 211 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
212 212 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
213 213 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
214 214 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
215 215 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
216 216 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
217 217 <value type="QString">-w</value>
218 218 <value type="QString">-r</value>
219 219 </valuelist>
220 220 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
221 221 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
222 222 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
223 223 </valuemap>
224 224 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
225 225 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
226 226 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
227 227 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
228 228 </valuemap>
229 229 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
230 230 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
231 231 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
232 232 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
233 233 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
234 234 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
235 235 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
236 236 <value type="QString">-w</value>
237 237 <value type="QString">-r</value>
238 238 </valuelist>
239 239 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
240 240 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
241 241 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
242 242 </valuemap>
243 243 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
244 244 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
245 245 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
246 246 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
247 247 </valuemap>
248 248 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
249 249 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
250 250 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
251 251 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
252 252 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
253 253 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
254 254 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
255 255 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
256 256 </valuemap>
257 257 <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value>
258 258 <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
259 259 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
260 260 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
261 261 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
262 262 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
263 263 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
264 264 </valuemap>
265 265 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
266 266 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
267 267 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
268 268 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
269 269 </valuemap>
270 270 <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
271 271 <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
272 272 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
273 273 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
274 274 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
275 275 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
276 276 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
277 277 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
278 278 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
279 279 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
280 280 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
281 281 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
282 282 <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
283 283 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
284 284 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
285 285 <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
286 286 <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
287 287 <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
288 288 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
289 289 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
290 290 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
291 291 <value type="int">0</value>
292 292 <value type="int">1</value>
293 293 <value type="int">2</value>
294 294 <value type="int">3</value>
295 295 <value type="int">4</value>
296 296 <value type="int">5</value>
297 297 <value type="int">6</value>
298 298 <value type="int">7</value>
299 299 <value type="int">8</value>
300 300 <value type="int">9</value>
301 301 <value type="int">10</value>
302 302 <value type="int">11</value>
303 303 <value type="int">12</value>
304 304 <value type="int">13</value>
305 305 <value type="int">14</value>
306 306 </valuelist>
307 307 <value type="int" key="PE.EnvironmentAspect.Base">2</value>
308 308 <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
309 309 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value>
310 310 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
311 311 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value>
312 312 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
313 313 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value>
314 314 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
315 315 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>
316 316 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
317 317 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
318 318 <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
319 319 <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
320 320 <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
321 321 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
322 322 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
323 323 </valuemap>
324 324 <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
325 325 </valuemap>
326 326 </data>
327 327 <data>
328 328 <variable>ProjectExplorer.Project.TargetCount</variable>
329 329 <value type="int">2</value>
330 330 </data>
331 331 <data>
332 332 <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
333 333 <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value>
334 334 </data>
335 335 <data>
336 336 <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
337 337 <value type="int">15</value>
338 338 </data>
339 339 </qtcreator>
@@ -1,225 +1,226
1 1 #ifndef FSW_PARAMS_H_INCLUDED
2 2 #define FSW_PARAMS_H_INCLUDED
3 3
4 4 #include "grlib_regs.h"
5 5 #include "fsw_params_processing.h"
6 6 #include "fsw_params_nb_bytes.h"
7 7 #include "tm_byte_positions.h"
8 8 #include "ccsds_types.h"
9 9
10 10 #define GRSPW_DEVICE_NAME "/dev/grspw0"
11 11 #define UART_DEVICE_NAME "/dev/console"
12 12
13 13 typedef struct ring_node
14 14 {
15 15 struct ring_node *previous;
16 16 int buffer_address;
17 17 struct ring_node *next;
18 18 unsigned int status;
19 19 } ring_node;
20 20
21 21 //************************
22 22 // flight software version
23 23 // this parameters is handled by the Qt project options
24 24
25 25 #define NB_PACKETS_PER_GROUP_OF_CWF 8 // 8 packets containing 336 blk
26 26 #define NB_PACKETS_PER_GROUP_OF_CWF_LIGHT 4 // 4 packets containing 672 blk
27 27 #define NB_SAMPLES_PER_SNAPSHOT 2688 // 336 * 8 = 672 * 4 = 2688
28 28 #define TIME_OFFSET 2
29 29 #define TIME_OFFSET_IN_BYTES 8
30 30 #define WAVEFORM_EXTENDED_HEADER_OFFSET 22
31 31 #define NB_BYTES_SWF_BLK (2 * 6)
32 32 #define NB_WORDS_SWF_BLK 3
33 33 #define NB_BYTES_CWF3_LIGHT_BLK 6
34 34 #define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8
35 35 #define NB_RING_NODES_F0 3 // AT LEAST 3
36 36 #define NB_RING_NODES_F1 5 // AT LEAST 3
37 37 #define NB_RING_NODES_F2 5 // AT LEAST 3
38 38 #define NB_RING_NODES_ASM_F0 12 // AT LEAST 3
39 39 #define NB_RING_NODES_ASM_F1 2 // AT LEAST 3
40 40 #define NB_RING_NODES_ASM_F2 2 // AT LEAST 3
41 41
42 42 //**********
43 43 // LFR MODES
44 44 #define LFR_MODE_STANDBY 0
45 45 #define LFR_MODE_NORMAL 1
46 46 #define LFR_MODE_BURST 2
47 47 #define LFR_MODE_SBM1 3
48 48 #define LFR_MODE_SBM2 4
49 49
50 50 #define TDS_MODE_LFM 5
51 51 #define TDS_MODE_STANDBY 0
52 52 #define TDS_MODE_NORMAL 1
53 53 #define TDS_MODE_BURST 2
54 54 #define TDS_MODE_SBM1 3
55 55 #define TDS_MODE_SBM2 4
56 56
57 57 #define THR_MODE_STANDBY 0
58 58 #define THR_MODE_NORMAL 1
59 59 #define THR_MODE_BURST 2
60 60
61 61 #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0
62 62 #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1
63 63 #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2
64 64 #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3
65 65 #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4
66 66 #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5
67 67 #define RTEMS_EVENT_MODE_NORMAL_SWF_F0 RTEMS_EVENT_6
68 68 #define RTEMS_EVENT_MODE_NORMAL_SWF_F1 RTEMS_EVENT_7
69 69 #define RTEMS_EVENT_MODE_NORMAL_SWF_F2 RTEMS_EVENT_8
70 70
71 71 //****************************
72 72 // LFR DEFAULT MODE PARAMETERS
73 73 // COMMON
74 74 #define DEFAULT_SY_LFR_COMMON0 0x00
75 75 #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0
76 76 // NORM
77 77 #define SY_LFR_N_SWF_L 2048 // nb sample
78 78 #define SY_LFR_N_SWF_P 300 // sec
79 79 #define SY_LFR_N_ASM_P 3600 // sec
80 80 #define SY_LFR_N_BP_P0 4 // sec
81 81 #define SY_LFR_N_BP_P1 20 // sec
82 82 #define SY_LFR_N_CWF_LONG_F3 0 // 0 => production of light continuous waveforms at f3
83 83 #define MIN_DELTA_SNAPSHOT 16 // sec
84 84 // BURST
85 85 #define DEFAULT_SY_LFR_B_BP_P0 1 // sec
86 86 #define DEFAULT_SY_LFR_B_BP_P1 5 // sec
87 87 // SBM1
88 88 #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec
89 89 #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec
90 90 // SBM2
91 91 #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec
92 92 #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec
93 93 // ADDITIONAL PARAMETERS
94 94 #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms
95 95 #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s
96 96 // STATUS WORD
97 97 #define DEFAULT_STATUS_WORD_BYTE0 0x0d // [0000] [1] [101] mode 4 bits / SPW enabled 1 bit / state is run 3 bits
98 98 #define DEFAULT_STATUS_WORD_BYTE1 0x00
99 99 //
100 100 #define SY_LFR_DPU_CONNECT_TIMEOUT 100 // 100 * 10 ms = 1 s
101 101 #define SY_LFR_DPU_CONNECT_ATTEMPT 3
102 102 //****************************
103 103
104 104 //*****************************
105 105 // APB REGISTERS BASE ADDRESSES
106 106 #define REGS_ADDR_APBUART 0x80000100
107 107 #define REGS_ADDR_GPTIMER 0x80000300
108 108 #define REGS_ADDR_GRSPW 0x80000500
109 109 #define REGS_ADDR_TIME_MANAGEMENT 0x80000600
110 110 #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00
111 111 #define REGS_ADDR_WAVEFORM_PICKER 0x80000f20
112 112
113 113 #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff
114 114 #define APBUART_CTRL_REG_MASK_TE 0x00000002
115 115 #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50)
116 116
117 117 //**********
118 118 // IRQ LINES
119 119 #define IRQ_SM_SIMULATOR 9
120 120 #define IRQ_SPARC_SM_SIMULATOR 0x19 // see sparcv8.pdf p.76 for interrupt levels
121 121 #define IRQ_WAVEFORM_PICKER 14
122 122 #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels
123 123 #define IRQ_SPECTRAL_MATRIX 6
124 124 #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels
125 125
126 126 //*****
127 127 // TIME
128 128 #define CLKDIV_SM_SIMULATOR (10000 - 1) // 10 ms
129 129 #define TIMER_SM_SIMULATOR 1
130 130 #define HK_PERIOD 100 // 100 * 10ms => 1s
131 131 #define SY_LFR_TIME_SYN_TIMEOUT_in_ms 2000
132 132 #define SY_LFR_TIME_SYN_TIMEOUT_in_ticks 200 // 200 * 10 ms = 2 s
133 133
134 134 //**********
135 135 // LPP CODES
136 136 #define LFR_SUCCESSFUL 0
137 137 #define LFR_DEFAULT 1
138 138
139 139 //******
140 140 // RTEMS
141 141 #define TASKID_RECV 1
142 142 #define TASKID_ACTN 2
143 143 #define TASKID_SPIQ 3
144 144 #define TASKID_SMIQ 4
145 145 #define TASKID_STAT 5
146 146 #define TASKID_AVF0 6
147 //#define TASKID_BPF0 7
147 #define TASKID_SWBD 7
148 148 #define TASKID_WFRM 8
149 149 #define TASKID_DUMB 9
150 150 #define TASKID_HOUS 10
151 151 #define TASKID_MATR 11
152 152 #define TASKID_CWF3 12
153 153 #define TASKID_CWF2 13
154 154 #define TASKID_CWF1 14
155 155 #define TASKID_SEND 15
156 156 #define TASKID_WTDG 16
157 157
158 158 #define TASK_PRIORITY_SPIQ 5
159 159 #define TASK_PRIORITY_SMIQ 10
160 160 #define TASK_PRIORITY_WTDG 20
161 161 #define TASK_PRIORITY_HOUS 30
162 162 #define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together
163 163 #define TASK_PRIORITY_CWF2 35 //
164 164 #define TASK_PRIORITY_WFRM 40
165 165 #define TASK_PRIORITY_CWF3 40 // there is a printf in this function, be careful with its priority wrt CWF1
166 #define TASK_PRIORITY_SWBD 40
166 167 #define TASK_PRIORITY_SEND 45
167 168 #define TASK_PRIORITY_RECV 50
168 169 #define TASK_PRIORITY_ACTN 50
169 170 #define TASK_PRIORITY_AVF0 60
170 171 #define TASK_PRIORITY_BPF0 60
171 172 #define TASK_PRIORITY_MATR 100
172 173 #define TASK_PRIORITY_STAT 200
173 174 #define TASK_PRIORITY_DUMB 200
174 175
175 176 #define ACTION_MSG_QUEUE_COUNT 10
176 177 #define ACTION_MSG_PKTS_COUNT 50
177 178 #define ACTION_MSG_PKTS_MAX_SIZE (PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES)
178 179 #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options
179 180
180 181 #define QUEUE_RECV 0
181 182 #define QUEUE_SEND 1
182 183
183 184 //*******
184 185 // MACROS
185 186 #ifdef PRINT_MESSAGES_ON_CONSOLE
186 187 #define PRINTF(x) printf(x);
187 188 #define PRINTF1(x,y) printf(x,y);
188 189 #define PRINTF2(x,y,z) printf(x,y,z);
189 190 #else
190 191 #define PRINTF(x) ;
191 192 #define PRINTF1(x,y) ;
192 193 #define PRINTF2(x,y,z) ;
193 194 #endif
194 195
195 196 #ifdef BOOT_MESSAGES
196 197 #define BOOT_PRINTF(x) printf(x);
197 198 #define BOOT_PRINTF1(x,y) printf(x,y);
198 199 #define BOOT_PRINTF2(x,y,z) printf(x,y,z);
199 200 #else
200 201 #define BOOT_PRINTF(x) ;
201 202 #define BOOT_PRINTF1(x,y) ;
202 203 #define BOOT_PRINTF2(x,y,z) ;
203 204 #endif
204 205
205 206 #ifdef DEBUG_MESSAGES
206 207 #define DEBUG_PRINTF(x) printf(x);
207 208 #define DEBUG_PRINTF1(x,y) printf(x,y);
208 209 #define DEBUG_PRINTF2(x,y,z) printf(x,y,z);
209 210 #else
210 211 #define DEBUG_PRINTF(x) ;
211 212 #define DEBUG_PRINTF1(x,y) ;
212 213 #define DEBUG_PRINTF2(x,y,z) ;
213 214 #endif
214 215
215 216 #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period
216 217
217 218 struct param_local_str{
218 219 unsigned int local_sbm1_nb_cwf_sent;
219 220 unsigned int local_sbm1_nb_cwf_max;
220 221 unsigned int local_sbm2_nb_cwf_sent;
221 222 unsigned int local_sbm2_nb_cwf_max;
222 223 unsigned int local_nb_interrupt_f0_MAX;
223 224 };
224 225
225 226 #endif // FSW_PARAMS_H_INCLUDED
@@ -1,90 +1,96
1 1 #ifndef WF_HANDLER_H_INCLUDED
2 2 #define WF_HANDLER_H_INCLUDED
3 3
4 4 #include <rtems.h>
5 5 #include <grspw.h>
6 6 #include <stdio.h>
7 7 #include <math.h>
8 8
9 9 #include "fsw_params.h"
10 10 #include "fsw_spacewire.h"
11 11 #include "fsw_misc.h"
12 12
13 13 #define pi 3.1415
14 14
15 15 extern int fdSPW;
16 16
17 17 //*****************
18 18 // waveform buffers
19 19 // F0
20 20 //extern volatile int wf_snap_f0[ ];
21 21 // F1 F2
22 22 extern volatile int wf_snap_f0[ ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 62 ];
23 23 extern volatile int wf_snap_f1[ ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 62 ];
24 24 extern volatile int wf_snap_f2[ ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 62 ];
25 25 // F3
26 26 extern volatile int wf_cont_f3_a[ ];
27 27 extern volatile int wf_cont_f3_b[ ];
28 28 extern char wf_cont_f3_light[ ];
29 29
30 30 extern waveform_picker_regs_new_t *waveform_picker_regs;
31 31 extern time_management_regs_t *time_management_regs;
32 32 extern Packet_TM_LFR_HK_t housekeeping_packet;
33 33 extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
34 34 extern struct param_local_str param_local;
35 35
36 36 extern unsigned short sequenceCounters_SCIENCE_NORMAL_BURST;
37 37 extern unsigned short sequenceCounters_SCIENCE_SBM1_SBM2;
38 38
39 39 extern rtems_id Task_id[20]; /* array of task ids */
40 40
41 41 extern unsigned char lfrCurrentMode;
42 42
43 //**********
44 // RTEMS_ISR
43 45 rtems_isr waveforms_isr( rtems_vector_number vector );
44 rtems_isr waveforms_isr_alt( rtems_vector_number vector );
46
47 //***********
48 // RTEMS_TASK
45 49 rtems_task wfrm_task( rtems_task_argument argument );
46 50 rtems_task cwf3_task( rtems_task_argument argument );
47 51 rtems_task cwf2_task( rtems_task_argument argument );
48 52 rtems_task cwf1_task( rtems_task_argument argument );
53 rtems_task swbd_task( rtems_task_argument argument );
49 54
50 55 //******************
51 56 // general functions
52 57 void init_waveforms( void );
53 58 void init_waveform_rings( void );
54 59 void reset_current_ring_nodes( void );
55 60 //
56 61 int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF );
57 62 int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF );
58 63 int init_header_continuous_cwf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF );
59 64 //
60 65 int send_waveform_SWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id );
61 66 int send_waveform_CWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
62 67 int send_waveform_CWF3( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
63 68 int send_waveform_CWF3_light( volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
64 69 //
65 70 void compute_acquisition_time(unsigned int coarseTime, unsigned int fineTime,
66 71 unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char *acquisitionTime );
72 void build_snapshot_from_ring( void );
67 73 //
68 74 rtems_id get_pkts_queue_id( void );
69 75
70 76 //**************
71 77 // wfp registers
72 78 // RESET
73 79 void reset_wfp_burst_enable( void );
74 80 void reset_wfp_status(void);
75 81 void reset_waveform_picker_regs( void );
76 82 // SET
77 83 void set_wfp_data_shaping(void);
78 84 void set_wfp_burst_enable_register( unsigned char mode );
79 85 void set_wfp_delta_snapshot( void );
80 86 void set_wfp_delta_f0_f0_2( void );
81 87 void set_wfp_delta_f1( void );
82 88 void set_wfp_delta_f2( void );
83 89
84 90 //*****************
85 91 // local parameters
86 92 void set_local_nb_interrupt_f0_MAX( void );
87 93
88 94 void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid );
89 95
90 96 #endif // WF_HANDLER_H_INCLUDED
@@ -1,72 +1,72
1 1 /** Global variables of the LFR flight software.
2 2 *
3 3 * @file
4 4 * @author P. LEROY
5 5 *
6 6 * Among global variables, there are:
7 7 * - RTEMS names and id.
8 8 * - APB configuration registers.
9 9 * - waveforms global buffers, used by the waveform picker hardware module to store data.
10 10 * - spectral matrices buffesr, used by the hardware module to store data.
11 11 * - variable related to LFR modes parameters.
12 12 * - the global HK packet buffer.
13 13 * - the global dump parameter buffer.
14 14 *
15 15 */
16 16
17 17 #include <rtems.h>
18 18 #include <grspw.h>
19 19
20 20 #include "ccsds_types.h"
21 21 #include "grlib_regs.h"
22 22 #include "fsw_params.h"
23 23
24 24 // RTEMS GLOBAL VARIABLES
25 25 rtems_name misc_name[5];
26 26 rtems_id misc_id[5];
27 27 rtems_name Task_name[20]; /* array of task names */
28 28 rtems_id Task_id[20]; /* array of task ids */
29 29 unsigned int maxCount;
30 30 int fdSPW = 0;
31 31 int fdUART = 0;
32 32 unsigned char lfrCurrentMode;
33 33
34 34 // WAVEFORMS GLOBAL VARIABLES // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes = 24584
35 35 // 97 * 256 = 24832 => delta = 248 bytes = 62 words
36 36 // WAVEFORMS GLOBAL VARIABLES // 2688 * 3 * 4 + 2 * 4 = 32256 + 8 bytes = 32264
37 37 // 127 * 256 = 32512 => delta = 248 bytes = 62 words
38 38 // F0
39 39 volatile int wf_snap_f0[ NB_RING_NODES_F0 ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 62 ] __attribute__((aligned(0x100)));
40 40 // F1 F2
41 41 volatile int wf_snap_f1[ NB_RING_NODES_F1 ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 62 ] __attribute__((aligned(0x100)));
42 42 volatile int wf_snap_f2[ NB_RING_NODES_F2 ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 62 ] __attribute__((aligned(0x100)));
43 43 // F3
44 44 volatile int wf_cont_f3_a [ (NB_SAMPLES_PER_SNAPSHOT) * NB_WORDS_SWF_BLK + TIME_OFFSET ] __attribute__((aligned(0x100)));
45 45 volatile int wf_cont_f3_b [ (NB_SAMPLES_PER_SNAPSHOT) * NB_WORDS_SWF_BLK + TIME_OFFSET ] __attribute__((aligned(0x100)));
46 46 char wf_cont_f3_light[ (NB_SAMPLES_PER_SNAPSHOT) * NB_BYTES_CWF3_LIGHT_BLK + TIME_OFFSET_IN_BYTES ] __attribute__((aligned(0x100)));
47 47
48 48 // SPECTRAL MATRICES GLOBAL VARIABLES
49 volatile int sm_f0[ NB_RING_NODES_ASM_F0 ][ TIME_OFFSET + TOTAL_SIZE_SM ] __attribute__((aligned(0x100)));
50 volatile int sm_f1[ NB_RING_NODES_ASM_F1 ][ TIME_OFFSET + TOTAL_SIZE_SM ] __attribute__((aligned(0x100)));
51 volatile int sm_f2[ NB_RING_NODES_ASM_F2 ][ TIME_OFFSET + TOTAL_SIZE_SM ] __attribute__((aligned(0x100)));
49 volatile int sm_f0[ NB_RING_NODES_ASM_F0 ][ TIME_OFFSET + TOTAL_SIZE_SM + 62 ] __attribute__((aligned(0x100)));
50 volatile int sm_f1[ NB_RING_NODES_ASM_F1 ][ TIME_OFFSET + TOTAL_SIZE_SM + 62 ] __attribute__((aligned(0x100)));
51 volatile int sm_f2[ NB_RING_NODES_ASM_F2 ][ TIME_OFFSET + TOTAL_SIZE_SM + 62 ] __attribute__((aligned(0x100)));
52 52
53 53 // APB CONFIGURATION REGISTERS
54 54 time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT;
55 55 gptimer_regs_t *gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER;
56 56 waveform_picker_regs_new_t *waveform_picker_regs = (waveform_picker_regs_new_t*) REGS_ADDR_WAVEFORM_PICKER;
57 57 spectral_matrix_regs_t *spectral_matrix_regs = (spectral_matrix_regs_t*) REGS_ADDR_SPECTRAL_MATRIX;
58 58
59 59 // MODE PARAMETERS
60 60 Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
61 61 struct param_local_str param_local;
62 62
63 63 // HK PACKETS
64 64 Packet_TM_LFR_HK_t housekeeping_packet;
65 65 // sequence counters are incremented by APID (PID + CAT) and destination ID
66 66 unsigned short sequenceCounters_SCIENCE_NORMAL_BURST;
67 67 unsigned short sequenceCounters_SCIENCE_SBM1_SBM2;
68 68 unsigned short sequenceCounters_TC_EXE[SEQ_CNT_NB_DEST_ID];
69 69 spw_stats spacewire_stats;
70 70 spw_stats spacewire_stats_backup;
71 71
72 72
@@ -1,604 +1,639
1 1 /** This is the RTEMS initialization module.
2 2 *
3 3 * @file
4 4 * @author P. LEROY
5 5 *
6 6 * This module contains two very different information:
7 7 * - specific instructions to configure the compilation of the RTEMS executive
8 8 * - functions related to the fligth softwre initialization, especially the INIT RTEMS task
9 9 *
10 10 */
11 11
12 12 //*************************
13 13 // GPL reminder to be added
14 14 //*************************
15 15
16 16 #include <rtems.h>
17 17
18 18 /* configuration information */
19 19
20 20 #define CONFIGURE_INIT
21 21
22 22 #include <bsp.h> /* for device driver prototypes */
23 23
24 24 /* configuration information */
25 25
26 26 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
27 27 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
28 28
29 29 #define CONFIGURE_MAXIMUM_TASKS 20
30 30 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
31 31 #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE)
32 32 #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32
33 33 #define CONFIGURE_INIT_TASK_PRIORITY 1 // instead of 100
34 34 #define CONFIGURE_INIT_TASK_MODE (RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT)
35 35 #define CONFIGURE_MAXIMUM_DRIVERS 16
36 36 #define CONFIGURE_MAXIMUM_PERIODS 5
37 37 #define CONFIGURE_MAXIMUM_TIMERS 5 // STAT (1s), send SWF (0.3s), send CWF3 (1s)
38 38 #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 2
39 39 #ifdef PRINT_STACK_REPORT
40 40 #define CONFIGURE_STACK_CHECKER_ENABLED
41 41 #endif
42 42
43 43 #include <rtems/confdefs.h>
44 44
45 45 /* If --drvmgr was enabled during the configuration of the RTEMS kernel */
46 46 #ifdef RTEMS_DRVMGR_STARTUP
47 47 #ifdef LEON3
48 48 /* Add Timer and UART Driver */
49 49 #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
50 50 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER
51 51 #endif
52 52 #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
53 53 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART
54 54 #endif
55 55 #endif
56 56 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */
57 57 #include <drvmgr/drvmgr_confdefs.h>
58 58 #endif
59 59
60 60 #include "fsw_init.h"
61 61 #include "fsw_config.c"
62 62
63 63 rtems_task Init( rtems_task_argument ignored )
64 64 {
65 65 /** This is the RTEMS INIT taks, it the first task launched by the system.
66 66 *
67 67 * @param unused is the starting argument of the RTEMS task
68 68 *
69 69 * The INIT task create and run all other RTEMS tasks.
70 70 *
71 71 */
72 72
73 73 reset_local_time();
74 74
75 75 rtems_status_code status;
76 76 rtems_status_code status_spw;
77 77 rtems_isr_entry old_isr_handler;
78 78
79 79 // UART settings
80 80 send_console_outputs_on_apbuart_port();
81 81 set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE);
82 82 enable_apbuart_transmitter();
83 83 DEBUG_PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n")
84 84
85 85 PRINTF("\n\n\n\n\n")
86 86 PRINTF("*************************\n")
87 87 PRINTF("** LFR Flight Software **\n")
88 88 PRINTF1("** %d.", SW_VERSION_N1)
89 89 PRINTF1("%d.", SW_VERSION_N2)
90 90 PRINTF1("%d.", SW_VERSION_N3)
91 91 PRINTF1("%d **\n", SW_VERSION_N4)
92 92 PRINTF("*************************\n")
93 93 PRINTF("\n\n")
94 94
95 95 reset_wfp_burst_enable(); // stop the waveform picker if it was running
96 96 init_waveform_rings(); // initialize the waveform rings
97 97 init_sm_rings();
98 98
99 99 init_parameter_dump();
100 100 init_local_mode_parameters();
101 101 init_housekeeping_parameters();
102 102
103 103 updateLFRCurrentMode();
104 104
105 105 BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode)
106 106
107 107 create_names(); // create all names
108 108
109 109 status = create_message_queues(); // create message queues
110 110 if (status != RTEMS_SUCCESSFUL)
111 111 {
112 112 PRINTF1("in INIT *** ERR in create_message_queues, code %d", status)
113 113 }
114 114
115 115 status = create_all_tasks(); // create all tasks
116 116 if (status != RTEMS_SUCCESSFUL)
117 117 {
118 118 PRINTF1("in INIT *** ERR in create_all_tasks, code %d", status)
119 119 }
120 120
121 121 // **************************
122 122 // <SPACEWIRE INITIALIZATION>
123 123 grspw_timecode_callback = &timecode_irq_handler;
124 124
125 125 status_spw = spacewire_open_link(); // (1) open the link
126 126 if ( status_spw != RTEMS_SUCCESSFUL )
127 127 {
128 128 PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw )
129 129 }
130 130
131 131 if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link
132 132 {
133 133 status_spw = spacewire_configure_link( fdSPW );
134 134 if ( status_spw != RTEMS_SUCCESSFUL )
135 135 {
136 136 PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw )
137 137 }
138 138 }
139 139
140 140 if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link
141 141 {
142 142 status_spw = spacewire_start_link( fdSPW );
143 143 if ( status_spw != RTEMS_SUCCESSFUL )
144 144 {
145 145 PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw )
146 146 }
147 147 }
148 148 // </SPACEWIRE INITIALIZATION>
149 149 // ***************************
150 150
151 151 status = start_all_tasks(); // start all tasks
152 152 if (status != RTEMS_SUCCESSFUL)
153 153 {
154 154 PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status)
155 155 }
156 156
157 157 // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization
158 158 status = start_recv_send_tasks();
159 159 if ( status != RTEMS_SUCCESSFUL )
160 160 {
161 161 PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status )
162 162 }
163 163
164 164 // suspend science tasks. they will be restarted later depending on the mode
165 165 status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY)
166 166 if (status != RTEMS_SUCCESSFUL)
167 167 {
168 168 PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status)
169 169 }
170 170
171 171 //******************************
172 172 // <SPECTRAL MATRICES SIMULATOR>
173 173 LEON_Mask_interrupt( IRQ_SM_SIMULATOR );
174 174 configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR,
175 175 IRQ_SPARC_SM_SIMULATOR, spectral_matrices_isr_simu );
176 176 // </SPECTRAL MATRICES SIMULATOR>
177 177 //*******************************
178 178
179 179 // configure IRQ handling for the waveform picker unit
180 180 status = rtems_interrupt_catch( waveforms_isr,
181 181 IRQ_SPARC_WAVEFORM_PICKER,
182 182 &old_isr_handler) ;
183 183 // configure IRQ handling for the spectral matrices unit
184 184 status = rtems_interrupt_catch( spectral_matrices_isr,
185 185 IRQ_SPARC_SPECTRAL_MATRIX,
186 186 &old_isr_handler) ;
187 187
188 188 // if the spacewire link is not up then send an event to the SPIQ task for link recovery
189 189 if ( status_spw != RTEMS_SUCCESSFUL )
190 190 {
191 191 status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT );
192 192 if ( status != RTEMS_SUCCESSFUL ) {
193 193 PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status )
194 194 }
195 195 }
196 196
197 197 BOOT_PRINTF("delete INIT\n")
198 198
199 199 status = rtems_task_delete(RTEMS_SELF);
200 200
201 201 }
202 202
203 203 void init_local_mode_parameters( void )
204 204 {
205 205 /** This function initialize the param_local global variable with default values.
206 206 *
207 207 */
208 208
209 209 unsigned int i;
210 210
211 211 // LOCAL PARAMETERS
212 212 set_local_nb_interrupt_f0_MAX();
213 213
214 214 BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max)
215 215 BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max)
216 216 BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX)
217 217
218 218 // init sequence counters
219 219
220 220 for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++)
221 221 {
222 222 sequenceCounters_TC_EXE[i] = 0x00;
223 223 }
224 224 sequenceCounters_SCIENCE_NORMAL_BURST = 0x00;
225 225 sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00;
226 226 }
227 227
228 228 void reset_local_time( void )
229 229 {
230 230
231 231 }
232 232
233 233 void create_names( void ) // create all names for tasks and queues
234 234 {
235 235 /** This function creates all RTEMS names used in the software for tasks and queues.
236 236 *
237 237 * @return RTEMS directive status codes:
238 238 * - RTEMS_SUCCESSFUL - successful completion
239 239 *
240 240 */
241 241
242 242 // task names
243 243 Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' );
244 244 Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' );
245 245 Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' );
246 246 Task_name[TASKID_SMIQ] = rtems_build_name( 'S', 'M', 'I', 'Q' );
247 247 Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' );
248 248 Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' );
249 // Task_name[TASKID_BPF0] = rtems_build_name( 'B', 'P', 'F', '0' );
249 Task_name[TASKID_SWBD] = rtems_build_name( 'S', 'W', 'B', 'D' );
250 250 Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' );
251 251 Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' );
252 252 Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' );
253 253 Task_name[TASKID_MATR] = rtems_build_name( 'M', 'A', 'T', 'R' );
254 254 Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' );
255 255 Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' );
256 256 Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' );
257 257 Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' );
258 258 Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' );
259 259
260 260 // rate monotonic period names
261 261 name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' );
262 262
263 263 misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' );
264 264 misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' );
265 265 }
266 266
267 267 int create_all_tasks( void ) // create all tasks which run in the software
268 268 {
269 269 /** This function creates all RTEMS tasks used in the software.
270 270 *
271 271 * @return RTEMS directive status codes:
272 272 * - RTEMS_SUCCESSFUL - task created successfully
273 273 * - RTEMS_INVALID_ADDRESS - id is NULL
274 274 * - RTEMS_INVALID_NAME - invalid task name
275 275 * - RTEMS_INVALID_PRIORITY - invalid task priority
276 276 * - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured
277 277 * - RTEMS_TOO_MANY - too many tasks created
278 278 * - RTEMS_UNSATISFIED - not enough memory for stack/FP context
279 279 * - RTEMS_TOO_MANY - too many global objects
280 280 *
281 281 */
282 282
283 283 rtems_status_code status;
284 284
285 //**********
286 // SPACEWIRE
285 287 // RECV
286 288 status = rtems_task_create(
287 289 Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE,
288 290 RTEMS_DEFAULT_MODES,
289 291 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV]
290 292 );
291
293 if (status == RTEMS_SUCCESSFUL) // SEND
294 {
295 status = rtems_task_create(
296 Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE,
297 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
298 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SEND]
299 );
300 }
301 if (status == RTEMS_SUCCESSFUL) // WTDG
302 {
303 status = rtems_task_create(
304 Task_name[TASKID_WTDG], TASK_PRIORITY_WTDG, RTEMS_MINIMUM_STACK_SIZE,
305 RTEMS_DEFAULT_MODES,
306 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_WTDG]
307 );
308 }
292 309 if (status == RTEMS_SUCCESSFUL) // ACTN
293 310 {
294 311 status = rtems_task_create(
295 312 Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE,
296 313 RTEMS_DEFAULT_MODES,
297 314 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN]
298 315 );
299 316 }
300 317 if (status == RTEMS_SUCCESSFUL) // SPIQ
301 318 {
302 319 status = rtems_task_create(
303 320 Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE,
304 321 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
305 322 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ]
306 323 );
307 324 }
325
326 //******************
327 // SPECTRAL MATRICES
308 328 if (status == RTEMS_SUCCESSFUL) // SMIQ
309 329 {
310 330 status = rtems_task_create(
311 331 Task_name[TASKID_SMIQ], TASK_PRIORITY_SMIQ, RTEMS_MINIMUM_STACK_SIZE,
312 332 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
313 333 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SMIQ]
314 334 );
315 335 }
316 if (status == RTEMS_SUCCESSFUL) // STAT
317 {
318 status = rtems_task_create(
319 Task_name[TASKID_STAT], TASK_PRIORITY_STAT, RTEMS_MINIMUM_STACK_SIZE,
320 RTEMS_DEFAULT_MODES,
321 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT]
322 );
323 }
324 336 if (status == RTEMS_SUCCESSFUL) // AVF0
325 337 {
326 338 status = rtems_task_create(
327 339 Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE,
328 340 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
329 341 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0]
330 342 );
331 343 }
344 if (status == RTEMS_SUCCESSFUL) // MATR
345 {
346 status = rtems_task_create(
347 Task_name[TASKID_MATR], TASK_PRIORITY_MATR, RTEMS_MINIMUM_STACK_SIZE,
348 RTEMS_DEFAULT_MODES,
349 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_MATR]
350 );
351 }
352
353 //****************
354 // WAVEFORM PICKER
332 355 if (status == RTEMS_SUCCESSFUL) // WFRM
333 356 {
334 357 status = rtems_task_create(
335 358 Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE,
336 359 RTEMS_DEFAULT_MODES,
337 360 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM]
338 361 );
339 362 }
340 if (status == RTEMS_SUCCESSFUL) // DUMB
341 {
342 status = rtems_task_create(
343 Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE,
344 RTEMS_DEFAULT_MODES,
345 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB]
346 );
347 }
348 if (status == RTEMS_SUCCESSFUL) // HOUS
349 {
350 status = rtems_task_create(
351 Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE,
352 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
353 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS]
354 );
355 }
356 if (status == RTEMS_SUCCESSFUL) // MATR
357 {
358 status = rtems_task_create(
359 Task_name[TASKID_MATR], TASK_PRIORITY_MATR, RTEMS_MINIMUM_STACK_SIZE,
360 RTEMS_DEFAULT_MODES,
361 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_MATR]
362 );
363 }
364 363 if (status == RTEMS_SUCCESSFUL) // CWF3
365 364 {
366 365 status = rtems_task_create(
367 366 Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE,
368 367 RTEMS_DEFAULT_MODES,
369 368 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF3]
370 369 );
371 370 }
372 371 if (status == RTEMS_SUCCESSFUL) // CWF2
373 372 {
374 373 status = rtems_task_create(
375 374 Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE,
376 375 RTEMS_DEFAULT_MODES,
377 376 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF2]
378 377 );
379 378 }
380 379 if (status == RTEMS_SUCCESSFUL) // CWF1
381 380 {
382 381 status = rtems_task_create(
383 382 Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE,
384 383 RTEMS_DEFAULT_MODES,
385 384 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF1]
386 385 );
387 386 }
388 if (status == RTEMS_SUCCESSFUL) // SEND
387 if (status == RTEMS_SUCCESSFUL) // SWBD
388 {
389 status = rtems_task_create(
390 Task_name[TASKID_SWBD], TASK_PRIORITY_SWBD, RTEMS_MINIMUM_STACK_SIZE,
391 RTEMS_DEFAULT_MODES,
392 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_SWBD]
393 );
394 }
395
396 //*****
397 // MISC
398 if (status == RTEMS_SUCCESSFUL) // STAT
389 399 {
390 400 status = rtems_task_create(
391 Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE,
392 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
393 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SEND]
401 Task_name[TASKID_STAT], TASK_PRIORITY_STAT, RTEMS_MINIMUM_STACK_SIZE,
402 RTEMS_DEFAULT_MODES,
403 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT]
394 404 );
395 405 }
396 if (status == RTEMS_SUCCESSFUL) // WTDG
406 if (status == RTEMS_SUCCESSFUL) // DUMB
397 407 {
398 408 status = rtems_task_create(
399 Task_name[TASKID_WTDG], TASK_PRIORITY_WTDG, RTEMS_MINIMUM_STACK_SIZE,
409 Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE,
400 410 RTEMS_DEFAULT_MODES,
401 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_WTDG]
411 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB]
412 );
413 }
414 if (status == RTEMS_SUCCESSFUL) // HOUS
415 {
416 status = rtems_task_create(
417 Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE,
418 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
419 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS]
402 420 );
403 421 }
404 422
405 423 return status;
406 424 }
407 425
408 426 int start_recv_send_tasks( void )
409 427 {
410 428 rtems_status_code status;
411 429
412 430 status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 );
413 431 if (status!=RTEMS_SUCCESSFUL) {
414 432 BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n")
415 433 }
416 434
417 435 if (status == RTEMS_SUCCESSFUL) // SEND
418 436 {
419 437 status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 );
420 438 if (status!=RTEMS_SUCCESSFUL) {
421 439 BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n")
422 440 }
423 441 }
424 442
425 443 return status;
426 444 }
427 445
428 446 int start_all_tasks( void ) // start all tasks except SEND RECV and HOUS
429 447 {
430 448 /** This function starts all RTEMS tasks used in the software.
431 449 *
432 450 * @return RTEMS directive status codes:
433 451 * - RTEMS_SUCCESSFUL - ask started successfully
434 452 * - RTEMS_INVALID_ADDRESS - invalid task entry point
435 453 * - RTEMS_INVALID_ID - invalid task id
436 454 * - RTEMS_INCORRECT_STATE - task not in the dormant state
437 455 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot start remote task
438 456 *
439 457 */
440 458 // starts all the tasks fot eh flight software
441 459
442 460 rtems_status_code status;
443 461
462 //**********
463 // SPACEWIRE
444 464 status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 );
445 465 if (status!=RTEMS_SUCCESSFUL) {
446 466 BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n")
447 467 }
448 468
449 469 if (status == RTEMS_SUCCESSFUL) // WTDG
450 470 {
451 471 status = rtems_task_start( Task_id[TASKID_WTDG], wtdg_task, 1 );
452 472 if (status!=RTEMS_SUCCESSFUL) {
453 473 BOOT_PRINTF("in INIT *** Error starting TASK_WTDG\n")
454 474 }
455 475 }
456 476
457 if (status == RTEMS_SUCCESSFUL) // SMIQ
458 {
459 status = rtems_task_start( Task_id[TASKID_SMIQ], smiq_task, 1 );
460 if (status!=RTEMS_SUCCESSFUL) {
461 BOOT_PRINTF("in INIT *** Error starting TASK_BPPR\n")
462 }
463 }
464
465 477 if (status == RTEMS_SUCCESSFUL) // ACTN
466 478 {
467 479 status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 );
468 480 if (status!=RTEMS_SUCCESSFUL) {
469 481 BOOT_PRINTF("in INIT *** Error starting TASK_ACTN\n")
470 482 }
471 483 }
472 484
473 if (status == RTEMS_SUCCESSFUL) // STAT
485 //******************
486 // SPECTRAL MATRICES
487 if (status == RTEMS_SUCCESSFUL) // SMIQ
474 488 {
475 status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 );
489 status = rtems_task_start( Task_id[TASKID_SMIQ], smiq_task, 1 );
476 490 if (status!=RTEMS_SUCCESSFUL) {
477 BOOT_PRINTF("in INIT *** Error starting TASK_STAT\n")
491 BOOT_PRINTF("in INIT *** Error starting TASK_BPPR\n")
478 492 }
479 493 }
480 494
481 495 if (status == RTEMS_SUCCESSFUL) // AVF0
482 496 {
483 497 status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, 1 );
484 498 if (status!=RTEMS_SUCCESSFUL) {
485 499 BOOT_PRINTF("in INIT *** Error starting TASK_AVF0\n")
486 500 }
487 501 }
488 502
503 if (status == RTEMS_SUCCESSFUL) // MATR
504 {
505 status = rtems_task_start( Task_id[TASKID_MATR], matr_task, 1 );
506 if (status!=RTEMS_SUCCESSFUL) {
507 BOOT_PRINTF("in INIT *** Error starting TASK_MATR\n")
508 }
509 }
510
511 //****************
512 // WAVEFORM PICKER
489 513 if (status == RTEMS_SUCCESSFUL) // WFRM
490 514 {
491 515 status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 );
492 516 if (status!=RTEMS_SUCCESSFUL) {
493 517 BOOT_PRINTF("in INIT *** Error starting TASK_WFRM\n")
494 518 }
495 519 }
496 520
497 if (status == RTEMS_SUCCESSFUL) // DUMB
498 {
499 status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 );
500 if (status!=RTEMS_SUCCESSFUL) {
501 BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n")
502 }
503 }
504
505 if (status == RTEMS_SUCCESSFUL) // HOUS
506 {
507 status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 );
508 if (status!=RTEMS_SUCCESSFUL) {
509 BOOT_PRINTF("in INIT *** Error starting TASK_HOUS\n")
510 }
511 }
512
513 if (status == RTEMS_SUCCESSFUL) // MATR
514 {
515 status = rtems_task_start( Task_id[TASKID_MATR], matr_task, 1 );
516 if (status!=RTEMS_SUCCESSFUL) {
517 BOOT_PRINTF("in INIT *** Error starting TASK_MATR\n")
518 }
519 }
520
521 521 if (status == RTEMS_SUCCESSFUL) // CWF3
522 522 {
523 523 status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 );
524 524 if (status!=RTEMS_SUCCESSFUL) {
525 525 BOOT_PRINTF("in INIT *** Error starting TASK_CWF3\n")
526 526 }
527 527 }
528 528
529 529 if (status == RTEMS_SUCCESSFUL) // CWF2
530 530 {
531 531 status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 );
532 532 if (status!=RTEMS_SUCCESSFUL) {
533 533 BOOT_PRINTF("in INIT *** Error starting TASK_CWF2\n")
534 534 }
535 535 }
536 536
537 537 if (status == RTEMS_SUCCESSFUL) // CWF1
538 538 {
539 539 status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 );
540 540 if (status!=RTEMS_SUCCESSFUL) {
541 541 BOOT_PRINTF("in INIT *** Error starting TASK_CWF1\n")
542 542 }
543 543 }
544
545 if (status == RTEMS_SUCCESSFUL) // SWBD
546 {
547 status = rtems_task_start( Task_id[TASKID_SWBD], swbd_task, 1 );
548 if (status!=RTEMS_SUCCESSFUL) {
549 BOOT_PRINTF("in INIT *** Error starting TASK_SWBD\n")
550 }
551 }
552
553 //*****
554 // MISC
555 if (status == RTEMS_SUCCESSFUL) // HOUS
556 {
557 status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 );
558 if (status!=RTEMS_SUCCESSFUL) {
559 BOOT_PRINTF("in INIT *** Error starting TASK_HOUS\n")
560 }
561 }
562
563 if (status == RTEMS_SUCCESSFUL) // DUMB
564 {
565 status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 );
566 if (status!=RTEMS_SUCCESSFUL) {
567 BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n")
568 }
569 }
570
571 if (status == RTEMS_SUCCESSFUL) // STAT
572 {
573 status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 );
574 if (status!=RTEMS_SUCCESSFUL) {
575 BOOT_PRINTF("in INIT *** Error starting TASK_STAT\n")
576 }
577 }
578
544 579 return status;
545 580 }
546 581
547 582 rtems_status_code create_message_queues( void ) // create the two message queues used in the software
548 583 {
549 584 rtems_status_code status_recv;
550 585 rtems_status_code status_send;
551 586 rtems_status_code ret;
552 587 rtems_id queue_id;
553 588
554 589 // create the queue for handling valid TCs
555 590 status_recv = rtems_message_queue_create( misc_name[QUEUE_RECV],
556 591 ACTION_MSG_QUEUE_COUNT, CCSDS_TC_PKT_MAX_SIZE,
557 592 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
558 593 if ( status_recv != RTEMS_SUCCESSFUL ) {
559 594 PRINTF1("in create_message_queues *** ERR creating QUEU queue, %d\n", status_recv)
560 595 }
561 596
562 597 // create the queue for handling TM packet sending
563 598 status_send = rtems_message_queue_create( misc_name[QUEUE_SEND],
564 599 ACTION_MSG_PKTS_COUNT, ACTION_MSG_PKTS_MAX_SIZE,
565 600 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
566 601 if ( status_send != RTEMS_SUCCESSFUL ) {
567 602 PRINTF1("in create_message_queues *** ERR creating PKTS queue, %d\n", status_send)
568 603 }
569 604
570 605 if ( status_recv != RTEMS_SUCCESSFUL )
571 606 {
572 607 ret = status_recv;
573 608 }
574 609 else
575 610 {
576 611 ret = status_send;
577 612 }
578 613
579 614 return ret;
580 615 }
581 616
582 617 rtems_status_code get_message_queue_id_send( rtems_id *queue_id )
583 618 {
584 619 rtems_status_code status;
585 620 rtems_name queue_name;
586 621
587 622 queue_name = rtems_build_name( 'Q', '_', 'S', 'D' );
588 623
589 624 status = rtems_message_queue_ident( queue_name, 0, queue_id );
590 625
591 626 return status;
592 627 }
593 628
594 629 rtems_status_code get_message_queue_id_recv( rtems_id *queue_id )
595 630 {
596 631 rtems_status_code status;
597 632 rtems_name queue_name;
598 633
599 634 queue_name = rtems_build_name( 'Q', '_', 'R', 'V' );
600 635
601 636 status = rtems_message_queue_ident( queue_name, 0, queue_id );
602 637
603 638 return status;
604 639 }
@@ -1,1305 +1,1236
1 1 /** Functions and tasks related to waveform packet generation.
2 2 *
3 3 * @file
4 4 * @author P. LEROY
5 5 *
6 6 * A group of functions to handle waveforms, in snapshot or continuous format.\n
7 7 *
8 8 */
9 9
10 10 #include "wf_handler.h"
11 11
12 12 //*****************
13 13 // waveform headers
14 14 // SWF
15 15 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F0[7];
16 16 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F1[7];
17 17 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F2[7];
18 18 // CWF
19 19 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F1[ NB_PACKETS_PER_GROUP_OF_CWF ];
20 20 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_BURST[ NB_PACKETS_PER_GROUP_OF_CWF ];
21 21 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_SBM2[ NB_PACKETS_PER_GROUP_OF_CWF ];
22 22 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3[ NB_PACKETS_PER_GROUP_OF_CWF ];
23 23 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3_light[ NB_PACKETS_PER_GROUP_OF_CWF_LIGHT ];
24 24
25 25 //**************
26 26 // waveform ring
27 27 ring_node waveform_ring_f0[NB_RING_NODES_F0];
28 28 ring_node waveform_ring_f1[NB_RING_NODES_F1];
29 29 ring_node waveform_ring_f2[NB_RING_NODES_F2];
30 30 ring_node *current_ring_node_f0;
31 31 ring_node *ring_node_to_send_swf_f0;
32 32 ring_node *current_ring_node_f1;
33 33 ring_node *ring_node_to_send_swf_f1;
34 34 ring_node *ring_node_to_send_cwf_f1;
35 35 ring_node *current_ring_node_f2;
36 36 ring_node *ring_node_to_send_swf_f2;
37 37 ring_node *ring_node_to_send_cwf_f2;
38 38
39 bool extractSWF = false;
40
41 int wf_snap_f1_extracted[ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET ];
42
39 43 rtems_isr waveforms_isr( rtems_vector_number vector )
40 44 {
41 45 /** This is the interrupt sub routine called by the waveform picker core.
42 46 *
43 47 * This ISR launch different actions depending mainly on two pieces of information:
44 48 * 1. the values read in the registers of the waveform picker.
45 49 * 2. the current LFR mode.
46 50 *
47 51 */
48 52
49 53 static unsigned char nb_swf = 0;
50 54
51 55 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
52 56 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
53 57 { // in modes other than STANDBY and BURST, send the CWF_F3 data
54 58 if ((waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full
55 59 // (1) change the receiving buffer for the waveform picker
56 60 if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3_a) {
57 61 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_b);
58 62 }
59 63 else {
60 64 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a);
61 65 }
62 66 // (2) send an event for the waveforms transmission
63 67 if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
64 68 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
65 69 }
66 70 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff777; // reset f3 bits to 0, [1111 0111 0111 0111]
67 71 }
68 72 }
69 73
70 74 switch(lfrCurrentMode)
71 75 {
72 76 //********
73 77 // STANDBY
74 78 case(LFR_MODE_STANDBY):
75 79 break;
76 80
77 81 //******
78 82 // NORMAL
79 83 case(LFR_MODE_NORMAL):
80 84 if ( (waveform_picker_regs->status & 0xff8) != 0x00) // [1000] check the error bits
81 85 {
82 86 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
83 87 }
84 88 if ( (waveform_picker_regs->status & 0x07) == 0x07) // [0111] check the f2, f1, f0 full bits
85 89 {
86 90 // change F0 ring node
87 91 ring_node_to_send_swf_f0 = current_ring_node_f0;
88 92 current_ring_node_f0 = current_ring_node_f0->next;
89 93 waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address;
90 94 // change F1 ring node
91 95 ring_node_to_send_swf_f1 = current_ring_node_f1;
92 96 current_ring_node_f1 = current_ring_node_f1->next;
93 97 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address;
94 98 // change F2 ring node
95 99 ring_node_to_send_swf_f2 = current_ring_node_f2;
96 100 current_ring_node_f2 = current_ring_node_f2->next;
97 101 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
98 102 //
99 103 // if (nb_swf < 2)
100 104 if (true)
101 105 {
102 106 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
103 107 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
104 108 }
105 109 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff888; // [1000 1000 1000]
106 110 nb_swf = nb_swf + 1;
107 111 }
108 112 else
109 113 {
110 114 reset_wfp_burst_enable();
111 115 nb_swf = 0;
112 116 }
113 117
114 118 }
115 119
116 120 break;
117 121
118 122 //******
119 123 // BURST
120 124 case(LFR_MODE_BURST):
121 125 if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit
122 126 // (1) change the receiving buffer for the waveform picker
123 127 ring_node_to_send_cwf_f2 = current_ring_node_f2;
124 128 current_ring_node_f2 = current_ring_node_f2->next;
125 129 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
126 130 // (2) send an event for the waveforms transmission
127 131 if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) {
128 132 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
129 133 }
130 134 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0
131 135 }
132 136 break;
133 137
134 138 //*****
135 139 // SBM1
136 140 case(LFR_MODE_SBM1):
137 141 if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit
142 // (0) launch snapshot extraction if needed
143 if (extractSWF == true)
144 {
145 ring_node_to_send_swf_f1 = current_ring_node_f1;
146 if (rtems_event_send( Task_id[TASKID_SWBD], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
147 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
148 }
149 extractSWF = false;
150 }
138 151 // (1) change the receiving buffer for the waveform picker
139 152 ring_node_to_send_cwf_f1 = current_ring_node_f1;
140 153 current_ring_node_f1 = current_ring_node_f1->next;
141 154 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address;
142 // (2) send an event for the waveforms transmission
155 // (2) send an event for the the CWF1 task for transmission
143 156 if (rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 ) != RTEMS_SUCCESSFUL) {
144 157 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
145 158 }
146 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bit = 0
147 }
148 if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit
149 ring_node_to_send_swf_f1 = current_ring_node_f1->previous;
150 }
151 if ( (waveform_picker_regs->status & 0x04) == 0x04 ) { // [0100] check the f2 full bit
152 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
153 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
154 }
155 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2 and f0 bits = 0
156 }
157 break;
158
159 //*****
160 // SBM2
161 case(LFR_MODE_SBM2):
162 if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit
163 // (1) change the receiving buffer for the waveform picker
164 ring_node_to_send_cwf_f2 = current_ring_node_f2;
165 current_ring_node_f2 = current_ring_node_f2->next;
166 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
167 // (2) send an event for the waveforms transmission
168 if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) {
169 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
170 }
171 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0
159 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bits = 0
172 160 }
173 161 if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit
174 ring_node_to_send_swf_f2 = current_ring_node_f2->previous;
175 }
176 if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit
177 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
178 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
179 }
180 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0
162 extractSWF = true;
163 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffeee; // [1111 1110 1110 1110] f0 bits = 0
181 164 }
182 break;
183
184 //********
185 // DEFAULT
186 default:
187 break;
188 }
189 }
190
191 rtems_isr waveforms_isr_alt( rtems_vector_number vector )
192 {
193 /** This is the interrupt sub routine called by the waveform picker core.
194 *
195 * This ISR launch different actions depending mainly on two pieces of information:
196 * 1. the values read in the registers of the waveform picker.
197 * 2. the current LFR mode.
198 *
199 */
200
201 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
202 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
203 { // in modes other than STANDBY and BURST, send the CWF_F3 data
204 if ((waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full
205 // (1) change the receiving buffer for the waveform picker
206 if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3_a) {
207 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_b);
208 }
209 else {
210 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a);
211 }
212 // (2) send an event for the waveforms transmission
213 if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
165 if ( (waveform_picker_regs->status & 0x04) == 0x04 ) { // [0100] check the f2 full bit
166 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM1 ) != RTEMS_SUCCESSFUL) {
214 167 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
215 168 }
216 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff777; // reset f3 bits to 0, [1111 0111 0111 0111]
217 }
218 }
219
220 switch(lfrCurrentMode)
221 {
222 //********
223 // STANDBY
224 case(LFR_MODE_STANDBY):
225 break;
226
227 //******
228 // NORMAL
229 case(LFR_MODE_NORMAL):
230 if ( (waveform_picker_regs->status & 0xff8) != 0x00) // [1000] check the error bits
231 {
232 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
233 }
234 if ( (waveform_picker_regs->status & 0x01) == 0x01) // [0001] check the f0 full bit
235 {
236 // change F0 ring node
237 ring_node_to_send_swf_f0 = current_ring_node_f0;
238 current_ring_node_f0 = current_ring_node_f0->next;
239 waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address;
240 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffeee; // [1110 1110 1110]
241 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL_SWF_F0 ) != RTEMS_SUCCESSFUL) {
242 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
243 }
244 }
245 if ( (waveform_picker_regs->status & 0x02) == 0x02) // [0010] check the f1 full bit
246 {
247 // change F1 ring node
248 ring_node_to_send_swf_f1 = current_ring_node_f1;
249 current_ring_node_f1 = current_ring_node_f1->next;
250 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address;
251 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1101 1101 1101]
252 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL_SWF_F1 ) != RTEMS_SUCCESSFUL) {
253 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
254 }
255 }
256 if ( (waveform_picker_regs->status & 0x04) == 0x04) // [0100] check the f2 full bit
257 {
258 // change F2 ring node
259 ring_node_to_send_swf_f2 = current_ring_node_f2;
260 current_ring_node_f2 = current_ring_node_f2->next;
261 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
262 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1011 1011 1011]
263 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL_SWF_F2 ) != RTEMS_SUCCESSFUL) {
264 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
265 }
266 }
267 break;
268
269 //******
270 // BURST
271 case(LFR_MODE_BURST):
272 if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit
273 // (1) change the receiving buffer for the waveform picker
274 ring_node_to_send_cwf_f2 = current_ring_node_f2;
275 current_ring_node_f2 = current_ring_node_f2->next;
276 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
277 // (2) send an event for the waveforms transmission
278 if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) {
279 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
280 }
281 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0
282 }
283 break;
284
285 //*****
286 // SBM1
287 case(LFR_MODE_SBM1):
288 if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit
289 // (1) change the receiving buffer for the waveform picker
290 ring_node_to_send_cwf_f1 = current_ring_node_f1;
291 current_ring_node_f1 = current_ring_node_f1->next;
292 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address;
293 // (2) send an event for the waveforms transmission
294 if (rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 ) != RTEMS_SUCCESSFUL) {
295 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
296 }
297 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bit = 0
298 }
299 if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit
300 ring_node_to_send_swf_f1 = current_ring_node_f1->previous;
301 }
302 if ( (waveform_picker_regs->status & 0x04) == 0x04 ) { // [0100] check the f2 full bit
303 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
304 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
305 }
306 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2 and f0 bits = 0
169 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bits = 0
307 170 }
308 171 break;
309 172
310 173 //*****
311 174 // SBM2
312 175 case(LFR_MODE_SBM2):
313 176 if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit
314 177 // (1) change the receiving buffer for the waveform picker
315 178 ring_node_to_send_cwf_f2 = current_ring_node_f2;
316 179 current_ring_node_f2 = current_ring_node_f2->next;
317 180 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
318 181 // (2) send an event for the waveforms transmission
319 182 if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) {
320 183 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
321 184 }
322 185 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0
323 186 }
324 187 if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit
325 188 ring_node_to_send_swf_f2 = current_ring_node_f2->previous;
326 189 }
327 190 if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit
328 191 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
329 192 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
330 193 }
331 194 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0
332 195 }
333 196 break;
334 197
335 198 //********
336 199 // DEFAULT
337 200 default:
338 201 break;
339 202 }
340 203 }
341 204
342 205 rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
343 206 {
344 207 /** This RTEMS task is dedicated to the transmission of snapshots of the NORMAL mode.
345 208 *
346 209 * @param unused is the starting argument of the RTEMS task
347 210 *
348 211 * The following data packets are sent by this task:
349 212 * - TM_LFR_SCIENCE_NORMAL_SWF_F0
350 213 * - TM_LFR_SCIENCE_NORMAL_SWF_F1
351 214 * - TM_LFR_SCIENCE_NORMAL_SWF_F2
352 215 *
353 216 */
354 217
355 218 rtems_event_set event_out;
356 219 rtems_id queue_id;
357 220 rtems_status_code status;
358 221
359 222 init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 );
360 223 init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 );
361 224 init_header_snapshot_wf_table( SID_NORM_SWF_F2, headerSWF_F2 );
362 225
363 226 init_waveforms();
364 227
365 228 status = get_message_queue_id_send( &queue_id );
366 229 if (status != RTEMS_SUCCESSFUL)
367 230 {
368 231 PRINTF1("in WFRM *** ERR get_message_queue_id_send %d\n", status)
369 232 }
370 233
371 234 BOOT_PRINTF("in WFRM ***\n")
372 235
373 236 while(1){
374 237 // wait for an RTEMS_EVENT
375 238 rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1
376 | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM
377 | RTEMS_EVENT_MODE_NORMAL_SWF_F0
378 | RTEMS_EVENT_MODE_NORMAL_SWF_F1
379 | RTEMS_EVENT_MODE_NORMAL_SWF_F2,
239 | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM,
380 240 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
381 241 if (event_out == RTEMS_EVENT_MODE_NORMAL)
382 242 {
243 PRINTF("WFRM received RTEMS_EVENT_MODE_NORMAL\n")
383 244 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
384 245 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
385 246 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
386 247 }
387 if ( (event_out & RTEMS_EVENT_MODE_NORMAL_SWF_F0) == RTEMS_EVENT_MODE_NORMAL_SWF_F0)
248 if (event_out == RTEMS_EVENT_MODE_SBM1)
388 249 {
250 PRINTF("WFRM received RTEMS_EVENT_MODE_SBM1\n")
389 251 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
390 }
391 if ( (event_out & RTEMS_EVENT_MODE_NORMAL_SWF_F1) == RTEMS_EVENT_MODE_NORMAL_SWF_F1)
392 {
393 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
394 }
395 if ( (event_out & RTEMS_EVENT_MODE_NORMAL_SWF_F2) == RTEMS_EVENT_MODE_NORMAL_SWF_F2)
396 {
252 send_waveform_SWF((volatile int*) wf_snap_f1_extracted , SID_NORM_SWF_F1, headerSWF_F1, queue_id);
397 253 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
398 254 }
399 255 }
400 256 }
401 257
402 258 rtems_task cwf3_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
403 259 {
404 260 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f3.
405 261 *
406 262 * @param unused is the starting argument of the RTEMS task
407 263 *
408 264 * The following data packet is sent by this task:
409 265 * - TM_LFR_SCIENCE_NORMAL_CWF_F3
410 266 *
411 267 */
412 268
413 269 rtems_event_set event_out;
414 270 rtems_id queue_id;
415 271 rtems_status_code status;
416 272
417 273 init_header_continuous_wf_table( SID_NORM_CWF_LONG_F3, headerCWF_F3 );
418 274 init_header_continuous_cwf3_light_table( headerCWF_F3_light );
419 275
420 276 status = get_message_queue_id_send( &queue_id );
421 277 if (status != RTEMS_SUCCESSFUL)
422 278 {
423 279 PRINTF1("in CWF3 *** ERR get_message_queue_id_send %d\n", status)
424 280 }
425 281
426 282 BOOT_PRINTF("in CWF3 ***\n")
427 283
428 284 while(1){
429 285 // wait for an RTEMS_EVENT
430 286 rtems_event_receive( RTEMS_EVENT_0,
431 287 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
432 288 if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01)
433 289 {
434 290 PRINTF("send CWF_LONG_F3\n")
435 291 }
436 292 else
437 293 {
438 294 PRINTF("send CWF_F3 (light)\n")
439 295 }
440 296 if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3_a) {
441 297 if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01)
442 298 {
443 299 send_waveform_CWF( wf_cont_f3_b, SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id );
444 300 }
445 301 else
446 302 {
447 303 send_waveform_CWF3_light( wf_cont_f3_b, headerCWF_F3_light, queue_id );
448 304 }
449 305 }
450 306 else
451 307 {
452 308 if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01)
453 309 {
454 310 send_waveform_CWF( wf_cont_f3_a, SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id );
455 311 }
456 312 else
457 313 {
458 314 send_waveform_CWF3_light( wf_cont_f3_a, headerCWF_F3_light, queue_id );
459 315 }
460 316
461 317 }
462 318 }
463 319 }
464 320
465 321 rtems_task cwf2_task(rtems_task_argument argument) // ONLY USED IN BURST AND SBM2
466 322 {
467 323 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f2.
468 324 *
469 325 * @param unused is the starting argument of the RTEMS task
470 326 *
471 327 * The following data packet is sent by this function:
472 328 * - TM_LFR_SCIENCE_BURST_CWF_F2
473 329 * - TM_LFR_SCIENCE_SBM2_CWF_F2
474 330 *
475 331 */
476 332
477 333 rtems_event_set event_out;
478 334 rtems_id queue_id;
479 335 rtems_status_code status;
480 336
481 337 init_header_continuous_wf_table( SID_BURST_CWF_F2, headerCWF_F2_BURST );
482 338 init_header_continuous_wf_table( SID_SBM2_CWF_F2, headerCWF_F2_SBM2 );
483 339
484 340 status = get_message_queue_id_send( &queue_id );
485 341 if (status != RTEMS_SUCCESSFUL)
486 342 {
487 343 PRINTF1("in CWF2 *** ERR get_message_queue_id_send %d\n", status)
488 344 }
489 345
490 346 BOOT_PRINTF("in CWF2 ***\n")
491 347
492 348 while(1){
493 349 // wait for an RTEMS_EVENT
494 350 rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2,
495 351 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
496 352 if (event_out == RTEMS_EVENT_MODE_BURST)
497 353 {
498 354 send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id );
499 355 }
500 356 if (event_out == RTEMS_EVENT_MODE_SBM2)
501 357 {
502 358 send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id );
503 359 }
504 360 }
505 361 }
506 362
507 363 rtems_task cwf1_task(rtems_task_argument argument) // ONLY USED IN SBM1
508 364 {
509 365 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f1.
510 366 *
511 367 * @param unused is the starting argument of the RTEMS task
512 368 *
513 369 * The following data packet is sent by this function:
514 370 * - TM_LFR_SCIENCE_SBM1_CWF_F1
515 371 *
516 372 */
517 373
518 374 rtems_event_set event_out;
519 375 rtems_id queue_id;
520 376 rtems_status_code status;
521 377
522 378 init_header_continuous_wf_table( SID_SBM1_CWF_F1, headerCWF_F1 );
523 379
524 380 status = get_message_queue_id_send( &queue_id );
525 381 if (status != RTEMS_SUCCESSFUL)
526 382 {
527 383 PRINTF1("in CWF1 *** ERR get_message_queue_id_send %d\n", status)
528 384 }
529 385
530 386 BOOT_PRINTF("in CWF1 ***\n")
531 387
532 388 while(1){
533 389 // wait for an RTEMS_EVENT
534 390 rtems_event_receive( RTEMS_EVENT_MODE_SBM1,
535 391 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
536 392 send_waveform_CWF( (volatile int*) ring_node_to_send_cwf_f1->buffer_address, SID_SBM1_CWF_F1, headerCWF_F1, queue_id );
537 393 }
538 394 }
539 395
396 rtems_task swbd_task(rtems_task_argument argument)
397 {
398 /** This RTEMS task is dedicated to the building of snapshots from different continuous waveforms buffers.
399 *
400 * @param unused is the starting argument of the RTEMS task
401 *
402 */
403
404 rtems_event_set event_out;
405
406 BOOT_PRINTF("in SWBD ***\n")
407
408 while(1){
409 // wait for an RTEMS_EVENT
410 rtems_event_receive( RTEMS_EVENT_0,
411 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
412 build_snapshot_from_ring();
413 }
414 }
415
540 416 //******************
541 417 // general functions
542 418 void init_waveforms( void )
543 419 {
544 420 int i = 0;
545 421
546 422 for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
547 423 {
548 424 //***
549 425 // F0
550 426 // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x88887777; //
551 427 // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; //
552 428 // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x44443333; //
553 429
554 430 //***
555 431 // F1
556 432 // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x22221111;
557 433 // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x44443333;
558 434 // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
559 435
560 436 //***
561 437 // F2
562 438 // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x44443333;
563 439 // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111;
564 440 // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
565 441
566 442 //***
567 443 // F3
568 444 // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 0 ] = val1;
569 445 // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 1 ] = val2;
570 446 // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 2 ] = 0xaaaa0000;
571 447 }
572 448 }
573 449
574 450 void init_waveform_rings( void )
575 451 {
576 452 unsigned char i;
577 453
578 454 // F0 RING
579 455 waveform_ring_f0[0].next = (ring_node*) &waveform_ring_f0[1];
580 456 waveform_ring_f0[0].previous = (ring_node*) &waveform_ring_f0[NB_RING_NODES_F0-1];
581 457 waveform_ring_f0[0].buffer_address = (int) &wf_snap_f0[0][0];
582 458
583 459 waveform_ring_f0[NB_RING_NODES_F0-1].next = (ring_node*) &waveform_ring_f0[0];
584 460 waveform_ring_f0[NB_RING_NODES_F0-1].previous = (ring_node*) &waveform_ring_f0[NB_RING_NODES_F0-2];
585 461 waveform_ring_f0[NB_RING_NODES_F0-1].buffer_address = (int) &wf_snap_f0[NB_RING_NODES_F0-1][0];
586 462
587 463 for(i=1; i<NB_RING_NODES_F0-1; i++)
588 464 {
589 465 waveform_ring_f0[i].next = (ring_node*) &waveform_ring_f0[i+1];
590 466 waveform_ring_f0[i].previous = (ring_node*) &waveform_ring_f0[i-1];
591 467 waveform_ring_f0[i].buffer_address = (int) &wf_snap_f0[i][0];
592 468 }
593 469
594 470 // F1 RING
595 471 waveform_ring_f1[0].next = (ring_node*) &waveform_ring_f1[1];
596 472 waveform_ring_f1[0].previous = (ring_node*) &waveform_ring_f1[NB_RING_NODES_F1-1];
597 473 waveform_ring_f1[0].buffer_address = (int) &wf_snap_f1[0][0];
598 474
599 475 waveform_ring_f1[NB_RING_NODES_F1-1].next = (ring_node*) &waveform_ring_f1[0];
600 476 waveform_ring_f1[NB_RING_NODES_F1-1].previous = (ring_node*) &waveform_ring_f1[NB_RING_NODES_F1-2];
601 477 waveform_ring_f1[NB_RING_NODES_F1-1].buffer_address = (int) &wf_snap_f1[NB_RING_NODES_F1-1][0];
602 478
603 479 for(i=1; i<NB_RING_NODES_F1-1; i++)
604 480 {
605 481 waveform_ring_f1[i].next = (ring_node*) &waveform_ring_f1[i+1];
606 482 waveform_ring_f1[i].previous = (ring_node*) &waveform_ring_f1[i-1];
607 483 waveform_ring_f1[i].buffer_address = (int) &wf_snap_f1[i][0];
608 484 }
609 485
610 486 // F2 RING
611 487 waveform_ring_f2[0].next = (ring_node*) &waveform_ring_f2[1];
612 488 waveform_ring_f2[0].previous = (ring_node*) &waveform_ring_f2[NB_RING_NODES_F2-1];
613 489 waveform_ring_f2[0].buffer_address = (int) &wf_snap_f2[0][0];
614 490
615 491 waveform_ring_f2[NB_RING_NODES_F2-1].next = (ring_node*) &waveform_ring_f2[0];
616 492 waveform_ring_f2[NB_RING_NODES_F2-1].previous = (ring_node*) &waveform_ring_f2[NB_RING_NODES_F2-2];
617 493 waveform_ring_f2[NB_RING_NODES_F2-1].buffer_address = (int) &wf_snap_f2[NB_RING_NODES_F2-1][0];
618 494
619 495 for(i=1; i<NB_RING_NODES_F2-1; i++)
620 496 {
621 497 waveform_ring_f2[i].next = (ring_node*) &waveform_ring_f2[i+1];
622 498 waveform_ring_f2[i].previous = (ring_node*) &waveform_ring_f2[i-1];
623 499 waveform_ring_f2[i].buffer_address = (int) &wf_snap_f2[i][0];
624 500 }
625 501
626 502 DEBUG_PRINTF1("waveform_ring_f0 @%x\n", (unsigned int) waveform_ring_f0)
627 503 DEBUG_PRINTF1("waveform_ring_f1 @%x\n", (unsigned int) waveform_ring_f1)
628 504 DEBUG_PRINTF1("waveform_ring_f2 @%x\n", (unsigned int) waveform_ring_f2)
629 505
630 506 }
631 507
632 508 void reset_current_ring_nodes( void )
633 509 {
634 510 current_ring_node_f0 = waveform_ring_f0;
635 511 ring_node_to_send_swf_f0 = waveform_ring_f0;
636 512
637 513 current_ring_node_f1 = waveform_ring_f1;
638 514 ring_node_to_send_cwf_f1 = waveform_ring_f1;
639 515 ring_node_to_send_swf_f1 = waveform_ring_f1;
640 516
641 517 current_ring_node_f2 = waveform_ring_f2;
642 518 ring_node_to_send_cwf_f2 = waveform_ring_f2;
643 519 ring_node_to_send_swf_f2 = waveform_ring_f2;
644 520 }
645 521
646 522 int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF)
647 523 {
648 524 unsigned char i;
649 525
650 526 for (i=0; i<7; i++)
651 527 {
652 528 headerSWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
653 529 headerSWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
654 530 headerSWF[ i ].reserved = DEFAULT_RESERVED;
655 531 headerSWF[ i ].userApplication = CCSDS_USER_APP;
656 532 headerSWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
657 533 headerSWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
658 534 headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
659 535 if (i == 6)
660 536 {
661 537 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_224 >> 8);
662 538 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_224 );
663 539 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_224 >> 8);
664 540 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_224 );
665 541 }
666 542 else
667 543 {
668 544 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_304 >> 8);
669 545 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_304 );
670 546 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_304 >> 8);
671 547 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_304 );
672 548 }
673 549 headerSWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
674 550 headerSWF[ i ].pktCnt = DEFAULT_PKTCNT; // PKT_CNT
675 551 headerSWF[ i ].pktNr = i+1; // PKT_NR
676 552 // DATA FIELD HEADER
677 553 headerSWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
678 554 headerSWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
679 555 headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
680 556 headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
681 557 // AUXILIARY DATA HEADER
682 558 headerSWF[ i ].time[0] = 0x00;
683 559 headerSWF[ i ].time[0] = 0x00;
684 560 headerSWF[ i ].time[0] = 0x00;
685 561 headerSWF[ i ].time[0] = 0x00;
686 562 headerSWF[ i ].time[0] = 0x00;
687 563 headerSWF[ i ].time[0] = 0x00;
688 564 headerSWF[ i ].sid = sid;
689 565 headerSWF[ i ].hkBIA = DEFAULT_HKBIA;
690 566 }
691 567 return LFR_SUCCESSFUL;
692 568 }
693 569
694 570 int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF )
695 571 {
696 572 unsigned int i;
697 573
698 574 for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF; i++)
699 575 {
700 576 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
701 577 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
702 578 headerCWF[ i ].reserved = DEFAULT_RESERVED;
703 579 headerCWF[ i ].userApplication = CCSDS_USER_APP;
704 580 if ( (sid == SID_SBM1_CWF_F1) || (sid == SID_SBM2_CWF_F2) )
705 581 {
706 582 headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2 >> 8);
707 583 headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2);
708 584 }
709 585 else
710 586 {
711 587 headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
712 588 headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
713 589 }
714 590 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
715 591 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_336 >> 8);
716 592 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_336 );
717 593 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF >> 8);
718 594 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF );
719 595 headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
720 596 // DATA FIELD HEADER
721 597 headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
722 598 headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
723 599 headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
724 600 headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
725 601 // AUXILIARY DATA HEADER
726 602 headerCWF[ i ].sid = sid;
727 603 headerCWF[ i ].hkBIA = DEFAULT_HKBIA;
728 604 headerCWF[ i ].time[0] = 0x00;
729 605 headerCWF[ i ].time[0] = 0x00;
730 606 headerCWF[ i ].time[0] = 0x00;
731 607 headerCWF[ i ].time[0] = 0x00;
732 608 headerCWF[ i ].time[0] = 0x00;
733 609 headerCWF[ i ].time[0] = 0x00;
734 610 }
735 611 return LFR_SUCCESSFUL;
736 612 }
737 613
738 614 int init_header_continuous_cwf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF )
739 615 {
740 616 unsigned int i;
741 617
742 618 for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF_LIGHT; i++)
743 619 {
744 620 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
745 621 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
746 622 headerCWF[ i ].reserved = DEFAULT_RESERVED;
747 623 headerCWF[ i ].userApplication = CCSDS_USER_APP;
748 624
749 625 headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
750 626 headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
751 627
752 628 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
753 629 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_672 >> 8);
754 630 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_672 );
755 631 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF_SHORT_F3 >> 8);
756 632 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF_SHORT_F3 );
757 633
758 634 headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
759 635 // DATA FIELD HEADER
760 636 headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
761 637 headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
762 638 headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
763 639 headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
764 640 // AUXILIARY DATA HEADER
765 641 headerCWF[ i ].sid = SID_NORM_CWF_F3;
766 642 headerCWF[ i ].hkBIA = DEFAULT_HKBIA;
767 643 headerCWF[ i ].time[0] = 0x00;
768 644 headerCWF[ i ].time[0] = 0x00;
769 645 headerCWF[ i ].time[0] = 0x00;
770 646 headerCWF[ i ].time[0] = 0x00;
771 647 headerCWF[ i ].time[0] = 0x00;
772 648 headerCWF[ i ].time[0] = 0x00;
773 649 }
774 650 return LFR_SUCCESSFUL;
775 651 }
776 652
777 653 int send_waveform_SWF( volatile int *waveform, unsigned int sid,
778 654 Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id )
779 655 {
780 656 /** This function sends SWF CCSDS packets (F2, F1 or F0).
781 657 *
782 658 * @param waveform points to the buffer containing the data that will be send.
783 659 * @param sid is the source identifier of the data that will be sent.
784 660 * @param headerSWF points to a table of headers that have been prepared for the data transmission.
785 661 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
786 662 * contain information to setup the transmission of the data packets.
787 663 *
788 664 * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks.
789 665 *
790 666 */
791 667
792 668 unsigned int i;
793 669 int ret;
794 670 unsigned int coarseTime;
795 671 unsigned int fineTime;
796 672 rtems_status_code status;
797 673 spw_ioctl_pkt_send spw_ioctl_send_SWF;
798 674
799 675 spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header
800 676 spw_ioctl_send_SWF.options = 0;
801 677
802 678 ret = LFR_DEFAULT;
803 679
804 680 DEBUG_PRINTF1("sid = %d, ", sid)
805 681 DEBUG_PRINTF2("coarse = %x, fine = %x\n", waveform[0], waveform[1])
806 682
807 683 coarseTime = waveform[0];
808 684 fineTime = waveform[1];
809 685
810 686 for (i=0; i<7; i++) // send waveform
811 687 {
812 688 spw_ioctl_send_SWF.data = (char*) &waveform[ (i * BLK_NR_304 * NB_WORDS_SWF_BLK) + TIME_OFFSET];
813 689 spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ];
814 690 // BUILD THE DATA
815 691 if (i==6) {
816 692 spw_ioctl_send_SWF.dlen = BLK_NR_224 * NB_BYTES_SWF_BLK;
817 693 }
818 694 else {
819 695 spw_ioctl_send_SWF.dlen = BLK_NR_304 * NB_BYTES_SWF_BLK;
820 696 }
821 697 // SET PACKET SEQUENCE COUNTER
822 698 increment_seq_counter_source_id( headerSWF[ i ].packetSequenceControl, sid );
823 699 // SET PACKET TIME
824 700 compute_acquisition_time( coarseTime, fineTime, sid, i, headerSWF[ i ].acquisitionTime );
825 701 //
826 702 headerSWF[ i ].time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
827 703 headerSWF[ i ].time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
828 704 headerSWF[ i ].time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
829 705 headerSWF[ i ].time[3] = (unsigned char) (time_management_regs->coarse_time);
830 706 headerSWF[ i ].time[4] = (unsigned char) (time_management_regs->fine_time>>8);
831 707 headerSWF[ i ].time[5] = (unsigned char) (time_management_regs->fine_time);
832 708 // SEND PACKET
833 709 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_SWF, ACTION_MSG_SPW_IOCTL_SEND_SIZE);
834 710 if (status != RTEMS_SUCCESSFUL) {
835 711 printf("%d-%d, ERR %d\n", sid, i, (int) status);
836 712 ret = LFR_DEFAULT;
837 713 }
838 714 rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds
839 715 }
840 716
841 717 return ret;
842 718 }
843 719
844 720 int send_waveform_CWF(volatile int *waveform, unsigned int sid,
845 721 Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id)
846 722 {
847 723 /** This function sends CWF CCSDS packets (F2, F1 or F0).
848 724 *
849 725 * @param waveform points to the buffer containing the data that will be send.
850 726 * @param sid is the source identifier of the data that will be sent.
851 727 * @param headerCWF points to a table of headers that have been prepared for the data transmission.
852 728 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
853 729 * contain information to setup the transmission of the data packets.
854 730 *
855 731 * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks.
856 732 *
857 733 */
858 734
859 735 unsigned int i;
860 736 int ret;
861 737 unsigned int coarseTime;
862 738 unsigned int fineTime;
863 739 rtems_status_code status;
864 740 spw_ioctl_pkt_send spw_ioctl_send_CWF;
865 741
866 742 spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
867 743 spw_ioctl_send_CWF.options = 0;
868 744
869 745 ret = LFR_DEFAULT;
870 746
871 747 coarseTime = waveform[0];
872 748 fineTime = waveform[1];
873 749
874 750 for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF; i++) // send waveform
875 751 {
876 752 spw_ioctl_send_CWF.data = (char*) &waveform[ (i * BLK_NR_CWF * NB_WORDS_SWF_BLK) + TIME_OFFSET];
877 753 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
878 754 // BUILD THE DATA
879 755 spw_ioctl_send_CWF.dlen = BLK_NR_CWF * NB_BYTES_SWF_BLK;
880 756 // SET PACKET SEQUENCE COUNTER
881 757 increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, sid );
882 758 // SET PACKET TIME
883 759 compute_acquisition_time( coarseTime, fineTime, sid, i, headerCWF[ i ].acquisitionTime);
884 760 //
885 761 headerCWF[ i ].time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
886 762 headerCWF[ i ].time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
887 763 headerCWF[ i ].time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
888 764 headerCWF[ i ].time[3] = (unsigned char) (time_management_regs->coarse_time);
889 765 headerCWF[ i ].time[4] = (unsigned char) (time_management_regs->fine_time>>8);
890 766 headerCWF[ i ].time[5] = (unsigned char) (time_management_regs->fine_time);
891 767 // SEND PACKET
892 768 if (sid == SID_NORM_CWF_LONG_F3)
893 769 {
894 770 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
895 771 if (status != RTEMS_SUCCESSFUL) {
896 772 printf("%d-%d, ERR %d\n", sid, i, (int) status);
897 773 ret = LFR_DEFAULT;
898 774 }
899 775 rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS);
900 776 }
901 777 else
902 778 {
903 779 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
904 780 if (status != RTEMS_SUCCESSFUL) {
905 781 printf("%d-%d, ERR %d\n", sid, i, (int) status);
906 782 ret = LFR_DEFAULT;
907 783 }
908 784 }
909 785 }
910 786
911 787 return ret;
912 788 }
913 789
914 790 int send_waveform_CWF3_light(volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id)
915 791 {
916 792 /** This function sends CWF_F3 CCSDS packets without the b1, b2 and b3 data.
917 793 *
918 794 * @param waveform points to the buffer containing the data that will be send.
919 795 * @param headerCWF points to a table of headers that have been prepared for the data transmission.
920 796 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
921 797 * contain information to setup the transmission of the data packets.
922 798 *
923 799 * By default, CWF_F3 packet are send without the b1, b2 and b3 data. This function rebuilds a data buffer
924 800 * from the incoming data and sends it in 7 packets, 6 containing 340 blocks and 1 one containing 8 blocks.
925 801 *
926 802 */
927 803
928 804 unsigned int i;
929 805 int ret;
930 806 unsigned int coarseTime;
931 807 unsigned int fineTime;
932 808 rtems_status_code status;
933 809 spw_ioctl_pkt_send spw_ioctl_send_CWF;
934 810 char *sample;
935 811
936 812 spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
937 813 spw_ioctl_send_CWF.options = 0;
938 814
939 815 ret = LFR_DEFAULT;
940 816
941 817 //**********************
942 818 // BUILD CWF3_light DATA
943 819 for ( i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
944 820 {
945 821 sample = (char*) &waveform[ (i * NB_WORDS_SWF_BLK) + TIME_OFFSET ];
946 822 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + TIME_OFFSET_IN_BYTES ] = sample[ 0 ];
947 823 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 + TIME_OFFSET_IN_BYTES ] = sample[ 1 ];
948 824 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 + TIME_OFFSET_IN_BYTES ] = sample[ 2 ];
949 825 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 + TIME_OFFSET_IN_BYTES ] = sample[ 3 ];
950 826 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 + TIME_OFFSET_IN_BYTES ] = sample[ 4 ];
951 827 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 + TIME_OFFSET_IN_BYTES ] = sample[ 5 ];
952 828 }
953 829
954 830 coarseTime = waveform[0];
955 831 fineTime = waveform[1];
956 832
957 833 //*********************
958 834 // SEND CWF3_light DATA
959 835 for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF_LIGHT; i++) // send waveform
960 836 {
961 837 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];
962 838 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
963 839 // BUILD THE DATA
964 840 spw_ioctl_send_CWF.dlen = BLK_NR_CWF_SHORT_F3 * NB_BYTES_CWF3_LIGHT_BLK;
965 841 // SET PACKET SEQUENCE COUNTER
966 842 increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, SID_NORM_CWF_F3 );
967 843 // SET PACKET TIME
968 844 compute_acquisition_time( coarseTime, fineTime, SID_NORM_CWF_F3, i, headerCWF[ i ].acquisitionTime );
969 845 //
970 846 headerCWF[ i ].time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
971 847 headerCWF[ i ].time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
972 848 headerCWF[ i ].time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
973 849 headerCWF[ i ].time[3] = (unsigned char) (time_management_regs->coarse_time);
974 850 headerCWF[ i ].time[4] = (unsigned char) (time_management_regs->fine_time>>8);
975 851 headerCWF[ i ].time[5] = (unsigned char) (time_management_regs->fine_time);
976 852 // SEND PACKET
977 853 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
978 854 if (status != RTEMS_SUCCESSFUL) {
979 855 printf("%d-%d, ERR %d\n", SID_NORM_CWF_F3, i, (int) status);
980 856 ret = LFR_DEFAULT;
981 857 }
982 858 rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS);
983 859 }
984 860
985 861 return ret;
986 862 }
987 863
988 864 void compute_acquisition_time( unsigned int coarseTime, unsigned int fineTime,
989 865 unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char * acquisitionTime )
990 866 {
991 867 unsigned long long int acquisitionTimeAsLong;
992 868 unsigned char localAcquisitionTime[6];
993 double deltaT = 0.;
869 double deltaT;
870
871 deltaT = 0.;
994 872
995 873 localAcquisitionTime[0] = (unsigned char) ( coarseTime >> 8 );
996 874 localAcquisitionTime[1] = (unsigned char) ( coarseTime );
997 875 localAcquisitionTime[2] = (unsigned char) ( coarseTime >> 24 );
998 876 localAcquisitionTime[3] = (unsigned char) ( coarseTime >> 16 );
999 877 localAcquisitionTime[4] = (unsigned char) ( fineTime >> 24 );
1000 878 localAcquisitionTime[5] = (unsigned char) ( fineTime >> 16 );
1001 879
1002 880 acquisitionTimeAsLong = ( (unsigned long long int) localAcquisitionTime[0] << 40 )
1003 881 + ( (unsigned long long int) localAcquisitionTime[1] << 32 )
1004 882 + ( localAcquisitionTime[2] << 24 )
1005 883 + ( localAcquisitionTime[3] << 16 )
1006 884 + ( localAcquisitionTime[4] << 8 )
1007 885 + ( localAcquisitionTime[5] );
1008 886
1009 887 switch( sid )
1010 888 {
1011 889 case SID_NORM_SWF_F0:
1012 890 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 24576. ;
1013 891 break;
1014 892
1015 893 case SID_NORM_SWF_F1:
1016 894 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 4096. ;
1017 895 break;
1018 896
1019 897 case SID_NORM_SWF_F2:
1020 898 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 256. ;
1021 899 break;
1022 900
1023 901 case SID_SBM1_CWF_F1:
1024 902 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 4096. ;
1025 903 break;
1026 904
1027 905 case SID_SBM2_CWF_F2:
1028 906 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ;
1029 907 break;
1030 908
1031 909 case SID_BURST_CWF_F2:
1032 910 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ;
1033 911 break;
1034 912
1035 913 case SID_NORM_CWF_F3:
1036 914 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF_SHORT_F3 * 65536. / 16. ;
1037 915 break;
1038 916
1039 917 case SID_NORM_CWF_LONG_F3:
1040 918 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 16. ;
1041 919 break;
1042 920
1043 921 default:
1044 922 PRINTF1("in compute_acquisition_time *** ERR unexpected sid %d", sid)
1045 923 deltaT = 0.;
1046 924 break;
1047 925 }
1048 926
1049 927 acquisitionTimeAsLong = acquisitionTimeAsLong + (unsigned long long int) deltaT;
1050 928 //
1051 929 acquisitionTime[0] = (unsigned char) (acquisitionTimeAsLong >> 40);
1052 930 acquisitionTime[1] = (unsigned char) (acquisitionTimeAsLong >> 32);
1053 931 acquisitionTime[2] = (unsigned char) (acquisitionTimeAsLong >> 24);
1054 932 acquisitionTime[3] = (unsigned char) (acquisitionTimeAsLong >> 16);
1055 933 acquisitionTime[4] = (unsigned char) (acquisitionTimeAsLong >> 8 );
1056 934 acquisitionTime[5] = (unsigned char) (acquisitionTimeAsLong );
935
936 }
937
938 void build_snapshot_from_ring( void )
939 {
940 unsigned int i;
941 unsigned long long int centerTime_asLong;
942 unsigned long long int acquisitionTimeF0_asLong;
943 unsigned long long int acquisitionTimeF1_asLong;
944 unsigned char *acquisitionTimeF0;
945 unsigned char *acquisitionTimeF1;
946 unsigned char *ptr1;
947 unsigned char *ptr2;
948
949 unsigned int deltaT;
950
951 deltaT = 2731; // (2048. / 24576. / 2.) * 65536. = 2730.667;
952
953 acquisitionTimeF0 = (unsigned char*) current_ring_node_f0->buffer_address;
954 acquisitionTimeF1 = (unsigned char*) ring_node_to_send_cwf_f1->buffer_address;
955
956 acquisitionTimeF0_asLong = 0x00;
957 acquisitionTimeF1_asLong = 0x00;
958 acquisitionTimeF0_asLong = ( acquisitionTimeF0[0] << 24 )
959 + ( acquisitionTimeF0[1] << 16 )
960 + ( (unsigned long long int) acquisitionTimeF0[2] << 40 )
961 + ( (unsigned long long int) acquisitionTimeF0[3] << 32 )
962 + ( acquisitionTimeF0[4] << 8 )
963 + ( acquisitionTimeF0[5] );
964
965 acquisitionTimeF1_asLong = ( acquisitionTimeF1[0] << 24 )
966 + ( acquisitionTimeF1[1] << 16 )
967 + ( (unsigned long long int) acquisitionTimeF1[2] << 40 )
968 + ( (unsigned long long int) acquisitionTimeF1[3] << 32 )
969 + ( acquisitionTimeF1[4] << 8 )
970 + ( acquisitionTimeF1[5] );
971
972 centerTime_asLong = acquisitionTimeF0_asLong + deltaT;
973
974 ptr1 = (unsigned char*) &acquisitionTimeF1_asLong;
975 ptr2 = (unsigned char*) wf_snap_f1_extracted;
976
977 ptr2[0] = ptr1[ 2 + 2 ];
978 ptr2[1] = ptr1[ 3 + 2 ];
979 ptr2[2] = ptr1[ 0 + 2 ];
980 ptr2[3] = ptr1[ 1 + 2 ];
981 ptr2[4] = ptr1[ 4 + 2 ];
982 ptr2[5] = ptr1[ 5 + 2 ];
983
984 for (i=0; i<(NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK); i++ )
985 {
986 wf_snap_f1_extracted[i + TIME_OFFSET] = ((int*)(ring_node_to_send_cwf_f1->buffer_address))[i + TIME_OFFSET];
987 }
1057 988 }
1058 989
1059 990 //**************
1060 991 // wfp registers
1061 992 void reset_wfp_burst_enable(void)
1062 993 {
1063 994 /** This function resets the waveform picker burst_enable register.
1064 995 *
1065 996 * The burst bits [f2 f1 f0] and the enable bits [f3 f2 f1 f0] are set to 0.
1066 997 *
1067 998 */
1068 999
1069 1000 waveform_picker_regs->run_burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
1070 1001 }
1071 1002
1072 1003 void reset_wfp_status( void )
1073 1004 {
1074 1005 /** This function resets the waveform picker status register.
1075 1006 *
1076 1007 * All status bits are set to 0 [new_err full_err full].
1077 1008 *
1078 1009 */
1079 1010
1080 1011 waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
1081 1012 }
1082 1013
1083 1014 void reset_waveform_picker_regs(void)
1084 1015 {
1085 1016 /** This function resets the waveform picker module registers.
1086 1017 *
1087 1018 * The registers affected by this function are located at the following offset addresses:
1088 1019 * - 0x00 data_shaping
1089 1020 * - 0x04 run_burst_enable
1090 1021 * - 0x08 addr_data_f0
1091 1022 * - 0x0C addr_data_f1
1092 1023 * - 0x10 addr_data_f2
1093 1024 * - 0x14 addr_data_f3
1094 1025 * - 0x18 status
1095 1026 * - 0x1C delta_snapshot
1096 1027 * - 0x20 delta_f0
1097 1028 * - 0x24 delta_f0_2
1098 1029 * - 0x28 delta_f1
1099 1030 * - 0x2c delta_f2
1100 1031 * - 0x30 nb_data_by_buffer
1101 1032 * - 0x34 nb_snapshot_param
1102 1033 * - 0x38 start_date
1103 1034 * - 0x3c nb_word_in_buffer
1104 1035 *
1105 1036 */
1106 1037
1107 1038 waveform_picker_regs->data_shaping = 0x01; // 0x00 *** R1 R0 SP1 SP0 BW
1108 1039 waveform_picker_regs->run_burst_enable = 0x00; // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ]
1109 1040 waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address; // 0x08
1110 1041 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; // 0x0c
1111 1042 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; // 0x10
1112 1043 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a); // 0x14
1113 1044 waveform_picker_regs->status = 0x00; // 0x18
1114 1045 //
1115 1046 set_wfp_delta_snapshot(); // 0x1c
1116 1047 set_wfp_delta_f0_f0_2(); // 0x20, 0x24
1117 1048 set_wfp_delta_f1(); // 0x28
1118 1049 set_wfp_delta_f2(); // 0x2c
1119 1050 DEBUG_PRINTF1("delta_snapshot %x\n", waveform_picker_regs->delta_snapshot)
1120 1051 DEBUG_PRINTF1("delta_f0 %x\n", waveform_picker_regs->delta_f0)
1121 1052 DEBUG_PRINTF1("delta_f0_2 %x\n", waveform_picker_regs->delta_f0_2)
1122 1053 DEBUG_PRINTF1("delta_f1 %x\n", waveform_picker_regs->delta_f1)
1123 1054 DEBUG_PRINTF1("delta_f2 %x\n", waveform_picker_regs->delta_f2)
1124 1055 // 2688 = 8 * 336
1125 1056 waveform_picker_regs->nb_data_by_buffer = 0xa7f; // 0x30 *** 2688 - 1 => nb samples -1
1126 1057 waveform_picker_regs->snapshot_param = 0xa80; // 0x34 *** 2688 => nb samples
1127 1058 waveform_picker_regs->start_date = 0x00; // 0x38
1128 1059 waveform_picker_regs->nb_word_in_buffer = 0x1f82; // 0x3c *** 2688 * 3 + 2 = 8066
1129 1060 }
1130 1061
1131 1062 void set_wfp_data_shaping( void )
1132 1063 {
1133 1064 /** This function sets the data_shaping register of the waveform picker module.
1134 1065 *
1135 1066 * The value is read from one field of the parameter_dump_packet structure:\n
1136 1067 * bw_sp0_sp1_r0_r1
1137 1068 *
1138 1069 */
1139 1070
1140 1071 unsigned char data_shaping;
1141 1072
1142 1073 // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register
1143 1074 // waveform picker : [R1 R0 SP1 SP0 BW]
1144 1075
1145 1076 data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1;
1146 1077
1147 1078 waveform_picker_regs->data_shaping =
1148 1079 ( (data_shaping & 0x10) >> 4 ) // BW
1149 1080 + ( (data_shaping & 0x08) >> 2 ) // SP0
1150 1081 + ( (data_shaping & 0x04) ) // SP1
1151 1082 + ( (data_shaping & 0x02) << 2 ) // R0
1152 1083 + ( (data_shaping & 0x01) << 4 ); // R1
1153 1084 }
1154 1085
1155 1086 void set_wfp_burst_enable_register( unsigned char mode )
1156 1087 {
1157 1088 /** This function sets the waveform picker burst_enable register depending on the mode.
1158 1089 *
1159 1090 * @param mode is the LFR mode to launch.
1160 1091 *
1161 1092 * The burst bits shall be before the enable bits.
1162 1093 *
1163 1094 */
1164 1095
1165 1096 // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0
1166 1097 // the burst bits shall be set first, before the enable bits
1167 1098 switch(mode) {
1168 1099 case(LFR_MODE_NORMAL):
1169 1100 waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enable
1170 1101 waveform_picker_regs->run_burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0
1171 1102 break;
1172 1103 case(LFR_MODE_BURST):
1173 1104 waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled
1174 1105 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x04; // [0100] enable f2
1175 1106 break;
1176 1107 case(LFR_MODE_SBM1):
1177 1108 waveform_picker_regs->run_burst_enable = 0x20; // [0010 0000] f1 burst enabled
1178 1109 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
1179 1110 break;
1180 1111 case(LFR_MODE_SBM2):
1181 1112 waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled
1182 1113 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
1183 1114 break;
1184 1115 default:
1185 1116 waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled
1186 1117 break;
1187 1118 }
1188 1119 }
1189 1120
1190 1121 void set_wfp_delta_snapshot( void )
1191 1122 {
1192 1123 /** This function sets the delta_snapshot register of the waveform picker module.
1193 1124 *
1194 1125 * The value is read from two (unsigned char) of the parameter_dump_packet structure:
1195 1126 * - sy_lfr_n_swf_p[0]
1196 1127 * - sy_lfr_n_swf_p[1]
1197 1128 *
1198 1129 */
1199 1130
1200 1131 unsigned int delta_snapshot;
1201 1132 unsigned int delta_snapshot_in_T2;
1202 1133
1203 1134 delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256
1204 1135 + parameter_dump_packet.sy_lfr_n_swf_p[1];
1205 1136
1206 1137 delta_snapshot_in_T2 = delta_snapshot * 256;
1207 1138 waveform_picker_regs->delta_snapshot = delta_snapshot_in_T2; // max 4 bytes
1208 1139 }
1209 1140
1210 1141 void set_wfp_delta_f0_f0_2( void )
1211 1142 {
1212 1143 unsigned int delta_snapshot;
1213 1144 unsigned int nb_samples_per_snapshot;
1214 1145 float delta_f0_in_float;
1215 1146
1216 1147 delta_snapshot = waveform_picker_regs->delta_snapshot;
1217 1148 nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1];
1218 1149 delta_f0_in_float =nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 24576.) * 256.;
1219 1150
1220 1151 waveform_picker_regs->delta_f0 = delta_snapshot - floor( delta_f0_in_float );
1221 1152 waveform_picker_regs->delta_f0_2 = 0x7; // max 7 bits
1222 1153 }
1223 1154
1224 1155 void set_wfp_delta_f1( void )
1225 1156 {
1226 1157 unsigned int delta_snapshot;
1227 1158 unsigned int nb_samples_per_snapshot;
1228 1159 float delta_f1_in_float;
1229 1160
1230 1161 delta_snapshot = waveform_picker_regs->delta_snapshot;
1231 1162 nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1];
1232 1163 delta_f1_in_float = nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 4096.) * 256.;
1233 1164
1234 1165 waveform_picker_regs->delta_f1 = delta_snapshot - floor( delta_f1_in_float );
1235 1166 }
1236 1167
1237 1168 void set_wfp_delta_f2()
1238 1169 {
1239 1170 unsigned int delta_snapshot;
1240 1171 unsigned int nb_samples_per_snapshot;
1241 1172
1242 1173 delta_snapshot = waveform_picker_regs->delta_snapshot;
1243 1174 nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1];
1244 1175
1245 1176 waveform_picker_regs->delta_f2 = delta_snapshot - nb_samples_per_snapshot / 2;
1246 1177 }
1247 1178
1248 1179 //*****************
1249 1180 // local parameters
1250 1181 void set_local_nb_interrupt_f0_MAX( void )
1251 1182 {
1252 1183 /** This function sets the value of the nb_interrupt_f0_MAX local parameter.
1253 1184 *
1254 1185 * This parameter is used for the SM validation only.\n
1255 1186 * The software waits param_local.local_nb_interrupt_f0_MAX interruptions from the spectral matrices
1256 1187 * module before launching a basic processing.
1257 1188 *
1258 1189 */
1259 1190
1260 1191 param_local.local_nb_interrupt_f0_MAX = ( (parameter_dump_packet.sy_lfr_n_asm_p[0]) * 256
1261 1192 + parameter_dump_packet.sy_lfr_n_asm_p[1] ) * 100;
1262 1193 }
1263 1194
1264 1195 void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid )
1265 1196 {
1266 1197 unsigned short *sequence_cnt;
1267 1198 unsigned short segmentation_grouping_flag;
1268 1199 unsigned short new_packet_sequence_control;
1269 1200
1270 1201 if ( (sid ==SID_NORM_SWF_F0) || (sid ==SID_NORM_SWF_F1) || (sid ==SID_NORM_SWF_F2)
1271 1202 || (sid ==SID_NORM_CWF_F3) || (sid==SID_NORM_CWF_LONG_F3) || (sid ==SID_BURST_CWF_F2) )
1272 1203 {
1273 1204 sequence_cnt = &sequenceCounters_SCIENCE_NORMAL_BURST;
1274 1205 }
1275 1206 else if ( (sid ==SID_SBM1_CWF_F1) || (sid ==SID_SBM2_CWF_F2) )
1276 1207 {
1277 1208 sequence_cnt = &sequenceCounters_SCIENCE_SBM1_SBM2;
1278 1209 }
1279 1210 else
1280 1211 {
1281 1212 sequence_cnt = NULL;
1282 1213 PRINTF1("in increment_seq_counter_source_id *** ERR apid_destid %d not known\n", sid)
1283 1214 }
1284 1215
1285 1216 if (sequence_cnt != NULL)
1286 1217 {
1287 1218 segmentation_grouping_flag = (packet_sequence_control[ 0 ] & 0xc0) << 8;
1288 1219 *sequence_cnt = (*sequence_cnt) & 0x3fff;
1289 1220
1290 1221 new_packet_sequence_control = segmentation_grouping_flag | *sequence_cnt ;
1291 1222
1292 1223 packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8);
1293 1224 packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control );
1294 1225
1295 1226 // increment the sequence counter for the next packet
1296 1227 if ( *sequence_cnt < SEQ_CNT_MAX)
1297 1228 {
1298 1229 *sequence_cnt = *sequence_cnt + 1;
1299 1230 }
1300 1231 else
1301 1232 {
1302 1233 *sequence_cnt = 0;
1303 1234 }
1304 1235 }
1305 1236 }
General Comments 0
You need to be logged in to leave comments. Login now