##// END OF EJS Templates
Integration of the VHDL_DEV option...
paul -
r90:b0bdcde41112 VHDLib206
parent child
Show More
@@ -1,249 +1,248
1 1 #############################################################################
2 2 # Makefile for building: bin/fsw
3 # Generated by qmake (2.01a) (Qt 4.8.5) on: Tue Jan 21 11:57:00 2014
3 # Generated by qmake (2.01a) (Qt 4.8.5) on: Tue Jan 21 15:38:15 2014
4 4 # Project: fsw-qt.pro
5 5 # Template: app
6 # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ CONFIG+=debug -o Makefile fsw-qt.pro
6 # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
7 7 #############################################################################
8 8
9 9 ####### Compiler, tools and options
10 10
11 11 CC = sparc-rtems-gcc
12 12 CXX = sparc-rtems-g++
13 DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=1 -DPRINT_MESSAGES_ON_CONSOLE -DDEBUG_MESSAGES
14 CFLAGS = -pipe -g -O3 -Wall $(DEFINES)
13 DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=1 -DPRINT_MESSAGES_ON_CONSOLE -DDEBUG_MESSAGES -DVHDL_DEV
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 LFLAGS = -g
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 /usr/lib64/qt4/mkspecs/features/debug.prf \
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 { test -n "$(DESTDIR)" && DESTDIR="$(DESTDIR)" || DESTDIR=.; } && test $$(gdb --version | sed -e 's,[^0-9]\+\([0-9]\)\.\([0-9]\).*,\1\2,;q') -gt 72 && gdb --nx --batch --quiet -ex 'set confirm off' -ex "save gdb-index $$DESTDIR" -ex quit '$(TARGET)' && test -f $(TARGET).gdb-index && sparc-rtems-objcopy --add-section '.gdb_index=$(TARGET).gdb-index' --set-section-flags '.gdb_index=readonly' '$(TARGET)' '$(TARGET)' && rm -f $(TARGET).gdb-index || true
122 121
123 122 Makefile: fsw-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \
124 123 /usr/lib64/qt4/mkspecs/common/linux.conf \
125 124 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
126 125 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
127 126 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
128 127 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
129 128 /usr/lib64/qt4/mkspecs/qconfig.pri \
130 129 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
131 130 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
132 131 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
133 132 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
134 133 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
135 134 sparc.pri \
136 /usr/lib64/qt4/mkspecs/features/debug.prf \
135 /usr/lib64/qt4/mkspecs/features/release.prf \
137 136 /usr/lib64/qt4/mkspecs/features/default_post.prf \
138 137 /usr/lib64/qt4/mkspecs/features/shared.prf \
139 138 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
140 139 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
141 140 /usr/lib64/qt4/mkspecs/features/resources.prf \
142 141 /usr/lib64/qt4/mkspecs/features/uic.prf \
143 142 /usr/lib64/qt4/mkspecs/features/yacc.prf \
144 143 /usr/lib64/qt4/mkspecs/features/lex.prf \
145 144 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf
146 $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ CONFIG+=debug -o Makefile fsw-qt.pro
145 $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
147 146 /usr/lib64/qt4/mkspecs/common/unix.conf:
148 147 /usr/lib64/qt4/mkspecs/common/linux.conf:
149 148 /usr/lib64/qt4/mkspecs/common/gcc-base.conf:
150 149 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf:
151 150 /usr/lib64/qt4/mkspecs/common/g++-base.conf:
152 151 /usr/lib64/qt4/mkspecs/common/g++-unix.conf:
153 152 /usr/lib64/qt4/mkspecs/qconfig.pri:
154 153 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri:
155 154 /usr/lib64/qt4/mkspecs/features/qt_functions.prf:
156 155 /usr/lib64/qt4/mkspecs/features/qt_config.prf:
157 156 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf:
158 157 /usr/lib64/qt4/mkspecs/features/default_pre.prf:
159 158 sparc.pri:
160 /usr/lib64/qt4/mkspecs/features/debug.prf:
159 /usr/lib64/qt4/mkspecs/features/release.prf:
161 160 /usr/lib64/qt4/mkspecs/features/default_post.prf:
162 161 /usr/lib64/qt4/mkspecs/features/shared.prf:
163 162 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf:
164 163 /usr/lib64/qt4/mkspecs/features/warn_on.prf:
165 164 /usr/lib64/qt4/mkspecs/features/resources.prf:
166 165 /usr/lib64/qt4/mkspecs/features/uic.prf:
167 166 /usr/lib64/qt4/mkspecs/features/yacc.prf:
168 167 /usr/lib64/qt4/mkspecs/features/lex.prf:
169 168 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf:
170 169 qmake: FORCE
171 @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ CONFIG+=debug -o Makefile fsw-qt.pro
170 @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
172 171
173 172 dist:
174 173 @$(CHK_DIR_EXISTS) obj/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0
175 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
176 175
177 176
178 177 clean:compiler_clean
179 178 -$(DEL_FILE) $(OBJECTS)
180 179 -$(DEL_FILE) *~ core *.core
181 180
182 181
183 182 ####### Sub-libraries
184 183
185 184 distclean: clean
186 185 -$(DEL_FILE) $(TARGET)
187 186 -$(DEL_FILE) Makefile
188 187
189 188
190 189 grmon:
191 190 cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u
192 191
193 192 check: first
194 193
195 194 compiler_rcc_make_all:
196 195 compiler_rcc_clean:
197 196 compiler_uic_make_all:
198 197 compiler_uic_clean:
199 198 compiler_image_collection_make_all: qmake_image_collection.cpp
200 199 compiler_image_collection_clean:
201 200 -$(DEL_FILE) qmake_image_collection.cpp
202 201 compiler_yacc_decl_make_all:
203 202 compiler_yacc_decl_clean:
204 203 compiler_yacc_impl_make_all:
205 204 compiler_yacc_impl_clean:
206 205 compiler_lex_make_all:
207 206 compiler_lex_clean:
208 207 compiler_clean:
209 208
210 209 ####### Compile
211 210
212 211 obj/wf_handler.o: ../src/wf_handler.c
213 212 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/wf_handler.o ../src/wf_handler.c
214 213
215 214 obj/tc_handler.o: ../src/tc_handler.c
216 215 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o ../src/tc_handler.c
217 216
218 217 obj/fsw_processing.o: ../src/fsw_processing.c ../src/fsw_processing_globals.c
219 218 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/fsw_processing.c
220 219
221 220 obj/fsw_misc.o: ../src/fsw_misc.c
222 221 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c
223 222
224 223 obj/fsw_init.o: ../src/fsw_init.c ../src/fsw_config.c
225 224 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o ../src/fsw_init.c
226 225
227 226 obj/fsw_globals.o: ../src/fsw_globals.c
228 227 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c
229 228
230 229 obj/fsw_spacewire.o: ../src/fsw_spacewire.c
231 230 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spacewire.o ../src/fsw_spacewire.c
232 231
233 232 obj/tc_load_dump_parameters.o: ../src/tc_load_dump_parameters.c
234 233 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_load_dump_parameters.o ../src/tc_load_dump_parameters.c
235 234
236 235 obj/tm_lfr_tc_exe.o: ../src/tm_lfr_tc_exe.c
237 236 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tm_lfr_tc_exe.o ../src/tm_lfr_tc_exe.c
238 237
239 238 obj/tc_acceptance.o: ../src/tc_acceptance.c
240 239 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_acceptance.o ../src/tc_acceptance.c
241 240
242 241 ####### Install
243 242
244 243 install: FORCE
245 244
246 245 uninstall: FORCE
247 246
248 247 FORCE:
249 248
@@ -1,79 +1,85
1 1 TEMPLATE = app
2 2 # CONFIG += console v8 sim
3 # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** gsa
4 CONFIG += console verbose debug_messages
3 # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** gsa *** vhdl_dev
4 CONFIG += console verbose debug_messages vhdl_dev
5 5 CONFIG -= qt
6 6
7 7 include(./sparc.pri)
8 8
9 9 # flight software version
10 10 SWVERSION=-1-0
11 11 DEFINES += SW_VERSION_N1=1 # major
12 12 DEFINES += SW_VERSION_N2=0 # minor
13 13 DEFINES += SW_VERSION_N3=0 # patch
14 14 DEFINES += SW_VERSION_N4=1 # internal
15 15
16 16 contains( CONFIG, verbose ) {
17 17 DEFINES += PRINT_MESSAGES_ON_CONSOLE
18 18 }
19 19
20 20 contains( CONFIG, debug_messages ) {
21 21 DEFINES += DEBUG_MESSAGES
22 22 }
23 23
24 24 contains( CONFIG, cpu_usage_report ) {
25 25 DEFINES += PRINT_TASK_STATISTICS
26 26 }
27 27
28 28 contains( CONFIG, stack_report ) {
29 29 DEFINES += PRINT_STACK_REPORT
30 30 }
31 31
32 32 contains( CONFIG, boot_messages ) {
33 33 DEFINES += BOOT_MESSAGES
34 34 }
35 35
36 36 #doxygen.target = doxygen
37 37 #doxygen.commands = doxygen ../doc/Doxyfile
38 38 #QMAKE_EXTRA_TARGETS += doxygen
39 39
40 40 TARGET = fsw
41 41 contains( CONFIG, gsa ) {
42 42 DEFINES += GSA
43 43 TARGET = fsw-gsa
44 44 }
45 45
46 TARGET = fsw
47 contains( CONFIG, vhdl_dev ) {
48 DEFINES += VHDL_DEV
49 TARGET = fsw
50 }
51
46 52 INCLUDEPATH += \
47 53 ../src \
48 54 ../header
49 55
50 56 SOURCES += \
51 57 ../src/wf_handler.c \
52 58 ../src/tc_handler.c \
53 59 ../src/fsw_processing.c \
54 60 ../src/fsw_misc.c \
55 61 ../src/fsw_init.c \
56 62 ../src/fsw_globals.c \
57 63 ../src/fsw_spacewire.c \
58 64 ../src/tc_load_dump_parameters.c \
59 65 ../src/tm_lfr_tc_exe.c \
60 66 ../src/tc_acceptance.c
61 67
62 68
63 69 HEADERS += \
64 70 ../header/wf_handler.h \
65 71 ../header/tc_handler.h \
66 72 ../header/grlib_regs.h \
67 73 ../header/fsw_processing.h \
68 74 ../header/fsw_params.h \
69 75 ../header/fsw_misc.h \
70 76 ../header/fsw_init.h \
71 77 ../header/ccsds_types.h \
72 78 ../header/fsw_params_processing.h \
73 79 ../header/fsw_spacewire.h \
74 80 ../header/tm_byte_positions.h \
75 81 ../header/tc_load_dump_parameters.h \
76 82 ../header/tm_lfr_tc_exe.h \
77 83 ../header/tc_acceptance.h \
78 84 ../header/fsw_params_nb_bytes.h
79 85
@@ -1,311 +1,311
1 1 <?xml version="1.0" encoding="UTF-8"?>
2 2 <!DOCTYPE QtCreatorProject>
3 <!-- Written by QtCreator 3.0.0, 2014-01-21T13:07:28. -->
3 <!-- Written by QtCreator 3.0.0, 2014-01-21T15:59:52. -->
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="QByteArray" key="CurrentPreferences">CppGlobal</value>
19 19 </valuemap>
20 20 </valuemap>
21 21 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
22 22 <value type="QString" key="language">QmlJS</value>
23 23 <valuemap type="QVariantMap" key="value">
24 24 <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
25 25 </valuemap>
26 26 </valuemap>
27 27 <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
28 <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
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 <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
59 <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">1</value>
60 60 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
61 61 <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/opt/DEV_PLE/FSW-qt</value>
62 62 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
63 63 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
64 64 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
65 65 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
66 66 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
67 67 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
68 68 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
69 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value>
69 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
70 70 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
71 71 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
72 72 </valuemap>
73 73 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
74 74 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
75 75 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
76 76 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
77 77 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
78 78 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
79 79 <value type="QString">-w</value>
80 80 <value type="QString">-r</value>
81 81 </valuelist>
82 82 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
83 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
83 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w -j 4</value>
84 84 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
85 85 </valuemap>
86 86 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
87 87 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
88 88 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
89 89 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
90 90 </valuemap>
91 91 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
92 92 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
93 93 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
94 94 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
95 95 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
96 96 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
97 97 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
98 98 <value type="QString">-w</value>
99 99 <value type="QString">-r</value>
100 100 </valuelist>
101 101 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
102 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
102 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w clean</value>
103 103 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
104 104 </valuemap>
105 105 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
106 106 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
107 107 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
108 108 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
109 109 </valuemap>
110 110 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
111 111 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
112 112 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
113 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
113 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 4.8.2 in PATH (System) Release</value>
114 114 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
115 115 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
116 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
116 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</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 <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/opt/DEV_PLE/FSW-qt</value>
121 121 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
122 122 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
123 123 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
124 124 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
125 125 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
126 126 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
127 127 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
128 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value>
128 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
129 129 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
130 130 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
131 131 </valuemap>
132 132 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
133 133 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
134 134 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
135 135 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
136 136 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
137 137 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
138 138 <value type="QString">-w</value>
139 139 <value type="QString">-r</value>
140 140 </valuelist>
141 141 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
142 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
142 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w </value>
143 143 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
144 144 </valuemap>
145 145 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
146 146 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
147 147 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
148 148 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
149 149 </valuemap>
150 150 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
151 151 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
152 152 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
153 153 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
154 154 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
155 155 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
156 156 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
157 157 <value type="QString">-w</value>
158 158 <value type="QString">-r</value>
159 159 </valuelist>
160 160 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
161 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
161 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w clean</value>
162 162 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
163 163 </valuemap>
164 164 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
165 165 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
166 166 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
167 167 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
168 168 </valuemap>
169 169 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
170 170 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
171 171 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
172 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release2</value>
172 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 4.8.2 in PATH (System) Debug</value>
173 173 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
174 174 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
175 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
175 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</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 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
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 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
195 195 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
196 196 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
197 197 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
198 198 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
199 199 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
200 200 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
201 201 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
202 202 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
203 203 <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</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="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
207 207 <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
208 208 <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
209 209 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
210 210 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
211 211 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
212 212 <value type="int">0</value>
213 213 <value type="int">1</value>
214 214 <value type="int">2</value>
215 215 <value type="int">3</value>
216 216 <value type="int">4</value>
217 217 <value type="int">5</value>
218 218 <value type="int">6</value>
219 219 <value type="int">7</value>
220 220 <value type="int">8</value>
221 221 <value type="int">9</value>
222 222 <value type="int">10</value>
223 223 <value type="int">11</value>
224 224 <value type="int">12</value>
225 225 <value type="int">13</value>
226 226 <value type="int">14</value>
227 227 </valuelist>
228 228 <value type="int" key="PE.EnvironmentAspect.Base">2</value>
229 229 <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
230 230 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value>
231 231 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
232 232 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value>
233 233 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
234 234 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value>
235 235 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
236 236 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>
237 237 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
238 238 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
239 239 <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
240 240 <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
241 241 <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
242 242 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
243 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
243 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">false</value>
244 244 </valuemap>
245 245 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.1">
246 246 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
247 247 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
248 248 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
249 249 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
250 250 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
251 251 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
252 252 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
253 253 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
254 254 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
255 255 <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
256 256 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
257 257 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
258 258 <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
259 259 <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
260 260 <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
261 261 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
262 262 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
263 263 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
264 264 <value type="int">0</value>
265 265 <value type="int">1</value>
266 266 <value type="int">2</value>
267 267 <value type="int">3</value>
268 268 <value type="int">4</value>
269 269 <value type="int">5</value>
270 270 <value type="int">6</value>
271 271 <value type="int">7</value>
272 272 <value type="int">8</value>
273 273 <value type="int">9</value>
274 274 <value type="int">10</value>
275 275 <value type="int">11</value>
276 276 <value type="int">12</value>
277 277 <value type="int">13</value>
278 278 <value type="int">14</value>
279 279 </valuelist>
280 <value type="int" key="PE.EnvironmentAspect.Base">-1</value>
280 <value type="int" key="PE.EnvironmentAspect.Base">2</value>
281 281 <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
282 282 <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value>
283 <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">grmon</value>
284 <value type="bool" key="ProjectExplorer.CustomExecutableRunConfiguration.UseTerminal">false</value>
285 <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">%{buildDir}</value>
286 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Run grmon</value>
283 <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">doxygen</value>
284 <value type="bool" key="ProjectExplorer.CustomExecutableRunConfiguration.UseTerminal">true</value>
285 <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">/opt/DEV_PLE/doc</value>
286 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Run doxygen</value>
287 287 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
288 288 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
289 289 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
290 <value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
291 <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
290 <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
291 <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
292 292 <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
293 293 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
294 294 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
295 295 </valuemap>
296 296 <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">2</value>
297 297 </valuemap>
298 298 </data>
299 299 <data>
300 300 <variable>ProjectExplorer.Project.TargetCount</variable>
301 301 <value type="int">1</value>
302 302 </data>
303 303 <data>
304 304 <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
305 305 <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value>
306 306 </data>
307 307 <data>
308 308 <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
309 309 <value type="int">15</value>
310 310 </data>
311 311 </qtcreator>
@@ -1,67 +1,86
1 1 #ifndef GRLIB_REGS_H_INCLUDED
2 2 #define GRLIB_REGS_H_INCLUDED
3 3
4 4 #define NB_GPTIMER 3
5 5
6 6 struct apbuart_regs_str{
7 7 volatile unsigned int data;
8 8 volatile unsigned int status;
9 9 volatile unsigned int ctrl;
10 10 volatile unsigned int scaler;
11 11 volatile unsigned int fifoDebug;
12 12 };
13 13
14 14 struct ahbuart_regs_str{
15 15 volatile unsigned int unused;
16 16 volatile unsigned int status;
17 17 volatile unsigned int ctrl;
18 18 volatile unsigned int scaler;
19 19 };
20 20
21 21 typedef struct {
22 22 volatile unsigned int counter;
23 23 volatile unsigned int reload;
24 24 volatile unsigned int ctrl;
25 25 volatile unsigned int unused;
26 26 } timer_regs_t;
27 27
28 28 typedef struct {
29 29 volatile unsigned int scaler_value;
30 30 volatile unsigned int scaler_reload;
31 31 volatile unsigned int conf;
32 32 volatile unsigned int unused0;
33 33 timer_regs_t timer[NB_GPTIMER];
34 34 } gptimer_regs_t;
35 35
36 36 typedef struct {
37 37 volatile int ctrl; // bit 0 forces the load of the coarse_time_load value and resets the fine_time
38 38 volatile int coarse_time_load;
39 39 volatile int coarse_time;
40 40 volatile int fine_time;
41 41 } time_management_regs_t;
42 42
43 43 typedef struct {
44 44 volatile int data_shaping; // 0x00 00 *** R1 R0 SP1 SP0 BW
45 45 volatile int burst_enable; // 0x04 01 *** burst f2, f1, f0 enable f3, f2, f1, f0
46 46 volatile int addr_data_f0; // 0x08 10 ***
47 47 volatile int addr_data_f1; // 0x0c 11 ***
48 48 volatile int addr_data_f2; // 0x10 100 ***
49 49 volatile int addr_data_f3; // 0x14 101 ***
50 50 volatile int status; // 0x18 110 ***
51 51 volatile int delta_snapshot; // 0x1c 111 ***
52 52 volatile int delta_f2_f1; // 0x20 0000 ***
53 53 volatile int delta_f2_f0; // 0x24 0001 ***
54 54 volatile int nb_burst_available;// 0x28 0010 ***
55 55 volatile int nb_snapshot_param; // 0x2c 0011 ***
56 56 } waveform_picker_regs_t;
57 57
58 58 typedef struct {
59 int data_shaping; // 0x00 00 *** R1 R0 SP1 SP0 BW
60 int run_burst_enable; // 0x04 01 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ]
61 int addr_data_f0; // 0x08
62 int addr_data_f1; // 0x0c
63 int addr_data_f2; // 0x10
64 int addr_data_f3; // 0x14
65 volatile int status; // 0x18
66 int delta_snapshot; // 0x1c
67 int delta_f0; // 0x20
68 int delta_f0_2; // 0x24
69 int delta_f1; // 0x28
70 int delta_f2; // 0x2c
71 int nb_data_by_buffer; // 0x30
72 int snapshot_param; // 0x34
73 int start_date; // 0x38
74 int nb_word_in_buffer; // 0x3c
75 } waveform_picker_regs_new_t;
76
77 typedef struct {
59 78 volatile int config;
60 79 volatile int status;
61 80 volatile int matrixF0_Address0;
62 81 volatile int matrixFO_Address1;
63 82 volatile int matrixF1_Address;
64 83 volatile int matrixF2_Address;
65 84 } spectral_matrix_regs_t;
66 85
67 86 #endif // GRLIB_REGS_H_INCLUDED
@@ -1,57 +1,58
1 1 #ifndef TC_HANDLER_H_INCLUDED
2 2 #define TC_HANDLER_H_INCLUDED
3 3
4 4 #include <rtems.h>
5 5 #include <leon.h>
6 6
7 7 #include "tc_load_dump_parameters.h"
8 8 #include "tc_acceptance.h"
9 9 #include "tm_lfr_tc_exe.h"
10 10 #include "wf_handler.h"
11 11
12 12 // MODE PARAMETERS
13 13 extern unsigned int maxCount;
14 14
15 15 //****
16 16 // ISR
17 17 rtems_isr commutation_isr1( rtems_vector_number vector );
18 18 rtems_isr commutation_isr2( rtems_vector_number vector );
19 19
20 20 //***********
21 21 // RTEMS TASK
22 22 rtems_task actn_task( rtems_task_argument unused );
23 23
24 24 //***********
25 25 // TC ACTIONS
26 26 int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
27 27 int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
28 28 int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id);
29 29 int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
30 30 int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
31 31 int action_update_time(ccsdsTelecommandPacket_t *TC);
32 32
33 33 // mode transition
34 34 int transition_validation(unsigned char requestedMode);
35 35 int stop_current_mode();
36 36 int enter_mode(unsigned char mode);
37 37 int enter_standby_mode();
38 38 int enter_normal_mode();
39 39 int enter_burst_mode();
40 40 int enter_sbm1_mode();
41 41 int enter_sbm2_mode();
42 42 int restart_science_tasks();
43 43 int suspend_science_tasks();
44 void launch_waveform_picker( unsigned char mode );
44 45
45 46 // other functions
46 47 void updateLFRCurrentMode();
47 48 void update_last_TC_exe(ccsdsTelecommandPacket_t *TC, unsigned char *time);
48 49 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char *time);
49 50 void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id, unsigned char *time);
50 51
51 52 extern rtems_status_code get_message_queue_id_send( rtems_id *queue_id );
52 53 extern rtems_status_code get_message_queue_id_recv( rtems_id *queue_id );
53 54
54 55 #endif // TC_HANDLER_H_INCLUDED
55 56
56 57
57 58
@@ -1,93 +1,94
1 1 #ifndef WF_HANDLER_H_INCLUDED
2 2 #define WF_HANDLER_H_INCLUDED
3 3
4 4 #include <rtems.h>
5 5 #include <grspw.h>
6 6 #include <stdio.h>
7 7 #include <math.h>
8 8
9 9 #include "fsw_params.h"
10 10 #include "fsw_spacewire.h"
11 11 #include "fsw_misc.h"
12 12
13 13 #define pi 3.1415
14 14
15 15 typedef struct ring_node
16 16 {
17 17 struct ring_node *previous;
18 18 int buffer_address;
19 19 struct ring_node *next;
20 20 unsigned int status;
21 21 } ring_node;
22 22
23 23 extern int fdSPW;
24 24
25 25 //*****************
26 26 // waveform buffers
27 27 // F0
28 28 extern volatile int wf_snap_f0[ ];
29 29 // F1
30 30 extern volatile int wf_snap_f1[ ][ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ];
31 31 // F2
32 32 extern volatile int wf_snap_f2[ ][ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ];
33 33 // F3
34 extern volatile int wf_cont_f3[ ];
35 extern volatile int wf_cont_f3_bis[ ];
34 extern volatile int wf_cont_f3_a[ ];
35 extern volatile int wf_cont_f3_b[ ];
36 36 extern char wf_cont_f3_light[ ];
37 37
38 #ifdef VHDL_DEV
39 extern waveform_picker_regs_new_t *waveform_picker_regs;
40 #else
38 41 extern waveform_picker_regs_t *waveform_picker_regs;
42 #endif
39 43 extern time_management_regs_t *time_management_regs;
40 44 extern Packet_TM_LFR_HK_t housekeeping_packet;
41 45 extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
42 46 extern struct param_local_str param_local;
43 47
44 48 extern unsigned short sequenceCounters_SCIENCE_NORMAL_BURST;
45 49 extern unsigned short sequenceCounters_SCIENCE_SBM1_SBM2;
46 50
47 51 extern rtems_id Task_id[20]; /* array of task ids */
48 52
49 53 extern unsigned char lfrCurrentMode;
50 54
51 55 rtems_isr waveforms_isr( rtems_vector_number vector );
52 56 rtems_task wfrm_task( rtems_task_argument argument );
53 57 rtems_task cwf3_task( rtems_task_argument argument );
54 58 rtems_task cwf2_task( rtems_task_argument argument );
55 59 rtems_task cwf1_task( rtems_task_argument argument );
56 60
57 61 //******************
58 62 // general functions
59 63 void init_waveforms( void );
60 64 void init_waveform_rings( void );
61 65 void reset_current_ring_nodes( void );
62 66 //
63 67 int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF );
64 68 int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF );
65 69 int init_header_continuous_wf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF );
66 70 //
67 71 int send_waveform_SWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id );
68 72 int send_waveform_CWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
69 73 int send_waveform_CWF3( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
70 74 int send_waveform_CWF3_light( volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
71 75 //
72 76 rtems_id get_pkts_queue_id( void );
73 77
74 78 //**************
75 79 // wfp registers
76 80 void set_wfp_data_shaping();
77 81 char set_wfp_delta_snapshot();
78 82 void set_wfp_burst_enable_register( unsigned char mode);
79 83 void reset_wfp_burst_enable();
80 84 void reset_wfp_status();
81 85 void reset_waveform_picker_regs();
86 void reset_new_waveform_picker_regs();
82 87
83 88 //*****************
84 89 // local parameters
85 void set_local_sbm1_nb_cwf_max( void );
86 void set_local_sbm2_nb_cwf_max( void );
87 90 void set_local_nb_interrupt_f0_MAX( void );
88 void reset_local_sbm1_nb_cwf_sent( void );
89 void reset_local_sbm2_nb_cwf_sent( void );
90 91
91 92 void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid );
92 93
93 94 #endif // WF_HANDLER_H_INCLUDED
@@ -1,87 +1,89
1 1 /** Global variables of the LFR flight software.
2 2 *
3 3 * @file
4 4 * @author P. LEROY
5 5 *
6 6 * Among global variables, there are:
7 7 * - RTEMS names and id.
8 8 * - APB configuration registers.
9 9 * - waveforms global buffers, used by the waveform picker hardware module to store data.
10 10 * - spectral matrices buffesr, used by the hardware module to store data.
11 11 * - variable related to LFR modes parameters.
12 12 * - the global HK packet buffer.
13 13 * - the global dump parameter buffer.
14 14 *
15 15 */
16 16
17 17 #include <rtems.h>
18 18 #include <grspw.h>
19 19
20 20 #include "ccsds_types.h"
21 21 #include "grlib_regs.h"
22 22 #include "fsw_params.h"
23 23
24 24 // RTEMS GLOBAL VARIABLES
25 25 rtems_name misc_name[5];
26 26 rtems_id misc_id[5];
27 27 rtems_name Task_name[20]; /* array of task names */
28 28 rtems_id Task_id[20]; /* array of task ids */
29 29 unsigned int maxCount;
30 30 int fdSPW = 0;
31 31 int fdUART = 0;
32 32 unsigned char lfrCurrentMode;
33 33
34 34 // WAVEFORMS GLOBAL VARIABLES // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes
35 35 volatile int wf_snap_f0[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ];
36 36 //
37 37 volatile int wf_snap_f1[NB_RING_NODES_F1][ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ];
38 38 //
39 39 volatile int wf_snap_f2[NB_RING_NODES_F2][ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ];
40 40 //
41 volatile int wf_cont_f3[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ];
42 volatile int wf_cont_f3_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ];
41 volatile int wf_cont_f3_a[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ];
42 volatile int wf_cont_f3_b[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ];
43 43 char wf_cont_f3_light[ NB_SAMPLES_PER_SNAPSHOT * NB_BYTES_CWF3_LIGHT_BLK ];
44 44
45 45 // SPECTRAL MATRICES GLOBAL VARIABLES
46 46 volatile int spec_mat_f0_0[ SM_HEADER + TOTAL_SIZE_SM ];
47 47 volatile int spec_mat_f0_1[ SM_HEADER + TOTAL_SIZE_SM ];
48 48 volatile int spec_mat_f0_a[ SM_HEADER + TOTAL_SIZE_SM ];
49 49 volatile int spec_mat_f0_b[ SM_HEADER + TOTAL_SIZE_SM ];
50 50 volatile int spec_mat_f0_c[ SM_HEADER + TOTAL_SIZE_SM ];
51 51 volatile int spec_mat_f0_d[ SM_HEADER + TOTAL_SIZE_SM ];
52 52 volatile int spec_mat_f0_e[ SM_HEADER + TOTAL_SIZE_SM ];
53 53 volatile int spec_mat_f0_f[ SM_HEADER + TOTAL_SIZE_SM ];
54 54 volatile int spec_mat_f0_g[ SM_HEADER + TOTAL_SIZE_SM ];
55 55 volatile int spec_mat_f0_h[ SM_HEADER + TOTAL_SIZE_SM ];
56 56 volatile int spec_mat_f0_0_bis[ SM_HEADER + TOTAL_SIZE_SM ];
57 57 volatile int spec_mat_f0_1_bis[ SM_HEADER + TOTAL_SIZE_SM ];
58 58 //
59 59 volatile int spec_mat_f1[ SM_HEADER + TOTAL_SIZE_SM ];
60 60 volatile int spec_mat_f1_bis[ SM_HEADER + TOTAL_SIZE_SM ];
61 61 //
62 62 volatile int spec_mat_f2[ SM_HEADER + TOTAL_SIZE_SM ];
63 63 volatile int spec_mat_f2_bis[ SM_HEADER + TOTAL_SIZE_SM ];
64 64
65 65 // APB CONFIGURATION REGISTERS
66 66 time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT;
67 67 gptimer_regs_t *gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER;
68 #ifdef GSA
68
69 #ifdef VHDL_DEV
70 waveform_picker_regs_new_t *waveform_picker_regs = (waveform_picker_regs_new_t*) REGS_ADDR_WAVEFORM_PICKER;
69 71 #else
70 72 waveform_picker_regs_t *waveform_picker_regs = (waveform_picker_regs_t*) REGS_ADDR_WAVEFORM_PICKER;
71 73 #endif
72 74 spectral_matrix_regs_t *spectral_matrix_regs = (spectral_matrix_regs_t*) REGS_ADDR_SPECTRAL_MATRIX;
73 75
74 76 // MODE PARAMETERS
75 77 Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
76 78 struct param_local_str param_local;
77 79
78 80 // HK PACKETS
79 81 Packet_TM_LFR_HK_t housekeeping_packet;
80 82 // sequence counters are incremented by APID (PID + CAT) and destination ID
81 83 unsigned short sequenceCounters_SCIENCE_NORMAL_BURST;
82 84 unsigned short sequenceCounters_SCIENCE_SBM1_SBM2;
83 85 unsigned short sequenceCounters_TC_EXE[SEQ_CNT_NB_DEST_ID];
84 86 spw_stats spacewire_stats;
85 87 spw_stats spacewire_stats_backup;
86 88
87 89
@@ -1,611 +1,606
1 1 /** This is the RTEMS initialization module.
2 2 *
3 3 * @file
4 4 * @author P. LEROY
5 5 *
6 6 * This module contains two very different information:
7 7 * - specific instructions to configure the compilation of the RTEMS executive
8 8 * - functions related to the fligth softwre initialization, especially the INIT RTEMS task
9 9 *
10 10 */
11 11
12 12 //*************************
13 13 // GPL reminder to be added
14 14 //*************************
15 15
16 16 #include <rtems.h>
17 17
18 18 /* configuration information */
19 19
20 20 #define CONFIGURE_INIT
21 21
22 22 #include <bsp.h> /* for device driver prototypes */
23 23
24 24 /* configuration information */
25 25
26 26 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
27 27 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
28 28
29 29 #define CONFIGURE_MAXIMUM_TASKS 20
30 30 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
31 31 #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE)
32 32 #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32
33 33 #define CONFIGURE_INIT_TASK_PRIORITY 1 // instead of 100
34 34 #define CONFIGURE_INIT_TASK_MODE (RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT)
35 35 #define CONFIGURE_MAXIMUM_DRIVERS 16
36 36 #define CONFIGURE_MAXIMUM_PERIODS 5
37 37 #define CONFIGURE_MAXIMUM_TIMERS 5 // STAT (1s), send SWF (0.3s), send CWF3 (1s)
38 38 #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 2
39 39 #ifdef PRINT_STACK_REPORT
40 40 #define CONFIGURE_STACK_CHECKER_ENABLED
41 41 #endif
42 42
43 43 #include <rtems/confdefs.h>
44 44
45 45 /* If --drvmgr was enabled during the configuration of the RTEMS kernel */
46 46 #ifdef RTEMS_DRVMGR_STARTUP
47 47 #ifdef LEON3
48 48 /* Add Timer and UART Driver */
49 49 #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
50 50 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER
51 51 #endif
52 52 #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
53 53 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART
54 54 #endif
55 55 #endif
56 56 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */
57 57 #include <drvmgr/drvmgr_confdefs.h>
58 58 #endif
59 59
60 60 #include "fsw_init.h"
61 61 #include "fsw_config.c"
62 62
63 63 rtems_task Init( rtems_task_argument ignored )
64 64 {
65 65 /** This is the RTEMS INIT taks, it the first task launched by the system.
66 66 *
67 67 * @param unused is the starting argument of the RTEMS task
68 68 *
69 69 * The INIT task create and run all other RTEMS tasks.
70 70 *
71 71 */
72 72
73 73
74 74 rtems_status_code status;
75 75 rtems_status_code status_spw;
76 76 rtems_isr_entry old_isr_handler;
77 77
78 78 BOOT_PRINTF("\n\n\n\n\n")
79 79 BOOT_PRINTF("***************************\n")
80 80 BOOT_PRINTF("** START Flight Software **\n")
81 81 BOOT_PRINTF("***************************\n")
82 82 BOOT_PRINTF("\n\n")
83 83
84 84 //send_console_outputs_on_apbuart_port();
85 85 set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE);
86 86
87 87 reset_wfp_burst_enable(); // stop the waveform picker if it was running
88 88 init_waveform_rings(); // initialize the waveform rings
89 89
90 90 init_parameter_dump();
91 91 init_local_mode_parameters();
92 92 init_housekeeping_parameters();
93 93
94 94 updateLFRCurrentMode();
95 95
96 96 BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode)
97 97
98 98 create_names(); // create all names
99 99
100 100 status = create_message_queues(); // create message queues
101 101 if (status != RTEMS_SUCCESSFUL)
102 102 {
103 103 PRINTF1("in INIT *** ERR in create_message_queues, code %d", status)
104 104 }
105 105
106 106 status = create_all_tasks(); // create all tasks
107 107 if (status != RTEMS_SUCCESSFUL)
108 108 {
109 109 PRINTF1("in INIT *** ERR in create_all_tasks, code %d", status)
110 110 }
111 111
112 112 // **************************
113 113 // <SPACEWIRE INITIALIZATION>
114 114 grspw_timecode_callback = &timecode_irq_handler;
115 115
116 116 status_spw = spacewire_open_link(); // (1) open the link
117 117 if ( status_spw != RTEMS_SUCCESSFUL )
118 118 {
119 119 PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw )
120 120 }
121 121
122 122 if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link
123 123 {
124 124 status_spw = spacewire_configure_link( fdSPW );
125 125 if ( status_spw != RTEMS_SUCCESSFUL )
126 126 {
127 127 PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw )
128 128 }
129 129 }
130 130
131 131 if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link
132 132 {
133 133 status_spw = spacewire_start_link( fdSPW );
134 134 if ( status_spw != RTEMS_SUCCESSFUL )
135 135 {
136 136 PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw )
137 137 }
138 138 }
139 139 // </SPACEWIRE INITIALIZATION>
140 140 // ***************************
141 141
142 142 status = start_all_tasks(); // start all tasks
143 143 if (status != RTEMS_SUCCESSFUL)
144 144 {
145 145 PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status)
146 146 }
147 147
148 148 // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization
149 149 status = start_recv_send_tasks();
150 150 if ( status != RTEMS_SUCCESSFUL )
151 151 {
152 152 PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status )
153 153 }
154 154
155 155 // suspend science tasks. they will be restarted later depending on the mode
156 156 status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY)
157 157 if (status != RTEMS_SUCCESSFUL)
158 158 {
159 159 PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status)
160 160 }
161 161
162 162 #ifdef GSA
163 163 // mask IRQ lines
164 164 LEON_Mask_interrupt( IRQ_SM );
165 165 LEON_Mask_interrupt( IRQ_WF );
166 166 // Spectral Matrices simulator
167 167 configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR,
168 168 IRQ_SPARC_SM, spectral_matrices_isr );
169 169 // WaveForms
170 170 configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR, CLKDIV_WF_SIMULATOR,
171 171 IRQ_SPARC_WF, waveforms_simulator_isr );
172 172 #else
173 173 // configure IRQ handling for the waveform picker unit
174 174 status = rtems_interrupt_catch( waveforms_isr,
175 175 IRQ_SPARC_WAVEFORM_PICKER,
176 176 &old_isr_handler) ;
177 177 #endif
178 178
179 179 // if the spacewire link is not up then send an event to the SPIQ task for link recovery
180 180 if ( status_spw != RTEMS_SUCCESSFUL )
181 181 {
182 182 status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT );
183 183 if ( status != RTEMS_SUCCESSFUL ) {
184 184 PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status )
185 185 }
186 186 }
187 187
188 188 BOOT_PRINTF("delete INIT\n")
189 189
190 190 status = rtems_task_delete(RTEMS_SELF);
191 191
192 192 }
193 193
194 194 void init_local_mode_parameters( void )
195 195 {
196 196 /** This function initialize the param_local global variable with default values.
197 197 *
198 198 */
199 199
200 200 unsigned int i;
201 201
202 202 // LOCAL PARAMETERS
203 set_local_sbm1_nb_cwf_max();
204 set_local_sbm2_nb_cwf_max();
205 203 set_local_nb_interrupt_f0_MAX();
206 204
207 205 BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max)
208 206 BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max)
209 207 BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX)
210 208
211 reset_local_sbm1_nb_cwf_sent();
212 reset_local_sbm2_nb_cwf_sent();
213
214 209 // init sequence counters
215 210
216 211 for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++)
217 212 {
218 213 sequenceCounters_TC_EXE[i] = 0x00;
219 214 }
220 215 sequenceCounters_SCIENCE_NORMAL_BURST = 0x00;
221 216 sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00;
222 217 }
223 218
224 219 void create_names( void ) // create all names for tasks and queues
225 220 {
226 221 /** This function creates all RTEMS names used in the software for tasks and queues.
227 222 *
228 223 * @return RTEMS directive status codes:
229 224 * - RTEMS_SUCCESSFUL - successful completion
230 225 *
231 226 */
232 227
233 228 // task names
234 229 Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' );
235 230 Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' );
236 231 Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' );
237 232 Task_name[TASKID_SMIQ] = rtems_build_name( 'S', 'M', 'I', 'Q' );
238 233 Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' );
239 234 Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' );
240 235 Task_name[TASKID_BPF0] = rtems_build_name( 'B', 'P', 'F', '0' );
241 236 Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' );
242 237 Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' );
243 238 Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' );
244 239 Task_name[TASKID_MATR] = rtems_build_name( 'M', 'A', 'T', 'R' );
245 240 Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' );
246 241 Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' );
247 242 Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' );
248 243 Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' );
249 244 Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' );
250 245
251 246 // rate monotonic period names
252 247 name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' );
253 248
254 249 misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' );
255 250 misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' );
256 251 }
257 252
258 253 int create_all_tasks( void ) // create all tasks which run in the software
259 254 {
260 255 /** This function creates all RTEMS tasks used in the software.
261 256 *
262 257 * @return RTEMS directive status codes:
263 258 * - RTEMS_SUCCESSFUL - task created successfully
264 259 * - RTEMS_INVALID_ADDRESS - id is NULL
265 260 * - RTEMS_INVALID_NAME - invalid task name
266 261 * - RTEMS_INVALID_PRIORITY - invalid task priority
267 262 * - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured
268 263 * - RTEMS_TOO_MANY - too many tasks created
269 264 * - RTEMS_UNSATISFIED - not enough memory for stack/FP context
270 265 * - RTEMS_TOO_MANY - too many global objects
271 266 *
272 267 */
273 268
274 269 rtems_status_code status;
275 270
276 271 // RECV
277 272 status = rtems_task_create(
278 273 Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE,
279 274 RTEMS_DEFAULT_MODES,
280 275 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV]
281 276 );
282 277
283 278 if (status == RTEMS_SUCCESSFUL) // ACTN
284 279 {
285 280 status = rtems_task_create(
286 281 Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE,
287 282 RTEMS_DEFAULT_MODES,
288 283 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN]
289 284 );
290 285 }
291 286 if (status == RTEMS_SUCCESSFUL) // SPIQ
292 287 {
293 288 status = rtems_task_create(
294 289 Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE,
295 290 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
296 291 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ]
297 292 );
298 293 }
299 294 if (status == RTEMS_SUCCESSFUL) // SMIQ
300 295 {
301 296 status = rtems_task_create(
302 297 Task_name[TASKID_SMIQ], TASK_PRIORITY_SMIQ, RTEMS_MINIMUM_STACK_SIZE,
303 298 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
304 299 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SMIQ]
305 300 );
306 301 }
307 302 if (status == RTEMS_SUCCESSFUL) // STAT
308 303 {
309 304 status = rtems_task_create(
310 305 Task_name[TASKID_STAT], TASK_PRIORITY_STAT, RTEMS_MINIMUM_STACK_SIZE,
311 306 RTEMS_DEFAULT_MODES,
312 307 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT]
313 308 );
314 309 }
315 310 if (status == RTEMS_SUCCESSFUL) // AVF0
316 311 {
317 312 status = rtems_task_create(
318 313 Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE,
319 314 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
320 315 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0]
321 316 );
322 317 }
323 318 if (status == RTEMS_SUCCESSFUL) // BPF0
324 319 {
325 320 status = rtems_task_create(
326 321 Task_name[TASKID_BPF0], TASK_PRIORITY_BPF0, RTEMS_MINIMUM_STACK_SIZE,
327 322 RTEMS_DEFAULT_MODES,
328 323 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_BPF0]
329 324 );
330 325 }
331 326 if (status == RTEMS_SUCCESSFUL) // WFRM
332 327 {
333 328 status = rtems_task_create(
334 329 Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE,
335 330 RTEMS_DEFAULT_MODES,
336 331 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM]
337 332 );
338 333 }
339 334 if (status == RTEMS_SUCCESSFUL) // DUMB
340 335 {
341 336 status = rtems_task_create(
342 337 Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE,
343 338 RTEMS_DEFAULT_MODES,
344 339 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB]
345 340 );
346 341 }
347 342 if (status == RTEMS_SUCCESSFUL) // HOUS
348 343 {
349 344 status = rtems_task_create(
350 345 Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE,
351 346 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
352 347 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS]
353 348 );
354 349 }
355 350 if (status == RTEMS_SUCCESSFUL) // MATR
356 351 {
357 352 status = rtems_task_create(
358 353 Task_name[TASKID_MATR], TASK_PRIORITY_MATR, RTEMS_MINIMUM_STACK_SIZE,
359 354 RTEMS_DEFAULT_MODES,
360 355 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_MATR]
361 356 );
362 357 }
363 358 if (status == RTEMS_SUCCESSFUL) // CWF3
364 359 {
365 360 status = rtems_task_create(
366 361 Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE,
367 362 RTEMS_DEFAULT_MODES,
368 363 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF3]
369 364 );
370 365 }
371 366 if (status == RTEMS_SUCCESSFUL) // CWF2
372 367 {
373 368 status = rtems_task_create(
374 369 Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE,
375 370 RTEMS_DEFAULT_MODES,
376 371 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF2]
377 372 );
378 373 }
379 374 if (status == RTEMS_SUCCESSFUL) // CWF1
380 375 {
381 376 status = rtems_task_create(
382 377 Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE,
383 378 RTEMS_DEFAULT_MODES,
384 379 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF1]
385 380 );
386 381 }
387 382 if (status == RTEMS_SUCCESSFUL) // SEND
388 383 {
389 384 status = rtems_task_create(
390 385 Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE,
391 386 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
392 387 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SEND]
393 388 );
394 389 }
395 390 if (status == RTEMS_SUCCESSFUL) // WTDG
396 391 {
397 392 status = rtems_task_create(
398 393 Task_name[TASKID_WTDG], TASK_PRIORITY_WTDG, RTEMS_MINIMUM_STACK_SIZE,
399 394 RTEMS_DEFAULT_MODES,
400 395 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_WTDG]
401 396 );
402 397 }
403 398
404 399 return status;
405 400 }
406 401
407 402 int start_recv_send_tasks( void )
408 403 {
409 404 rtems_status_code status;
410 405
411 406 status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 );
412 407 if (status!=RTEMS_SUCCESSFUL) {
413 408 BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n")
414 409 }
415 410
416 411 if (status == RTEMS_SUCCESSFUL) // SEND
417 412 {
418 413 status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 );
419 414 if (status!=RTEMS_SUCCESSFUL) {
420 415 BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n")
421 416 }
422 417 }
423 418
424 419 return status;
425 420 }
426 421
427 422 int start_all_tasks( void ) // start all tasks except SEND RECV and HOUS
428 423 {
429 424 /** This function starts all RTEMS tasks used in the software.
430 425 *
431 426 * @return RTEMS directive status codes:
432 427 * - RTEMS_SUCCESSFUL - ask started successfully
433 428 * - RTEMS_INVALID_ADDRESS - invalid task entry point
434 429 * - RTEMS_INVALID_ID - invalid task id
435 430 * - RTEMS_INCORRECT_STATE - task not in the dormant state
436 431 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot start remote task
437 432 *
438 433 */
439 434 // starts all the tasks fot eh flight software
440 435
441 436 rtems_status_code status;
442 437
443 438 status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 );
444 439 if (status!=RTEMS_SUCCESSFUL) {
445 440 BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n")
446 441 }
447 442
448 443 if (status == RTEMS_SUCCESSFUL) // WTDG
449 444 {
450 445 status = rtems_task_start( Task_id[TASKID_WTDG], wtdg_task, 1 );
451 446 if (status!=RTEMS_SUCCESSFUL) {
452 447 BOOT_PRINTF("in INIT *** Error starting TASK_WTDG\n")
453 448 }
454 449 }
455 450
456 451 if (status == RTEMS_SUCCESSFUL) // SMIQ
457 452 {
458 453 status = rtems_task_start( Task_id[TASKID_SMIQ], smiq_task, 1 );
459 454 if (status!=RTEMS_SUCCESSFUL) {
460 455 BOOT_PRINTF("in INIT *** Error starting TASK_BPPR\n")
461 456 }
462 457 }
463 458
464 459 if (status == RTEMS_SUCCESSFUL) // ACTN
465 460 {
466 461 status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 );
467 462 if (status!=RTEMS_SUCCESSFUL) {
468 463 BOOT_PRINTF("in INIT *** Error starting TASK_ACTN\n")
469 464 }
470 465 }
471 466
472 467 if (status == RTEMS_SUCCESSFUL) // STAT
473 468 {
474 469 status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 );
475 470 if (status!=RTEMS_SUCCESSFUL) {
476 471 BOOT_PRINTF("in INIT *** Error starting TASK_STAT\n")
477 472 }
478 473 }
479 474
480 475 if (status == RTEMS_SUCCESSFUL) // AVF0
481 476 {
482 477 status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, 1 );
483 478 if (status!=RTEMS_SUCCESSFUL) {
484 479 BOOT_PRINTF("in INIT *** Error starting TASK_AVF0\n")
485 480 }
486 481 }
487 482
488 483 if (status == RTEMS_SUCCESSFUL) // BPF0
489 484 {
490 485 status = rtems_task_start( Task_id[TASKID_BPF0], bpf0_task, 1 );
491 486 if (status!=RTEMS_SUCCESSFUL) {
492 487 BOOT_PRINTF("in INIT *** Error starting TASK_BPF0\n")
493 488 }
494 489 }
495 490
496 491 if (status == RTEMS_SUCCESSFUL) // WFRM
497 492 {
498 493 status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 );
499 494 if (status!=RTEMS_SUCCESSFUL) {
500 495 BOOT_PRINTF("in INIT *** Error starting TASK_WFRM\n")
501 496 }
502 497 }
503 498
504 499 if (status == RTEMS_SUCCESSFUL) // DUMB
505 500 {
506 501 status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 );
507 502 if (status!=RTEMS_SUCCESSFUL) {
508 503 BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n")
509 504 }
510 505 }
511 506
512 507 if (status == RTEMS_SUCCESSFUL) // HOUS
513 508 {
514 509 status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 );
515 510 if (status!=RTEMS_SUCCESSFUL) {
516 511 BOOT_PRINTF("in INIT *** Error starting TASK_HOUS\n")
517 512 }
518 513 }
519 514
520 515 if (status == RTEMS_SUCCESSFUL) // MATR
521 516 {
522 517 status = rtems_task_start( Task_id[TASKID_MATR], matr_task, 1 );
523 518 if (status!=RTEMS_SUCCESSFUL) {
524 519 BOOT_PRINTF("in INIT *** Error starting TASK_MATR\n")
525 520 }
526 521 }
527 522
528 523 if (status == RTEMS_SUCCESSFUL) // CWF3
529 524 {
530 525 status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 );
531 526 if (status!=RTEMS_SUCCESSFUL) {
532 527 BOOT_PRINTF("in INIT *** Error starting TASK_CWF3\n")
533 528 }
534 529 }
535 530
536 531 if (status == RTEMS_SUCCESSFUL) // CWF2
537 532 {
538 533 status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 );
539 534 if (status!=RTEMS_SUCCESSFUL) {
540 535 BOOT_PRINTF("in INIT *** Error starting TASK_CWF2\n")
541 536 }
542 537 }
543 538
544 539 if (status == RTEMS_SUCCESSFUL) // CWF1
545 540 {
546 541 status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 );
547 542 if (status!=RTEMS_SUCCESSFUL) {
548 543 BOOT_PRINTF("in INIT *** Error starting TASK_CWF1\n")
549 544 }
550 545 }
551 546 return status;
552 547 }
553 548
554 549 rtems_status_code create_message_queues( void ) // create the two message queues used in the software
555 550 {
556 551 rtems_status_code status_recv;
557 552 rtems_status_code status_send;
558 553 rtems_status_code ret;
559 554 rtems_id queue_id;
560 555
561 556 // create the queue for handling valid TCs
562 557 status_recv = rtems_message_queue_create( misc_name[QUEUE_RECV],
563 558 ACTION_MSG_QUEUE_COUNT, CCSDS_TC_PKT_MAX_SIZE,
564 559 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
565 560 if ( status_recv != RTEMS_SUCCESSFUL ) {
566 561 PRINTF1("in create_message_queues *** ERR creating QUEU queue, %d\n", status_recv)
567 562 }
568 563
569 564 // create the queue for handling TM packet sending
570 565 status_send = rtems_message_queue_create( misc_name[QUEUE_SEND],
571 566 ACTION_MSG_PKTS_COUNT, ACTION_MSG_PKTS_MAX_SIZE,
572 567 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
573 568 if ( status_send != RTEMS_SUCCESSFUL ) {
574 569 PRINTF1("in create_message_queues *** ERR creating PKTS queue, %d\n", status_send)
575 570 }
576 571
577 572 if ( status_recv != RTEMS_SUCCESSFUL )
578 573 {
579 574 ret = status_recv;
580 575 }
581 576 else
582 577 {
583 578 ret = status_send;
584 579 }
585 580
586 581 return ret;
587 582 }
588 583
589 584 rtems_status_code get_message_queue_id_send( rtems_id *queue_id )
590 585 {
591 586 rtems_status_code status;
592 587 rtems_name queue_name;
593 588
594 589 queue_name = rtems_build_name( 'Q', '_', 'S', 'D' );
595 590
596 591 status = rtems_message_queue_ident( queue_name, 0, queue_id );
597 592
598 593 return status;
599 594 }
600 595
601 596 rtems_status_code get_message_queue_id_recv( rtems_id *queue_id )
602 597 {
603 598 rtems_status_code status;
604 599 rtems_name queue_name;
605 600
606 601 queue_name = rtems_build_name( 'Q', '_', 'R', 'V' );
607 602
608 603 status = rtems_message_queue_ident( queue_name, 0, queue_id );
609 604
610 605 return status;
611 606 }
@@ -1,868 +1,832
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 unsigned char time[6];
35 35 rtems_id queue_rcv_id;
36 36 rtems_id queue_snd_id;
37 37
38 38 status = get_message_queue_id_recv( &queue_rcv_id );
39 39 if (status != RTEMS_SUCCESSFUL)
40 40 {
41 41 PRINTF1("in ACTN *** ERR get_message_queue_id_recv %d\n", status)
42 42 }
43 43
44 44 status = get_message_queue_id_send( &queue_snd_id );
45 45 if (status != RTEMS_SUCCESSFUL)
46 46 {
47 47 PRINTF1("in ACTN *** ERR get_message_queue_id_send %d\n", status)
48 48 }
49 49
50 50 result = LFR_SUCCESSFUL;
51 51 subtype = 0; // subtype of the current TC packet
52 52
53 53 BOOT_PRINTF("in ACTN *** \n")
54 54
55 55 while(1)
56 56 {
57 57 status = rtems_message_queue_receive( queue_rcv_id, (char*) &TC, &size,
58 58 RTEMS_WAIT, RTEMS_NO_TIMEOUT);
59 59 getTime( time ); // set time to the current time
60 60 if (status!=RTEMS_SUCCESSFUL)
61 61 {
62 62 PRINTF1("ERR *** in task ACTN *** error receiving a message, code %d \n", status)
63 63 }
64 64 else
65 65 {
66 66 subtype = TC.serviceSubType;
67 67 switch(subtype)
68 68 {
69 69 case TC_SUBTYPE_RESET:
70 70 result = action_reset( &TC, queue_snd_id, time );
71 71 close_action( &TC, result, queue_snd_id, time );
72 72 break;
73 73 //
74 74 case TC_SUBTYPE_LOAD_COMM:
75 75 result = action_load_common_par( &TC );
76 76 close_action( &TC, result, queue_snd_id, time );
77 77 break;
78 78 //
79 79 case TC_SUBTYPE_LOAD_NORM:
80 80 result = action_load_normal_par( &TC, queue_snd_id, time );
81 81 close_action( &TC, result, queue_snd_id, time );
82 82 break;
83 83 //
84 84 case TC_SUBTYPE_LOAD_BURST:
85 85 result = action_load_burst_par( &TC, queue_snd_id, time );
86 86 close_action( &TC, result, queue_snd_id, time );
87 87 break;
88 88 //
89 89 case TC_SUBTYPE_LOAD_SBM1:
90 90 result = action_load_sbm1_par( &TC, queue_snd_id, time );
91 91 close_action( &TC, result, queue_snd_id, time );
92 92 break;
93 93 //
94 94 case TC_SUBTYPE_LOAD_SBM2:
95 95 result = action_load_sbm2_par( &TC, queue_snd_id, time );
96 96 close_action( &TC, result, queue_snd_id, time );
97 97 break;
98 98 //
99 99 case TC_SUBTYPE_DUMP:
100 100 result = action_dump_par( queue_snd_id );
101 101 close_action( &TC, result, queue_snd_id, time );
102 102 break;
103 103 //
104 104 case TC_SUBTYPE_ENTER:
105 105 result = action_enter_mode( &TC, queue_snd_id, time );
106 106 close_action( &TC, result, queue_snd_id, time );
107 107 break;
108 108 //
109 109 case TC_SUBTYPE_UPDT_INFO:
110 110 result = action_update_info( &TC, queue_snd_id );
111 111 close_action( &TC, result, queue_snd_id, time );
112 112 break;
113 113 //
114 114 case TC_SUBTYPE_EN_CAL:
115 115 result = action_enable_calibration( &TC, queue_snd_id, time );
116 116 close_action( &TC, result, queue_snd_id, time );
117 117 break;
118 118 //
119 119 case TC_SUBTYPE_DIS_CAL:
120 120 result = action_disable_calibration( &TC, queue_snd_id, time );
121 121 close_action( &TC, result, queue_snd_id, time );
122 122 break;
123 123 //
124 124 case TC_SUBTYPE_UPDT_TIME:
125 125 result = action_update_time( &TC );
126 126 close_action( &TC, result, queue_snd_id, time );
127 127 break;
128 128 //
129 129 default:
130 130 break;
131 131 }
132 132 }
133 133 }
134 134 }
135 135
136 136 //***********
137 137 // TC ACTIONS
138 138
139 139 int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
140 140 {
141 141 /** This function executes specific actions when a TC_LFR_RESET TeleCommand has been received.
142 142 *
143 143 * @param TC points to the TeleCommand packet that is being processed
144 144 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
145 145 *
146 146 */
147 147
148 148 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
149 149 return LFR_DEFAULT;
150 150 }
151 151
152 152 int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
153 153 {
154 154 /** This function executes specific actions when a TC_LFR_ENTER_MODE TeleCommand has been received.
155 155 *
156 156 * @param TC points to the TeleCommand packet that is being processed
157 157 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
158 158 *
159 159 */
160 160
161 161 rtems_status_code status;
162 162 unsigned char requestedMode;
163 163
164 164 requestedMode = TC->dataAndCRC[1];
165 165
166 166 if ( (requestedMode != LFR_MODE_STANDBY)
167 167 && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST)
168 168 && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) )
169 169 {
170 170 status = RTEMS_UNSATISFIED;
171 171 send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_LFR_MODE, requestedMode, time );
172 172 }
173 173 else
174 174 {
175 175 printf("try to enter mode %d\n", requestedMode);
176 176
177 177 #ifdef PRINT_TASK_STATISTICS
178 178 if (requestedMode != LFR_MODE_STANDBY)
179 179 {
180 180 rtems_cpu_usage_reset();
181 181 maxCount = 0;
182 182 }
183 183 #endif
184 184
185 185 status = transition_validation(requestedMode);
186 186
187 187 if ( status == LFR_SUCCESSFUL ) {
188 188 if ( lfrCurrentMode != LFR_MODE_STANDBY)
189 189 {
190 190 status = stop_current_mode();
191 191 }
192 192 if (status != RTEMS_SUCCESSFUL)
193 193 {
194 194 PRINTF("ERR *** in action_enter *** stop_current_mode\n")
195 195 }
196 196 status = enter_mode( requestedMode );
197 197 }
198 198 else
199 199 {
200 200 PRINTF("ERR *** in action_enter *** transition rejected\n")
201 201 send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
202 202 }
203 203 }
204 204
205 205 return status;
206 206 }
207 207
208 208 int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
209 209 {
210 210 /** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received.
211 211 *
212 212 * @param TC points to the TeleCommand packet that is being processed
213 213 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
214 214 *
215 215 * @return LFR directive status code:
216 216 * - LFR_DEFAULT
217 217 * - LFR_SUCCESSFUL
218 218 *
219 219 */
220 220
221 221 unsigned int val;
222 222 int result;
223 223
224 224 result = LFR_SUCCESSFUL;
225 225
226 226 val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256
227 227 + housekeeping_packet.hk_lfr_update_info_tc_cnt[1];
228 228 val++;
229 229 housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8);
230 230 housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val);
231 231
232 232 return result;
233 233 }
234 234
235 235 int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
236 236 {
237 237 /** This function executes specific actions when a TC_LFR_ENABLE_CALIBRATION TeleCommand has been received.
238 238 *
239 239 * @param TC points to the TeleCommand packet that is being processed
240 240 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
241 241 *
242 242 */
243 243
244 244 int result;
245 245 unsigned char lfrMode;
246 246
247 247 result = LFR_DEFAULT;
248 248 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
249 249
250 250 if ( (lfrMode == LFR_MODE_STANDBY) || (lfrMode == LFR_MODE_BURST) || (lfrMode == LFR_MODE_SBM2) ) {
251 251 send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
252 252 result = LFR_DEFAULT;
253 253 }
254 254 else {
255 255 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
256 256 result = LFR_DEFAULT;
257 257 }
258 258 return result;
259 259 }
260 260
261 261 int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
262 262 {
263 263 /** This function executes specific actions when a TC_LFR_DISABLE_CALIBRATION TeleCommand has been received.
264 264 *
265 265 * @param TC points to the TeleCommand packet that is being processed
266 266 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
267 267 *
268 268 */
269 269
270 270 int result;
271 271 unsigned char lfrMode;
272 272
273 273 result = LFR_DEFAULT;
274 274 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
275 275
276 276 if ( (lfrMode == LFR_MODE_STANDBY) || (lfrMode == LFR_MODE_BURST) || (lfrMode == LFR_MODE_SBM2) ) {
277 277 send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
278 278 result = LFR_DEFAULT;
279 279 }
280 280 else {
281 281 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
282 282 result = LFR_DEFAULT;
283 283 }
284 284 return result;
285 285 }
286 286
287 287 int action_update_time(ccsdsTelecommandPacket_t *TC)
288 288 {
289 289 /** This function executes specific actions when a TC_LFR_UPDATE_TIME TeleCommand has been received.
290 290 *
291 291 * @param TC points to the TeleCommand packet that is being processed
292 292 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
293 293 *
294 294 * @return LFR_SUCCESSFUL
295 295 *
296 296 */
297 297
298 298 unsigned int val;
299 299
300 300 time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24)
301 301 + (TC->dataAndCRC[1] << 16)
302 302 + (TC->dataAndCRC[2] << 8)
303 303 + TC->dataAndCRC[3];
304 304 val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256
305 305 + housekeeping_packet.hk_lfr_update_time_tc_cnt[1];
306 306 val++;
307 307 housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8);
308 308 housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val);
309 309 time_management_regs->ctrl = time_management_regs->ctrl | 1;
310 310
311 311 return LFR_SUCCESSFUL;
312 312 }
313 313
314 314 //*******************
315 315 // ENTERING THE MODES
316 316
317 317 int transition_validation(unsigned char requestedMode)
318 318 {
319 319 /** This function checks the validity of the transition requested by the TC_LFR_ENTER_MODE.
320 320 *
321 321 * @param requestedMode is the mode requested by the TC_LFR_ENTER_MODE
322 322 *
323 323 * @return LFR directive status codes:
324 324 * - LFR_SUCCESSFUL - the transition is authorized
325 325 * - LFR_DEFAULT - the transition is not authorized
326 326 *
327 327 */
328 328
329 329 int status;
330 330
331 331 switch (requestedMode)
332 332 {
333 333 case LFR_MODE_STANDBY:
334 334 if ( lfrCurrentMode == LFR_MODE_STANDBY ) {
335 335 status = LFR_DEFAULT;
336 336 }
337 337 else
338 338 {
339 339 status = LFR_SUCCESSFUL;
340 340 }
341 341 break;
342 342 case LFR_MODE_NORMAL:
343 343 if ( lfrCurrentMode == LFR_MODE_NORMAL ) {
344 344 status = LFR_DEFAULT;
345 345 }
346 346 else {
347 347 status = LFR_SUCCESSFUL;
348 348 }
349 349 break;
350 350 case LFR_MODE_BURST:
351 351 if ( lfrCurrentMode == LFR_MODE_BURST ) {
352 352 status = LFR_DEFAULT;
353 353 }
354 354 else {
355 355 status = LFR_SUCCESSFUL;
356 356 }
357 357 break;
358 358 case LFR_MODE_SBM1:
359 359 if ( lfrCurrentMode == LFR_MODE_SBM1 ) {
360 360 status = LFR_DEFAULT;
361 361 }
362 362 else {
363 363 status = LFR_SUCCESSFUL;
364 364 }
365 365 break;
366 366 case LFR_MODE_SBM2:
367 367 if ( lfrCurrentMode == LFR_MODE_SBM2 ) {
368 368 status = LFR_DEFAULT;
369 369 }
370 370 else {
371 371 status = LFR_SUCCESSFUL;
372 372 }
373 373 break;
374 374 default:
375 375 status = LFR_DEFAULT;
376 376 break;
377 377 }
378 378
379 379 return status;
380 380 }
381 381
382 382 int stop_current_mode()
383 383 {
384 384 /** This function stops the current mode by masking interrupt lines and suspending science tasks.
385 385 *
386 386 * @return RTEMS directive status codes:
387 387 * - RTEMS_SUCCESSFUL - task restarted successfully
388 388 * - RTEMS_INVALID_ID - task id invalid
389 389 * - RTEMS_ALREADY_SUSPENDED - task already suspended
390 390 *
391 391 */
392 392
393 393 rtems_status_code status;
394 394
395 395 status = RTEMS_SUCCESSFUL;
396 396
397 397 #ifdef GSA
398 398 LEON_Mask_interrupt( IRQ_WF ); // mask waveform interrupt (coming from the timer VHDL IP)
399 399 LEON_Clear_interrupt( IRQ_WF ); // clear waveform interrupt (coming from the timer VHDL IP)
400 400 timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR );
401 401 #else
402 402 // mask interruptions
403 403 LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt
404 404 LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // mask spectral matrix interrupt
405 405 // reset registers
406 406 reset_wfp_burst_enable(); // reset burst and enable bits
407 407 reset_wfp_status(); // reset all the status bits
408 408 // creal interruptions
409 409 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt
410 410 LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectarl matrix interrupt
411 411 #endif
412 412 //**********************
413 413 // suspend several tasks
414 414 if (lfrCurrentMode != LFR_MODE_STANDBY) {
415 415 status = suspend_science_tasks();
416 416 }
417 417
418 418 if (status != RTEMS_SUCCESSFUL)
419 419 {
420 420 PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status)
421 421 }
422 422
423 423 return status;
424 424 }
425 425
426 426 int enter_mode(unsigned char mode )
427 427 {
428 428 /** This function is launched after a mode transition validation.
429 429 *
430 430 * @param mode is the mode in which LFR will be put.
431 431 *
432 432 * @return RTEMS directive status codes:
433 433 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
434 434 * - RTEMS_NOT_SATISFIED - the mode has not been entered successfully
435 435 *
436 436 */
437 437
438 438 rtems_status_code status;
439 439
440 440 status = RTEMS_UNSATISFIED;
441 441
442 442 housekeeping_packet.lfr_status_word[0] = (unsigned char) ((mode << 4) + 0x0d);
443 443 updateLFRCurrentMode();
444 444
445 445 switch(mode){
446 446 case LFR_MODE_STANDBY:
447 447 status = enter_standby_mode( );
448 448 break;
449 449 case LFR_MODE_NORMAL:
450 450 status = enter_normal_mode( );
451 451 break;
452 452 case LFR_MODE_BURST:
453 453 status = enter_burst_mode( );
454 454 break;
455 455 case LFR_MODE_SBM1:
456 456 status = enter_sbm1_mode( );
457 457 break;
458 458 case LFR_MODE_SBM2:
459 459 status = enter_sbm2_mode( );
460 460 break;
461 461 default:
462 462 status = RTEMS_UNSATISFIED;
463 463 }
464 464
465 465 if (status != RTEMS_SUCCESSFUL)
466 466 {
467 467 PRINTF("in enter_mode *** ERR\n")
468 468 status = RTEMS_UNSATISFIED;
469 469 }
470 470
471 471 return status;
472 472 }
473 473
474 474 int enter_standby_mode()
475 475 {
476 476 /** This function is used to enter the STANDBY mode.
477 477 *
478 478 * @return RTEMS directive status codes:
479 479 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
480 480 *
481 481 */
482 482
483 483 PRINTF1("maxCount = %d\n", maxCount)
484 484
485 485 #ifdef PRINT_TASK_STATISTICS
486 486 rtems_cpu_usage_report();
487 487 #endif
488 488
489 489 #ifdef PRINT_STACK_REPORT
490 490 rtems_stack_checker_report_usage();
491 491 #endif
492 492
493 493 return LFR_SUCCESSFUL;
494 494 }
495 495
496 496 int enter_normal_mode()
497 497 {
498 498 rtems_status_code status;
499 499
500 500 status = restart_science_tasks();
501 501
502 502 #ifdef GSA
503 timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR );
504 503 timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR );
505 LEON_Clear_interrupt( IRQ_WF );
506 LEON_Unmask_interrupt( IRQ_WF );
507 504 //
508 505 set_local_nb_interrupt_f0_MAX();
509 506 LEON_Clear_interrupt( IRQ_SM ); // the IRQ_SM seems to be incompatible with the IRQ_WF on the xilinx board
510 507 LEON_Unmask_interrupt( IRQ_SM );
511 508 #else
512 //****************
513 // waveform picker
514 reset_waveform_picker_regs();
515 set_wfp_burst_enable_register(LFR_MODE_NORMAL);
516 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
517 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
518 //****************
519 // spectral matrix
509 launch_waveform_picker( LFR_MODE_SBM1 );
520 510 #endif
521 511
522 512 return status;
523 513 }
524 514
525 515 int enter_burst_mode()
526 516 {
527 517 /** This function is used to enter the STANDBY mode.
528 518 *
529 519 * @return RTEMS directive status codes:
530 520 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
531 521 * - RTEMS_INVALID_ID - task id invalid
532 522 * - RTEMS_INCORRECT_STATE - task never started
533 523 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
534 524 *
535 525 */
536 526
537 527 rtems_status_code status;
538 528
539 529 status = restart_science_tasks();
540 530
541 #ifdef GSA
542 LEON_Unmask_interrupt( IRQ_SM );
543 #else
544 reset_waveform_picker_regs();
545 set_wfp_burst_enable_register(LFR_MODE_BURST);
546 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
547 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
548 #endif
531 launch_waveform_picker( LFR_MODE_BURST );
549 532
550 533 return status;
551 534 }
552 535
553 536 int enter_sbm1_mode()
554 537 {
555 538 /** This function is used to enter the SBM1 mode.
556 539 *
557 540 * @return RTEMS directive status codes:
558 541 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
559 542 * - RTEMS_INVALID_ID - task id invalid
560 543 * - RTEMS_INCORRECT_STATE - task never started
561 544 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
562 545 *
563 546 */
564 547
565 548 rtems_status_code status;
566 549
567 550 status = restart_science_tasks();
568 551
569 set_local_sbm1_nb_cwf_max();
570
571 reset_local_sbm1_nb_cwf_sent();
572
573 #ifdef GSA
574 LEON_Unmask_interrupt( IRQ_SM );
575 #else
576 //****************
577 // waveform picker
578 reset_current_ring_nodes();
579 reset_waveform_picker_regs();
580 set_wfp_burst_enable_register(LFR_MODE_SBM1);
581 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
582 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
583 #endif
552 launch_waveform_picker( LFR_MODE_SBM1 );
584 553
585 554 return status;
586 555 }
587 556
588 557 int enter_sbm2_mode()
589 558 {
590 559 /** This function is used to enter the SBM2 mode.
591 560 *
592 561 * @return RTEMS directive status codes:
593 562 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
594 563 * - RTEMS_INVALID_ID - task id invalid
595 564 * - RTEMS_INCORRECT_STATE - task never started
596 565 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
597 566 *
598 567 */
599 568
600 569 rtems_status_code status;
601 570
602 571 status = restart_science_tasks();
603 572
604 set_local_sbm2_nb_cwf_max();
605
606 reset_local_sbm2_nb_cwf_sent();
607
608 #ifdef GSA
609 LEON_Unmask_interrupt( IRQ_SM );
610 #else
611 //****************
612 // waveform picker
613 reset_current_ring_nodes();
614 reset_waveform_picker_regs();
615 set_wfp_burst_enable_register(LFR_MODE_SBM2);
616 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
617 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
618 #endif
573 launch_waveform_picker( LFR_MODE_SBM2 );
619 574
620 575 return status;
621 576 }
622 577
623 578 int restart_science_tasks()
624 579 {
625 580 /** This function is used to restart all science tasks.
626 581 *
627 582 * @return RTEMS directive status codes:
628 583 * - RTEMS_SUCCESSFUL - task restarted successfully
629 584 * - RTEMS_INVALID_ID - task id invalid
630 585 * - RTEMS_INCORRECT_STATE - task never started
631 586 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
632 587 *
633 588 * Science tasks are AVF0, BPF0, WFRM, CWF3, CW2, CWF1
634 589 *
635 590 */
636 591
637 592 rtems_status_code status[6];
638 593 rtems_status_code ret;
639 594
640 595 ret = RTEMS_SUCCESSFUL;
641 596
642 597 status[0] = rtems_task_restart( Task_id[TASKID_AVF0], 1 );
643 598 if (status[0] != RTEMS_SUCCESSFUL)
644 599 {
645 600 PRINTF1("in restart_science_task *** 0 ERR %d\n", status[0])
646 601 }
647 602
648 603 status[1] = rtems_task_restart( Task_id[TASKID_BPF0],1 );
649 604 if (status[1] != RTEMS_SUCCESSFUL)
650 605 {
651 606 PRINTF1("in restart_science_task *** 1 ERR %d\n", status[1])
652 607 }
653 608
654 609 status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 );
655 610 if (status[2] != RTEMS_SUCCESSFUL)
656 611 {
657 612 PRINTF1("in restart_science_task *** 2 ERR %d\n", status[2])
658 613 }
659 614
660 615 status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 );
661 616 if (status[3] != RTEMS_SUCCESSFUL)
662 617 {
663 618 PRINTF1("in restart_science_task *** 3 ERR %d\n", status[3])
664 619 }
665 620
666 621 status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 );
667 622 if (status[4] != RTEMS_SUCCESSFUL)
668 623 {
669 624 PRINTF1("in restart_science_task *** 4 ERR %d\n", status[4])
670 625 }
671 626
672 627 status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 );
673 628 if (status[5] != RTEMS_SUCCESSFUL)
674 629 {
675 630 PRINTF1("in restart_science_task *** 5 ERR %d\n", status[5])
676 631 }
677 632
678 633 if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) ||
679 634 (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) )
680 635 {
681 636 ret = RTEMS_UNSATISFIED;
682 637 }
683 638
684 639 return ret;
685 640 }
686 641
687 642 int suspend_science_tasks()
688 643 {
689 644 /** This function suspends the science tasks.
690 645 *
691 646 * @return RTEMS directive status codes:
692 647 * - RTEMS_SUCCESSFUL - task restarted successfully
693 648 * - RTEMS_INVALID_ID - task id invalid
694 649 * - RTEMS_ALREADY_SUSPENDED - task already suspended
695 650 *
696 651 */
697 652
698 653 rtems_status_code status;
699 654
700 655 status = rtems_task_suspend( Task_id[TASKID_AVF0] );
701 656 if (status != RTEMS_SUCCESSFUL)
702 657 {
703 658 PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status)
704 659 }
705 660
706 661 if (status == RTEMS_SUCCESSFUL) // suspend BPF0
707 662 {
708 663 status = rtems_task_suspend( Task_id[TASKID_BPF0] );
709 664 if (status != RTEMS_SUCCESSFUL)
710 665 {
711 666 PRINTF1("in suspend_science_task *** BPF0 ERR %d\n", status)
712 667 }
713 668 }
714 669
715 670 if (status == RTEMS_SUCCESSFUL) // suspend WFRM
716 671 {
717 672 status = rtems_task_suspend( Task_id[TASKID_WFRM] );
718 673 if (status != RTEMS_SUCCESSFUL)
719 674 {
720 675 PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status)
721 676 }
722 677 }
723 678
724 679 if (status == RTEMS_SUCCESSFUL) // suspend CWF3
725 680 {
726 681 status = rtems_task_suspend( Task_id[TASKID_CWF3] );
727 682 if (status != RTEMS_SUCCESSFUL)
728 683 {
729 684 PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status)
730 685 }
731 686 }
732 687
733 688 if (status == RTEMS_SUCCESSFUL) // suspend CWF2
734 689 {
735 690 status = rtems_task_suspend( Task_id[TASKID_CWF2] );
736 691 if (status != RTEMS_SUCCESSFUL)
737 692 {
738 693 PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status)
739 694 }
740 695 }
741 696
742 697 if (status == RTEMS_SUCCESSFUL) // suspend CWF1
743 698 {
744 699 status = rtems_task_suspend( Task_id[TASKID_CWF1] );
745 700 if (status != RTEMS_SUCCESSFUL)
746 701 {
747 702 PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status)
748 703 }
749 704 }
750 705
751 706 return status;
752 707 }
753 708
709 void launch_waveform_picker( unsigned char mode )
710 {
711 reset_current_ring_nodes();
712 reset_waveform_picker_regs();
713 set_wfp_burst_enable_register( mode );
714 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
715 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
716 }
717
754 718 //****************
755 719 // CLOSING ACTIONS
756 720 void update_last_TC_exe(ccsdsTelecommandPacket_t *TC, unsigned char *time)
757 721 {
758 722 /** This function is used to update the HK packets statistics after a successful TC execution.
759 723 *
760 724 * @param TC points to the TC being processed
761 725 * @param time is the time used to date the TC execution
762 726 *
763 727 */
764 728
765 729 housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0];
766 730 housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1];
767 731 housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00;
768 732 housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType;
769 733 housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00;
770 734 housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType;
771 735 housekeeping_packet.hk_lfr_last_exe_tc_time[0] = time[0];
772 736 housekeeping_packet.hk_lfr_last_exe_tc_time[1] = time[1];
773 737 housekeeping_packet.hk_lfr_last_exe_tc_time[2] = time[2];
774 738 housekeeping_packet.hk_lfr_last_exe_tc_time[3] = time[3];
775 739 housekeeping_packet.hk_lfr_last_exe_tc_time[4] = time[4];
776 740 housekeeping_packet.hk_lfr_last_exe_tc_time[5] = time[5];
777 741 }
778 742
779 743 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char *time)
780 744 {
781 745 /** This function is used to update the HK packets statistics after a TC rejection.
782 746 *
783 747 * @param TC points to the TC being processed
784 748 * @param time is the time used to date the TC rejection
785 749 *
786 750 */
787 751
788 752 housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0];
789 753 housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1];
790 754 housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00;
791 755 housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType;
792 756 housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00;
793 757 housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType;
794 758 housekeeping_packet.hk_lfr_last_rej_tc_time[0] = time[0];
795 759 housekeeping_packet.hk_lfr_last_rej_tc_time[1] = time[1];
796 760 housekeeping_packet.hk_lfr_last_rej_tc_time[2] = time[2];
797 761 housekeeping_packet.hk_lfr_last_rej_tc_time[3] = time[3];
798 762 housekeeping_packet.hk_lfr_last_rej_tc_time[4] = time[4];
799 763 housekeeping_packet.hk_lfr_last_rej_tc_time[5] = time[5];
800 764 }
801 765
802 766 void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id, unsigned char *time)
803 767 {
804 768 /** This function is the last step of the TC execution workflow.
805 769 *
806 770 * @param TC points to the TC being processed
807 771 * @param result is the result of the TC execution (LFR_SUCCESSFUL / LFR_DEFAULT)
808 772 * @param queue_id is the id of the RTEMS message queue used to send TM packets
809 773 * @param time is the time used to date the TC execution
810 774 *
811 775 */
812 776
813 777 unsigned int val = 0;
814 778
815 779 if (result == LFR_SUCCESSFUL)
816 780 {
817 781 if ( !( (TC->serviceType==TC_TYPE_TIME) && (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) )
818 782 &&
819 783 !( (TC->serviceType==TC_TYPE_GEN) && (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO))
820 784 )
821 785 {
822 786 send_tm_lfr_tc_exe_success( TC, queue_id, time );
823 787 }
824 788 update_last_TC_exe( TC, time );
825 789 val = housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[0] * 256 + housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[1];
826 790 val++;
827 791 housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[0] = (unsigned char) (val >> 8);
828 792 housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[1] = (unsigned char) (val);
829 793 }
830 794 else
831 795 {
832 796 update_last_TC_rej( TC, time );
833 797 val = housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[0] * 256 + housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[1];
834 798 val++;
835 799 housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[0] = (unsigned char) (val >> 8);
836 800 housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[1] = (unsigned char) (val);
837 801 }
838 802 }
839 803
840 804 //***************************
841 805 // Interrupt Service Routines
842 806 rtems_isr commutation_isr1( rtems_vector_number vector )
843 807 {
844 808 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
845 809 printf("In commutation_isr1 *** Error sending event to DUMB\n");
846 810 }
847 811 }
848 812
849 813 rtems_isr commutation_isr2( rtems_vector_number vector )
850 814 {
851 815 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
852 816 printf("In commutation_isr2 *** Error sending event to DUMB\n");
853 817 }
854 818 }
855 819
856 820 //****************
857 821 // OTHER FUNCTIONS
858 822 void updateLFRCurrentMode()
859 823 {
860 824 /** This function updates the value of the global variable lfrCurrentMode.
861 825 *
862 826 * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running.
863 827 *
864 828 */
865 829 // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure
866 830 lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
867 831 }
868 832
@@ -1,1135 +1,1146
1 1 /** Functions and tasks related to waveform packet generation.
2 2 *
3 3 * @file
4 4 * @author P. LEROY
5 5 *
6 6 * A group of functions to handle waveforms, in snapshot or continuous format.\n
7 7 *
8 8 */
9 9
10 10 #include "wf_handler.h"
11 11
12 12 //*****************
13 13 // waveform headers
14 14 // SWF
15 15 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F0[7];
16 16 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F1[7];
17 17 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F2[7];
18 18 // CWF
19 19 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F1[7];
20 20 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_BURST[7];
21 21 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_SBM2[7];
22 22 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3[7];
23 23 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3_light[7];
24 24
25 25 //**************
26 26 // waveform ring
27 27 ring_node waveform_ring_f1[NB_RING_NODES_F1];
28 28 ring_node waveform_ring_f2[NB_RING_NODES_F2];
29 29 ring_node *current_ring_node_f1;
30 30 ring_node *ring_node_to_send_swf_f1;
31 31 ring_node *ring_node_to_send_cwf_f1;
32 32 ring_node *current_ring_node_f2;
33 33 ring_node *ring_node_to_send_swf_f2;
34 34 ring_node *ring_node_to_send_cwf_f2;
35 35
36 36 unsigned char doubleSendCWF2 = 0;
37 37
38 38 rtems_isr waveforms_isr( rtems_vector_number vector )
39 39 {
40 40 /** This is the interrupt sub routine called by the waveform picker core.
41 41 *
42 42 * This ISR launch different actions depending mainly on two pieces of information:
43 43 * 1. the values read in the registers of the waveform picker.
44 44 * 2. the current LFR mode.
45 45 *
46 46 */
47 47
48 #ifdef GSA
49 #else
50 48 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
51 49 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
52 50 { // in modes other than STANDBY and BURST, send the CWF_F3 data
53 51 if ((waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full
54 52 // (1) change the receiving buffer for the waveform picker
55 if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3) {
56 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_bis);
53 if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3_a) {
54 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_b);
57 55 }
58 56 else {
59 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3);
57 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a);
60 58 }
61 59 // (2) send an event for the waveforms transmission
62 60 if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
63 61 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
64 62 }
65 63 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff777; // reset f3 bits to 0, [1111 0111 0111 0111]
66 64 }
67 65 }
68 #endif
69 66
70 67 switch(lfrCurrentMode)
71 68 {
72 69 //********
73 70 // STANDBY
74 71 case(LFR_MODE_STANDBY):
75 72 break;
76 73
77 74 //******
78 75 // NORMAL
79 76 case(LFR_MODE_NORMAL):
80 #ifdef GSA
81 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
82 #else
83 if ( (waveform_picker_regs->burst_enable & 0x7) == 0x0 ){ // if no channel is enable
84 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
85 }
86 else {
87 77 if ( (waveform_picker_regs->status & 0x7) == 0x7 ){ // f2 f1 and f0 are full
88 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable & 0x08;
89
78 // change F1 ring node
90 79 ring_node_to_send_swf_f1 = current_ring_node_f1;
91 80 current_ring_node_f1 = current_ring_node_f1->next;
92 81 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address;
93
82 // change F2 ring node
94 83 ring_node_to_send_swf_f2 = current_ring_node_f2;
95 84 current_ring_node_f2 = current_ring_node_f2->next;
96 85 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
97
86 // send an event to the WFRM task
98 87 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
99 88 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
100 89 }
101
102 90 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff888; // [1000 1000 1000]
103 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x07; // [0111] enable f2 f1 f0
104 91 }
105 }
106 #endif
107 92 break;
108 93
109 94 //******
110 95 // BURST
111 96 case(LFR_MODE_BURST):
112 #ifdef GSA
113 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
114 #else
115 97 if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit
116 98 // (1) change the receiving buffer for the waveform picker
117 99 ring_node_to_send_cwf_f2 = current_ring_node_f2;
118 100 current_ring_node_f2 = current_ring_node_f2->next;
119 101 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
120 102 // (2) send an event for the waveforms transmission
121 if (rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) {
103 if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) {
122 104 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
123 105 }
124 106 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0
125 107 }
126 #endif
127 108 break;
128 109
129 110 //*****
130 111 // SBM1
131 112 case(LFR_MODE_SBM1):
132 #ifdef GSA
133 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
134 #else
135 113 if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit
136 114 // (1) change the receiving buffer for the waveform picker
137 115 ring_node_to_send_cwf_f1 = current_ring_node_f1;
138 116 current_ring_node_f1 = current_ring_node_f1->next;
139 117 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address;
140 118 // (2) send an event for the waveforms transmission
141 119 if (rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 ) != RTEMS_SUCCESSFUL) {
142 120 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
143 121 }
144 122 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bit = 0
145 123 }
146 124 if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit
147 125 ring_node_to_send_swf_f1 = current_ring_node_f1->previous;
148 126 }
149 127 if ( (waveform_picker_regs->status & 0x04) == 0x04 ) { // [0100] check the f2 full bit
150 128 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
151 129 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
152 130 }
153 131 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2 and f0 bits = 0
154 132 }
155
156 #endif
157 133 break;
158 134
159 135 //*****
160 136 // SBM2
161 137 case(LFR_MODE_SBM2):
162 #ifdef GSA
163 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
164 #else
165 138 if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit
166 139 // (1) change the receiving buffer for the waveform picker
167 140 ring_node_to_send_cwf_f2 = current_ring_node_f2;
168 141 current_ring_node_f2 = current_ring_node_f2->next;
169 142 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
170 143 // (2) send an event for the waveforms transmission
171 144 if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) {
172 145 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
173 146 }
174 147 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0
175 148 }
176 // if ( (waveform_picker_regs->status & 0x03) == 0x03 ) { // [0011] f3 f2 f1 f0, f1 and f0 are full
177 // if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) {
178 // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
179 // }
180 // waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0
181 // }
182 #endif
149 if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit
150 ring_node_to_send_swf_f2 = current_ring_node_f2->previous;
151 }
152 if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit
153 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
154 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
155 }
156 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0
157 }
183 158 break;
184 159
185 160 //********
186 161 // DEFAULT
187 162 default:
188 163 break;
189 164 }
190 165 }
191 166
192 167 rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
193 168 {
194 169 /** This RTEMS task is dedicated to the transmission of snapshots of the NORMAL mode.
195 170 *
196 171 * @param unused is the starting argument of the RTEMS task
197 172 *
198 173 * The following data packets are sent by this task:
199 174 * - TM_LFR_SCIENCE_NORMAL_SWF_F0
200 175 * - TM_LFR_SCIENCE_NORMAL_SWF_F1
201 176 * - TM_LFR_SCIENCE_NORMAL_SWF_F2
202 177 *
203 178 */
204 179
205 180 rtems_event_set event_out;
206 181 rtems_id queue_id;
207 182 rtems_status_code status;
208 183
209 184 init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 );
210 185 init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 );
211 186 init_header_snapshot_wf_table( SID_NORM_SWF_F2, headerSWF_F2 );
212 187
213 188 init_waveforms();
214 189
215 190 status = get_message_queue_id_send( &queue_id );
216 191 if (status != RTEMS_SUCCESSFUL)
217 192 {
218 193 PRINTF1("in WFRM *** ERR get_message_queue_id_send %d\n", status)
219 194 }
220 195
221 196 BOOT_PRINTF("in WFRM ***\n")
222 197
223 198 while(1){
224 199 // wait for an RTEMS_EVENT
225 200 rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1
226 201 | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM,
227 202 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
228 DEBUG_PRINTF("in WFRM *** 2\n")
229 203 if (event_out == RTEMS_EVENT_MODE_NORMAL)
230 204 {
231 205 send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
232 206 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
233 207 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
234 208 }
235 209 else
236 210 {
237 211 PRINTF("in WFRM *** unexpected event")
238 212 }
239 213 }
240 214 }
241 215
242 216 rtems_task cwf3_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
243 217 {
244 218 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f3.
245 219 *
246 220 * @param unused is the starting argument of the RTEMS task
247 221 *
248 222 * The following data packet is sent by this task:
249 223 * - TM_LFR_SCIENCE_NORMAL_CWF_F3
250 224 *
251 225 */
252 226
253 227 rtems_event_set event_out;
254 228 rtems_id queue_id;
255 229 rtems_status_code status;
256 230
257 231 init_header_continuous_wf_table( SID_NORM_CWF_F3, headerCWF_F3 );
258 232 init_header_continuous_wf3_light_table( headerCWF_F3_light );
259 233
260 234 status = get_message_queue_id_send( &queue_id );
261 235 if (status != RTEMS_SUCCESSFUL)
262 236 {
263 237 PRINTF1("in CWF3 *** ERR get_message_queue_id_send %d\n", status)
264 238 }
265 239
266 240 BOOT_PRINTF("in CWF3 ***\n")
267 241
268 242 while(1){
269 243 // wait for an RTEMS_EVENT
270 244 rtems_event_receive( RTEMS_EVENT_0,
271 245 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
272 246 PRINTF("send CWF F3 \n")
273 247 #ifdef GSA
274 248 #else
275 if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3) {
276 send_waveform_CWF3_light( wf_cont_f3_bis, headerCWF_F3_light, queue_id );
249 if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3_a) {
250 send_waveform_CWF3_light( wf_cont_f3_b, headerCWF_F3_light, queue_id );
277 251 }
278 252 else {
279 send_waveform_CWF3_light( wf_cont_f3, headerCWF_F3_light, queue_id );
253 send_waveform_CWF3_light( wf_cont_f3_a, headerCWF_F3_light, queue_id );
280 254 }
281 255 #endif
282 256 }
283 257 }
284 258
285 259 rtems_task cwf2_task(rtems_task_argument argument) // ONLY USED IN BURST AND SBM2
286 260 {
287 261 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f2.
288 262 *
289 263 * @param unused is the starting argument of the RTEMS task
290 264 *
291 265 * The following data packet is sent by this function:
292 266 * - TM_LFR_SCIENCE_BURST_CWF_F2
293 267 * - TM_LFR_SCIENCE_SBM2_CWF_F2
294 268 *
295 269 */
296 270
297 271 rtems_event_set event_out;
298 272 rtems_id queue_id;
299 273 rtems_status_code status;
300 274
301 275 init_header_continuous_wf_table( SID_BURST_CWF_F2, headerCWF_F2_BURST );
302 276 init_header_continuous_wf_table( SID_SBM2_CWF_F2, headerCWF_F2_SBM2 );
303 277
304 278 status = get_message_queue_id_send( &queue_id );
305 279 if (status != RTEMS_SUCCESSFUL)
306 280 {
307 281 PRINTF1("in CWF2 *** ERR get_message_queue_id_send %d\n", status)
308 282 }
309 283
310 284 BOOT_PRINTF("in CWF2 ***\n")
311 285
312 286 while(1){
313 287 // wait for an RTEMS_EVENT
314 288 rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2,
315 289 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
316
317 290 if (event_out == RTEMS_EVENT_MODE_BURST)
318 291 {
319 292 send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id );
320 293 }
321 294 if (event_out == RTEMS_EVENT_MODE_SBM2)
322 295 {
323 send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id );
296 send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id );
324 297 }
325 298 }
326 299 }
327 300
328 301 rtems_task cwf1_task(rtems_task_argument argument) // ONLY USED IN SBM1
329 302 {
330 303 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f1.
331 304 *
332 305 * @param unused is the starting argument of the RTEMS task
333 306 *
334 307 * The following data packet is sent by this function:
335 308 * - TM_LFR_SCIENCE_SBM1_CWF_F1
336 309 *
337 310 */
338 311
339 312 rtems_event_set event_out;
340 313 rtems_id queue_id;
341 314 rtems_status_code status;
342 315
343 316 init_header_continuous_wf_table( SID_SBM1_CWF_F1, headerCWF_F1 );
344 317
345 318 status = get_message_queue_id_send( &queue_id );
346 319 if (status != RTEMS_SUCCESSFUL)
347 320 {
348 321 PRINTF1("in CWF1 *** ERR get_message_queue_id_send %d\n", status)
349 322 }
350 323
351 324 BOOT_PRINTF("in CWF1 ***\n")
352 325
353 326 while(1){
354 327 // wait for an RTEMS_EVENT
355 328 rtems_event_receive( RTEMS_EVENT_MODE_SBM1,
356 329 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
357 330 send_waveform_CWF((volatile int*) ring_node_to_send_cwf_f1->buffer_address, SID_SBM1_CWF_F1, headerCWF_F1, queue_id );
358 331 }
359 332 }
360 333
361 334 //******************
362 335 // general functions
363 336 void init_waveforms( void )
364 337 {
365 338 int i = 0;
366 339
367 340 for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
368 341 {
369 342 //***
370 343 // F0
371 344 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x88887777; //
372 345 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; //
373 346 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x44443333; //
374 347
375 348 //***
376 349 // F1
377 350 // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x22221111;
378 351 // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x44443333;
379 352 // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
380 353
381 354 //***
382 355 // F2
383 356 // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x44443333;
384 357 // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111;
385 358 // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
386 359
387 360 //***
388 361 // F3
389 362 // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 0 ] = val1;
390 363 // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 1 ] = val2;
391 364 // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 2 ] = 0xaaaa0000;
392 365 }
393 366 }
394 367
395 368 void init_waveform_rings( void )
396 369 {
397 370 unsigned char i;
398 371
399 372 // F1 RING
400 373 waveform_ring_f1[0].next = (ring_node*) &waveform_ring_f1[1];
401 374 waveform_ring_f1[0].previous = (ring_node*) &waveform_ring_f1[NB_RING_NODES_F1-1];
402 375 waveform_ring_f1[0].buffer_address = (int) &wf_snap_f1[0][0];
403 376
404 377 waveform_ring_f1[NB_RING_NODES_F1-1].next = (ring_node*) &waveform_ring_f1[0];
405 378 waveform_ring_f1[NB_RING_NODES_F1-1].previous = (ring_node*) &waveform_ring_f1[NB_RING_NODES_F1-2];
406 379 waveform_ring_f1[NB_RING_NODES_F1-1].buffer_address = (int) &wf_snap_f1[NB_RING_NODES_F1-1][0];
407 380
408 381 for(i=1; i<NB_RING_NODES_F1-1; i++)
409 382 {
410 383 waveform_ring_f1[i].next = (ring_node*) &waveform_ring_f1[i+1];
411 384 waveform_ring_f1[i].previous = (ring_node*) &waveform_ring_f1[i-1];
412 385 waveform_ring_f1[i].buffer_address = (int) &wf_snap_f1[i][0];
413 386 }
414 387
415 388 // F2 RING
416 389 waveform_ring_f2[0].next = (ring_node*) &waveform_ring_f2[1];
417 390 waveform_ring_f2[0].previous = (ring_node*) &waveform_ring_f2[NB_RING_NODES_F2-1];
418 391 waveform_ring_f2[0].buffer_address = (int) &wf_snap_f2[0][0];
419 392
420 393 waveform_ring_f2[NB_RING_NODES_F2-1].next = (ring_node*) &waveform_ring_f2[0];
421 394 waveform_ring_f2[NB_RING_NODES_F2-1].previous = (ring_node*) &waveform_ring_f2[NB_RING_NODES_F2-2];
422 395 waveform_ring_f2[NB_RING_NODES_F2-1].buffer_address = (int) &wf_snap_f2[NB_RING_NODES_F2-1][0];
423 396
424 397 for(i=1; i<NB_RING_NODES_F2-1; i++)
425 398 {
426 399 waveform_ring_f2[i].next = (ring_node*) &waveform_ring_f2[i+1];
427 400 waveform_ring_f2[i].previous = (ring_node*) &waveform_ring_f2[i-1];
428 401 waveform_ring_f2[i].buffer_address = (int) &wf_snap_f2[i][0];
429 402 }
430 403
431 404 DEBUG_PRINTF1("waveform_ring_f1 @%x\n", (unsigned int) waveform_ring_f1)
432 405 DEBUG_PRINTF1("waveform_ring_f2 @%x\n", (unsigned int) waveform_ring_f2)
433 406
434 407 }
435 408
436 409 void reset_current_ring_nodes( void )
437 410 {
438 411 current_ring_node_f1 = waveform_ring_f1;
439 412 ring_node_to_send_cwf_f1 = waveform_ring_f1;
440 413 ring_node_to_send_swf_f1 = waveform_ring_f1;
441 414
442 415 current_ring_node_f2 = waveform_ring_f2;
443 416 ring_node_to_send_cwf_f2 = waveform_ring_f2;
444 417 ring_node_to_send_swf_f2 = waveform_ring_f2;
445 418 }
446 419
447 420 int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF)
448 421 {
449 422 unsigned char i;
450 423
451 424 for (i=0; i<7; i++)
452 425 {
453 426 headerSWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
454 427 headerSWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
455 428 headerSWF[ i ].reserved = DEFAULT_RESERVED;
456 429 headerSWF[ i ].userApplication = CCSDS_USER_APP;
457 430 headerSWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
458 431 headerSWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
459 432 if (i == 0)
460 433 {
461 434 headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST;
462 435 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_340 >> 8);
463 436 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_340 );
464 437 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
465 438 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
466 439 }
467 440 else if (i == 6)
468 441 {
469 442 headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST;
470 443 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_8 >> 8);
471 444 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_8 );
472 445 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8);
473 446 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 );
474 447 }
475 448 else
476 449 {
477 450 headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION;
478 451 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_340 >> 8);
479 452 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_340 );
480 453 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
481 454 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
482 455 }
483 456 headerSWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
484 457 headerSWF[ i ].pktCnt = DEFAULT_PKTCNT; // PKT_CNT
485 458 headerSWF[ i ].pktNr = i+1; // PKT_NR
486 459 // DATA FIELD HEADER
487 460 headerSWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
488 461 headerSWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
489 462 headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
490 463 headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
491 464 // AUXILIARY DATA HEADER
492 465 headerSWF[ i ].time[0] = 0x00;
493 466 headerSWF[ i ].time[0] = 0x00;
494 467 headerSWF[ i ].time[0] = 0x00;
495 468 headerSWF[ i ].time[0] = 0x00;
496 469 headerSWF[ i ].time[0] = 0x00;
497 470 headerSWF[ i ].time[0] = 0x00;
498 471 headerSWF[ i ].sid = sid;
499 472 headerSWF[ i ].hkBIA = DEFAULT_HKBIA;
500 473 }
501 474 return LFR_SUCCESSFUL;
502 475 }
503 476
504 477 int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF )
505 478 {
506 479 unsigned int i;
507 480
508 481 for (i=0; i<7; i++)
509 482 {
510 483 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
511 484 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
512 485 headerCWF[ i ].reserved = DEFAULT_RESERVED;
513 486 headerCWF[ i ].userApplication = CCSDS_USER_APP;
514 487 if ( (sid == SID_SBM1_CWF_F1) || (sid == SID_SBM2_CWF_F2) )
515 488 {
516 489 headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2 >> 8);
517 490 headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2);
518 491 }
519 492 else
520 493 {
521 494 headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
522 495 headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
523 496 }
524 497 if (i == 0)
525 498 {
526 499 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST;
527 500 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_340 >> 8);
528 501 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_340 );
529 502 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
530 503 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
531 504 }
532 505 else if (i == 6)
533 506 {
534 507 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST;
535 508 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_8 >> 8);
536 509 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_8 );
537 510 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8);
538 511 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 );
539 512 }
540 513 else
541 514 {
542 515 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION;
543 516 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_340 >> 8);
544 517 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_340 );
545 518 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
546 519 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
547 520 }
548 521 headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
549 522 // PKT_CNT
550 523 // PKT_NR
551 524 // DATA FIELD HEADER
552 525 headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
553 526 headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
554 527 headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
555 528 headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
556 529 // AUXILIARY DATA HEADER
557 530 headerCWF[ i ].sid = sid;
558 531 headerCWF[ i ].hkBIA = DEFAULT_HKBIA;
559 532 headerCWF[ i ].time[0] = 0x00;
560 533 headerCWF[ i ].time[0] = 0x00;
561 534 headerCWF[ i ].time[0] = 0x00;
562 535 headerCWF[ i ].time[0] = 0x00;
563 536 headerCWF[ i ].time[0] = 0x00;
564 537 headerCWF[ i ].time[0] = 0x00;
565 538 }
566 539 return LFR_SUCCESSFUL;
567 540 }
568 541
569 542 int init_header_continuous_wf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF )
570 543 {
571 544 unsigned int i;
572 545
573 546 for (i=0; i<7; i++)
574 547 {
575 548 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
576 549 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
577 550 headerCWF[ i ].reserved = DEFAULT_RESERVED;
578 551 headerCWF[ i ].userApplication = CCSDS_USER_APP;
579 552
580 553 headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
581 554 headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
582 555 if (i == 0)
583 556 {
584 557 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST;
585 558 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 >> 8);
586 559 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 );
587 560 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
588 561 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
589 562 }
590 563 else if (i == 6)
591 564 {
592 565 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST;
593 566 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_8 >> 8);
594 567 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_8 );
595 568 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8);
596 569 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 );
597 570 }
598 571 else
599 572 {
600 573 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION;
601 574 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 >> 8);
602 575 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 );
603 576 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
604 577 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
605 578 }
606 579 headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
607 580 // DATA FIELD HEADER
608 581 headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
609 582 headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
610 583 headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
611 584 headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
612 585 // AUXILIARY DATA HEADER
613 586 headerCWF[ i ].sid = SID_NORM_CWF_F3;
614 587 headerCWF[ i ].hkBIA = DEFAULT_HKBIA;
615 588 headerCWF[ i ].time[0] = 0x00;
616 589 headerCWF[ i ].time[0] = 0x00;
617 590 headerCWF[ i ].time[0] = 0x00;
618 591 headerCWF[ i ].time[0] = 0x00;
619 592 headerCWF[ i ].time[0] = 0x00;
620 593 headerCWF[ i ].time[0] = 0x00;
621 594 }
622 595 return LFR_SUCCESSFUL;
623 596 }
624 597
625 598 int send_waveform_SWF( volatile int *waveform, unsigned int sid,
626 599 Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id )
627 600 {
628 601 /** This function sends SWF CCSDS packets (F2, F1 or F0).
629 602 *
630 603 * @param waveform points to the buffer containing the data that will be send.
631 604 * @param sid is the source identifier of the data that will be sent.
632 605 * @param headerSWF points to a table of headers that have been prepared for the data transmission.
633 606 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
634 607 * contain information to setup the transmission of the data packets.
635 608 *
636 609 * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks.
637 610 *
638 611 */
639 612
640 613 unsigned int i;
641 614 int ret;
642 615 rtems_status_code status;
643 616 spw_ioctl_pkt_send spw_ioctl_send_SWF;
644 617
645 618 spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header
646 619 spw_ioctl_send_SWF.options = 0;
647 620
648 621 ret = LFR_DEFAULT;
649 622
650 623 for (i=0; i<7; i++) // send waveform
651 624 {
625 #ifdef VHDL_DEV
626 spw_ioctl_send_SWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) + TIME_OFFSET];
627 #else
652 628 spw_ioctl_send_SWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ];
629 #endif
653 630 spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ];
654 631 // BUILD THE DATA
655 632 if (i==6) {
656 633 spw_ioctl_send_SWF.dlen = 8 * NB_BYTES_SWF_BLK;
657 634 }
658 635 else {
659 636 spw_ioctl_send_SWF.dlen = 340 * NB_BYTES_SWF_BLK;
660 637 }
661 638 // SET PACKET SEQUENCE COUNTER
662 639 increment_seq_counter_source_id( headerSWF[ i ].packetSequenceControl, sid );
663 640 // SET PACKET TIME
664 641 headerSWF[ i ].acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24);
665 642 headerSWF[ i ].acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16);
666 643 headerSWF[ i ].acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8);
667 644 headerSWF[ i ].acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time);
668 645 headerSWF[ i ].acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8);
669 646 headerSWF[ i ].acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time);
670 647 headerSWF[ i ].time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
671 648 headerSWF[ i ].time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
672 649 headerSWF[ i ].time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
673 650 headerSWF[ i ].time[3] = (unsigned char) (time_management_regs->coarse_time);
674 651 headerSWF[ i ].time[4] = (unsigned char) (time_management_regs->fine_time>>8);
675 652 headerSWF[ i ].time[5] = (unsigned char) (time_management_regs->fine_time);
676 653 // SEND PACKET
677 654 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_SWF, ACTION_MSG_SPW_IOCTL_SEND_SIZE);
678 655 if (status != RTEMS_SUCCESSFUL) {
679 656 printf("%d-%d, ERR %d\n", sid, i, (int) status);
680 657 ret = LFR_DEFAULT;
681 658 }
682 659 rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds
683 660 }
684 661
685 662 return ret;
686 663 }
687 664
688 665 int send_waveform_CWF(volatile int *waveform, unsigned int sid,
689 666 Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id)
690 667 {
691 668 /** This function sends CWF CCSDS packets (F2, F1 or F0).
692 669 *
693 670 * @param waveform points to the buffer containing the data that will be send.
694 671 * @param sid is the source identifier of the data that will be sent.
695 672 * @param headerCWF points to a table of headers that have been prepared for the data transmission.
696 673 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
697 674 * contain information to setup the transmission of the data packets.
698 675 *
699 676 * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks.
700 677 *
701 678 */
702 679
703 680 unsigned int i;
704 681 int ret;
705 682 rtems_status_code status;
706 683 spw_ioctl_pkt_send spw_ioctl_send_CWF;
707 684
708 685 spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
709 686 spw_ioctl_send_CWF.options = 0;
710 687
711 688 ret = LFR_DEFAULT;
712 689
713 690 for (i=0; i<7; i++) // send waveform
714 691 {
715 692 int coarseTime = 0x00;
716 693 int fineTime = 0x00;
694 #ifdef VHDL_DEV
695 spw_ioctl_send_CWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) + TIME_OFFSET];
696 #else
717 697 spw_ioctl_send_CWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ];
698 #endif
718 699 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
719 700 // BUILD THE DATA
720 701 if (i==6) {
721 702 spw_ioctl_send_CWF.dlen = 8 * NB_BYTES_SWF_BLK;
722 703 }
723 704 else {
724 705 spw_ioctl_send_CWF.dlen = 340 * NB_BYTES_SWF_BLK;
725 706 }
726 707 // SET PACKET SEQUENCE COUNTER
727 708 increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, sid );
728 709 // SET PACKET TIME
729 710 coarseTime = time_management_regs->coarse_time;
730 711 fineTime = time_management_regs->fine_time;
731 712 headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24);
732 713 headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16);
733 714 headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8);
734 715 headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime);
735 716 headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8);
736 717 headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime);
737 718 headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24);
738 719 headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16);
739 720 headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8);
740 721 headerCWF[ i ].time[3] = (unsigned char) (coarseTime);
741 722 headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8);
742 723 headerCWF[ i ].time[5] = (unsigned char) (fineTime);
743 724 // SEND PACKET
744 725 if (sid == SID_NORM_CWF_F3)
745 726 {
746 727 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
747 728 if (status != RTEMS_SUCCESSFUL) {
748 729 printf("%d-%d, ERR %d\n", sid, i, (int) status);
749 730 ret = LFR_DEFAULT;
750 731 }
751 732 rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS);
752 733 }
753 734 else
754 735 {
755 736 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
756 737 if (status != RTEMS_SUCCESSFUL) {
757 738 printf("%d-%d, ERR %d\n", sid, i, (int) status);
758 739 ret = LFR_DEFAULT;
759 740 }
760 741 }
761 742 }
762 743
763 744 return ret;
764 745 }
765 746
766 747 int send_waveform_CWF3_light(volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id)
767 748 {
768 749 /** This function sends CWF_F3 CCSDS packets without the b1, b2 and b3 data.
769 750 *
770 751 * @param waveform points to the buffer containing the data that will be send.
771 752 * @param headerCWF points to a table of headers that have been prepared for the data transmission.
772 753 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
773 754 * contain information to setup the transmission of the data packets.
774 755 *
775 756 * By default, CWF_F3 packet are send without the b1, b2 and b3 data. This function rebuilds a data buffer
776 757 * from the incoming data and sends it in 7 packets, 6 containing 340 blocks and 1 one containing 8 blocks.
777 758 *
778 759 */
779 760
780 761 unsigned int i;
781 762 int ret;
782 763 rtems_status_code status;
783 764 spw_ioctl_pkt_send spw_ioctl_send_CWF;
784 765 char *sample;
785 766
786 767 spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
787 768 spw_ioctl_send_CWF.options = 0;
788 769
789 770 ret = LFR_DEFAULT;
790 771
791 772 //**********************
792 773 // BUILD CWF3_light DATA
793 774 for ( i=0; i< 2048; i++)
794 775 {
795 776 sample = (char*) &waveform[ i * NB_WORDS_SWF_BLK ];
796 777 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) ] = sample[ 0 ];
797 778 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 ] = sample[ 1 ];
798 779 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 ] = sample[ 2 ];
799 780 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 ] = sample[ 3 ];
800 781 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 ] = sample[ 4 ];
801 782 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 ] = sample[ 5 ];
802 783 }
803 784
804 785 //*********************
805 786 // SEND CWF3_light DATA
806 787
807 788 for (i=0; i<7; i++) // send waveform
808 789 {
809 790 int coarseTime = 0x00;
810 791 int fineTime = 0x00;
792 #ifdef VHDL_DEV
793 spw_ioctl_send_CWF.data = (char*) &wf_cont_f3_light[ (i * 340 * NB_BYTES_CWF3_LIGHT_BLK) + TIME_OFFSET];
794 #else
811 795 spw_ioctl_send_CWF.data = (char*) &wf_cont_f3_light[ (i * 340 * NB_BYTES_CWF3_LIGHT_BLK) ];
796 #endif
812 797 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
813 798 // BUILD THE DATA
814 799 if ( i == WFRM_INDEX_OF_LAST_PACKET ) {
815 800 spw_ioctl_send_CWF.dlen = 8 * NB_BYTES_CWF3_LIGHT_BLK;
816 801 }
817 802 else {
818 803 spw_ioctl_send_CWF.dlen = 340 * NB_BYTES_CWF3_LIGHT_BLK;
819 804 }
820 805 // SET PACKET SEQUENCE COUNTER
821 806 increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, SID_NORM_CWF_F3 );
822 807 // SET PACKET TIME
823 808 coarseTime = time_management_regs->coarse_time;
824 809 fineTime = time_management_regs->fine_time;
825 810 headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24);
826 811 headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16);
827 812 headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8);
828 813 headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime);
829 814 headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8);
830 815 headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime);
831 816 headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24);
832 817 headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16);
833 818 headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8);
834 819 headerCWF[ i ].time[3] = (unsigned char) (coarseTime);
835 820 headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8);
836 821 headerCWF[ i ].time[5] = (unsigned char) (fineTime);
837 822 // SEND PACKET
838 823 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
839 824 if (status != RTEMS_SUCCESSFUL) {
840 825 printf("%d-%d, ERR %d\n", SID_NORM_CWF_F3, i, (int) status);
841 826 ret = LFR_DEFAULT;
842 827 }
843 828 rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS);
844 829 }
845 830
846 831 return ret;
847 832 }
848 833
849 834
850 835 //**************
851 836 // wfp registers
852 837 void set_wfp_data_shaping()
853 838 {
854 839 /** This function sets the data_shaping register of the waveform picker module.
855 840 *
856 841 * The value is read from one field of the parameter_dump_packet structure:\n
857 842 * bw_sp0_sp1_r0_r1
858 843 *
859 844 */
860 845
861 846 unsigned char data_shaping;
862 847
863 848 // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register
864 849 // waveform picker : [R1 R0 SP1 SP0 BW]
865 850
866 851 data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1;
867 852
868 853 #ifdef GSA
869 854 #else
870 855 waveform_picker_regs->data_shaping =
871 856 ( (data_shaping & 0x10) >> 4 ) // BW
872 857 + ( (data_shaping & 0x08) >> 2 ) // SP0
873 858 + ( (data_shaping & 0x04) ) // SP1
874 859 + ( (data_shaping & 0x02) << 2 ) // R0
875 860 + ( (data_shaping & 0x01) << 4 ); // R1
876 861 #endif
877 862 }
878 863
879 864 char set_wfp_delta_snapshot()
880 865 {
881 866 /** This function sets the delta_snapshot register of the waveform picker module.
882 867 *
883 868 * The value is read from two (unsigned char) of the parameter_dump_packet structure:
884 869 * - sy_lfr_n_swf_p[0]
885 870 * - sy_lfr_n_swf_p[1]
886 871 *
887 872 */
888 873
889 874 char ret;
890 875 unsigned int delta_snapshot;
891 876 unsigned int aux;
892 877
893 878 aux = 0;
894 879 ret = LFR_DEFAULT;
895 880
896 881 delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256
897 882 + parameter_dump_packet.sy_lfr_n_swf_p[1];
898 883
899 884 #ifdef GSA
900 885 #else
901 886 if ( delta_snapshot < MIN_DELTA_SNAPSHOT )
902 887 {
903 888 aux = MIN_DELTA_SNAPSHOT;
904 889 ret = LFR_DEFAULT;
905 890 }
906 891 else
907 892 {
908 893 aux = delta_snapshot ;
909 894 ret = LFR_SUCCESSFUL;
910 895 }
911 896 waveform_picker_regs->delta_snapshot = aux - 1; // max 2 bytes
912 897 #endif
913 898
914 899 return ret;
915 900 }
916 901
902 #ifdef VHDL_DEV
917 903 void set_wfp_burst_enable_register( unsigned char mode)
918 904 {
919 905 /** This function sets the waveform picker burst_enable register depending on the mode.
920 906 *
921 907 * @param mode is the LFR mode to launch.
922 908 *
923 909 * The burst bits shall be before the enable bits.
924 910 *
925 911 */
926 912
927 #ifdef GSA
913 // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0
914 // the burst bits shall be set first, before the enable bits
915 switch(mode) {
916 case(LFR_MODE_NORMAL):
917 waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enable
918 waveform_picker_regs->run_burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0
919 break;
920 case(LFR_MODE_BURST):
921 waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled
922 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x04; // [0100] enable f2
923 break;
924 case(LFR_MODE_SBM1):
925 waveform_picker_regs->run_burst_enable = 0x20; // [0010 0000] f1 burst enabled
926 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
927 break;
928 case(LFR_MODE_SBM2):
929 waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled
930 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
931 break;
932 default:
933 waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled
934 break;
935 }
936 }
928 937 #else
938 void set_wfp_burst_enable_register( unsigned char mode )
939 {
940 /** This function sets the waveform picker burst_enable register depending on the mode.
941 *
942 * @param mode is the LFR mode to launch.
943 *
944 * The burst bits shall be before the enable bits.
945 *
946 */
947
929 948 // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0
930 949 // the burst bits shall be set first, before the enable bits
931 950 switch(mode) {
932 951 case(LFR_MODE_NORMAL):
933 952 waveform_picker_regs->burst_enable = 0x00; // [0000 0000] no burst enable
934 953 waveform_picker_regs->burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0
935 954 break;
936 955 case(LFR_MODE_BURST):
937 956 waveform_picker_regs->burst_enable = 0x40; // [0100 0000] f2 burst enabled
938 957 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x04; // [0100] enable f2
939 958 break;
940 959 case(LFR_MODE_SBM1):
941 960 waveform_picker_regs->burst_enable = 0x20; // [0010 0000] f1 burst enabled
942 961 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
943 962 break;
944 963 case(LFR_MODE_SBM2):
945 964 waveform_picker_regs->burst_enable = 0x40; // [0100 0000] f2 burst enabled
946 965 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
947 966 break;
948 967 default:
949 968 waveform_picker_regs->burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled
950 969 break;
951 970 }
971 }
952 972 #endif
953 }
954 973
955 974 void reset_wfp_burst_enable()
956 975 {
957 976 /** This function resets the waveform picker burst_enable register.
958 977 *
959 978 * The burst bits [f2 f1 f0] and the enable bits [f3 f2 f1 f0] are set to 0.
960 979 *
961 980 */
962 981
963 #ifdef GSA
982 #ifdef VHDL_DEV
983 waveform_picker_regs->run_burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
964 984 #else
965 985 waveform_picker_regs->burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
966 986 #endif
967 987 }
968 988
969 989 void reset_wfp_status()
970 990 {
971 991 /** This function resets the waveform picker status register.
972 992 *
973 993 * All status bits are set to 0 [new_err full_err full].
974 994 *
975 995 */
976 996
977 997 #ifdef GSA
978 998 #else
979 999 waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
980 1000 #endif
981 1001 }
982 1002
1003 #ifdef VHDL_DEV
1004 void reset_waveform_picker_regs()
1005 {
1006 /** This function resets the waveform picker module registers.
1007 *
1008 * The registers affected by this function are located at the following offset addresses:
1009 * - 0x00 data_shaping
1010 * - 0x04 run_burst_enable
1011 * - 0x08 addr_data_f0
1012 * - 0x0C addr_data_f1
1013 * - 0x10 addr_data_f2
1014 * - 0x14 addr_data_f3
1015 * - 0x18 status
1016 * - 0x1C delta_snapshot
1017 * - 0x20 delta_f0
1018 * - 0x24 delta_f0_2
1019 * - 0x28 delta_f1
1020 * - 0x2c delta_f2
1021 * - 0x30 nb_data_by_buffer
1022 * - 0x34 nb_snapshot_param
1023 * - 0x38 start_date
1024 * - 0x3c nb_word_in_buffer
1025 *
1026 */
1027 waveform_picker_regs->data_shaping = 0x01; // 0x00 *** R1 R0 SP1 SP0 BW
1028 waveform_picker_regs->run_burst_enable = 0x00; // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ]
1029 waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0); // 0x08
1030 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; // 0x0c
1031 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; // 0x10
1032 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a); // 0x14
1033 waveform_picker_regs->status = 0x00; // 0x18
1034 // waveform_picker_regs->delta_snapshot = 0x12800; // 0x1c 296 * 256 = 75776
1035 // waveform_picker_regs->delta_snapshot = 0x1000; // 0x1c 16 * 256 = 4096
1036 waveform_picker_regs->delta_snapshot = 0x2000; // 0x1c 32 * 256 = 8192
1037 waveform_picker_regs->delta_f0 = 0xbf5; // 0x20 *** 1013
1038 waveform_picker_regs->delta_f0_2 = 0x7; // 0x24 *** 7 [7 bits]
1039 waveform_picker_regs->delta_f1 = 0xbc0; // 0x28 *** 960
1040 // waveform_picker_regs->delta_f2 = 0x12200; // 0x2c *** 290 * 256 = 74240
1041 waveform_picker_regs->delta_f2 = 0xc00; // 0x2c *** 12 * 256 = 3072
1042 waveform_picker_regs->nb_data_by_buffer = 0x7ff; // 0x30 *** 2048 -1 => nb samples -1
1043 waveform_picker_regs->snapshot_param = 0x800; // 0x34 *** 2048 => nb samples
1044 waveform_picker_regs->start_date = 0x00; // 0x38
1045 waveform_picker_regs->nb_word_in_buffer = 0x1802; // 0x3c *** 2048 * 3 + 2 = 6146
1046 }
1047 #else
983 1048 void reset_waveform_picker_regs()
984 1049 {
985 1050 /** This function resets the waveform picker module registers.
986 1051 *
987 1052 * The registers affected by this function are located at the following offset addresses:
988 1053 * - 0x00 data_shaping
989 1054 * - 0x04 burst_enable
990 1055 * - 0x08 addr_data_f0
991 1056 * - 0x0C addr_data_f1
992 1057 * - 0x10 addr_data_f2
993 1058 * - 0x14 addr_data_f3
994 1059 * - 0x18 status
995 1060 * - 0x1C delta_snapshot
996 1061 * - 0x20 delta_f2_f1
997 1062 * - 0x24 delta_f2_f0
998 1063 * - 0x28 nb_burst
999 1064 * - 0x2C nb_snapshot
1000 1065 *
1001 1066 */
1002 1067
1003 #ifdef GSA
1004 #else
1005 1068 reset_wfp_burst_enable();
1006 1069 reset_wfp_status();
1007 1070 // set buffer addresses
1008 1071 waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0);
1009 1072 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address;
1010 1073 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
1011 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3);
1074 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a);
1012 1075 // set other parameters
1013 1076 set_wfp_data_shaping();
1014 1077 set_wfp_delta_snapshot(); // time in seconds between two snapshots
1015 1078 waveform_picker_regs->delta_f2_f1 = 0xffff; // 0x16800 => 92160 (max 4 bytes)
1016 1079 waveform_picker_regs->delta_f2_f0 = 0x17c00; // 97 280 (max 5 bytes)
1017 1080 // waveform_picker_regs->nb_burst_available = 0x180; // max 3 bytes, size of the buffer in burst (1 burst = 16 x 4 octets)
1018 1081 // // 3 * 2048 / 16 = 384
1019 1082 // waveform_picker_regs->nb_snapshot_param = 0x7ff; // max 3 octets, 2048 - 1
1020 1083 waveform_picker_regs->nb_burst_available = 0x1b9; // max 3 bytes, size of the buffer in burst (1 burst = 16 x 4 octets)
1021 1084 // 3 * 2352 / 16 = 441
1022 1085 waveform_picker_regs->nb_snapshot_param = 0x944; // max 3 octets, 2372 - 1
1086 }
1023 1087 #endif
1024 }
1025 1088
1026 1089 //*****************
1027 1090 // local parameters
1028 void set_local_sbm1_nb_cwf_max( void )
1029 {
1030 /** This function sets the value of the sbm1_nb_cwf_max local parameter.
1031 *
1032 * The sbm1_nb_cwf_max parameter counts the number of CWF_F1 records that have been sent.\n
1033 * This parameter is used to send CWF_F1 data as normal data when the SBM1 is active.\n\n
1034 * (2 snapshots of 2048 points per seconds) * (period of the NORM snashots) - 8 s (duration of the f2 snapshot)
1035 *
1036 */
1037 param_local.local_sbm1_nb_cwf_max = 2 *
1038 (parameter_dump_packet.sy_lfr_n_swf_p[0] * 256
1039 + parameter_dump_packet.sy_lfr_n_swf_p[1]) - 8; // 16 CWF1 parts during 1 SWF2
1040 }
1041
1042 void set_local_sbm2_nb_cwf_max(void)
1043 {
1044 /** This function sets the value of the sbm1_nb_cwf_max local parameter.
1045 *
1046 * The sbm1_nb_cwf_max parameter counts the number of CWF_F1 records that have been sent.\n
1047 * This parameter is used to send CWF_F2 data as normal data when the SBM2 is active.\n\n
1048 * (period of the NORM snashots) / (8 seconds per snapshot at f2 = 256 Hz)
1049 *
1050 */
1051
1052 param_local.local_sbm2_nb_cwf_max = (parameter_dump_packet.sy_lfr_n_swf_p[0] * 256
1053 + parameter_dump_packet.sy_lfr_n_swf_p[1]) / 8;
1054 }
1055
1056 1091 void set_local_nb_interrupt_f0_MAX( void )
1057 1092 {
1058 1093 /** This function sets the value of the nb_interrupt_f0_MAX local parameter.
1059 1094 *
1060 1095 * This parameter is used for the SM validation only.\n
1061 1096 * The software waits param_local.local_nb_interrupt_f0_MAX interruptions from the spectral matrices
1062 1097 * module before launching a basic processing.
1063 1098 *
1064 1099 */
1065 1100
1066 1101 param_local.local_nb_interrupt_f0_MAX = ( (parameter_dump_packet.sy_lfr_n_asm_p[0]) * 256
1067 1102 + parameter_dump_packet.sy_lfr_n_asm_p[1] ) * 100;
1068 1103 }
1069 1104
1070 void reset_local_sbm1_nb_cwf_sent( void )
1071 {
1072 /** This function resets the value of the sbm1_nb_cwf_sent local parameter.
1073 *
1074 * The sbm1_nb_cwf_sent parameter counts the number of CWF_F1 records that have been sent.\n
1075 * This parameter is used to send CWF_F1 data as normal data when the SBM1 is active.
1076 *
1077 */
1078
1079 param_local.local_sbm1_nb_cwf_sent = 0;
1080 }
1081
1082 void reset_local_sbm2_nb_cwf_sent( void )
1083 {
1084 /** This function resets the value of the sbm2_nb_cwf_sent local parameter.
1085 *
1086 * The sbm2_nb_cwf_sent parameter counts the number of CWF_F2 records that have been sent.\n
1087 * This parameter is used to send CWF_F2 data as normal data when the SBM2 mode is active.
1088 *
1089 */
1090
1091 param_local.local_sbm2_nb_cwf_sent = 0;
1092 }
1093
1094 1105 void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid )
1095 1106 {
1096 1107 unsigned short *sequence_cnt;
1097 1108 unsigned short segmentation_grouping_flag;
1098 1109 unsigned short new_packet_sequence_control;
1099 1110
1100 1111 if ( (sid ==SID_NORM_SWF_F0) || (sid ==SID_NORM_SWF_F1) || (sid ==SID_NORM_SWF_F2)
1101 1112 || (sid ==SID_NORM_CWF_F3) || (sid ==SID_BURST_CWF_F2) )
1102 1113 {
1103 1114 sequence_cnt = &sequenceCounters_SCIENCE_NORMAL_BURST;
1104 1115 }
1105 1116 else if ( (sid ==SID_SBM1_CWF_F1) || (sid ==SID_SBM2_CWF_F2) )
1106 1117 {
1107 1118 sequence_cnt = &sequenceCounters_SCIENCE_SBM1_SBM2;
1108 1119 }
1109 1120 else
1110 1121 {
1111 1122 sequence_cnt = NULL;
1112 1123 PRINTF1("in increment_seq_counter_source_id *** ERR apid_destid %d not known\n", sid)
1113 1124 }
1114 1125
1115 1126 if (sequence_cnt != NULL)
1116 1127 {
1117 1128 segmentation_grouping_flag = (packet_sequence_control[ 0 ] & 0xc0) << 8;
1118 1129 *sequence_cnt = (*sequence_cnt) & 0x3fff;
1119 1130
1120 1131 new_packet_sequence_control = segmentation_grouping_flag | *sequence_cnt ;
1121 1132
1122 1133 packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8);
1123 1134 packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control );
1124 1135
1125 1136 // increment the sequence counter for the next packet
1126 1137 if ( *sequence_cnt < SEQ_CNT_MAX)
1127 1138 {
1128 1139 *sequence_cnt = *sequence_cnt + 1;
1129 1140 }
1130 1141 else
1131 1142 {
1132 1143 *sequence_cnt = 0;
1133 1144 }
1134 1145 }
1135 1146 }
General Comments 0
You need to be logged in to leave comments. Login now