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