##// END OF EJS Templates
Minor changes to test VHDL 0.0.9
paul -
r86:143da496b835 nov2013
parent child
Show More
@@ -1,248 +1,248
1 1 #############################################################################
2 2 # Makefile for building: bin/fsw
3 # Generated by qmake (2.01a) (Qt 4.8.5) on: Fri Nov 22 16:34:14 2013
3 # Generated by qmake (2.01a) (Qt 4.8.5) on: Thu Dec 12 07:45:06 2013
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 13 DEFINES = -DSW_VERSION_N1=0 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=22 -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
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 OBJECTS = obj/wf_handler.o \
57 57 obj/tc_handler.o \
58 58 obj/fsw_processing.o \
59 59 obj/fsw_misc.o \
60 60 obj/fsw_init.o \
61 61 obj/fsw_globals.o \
62 62 obj/fsw_spacewire.o \
63 63 obj/tc_load_dump_parameters.o \
64 64 obj/tm_lfr_tc_exe.o \
65 65 obj/tc_acceptance.o
66 66 DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \
67 67 /usr/lib64/qt4/mkspecs/common/linux.conf \
68 68 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
69 69 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
70 70 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
71 71 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
72 72 /usr/lib64/qt4/mkspecs/qconfig.pri \
73 73 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
74 74 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
75 75 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
76 76 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
77 77 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
78 78 sparc.pri \
79 79 /usr/lib64/qt4/mkspecs/features/release.prf \
80 80 /usr/lib64/qt4/mkspecs/features/default_post.prf \
81 81 /usr/lib64/qt4/mkspecs/features/shared.prf \
82 82 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
83 83 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
84 84 /usr/lib64/qt4/mkspecs/features/resources.prf \
85 85 /usr/lib64/qt4/mkspecs/features/uic.prf \
86 86 /usr/lib64/qt4/mkspecs/features/yacc.prf \
87 87 /usr/lib64/qt4/mkspecs/features/lex.prf \
88 88 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \
89 89 fsw-qt.pro
90 90 QMAKE_TARGET = fsw
91 91 DESTDIR = bin/
92 92 TARGET = bin/fsw
93 93
94 94 first: all
95 95 ####### Implicit rules
96 96
97 97 .SUFFIXES: .o .c .cpp .cc .cxx .C
98 98
99 99 .cpp.o:
100 100 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
101 101
102 102 .cc.o:
103 103 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
104 104
105 105 .cxx.o:
106 106 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
107 107
108 108 .C.o:
109 109 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
110 110
111 111 .c.o:
112 112 $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
113 113
114 114 ####### Build rules
115 115
116 116 all: Makefile $(TARGET)
117 117
118 118 $(TARGET): $(OBJECTS)
119 119 @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/
120 120 $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
121 121
122 122 Makefile: fsw-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \
123 123 /usr/lib64/qt4/mkspecs/common/linux.conf \
124 124 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
125 125 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
126 126 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
127 127 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
128 128 /usr/lib64/qt4/mkspecs/qconfig.pri \
129 129 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
130 130 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
131 131 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
132 132 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
133 133 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
134 134 sparc.pri \
135 135 /usr/lib64/qt4/mkspecs/features/release.prf \
136 136 /usr/lib64/qt4/mkspecs/features/default_post.prf \
137 137 /usr/lib64/qt4/mkspecs/features/shared.prf \
138 138 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
139 139 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
140 140 /usr/lib64/qt4/mkspecs/features/resources.prf \
141 141 /usr/lib64/qt4/mkspecs/features/uic.prf \
142 142 /usr/lib64/qt4/mkspecs/features/yacc.prf \
143 143 /usr/lib64/qt4/mkspecs/features/lex.prf \
144 144 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf
145 145 $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
146 146 /usr/lib64/qt4/mkspecs/common/unix.conf:
147 147 /usr/lib64/qt4/mkspecs/common/linux.conf:
148 148 /usr/lib64/qt4/mkspecs/common/gcc-base.conf:
149 149 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf:
150 150 /usr/lib64/qt4/mkspecs/common/g++-base.conf:
151 151 /usr/lib64/qt4/mkspecs/common/g++-unix.conf:
152 152 /usr/lib64/qt4/mkspecs/qconfig.pri:
153 153 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri:
154 154 /usr/lib64/qt4/mkspecs/features/qt_functions.prf:
155 155 /usr/lib64/qt4/mkspecs/features/qt_config.prf:
156 156 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf:
157 157 /usr/lib64/qt4/mkspecs/features/default_pre.prf:
158 158 sparc.pri:
159 159 /usr/lib64/qt4/mkspecs/features/release.prf:
160 160 /usr/lib64/qt4/mkspecs/features/default_post.prf:
161 161 /usr/lib64/qt4/mkspecs/features/shared.prf:
162 162 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf:
163 163 /usr/lib64/qt4/mkspecs/features/warn_on.prf:
164 164 /usr/lib64/qt4/mkspecs/features/resources.prf:
165 165 /usr/lib64/qt4/mkspecs/features/uic.prf:
166 166 /usr/lib64/qt4/mkspecs/features/yacc.prf:
167 167 /usr/lib64/qt4/mkspecs/features/lex.prf:
168 168 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf:
169 169 qmake: FORCE
170 170 @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
171 171
172 172 dist:
173 173 @$(CHK_DIR_EXISTS) obj/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0
174 174 $(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
175 175
176 176
177 177 clean:compiler_clean
178 178 -$(DEL_FILE) $(OBJECTS)
179 179 -$(DEL_FILE) *~ core *.core
180 180
181 181
182 182 ####### Sub-libraries
183 183
184 184 distclean: clean
185 185 -$(DEL_FILE) $(TARGET)
186 186 -$(DEL_FILE) Makefile
187 187
188 188
189 189 grmon:
190 190 cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u
191 191
192 192 check: first
193 193
194 194 compiler_rcc_make_all:
195 195 compiler_rcc_clean:
196 196 compiler_uic_make_all:
197 197 compiler_uic_clean:
198 198 compiler_image_collection_make_all: qmake_image_collection.cpp
199 199 compiler_image_collection_clean:
200 200 -$(DEL_FILE) qmake_image_collection.cpp
201 201 compiler_yacc_decl_make_all:
202 202 compiler_yacc_decl_clean:
203 203 compiler_yacc_impl_make_all:
204 204 compiler_yacc_impl_clean:
205 205 compiler_lex_make_all:
206 206 compiler_lex_clean:
207 207 compiler_clean:
208 208
209 209 ####### Compile
210 210
211 211 obj/wf_handler.o: ../src/wf_handler.c
212 212 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/wf_handler.o ../src/wf_handler.c
213 213
214 214 obj/tc_handler.o: ../src/tc_handler.c
215 215 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o ../src/tc_handler.c
216 216
217 217 obj/fsw_processing.o: ../src/fsw_processing.c ../src/fsw_processing_globals.c
218 218 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/fsw_processing.c
219 219
220 220 obj/fsw_misc.o: ../src/fsw_misc.c
221 221 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c
222 222
223 223 obj/fsw_init.o: ../src/fsw_init.c ../src/fsw_config.c
224 224 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o ../src/fsw_init.c
225 225
226 226 obj/fsw_globals.o: ../src/fsw_globals.c
227 227 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c
228 228
229 229 obj/fsw_spacewire.o: ../src/fsw_spacewire.c
230 230 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spacewire.o ../src/fsw_spacewire.c
231 231
232 232 obj/tc_load_dump_parameters.o: ../src/tc_load_dump_parameters.c
233 233 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_load_dump_parameters.o ../src/tc_load_dump_parameters.c
234 234
235 235 obj/tm_lfr_tc_exe.o: ../src/tm_lfr_tc_exe.c
236 236 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tm_lfr_tc_exe.o ../src/tm_lfr_tc_exe.c
237 237
238 238 obj/tc_acceptance.o: ../src/tc_acceptance.c
239 239 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_acceptance.o ../src/tc_acceptance.c
240 240
241 241 ####### Install
242 242
243 243 install: FORCE
244 244
245 245 uninstall: FORCE
246 246
247 247 FORCE:
248 248
@@ -1,305 +1,305
1 1 <?xml version="1.0" encoding="UTF-8"?>
2 2 <!DOCTYPE QtCreatorProject>
3 <!-- Written by QtCreator 2.8.1, 2013-11-29T10:16:14. -->
3 <!-- Written by QtCreator 2.8.1, 2013-12-12T15:59:05. -->
4 4 <qtcreator>
5 5 <data>
6 6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
7 7 <value type="int">0</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="QString" 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="QString" 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">System</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-Qt 4.8.2 in PATH (System)</value>
55 55 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.2 in PATH (System)</value>
56 56 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{5289e843-9ef2-45ce-88c6-ad27d8e08def}</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">1</value>
60 60 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
61 61 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
62 62 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
63 63 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
64 64 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
65 65 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
66 66 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
67 67 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
68 68 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
69 69 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
70 70 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
71 71 </valuemap>
72 72 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
73 73 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
74 74 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
75 75 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
76 76 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
77 77 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
78 78 <value type="QString">-w</value>
79 79 <value type="QString">-r</value>
80 80 </valuelist>
81 81 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
82 82 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w -j 4</value>
83 83 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
84 84 </valuemap>
85 85 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
86 86 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
87 87 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
88 88 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
89 89 </valuemap>
90 90 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
91 91 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
92 92 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
93 93 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
94 94 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
95 95 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
96 96 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
97 97 <value type="QString">-w</value>
98 98 <value type="QString">-r</value>
99 99 </valuelist>
100 100 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
101 101 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w clean</value>
102 102 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
103 103 </valuemap>
104 104 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
105 105 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
106 106 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
107 107 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
108 108 </valuemap>
109 109 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
110 110 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
111 111 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
112 112 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 4.8.2 in PATH (System) Release</value>
113 113 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
114 114 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
115 115 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
116 116 <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/DEV_PLE/FSW-qt</value>
117 117 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value>
118 118 </valuemap>
119 119 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
120 120 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
121 121 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
122 122 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
123 123 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
124 124 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
125 125 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
126 126 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
127 127 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
128 128 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
129 129 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
130 130 </valuemap>
131 131 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
132 132 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
133 133 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
134 134 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
135 135 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
136 136 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
137 137 <value type="QString">-w</value>
138 138 <value type="QString">-r</value>
139 139 </valuelist>
140 140 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
141 141 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w </value>
142 142 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
143 143 </valuemap>
144 144 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
145 145 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
146 146 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
147 147 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
148 148 </valuemap>
149 149 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
150 150 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
151 151 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
152 152 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
153 153 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
154 154 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
155 155 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
156 156 <value type="QString">-w</value>
157 157 <value type="QString">-r</value>
158 158 </valuelist>
159 159 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
160 160 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w clean</value>
161 161 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
162 162 </valuemap>
163 163 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
164 164 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
165 165 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
166 166 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
167 167 </valuemap>
168 168 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
169 169 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
170 170 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
171 171 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 4.8.2 in PATH (System) Debug</value>
172 172 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
173 173 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
174 174 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
175 175 <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/DEV_PLE/FSW-qt</value>
176 176 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value>
177 177 </valuemap>
178 178 <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
179 179 <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
180 180 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
181 181 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
182 182 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
183 183 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
184 184 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
185 185 </valuemap>
186 186 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
187 187 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">No deployment</value>
188 188 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
189 189 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
190 190 </valuemap>
191 191 <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
192 192 <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
193 193 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
194 194 <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
195 195 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
196 196 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
197 197 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
198 198 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
199 199 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
200 200 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
201 201 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
202 202 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
203 203 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
204 204 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
205 205 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
206 206 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
207 207 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
208 208 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
209 209 <value type="int">0</value>
210 210 <value type="int">1</value>
211 211 <value type="int">2</value>
212 212 <value type="int">3</value>
213 213 <value type="int">4</value>
214 214 <value type="int">5</value>
215 215 <value type="int">6</value>
216 216 <value type="int">7</value>
217 217 <value type="int">8</value>
218 218 <value type="int">9</value>
219 219 <value type="int">10</value>
220 220 <value type="int">11</value>
221 221 <value type="int">12</value>
222 222 <value type="int">13</value>
223 223 <value type="int">14</value>
224 224 </valuelist>
225 225 <value type="int" key="PE.EnvironmentAspect.Base">2</value>
226 226 <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
227 227 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value>
228 228 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
229 229 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value>
230 230 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
231 231 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value>
232 232 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
233 233 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>
234 234 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
235 235 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
236 236 <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
237 237 <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
238 238 <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
239 239 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
240 240 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">false</value>
241 241 </valuemap>
242 242 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.1">
243 243 <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
244 244 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
245 245 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
246 246 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
247 247 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
248 248 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
249 249 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
250 250 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
251 251 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
252 252 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
253 253 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
254 254 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
255 255 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
256 256 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
257 257 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
258 258 <value type="int">0</value>
259 259 <value type="int">1</value>
260 260 <value type="int">2</value>
261 261 <value type="int">3</value>
262 262 <value type="int">4</value>
263 263 <value type="int">5</value>
264 264 <value type="int">6</value>
265 265 <value type="int">7</value>
266 266 <value type="int">8</value>
267 267 <value type="int">9</value>
268 268 <value type="int">10</value>
269 269 <value type="int">11</value>
270 270 <value type="int">12</value>
271 271 <value type="int">13</value>
272 272 <value type="int">14</value>
273 273 </valuelist>
274 274 <value type="int" key="PE.EnvironmentAspect.Base">2</value>
275 275 <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
276 276 <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value>
277 277 <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">doxygen</value>
278 278 <value type="bool" key="ProjectExplorer.CustomExecutableRunConfiguration.UseTerminal">true</value>
279 279 <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">/opt/DEV_PLE/doc</value>
280 280 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Run doxygen</value>
281 281 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
282 282 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
283 283 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
284 284 <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
285 285 <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
286 286 <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
287 287 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
288 288 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
289 289 </valuemap>
290 290 <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">2</value>
291 291 </valuemap>
292 292 </data>
293 293 <data>
294 294 <variable>ProjectExplorer.Project.TargetCount</variable>
295 295 <value type="int">1</value>
296 296 </data>
297 297 <data>
298 298 <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
299 299 <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value>
300 300 </data>
301 301 <data>
302 302 <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
303 303 <value type="int">14</value>
304 304 </data>
305 305 </qtcreator>
@@ -1,87 +1,86
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
11 11 #define pi 3.1415
12 12
13 13 extern int fdSPW;
14 14 extern volatile int wf_snap_f0[ ];
15 15 //
16 16 extern volatile int wf_snap_f1[ ];
17 17 extern volatile int wf_snap_f1_bis[ ];
18 18 extern volatile int wf_snap_f1_norm[ ];
19 19 //
20 20 extern volatile int wf_snap_f2[ ];
21 21 extern volatile int wf_snap_f2_bis[ ];
22 22 extern volatile int wf_snap_f2_norm[ ];
23 23 //
24 24 extern volatile int wf_cont_f3[ ];
25 25 extern volatile int wf_cont_f3_bis[ ];
26 26 extern char wf_cont_f3_light[ ];
27 27 extern new_waveform_picker_regs_t *new_waveform_picker_regs;
28 28 extern time_management_regs_t *time_management_regs;
29 29 extern Packet_TM_LFR_HK_t housekeeping_packet;
30 30 extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
31 31 extern struct param_local_str param_local;
32 32
33 33 extern unsigned short sequenceCounters_SCIENCE_NORMAL_BURST;
34 34 extern unsigned short sequenceCounters_SCIENCE_SBM1_SBM2;
35 35 extern unsigned short sequenceCounters_TC_EXE[];
36 36
37 37 extern rtems_name misc_name[5];
38 38 extern rtems_name Task_name[20]; /* array of task ids */
39 39 extern rtems_id Task_id[20]; /* array of task ids */
40 40
41 41 extern unsigned char lfrCurrentMode;
42 42
43 43 rtems_isr waveforms_isr( rtems_vector_number vector );
44 44 rtems_isr waveforms_simulator_isr( rtems_vector_number vector );
45 45 rtems_task wfrm_task( rtems_task_argument argument );
46 46 rtems_task cwf3_task( rtems_task_argument argument );
47 47 rtems_task cwf2_task( rtems_task_argument argument );
48 48 rtems_task cwf1_task( rtems_task_argument argument );
49 49
50 50 //******************
51 51 // general functions
52 52 void init_waveforms( void );
53 53 //
54 54 int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF );
55 55 int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF );
56 56 int init_header_continuous_wf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF );
57 57 //
58 58 void reset_waveforms( void );
59 59 //
60 60 int send_waveform_SWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id );
61 61 int send_waveform_CWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
62 62 int send_waveform_CWF3( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
63 63 int send_waveform_CWF3_light( volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
64 64 //
65 65 rtems_id get_pkts_queue_id( void );
66 66
67 67 //**************
68 68 // wfp registers
69 69 void set_wfp_data_shaping();
70 70 char set_wfp_delta_snapshot();
71 71 void set_wfp_burst_enable_register( unsigned char mode);
72 72 void reset_wfp_run_burst_enable();
73 73 void reset_wfp_status();
74 74 void reset_new_waveform_picker_regs();
75 unsigned int address_alignment( volatile int *address);
76 75
77 76 //*****************
78 77 // local parameters
79 78 void set_local_sbm1_nb_cwf_max();
80 79 void set_local_sbm2_nb_cwf_max();
81 80 void set_local_nb_interrupt_f0_MAX();
82 81 void reset_local_sbm1_nb_cwf_sent();
83 82 void reset_local_sbm2_nb_cwf_sent();
84 83
85 84 void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid );
86 85
87 86 #endif // WF_HANDLER_H_INCLUDED
@@ -1,91 +1,91
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 // APB CONFIGURATION REGISTERS
35 35 time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT;
36 36 gptimer_regs_t *gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER;
37 37 #ifdef GSA
38 38 #else
39 39 new_waveform_picker_regs_t *new_waveform_picker_regs = (new_waveform_picker_regs_t*) REGS_ADDR_WAVEFORM_PICKER;
40 40 #endif
41 41 spectral_matrix_regs_t *spectral_matrix_regs = (spectral_matrix_regs_t*) REGS_ADDR_SPECTRAL_MATRIX;
42 42
43 43 // WAVEFORMS GLOBAL VARIABLES // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes
44 volatile int wf_snap_f0[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET + ALIGNEMENT_OFFSET ];
44 volatile int wf_snap_f0[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ] __attribute__((aligned(0x100)));
45 45 //
46 volatile int wf_snap_f1[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET + ALIGNEMENT_OFFSET ];
47 volatile int wf_snap_f1_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET + ALIGNEMENT_OFFSET ];
48 volatile int wf_snap_f1_norm[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET + ALIGNEMENT_OFFSET ];
46 volatile int wf_snap_f1[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ] __attribute__((aligned(0x100)));
47 volatile int wf_snap_f1_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ] __attribute__((aligned(0x100)));
48 volatile int wf_snap_f1_norm[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ] __attribute__((aligned(0x100)));
49 49 //
50 volatile int wf_snap_f2[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET + ALIGNEMENT_OFFSET ];
51 volatile int wf_snap_f2_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET + ALIGNEMENT_OFFSET ];
52 volatile int wf_snap_f2_norm[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET + ALIGNEMENT_OFFSET ];
50 volatile int wf_snap_f2[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ] __attribute__((aligned(0x100)));
51 volatile int wf_snap_f2_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ] __attribute__((aligned(0x100)));
52 volatile int wf_snap_f2_norm[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ] __attribute__((aligned(0x100)));
53 53 //
54 volatile int wf_cont_f3[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET + ALIGNEMENT_OFFSET ];
55 volatile int wf_cont_f3_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET + ALIGNEMENT_OFFSET ];
56 char wf_cont_f3_light[ NB_SAMPLES_PER_SNAPSHOT * NB_BYTES_CWF3_LIGHT_BLK + ALIGNEMENT_OFFSET ];
54 volatile int wf_cont_f3[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ] __attribute__((aligned(0x100)));
55 volatile int wf_cont_f3_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ] __attribute__((aligned(0x100)));
56 char wf_cont_f3_light[ NB_SAMPLES_PER_SNAPSHOT * NB_BYTES_CWF3_LIGHT_BLK ] __attribute__((aligned(0x100)));
57 57
58 58 // SPECTRAL MATRICES GLOBAL VARIABLES
59 59 volatile int spec_mat_f0_0[ SM_HEADER + TOTAL_SIZE_SM ];
60 60 volatile int spec_mat_f0_1[ SM_HEADER + TOTAL_SIZE_SM ];
61 61 volatile int spec_mat_f0_a[ SM_HEADER + TOTAL_SIZE_SM ];
62 62 volatile int spec_mat_f0_b[ SM_HEADER + TOTAL_SIZE_SM ];
63 63 volatile int spec_mat_f0_c[ SM_HEADER + TOTAL_SIZE_SM ];
64 64 volatile int spec_mat_f0_d[ SM_HEADER + TOTAL_SIZE_SM ];
65 65 volatile int spec_mat_f0_e[ SM_HEADER + TOTAL_SIZE_SM ];
66 66 volatile int spec_mat_f0_f[ SM_HEADER + TOTAL_SIZE_SM ];
67 67 volatile int spec_mat_f0_g[ SM_HEADER + TOTAL_SIZE_SM ];
68 68 volatile int spec_mat_f0_h[ SM_HEADER + TOTAL_SIZE_SM ];
69 69 volatile int spec_mat_f0_0_bis[ SM_HEADER + TOTAL_SIZE_SM ];
70 70 volatile int spec_mat_f0_1_bis[ SM_HEADER + TOTAL_SIZE_SM ];
71 71 //
72 72 volatile int spec_mat_f1[ SM_HEADER + TOTAL_SIZE_SM ];
73 73 volatile int spec_mat_f1_bis[ SM_HEADER + TOTAL_SIZE_SM ];
74 74 //
75 75 volatile int spec_mat_f2[ SM_HEADER + TOTAL_SIZE_SM ];
76 76 volatile int spec_mat_f2_bis[ SM_HEADER + TOTAL_SIZE_SM ];
77 77
78 78 // MODE PARAMETERS
79 79 Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
80 80 struct param_local_str param_local;
81 81
82 82 // HK PACKETS
83 83 Packet_TM_LFR_HK_t housekeeping_packet;
84 84 // sequence counters are incremented by APID (PID + CAT) and destination ID
85 85 unsigned short sequenceCounters_SCIENCE_NORMAL_BURST;
86 86 unsigned short sequenceCounters_SCIENCE_SBM1_SBM2;
87 87 unsigned short sequenceCounters_TC_EXE[SEQ_CNT_NB_DEST_ID];
88 88 spw_stats spacewire_stats;
89 89 spw_stats spacewire_stats_backup;
90 90
91 91
@@ -1,772 +1,776
1 1 /** Functions and tasks related to TeleCommand handling.
2 2 *
3 3 * @file
4 4 * @author P. LEROY
5 5 *
6 6 * A group of functions to handle TeleCommands:\n
7 7 * action launching\n
8 8 * TC parsing\n
9 9 * ...
10 10 *
11 11 */
12 12
13 13 #include "tc_handler.h"
14 14
15 15 //***********
16 16 // RTEMS TASK
17 17
18 18 rtems_task actn_task( rtems_task_argument unused )
19 19 {
20 20 /** This RTEMS task is responsible for launching actions upton the reception of valid TeleCommands.
21 21 *
22 22 * @param unused is the starting argument of the RTEMS task
23 23 *
24 24 * The ACTN task waits for data coming from an RTEMS msesage queue. When data arrives, it launches specific actions depending
25 25 * on the incoming TeleCommand.
26 26 *
27 27 */
28 28
29 29 int result;
30 30 rtems_status_code status; // RTEMS status code
31 31 ccsdsTelecommandPacket_t TC; // TC sent to the ACTN task
32 32 size_t size; // size of the incoming TC packet
33 33 unsigned char subtype; // subtype of the current TC packet
34 34 rtems_id queue_rcv_id;
35 35 rtems_id queue_snd_id;
36 36
37 37 status = rtems_message_queue_ident( misc_name[QUEUE_RECV], 0, &queue_rcv_id );
38 38 if (status != RTEMS_SUCCESSFUL)
39 39 {
40 40 PRINTF1("in ACTN *** ERR getting queue_rcv_id %d\n", status)
41 41 }
42 42
43 43 status = rtems_message_queue_ident( misc_name[QUEUE_SEND], 0, &queue_snd_id );
44 44 if (status != RTEMS_SUCCESSFUL)
45 45 {
46 46 PRINTF1("in ACTN *** ERR getting queue_snd_id %d\n", status)
47 47 }
48 48
49 49 result = LFR_SUCCESSFUL;
50 50 subtype = 0; // subtype of the current TC packet
51 51
52 52 BOOT_PRINTF("in ACTN *** \n")
53 53
54 54 while(1)
55 55 {
56 56 status = rtems_message_queue_receive( queue_rcv_id, (char*) &TC, &size,
57 57 RTEMS_WAIT, RTEMS_NO_TIMEOUT);
58 58 if (status!=RTEMS_SUCCESSFUL) PRINTF1("ERR *** in task ACTN *** error receiving a message, code %d \n", status)
59 59 else
60 60 {
61 61 subtype = TC.serviceSubType;
62 62 switch(subtype)
63 63 {
64 64 case TC_SUBTYPE_RESET:
65 65 result = action_reset( &TC, queue_snd_id );
66 66 close_action( &TC, result, queue_snd_id );
67 67 break;
68 68 //
69 69 case TC_SUBTYPE_LOAD_COMM:
70 70 result = action_load_common_par( &TC );
71 71 close_action( &TC, result, queue_snd_id );
72 72 break;
73 73 //
74 74 case TC_SUBTYPE_LOAD_NORM:
75 75 result = action_load_normal_par( &TC, queue_snd_id );
76 76 close_action( &TC, result, queue_snd_id );
77 77 break;
78 78 //
79 79 case TC_SUBTYPE_LOAD_BURST:
80 80 result = action_load_burst_par( &TC, queue_snd_id );
81 81 close_action( &TC, result, queue_snd_id );
82 82 break;
83 83 //
84 84 case TC_SUBTYPE_LOAD_SBM1:
85 85 result = action_load_sbm1_par( &TC, queue_snd_id );
86 86 close_action( &TC, result, queue_snd_id );
87 87 break;
88 88 //
89 89 case TC_SUBTYPE_LOAD_SBM2:
90 90 result = action_load_sbm2_par( &TC, queue_snd_id );
91 91 close_action( &TC, result, queue_snd_id );
92 92 break;
93 93 //
94 94 case TC_SUBTYPE_DUMP:
95 95 result = action_dump_par( queue_snd_id );
96 96 close_action( &TC, result, queue_snd_id );
97 97 break;
98 98 //
99 99 case TC_SUBTYPE_ENTER:
100 100 result = action_enter_mode( &TC, queue_snd_id );
101 101 close_action( &TC, result, queue_snd_id );
102 102 break;
103 103 //
104 104 case TC_SUBTYPE_UPDT_INFO:
105 105 result = action_update_info( &TC, queue_snd_id );
106 106 close_action( &TC, result, queue_snd_id );
107 107 break;
108 108 //
109 109 case TC_SUBTYPE_EN_CAL:
110 110 result = action_enable_calibration( &TC, queue_snd_id );
111 111 close_action( &TC, result, queue_snd_id );
112 112 break;
113 113 //
114 114 case TC_SUBTYPE_DIS_CAL:
115 115 result = action_disable_calibration( &TC, queue_snd_id );
116 116 close_action( &TC, result, queue_snd_id );
117 117 break;
118 118 //
119 119 case TC_SUBTYPE_UPDT_TIME:
120 120 result = action_update_time( &TC );
121 121 close_action( &TC, result, queue_snd_id );
122 122 break;
123 123 //
124 124 default:
125 125 break;
126 126 }
127 127 }
128 128 }
129 129 }
130 130
131 131 //***********
132 132 // TC ACTIONS
133 133
134 134 int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
135 135 {
136 136 /** This function executes specific actions when a TC_LFR_RESET TeleCommand has been received.
137 137 *
138 138 * @param TC points to the TeleCommand packet that is being processed
139 139 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
140 140 *
141 141 */
142 142
143 143 send_tm_lfr_tc_exe_not_implemented( TC, queue_id );
144 144 return LFR_DEFAULT;
145 145 }
146 146
147 147 int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
148 148 {
149 149 /** This function executes specific actions when a TC_LFR_ENTER_MODE TeleCommand has been received.
150 150 *
151 151 * @param TC points to the TeleCommand packet that is being processed
152 152 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
153 153 *
154 154 */
155 155
156 156 rtems_status_code status;
157 157 unsigned char requestedMode;
158 158
159 159 requestedMode = TC->dataAndCRC[1];
160 160
161 161 if ( (requestedMode != LFR_MODE_STANDBY)
162 162 && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST)
163 163 && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) )
164 164 {
165 165 status = RTEMS_UNSATISFIED;
166 166 send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_LFR_MODE, requestedMode );
167 167 }
168 168 else
169 169 {
170 170 printf("try to enter mode %d\n", requestedMode);
171 171
172 172 #ifdef PRINT_TASK_STATISTICS
173 173 if (requestedMode != LFR_MODE_STANDBY)
174 174 {
175 175 rtems_cpu_usage_reset();
176 176 maxCount = 0;
177 177 }
178 178 #endif
179 179
180 180 status = transition_validation(requestedMode);
181 181
182 182 if ( status == LFR_SUCCESSFUL ) {
183 183 if ( lfrCurrentMode != LFR_MODE_STANDBY)
184 184 {
185 185 status = stop_current_mode();
186 186 }
187 187 if (status != RTEMS_SUCCESSFUL)
188 188 {
189 189 PRINTF("ERR *** in action_enter *** stop_current_mode\n")
190 190 }
191 191 status = enter_mode(requestedMode, TC);
192 192 }
193 193 else
194 194 {
195 195 PRINTF("ERR *** in action_enter *** transition rejected\n")
196 196 send_tm_lfr_tc_exe_not_executable( TC, queue_id );
197 197 }
198 198 }
199 199
200 200 return status;
201 201 }
202 202
203 203 int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
204 204 {
205 205 /** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received.
206 206 *
207 207 * @param TC points to the TeleCommand packet that is being processed
208 208 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
209 209 *
210 210 * @return LFR directive status code:
211 211 * - LFR_DEFAULT
212 212 * - LFR_SUCCESSFUL
213 213 *
214 214 */
215 215
216 216 unsigned int val;
217 217 int result;
218 218
219 219 result = LFR_DEFAULT;
220 220
221 221 val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256
222 222 + housekeeping_packet.hk_lfr_update_info_tc_cnt[1];
223 223 val++;
224 224 housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8);
225 225 housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val);
226 226
227 227 return result;
228 228 }
229 229
230 230 int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
231 231 {
232 232 /** This function executes specific actions when a TC_LFR_ENABLE_CALIBRATION TeleCommand has been received.
233 233 *
234 234 * @param TC points to the TeleCommand packet that is being processed
235 235 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
236 236 *
237 237 */
238 238
239 239 int result;
240 240 unsigned char lfrMode;
241 241
242 242 result = LFR_DEFAULT;
243 243 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
244 244
245 245 if ( (lfrMode == LFR_MODE_STANDBY) || (lfrMode == LFR_MODE_BURST) || (lfrMode == LFR_MODE_SBM2) ) {
246 246 send_tm_lfr_tc_exe_not_executable( TC, queue_id );
247 247 result = LFR_DEFAULT;
248 248 }
249 249 else {
250 250 send_tm_lfr_tc_exe_not_implemented( TC, queue_id );
251 251 result = LFR_DEFAULT;
252 252 }
253 253 return result;
254 254 }
255 255
256 256 int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
257 257 {
258 258 /** This function executes specific actions when a TC_LFR_DISABLE_CALIBRATION TeleCommand has been received.
259 259 *
260 260 * @param TC points to the TeleCommand packet that is being processed
261 261 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
262 262 *
263 263 */
264 264
265 265 int result;
266 266 unsigned char lfrMode;
267 267
268 268 result = LFR_DEFAULT;
269 269 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
270 270
271 271 if ( (lfrMode == LFR_MODE_STANDBY) || (lfrMode == LFR_MODE_BURST) || (lfrMode == LFR_MODE_SBM2) ) {
272 272 send_tm_lfr_tc_exe_not_executable( TC, queue_id );
273 273 result = LFR_DEFAULT;
274 274 }
275 275 else {
276 276 send_tm_lfr_tc_exe_not_implemented( TC, queue_id );
277 277 result = LFR_DEFAULT;
278 278 }
279 279 return result;
280 280 }
281 281
282 282 int action_update_time(ccsdsTelecommandPacket_t *TC)
283 283 {
284 284 /** This function executes specific actions when a TC_LFR_UPDATE_TIME TeleCommand has been received.
285 285 *
286 286 * @param TC points to the TeleCommand packet that is being processed
287 287 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
288 288 *
289 289 * @return LFR_SUCCESSFUL
290 290 *
291 291 */
292 292
293 293 unsigned int val;
294 294
295 295 time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24)
296 296 + (TC->dataAndCRC[1] << 16)
297 297 + (TC->dataAndCRC[2] << 8)
298 298 + TC->dataAndCRC[3];
299 299 val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256
300 300 + housekeeping_packet.hk_lfr_update_time_tc_cnt[1];
301 301 val++;
302 302 housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8);
303 303 housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val);
304 304 time_management_regs->ctrl = time_management_regs->ctrl | 1;
305 305
306 306 return LFR_SUCCESSFUL;
307 307 }
308 308
309 309 //*******************
310 310 // ENTERING THE MODES
311 311
312 312 int transition_validation(unsigned char requestedMode)
313 313 {
314 314 int status;
315 315
316 316 switch (requestedMode)
317 317 {
318 318 case LFR_MODE_STANDBY:
319 319 if ( lfrCurrentMode == LFR_MODE_STANDBY ) {
320 320 status = LFR_DEFAULT;
321 321 }
322 322 else
323 323 {
324 324 status = LFR_SUCCESSFUL;
325 325 }
326 326 break;
327 327 case LFR_MODE_NORMAL:
328 328 if ( lfrCurrentMode == LFR_MODE_NORMAL ) {
329 329 status = LFR_DEFAULT;
330 330 }
331 331 else {
332 332 status = LFR_SUCCESSFUL;
333 333 }
334 334 break;
335 335 case LFR_MODE_BURST:
336 336 if ( lfrCurrentMode == LFR_MODE_BURST ) {
337 337 status = LFR_DEFAULT;
338 338 }
339 339 else {
340 340 status = LFR_SUCCESSFUL;
341 341 }
342 342 break;
343 343 case LFR_MODE_SBM1:
344 344 if ( lfrCurrentMode == LFR_MODE_SBM1 ) {
345 345 status = LFR_DEFAULT;
346 346 }
347 347 else {
348 348 status = LFR_SUCCESSFUL;
349 349 }
350 350 break;
351 351 case LFR_MODE_SBM2:
352 352 if ( lfrCurrentMode == LFR_MODE_SBM2 ) {
353 353 status = LFR_DEFAULT;
354 354 }
355 355 else {
356 356 status = LFR_SUCCESSFUL;
357 357 }
358 358 break;
359 359 default:
360 360 status = LFR_DEFAULT;
361 361 break;
362 362 }
363 363
364 364 return status;
365 365 }
366 366
367 367 int stop_current_mode()
368 368 {
369 369 /** This function stops the current mode by masking interrupt lines and suspending science tasks.
370 370 *
371 371 * @return RTEMS directive status codes:
372 372 * - RTEMS_SUCCESSFUL - task restarted successfully
373 373 * - RTEMS_INVALID_ID - task id invalid
374 374 * - RTEMS_ALREADY_SUSPENDED - task already suspended
375 375 *
376 376 */
377 377
378 378 rtems_status_code status;
379 379
380 380 status = RTEMS_SUCCESSFUL;
381 381
382 382 #ifdef GSA
383 383 LEON_Mask_interrupt( IRQ_WF ); // mask waveform interrupt (coming from the timer VHDL IP)
384 384 LEON_Clear_interrupt( IRQ_WF ); // clear waveform interrupt (coming from the timer VHDL IP)
385 385 timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR );
386 386 #else
387 387 // mask interruptions
388 388 LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt
389 389 LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // mask spectral matrix interrupt
390 390 // reset registers
391 391 reset_wfp_run_burst_enable(); // reset run, burst and enable bits, [r b2 b1 b0 e3 e2 e1 e0]
392 392 reset_wfp_status(); // reset all the status bits
393 393 // creal interruptions
394 394 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt
395 395 LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectarl matrix interrupt
396 396 #endif
397 397 //**********************
398 398 // suspend several tasks
399 399 if (lfrCurrentMode != LFR_MODE_STANDBY) {
400 400 status = suspend_science_tasks();
401 401 }
402 402
403 403 if (status != RTEMS_SUCCESSFUL)
404 404 {
405 405 PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status)
406 406 }
407 407
408 408 return status;
409 409 }
410 410
411 411 int enter_mode(unsigned char mode, ccsdsTelecommandPacket_t *TC )
412 412 {
413 413 rtems_status_code status;
414 414
415 415 status = RTEMS_UNSATISFIED;
416 416
417 417 housekeeping_packet.lfr_status_word[0] = (unsigned char) ((mode << 4) + 0x0d);
418 418 updateLFRCurrentMode();
419 419
420 420 switch(mode){
421 421 case LFR_MODE_STANDBY:
422 422 status = enter_standby_mode( );
423 423 break;
424 424 case LFR_MODE_NORMAL:
425 425 status = enter_normal_mode( );
426 426 break;
427 427 case LFR_MODE_BURST:
428 428 status = enter_burst_mode( );
429 429 break;
430 430 case LFR_MODE_SBM1:
431 431 status = enter_sbm1_mode( );
432 432 break;
433 433 case LFR_MODE_SBM2:
434 434 status = enter_sbm2_mode( );
435 435 break;
436 436 default:
437 437 status = RTEMS_UNSATISFIED;
438 438 }
439 439
440 440 if (status != RTEMS_SUCCESSFUL)
441 441 {
442 442 PRINTF("in enter_mode *** ERR\n")
443 443 status = RTEMS_UNSATISFIED;
444 444 }
445 445
446 446 return status;
447 447 }
448 448
449 449 int enter_standby_mode()
450 450 {
451 451 PRINTF1("maxCount = %d\n", maxCount)
452 452
453 453 #ifdef PRINT_TASK_STATISTICS
454 454 rtems_cpu_usage_report();
455 455 #endif
456 456
457 457 #ifdef PRINT_STACK_REPORT
458 458 rtems_stack_checker_report_usage();
459 459 #endif
460 460
461 461 return LFR_SUCCESSFUL;
462 462 }
463 463
464 464 int enter_normal_mode()
465 465 {
466 466 rtems_status_code status;
467 467 int startDate;
468 468
469 469 status = restart_science_tasks();
470 470
471 471 #ifdef GSA
472 472 timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR );
473 473 timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR );
474 474 LEON_Clear_interrupt( IRQ_WF );
475 475 LEON_Unmask_interrupt( IRQ_WF );
476 476 //
477 477 set_local_nb_interrupt_f0_MAX();
478 478 LEON_Clear_interrupt( IRQ_SM ); // the IRQ_SM seems to be incompatible with the IRQ_WF on the xilinx board
479 479 LEON_Unmask_interrupt( IRQ_SM );
480 480 #else
481 481 //****************
482 482 // waveform picker
483 483 reset_new_waveform_picker_regs();
484 484 set_wfp_burst_enable_register( LFR_MODE_NORMAL );
485 485 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
486 486 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
487 487 startDate = time_management_regs->coarse_time + 2;
488 488 new_waveform_picker_regs->run_burst_enable = new_waveform_picker_regs->run_burst_enable | 0x80; // [1000 0000]
489 489 new_waveform_picker_regs->start_date = startDate;
490 490 //****************
491 491 // spectral matrix
492 492 #endif
493 493
494 494 return status;
495 495 }
496 496
497 497 int enter_burst_mode()
498 498 {
499 499 rtems_status_code status;
500 500
501 501 status = restart_science_tasks();
502 502
503 503 #ifdef GSA
504 504 LEON_Unmask_interrupt( IRQ_SM );
505 505 #else
506 506 reset_new_waveform_picker_regs();
507 507 set_wfp_burst_enable_register(LFR_MODE_BURST);
508 508 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
509 509 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
510 510 #endif
511 511
512 512 return status;
513 513 }
514 514
515 515 int enter_sbm1_mode()
516 516 {
517 517 rtems_status_code status;
518 int startDate;
518 519
519 520 status = restart_science_tasks();
520 521
521 522 set_local_sbm1_nb_cwf_max();
522 523
523 524 reset_local_sbm1_nb_cwf_sent();
524 525
525 526 #ifdef GSA
526 527 LEON_Unmask_interrupt( IRQ_SM );
527 528 #else
529 //****************
530 // waveform picker
528 531 reset_new_waveform_picker_regs();
529 532 set_wfp_burst_enable_register(LFR_MODE_SBM1);
530 533 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
531 534 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
532 // SM simulation
533 // timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR );
534 // LEON_Clear_interrupt( IRQ_SM ); // the IRQ_SM seems to be incompatible with the IRQ_WF on the xilinx board
535 // LEON_Unmask_interrupt( IRQ_SM );
535 startDate = time_management_regs->coarse_time + 2;
536 new_waveform_picker_regs->run_burst_enable = new_waveform_picker_regs->run_burst_enable | 0x80; // [1000 0000]
537 new_waveform_picker_regs->start_date = startDate;
538 //****************
539 // spectral matrix
536 540 #endif
537 541
538 542 return status;
539 543 }
540 544
541 545 int enter_sbm2_mode()
542 546 {
543 547 rtems_status_code status;
544 548
545 549 status = restart_science_tasks();
546 550
547 551 set_local_sbm2_nb_cwf_max();
548 552
549 553 reset_local_sbm2_nb_cwf_sent();
550 554
551 555 #ifdef GSA
552 556 LEON_Unmask_interrupt( IRQ_SM );
553 557 #else
554 558 reset_new_waveform_picker_regs();
555 559 set_wfp_burst_enable_register(LFR_MODE_SBM2);
556 560 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
557 561 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
558 562 #endif
559 563
560 564 return status;
561 565 }
562 566
563 567 int restart_science_tasks()
564 568 {
565 569 rtems_status_code status[6];
566 570 rtems_status_code ret;
567 571
568 572 ret = RTEMS_SUCCESSFUL;
569 573
570 574 status[0] = rtems_task_restart( Task_id[TASKID_AVF0], 1 );
571 575 if (status[0] != RTEMS_SUCCESSFUL)
572 576 {
573 577 PRINTF1("in restart_science_task *** 0 ERR %d\n", status[0])
574 578 }
575 579
576 580 status[1] = rtems_task_restart( Task_id[TASKID_BPF0],1 );
577 581 if (status[1] != RTEMS_SUCCESSFUL)
578 582 {
579 583 PRINTF1("in restart_science_task *** 1 ERR %d\n", status[1])
580 584 }
581 585
582 586 status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 );
583 587 if (status[2] != RTEMS_SUCCESSFUL)
584 588 {
585 589 PRINTF1("in restart_science_task *** 2 ERR %d\n", status[2])
586 590 }
587 591
588 592 status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 );
589 593 if (status[3] != RTEMS_SUCCESSFUL)
590 594 {
591 595 PRINTF1("in restart_science_task *** 3 ERR %d\n", status[3])
592 596 }
593 597
594 598 status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 );
595 599 if (status[4] != RTEMS_SUCCESSFUL)
596 600 {
597 601 PRINTF1("in restart_science_task *** 4 ERR %d\n", status[4])
598 602 }
599 603
600 604 status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 );
601 605 if (status[5] != RTEMS_SUCCESSFUL)
602 606 {
603 607 PRINTF1("in restart_science_task *** 5 ERR %d\n", status[5])
604 608 }
605 609
606 610 if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) ||
607 611 (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) )
608 612 {
609 613 ret = RTEMS_UNSATISFIED;
610 614 }
611 615
612 616 return ret;
613 617 }
614 618
615 619 int suspend_science_tasks()
616 620 {
617 621 /** This function suspends the science tasks.
618 622 *
619 623 * @return RTEMS directive status codes:
620 624 * - RTEMS_SUCCESSFUL - task restarted successfully
621 625 * - RTEMS_INVALID_ID - task id invalid
622 626 * - RTEMS_ALREADY_SUSPENDED - task already suspended
623 627 *
624 628 */
625 629
626 630 rtems_status_code status;
627 631
628 632 status = rtems_task_suspend( Task_id[TASKID_AVF0] );
629 633 if (status != RTEMS_SUCCESSFUL)
630 634 {
631 635 PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status)
632 636 }
633 637
634 638 if (status == RTEMS_SUCCESSFUL) // suspend BPF0
635 639 {
636 640 status = rtems_task_suspend( Task_id[TASKID_BPF0] );
637 641 if (status != RTEMS_SUCCESSFUL)
638 642 {
639 643 PRINTF1("in suspend_science_task *** BPF0 ERR %d\n", status)
640 644 }
641 645 }
642 646
643 647 if (status == RTEMS_SUCCESSFUL) // suspend WFRM
644 648 {
645 649 status = rtems_task_suspend( Task_id[TASKID_WFRM] );
646 650 if (status != RTEMS_SUCCESSFUL)
647 651 {
648 652 PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status)
649 653 }
650 654 }
651 655
652 656 if (status == RTEMS_SUCCESSFUL) // suspend CWF3
653 657 {
654 658 status = rtems_task_suspend( Task_id[TASKID_CWF3] );
655 659 if (status != RTEMS_SUCCESSFUL)
656 660 {
657 661 PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status)
658 662 }
659 663 }
660 664
661 665 if (status == RTEMS_SUCCESSFUL) // suspend CWF2
662 666 {
663 667 status = rtems_task_suspend( Task_id[TASKID_CWF2] );
664 668 if (status != RTEMS_SUCCESSFUL)
665 669 {
666 670 PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status)
667 671 }
668 672 }
669 673
670 674 if (status == RTEMS_SUCCESSFUL) // suspend CWF1
671 675 {
672 676 status = rtems_task_suspend( Task_id[TASKID_CWF1] );
673 677 if (status != RTEMS_SUCCESSFUL)
674 678 {
675 679 PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status)
676 680 }
677 681 }
678 682
679 683 return status;
680 684 }
681 685
682 686 //****************
683 687 // CLOSING ACTIONS
684 688 void update_last_TC_exe(ccsdsTelecommandPacket_t *TC)
685 689 {
686 690 housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0];
687 691 housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1];
688 692 housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00;
689 693 housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType;
690 694 housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00;
691 695 housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType;
692 696 housekeeping_packet.hk_lfr_last_exe_tc_time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
693 697 housekeeping_packet.hk_lfr_last_exe_tc_time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
694 698 housekeeping_packet.hk_lfr_last_exe_tc_time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
695 699 housekeeping_packet.hk_lfr_last_exe_tc_time[3] = (unsigned char) (time_management_regs->coarse_time);
696 700 housekeeping_packet.hk_lfr_last_exe_tc_time[4] = (unsigned char) (time_management_regs->fine_time>>8);
697 701 housekeeping_packet.hk_lfr_last_exe_tc_time[5] = (unsigned char) (time_management_regs->fine_time);
698 702 }
699 703
700 704 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC)
701 705 {
702 706 housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0];
703 707 housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1];
704 708 housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00;
705 709 housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType;
706 710 housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00;
707 711 housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType;
708 712 housekeeping_packet.hk_lfr_last_rej_tc_time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
709 713 housekeeping_packet.hk_lfr_last_rej_tc_time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
710 714 housekeeping_packet.hk_lfr_last_rej_tc_time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
711 715 housekeeping_packet.hk_lfr_last_rej_tc_time[3] = (unsigned char) (time_management_regs->coarse_time);
712 716 housekeeping_packet.hk_lfr_last_rej_tc_time[4] = (unsigned char) (time_management_regs->fine_time>>8);
713 717 housekeeping_packet.hk_lfr_last_rej_tc_time[5] = (unsigned char) (time_management_regs->fine_time);
714 718 }
715 719
716 720 void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id)
717 721 {
718 722 unsigned int val = 0;
719 723 if (result == LFR_SUCCESSFUL)
720 724 {
721 725 if ( !( (TC->serviceType==TC_TYPE_TIME) && (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) )
722 726 &&
723 727 !( (TC->serviceType==TC_TYPE_GEN) && (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO))
724 728 )
725 729 {
726 730 send_tm_lfr_tc_exe_success( TC, queue_id );
727 731 }
728 732 update_last_TC_exe( TC );
729 733 val = housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[0] * 256 + housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[1];
730 734 val++;
731 735 housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[0] = (unsigned char) (val >> 8);
732 736 housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[1] = (unsigned char) (val);
733 737 }
734 738 else
735 739 {
736 740 update_last_TC_rej( TC );
737 741 val = housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[0] * 256 + housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[1];
738 742 val++;
739 743 housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[0] = (unsigned char) (val >> 8);
740 744 housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[1] = (unsigned char) (val);
741 745 }
742 746 }
743 747
744 748 //***************************
745 749 // Interrupt Service Routines
746 750 rtems_isr commutation_isr1( rtems_vector_number vector )
747 751 {
748 752 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
749 753 printf("In commutation_isr1 *** Error sending event to DUMB\n");
750 754 }
751 755 }
752 756
753 757 rtems_isr commutation_isr2( rtems_vector_number vector )
754 758 {
755 759 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
756 760 printf("In commutation_isr2 *** Error sending event to DUMB\n");
757 761 }
758 762 }
759 763
760 764 //****************
761 765 // OTHER FUNCTIONS
762 766 void updateLFRCurrentMode()
763 767 {
764 768 /** This function updates the value of the global variable lfrCurrentMode.
765 769 *
766 770 * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running.
767 771 *
768 772 */
769 773 // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure
770 774 lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
771 775 }
772 776
@@ -1,1351 +1,1242
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 // SWF
13 13 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F0[7];
14 14 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F1[7];
15 15 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F2[7];
16 16 // CWF
17 17 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F1[7];
18 18 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_BURST[7];
19 19 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_SBM2[7];
20 20 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3[7];
21 21 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3_light[7];
22 22
23 23 unsigned char doubleSendCWF1 = 0;
24 24 unsigned char doubleSendCWF2 = 0;
25 25 unsigned char fullRecord;
26 26
27 27 rtems_isr waveforms_isr( rtems_vector_number vector )
28 28 {
29 29 unsigned int statusReg;
30 30
31 31 /** This is the interrupt sub routine called by the waveform picker core.
32 32 *
33 33 * This ISR launch different actions depending mainly on two pieces of information:
34 34 * 1. the values read in the registers of the waveform picker.
35 35 * 2. the current LFR mode.
36 36 *
37 37 */
38 38
39 39 new_waveform_picker_regs->status = new_waveform_picker_regs->status & 0xfffff00f; // clear new_err and full_err
40 40
41 41 #ifdef GSA
42 42 #else
43 43 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
44 44 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
45 45 { // in modes other than STANDBY and BURST, send the CWF_F3 data
46 46 if ((new_waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full
47 47 // (1) change the receiving buffer for the waveform picker
48 48 if (new_waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3) {
49 49 new_waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_bis);
50 50 }
51 51 else {
52 52 new_waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3);
53 53 }
54 54 // (2) send an event for the waveforms transmission
55 55 if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
56 56 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
57 57 }
58 58 new_waveform_picker_regs->status = new_waveform_picker_regs->status & 0xfffff777; // reset f3 bits to 0, [1111 0111 0111 0111]
59 59 }
60 60 }
61 61 #endif
62 62
63 63 switch(lfrCurrentMode)
64 64 {
65 65 //********
66 66 // STANDBY
67 67 case(LFR_MODE_STANDBY):
68 68 break;
69 69
70 70 //******
71 71 // NORMAL
72 72 case(LFR_MODE_NORMAL):
73 73 #ifdef GSA
74 74 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
75 75 #else
76 76 statusReg = new_waveform_picker_regs->status;
77 77 fullRecord = fullRecord | ( statusReg & 0x7 );
78 // if ( (new_waveform_picker_regs->status & 0x7) == 0x7 ){ // f2 f1 and f0 are full
79 // if ( (new_waveform_picker_regs->status & 0x1) == 0x1 ) // f0 is full
80 if ( (new_waveform_picker_regs->status & 0x4) == 0x4 ) // f2 is full
78 if ( (new_waveform_picker_regs->status & 0x7) == 0x7 ) // f2 f1 and f0 are full
81 79 {
82 80 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
83 81 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
84 82 }
85 83 new_waveform_picker_regs->status = new_waveform_picker_regs->status & 0xfffff888;
86 new_waveform_picker_regs->status = new_waveform_picker_regs->status & 0xfffff888;
87 new_waveform_picker_regs->status = new_waveform_picker_regs->status & 0xfffff888;
88 new_waveform_picker_regs->status = new_waveform_picker_regs->status & 0xfffff888;
89 new_waveform_picker_regs->status = new_waveform_picker_regs->status & 0xfffff888;
90 // if ( (new_waveform_picker_regs->status & 0x1) == 0x1 )
91 if ( (new_waveform_picker_regs->status & 0x4) == 0x4 ) // f2 is full
92 {
93 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 );
94 }
95 // if ( (new_waveform_picker_regs->status & 0x1) == 0x0 )
96 if ( (new_waveform_picker_regs->status & 0x4) == 0x0 )
97 {
98 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_7 );
99 }
100 84 }
101 85 #endif
102 86 break;
103 87
104 88 //******
105 89 // BURST
106 90 case(LFR_MODE_BURST):
107 91 #ifdef GSA
108 92 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
109 93 #else
110 94 if ((new_waveform_picker_regs->status & 0x04) == 0x04){ // [0100] check the f2 full bit
111 95 // (1) change the receiving buffer for the waveform picker
112 96 if (new_waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) {
113 97 new_waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_bis);
114 98 }
115 99 else {
116 100 new_waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2);
117 101 }
118 102 // (2) send an event for the waveforms transmission
119 103 if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) {
120 104 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
121 105 }
122 106 new_waveform_picker_regs->status = new_waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bits = 0
123 107 }
124 108 #endif
125 109 break;
126 110
127 111 //*****
128 112 // SBM1
129 113 case(LFR_MODE_SBM1):
130 114 #ifdef GSA
131 115 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
132 116 #else
133 117 if ((new_waveform_picker_regs->status & 0x02) == 0x02){ // [0010] check the f1 full bit
134 118 // (1) change the receiving buffer for the waveform picker
135 119 if ( param_local.local_sbm1_nb_cwf_sent == (param_local.local_sbm1_nb_cwf_max-1) )
136 120 {
137 121 new_waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_norm);
138 122 }
139 123 else if ( new_waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1_norm )
140 124 {
141 125 doubleSendCWF1 = 1;
142 126 new_waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1);
143 127 }
144 128 else if ( new_waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1 ) {
145 129 new_waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_bis);
146 130 }
147 131 else {
148 132 new_waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1);
149 133 }
150 134 // (2) send an event for the waveforms transmission
151 135 if (rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 ) != RTEMS_SUCCESSFUL) {
152 136 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
153 137 }
154 138 new_waveform_picker_regs->status = new_waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bit = 0
155 139 }
156 140 if ( ( (new_waveform_picker_regs->status & 0x05) == 0x05 ) ) { // [0101] check the f2 and f0 full bit
157 141 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
158 142 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
159 143 }
160 144 new_waveform_picker_regs->status = new_waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2 and f0 bits = 0
161 145 reset_local_sbm1_nb_cwf_sent();
162 146 }
163 147
164 148 #endif
165 149 break;
166 150
167 151 //*****
168 152 // SBM2
169 153 case(LFR_MODE_SBM2):
170 154 #ifdef GSA
171 155 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
172 156 #else
173 157 if ((new_waveform_picker_regs->status & 0x04) == 0x04){ // [0100] check the f2 full bit
174 158 // (1) change the receiving buffer for the waveform picker
175 159 if ( param_local.local_sbm2_nb_cwf_sent == (param_local.local_sbm2_nb_cwf_max-1) )
176 160 {
177 161 new_waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_norm);
178 162 }
179 163 else if ( new_waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2_norm ) {
180 164 new_waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2);
181 165 doubleSendCWF2 = 1;
182 166 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2_WFRM ) != RTEMS_SUCCESSFUL) {
183 167 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
184 168 }
185 169 reset_local_sbm2_nb_cwf_sent();
186 170 }
187 171 else if ( new_waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2 ) {
188 172 new_waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_bis);
189 173 }
190 174 else {
191 175 new_waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2);
192 176 }
193 177 // (2) send an event for the waveforms transmission
194 178 if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) {
195 179 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
196 180 }
197 181 new_waveform_picker_regs->status = new_waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0
198 182 }
199 183 if ( ( (new_waveform_picker_regs->status & 0x03) == 0x03 ) ) { // [0011] f3 f2 f1 f0, f1 and f0 are full
200 184 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) {
201 185 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
202 186 }
203 187 new_waveform_picker_regs->status = new_waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0
204 188 }
205 189 #endif
206 190 break;
207 191
208 192 //********
209 193 // DEFAULT
210 194 default:
211 195 break;
212 196 }
213 197 }
214 198
215 199 rtems_isr waveforms_simulator_isr( rtems_vector_number vector )
216 200 {
217 201 /** This is the interrupt sub routine called by the waveform picker simulator.
218 202 *
219 203 * This ISR is for debug purpose only.
220 204 *
221 205 */
222 206
223 207 unsigned char lfrMode;
224 208 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
225 209
226 210 switch(lfrMode) {
227 211 case (LFR_MODE_STANDBY):
228 212 break;
229 213 case (LFR_MODE_NORMAL):
230 214 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
231 215 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_5 );
232 216 }
233 217 break;
234 218 case (LFR_MODE_BURST):
235 219 break;
236 220 case (LFR_MODE_SBM1):
237 221 break;
238 222 case (LFR_MODE_SBM2):
239 223 break;
240 224 }
241 225 }
242 226
243 227 rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
244 228 {
245 229 /** This RTEMS task is dedicated to the transmission of snapshots of the NORMAL mode.
246 230 *
247 231 * @param unused is the starting argument of the RTEMS task
248 232 *
249 233 * The following data packets are sent by this task:
250 234 * - TM_LFR_SCIENCE_NORMAL_SWF_F0
251 235 * - TM_LFR_SCIENCE_NORMAL_SWF_F1
252 236 * - TM_LFR_SCIENCE_NORMAL_SWF_F2
253 237 *
254 238 */
255 239
256 240 rtems_event_set event_out;
257 241 rtems_id queue_id;
258 242
259 243 init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 );
260 244 init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 );
261 245 init_header_snapshot_wf_table( SID_NORM_SWF_F2, headerSWF_F2 );
262 246
263 247 init_waveforms();
264 248
265 249 queue_id = get_pkts_queue_id();
266 250
267 251 BOOT_PRINTF("in WFRM ***\n")
268 252
269 253 while(1){
270 254 // wait for an RTEMS_EVENT
271 255 rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1
272 256 | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM,
273 257 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
274 258
275 259 if (event_out == RTEMS_EVENT_MODE_NORMAL)
276 260 {
277 //send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
278 //send_waveform_SWF(wf_snap_f1, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
261 send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
262 send_waveform_SWF(wf_snap_f1, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
279 263 send_waveform_SWF(wf_snap_f2, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
280 264 #ifdef GSA
281 265 new_waveform_picker_regs->status = new_waveform_picker_regs->status & 0xf888; // [1111 1000 1000 1000] f2, f1, f0 bits =0
282 266 #endif
283 267 }
284 268 else if (event_out == RTEMS_EVENT_MODE_SBM1)
285 269 {
286 270 send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
287 271 send_waveform_SWF(wf_snap_f1_norm, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
288 272 send_waveform_SWF(wf_snap_f2, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
289 273 #ifdef GSA
290 274 new_waveform_picker_regs->status = new_waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2, f0 bits = 0
291 275 #endif
292 276 }
293 277 else if (event_out == RTEMS_EVENT_MODE_SBM2)
294 278 {
295 279 send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
296 280 send_waveform_SWF(wf_snap_f1, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
297 281 #ifdef GSA
298 282 new_waveform_picker_regs->status = new_waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0
299 283 #endif
300 284 }
301 285 else if (event_out == RTEMS_EVENT_MODE_SBM2_WFRM)
302 286 {
303 287 send_waveform_SWF(wf_snap_f2_norm, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
304 288 }
305 289 else
306 290 {
307 291 PRINTF("in WFRM *** unexpected event")
308 292 }
309 293
310 294
311 295 #ifdef GSA
312 296 // irq processed, reset the related register of the timer unit
313 297 gptimer_regs->timer[TIMER_WF_SIMULATOR].ctrl = gptimer_regs->timer[TIMER_WF_SIMULATOR].ctrl | 0x00000010;
314 298 // clear the interruption
315 299 LEON_Unmask_interrupt( IRQ_WF );
316 300 #endif
317 301 }
318 302 }
319 303
320 304 rtems_task cwf3_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
321 305 {
322 306 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f3.
323 307 *
324 308 * @param unused is the starting argument of the RTEMS task
325 309 *
326 310 * The following data packet is sent by this task:
327 311 * - TM_LFR_SCIENCE_NORMAL_CWF_F3
328 312 *
329 313 */
330 314
331 315 rtems_event_set event_out;
332 316 rtems_id queue_id;
333 317
334 318 init_header_continuous_wf_table( SID_NORM_CWF_F3, headerCWF_F3 );
335 319 init_header_continuous_wf3_light_table( headerCWF_F3_light );
336 320
337 321 queue_id = get_pkts_queue_id();
338 322
339 323 BOOT_PRINTF("in CWF3 ***\n")
340 324
341 325 while(1){
342 326 // wait for an RTEMS_EVENT
343 327 rtems_event_receive( RTEMS_EVENT_0,
344 328 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
345 329 PRINTF("send CWF F3 \n")
346 330 #ifdef GSA
347 331 #else
348 332 if (new_waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3) {
349 333 send_waveform_CWF3_light( wf_cont_f3_bis, headerCWF_F3_light, queue_id );
350 334 }
351 335 else {
352 336 send_waveform_CWF3_light( wf_cont_f3, headerCWF_F3_light, queue_id );
353 337 }
354 338 #endif
355 339 }
356 340 }
357 341
358 342 rtems_task cwf2_task(rtems_task_argument argument) // ONLY USED IN BURST AND SBM2
359 343 {
360 344 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f2.
361 345 *
362 346 * @param unused is the starting argument of the RTEMS task
363 347 *
364 348 * The following data packet is sent by this function:
365 349 * - TM_LFR_SCIENCE_BURST_CWF_F2
366 350 * - TM_LFR_SCIENCE_SBM2_CWF_F2
367 351 *
368 352 */
369 353
370 354 rtems_event_set event_out;
371 355 rtems_id queue_id;
372 356
373 357 init_header_continuous_wf_table( SID_BURST_CWF_F2, headerCWF_F2_BURST );
374 358 init_header_continuous_wf_table( SID_SBM2_CWF_F2, headerCWF_F2_SBM2 );
375 359
376 360 queue_id = get_pkts_queue_id();
377 361
378 362 BOOT_PRINTF("in CWF2 ***\n")
379 363
380 364 while(1){
381 365 // wait for an RTEMS_EVENT
382 366 rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2,
383 367 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
384 368
385 369 if (event_out == RTEMS_EVENT_MODE_BURST)
386 370 {
387 371 // F2
388 372 #ifdef GSA
389 373 #else
390 374 if (new_waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) {
391 375 send_waveform_CWF( wf_snap_f2_bis, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id );
392 376 }
393 377 else {
394 378 send_waveform_CWF( wf_snap_f2, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id );
395 379 }
396 380 #endif
397 381 }
398 382
399 383 else if (event_out == RTEMS_EVENT_MODE_SBM2)
400 384 {
401 385 #ifdef GSA
402 386 #else
403 387 if (doubleSendCWF2 == 1)
404 388 {
405 389 doubleSendCWF2 = 0;
406 390 send_waveform_CWF( wf_snap_f2_norm, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id );
407 391 }
408 392 else if (new_waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) {
409 393 send_waveform_CWF( wf_snap_f2_bis, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id );
410 394 }
411 395 else {
412 396 send_waveform_CWF( wf_snap_f2, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id );
413 397 }
414 398 param_local.local_sbm2_nb_cwf_sent ++;
415 399 #endif
416 400 }
417 401 else
418 402 {
419 403 PRINTF1("in CWF2 *** ERR mode = %d\n", lfrCurrentMode)
420 404 }
421 405 }
422 406 }
423 407
424 408 rtems_task cwf1_task(rtems_task_argument argument) // ONLY USED IN SBM1
425 409 {
426 410 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f1.
427 411 *
428 412 * @param unused is the starting argument of the RTEMS task
429 413 *
430 414 * The following data packet is sent by this function:
431 415 * - TM_LFR_SCIENCE_SBM1_CWF_F1
432 416 *
433 417 */
434 418
435 419 rtems_event_set event_out;
436 420 rtems_id queue_id;
437 421
438 422 init_header_continuous_wf_table( SID_SBM1_CWF_F1, headerCWF_F1 );
439 423
440 424 queue_id = get_pkts_queue_id();
441 425
442 426 BOOT_PRINTF("in CWF1 ***\n")
443 427
444 428 while(1){
445 429 // wait for an RTEMS_EVENT
446 430 rtems_event_receive( RTEMS_EVENT_MODE_SBM1,
447 431 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
448 432 if (event_out == RTEMS_EVENT_MODE_SBM1)
449 433 {
450 434 #ifdef GSA
451 435 #else
452 436 if (doubleSendCWF1 == 1)
453 437 {
454 438 doubleSendCWF1 = 0;
455 439 send_waveform_CWF( wf_snap_f1_norm, SID_SBM1_CWF_F1, headerCWF_F1, queue_id );
456 440 }
457 441 else if (new_waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1) {
458 442 send_waveform_CWF( wf_snap_f1_bis, SID_SBM1_CWF_F1, headerCWF_F1, queue_id );
459 443 }
460 444 else {
461 445 send_waveform_CWF( wf_snap_f1, SID_SBM1_CWF_F1, headerCWF_F1, queue_id );
462 446 }
463 447 param_local.local_sbm1_nb_cwf_sent ++;
464 448 #endif
465 449 }
466 450 else
467 451 {
468 452 PRINTF1("in CWF1 *** ERR mode = %d\n", lfrCurrentMode)
469 453 }
470 454 }
471 455 }
472 456
473 457 //******************
474 458 // general functions
475 459 void init_waveforms( void )
476 460 {
477 461 int i = 0;
478 462
479 463 for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
480 464 {
481 465 // //***
482 466 // // F0
483 467 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x88887777; //
484 468 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; //
485 469 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x44443333; //
486 470
487 471 //***
488 472 // F1
489 473 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x22221111;
490 474 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x44443333;
491 475 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
492 476
493 477 //***
494 478 // F2
495 479 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0xffffffff;
496 480 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0xffffffff;
497 481 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xffffffff;
498 482
499 483 //***
500 484 // F0
501 485 // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x0; //
502 486 // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x0; //
503 487 // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x0; //
504 488
505 489 // //***
506 490 // // F1
507 491 // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x0;
508 492 // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x0;
509 493 // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x0;
510 494
511 495 // //***
512 496 // // F2
513 497 // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x0;
514 498 // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x0;
515 499 // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x0;
516 500
517 501 //***
518 502 // F3
519 503 //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 0 ] = val1;
520 504 //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 1 ] = val2;
521 505 //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 2 ] = 0xaaaa0000;
522 506 }
523 507 }
524 508
525 509 int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF)
526 510 {
527 511 unsigned char i;
528 512
529 513 for (i=0; i<7; i++)
530 514 {
531 515 headerSWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
532 516 headerSWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
533 517 headerSWF[ i ].reserved = DEFAULT_RESERVED;
534 518 headerSWF[ i ].userApplication = CCSDS_USER_APP;
535 519 headerSWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
536 520 headerSWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
537 521 if (i == 0)
538 522 {
539 523 headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST;
540 524 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_340 >> 8);
541 525 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_340 );
542 526 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
543 527 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
544 528 }
545 529 else if (i == 6)
546 530 {
547 531 headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST;
548 532 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_8 >> 8);
549 533 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_8 );
550 534 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8);
551 535 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 );
552 536 }
553 537 else
554 538 {
555 539 headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION;
556 540 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_340 >> 8);
557 541 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_340 );
558 542 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
559 543 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
560 544 }
561 545 headerSWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
562 546 headerSWF[ i ].pktCnt = DEFAULT_PKTCNT; // PKT_CNT
563 547 headerSWF[ i ].pktNr = i+1; // PKT_NR
564 548 // DATA FIELD HEADER
565 549 headerSWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
566 550 headerSWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
567 551 headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
568 552 headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
569 553 // AUXILIARY DATA HEADER
570 554 headerSWF[ i ].sid = sid;
571 555 headerSWF[ i ].hkBIA = DEFAULT_HKBIA;
572 556 headerSWF[ i ].time[0] = 0x00;
573 557 headerSWF[ i ].time[0] = 0x00;
574 558 headerSWF[ i ].time[0] = 0x00;
575 559 headerSWF[ i ].time[0] = 0x00;
576 560 headerSWF[ i ].time[0] = 0x00;
577 561 headerSWF[ i ].time[0] = 0x00;
578 562 }
579 563 return LFR_SUCCESSFUL;
580 564 }
581 565
582 566 int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF )
583 567 {
584 568 unsigned int i;
585 569
586 570 for (i=0; i<7; i++)
587 571 {
588 572 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
589 573 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
590 574 headerCWF[ i ].reserved = DEFAULT_RESERVED;
591 575 headerCWF[ i ].userApplication = CCSDS_USER_APP;
592 576 if ( (sid == SID_SBM1_CWF_F1) || (sid == SID_SBM2_CWF_F2) )
593 577 {
594 578 headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2 >> 8);
595 579 headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2);
596 580 }
597 581 else
598 582 {
599 583 headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
600 584 headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
601 585 }
602 586 if (i == 0)
603 587 {
604 588 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST;
605 589 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_340 >> 8);
606 590 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_340 );
607 591 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
608 592 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
609 593 }
610 594 else if (i == 6)
611 595 {
612 596 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST;
613 597 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_8 >> 8);
614 598 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_8 );
615 599 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8);
616 600 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 );
617 601 }
618 602 else
619 603 {
620 604 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION;
621 605 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_340 >> 8);
622 606 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_340 );
623 607 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
624 608 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
625 609 }
626 610 headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
627 611 // PKT_CNT
628 612 // PKT_NR
629 613 // DATA FIELD HEADER
630 614 headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
631 615 headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
632 616 headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
633 617 headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
634 618 // AUXILIARY DATA HEADER
635 619 headerCWF[ i ].sid = sid;
636 620 headerCWF[ i ].hkBIA = DEFAULT_HKBIA;
637 621 headerCWF[ i ].time[0] = 0x00;
638 622 headerCWF[ i ].time[0] = 0x00;
639 623 headerCWF[ i ].time[0] = 0x00;
640 624 headerCWF[ i ].time[0] = 0x00;
641 625 headerCWF[ i ].time[0] = 0x00;
642 626 headerCWF[ i ].time[0] = 0x00;
643 627 }
644 628 return LFR_SUCCESSFUL;
645 629 }
646 630
647 631 int init_header_continuous_wf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF )
648 632 {
649 633 unsigned int i;
650 634
651 635 for (i=0; i<7; i++)
652 636 {
653 637 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
654 638 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
655 639 headerCWF[ i ].reserved = DEFAULT_RESERVED;
656 640 headerCWF[ i ].userApplication = CCSDS_USER_APP;
657 641
658 642 headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
659 643 headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
660 644 if (i == 0)
661 645 {
662 646 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST;
663 647 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 >> 8);
664 648 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 );
665 649 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
666 650 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
667 651 }
668 652 else if (i == 6)
669 653 {
670 654 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST;
671 655 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_8 >> 8);
672 656 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_8 );
673 657 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8);
674 658 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 );
675 659 }
676 660 else
677 661 {
678 662 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION;
679 663 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 >> 8);
680 664 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 );
681 665 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
682 666 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
683 667 }
684 668 headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
685 669 // DATA FIELD HEADER
686 670 headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
687 671 headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
688 672 headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
689 673 headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
690 674 // AUXILIARY DATA HEADER
691 675 headerCWF[ i ].sid = SID_NORM_CWF_F3;
692 676 headerCWF[ i ].hkBIA = DEFAULT_HKBIA;
693 677 headerCWF[ i ].time[0] = 0x00;
694 678 headerCWF[ i ].time[0] = 0x00;
695 679 headerCWF[ i ].time[0] = 0x00;
696 680 headerCWF[ i ].time[0] = 0x00;
697 681 headerCWF[ i ].time[0] = 0x00;
698 682 headerCWF[ i ].time[0] = 0x00;
699 683 }
700 684 return LFR_SUCCESSFUL;
701 685 }
702 686
703 687 void reset_waveforms( void )
704 688 {
705 689 int i = 0;
706 690
707 691 for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
708 692 {
709 693 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x10002000;
710 694 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0x20001000;
711 695 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x40008000;
712 696
713 697 //***
714 698 // F1
715 699 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x1000f000;
716 700 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0xf0001000;
717 701 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x40008000;
718 702
719 703 //***
720 704 // F2
721 705 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x40008000;
722 706 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0x20001000;
723 707 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x10002000;
724 708
725 709 //***
726 710 // F3
727 711 /*wf_cont_f3[ i* NB_WORDS_SWF_BLK + 0 ] = build_value( i, i ); // v and 1
728 712 wf_cont_f3[ i* NB_WORDS_SWF_BLK + 1 ] = build_value( i, i ); // e2 and b1
729 713 wf_cont_f3[ i* NB_WORDS_SWF_BLK + 2 ] = build_value( i, i ); // b2 and b3*/
730 714 }
731 715 }
732 716
733 717 int send_waveform_SWF( volatile int *waveform, unsigned int sid,
734 718 Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id )
735 719 {
736 720 /** This function sends SWF CCSDS packets (F2, F1 or F0).
737 721 *
738 722 * @param waveform points to the buffer containing the data that will be send.
739 723 * @param sid is the source identifier of the data that will be sent.
740 724 * @param headerSWF points to a table of headers that have been prepared for the data transmission.
741 725 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
742 726 * contain information to setup the transmission of the data packets.
743 727 *
744 728 * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks.
745 729 *
746 730 */
747 731
748 732 unsigned int i;
749 733 int ret;
750 734 rtems_status_code status;
751 735 spw_ioctl_pkt_send spw_ioctl_send_SWF;
752 736
753 737 spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header
754 738 spw_ioctl_send_SWF.options = 0;
755 739
756 740 ret = LFR_DEFAULT;
757 741
758 742 for (i=0; i<7; i++) // send waveform
759 743 {
760 744 spw_ioctl_send_SWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) + TIME_OFFSET ];
761 745 spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ];
762 746 // BUILD THE DATA
763 747 if (i==6) {
764 748 spw_ioctl_send_SWF.dlen = 8 * NB_BYTES_SWF_BLK;
765 749 }
766 750 else {
767 751 spw_ioctl_send_SWF.dlen = 340 * NB_BYTES_SWF_BLK;
768 752 }
769 753 // SET PACKET SEQUENCE COUNTER
770 754 increment_seq_counter_source_id( headerSWF[ i ].packetSequenceControl, sid );
771 755 // SET PACKET TIME
772 756 headerSWF[ i ].acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24);
773 757 headerSWF[ i ].acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16);
774 758 headerSWF[ i ].acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8);
775 759 headerSWF[ i ].acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time);
776 760 headerSWF[ i ].acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8);
777 761 headerSWF[ i ].acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time);
778 762 headerSWF[ i ].time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
779 763 headerSWF[ i ].time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
780 764 headerSWF[ i ].time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
781 765 headerSWF[ i ].time[3] = (unsigned char) (time_management_regs->coarse_time);
782 766 headerSWF[ i ].time[4] = (unsigned char) (time_management_regs->fine_time>>8);
783 767 headerSWF[ i ].time[5] = (unsigned char) (time_management_regs->fine_time);
784 768 // SEND PACKET
785 769 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_SWF, ACTION_MSG_SPW_IOCTL_SEND_SIZE);
786 770 if (status != RTEMS_SUCCESSFUL) {
787 771 printf("%d-%d, ERR %d\n", sid, i, (int) status);
788 772 ret = LFR_DEFAULT;
789 773 }
790 774 rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds
791 775 }
792 776
793 777 return ret;
794 778 }
795 779
796 780 int send_waveform_CWF(volatile int *waveform, unsigned int sid,
797 781 Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id)
798 782 {
799 783 /** This function sends CWF CCSDS packets (F2, F1 or F0).
800 784 *
801 785 * @param waveform points to the buffer containing the data that will be send.
802 786 * @param sid is the source identifier of the data that will be sent.
803 787 * @param headerCWF points to a table of headers that have been prepared for the data transmission.
804 788 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
805 789 * contain information to setup the transmission of the data packets.
806 790 *
807 791 * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks.
808 792 *
809 793 */
810 794
811 795 unsigned int i;
812 796 int ret;
813 797 rtems_status_code status;
814 798 spw_ioctl_pkt_send spw_ioctl_send_CWF;
815 799
816 800 spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
817 801 spw_ioctl_send_CWF.options = 0;
818 802
819 803 ret = LFR_DEFAULT;
820 804
821 805 for (i=0; i<7; i++) // send waveform
822 806 {
823 807 int coarseTime = 0x00;
824 808 int fineTime = 0x00;
825 809 spw_ioctl_send_CWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ];
826 810 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
827 811 // BUILD THE DATA
828 812 if (i==6) {
829 813 spw_ioctl_send_CWF.dlen = 8 * NB_BYTES_SWF_BLK;
830 814 }
831 815 else {
832 816 spw_ioctl_send_CWF.dlen = 340 * NB_BYTES_SWF_BLK;
833 817 }
834 818 // SET PACKET SEQUENCE COUNTER
835 819 increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, sid );
836 820 // SET PACKET TIME
837 821 coarseTime = time_management_regs->coarse_time;
838 822 fineTime = time_management_regs->fine_time;
839 823 headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24);
840 824 headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16);
841 825 headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8);
842 826 headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime);
843 827 headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8);
844 828 headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime);
845 829 headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24);
846 830 headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16);
847 831 headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8);
848 832 headerCWF[ i ].time[3] = (unsigned char) (coarseTime);
849 833 headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8);
850 834 headerCWF[ i ].time[5] = (unsigned char) (fineTime);
851 835 // SEND PACKET
852 836 if (sid == SID_NORM_CWF_F3)
853 837 {
854 838 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
855 839 if (status != RTEMS_SUCCESSFUL) {
856 840 printf("%d-%d, ERR %d\n", sid, i, (int) status);
857 841 ret = LFR_DEFAULT;
858 842 }
859 843 rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS);
860 844 }
861 845 else
862 846 {
863 847 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
864 848 if (status != RTEMS_SUCCESSFUL) {
865 849 printf("%d-%d, ERR %d\n", sid, i, (int) status);
866 850 ret = LFR_DEFAULT;
867 851 }
868 852 }
869 853 }
870 854
871 855 return ret;
872 856 }
873 857
874 858 int send_waveform_CWF3_light(volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id)
875 859 {
876 860 /** This function sends CWF_F3 CCSDS packets without the b1, b2 and b3 data.
877 861 *
878 862 * @param waveform points to the buffer containing the data that will be send.
879 863 * @param headerCWF points to a table of headers that have been prepared for the data transmission.
880 864 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
881 865 * contain information to setup the transmission of the data packets.
882 866 *
883 867 * By default, CWF_F3 packet are send without the b1, b2 and b3 data. This function rebuilds a data buffer
884 868 * from the incoming data and sends it in 7 packets, 6 containing 340 blocks and 1 one containing 8 blocks.
885 869 *
886 870 */
887 871
888 872 unsigned int i;
889 873 int ret;
890 874 rtems_status_code status;
891 875 spw_ioctl_pkt_send spw_ioctl_send_CWF;
892 876 char *sample;
893 877
894 878 spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
895 879 spw_ioctl_send_CWF.options = 0;
896 880
897 881 ret = LFR_DEFAULT;
898 882
899 883 //**********************
900 884 // BUILD CWF3_light DATA
901 885 for ( i=0; i< 2048; i++)
902 886 {
903 887 sample = (char*) &waveform[ i * NB_WORDS_SWF_BLK ];
904 888 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) ] = sample[ 0 ];
905 889 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 ] = sample[ 1 ];
906 890 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 ] = sample[ 2 ];
907 891 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 ] = sample[ 3 ];
908 892 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 ] = sample[ 4 ];
909 893 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 ] = sample[ 5 ];
910 894 }
911 895
912 896 //*********************
913 897 // SEND CWF3_light DATA
914 898
915 899 for (i=0; i<7; i++) // send waveform
916 900 {
917 901 int coarseTime = 0x00;
918 902 int fineTime = 0x00;
919 903 spw_ioctl_send_CWF.data = (char*) &wf_cont_f3_light[ (i * 340 * NB_BYTES_CWF3_LIGHT_BLK) ];
920 904 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
921 905 // BUILD THE DATA
922 906 if ( i == WFRM_INDEX_OF_LAST_PACKET ) {
923 907 spw_ioctl_send_CWF.dlen = 8 * NB_BYTES_CWF3_LIGHT_BLK;
924 908 }
925 909 else {
926 910 spw_ioctl_send_CWF.dlen = 340 * NB_BYTES_CWF3_LIGHT_BLK;
927 911 }
928 912 // SET PACKET SEQUENCE COUNTER
929 913 increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, SID_NORM_CWF_F3 );
930 914 // SET PACKET TIME
931 915 coarseTime = time_management_regs->coarse_time;
932 916 fineTime = time_management_regs->fine_time;
933 917 headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24);
934 918 headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16);
935 919 headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8);
936 920 headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime);
937 921 headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8);
938 922 headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime);
939 923 headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24);
940 924 headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16);
941 925 headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8);
942 926 headerCWF[ i ].time[3] = (unsigned char) (coarseTime);
943 927 headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8);
944 928 headerCWF[ i ].time[5] = (unsigned char) (fineTime);
945 929 // SEND PACKET
946 930 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
947 931 if (status != RTEMS_SUCCESSFUL) {
948 932 printf("%d-%d, ERR %d\n", SID_NORM_CWF_F3, i, (int) status);
949 933 ret = LFR_DEFAULT;
950 934 }
951 935 rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS);
952 936 }
953 937
954 938 return ret;
955 939 }
956 940
957 941
958 942 //**************
959 943 // wfp registers
960 944 void set_wfp_data_shaping()
961 945 {
962 946 /** This function sets the data_shaping register of the waveform picker module.
963 947 *
964 948 * The value is read from one field of the parameter_dump_packet structure:\n
965 949 * bw_sp0_sp1_r0_r1
966 950 *
967 951 */
968 952
969 953 unsigned char data_shaping;
970 954
971 955 // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register
972 956 // waveform picker : [R1 R0 SP1 SP0 BW]
973 957
974 958 data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1;
975 959
976 960 #ifdef GSA
977 961 #else
978 962 new_waveform_picker_regs->data_shaping =
979 963 ( (data_shaping & 0x10) >> 4 ) // BW
980 964 + ( (data_shaping & 0x08) >> 2 ) // SP0
981 965 + ( (data_shaping & 0x04) ) // SP1
982 966 + ( (data_shaping & 0x02) << 2 ) // R0
983 967 + ( (data_shaping & 0x01) << 4 ); // R1
984 968 #endif
985 969 }
986 970
987 971 char set_wfp_delta_snapshot()
988 972 {
989 973 /** This function sets the delta_snapshot register of the waveform picker module.
990 974 *
991 975 * The value is read from two (unsigned char) of the parameter_dump_packet structure:
992 976 * - sy_lfr_n_swf_p[0]
993 977 * - sy_lfr_n_swf_p[1]
994 978 *
995 979 */
996 980
997 981 char ret;
998 982 unsigned int delta_snapshot;
999 983 unsigned int aux;
1000 984
1001 985 aux = 0;
1002 986 ret = LFR_DEFAULT;
1003 987
1004 988 delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256
1005 989 + parameter_dump_packet.sy_lfr_n_swf_p[1];
1006 990
1007 991 #ifdef GSA
1008 992 #else
1009 993 if ( delta_snapshot < MIN_DELTA_SNAPSHOT )
1010 994 {
1011 995 aux = MIN_DELTA_SNAPSHOT;
1012 996 ret = LFR_DEFAULT;
1013 997 }
1014 998 else
1015 999 {
1016 1000 aux = delta_snapshot ;
1017 1001 ret = LFR_SUCCESSFUL;
1018 1002 }
1019 1003 new_waveform_picker_regs->delta_snapshot = aux - 1; // max 2 bytes
1020 1004 #endif
1021 1005
1022 1006 return ret;
1023 1007 }
1024 1008
1025 1009 void set_wfp_burst_enable_register( unsigned char mode)
1026 1010 {
1027 1011 /** This function sets the waveform picker burst_enable register depending on the mode.
1028 1012 *
1029 1013 * @param mode is the LFR mode to launch.
1030 1014 *
1031 1015 * The burst bits shall be before the enable bits.
1032 1016 *
1033 1017 */
1034 1018
1035 1019 #ifdef GSA
1036 1020 #else
1037 1021 // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0
1038 1022 // the burst bits shall be set first, before the enable bits
1039 1023 switch(mode) {
1040 1024 case(LFR_MODE_NORMAL):
1041 new_waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enable
1042 // new_waveform_picker_regs->run_burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0
1043 // new_waveform_picker_regs->run_burst_enable = 0x07; // [0000 0111] enable f2 f1 f0
1044 // new_waveform_picker_regs->run_burst_enable = 0x01; // [0000 0001] enable f0
1045 new_waveform_picker_regs->run_burst_enable = 0x04; // [0000 0100] enable f0
1025 new_waveform_picker_regs->run_burst_enable = 0x80; // [1000 0000] f3 burst enable
1026 new_waveform_picker_regs->run_burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0
1046 1027 break;
1047 1028 case(LFR_MODE_BURST):
1048 1029 new_waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled
1049 1030 new_waveform_picker_regs->run_burst_enable = new_waveform_picker_regs->run_burst_enable | 0x04; // [0100] enable f2
1050 1031 break;
1051 1032 case(LFR_MODE_SBM1):
1052 1033 new_waveform_picker_regs->run_burst_enable = 0x20; // [0010 0000] f1 burst enabled
1053 1034 new_waveform_picker_regs->run_burst_enable = new_waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
1054 1035 break;
1055 1036 case(LFR_MODE_SBM2):
1056 1037 new_waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled
1057 1038 new_waveform_picker_regs->run_burst_enable = new_waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
1058 1039 break;
1059 1040 default:
1060 1041 new_waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled
1061 1042 break;
1062 1043 }
1063 1044 #endif
1064 1045 }
1065 1046
1066 1047 void reset_wfp_run_burst_enable()
1067 1048 {
1068 1049 /** This function resets the waveform picker burst_enable register.
1069 1050 *
1070 1051 * The burst bits [f2 f1 f0] and the enable bits [f3 f2 f1 f0] are set to 0.
1071 1052 *
1072 1053 */
1073 1054
1074 1055 #ifdef GSA
1075 1056 #else
1076 1057 new_waveform_picker_regs->run_burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
1077 1058 #endif
1078 1059 }
1079 1060
1080 1061 void reset_wfp_status()
1081 1062 {
1082 1063 /** This function resets the waveform picker status register.
1083 1064 *
1084 1065 * All status bits are set to 0 [new_err full_err full].
1085 1066 *
1086 1067 */
1087 1068
1088 1069 #ifdef GSA
1089 1070 #else
1090 1071 new_waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
1091 1072 #endif
1092 1073 }
1093 1074
1094 1075 void reset_new_waveform_picker_regs()
1095 1076 {
1096 1077 /** This function resets the waveform picker module registers.
1097 1078 *
1098 1079 * The registers affected by this function are located at the following offset addresses:
1099 1080 * - 0x00 data_shaping
1100 1081 * - 0x04 run_burst_enable
1101 1082 * - 0x08 addr_data_f0
1102 1083 * - 0x0C addr_data_f1
1103 1084 * - 0x10 addr_data_f2
1104 1085 * - 0x14 addr_data_f3
1105 1086 * - 0x18 status
1106 1087 * - 0x1C delta_snapshot
1107 1088 * - 0x20 delta_f0
1108 1089 * - 0x24 delta_f0_2
1109 1090 * - 0x28 delta_f1
1110 1091 * - 0x2c delta_f2
1111 1092 * - 0x30 nb_data_by_buffer
1112 1093 * - 0x34 nb_snapshot_param
1113 1094 * - 0x38 start_date
1114 1095 * - 0x3c nb_word_in_buffer
1115 1096 *
1116 1097 */
1117 1098
1118 unsigned int wf_snap_f0_aligned;
1119 unsigned int wf_snap_f1_aligned;
1120 unsigned int wf_snap_f2_aligned;
1121 unsigned int wf_cont_f3_aligned;
1122
1123 1099 new_waveform_picker_regs->data_shaping = 0x01; // 0x00 *** R1 R0 SP1 SP0 BW
1124 1100 new_waveform_picker_regs->run_burst_enable = 0x00; // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ]
1125 wf_snap_f0_aligned = address_alignment( wf_snap_f0 );
1126 wf_snap_f1_aligned = address_alignment( wf_snap_f1 );
1127 wf_snap_f2_aligned = address_alignment( wf_snap_f2 );
1128 wf_cont_f3_aligned = address_alignment( wf_cont_f3 );
1129 new_waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0_aligned); // 0x08
1130 new_waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_aligned); // 0x0c
1131 new_waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_aligned); // 0x10
1132 new_waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_aligned); // 0x14
1101 new_waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0); // 0x08
1102 new_waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1); // 0x0c
1103 new_waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); // 0x10
1104 new_waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3); // 0x14
1133 1105 new_waveform_picker_regs->status = 0x00; // 0x18
1134 1106 // new_waveform_picker_regs->delta_snapshot = 0x12800; // 0x1c 296 * 256 = 75776
1135 1107 // new_waveform_picker_regs->delta_snapshot = 0x1000; // 0x1c 16 * 256 = 4096
1136 1108 new_waveform_picker_regs->delta_snapshot = 0x2000; // 0x1c 32 * 256 = 8192
1137 1109 new_waveform_picker_regs->delta_f0 = 0xbf5; // 0x20 *** 1013
1138 1110 new_waveform_picker_regs->delta_f0_2 = 0x7; // 0x24 *** 7 [7 bits]
1139 1111 new_waveform_picker_regs->delta_f1 = 0xbc0; // 0x28 *** 960
1140 1112 // new_waveform_picker_regs->delta_f2 = 0x12200; // 0x2c *** 74240
1141 1113 new_waveform_picker_regs->delta_f2 = 0xc00; // 0x2c *** 12 * 256 = 3072
1142 1114 new_waveform_picker_regs->nb_data_by_buffer = 0x7ff; // 0x30 *** 2048 -1 => nb samples -1
1143 1115 new_waveform_picker_regs->snapshot_param = 0x800; // 0x34 *** 2048 => nb samples
1144 1116 new_waveform_picker_regs->start_date = 0x00; // 0x38
1145 1117 new_waveform_picker_regs->nb_word_in_buffer = 0x1802; // 0x3c *** 2048 * 3 + 2 = 6146
1146 1118 }
1147 1119
1148 void reset_new_waveform_picker_regs_alt()
1149 {
1150 /** This function resets the waveform picker module registers.
1151 *
1152 * The registers affected by this function are located at the following offset addresses:
1153 * - 0x00 data_shaping
1154 * - 0x04 run_burst_enable
1155 * - 0x08 addr_data_f0
1156 * - 0x0C addr_data_f1
1157 * - 0x10 addr_data_f2
1158 * - 0x14 addr_data_f3
1159 * - 0x18 status
1160 * - 0x1C delta_snapshot
1161 * - 0x20 delta_f0
1162 * - 0x24 delta_f0_2
1163 * - 0x28 delta_f1
1164 * - 0x2c delta_f2
1165 * - 0x30 nb_data_by_buffer
1166 * - 0x34 nb_snapshot_param
1167 * - 0x38 start_date
1168 * - 0x3c nb_word_in_buffer
1169 *
1170 */
1171
1172 unsigned int wf_snap_f0_aligned;
1173 unsigned int wf_snap_f1_aligned;
1174 unsigned int wf_snap_f2_aligned;
1175 unsigned int wf_cont_f3_aligned;
1176
1177 new_waveform_picker_regs->data_shaping = 0x01; // 0x00 *** R1 R0 SP1 SP0 BW
1178 new_waveform_picker_regs->run_burst_enable = 0x00; // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ]
1179 wf_snap_f0_aligned = address_alignment( wf_snap_f0 );
1180 wf_snap_f1_aligned = address_alignment( wf_snap_f1 );
1181 wf_snap_f2_aligned = address_alignment( wf_snap_f2 );
1182 wf_cont_f3_aligned = address_alignment( wf_cont_f3 );
1183 new_waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0_aligned); // 0x08
1184 new_waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_aligned); // 0x0c
1185 new_waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_aligned); // 0x10
1186 new_waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_aligned); // 0x14
1187 new_waveform_picker_regs->status = 0x00; // 0x18
1188 // new_waveform_picker_regs->delta_snapshot = 0x12800; // 0x1c 296 * 256 = 75776
1189 new_waveform_picker_regs->delta_snapshot = 0x1000; // 0x1c 16 * 256 = 4096
1190 new_waveform_picker_regs->delta_f0 = 0xbf5; // 0x20 *** 1013
1191 new_waveform_picker_regs->delta_f0_2 = 0x7; // 0x24 *** 7 [7 bits]
1192 new_waveform_picker_regs->delta_f1 = 0xbc0; // 0x28 *** 960
1193 // new_waveform_picker_regs->delta_f2 = 0x12200; // 0x2c *** 74240
1194 new_waveform_picker_regs->delta_f2 = 0xc00; // 0x2c *** 12 * 256 = 3072
1195 new_waveform_picker_regs->nb_data_by_buffer = 0x07; // 0x30 *** 7
1196 new_waveform_picker_regs->snapshot_param = 0x10; // 0x34 *** 16
1197 new_waveform_picker_regs->start_date = 0x00; // 0x38
1198 new_waveform_picker_regs->nb_word_in_buffer = 0x34; // 0x3c *** (3 * 8 + 2) * 2
1199 }
1200
1201 1120 //*****************
1202 1121 // local parameters
1203 1122 void set_local_sbm1_nb_cwf_max()
1204 1123 {
1205 1124 /** This function sets the value of the sbm1_nb_cwf_max local parameter.
1206 1125 *
1207 1126 * The sbm1_nb_cwf_max parameter counts the number of CWF_F1 records that have been sent.\n
1208 1127 * This parameter is used to send CWF_F1 data as normal data when the SBM1 is active.\n\n
1209 1128 * (2 snapshots of 2048 points per seconds) * (period of the NORM snashots) - 8 s (duration of the f2 snapshot)
1210 1129 *
1211 1130 */
1212 1131 param_local.local_sbm1_nb_cwf_max = 2 *
1213 1132 (parameter_dump_packet.sy_lfr_n_swf_p[0] * 256
1214 1133 + parameter_dump_packet.sy_lfr_n_swf_p[1]) - 8; // 16 CWF1 parts during 1 SWF2
1215 1134 }
1216 1135
1217 1136 void set_local_sbm2_nb_cwf_max()
1218 1137 {
1219 1138 /** This function sets the value of the sbm1_nb_cwf_max local parameter.
1220 1139 *
1221 1140 * The sbm1_nb_cwf_max parameter counts the number of CWF_F1 records that have been sent.\n
1222 1141 * This parameter is used to send CWF_F2 data as normal data when the SBM2 is active.\n\n
1223 1142 * (period of the NORM snashots) / (8 seconds per snapshot at f2 = 256 Hz)
1224 1143 *
1225 1144 */
1226 1145
1227 1146 param_local.local_sbm2_nb_cwf_max = (parameter_dump_packet.sy_lfr_n_swf_p[0] * 256
1228 1147 + parameter_dump_packet.sy_lfr_n_swf_p[1]) / 8;
1229 1148 }
1230 1149
1231 1150 void set_local_nb_interrupt_f0_MAX()
1232 1151 {
1233 1152 /** This function sets the value of the nb_interrupt_f0_MAX local parameter.
1234 1153 *
1235 1154 * This parameter is used for the SM validation only.\n
1236 1155 * The software waits param_local.local_nb_interrupt_f0_MAX interruptions from the spectral matrices
1237 1156 * module before launching a basic processing.
1238 1157 *
1239 1158 */
1240 1159
1241 1160 param_local.local_nb_interrupt_f0_MAX = ( (parameter_dump_packet.sy_lfr_n_asm_p[0]) * 256
1242 1161 + parameter_dump_packet.sy_lfr_n_asm_p[1] ) * 100;
1243 1162 }
1244 1163
1245 1164 void reset_local_sbm1_nb_cwf_sent()
1246 1165 {
1247 1166 /** This function resets the value of the sbm1_nb_cwf_sent local parameter.
1248 1167 *
1249 1168 * The sbm1_nb_cwf_sent parameter counts the number of CWF_F1 records that have been sent.\n
1250 1169 * This parameter is used to send CWF_F1 data as normal data when the SBM1 is active.
1251 1170 *
1252 1171 */
1253 1172
1254 1173 param_local.local_sbm1_nb_cwf_sent = 0;
1255 1174 }
1256 1175
1257 1176 void reset_local_sbm2_nb_cwf_sent()
1258 1177 {
1259 1178 /** This function resets the value of the sbm2_nb_cwf_sent local parameter.
1260 1179 *
1261 1180 * The sbm2_nb_cwf_sent parameter counts the number of CWF_F2 records that have been sent.\n
1262 1181 * This parameter is used to send CWF_F2 data as normal data when the SBM2 mode is active.
1263 1182 *
1264 1183 */
1265 1184
1266 1185 param_local.local_sbm2_nb_cwf_sent = 0;
1267 1186 }
1268 1187
1269 1188 rtems_id get_pkts_queue_id( void )
1270 1189 {
1271 1190 rtems_id queue_id;
1272 1191 rtems_status_code status;
1273 1192 rtems_name queue_send_name;
1274 1193
1275 1194 queue_send_name = rtems_build_name( 'Q', '_', 'S', 'D' );
1276 1195
1277 1196 status = rtems_message_queue_ident( queue_send_name, 0, &queue_id );
1278 1197 if (status != RTEMS_SUCCESSFUL)
1279 1198 {
1280 1199 PRINTF1("in get_pkts_queue_id *** ERR %d\n", status)
1281 1200 }
1282 1201 return queue_id;
1283 1202 }
1284 1203
1285 1204 void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid )
1286 1205 {
1287 1206 unsigned short *sequence_cnt;
1288 1207 unsigned short segmentation_grouping_flag;
1289 1208 unsigned short new_packet_sequence_control;
1290 1209
1291 1210 if ( (sid ==SID_NORM_SWF_F0) || (sid ==SID_NORM_SWF_F1) || (sid ==SID_NORM_SWF_F2)
1292 1211 || (sid ==SID_NORM_CWF_F3) || (sid ==SID_BURST_CWF_F2) )
1293 1212 {
1294 1213 sequence_cnt = &sequenceCounters_SCIENCE_NORMAL_BURST;
1295 1214 }
1296 1215 else if ( (sid ==SID_SBM1_CWF_F1) || (sid ==SID_SBM2_CWF_F2) )
1297 1216 {
1298 1217 sequence_cnt = &sequenceCounters_SCIENCE_SBM1_SBM2;
1299 1218 }
1300 1219 else
1301 1220 {
1302 1221 sequence_cnt = &sequenceCounters_TC_EXE[ UNKNOWN ];
1303 1222 PRINTF1("in increment_seq_counter_source_id *** ERR apid_destid %d not known\n", sid)
1304 1223 }
1305 1224
1306 1225 segmentation_grouping_flag = (packet_sequence_control[ 0 ] & 0xc0) << 8;
1307 1226 *sequence_cnt = (*sequence_cnt) & 0x3fff;
1308 1227
1309 1228 new_packet_sequence_control = segmentation_grouping_flag | *sequence_cnt ;
1310 1229
1311 1230 packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8);
1312 1231 packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control );
1313 1232
1314 1233 // increment the sequence counter for the next packet
1315 1234 if ( *sequence_cnt < SEQ_CNT_MAX)
1316 1235 {
1317 1236 *sequence_cnt = *sequence_cnt + 1;
1318 1237 }
1319 1238 else
1320 1239 {
1321 1240 *sequence_cnt = 0;
1322 1241 }
1323 1242 }
1324
1325 unsigned int address_alignment( volatile int *address)
1326 {
1327 unsigned char i;
1328 unsigned char lastByte;
1329 unsigned int addressAligned;
1330
1331 addressAligned = (unsigned int) address;
1332
1333 PRINTF1("address %x\n", addressAligned );
1334
1335 for (i=0; i<256; i++)
1336 {
1337 lastByte = (unsigned char) ( addressAligned & 0x000000ff ) ;
1338 if (lastByte == 0x00)
1339 {
1340 break;
1341 }
1342 else
1343 {
1344 addressAligned = addressAligned + 1;
1345 }
1346 }
1347
1348 PRINTF2("i = %d, address %x\n", i, (int) addressAligned);
1349
1350 return addressAligned;
1351 }
General Comments 0
You need to be logged in to leave comments. Login now