@@ -1,273 +1,273 | |||
|
1 | 1 | ############################################################################# |
|
2 | 2 | # Makefile for building: bin/fsw |
|
3 |
# Generated by qmake (2.01a) (Qt 4.8.6) on: |
|
|
3 | # Generated by qmake (2.01a) (Qt 4.8.6) on: Tue Jun 17 07:27:34 2014 | |
|
4 | 4 | # Project: fsw-qt.pro |
|
5 | 5 | # Template: app |
|
6 | 6 | # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro |
|
7 | 7 | ############################################################################# |
|
8 | 8 | |
|
9 | 9 | ####### Compiler, tools and options |
|
10 | 10 | |
|
11 | 11 | CC = sparc-rtems-gcc |
|
12 | 12 | CXX = sparc-rtems-g++ |
|
13 | 13 | DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=10 -DPRINT_MESSAGES_ON_CONSOLE |
|
14 | 14 | CFLAGS = -pipe -O3 -Wall $(DEFINES) |
|
15 | 15 | CXXFLAGS = -pipe -O3 -Wall $(DEFINES) |
|
16 | 16 | INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header -I../header/processing -I../src/LFR_basic-parameters |
|
17 | 17 | LINK = sparc-rtems-g++ |
|
18 | 18 | LFLAGS = |
|
19 | 19 | LIBS = $(SUBLIBS) |
|
20 | 20 | AR = sparc-rtems-ar rcs |
|
21 | 21 | RANLIB = |
|
22 | 22 | QMAKE = /usr/bin/qmake-qt4 |
|
23 | 23 | TAR = tar -cf |
|
24 | 24 | COMPRESS = gzip -9f |
|
25 | 25 | COPY = cp -f |
|
26 | 26 | SED = sed |
|
27 | 27 | COPY_FILE = $(COPY) |
|
28 | 28 | COPY_DIR = $(COPY) -r |
|
29 | 29 | STRIP = sparc-rtems-strip |
|
30 | 30 | INSTALL_FILE = install -m 644 -p |
|
31 | 31 | INSTALL_DIR = $(COPY_DIR) |
|
32 | 32 | INSTALL_PROGRAM = install -m 755 -p |
|
33 | 33 | DEL_FILE = rm -f |
|
34 | 34 | SYMLINK = ln -f -s |
|
35 | 35 | DEL_DIR = rmdir |
|
36 | 36 | MOVE = mv -f |
|
37 | 37 | CHK_DIR_EXISTS= test -d |
|
38 | 38 | MKDIR = mkdir -p |
|
39 | 39 | |
|
40 | 40 | ####### Output directory |
|
41 | 41 | |
|
42 | 42 | OBJECTS_DIR = obj/ |
|
43 | 43 | |
|
44 | 44 | ####### Files |
|
45 | 45 | |
|
46 | 46 | SOURCES = ../src/wf_handler.c \ |
|
47 | 47 | ../src/tc_handler.c \ |
|
48 | 48 | ../src/fsw_misc.c \ |
|
49 | 49 | ../src/fsw_init.c \ |
|
50 | 50 | ../src/fsw_globals.c \ |
|
51 | 51 | ../src/fsw_spacewire.c \ |
|
52 | 52 | ../src/tc_load_dump_parameters.c \ |
|
53 | 53 | ../src/tm_lfr_tc_exe.c \ |
|
54 | 54 | ../src/tc_acceptance.c \ |
|
55 | 55 | ../src/processing/fsw_processing.c \ |
|
56 | 56 | ../src/processing/avf0_prc0.c \ |
|
57 | 57 | ../src/processing/avf1_prc1.c \ |
|
58 | 58 | ../src/processing/avf2_prc2.c \ |
|
59 | 59 | ../src/lfr_cpu_usage_report.c \ |
|
60 | 60 | ../src/LFR_basic-parameters/basic_parameters.c |
|
61 | 61 | OBJECTS = obj/wf_handler.o \ |
|
62 | 62 | obj/tc_handler.o \ |
|
63 | 63 | obj/fsw_misc.o \ |
|
64 | 64 | obj/fsw_init.o \ |
|
65 | 65 | obj/fsw_globals.o \ |
|
66 | 66 | obj/fsw_spacewire.o \ |
|
67 | 67 | obj/tc_load_dump_parameters.o \ |
|
68 | 68 | obj/tm_lfr_tc_exe.o \ |
|
69 | 69 | obj/tc_acceptance.o \ |
|
70 | 70 | obj/fsw_processing.o \ |
|
71 | 71 | obj/avf0_prc0.o \ |
|
72 | 72 | obj/avf1_prc1.o \ |
|
73 | 73 | obj/avf2_prc2.o \ |
|
74 | 74 | obj/lfr_cpu_usage_report.o \ |
|
75 | 75 | obj/basic_parameters.o |
|
76 | 76 | DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \ |
|
77 | 77 | /usr/lib64/qt4/mkspecs/common/linux.conf \ |
|
78 | 78 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ |
|
79 | 79 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ |
|
80 | 80 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ |
|
81 | 81 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ |
|
82 | 82 | /usr/lib64/qt4/mkspecs/qconfig.pri \ |
|
83 | 83 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ |
|
84 | 84 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ |
|
85 | 85 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ |
|
86 | 86 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ |
|
87 | 87 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ |
|
88 | 88 | sparc.pri \ |
|
89 | 89 | /usr/lib64/qt4/mkspecs/features/release.prf \ |
|
90 | 90 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ |
|
91 | 91 | /usr/lib64/qt4/mkspecs/features/shared.prf \ |
|
92 | 92 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ |
|
93 | 93 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ |
|
94 | 94 | /usr/lib64/qt4/mkspecs/features/resources.prf \ |
|
95 | 95 | /usr/lib64/qt4/mkspecs/features/uic.prf \ |
|
96 | 96 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ |
|
97 | 97 | /usr/lib64/qt4/mkspecs/features/lex.prf \ |
|
98 | 98 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \ |
|
99 | 99 | fsw-qt.pro |
|
100 | 100 | QMAKE_TARGET = fsw |
|
101 | 101 | DESTDIR = bin/ |
|
102 | 102 | TARGET = bin/fsw |
|
103 | 103 | |
|
104 | 104 | first: all |
|
105 | 105 | ####### Implicit rules |
|
106 | 106 | |
|
107 | 107 | .SUFFIXES: .o .c .cpp .cc .cxx .C |
|
108 | 108 | |
|
109 | 109 | .cpp.o: |
|
110 | 110 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
111 | 111 | |
|
112 | 112 | .cc.o: |
|
113 | 113 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
114 | 114 | |
|
115 | 115 | .cxx.o: |
|
116 | 116 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
117 | 117 | |
|
118 | 118 | .C.o: |
|
119 | 119 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
120 | 120 | |
|
121 | 121 | .c.o: |
|
122 | 122 | $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<" |
|
123 | 123 | |
|
124 | 124 | ####### Build rules |
|
125 | 125 | |
|
126 | 126 | all: Makefile $(TARGET) |
|
127 | 127 | |
|
128 | 128 | $(TARGET): $(OBJECTS) |
|
129 | 129 | @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/ |
|
130 | 130 | $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) |
|
131 | 131 | |
|
132 | 132 | Makefile: fsw-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \ |
|
133 | 133 | /usr/lib64/qt4/mkspecs/common/linux.conf \ |
|
134 | 134 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ |
|
135 | 135 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ |
|
136 | 136 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ |
|
137 | 137 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ |
|
138 | 138 | /usr/lib64/qt4/mkspecs/qconfig.pri \ |
|
139 | 139 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ |
|
140 | 140 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ |
|
141 | 141 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ |
|
142 | 142 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ |
|
143 | 143 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ |
|
144 | 144 | sparc.pri \ |
|
145 | 145 | /usr/lib64/qt4/mkspecs/features/release.prf \ |
|
146 | 146 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ |
|
147 | 147 | /usr/lib64/qt4/mkspecs/features/shared.prf \ |
|
148 | 148 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ |
|
149 | 149 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ |
|
150 | 150 | /usr/lib64/qt4/mkspecs/features/resources.prf \ |
|
151 | 151 | /usr/lib64/qt4/mkspecs/features/uic.prf \ |
|
152 | 152 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ |
|
153 | 153 | /usr/lib64/qt4/mkspecs/features/lex.prf \ |
|
154 | 154 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf |
|
155 | 155 | $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro |
|
156 | 156 | /usr/lib64/qt4/mkspecs/common/unix.conf: |
|
157 | 157 | /usr/lib64/qt4/mkspecs/common/linux.conf: |
|
158 | 158 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf: |
|
159 | 159 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf: |
|
160 | 160 | /usr/lib64/qt4/mkspecs/common/g++-base.conf: |
|
161 | 161 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf: |
|
162 | 162 | /usr/lib64/qt4/mkspecs/qconfig.pri: |
|
163 | 163 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri: |
|
164 | 164 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf: |
|
165 | 165 | /usr/lib64/qt4/mkspecs/features/qt_config.prf: |
|
166 | 166 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf: |
|
167 | 167 | /usr/lib64/qt4/mkspecs/features/default_pre.prf: |
|
168 | 168 | sparc.pri: |
|
169 | 169 | /usr/lib64/qt4/mkspecs/features/release.prf: |
|
170 | 170 | /usr/lib64/qt4/mkspecs/features/default_post.prf: |
|
171 | 171 | /usr/lib64/qt4/mkspecs/features/shared.prf: |
|
172 | 172 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf: |
|
173 | 173 | /usr/lib64/qt4/mkspecs/features/warn_on.prf: |
|
174 | 174 | /usr/lib64/qt4/mkspecs/features/resources.prf: |
|
175 | 175 | /usr/lib64/qt4/mkspecs/features/uic.prf: |
|
176 | 176 | /usr/lib64/qt4/mkspecs/features/yacc.prf: |
|
177 | 177 | /usr/lib64/qt4/mkspecs/features/lex.prf: |
|
178 | 178 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf: |
|
179 | 179 | qmake: FORCE |
|
180 | 180 | @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro |
|
181 | 181 | |
|
182 | 182 | dist: |
|
183 | 183 | @$(CHK_DIR_EXISTS) obj/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0 |
|
184 | 184 | $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/fsw1.0.0/ && (cd `dirname obj/fsw1.0.0` && $(TAR) fsw1.0.0.tar fsw1.0.0 && $(COMPRESS) fsw1.0.0.tar) && $(MOVE) `dirname obj/fsw1.0.0`/fsw1.0.0.tar.gz . && $(DEL_FILE) -r obj/fsw1.0.0 |
|
185 | 185 | |
|
186 | 186 | |
|
187 | 187 | clean:compiler_clean |
|
188 | 188 | -$(DEL_FILE) $(OBJECTS) |
|
189 | 189 | -$(DEL_FILE) *~ core *.core |
|
190 | 190 | |
|
191 | 191 | |
|
192 | 192 | ####### Sub-libraries |
|
193 | 193 | |
|
194 | 194 | distclean: clean |
|
195 | 195 | -$(DEL_FILE) $(TARGET) |
|
196 | 196 | -$(DEL_FILE) Makefile |
|
197 | 197 | |
|
198 | 198 | |
|
199 | 199 | grmon: |
|
200 | 200 | cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u |
|
201 | 201 | |
|
202 | 202 | check: first |
|
203 | 203 | |
|
204 | 204 | compiler_rcc_make_all: |
|
205 | 205 | compiler_rcc_clean: |
|
206 | 206 | compiler_uic_make_all: |
|
207 | 207 | compiler_uic_clean: |
|
208 | 208 | compiler_image_collection_make_all: qmake_image_collection.cpp |
|
209 | 209 | compiler_image_collection_clean: |
|
210 | 210 | -$(DEL_FILE) qmake_image_collection.cpp |
|
211 | 211 | compiler_yacc_decl_make_all: |
|
212 | 212 | compiler_yacc_decl_clean: |
|
213 | 213 | compiler_yacc_impl_make_all: |
|
214 | 214 | compiler_yacc_impl_clean: |
|
215 | 215 | compiler_lex_make_all: |
|
216 | 216 | compiler_lex_clean: |
|
217 | 217 | compiler_clean: |
|
218 | 218 | |
|
219 | 219 | ####### Compile |
|
220 | 220 | |
|
221 | 221 | obj/wf_handler.o: ../src/wf_handler.c |
|
222 | 222 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/wf_handler.o ../src/wf_handler.c |
|
223 | 223 | |
|
224 | 224 | obj/tc_handler.o: ../src/tc_handler.c |
|
225 | 225 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o ../src/tc_handler.c |
|
226 | 226 | |
|
227 | 227 | obj/fsw_misc.o: ../src/fsw_misc.c |
|
228 | 228 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c |
|
229 | 229 | |
|
230 | 230 | obj/fsw_init.o: ../src/fsw_init.c ../src/fsw_config.c |
|
231 | 231 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o ../src/fsw_init.c |
|
232 | 232 | |
|
233 | 233 | obj/fsw_globals.o: ../src/fsw_globals.c |
|
234 | 234 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c |
|
235 | 235 | |
|
236 | 236 | obj/fsw_spacewire.o: ../src/fsw_spacewire.c |
|
237 | 237 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spacewire.o ../src/fsw_spacewire.c |
|
238 | 238 | |
|
239 | 239 | obj/tc_load_dump_parameters.o: ../src/tc_load_dump_parameters.c |
|
240 | 240 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_load_dump_parameters.o ../src/tc_load_dump_parameters.c |
|
241 | 241 | |
|
242 | 242 | obj/tm_lfr_tc_exe.o: ../src/tm_lfr_tc_exe.c |
|
243 | 243 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tm_lfr_tc_exe.o ../src/tm_lfr_tc_exe.c |
|
244 | 244 | |
|
245 | 245 | obj/tc_acceptance.o: ../src/tc_acceptance.c |
|
246 | 246 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_acceptance.o ../src/tc_acceptance.c |
|
247 | 247 | |
|
248 | 248 | obj/fsw_processing.o: ../src/processing/fsw_processing.c |
|
249 | 249 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/processing/fsw_processing.c |
|
250 | 250 | |
|
251 | 251 | obj/avf0_prc0.o: ../src/processing/avf0_prc0.c |
|
252 | 252 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf0_prc0.o ../src/processing/avf0_prc0.c |
|
253 | 253 | |
|
254 | 254 | obj/avf1_prc1.o: ../src/processing/avf1_prc1.c |
|
255 | 255 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf1_prc1.o ../src/processing/avf1_prc1.c |
|
256 | 256 | |
|
257 | 257 | obj/avf2_prc2.o: ../src/processing/avf2_prc2.c |
|
258 | 258 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf2_prc2.o ../src/processing/avf2_prc2.c |
|
259 | 259 | |
|
260 | 260 | obj/lfr_cpu_usage_report.o: ../src/lfr_cpu_usage_report.c |
|
261 | 261 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/lfr_cpu_usage_report.o ../src/lfr_cpu_usage_report.c |
|
262 | 262 | |
|
263 | 263 | obj/basic_parameters.o: ../src/LFR_basic-parameters/basic_parameters.c |
|
264 | 264 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/basic_parameters.o ../src/LFR_basic-parameters/basic_parameters.c |
|
265 | 265 | |
|
266 | 266 | ####### Install |
|
267 | 267 | |
|
268 | 268 | install: FORCE |
|
269 | 269 | |
|
270 | 270 | uninstall: FORCE |
|
271 | 271 | |
|
272 | 272 | FORCE: |
|
273 | 273 |
@@ -1,201 +1,201 | |||
|
1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
|
2 | 2 | <!DOCTYPE QtCreatorProject> |
|
3 |
<!-- Written by QtCreator 3.0.1, 2014-06-1 |
|
|
3 | <!-- Written by QtCreator 3.0.1, 2014-06-17T07:01:31. --> | |
|
4 | 4 | <qtcreator> |
|
5 | 5 | <data> |
|
6 | 6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
|
7 | 7 | <value type="int">0</value> |
|
8 | 8 | </data> |
|
9 | 9 | <data> |
|
10 | 10 | <variable>ProjectExplorer.Project.EditorSettings</variable> |
|
11 | 11 | <valuemap type="QVariantMap"> |
|
12 | 12 | <value type="bool" key="EditorConfiguration.AutoIndent">true</value> |
|
13 | 13 | <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value> |
|
14 | 14 | <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value> |
|
15 | 15 | <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0"> |
|
16 | 16 | <value type="QString" key="language">Cpp</value> |
|
17 | 17 | <valuemap type="QVariantMap" key="value"> |
|
18 | 18 | <value type="QByteArray" key="CurrentPreferences">CppGlobal</value> |
|
19 | 19 | </valuemap> |
|
20 | 20 | </valuemap> |
|
21 | 21 | <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1"> |
|
22 | 22 | <value type="QString" key="language">QmlJS</value> |
|
23 | 23 | <valuemap type="QVariantMap" key="value"> |
|
24 | 24 | <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value> |
|
25 | 25 | </valuemap> |
|
26 | 26 | </valuemap> |
|
27 | 27 | <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value> |
|
28 | 28 | <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value> |
|
29 | 29 | <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value> |
|
30 | 30 | <value type="int" key="EditorConfiguration.IndentSize">4</value> |
|
31 | 31 | <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value> |
|
32 | 32 | <value type="bool" key="EditorConfiguration.MouseNavigation">true</value> |
|
33 | 33 | <value type="int" key="EditorConfiguration.PaddingMode">1</value> |
|
34 | 34 | <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value> |
|
35 | 35 | <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value> |
|
36 | 36 | <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value> |
|
37 | 37 | <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value> |
|
38 | 38 | <value type="int" key="EditorConfiguration.TabSize">8</value> |
|
39 | 39 | <value type="bool" key="EditorConfiguration.UseGlobal">true</value> |
|
40 | 40 | <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value> |
|
41 | 41 | <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value> |
|
42 | 42 | <value type="bool" key="EditorConfiguration.cleanIndentation">true</value> |
|
43 | 43 | <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value> |
|
44 | 44 | <value type="bool" key="EditorConfiguration.inEntireDocument">false</value> |
|
45 | 45 | </valuemap> |
|
46 | 46 | </data> |
|
47 | 47 | <data> |
|
48 | 48 | <variable>ProjectExplorer.Project.PluginSettings</variable> |
|
49 | 49 | <valuemap type="QVariantMap"/> |
|
50 | 50 | </data> |
|
51 | 51 | <data> |
|
52 | 52 | <variable>ProjectExplorer.Project.Target.0</variable> |
|
53 | 53 | <valuemap type="QVariantMap"> |
|
54 | 54 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-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">0</value> |
|
60 | 60 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> |
|
61 | 61 | <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory"></value> |
|
62 | 62 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|
63 | 63 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
64 | 64 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
65 | 65 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> |
|
66 | 66 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
67 | 67 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> |
|
68 | 68 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> |
|
69 | 69 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value> |
|
70 | 70 | <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> |
|
71 | 71 | <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> |
|
72 | 72 | </valuemap> |
|
73 | 73 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> |
|
74 | 74 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
75 | 75 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
76 | 76 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
77 | 77 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
78 | 78 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
79 | 79 | <value type="QString">-w</value> |
|
80 | 80 | <value type="QString">-r</value> |
|
81 | 81 | </valuelist> |
|
82 | 82 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> |
|
83 | 83 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> |
|
84 | 84 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
85 | 85 | </valuemap> |
|
86 | 86 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> |
|
87 | 87 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> |
|
88 | 88 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
89 | 89 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> |
|
90 | 90 | </valuemap> |
|
91 | 91 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> |
|
92 | 92 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
93 | 93 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
94 | 94 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
95 | 95 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
96 | 96 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
97 | 97 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
98 | 98 | <value type="QString">-w</value> |
|
99 | 99 | <value type="QString">-r</value> |
|
100 | 100 | </valuelist> |
|
101 | 101 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> |
|
102 | 102 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> |
|
103 | 103 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
104 | 104 | </valuemap> |
|
105 | 105 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> |
|
106 | 106 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> |
|
107 | 107 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
108 | 108 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> |
|
109 | 109 | </valuemap> |
|
110 | 110 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> |
|
111 | 111 | <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> |
|
112 | 112 | <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> |
|
113 | 113 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value> |
|
114 | 114 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
115 | 115 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> |
|
116 | 116 | <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> |
|
117 | 117 | <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> |
|
118 | 118 | </valuemap> |
|
119 | 119 | <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value> |
|
120 | 120 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0"> |
|
121 | 121 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|
122 | 122 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value> |
|
123 | 123 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value> |
|
124 | 124 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
125 | 125 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value> |
|
126 | 126 | </valuemap> |
|
127 | 127 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value> |
|
128 | 128 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value> |
|
129 | 129 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
130 | 130 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value> |
|
131 | 131 | </valuemap> |
|
132 | 132 | <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> |
|
133 | 133 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/> |
|
134 | 134 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> |
|
135 | 135 | <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> |
|
136 | 136 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> |
|
137 | 137 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> |
|
138 | 138 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> |
|
139 | 139 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> |
|
140 | 140 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> |
|
141 | 141 | <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> |
|
142 | 142 | <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> |
|
143 | 143 | <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> |
|
144 | 144 | <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value> |
|
145 | 145 | <value type="int" key="Analyzer.Valgrind.NumCallers">25</value> |
|
146 | 146 | <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> |
|
147 | 147 | <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value> |
|
148 | 148 | <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value> |
|
149 | 149 | <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value> |
|
150 | 150 | <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> |
|
151 | 151 | <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> |
|
152 | 152 | <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> |
|
153 | 153 | <value type="int">0</value> |
|
154 | 154 | <value type="int">1</value> |
|
155 | 155 | <value type="int">2</value> |
|
156 | 156 | <value type="int">3</value> |
|
157 | 157 | <value type="int">4</value> |
|
158 | 158 | <value type="int">5</value> |
|
159 | 159 | <value type="int">6</value> |
|
160 | 160 | <value type="int">7</value> |
|
161 | 161 | <value type="int">8</value> |
|
162 | 162 | <value type="int">9</value> |
|
163 | 163 | <value type="int">10</value> |
|
164 | 164 | <value type="int">11</value> |
|
165 | 165 | <value type="int">12</value> |
|
166 | 166 | <value type="int">13</value> |
|
167 | 167 | <value type="int">14</value> |
|
168 | 168 | </valuelist> |
|
169 | 169 | <value type="int" key="PE.EnvironmentAspect.Base">2</value> |
|
170 | 170 | <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> |
|
171 | 171 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value> |
|
172 | 172 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
173 | 173 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value> |
|
174 | 174 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value> |
|
175 | 175 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value> |
|
176 | 176 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value> |
|
177 | 177 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value> |
|
178 | 178 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value> |
|
179 | 179 | <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> |
|
180 | 180 | <value type="bool" key="RunConfiguration.UseCppDebugger">true</value> |
|
181 | 181 | <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value> |
|
182 | 182 | <value type="bool" key="RunConfiguration.UseMultiProcess">false</value> |
|
183 | 183 | <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> |
|
184 | 184 | <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> |
|
185 | 185 | </valuemap> |
|
186 | 186 | <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value> |
|
187 | 187 | </valuemap> |
|
188 | 188 | </data> |
|
189 | 189 | <data> |
|
190 | 190 | <variable>ProjectExplorer.Project.TargetCount</variable> |
|
191 | 191 | <value type="int">1</value> |
|
192 | 192 | </data> |
|
193 | 193 | <data> |
|
194 | 194 | <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable> |
|
195 | 195 | <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value> |
|
196 | 196 | </data> |
|
197 | 197 | <data> |
|
198 | 198 | <variable>ProjectExplorer.Project.Updater.FileVersion</variable> |
|
199 | 199 | <value type="int">15</value> |
|
200 | 200 | </data> |
|
201 | 201 | </qtcreator> |
@@ -1,782 +1,782 | |||
|
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_INIT_TASK_ATTRIBUTES (RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT) |
|
36 | 36 | #define CONFIGURE_MAXIMUM_DRIVERS 16 |
|
37 | 37 | #define CONFIGURE_MAXIMUM_PERIODS 5 |
|
38 | 38 | #define CONFIGURE_MAXIMUM_TIMERS 5 // STAT (1s), send SWF (0.3s), send CWF3 (1s) |
|
39 | 39 | #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 5 |
|
40 | 40 | #ifdef PRINT_STACK_REPORT |
|
41 | 41 | #define CONFIGURE_STACK_CHECKER_ENABLED |
|
42 | 42 | #endif |
|
43 | 43 | |
|
44 | 44 | #include <rtems/confdefs.h> |
|
45 | 45 | |
|
46 | 46 | /* If --drvmgr was enabled during the configuration of the RTEMS kernel */ |
|
47 | 47 | #ifdef RTEMS_DRVMGR_STARTUP |
|
48 | 48 | #ifdef LEON3 |
|
49 | 49 | /* Add Timer and UART Driver */ |
|
50 | 50 | #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
|
51 | 51 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER |
|
52 | 52 | #endif |
|
53 | 53 | #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
|
54 | 54 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART |
|
55 | 55 | #endif |
|
56 | 56 | #endif |
|
57 | 57 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */ |
|
58 | 58 | #include <drvmgr/drvmgr_confdefs.h> |
|
59 | 59 | #endif |
|
60 | 60 | |
|
61 | 61 | #include "fsw_init.h" |
|
62 | 62 | #include "fsw_config.c" |
|
63 | 63 | |
|
64 | 64 | rtems_task Init( rtems_task_argument ignored ) |
|
65 | 65 | { |
|
66 | 66 | /** This is the RTEMS INIT taks, it the first task launched by the system. |
|
67 | 67 | * |
|
68 | 68 | * @param unused is the starting argument of the RTEMS task |
|
69 | 69 | * |
|
70 | 70 | * The INIT task create and run all other RTEMS tasks. |
|
71 | 71 | * |
|
72 | 72 | */ |
|
73 | 73 | |
|
74 | 74 | unsigned char *vhdlVersion; |
|
75 | 75 | |
|
76 | 76 | reset_local_time(); |
|
77 | 77 | |
|
78 | 78 | rtems_cpu_usage_reset(); |
|
79 | 79 | |
|
80 | 80 | rtems_status_code status; |
|
81 | 81 | rtems_status_code status_spw; |
|
82 | 82 | rtems_isr_entry old_isr_handler; |
|
83 | 83 | |
|
84 | 84 | // UART settings |
|
85 | 85 | send_console_outputs_on_apbuart_port(); |
|
86 | 86 | set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE); |
|
87 | 87 | enable_apbuart_transmitter(); |
|
88 | 88 | DEBUG_PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n") |
|
89 | 89 | |
|
90 | 90 | PRINTF("\n\n\n\n\n") |
|
91 | 91 | PRINTF("*************************\n") |
|
92 | 92 | PRINTF("** LFR Flight Software **\n") |
|
93 | 93 | PRINTF1("** %d.", SW_VERSION_N1) |
|
94 | 94 | PRINTF1("%d." , SW_VERSION_N2) |
|
95 | 95 | PRINTF1("%d." , SW_VERSION_N3) |
|
96 | 96 | PRINTF1("%d **\n", SW_VERSION_N4) |
|
97 | 97 | |
|
98 | 98 | vhdlVersion = (unsigned char *) (REGS_ADDR_VHDL_VERSION); |
|
99 | 99 | PRINTF("** VHDL **\n") |
|
100 | 100 | PRINTF1("** %d.", vhdlVersion[1]) |
|
101 | 101 | PRINTF1("%d." , vhdlVersion[2]) |
|
102 | 102 | PRINTF1("%d **\n", vhdlVersion[3]) |
|
103 | 103 | PRINTF("*************************\n") |
|
104 | 104 | PRINTF("\n\n") |
|
105 | 105 | |
|
106 | 106 | init_parameter_dump(); |
|
107 | 107 | init_local_mode_parameters(); |
|
108 | 108 | init_housekeeping_parameters(); |
|
109 | 109 | |
|
110 | 110 | // waveform picker initialization |
|
111 | 111 | WFP_init_rings(); // initialize the waveform rings |
|
112 | 112 | WFP_reset_current_ring_nodes(); |
|
113 | 113 | reset_waveform_picker_regs(); |
|
114 | 114 | |
|
115 | 115 | // spectral matrices initialization |
|
116 | 116 | SM_init_rings(); // initialize spectral matrices rings |
|
117 | 117 | SM_reset_current_ring_nodes(); |
|
118 | 118 | reset_spectral_matrix_regs(); |
|
119 | 119 | |
|
120 | 120 | updateLFRCurrentMode(); |
|
121 | 121 | |
|
122 | 122 | BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode) |
|
123 | 123 | |
|
124 | 124 | create_names(); // create all names |
|
125 | 125 | |
|
126 | 126 | status = create_message_queues(); // create message queues |
|
127 | 127 | if (status != RTEMS_SUCCESSFUL) |
|
128 | 128 | { |
|
129 | 129 | PRINTF1("in INIT *** ERR in create_message_queues, code %d", status) |
|
130 | 130 | } |
|
131 | 131 | |
|
132 | 132 | status = create_all_tasks(); // create all tasks |
|
133 | 133 | if (status != RTEMS_SUCCESSFUL) |
|
134 | 134 | { |
|
135 | 135 | PRINTF1("in INIT *** ERR in create_all_tasks, code %d\n", status) |
|
136 | 136 | } |
|
137 | 137 | |
|
138 | 138 | // ************************** |
|
139 | 139 | // <SPACEWIRE INITIALIZATION> |
|
140 | 140 | grspw_timecode_callback = &timecode_irq_handler; |
|
141 | 141 | |
|
142 | 142 | status_spw = spacewire_open_link(); // (1) open the link |
|
143 | 143 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
144 | 144 | { |
|
145 | 145 | PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw ) |
|
146 | 146 | } |
|
147 | 147 | |
|
148 | 148 | if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link |
|
149 | 149 | { |
|
150 | 150 | status_spw = spacewire_configure_link( fdSPW ); |
|
151 | 151 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
152 | 152 | { |
|
153 | 153 | PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw ) |
|
154 | 154 | } |
|
155 | 155 | } |
|
156 | 156 | |
|
157 | 157 | if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link |
|
158 | 158 | { |
|
159 | 159 | status_spw = spacewire_start_link( fdSPW ); |
|
160 | 160 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
161 | 161 | { |
|
162 | 162 | PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw ) |
|
163 | 163 | } |
|
164 | 164 | } |
|
165 | 165 | // </SPACEWIRE INITIALIZATION> |
|
166 | 166 | // *************************** |
|
167 | 167 | |
|
168 | 168 | status = start_all_tasks(); // start all tasks |
|
169 | 169 | if (status != RTEMS_SUCCESSFUL) |
|
170 | 170 | { |
|
171 | 171 | PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status) |
|
172 | 172 | } |
|
173 | 173 | |
|
174 | 174 | // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization |
|
175 | 175 | status = start_recv_send_tasks(); |
|
176 | 176 | if ( status != RTEMS_SUCCESSFUL ) |
|
177 | 177 | { |
|
178 | 178 | PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status ) |
|
179 | 179 | } |
|
180 | 180 | |
|
181 | 181 | // suspend science tasks, they will be restarted later depending on the mode |
|
182 | 182 | status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY) |
|
183 | 183 | if (status != RTEMS_SUCCESSFUL) |
|
184 | 184 | { |
|
185 | 185 | PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status) |
|
186 | 186 | } |
|
187 | 187 | |
|
188 | 188 | //****************************** |
|
189 | 189 | // <SPECTRAL MATRICES SIMULATOR> |
|
190 | 190 | LEON_Mask_interrupt( IRQ_SM_SIMULATOR ); |
|
191 | 191 | configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR, |
|
192 | 192 | IRQ_SPARC_SM_SIMULATOR, spectral_matrices_isr_simu ); |
|
193 | 193 | // </SPECTRAL MATRICES SIMULATOR> |
|
194 | 194 | //******************************* |
|
195 | 195 | |
|
196 | 196 | // configure IRQ handling for the waveform picker unit |
|
197 | 197 | status = rtems_interrupt_catch( waveforms_isr, |
|
198 | 198 | IRQ_SPARC_WAVEFORM_PICKER, |
|
199 | 199 | &old_isr_handler) ; |
|
200 | 200 | // configure IRQ handling for the spectral matrices unit |
|
201 | 201 | status = rtems_interrupt_catch( spectral_matrices_isr, |
|
202 | 202 | IRQ_SPARC_SPECTRAL_MATRIX, |
|
203 | 203 | &old_isr_handler) ; |
|
204 | 204 | |
|
205 | 205 | // if the spacewire link is not up then send an event to the SPIQ task for link recovery |
|
206 | 206 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
207 | 207 | { |
|
208 | 208 | status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT ); |
|
209 | 209 | if ( status != RTEMS_SUCCESSFUL ) { |
|
210 | 210 | PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status ) |
|
211 | 211 | } |
|
212 | 212 | } |
|
213 | 213 | |
|
214 | 214 | BOOT_PRINTF("delete INIT\n") |
|
215 | 215 | |
|
216 | 216 | send_dumb_hk(); |
|
217 | 217 | |
|
218 | 218 | status = rtems_task_delete(RTEMS_SELF); |
|
219 | 219 | |
|
220 | 220 | } |
|
221 | 221 | |
|
222 | 222 | void init_local_mode_parameters( void ) |
|
223 | 223 | { |
|
224 | 224 | /** This function initialize the param_local global variable with default values. |
|
225 | 225 | * |
|
226 | 226 | */ |
|
227 | 227 | |
|
228 | 228 | unsigned int i; |
|
229 | 229 | |
|
230 | 230 | // LOCAL PARAMETERS |
|
231 | 231 | |
|
232 | 232 | BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max) |
|
233 | 233 | BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max) |
|
234 | 234 | BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX) |
|
235 | 235 | |
|
236 | 236 | // init sequence counters |
|
237 | 237 | |
|
238 | 238 | for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++) |
|
239 | 239 | { |
|
240 | 240 | sequenceCounters_TC_EXE[i] = 0x00; |
|
241 | 241 | } |
|
242 | 242 | sequenceCounters_SCIENCE_NORMAL_BURST = 0x00; |
|
243 | sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00; | |
|
244 | sequenceCounterHK = TM_PACKET_SEQ_CTRL_STANDALONE << 8; | |
|
245 | sequenceCounterParameterDump = TM_PACKET_SEQ_CTRL_STANDALONE << 8; | |
|
243 | sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00; | |
|
244 | sequenceCounterHK = TM_PACKET_SEQ_CTRL_STANDALONE << 8; | |
|
245 | sequenceCounterParameterDump = TM_PACKET_SEQ_CTRL_STANDALONE << 8; | |
|
246 | 246 | } |
|
247 | 247 | |
|
248 | 248 | void reset_local_time( void ) |
|
249 | 249 | { |
|
250 | 250 | time_management_regs->ctrl = 0x02; // software reset, coarse time = 0x80000000 |
|
251 | 251 | } |
|
252 | 252 | |
|
253 | 253 | void create_names( void ) // create all names for tasks and queues |
|
254 | 254 | { |
|
255 | 255 | /** This function creates all RTEMS names used in the software for tasks and queues. |
|
256 | 256 | * |
|
257 | 257 | * @return RTEMS directive status codes: |
|
258 | 258 | * - RTEMS_SUCCESSFUL - successful completion |
|
259 | 259 | * |
|
260 | 260 | */ |
|
261 | 261 | |
|
262 | 262 | // task names |
|
263 | 263 | Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' ); |
|
264 | 264 | Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' ); |
|
265 | 265 | Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' ); |
|
266 | 266 | Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' ); |
|
267 | 267 | Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' ); |
|
268 | 268 | Task_name[TASKID_SWBD] = rtems_build_name( 'S', 'W', 'B', 'D' ); |
|
269 | 269 | Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' ); |
|
270 | 270 | Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' ); |
|
271 | 271 | Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' ); |
|
272 | 272 | Task_name[TASKID_PRC0] = rtems_build_name( 'P', 'R', 'C', '0' ); |
|
273 | 273 | Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' ); |
|
274 | 274 | Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' ); |
|
275 | 275 | Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' ); |
|
276 | 276 | Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' ); |
|
277 | 277 | Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' ); |
|
278 | 278 | Task_name[TASKID_AVF1] = rtems_build_name( 'A', 'V', 'F', '1' ); |
|
279 | 279 | Task_name[TASKID_PRC1] = rtems_build_name( 'P', 'R', 'C', '1' ); |
|
280 | 280 | Task_name[TASKID_AVF2] = rtems_build_name( 'A', 'V', 'F', '2' ); |
|
281 | 281 | Task_name[TASKID_PRC2] = rtems_build_name( 'P', 'R', 'C', '2' ); |
|
282 | 282 | |
|
283 | 283 | // rate monotonic period names |
|
284 | 284 | name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' ); |
|
285 | 285 | |
|
286 | 286 | misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' ); |
|
287 | 287 | misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' ); |
|
288 | 288 | misc_name[QUEUE_PRC0] = rtems_build_name( 'Q', '_', 'P', '0' ); |
|
289 | 289 | misc_name[QUEUE_PRC1] = rtems_build_name( 'Q', '_', 'P', '1' ); |
|
290 | 290 | misc_name[QUEUE_PRC2] = rtems_build_name( 'Q', '_', 'P', '2' ); |
|
291 | 291 | } |
|
292 | 292 | |
|
293 | 293 | int create_all_tasks( void ) // create all tasks which run in the software |
|
294 | 294 | { |
|
295 | 295 | /** This function creates all RTEMS tasks used in the software. |
|
296 | 296 | * |
|
297 | 297 | * @return RTEMS directive status codes: |
|
298 | 298 | * - RTEMS_SUCCESSFUL - task created successfully |
|
299 | 299 | * - RTEMS_INVALID_ADDRESS - id is NULL |
|
300 | 300 | * - RTEMS_INVALID_NAME - invalid task name |
|
301 | 301 | * - RTEMS_INVALID_PRIORITY - invalid task priority |
|
302 | 302 | * - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured |
|
303 | 303 | * - RTEMS_TOO_MANY - too many tasks created |
|
304 | 304 | * - RTEMS_UNSATISFIED - not enough memory for stack/FP context |
|
305 | 305 | * - RTEMS_TOO_MANY - too many global objects |
|
306 | 306 | * |
|
307 | 307 | */ |
|
308 | 308 | |
|
309 | 309 | rtems_status_code status; |
|
310 | 310 | |
|
311 | 311 | //********** |
|
312 | 312 | // SPACEWIRE |
|
313 | 313 | // RECV |
|
314 | 314 | status = rtems_task_create( |
|
315 | 315 | Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE, |
|
316 | 316 | RTEMS_DEFAULT_MODES, |
|
317 | 317 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV] |
|
318 | 318 | ); |
|
319 | 319 | if (status == RTEMS_SUCCESSFUL) // SEND |
|
320 | 320 | { |
|
321 | 321 | status = rtems_task_create( |
|
322 | 322 | Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE, |
|
323 | 323 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
324 | 324 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SEND] |
|
325 | 325 | ); |
|
326 | 326 | } |
|
327 | 327 | if (status == RTEMS_SUCCESSFUL) // WTDG |
|
328 | 328 | { |
|
329 | 329 | status = rtems_task_create( |
|
330 | 330 | Task_name[TASKID_WTDG], TASK_PRIORITY_WTDG, RTEMS_MINIMUM_STACK_SIZE, |
|
331 | 331 | RTEMS_DEFAULT_MODES, |
|
332 | 332 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_WTDG] |
|
333 | 333 | ); |
|
334 | 334 | } |
|
335 | 335 | if (status == RTEMS_SUCCESSFUL) // ACTN |
|
336 | 336 | { |
|
337 | 337 | status = rtems_task_create( |
|
338 | 338 | Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE, |
|
339 | 339 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
340 | 340 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN] |
|
341 | 341 | ); |
|
342 | 342 | } |
|
343 | 343 | if (status == RTEMS_SUCCESSFUL) // SPIQ |
|
344 | 344 | { |
|
345 | 345 | status = rtems_task_create( |
|
346 | 346 | Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE, |
|
347 | 347 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
348 | 348 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ] |
|
349 | 349 | ); |
|
350 | 350 | } |
|
351 | 351 | |
|
352 | 352 | //****************** |
|
353 | 353 | // SPECTRAL MATRICES |
|
354 | 354 | if (status == RTEMS_SUCCESSFUL) // AVF0 |
|
355 | 355 | { |
|
356 | 356 | status = rtems_task_create( |
|
357 | 357 | Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE, |
|
358 | 358 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
359 | 359 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0] |
|
360 | 360 | ); |
|
361 | 361 | } |
|
362 | 362 | if (status == RTEMS_SUCCESSFUL) // PRC0 |
|
363 | 363 | { |
|
364 | 364 | status = rtems_task_create( |
|
365 | 365 | Task_name[TASKID_PRC0], TASK_PRIORITY_PRC0, RTEMS_MINIMUM_STACK_SIZE * 2, |
|
366 | 366 | RTEMS_DEFAULT_MODES, |
|
367 | 367 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC0] |
|
368 | 368 | ); |
|
369 | 369 | } |
|
370 | 370 | if (status == RTEMS_SUCCESSFUL) // AVF1 |
|
371 | 371 | { |
|
372 | 372 | status = rtems_task_create( |
|
373 | 373 | Task_name[TASKID_AVF1], TASK_PRIORITY_AVF1, RTEMS_MINIMUM_STACK_SIZE, |
|
374 | 374 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
375 | 375 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF1] |
|
376 | 376 | ); |
|
377 | 377 | } |
|
378 | 378 | if (status == RTEMS_SUCCESSFUL) // PRC1 |
|
379 | 379 | { |
|
380 | 380 | status = rtems_task_create( |
|
381 | 381 | Task_name[TASKID_PRC1], TASK_PRIORITY_PRC1, RTEMS_MINIMUM_STACK_SIZE * 2, |
|
382 | 382 | RTEMS_DEFAULT_MODES, |
|
383 | 383 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC1] |
|
384 | 384 | ); |
|
385 | 385 | } |
|
386 | 386 | if (status == RTEMS_SUCCESSFUL) // AVF2 |
|
387 | 387 | { |
|
388 | 388 | status = rtems_task_create( |
|
389 | 389 | Task_name[TASKID_AVF2], TASK_PRIORITY_AVF2, RTEMS_MINIMUM_STACK_SIZE, |
|
390 | 390 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
391 | 391 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF2] |
|
392 | 392 | ); |
|
393 | 393 | } |
|
394 | 394 | if (status == RTEMS_SUCCESSFUL) // PRC2 |
|
395 | 395 | { |
|
396 | 396 | status = rtems_task_create( |
|
397 | 397 | Task_name[TASKID_PRC2], TASK_PRIORITY_PRC2, RTEMS_MINIMUM_STACK_SIZE * 2, |
|
398 | 398 | RTEMS_DEFAULT_MODES, |
|
399 | 399 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC2] |
|
400 | 400 | ); |
|
401 | 401 | } |
|
402 | 402 | |
|
403 | 403 | //**************** |
|
404 | 404 | // WAVEFORM PICKER |
|
405 | 405 | if (status == RTEMS_SUCCESSFUL) // WFRM |
|
406 | 406 | { |
|
407 | 407 | status = rtems_task_create( |
|
408 | 408 | Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE, |
|
409 | 409 | RTEMS_DEFAULT_MODES, |
|
410 | 410 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM] |
|
411 | 411 | ); |
|
412 | 412 | } |
|
413 | 413 | if (status == RTEMS_SUCCESSFUL) // CWF3 |
|
414 | 414 | { |
|
415 | 415 | status = rtems_task_create( |
|
416 | 416 | Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE, |
|
417 | 417 | RTEMS_DEFAULT_MODES, |
|
418 | 418 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF3] |
|
419 | 419 | ); |
|
420 | 420 | } |
|
421 | 421 | if (status == RTEMS_SUCCESSFUL) // CWF2 |
|
422 | 422 | { |
|
423 | 423 | status = rtems_task_create( |
|
424 | 424 | Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE, |
|
425 | 425 | RTEMS_DEFAULT_MODES, |
|
426 | 426 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF2] |
|
427 | 427 | ); |
|
428 | 428 | } |
|
429 | 429 | if (status == RTEMS_SUCCESSFUL) // CWF1 |
|
430 | 430 | { |
|
431 | 431 | status = rtems_task_create( |
|
432 | 432 | Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE, |
|
433 | 433 | RTEMS_DEFAULT_MODES, |
|
434 | 434 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF1] |
|
435 | 435 | ); |
|
436 | 436 | } |
|
437 | 437 | if (status == RTEMS_SUCCESSFUL) // SWBD |
|
438 | 438 | { |
|
439 | 439 | status = rtems_task_create( |
|
440 | 440 | Task_name[TASKID_SWBD], TASK_PRIORITY_SWBD, RTEMS_MINIMUM_STACK_SIZE, |
|
441 | 441 | RTEMS_DEFAULT_MODES, |
|
442 | 442 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_SWBD] |
|
443 | 443 | ); |
|
444 | 444 | } |
|
445 | 445 | |
|
446 | 446 | //***** |
|
447 | 447 | // MISC |
|
448 | 448 | if (status == RTEMS_SUCCESSFUL) // STAT |
|
449 | 449 | { |
|
450 | 450 | status = rtems_task_create( |
|
451 | 451 | Task_name[TASKID_STAT], TASK_PRIORITY_STAT, RTEMS_MINIMUM_STACK_SIZE, |
|
452 | 452 | RTEMS_DEFAULT_MODES, |
|
453 | 453 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT] |
|
454 | 454 | ); |
|
455 | 455 | } |
|
456 | 456 | if (status == RTEMS_SUCCESSFUL) // DUMB |
|
457 | 457 | { |
|
458 | 458 | status = rtems_task_create( |
|
459 | 459 | Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE, |
|
460 | 460 | RTEMS_DEFAULT_MODES, |
|
461 | 461 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB] |
|
462 | 462 | ); |
|
463 | 463 | } |
|
464 | 464 | if (status == RTEMS_SUCCESSFUL) // HOUS |
|
465 | 465 | { |
|
466 | 466 | status = rtems_task_create( |
|
467 | 467 | Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE, |
|
468 | 468 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
469 | 469 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS] |
|
470 | 470 | ); |
|
471 | 471 | } |
|
472 | 472 | |
|
473 | 473 | return status; |
|
474 | 474 | } |
|
475 | 475 | |
|
476 | 476 | int start_recv_send_tasks( void ) |
|
477 | 477 | { |
|
478 | 478 | rtems_status_code status; |
|
479 | 479 | |
|
480 | 480 | status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 ); |
|
481 | 481 | if (status!=RTEMS_SUCCESSFUL) { |
|
482 | 482 | BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n") |
|
483 | 483 | } |
|
484 | 484 | |
|
485 | 485 | if (status == RTEMS_SUCCESSFUL) // SEND |
|
486 | 486 | { |
|
487 | 487 | status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 ); |
|
488 | 488 | if (status!=RTEMS_SUCCESSFUL) { |
|
489 | 489 | BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n") |
|
490 | 490 | } |
|
491 | 491 | } |
|
492 | 492 | |
|
493 | 493 | return status; |
|
494 | 494 | } |
|
495 | 495 | |
|
496 | 496 | int start_all_tasks( void ) // start all tasks except SEND RECV and HOUS |
|
497 | 497 | { |
|
498 | 498 | /** This function starts all RTEMS tasks used in the software. |
|
499 | 499 | * |
|
500 | 500 | * @return RTEMS directive status codes: |
|
501 | 501 | * - RTEMS_SUCCESSFUL - ask started successfully |
|
502 | 502 | * - RTEMS_INVALID_ADDRESS - invalid task entry point |
|
503 | 503 | * - RTEMS_INVALID_ID - invalid task id |
|
504 | 504 | * - RTEMS_INCORRECT_STATE - task not in the dormant state |
|
505 | 505 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot start remote task |
|
506 | 506 | * |
|
507 | 507 | */ |
|
508 | 508 | // starts all the tasks fot eh flight software |
|
509 | 509 | |
|
510 | 510 | rtems_status_code status; |
|
511 | 511 | |
|
512 | 512 | //********** |
|
513 | 513 | // SPACEWIRE |
|
514 | 514 | status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 ); |
|
515 | 515 | if (status!=RTEMS_SUCCESSFUL) { |
|
516 | 516 | BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n") |
|
517 | 517 | } |
|
518 | 518 | |
|
519 | 519 | if (status == RTEMS_SUCCESSFUL) // WTDG |
|
520 | 520 | { |
|
521 | 521 | status = rtems_task_start( Task_id[TASKID_WTDG], wtdg_task, 1 ); |
|
522 | 522 | if (status!=RTEMS_SUCCESSFUL) { |
|
523 | 523 | BOOT_PRINTF("in INIT *** Error starting TASK_WTDG\n") |
|
524 | 524 | } |
|
525 | 525 | } |
|
526 | 526 | |
|
527 | 527 | if (status == RTEMS_SUCCESSFUL) // ACTN |
|
528 | 528 | { |
|
529 | 529 | status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 ); |
|
530 | 530 | if (status!=RTEMS_SUCCESSFUL) { |
|
531 | 531 | BOOT_PRINTF("in INIT *** Error starting TASK_ACTN\n") |
|
532 | 532 | } |
|
533 | 533 | } |
|
534 | 534 | |
|
535 | 535 | //****************** |
|
536 | 536 | // SPECTRAL MATRICES |
|
537 | 537 | if (status == RTEMS_SUCCESSFUL) // AVF0 |
|
538 | 538 | { |
|
539 | 539 | status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, LFR_MODE_STANDBY ); |
|
540 | 540 | if (status!=RTEMS_SUCCESSFUL) { |
|
541 | 541 | BOOT_PRINTF("in INIT *** Error starting TASK_AVF0\n") |
|
542 | 542 | } |
|
543 | 543 | } |
|
544 | 544 | if (status == RTEMS_SUCCESSFUL) // PRC0 |
|
545 | 545 | { |
|
546 | 546 | status = rtems_task_start( Task_id[TASKID_PRC0], prc0_task, LFR_MODE_STANDBY ); |
|
547 | 547 | if (status!=RTEMS_SUCCESSFUL) { |
|
548 | 548 | BOOT_PRINTF("in INIT *** Error starting TASK_PRC0\n") |
|
549 | 549 | } |
|
550 | 550 | } |
|
551 | 551 | if (status == RTEMS_SUCCESSFUL) // AVF1 |
|
552 | 552 | { |
|
553 | 553 | status = rtems_task_start( Task_id[TASKID_AVF1], avf1_task, LFR_MODE_STANDBY ); |
|
554 | 554 | if (status!=RTEMS_SUCCESSFUL) { |
|
555 | 555 | BOOT_PRINTF("in INIT *** Error starting TASK_AVF1\n") |
|
556 | 556 | } |
|
557 | 557 | } |
|
558 | 558 | if (status == RTEMS_SUCCESSFUL) // PRC1 |
|
559 | 559 | { |
|
560 | 560 | status = rtems_task_start( Task_id[TASKID_PRC1], prc1_task, LFR_MODE_STANDBY ); |
|
561 | 561 | if (status!=RTEMS_SUCCESSFUL) { |
|
562 | 562 | BOOT_PRINTF("in INIT *** Error starting TASK_PRC1\n") |
|
563 | 563 | } |
|
564 | 564 | } |
|
565 | 565 | if (status == RTEMS_SUCCESSFUL) // AVF2 |
|
566 | 566 | { |
|
567 | 567 | status = rtems_task_start( Task_id[TASKID_AVF2], avf2_task, 1 ); |
|
568 | 568 | if (status!=RTEMS_SUCCESSFUL) { |
|
569 | 569 | BOOT_PRINTF("in INIT *** Error starting TASK_AVF2\n") |
|
570 | 570 | } |
|
571 | 571 | } |
|
572 | 572 | if (status == RTEMS_SUCCESSFUL) // PRC2 |
|
573 | 573 | { |
|
574 | 574 | status = rtems_task_start( Task_id[TASKID_PRC2], prc2_task, 1 ); |
|
575 | 575 | if (status!=RTEMS_SUCCESSFUL) { |
|
576 | 576 | BOOT_PRINTF("in INIT *** Error starting TASK_PRC2\n") |
|
577 | 577 | } |
|
578 | 578 | } |
|
579 | 579 | |
|
580 | 580 | //**************** |
|
581 | 581 | // WAVEFORM PICKER |
|
582 | 582 | if (status == RTEMS_SUCCESSFUL) // WFRM |
|
583 | 583 | { |
|
584 | 584 | status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 ); |
|
585 | 585 | if (status!=RTEMS_SUCCESSFUL) { |
|
586 | 586 | BOOT_PRINTF("in INIT *** Error starting TASK_WFRM\n") |
|
587 | 587 | } |
|
588 | 588 | } |
|
589 | 589 | if (status == RTEMS_SUCCESSFUL) // CWF3 |
|
590 | 590 | { |
|
591 | 591 | status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 ); |
|
592 | 592 | if (status!=RTEMS_SUCCESSFUL) { |
|
593 | 593 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF3\n") |
|
594 | 594 | } |
|
595 | 595 | } |
|
596 | 596 | if (status == RTEMS_SUCCESSFUL) // CWF2 |
|
597 | 597 | { |
|
598 | 598 | status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 ); |
|
599 | 599 | if (status!=RTEMS_SUCCESSFUL) { |
|
600 | 600 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF2\n") |
|
601 | 601 | } |
|
602 | 602 | } |
|
603 | 603 | if (status == RTEMS_SUCCESSFUL) // CWF1 |
|
604 | 604 | { |
|
605 | 605 | status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 ); |
|
606 | 606 | if (status!=RTEMS_SUCCESSFUL) { |
|
607 | 607 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF1\n") |
|
608 | 608 | } |
|
609 | 609 | } |
|
610 | 610 | if (status == RTEMS_SUCCESSFUL) // SWBD |
|
611 | 611 | { |
|
612 | 612 | status = rtems_task_start( Task_id[TASKID_SWBD], swbd_task, 1 ); |
|
613 | 613 | if (status!=RTEMS_SUCCESSFUL) { |
|
614 | 614 | BOOT_PRINTF("in INIT *** Error starting TASK_SWBD\n") |
|
615 | 615 | } |
|
616 | 616 | } |
|
617 | 617 | |
|
618 | 618 | //***** |
|
619 | 619 | // MISC |
|
620 | 620 | if (status == RTEMS_SUCCESSFUL) // HOUS |
|
621 | 621 | { |
|
622 | 622 | status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 ); |
|
623 | 623 | if (status!=RTEMS_SUCCESSFUL) { |
|
624 | 624 | BOOT_PRINTF("in INIT *** Error starting TASK_HOUS\n") |
|
625 | 625 | } |
|
626 | 626 | } |
|
627 | 627 | if (status == RTEMS_SUCCESSFUL) // DUMB |
|
628 | 628 | { |
|
629 | 629 | status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 ); |
|
630 | 630 | if (status!=RTEMS_SUCCESSFUL) { |
|
631 | 631 | BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n") |
|
632 | 632 | } |
|
633 | 633 | } |
|
634 | 634 | if (status == RTEMS_SUCCESSFUL) // STAT |
|
635 | 635 | { |
|
636 | 636 | status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 ); |
|
637 | 637 | if (status!=RTEMS_SUCCESSFUL) { |
|
638 | 638 | BOOT_PRINTF("in INIT *** Error starting TASK_STAT\n") |
|
639 | 639 | } |
|
640 | 640 | } |
|
641 | 641 | |
|
642 | 642 | return status; |
|
643 | 643 | } |
|
644 | 644 | |
|
645 | 645 | rtems_status_code create_message_queues( void ) // create the two message queues used in the software |
|
646 | 646 | { |
|
647 | 647 | rtems_status_code status_recv; |
|
648 | 648 | rtems_status_code status_send; |
|
649 | 649 | rtems_status_code status_q_p0; |
|
650 | 650 | rtems_status_code status_q_p1; |
|
651 | 651 | rtems_status_code status_q_p2; |
|
652 | 652 | rtems_status_code ret; |
|
653 | 653 | rtems_id queue_id; |
|
654 | 654 | |
|
655 | 655 | //**************************************** |
|
656 | 656 | // create the queue for handling valid TCs |
|
657 | 657 | status_recv = rtems_message_queue_create( misc_name[QUEUE_RECV], |
|
658 | 658 | MSG_QUEUE_COUNT_RECV, CCSDS_TC_PKT_MAX_SIZE, |
|
659 | 659 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); |
|
660 | 660 | if ( status_recv != RTEMS_SUCCESSFUL ) { |
|
661 | 661 | PRINTF1("in create_message_queues *** ERR creating QUEU queue, %d\n", status_recv) |
|
662 | 662 | } |
|
663 | 663 | |
|
664 | 664 | //************************************************ |
|
665 | 665 | // create the queue for handling TM packet sending |
|
666 | 666 | status_send = rtems_message_queue_create( misc_name[QUEUE_SEND], |
|
667 | 667 | MSG_QUEUE_COUNT_SEND, MSG_QUEUE_SIZE_SEND, |
|
668 | 668 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); |
|
669 | 669 | if ( status_send != RTEMS_SUCCESSFUL ) { |
|
670 | 670 | PRINTF1("in create_message_queues *** ERR creating PKTS queue, %d\n", status_send) |
|
671 | 671 | } |
|
672 | 672 | |
|
673 | 673 | //***************************************************************************** |
|
674 | 674 | // create the queue for handling averaged spectral matrices for processing @ f0 |
|
675 | 675 | status_q_p0 = rtems_message_queue_create( misc_name[QUEUE_PRC0], |
|
676 | 676 | MSG_QUEUE_COUNT_PRC0, MSG_QUEUE_SIZE_PRC0, |
|
677 | 677 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); |
|
678 | 678 | if ( status_q_p0 != RTEMS_SUCCESSFUL ) { |
|
679 | 679 | PRINTF1("in create_message_queues *** ERR creating Q_P0 queue, %d\n", status_q_p0) |
|
680 | 680 | } |
|
681 | 681 | |
|
682 | 682 | //***************************************************************************** |
|
683 | 683 | // create the queue for handling averaged spectral matrices for processing @ f1 |
|
684 | 684 | status_q_p1 = rtems_message_queue_create( misc_name[QUEUE_PRC1], |
|
685 | 685 | MSG_QUEUE_COUNT_PRC1, MSG_QUEUE_SIZE_PRC1, |
|
686 | 686 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); |
|
687 | 687 | if ( status_q_p1 != RTEMS_SUCCESSFUL ) { |
|
688 | 688 | PRINTF1("in create_message_queues *** ERR creating Q_P1 queue, %d\n", status_q_p1) |
|
689 | 689 | } |
|
690 | 690 | |
|
691 | 691 | //***************************************************************************** |
|
692 | 692 | // create the queue for handling averaged spectral matrices for processing @ f2 |
|
693 | 693 | status_q_p2 = rtems_message_queue_create( misc_name[QUEUE_PRC2], |
|
694 | 694 | MSG_QUEUE_COUNT_PRC2, MSG_QUEUE_SIZE_PRC2, |
|
695 | 695 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); |
|
696 | 696 | if ( status_q_p2 != RTEMS_SUCCESSFUL ) { |
|
697 | 697 | PRINTF1("in create_message_queues *** ERR creating Q_P2 queue, %d\n", status_q_p2) |
|
698 | 698 | } |
|
699 | 699 | |
|
700 | 700 | if ( status_recv != RTEMS_SUCCESSFUL ) |
|
701 | 701 | { |
|
702 | 702 | ret = status_recv; |
|
703 | 703 | } |
|
704 | 704 | else if( status_send != RTEMS_SUCCESSFUL ) |
|
705 | 705 | { |
|
706 | 706 | ret = status_send; |
|
707 | 707 | } |
|
708 | 708 | else if( status_q_p0 != RTEMS_SUCCESSFUL ) |
|
709 | 709 | { |
|
710 | 710 | ret = status_q_p0; |
|
711 | 711 | } |
|
712 | 712 | else if( status_q_p1 != RTEMS_SUCCESSFUL ) |
|
713 | 713 | { |
|
714 | 714 | ret = status_q_p1; |
|
715 | 715 | } |
|
716 | 716 | else |
|
717 | 717 | { |
|
718 | 718 | ret = status_q_p2; |
|
719 | 719 | } |
|
720 | 720 | |
|
721 | 721 | return ret; |
|
722 | 722 | } |
|
723 | 723 | |
|
724 | 724 | rtems_status_code get_message_queue_id_send( rtems_id *queue_id ) |
|
725 | 725 | { |
|
726 | 726 | rtems_status_code status; |
|
727 | 727 | rtems_name queue_name; |
|
728 | 728 | |
|
729 | 729 | queue_name = rtems_build_name( 'Q', '_', 'S', 'D' ); |
|
730 | 730 | |
|
731 | 731 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); |
|
732 | 732 | |
|
733 | 733 | return status; |
|
734 | 734 | } |
|
735 | 735 | |
|
736 | 736 | rtems_status_code get_message_queue_id_recv( rtems_id *queue_id ) |
|
737 | 737 | { |
|
738 | 738 | rtems_status_code status; |
|
739 | 739 | rtems_name queue_name; |
|
740 | 740 | |
|
741 | 741 | queue_name = rtems_build_name( 'Q', '_', 'R', 'V' ); |
|
742 | 742 | |
|
743 | 743 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); |
|
744 | 744 | |
|
745 | 745 | return status; |
|
746 | 746 | } |
|
747 | 747 | |
|
748 | 748 | rtems_status_code get_message_queue_id_prc0( rtems_id *queue_id ) |
|
749 | 749 | { |
|
750 | 750 | rtems_status_code status; |
|
751 | 751 | rtems_name queue_name; |
|
752 | 752 | |
|
753 | 753 | queue_name = rtems_build_name( 'Q', '_', 'P', '0' ); |
|
754 | 754 | |
|
755 | 755 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); |
|
756 | 756 | |
|
757 | 757 | return status; |
|
758 | 758 | } |
|
759 | 759 | |
|
760 | 760 | rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id ) |
|
761 | 761 | { |
|
762 | 762 | rtems_status_code status; |
|
763 | 763 | rtems_name queue_name; |
|
764 | 764 | |
|
765 | 765 | queue_name = rtems_build_name( 'Q', '_', 'P', '1' ); |
|
766 | 766 | |
|
767 | 767 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); |
|
768 | 768 | |
|
769 | 769 | return status; |
|
770 | 770 | } |
|
771 | 771 | |
|
772 | 772 | rtems_status_code get_message_queue_id_prc2( rtems_id *queue_id ) |
|
773 | 773 | { |
|
774 | 774 | rtems_status_code status; |
|
775 | 775 | rtems_name queue_name; |
|
776 | 776 | |
|
777 | 777 | queue_name = rtems_build_name( 'Q', '_', 'P', '2' ); |
|
778 | 778 | |
|
779 | 779 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); |
|
780 | 780 | |
|
781 | 781 | return status; |
|
782 | 782 | } |
@@ -1,621 +1,588 | |||
|
1 | 1 | /** General usage functions and RTEMS tasks. |
|
2 | 2 | * |
|
3 | 3 | * @file |
|
4 | 4 | * @author P. LEROY |
|
5 | 5 | * |
|
6 | 6 | */ |
|
7 | 7 | |
|
8 | 8 | #include "fsw_misc.h" |
|
9 | 9 | |
|
10 | 10 | void configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider, |
|
11 | 11 | unsigned char interrupt_level, rtems_isr (*timer_isr)() ) |
|
12 | 12 | { |
|
13 | 13 | /** This function configures a GPTIMER timer instantiated in the VHDL design. |
|
14 | 14 | * |
|
15 | 15 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. |
|
16 | 16 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). |
|
17 | 17 | * @param clock_divider is the divider of the 1 MHz clock that will be configured. |
|
18 | 18 | * @param interrupt_level is the interrupt level that the timer drives. |
|
19 | 19 | * @param timer_isr is the interrupt subroutine that will be attached to the IRQ driven by the timer. |
|
20 | 20 | * |
|
21 | 21 | * Interrupt levels are described in the SPARC documentation sparcv8.pdf p.76 |
|
22 | 22 | * |
|
23 | 23 | */ |
|
24 | 24 | |
|
25 | 25 | rtems_status_code status; |
|
26 | 26 | rtems_isr_entry old_isr_handler; |
|
27 | 27 | |
|
28 | 28 | gptimer_regs->timer[timer].ctrl = 0x00; // reset the control register |
|
29 | 29 | |
|
30 | 30 | status = rtems_interrupt_catch( timer_isr, interrupt_level, &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels |
|
31 | 31 | if (status!=RTEMS_SUCCESSFUL) |
|
32 | 32 | { |
|
33 | 33 | PRINTF("in configure_timer *** ERR rtems_interrupt_catch\n") |
|
34 | 34 | } |
|
35 | 35 | |
|
36 | 36 | timer_set_clock_divider( gptimer_regs, timer, clock_divider); |
|
37 | 37 | } |
|
38 | 38 | |
|
39 | 39 | void timer_start(gptimer_regs_t *gptimer_regs, unsigned char timer) |
|
40 | 40 | { |
|
41 | 41 | /** This function starts a GPTIMER timer. |
|
42 | 42 | * |
|
43 | 43 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. |
|
44 | 44 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). |
|
45 | 45 | * |
|
46 | 46 | */ |
|
47 | 47 | |
|
48 | 48 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any |
|
49 | 49 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000004; // LD load value from the reload register |
|
50 | 50 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000001; // EN enable the timer |
|
51 | 51 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000002; // RS restart |
|
52 | 52 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000008; // IE interrupt enable |
|
53 | 53 | } |
|
54 | 54 | |
|
55 | 55 | void timer_stop(gptimer_regs_t *gptimer_regs, unsigned char timer) |
|
56 | 56 | { |
|
57 | 57 | /** This function stops a GPTIMER timer. |
|
58 | 58 | * |
|
59 | 59 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. |
|
60 | 60 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). |
|
61 | 61 | * |
|
62 | 62 | */ |
|
63 | 63 | |
|
64 | 64 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xfffffffe; // EN enable the timer |
|
65 | 65 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xffffffef; // IE interrupt enable |
|
66 | 66 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any |
|
67 | 67 | } |
|
68 | 68 | |
|
69 | 69 | void timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider) |
|
70 | 70 | { |
|
71 | 71 | /** This function sets the clock divider of a GPTIMER timer. |
|
72 | 72 | * |
|
73 | 73 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. |
|
74 | 74 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). |
|
75 | 75 | * @param clock_divider is the divider of the 1 MHz clock that will be configured. |
|
76 | 76 | * |
|
77 | 77 | */ |
|
78 | 78 | |
|
79 | 79 | gptimer_regs->timer[timer].reload = clock_divider; // base clock frequency is 1 MHz |
|
80 | 80 | } |
|
81 | 81 | |
|
82 | 82 | int send_console_outputs_on_apbuart_port( void ) // Send the console outputs on the apbuart port |
|
83 | 83 | { |
|
84 | 84 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART; |
|
85 | 85 | |
|
86 | 86 | apbuart_regs->ctrl = APBUART_CTRL_REG_MASK_TE; |
|
87 | 87 | |
|
88 | 88 | return 0; |
|
89 | 89 | } |
|
90 | 90 | |
|
91 | 91 | int enable_apbuart_transmitter( void ) // set the bit 1, TE Transmitter Enable to 1 in the APBUART control register |
|
92 | 92 | { |
|
93 | 93 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART; |
|
94 | 94 | |
|
95 | 95 | apbuart_regs->ctrl = apbuart_regs->ctrl | APBUART_CTRL_REG_MASK_TE; |
|
96 | 96 | |
|
97 | 97 | return 0; |
|
98 | 98 | } |
|
99 | 99 | |
|
100 | 100 | void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value) |
|
101 | 101 | { |
|
102 | 102 | /** This function sets the scaler reload register of the apbuart module |
|
103 | 103 | * |
|
104 | 104 | * @param regs is the address of the apbuart registers in memory |
|
105 | 105 | * @param value is the value that will be stored in the scaler register |
|
106 | 106 | * |
|
107 | 107 | * The value shall be set by the software to get data on the serial interface. |
|
108 | 108 | * |
|
109 | 109 | */ |
|
110 | 110 | |
|
111 | 111 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) regs; |
|
112 | 112 | |
|
113 | 113 | apbuart_regs->scaler = value; |
|
114 | 114 | BOOT_PRINTF1("OK *** apbuart port scaler reload register set to 0x%x\n", value) |
|
115 | 115 | } |
|
116 | 116 | |
|
117 | 117 | //************ |
|
118 | 118 | // RTEMS TASKS |
|
119 | 119 | |
|
120 | 120 | rtems_task stat_task(rtems_task_argument argument) |
|
121 | 121 | { |
|
122 | 122 | int i; |
|
123 | 123 | int j; |
|
124 | 124 | i = 0; |
|
125 | 125 | j = 0; |
|
126 | 126 | BOOT_PRINTF("in STAT *** \n") |
|
127 | 127 | while(1){ |
|
128 | 128 | rtems_task_wake_after(1000); |
|
129 | 129 | PRINTF1("%d\n", j) |
|
130 | 130 | if (i == CPU_USAGE_REPORT_PERIOD) { |
|
131 | 131 | // #ifdef PRINT_TASK_STATISTICS |
|
132 | 132 | // rtems_cpu_usage_report(); |
|
133 | 133 | // rtems_cpu_usage_reset(); |
|
134 | 134 | // #endif |
|
135 | 135 | i = 0; |
|
136 | 136 | } |
|
137 | 137 | else i++; |
|
138 | 138 | j++; |
|
139 | 139 | } |
|
140 | 140 | } |
|
141 | 141 | |
|
142 | 142 | rtems_task hous_task(rtems_task_argument argument) |
|
143 | 143 | { |
|
144 | 144 | rtems_status_code status; |
|
145 | 145 | rtems_id queue_id; |
|
146 | 146 | rtems_rate_monotonic_period_status period_status; |
|
147 | 147 | |
|
148 | 148 | status = get_message_queue_id_send( &queue_id ); |
|
149 | 149 | if (status != RTEMS_SUCCESSFUL) |
|
150 | 150 | { |
|
151 | 151 | PRINTF1("in HOUS *** ERR get_message_queue_id_send %d\n", status) |
|
152 | 152 | } |
|
153 | 153 | |
|
154 | 154 | BOOT_PRINTF("in HOUS ***\n") |
|
155 | 155 | |
|
156 | 156 | if (rtems_rate_monotonic_ident( name_hk_rate_monotonic, &HK_id) != RTEMS_SUCCESSFUL) { |
|
157 | 157 | status = rtems_rate_monotonic_create( name_hk_rate_monotonic, &HK_id ); |
|
158 | 158 | if( status != RTEMS_SUCCESSFUL ) { |
|
159 | 159 | PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status ) |
|
160 | 160 | } |
|
161 | 161 | } |
|
162 | 162 | |
|
163 | 163 | housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
164 | 164 | housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
165 | 165 | housekeeping_packet.reserved = DEFAULT_RESERVED; |
|
166 | 166 | housekeeping_packet.userApplication = CCSDS_USER_APP; |
|
167 | 167 | housekeeping_packet.packetID[0] = (unsigned char) (APID_TM_HK >> 8); |
|
168 | 168 | housekeeping_packet.packetID[1] = (unsigned char) (APID_TM_HK); |
|
169 | 169 | housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
170 | 170 | housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
171 | 171 | housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8); |
|
172 | 172 | housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK ); |
|
173 | 173 | housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
174 | 174 | housekeeping_packet.serviceType = TM_TYPE_HK; |
|
175 | 175 | housekeeping_packet.serviceSubType = TM_SUBTYPE_HK; |
|
176 | 176 | housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND; |
|
177 | 177 | housekeeping_packet.sid = SID_HK; |
|
178 | 178 | |
|
179 | 179 | status = rtems_rate_monotonic_cancel(HK_id); |
|
180 | 180 | if( status != RTEMS_SUCCESSFUL ) { |
|
181 | 181 | PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status ) |
|
182 | 182 | } |
|
183 | 183 | else { |
|
184 | 184 | DEBUG_PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n") |
|
185 | 185 | } |
|
186 | 186 | |
|
187 | 187 | // startup phase |
|
188 | 188 | status = rtems_rate_monotonic_period( HK_id, SY_LFR_TIME_SYN_TIMEOUT_in_ticks ); |
|
189 | 189 | status = rtems_rate_monotonic_get_status( HK_id, &period_status ); |
|
190 | 190 | DEBUG_PRINTF1("startup HK, HK_id status = %d\n", period_status.state) |
|
191 | 191 | while(period_status.state != RATE_MONOTONIC_EXPIRED ) // after SY_LFR_TIME_SYN_TIMEOUT ms, starts HK anyway |
|
192 | 192 | { |
|
193 | 193 | if ((time_management_regs->coarse_time & 0x80000000) == 0x00000000) // check time synchronization |
|
194 | 194 | { |
|
195 | 195 | break; // break if LFR is synchronized |
|
196 | 196 | } |
|
197 | 197 | else |
|
198 | 198 | { |
|
199 | 199 | status = rtems_rate_monotonic_get_status( HK_id, &period_status ); |
|
200 | 200 | // sched_yield(); |
|
201 | 201 | status = rtems_task_wake_after( 10 ); // wait SY_LFR_DPU_CONNECT_TIMEOUT 100 ms = 10 * 10 ms |
|
202 | 202 | } |
|
203 | 203 | } |
|
204 | 204 | status = rtems_rate_monotonic_cancel(HK_id); |
|
205 | 205 | DEBUG_PRINTF1("startup HK, HK_id status = %d\n", period_status.state) |
|
206 | 206 | |
|
207 | 207 | while(1){ // launch the rate monotonic task |
|
208 | 208 | status = rtems_rate_monotonic_period( HK_id, HK_PERIOD ); |
|
209 | 209 | if ( status != RTEMS_SUCCESSFUL ) { |
|
210 | 210 | PRINTF1( "in HOUS *** ERR period: %d\n", status); |
|
211 | 211 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_6 ); |
|
212 | 212 | } |
|
213 | 213 | else { |
|
214 | housekeeping_packet.packetSequenceControl[0] = (unsigned char) sequenceCounterHK >> 8; | |
|
215 | housekeeping_packet.packetSequenceControl[1] = (unsigned char) sequenceCounterHK; | |
|
214 | housekeeping_packet.packetSequenceControl[0] = (unsigned char) (sequenceCounterHK >> 8); | |
|
215 | housekeeping_packet.packetSequenceControl[1] = (unsigned char) (sequenceCounterHK ); | |
|
216 | 216 | increment_seq_counter( &sequenceCounterHK ); |
|
217 | 217 | |
|
218 | 218 | housekeeping_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
219 | 219 | housekeeping_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
220 | 220 | housekeeping_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
221 | 221 | housekeeping_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
222 | 222 | housekeeping_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
223 | 223 | housekeeping_packet.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
224 | 224 | |
|
225 | 225 | spacewire_update_statistics(); |
|
226 | 226 | |
|
227 | 227 | get_v_e1_e2_f3( housekeeping_packet.hk_lfr_sc_v_f3 ); |
|
228 | 228 | get_cpu_load( (unsigned char *) &housekeeping_packet.hk_lfr_cpu_load ); |
|
229 | 229 | |
|
230 | 230 | // SEND PACKET |
|
231 | 231 | status = rtems_message_queue_urgent( queue_id, &housekeeping_packet, |
|
232 | 232 | PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES); |
|
233 | 233 | if (status != RTEMS_SUCCESSFUL) { |
|
234 | 234 | PRINTF1("in HOUS *** ERR send: %d\n", status) |
|
235 | 235 | } |
|
236 | 236 | } |
|
237 | 237 | } |
|
238 | 238 | |
|
239 | 239 | PRINTF("in HOUS *** deleting task\n") |
|
240 | 240 | |
|
241 | 241 | status = rtems_task_delete( RTEMS_SELF ); // should not return |
|
242 | 242 | printf( "rtems_task_delete returned with status of %d.\n", status ); |
|
243 | 243 | return; |
|
244 | 244 | } |
|
245 | 245 | |
|
246 | 246 | rtems_task dumb_task( rtems_task_argument unused ) |
|
247 | 247 | { |
|
248 | 248 | /** This RTEMS taks is used to print messages without affecting the general behaviour of the software. |
|
249 | 249 | * |
|
250 | 250 | * @param unused is the starting argument of the RTEMS task |
|
251 | 251 | * |
|
252 | 252 | * The DUMB taks waits for RTEMS events and print messages depending on the incoming events. |
|
253 | 253 | * |
|
254 | 254 | */ |
|
255 | 255 | |
|
256 | 256 | unsigned int i; |
|
257 | 257 | unsigned int intEventOut; |
|
258 | 258 | unsigned int coarse_time = 0; |
|
259 | 259 | unsigned int fine_time = 0; |
|
260 | 260 | rtems_event_set event_out; |
|
261 | 261 | |
|
262 | 262 | char *DumbMessages[12] = {"in DUMB *** default", // RTEMS_EVENT_0 |
|
263 | 263 | "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1 |
|
264 | 264 | "in DUMB *** f3 buffer changed", // RTEMS_EVENT_2 |
|
265 | 265 | "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3 |
|
266 | 266 | "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4 |
|
267 | 267 | "in DUMB *** waveforms_simulator_isr", // RTEMS_EVENT_5 |
|
268 | 268 | "ERR HK", // RTEMS_EVENT_6 |
|
269 | 269 | "ready for dump", // RTEMS_EVENT_7 |
|
270 | 270 | "VHDL ERR *** spectral matrix", // RTEMS_EVENT_8 |
|
271 | 271 | "tick", // RTEMS_EVENT_9 |
|
272 | 272 | "VHDL ERR *** waveform picker", // RTEMS_EVENT_10 |
|
273 | 273 | "VHDL ERR *** unexpected ready matrix values" // RTEMS_EVENT_11 |
|
274 | 274 | }; |
|
275 | 275 | |
|
276 | 276 | BOOT_PRINTF("in DUMB *** \n") |
|
277 | 277 | |
|
278 | 278 | while(1){ |
|
279 | 279 | rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3 |
|
280 | 280 | | RTEMS_EVENT_4 | RTEMS_EVENT_5 | RTEMS_EVENT_6 | RTEMS_EVENT_7 |
|
281 | 281 | | RTEMS_EVENT_8 | RTEMS_EVENT_9, |
|
282 | 282 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT |
|
283 | 283 | intEventOut = (unsigned int) event_out; |
|
284 | 284 | for ( i=0; i<32; i++) |
|
285 | 285 | { |
|
286 | 286 | if ( ((intEventOut >> i) & 0x0001) != 0) |
|
287 | 287 | { |
|
288 | 288 | coarse_time = time_management_regs->coarse_time; |
|
289 | 289 | fine_time = time_management_regs->fine_time; |
|
290 | 290 | printf("in DUMB *** coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]); |
|
291 | 291 | if (i==8) |
|
292 | 292 | { |
|
293 | 293 | PRINTF1("spectral_matrix_regs->status = %x\n", spectral_matrix_regs->status) |
|
294 | 294 | } |
|
295 | 295 | if (i==10) |
|
296 | 296 | { |
|
297 | 297 | PRINTF1("waveform_picker_regs->status = %x\n", waveform_picker_regs->status) |
|
298 | 298 | } |
|
299 | 299 | } |
|
300 | 300 | } |
|
301 | 301 | } |
|
302 | 302 | } |
|
303 | 303 | |
|
304 | 304 | //***************************** |
|
305 | 305 | // init housekeeping parameters |
|
306 | 306 | |
|
307 | 307 | void init_housekeeping_parameters( void ) |
|
308 | 308 | { |
|
309 | 309 | /** This function initialize the housekeeping_packet global variable with default values. |
|
310 | 310 | * |
|
311 | 311 | */ |
|
312 | 312 | |
|
313 | 313 | unsigned int i = 0; |
|
314 | 314 | unsigned char *parameters; |
|
315 | 315 | |
|
316 | 316 | parameters = (unsigned char*) &housekeeping_packet.lfr_status_word; |
|
317 | 317 | for(i = 0; i< SIZE_HK_PARAMETERS; i++) |
|
318 | 318 | { |
|
319 | 319 | parameters[i] = 0x00; |
|
320 | 320 | } |
|
321 | 321 | // init status word |
|
322 | 322 | housekeeping_packet.lfr_status_word[0] = DEFAULT_STATUS_WORD_BYTE0; |
|
323 | 323 | housekeeping_packet.lfr_status_word[1] = DEFAULT_STATUS_WORD_BYTE1; |
|
324 | 324 | // init software version |
|
325 | 325 | housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1; |
|
326 | 326 | housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2; |
|
327 | 327 | housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3; |
|
328 | 328 | housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4; |
|
329 | 329 | // init fpga version |
|
330 | 330 | parameters = (unsigned char *) (REGS_ADDR_VHDL_VERSION); |
|
331 | 331 | housekeeping_packet.lfr_fpga_version[0] = parameters[1]; // n1 |
|
332 | 332 | housekeeping_packet.lfr_fpga_version[1] = parameters[2]; // n2 |
|
333 | 333 | housekeeping_packet.lfr_fpga_version[2] = parameters[3]; // n3 |
|
334 | 334 | } |
|
335 | 335 | |
|
336 | void increment_seq_counter_old( unsigned char *packet_sequence_control) | |
|
337 | { | |
|
338 | /** This function increment the sequence counter psased in argument. | |
|
339 | * | |
|
340 | * The increment does not affect the grouping flag. In case of an overflow, the counter is reset to 0. | |
|
341 | * | |
|
342 | */ | |
|
343 | ||
|
344 | unsigned short sequence_cnt; | |
|
345 | unsigned short segmentation_grouping_flag; | |
|
346 | unsigned short new_packet_sequence_control; | |
|
347 | ||
|
348 | segmentation_grouping_flag = TM_PACKET_SEQ_CTRL_STANDALONE << 8; // keep bits 7 downto 6 | |
|
349 | sequence_cnt = (unsigned short) ( | |
|
350 | ( (packet_sequence_control[0] & 0x3f) << 8 ) // keep bits 5 downto 0 | |
|
351 | + packet_sequence_control[1] | |
|
352 | ); | |
|
353 | ||
|
354 | new_packet_sequence_control = segmentation_grouping_flag | sequence_cnt ; | |
|
355 | ||
|
356 | packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8); | |
|
357 | packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control ); | |
|
358 | ||
|
359 | if ( sequence_cnt < SEQ_CNT_MAX) | |
|
360 | { | |
|
361 | sequence_cnt = sequence_cnt + 1; | |
|
362 | } | |
|
363 | else | |
|
364 | { | |
|
365 | sequence_cnt = 0; | |
|
366 | } | |
|
367 | } | |
|
368 | ||
|
369 | 336 | void increment_seq_counter( unsigned short *packetSequenceControl ) |
|
370 | 337 | { |
|
371 | 338 | /** This function increment the sequence counter psased in argument. |
|
372 | 339 | * |
|
373 | 340 | * The increment does not affect the grouping flag. In case of an overflow, the counter is reset to 0. |
|
374 | 341 | * |
|
375 | 342 | */ |
|
376 | 343 | |
|
344 | unsigned short segmentation_grouping_flag; | |
|
377 | 345 | unsigned short sequence_cnt; |
|
378 | unsigned short segmentation_grouping_flag; | |
|
379 | 346 | |
|
380 | 347 | segmentation_grouping_flag = TM_PACKET_SEQ_CTRL_STANDALONE << 8; // keep bits 7 downto 6 |
|
381 |
sequence_cnt = (*packetSequenceControl) & 0x3fff; |
|
|
348 | sequence_cnt = (*packetSequenceControl) & 0x3fff; // [0011 1111 1111 1111] | |
|
382 | 349 | |
|
383 | 350 | if ( sequence_cnt < SEQ_CNT_MAX) |
|
384 | 351 | { |
|
385 | 352 | sequence_cnt = sequence_cnt + 1; |
|
386 | 353 | } |
|
387 | 354 | else |
|
388 | 355 | { |
|
389 | 356 | sequence_cnt = 0; |
|
390 | 357 | } |
|
391 | 358 | |
|
392 | 359 | *packetSequenceControl = segmentation_grouping_flag | sequence_cnt ; |
|
393 | 360 | } |
|
394 | 361 | |
|
395 | 362 | void getTime( unsigned char *time) |
|
396 | 363 | { |
|
397 | 364 | /** This function write the current local time in the time buffer passed in argument. |
|
398 | 365 | * |
|
399 | 366 | */ |
|
400 | 367 | |
|
401 | 368 | time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
402 | 369 | time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
403 | 370 | time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
404 | 371 | time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
405 | 372 | time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
406 | 373 | time[5] = (unsigned char) (time_management_regs->fine_time); |
|
407 | 374 | } |
|
408 | 375 | |
|
409 | 376 | unsigned long long int getTimeAsUnsignedLongLongInt( ) |
|
410 | 377 | { |
|
411 | 378 | /** This function write the current local time in the time buffer passed in argument. |
|
412 | 379 | * |
|
413 | 380 | */ |
|
414 | 381 | unsigned long long int time; |
|
415 | 382 | |
|
416 | 383 | time = ( (unsigned long long int) (time_management_regs->coarse_time & 0x7fffffff) << 16 ) |
|
417 | 384 | + time_management_regs->fine_time; |
|
418 | 385 | |
|
419 | 386 | return time; |
|
420 | 387 | } |
|
421 | 388 | |
|
422 | 389 | void send_dumb_hk( void ) |
|
423 | 390 | { |
|
424 | 391 | Packet_TM_LFR_HK_t dummy_hk_packet; |
|
425 | 392 | unsigned char *parameters; |
|
426 | 393 | unsigned int i; |
|
427 | 394 | rtems_id queue_id; |
|
428 | 395 | |
|
429 | 396 | dummy_hk_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
430 | 397 | dummy_hk_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
431 | 398 | dummy_hk_packet.reserved = DEFAULT_RESERVED; |
|
432 | 399 | dummy_hk_packet.userApplication = CCSDS_USER_APP; |
|
433 | 400 | dummy_hk_packet.packetID[0] = (unsigned char) (APID_TM_HK >> 8); |
|
434 | 401 | dummy_hk_packet.packetID[1] = (unsigned char) (APID_TM_HK); |
|
435 | 402 | dummy_hk_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
436 | 403 | dummy_hk_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
437 | 404 | dummy_hk_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8); |
|
438 | 405 | dummy_hk_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK ); |
|
439 | 406 | dummy_hk_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
440 | 407 | dummy_hk_packet.serviceType = TM_TYPE_HK; |
|
441 | 408 | dummy_hk_packet.serviceSubType = TM_SUBTYPE_HK; |
|
442 | 409 | dummy_hk_packet.destinationID = TM_DESTINATION_ID_GROUND; |
|
443 | 410 | dummy_hk_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
444 | 411 | dummy_hk_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
445 | 412 | dummy_hk_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
446 | 413 | dummy_hk_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
447 | 414 | dummy_hk_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
448 | 415 | dummy_hk_packet.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
449 | 416 | dummy_hk_packet.sid = SID_HK; |
|
450 | 417 | |
|
451 | 418 | // init status word |
|
452 | 419 | dummy_hk_packet.lfr_status_word[0] = 0xff; |
|
453 | 420 | dummy_hk_packet.lfr_status_word[1] = 0xff; |
|
454 | 421 | // init software version |
|
455 | 422 | dummy_hk_packet.lfr_sw_version[0] = SW_VERSION_N1; |
|
456 | 423 | dummy_hk_packet.lfr_sw_version[1] = SW_VERSION_N2; |
|
457 | 424 | dummy_hk_packet.lfr_sw_version[2] = SW_VERSION_N3; |
|
458 | 425 | dummy_hk_packet.lfr_sw_version[3] = SW_VERSION_N4; |
|
459 | 426 | // init fpga version |
|
460 | 427 | parameters = (unsigned char *) (REGS_ADDR_WAVEFORM_PICKER + 0xb0); |
|
461 | 428 | dummy_hk_packet.lfr_fpga_version[0] = parameters[1]; // n1 |
|
462 | 429 | dummy_hk_packet.lfr_fpga_version[1] = parameters[2]; // n2 |
|
463 | 430 | dummy_hk_packet.lfr_fpga_version[2] = parameters[3]; // n3 |
|
464 | 431 | |
|
465 | 432 | parameters = (unsigned char *) &dummy_hk_packet.hk_lfr_cpu_load; |
|
466 | 433 | |
|
467 | 434 | for (i=0; i<100; i++) |
|
468 | 435 | { |
|
469 | 436 | parameters[i] = 0xff; |
|
470 | 437 | } |
|
471 | 438 | |
|
472 | 439 | get_message_queue_id_send( &queue_id ); |
|
473 | 440 | |
|
474 | 441 | rtems_message_queue_urgent( queue_id, &dummy_hk_packet, |
|
475 | 442 | PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES); |
|
476 | 443 | } |
|
477 | 444 | |
|
478 | 445 | void get_v_e1_e2_f3_old( unsigned char *spacecraft_potential ) |
|
479 | 446 | { |
|
480 | 447 | unsigned int coarseTime; |
|
481 | 448 | unsigned int acquisitionTime; |
|
482 | 449 | unsigned int deltaT = 0; |
|
483 | 450 | unsigned char *bufferPtr; |
|
484 | 451 | |
|
485 | 452 | unsigned int offset_in_samples; |
|
486 | 453 | unsigned int offset_in_bytes; |
|
487 | 454 | unsigned char f3 = 16; // v, e1 and e2 will be picked up each second, f3 = 16 Hz |
|
488 | 455 | |
|
489 | 456 | if (lfrCurrentMode == LFR_MODE_STANDBY) |
|
490 | 457 | { |
|
491 | 458 | spacecraft_potential[0] = 0x00; |
|
492 | 459 | spacecraft_potential[1] = 0x00; |
|
493 | 460 | spacecraft_potential[2] = 0x00; |
|
494 | 461 | spacecraft_potential[3] = 0x00; |
|
495 | 462 | spacecraft_potential[4] = 0x00; |
|
496 | 463 | spacecraft_potential[5] = 0x00; |
|
497 | 464 | } |
|
498 | 465 | else |
|
499 | 466 | { |
|
500 | 467 | coarseTime = time_management_regs->coarse_time & 0x7fffffff; |
|
501 | 468 | bufferPtr = (unsigned char*) current_ring_node_f3->buffer_address; |
|
502 | 469 | acquisitionTime = (unsigned int) ( ( bufferPtr[2] & 0x7f ) << 24 ) |
|
503 | 470 | + (unsigned int) ( bufferPtr[3] << 16 ) |
|
504 | 471 | + (unsigned int) ( bufferPtr[0] << 8 ) |
|
505 | 472 | + (unsigned int) ( bufferPtr[1] ); |
|
506 | 473 | if ( coarseTime > acquisitionTime ) |
|
507 | 474 | { |
|
508 | 475 | deltaT = coarseTime - acquisitionTime; |
|
509 | 476 | offset_in_samples = (deltaT-1) * f3 ; |
|
510 | 477 | } |
|
511 | 478 | else if( coarseTime == acquisitionTime ) |
|
512 | 479 | { |
|
513 | 480 | bufferPtr = (unsigned char*) current_ring_node_f3->previous->buffer_address; // pick up v e1 and e2 in the previous f3 buffer |
|
514 | 481 | offset_in_samples = NB_SAMPLES_PER_SNAPSHOT-1; |
|
515 | 482 | } |
|
516 | 483 | else |
|
517 | 484 | { |
|
518 | 485 | offset_in_samples = 0; |
|
519 | 486 | PRINTF2("ERR *** in get_v_e1_e2_f3 *** coarseTime = %x, acquisitionTime = %x\n", coarseTime, acquisitionTime) |
|
520 | 487 | } |
|
521 | 488 | |
|
522 | 489 | if ( offset_in_samples > (NB_SAMPLES_PER_SNAPSHOT - 1) ) |
|
523 | 490 | { |
|
524 | 491 | PRINTF1("ERR *** in get_v_e1_e2_f3 *** trying to read out of the buffer, counter = %d\n", offset_in_samples) |
|
525 | 492 | offset_in_samples = NB_SAMPLES_PER_SNAPSHOT -1; |
|
526 | 493 | } |
|
527 | 494 | offset_in_bytes = TIME_OFFSET_IN_BYTES + offset_in_samples * NB_WORDS_SWF_BLK * 4; |
|
528 | 495 | spacecraft_potential[0] = bufferPtr[ offset_in_bytes + 0]; |
|
529 | 496 | spacecraft_potential[1] = bufferPtr[ offset_in_bytes + 1]; |
|
530 | 497 | spacecraft_potential[2] = bufferPtr[ offset_in_bytes + 2]; |
|
531 | 498 | spacecraft_potential[3] = bufferPtr[ offset_in_bytes + 3]; |
|
532 | 499 | spacecraft_potential[4] = bufferPtr[ offset_in_bytes + 4]; |
|
533 | 500 | spacecraft_potential[5] = bufferPtr[ offset_in_bytes + 5]; |
|
534 | 501 | } |
|
535 | 502 | } |
|
536 | 503 | |
|
537 | 504 | void get_v_e1_e2_f3( unsigned char *spacecraft_potential ) |
|
538 | 505 | { |
|
539 | 506 | unsigned int coarseTime; |
|
540 | 507 | unsigned int acquisitionTime; |
|
541 | 508 | unsigned int deltaT = 0; |
|
542 | 509 | unsigned char *bufferPtr; |
|
543 | 510 | |
|
544 | 511 | unsigned int offset_in_samples; |
|
545 | 512 | unsigned int offset_in_bytes; |
|
546 | 513 | unsigned char f3 = 16; // v, e1 and e2 will be picked up each second, f3 = 16 Hz |
|
547 | 514 | |
|
548 | 515 | if (lfrCurrentMode == LFR_MODE_STANDBY) |
|
549 | 516 | { |
|
550 | 517 | spacecraft_potential[0] = 0x00; |
|
551 | 518 | spacecraft_potential[1] = 0x00; |
|
552 | 519 | spacecraft_potential[2] = 0x00; |
|
553 | 520 | spacecraft_potential[3] = 0x00; |
|
554 | 521 | spacecraft_potential[4] = 0x00; |
|
555 | 522 | spacecraft_potential[5] = 0x00; |
|
556 | 523 | } |
|
557 | 524 | else |
|
558 | 525 | { |
|
559 | 526 | coarseTime = time_management_regs->coarse_time & 0x7fffffff; |
|
560 | 527 | bufferPtr = (unsigned char*) current_ring_node_f3->buffer_address; |
|
561 | 528 | acquisitionTime = (unsigned int) ( ( bufferPtr[0] & 0x7f ) << 24 ) |
|
562 | 529 | + (unsigned int) ( bufferPtr[1] << 16 ) |
|
563 | 530 | + (unsigned int) ( bufferPtr[2] << 8 ) |
|
564 | 531 | + (unsigned int) ( bufferPtr[3] ); |
|
565 | 532 | if ( coarseTime > acquisitionTime ) |
|
566 | 533 | { |
|
567 | 534 | deltaT = coarseTime - acquisitionTime; |
|
568 | 535 | offset_in_samples = (deltaT-1) * f3 ; |
|
569 | 536 | } |
|
570 | 537 | else if( coarseTime == acquisitionTime ) |
|
571 | 538 | { |
|
572 | 539 | bufferPtr = (unsigned char*) current_ring_node_f3->previous->buffer_address; // pick up v e1 and e2 in the previous f3 buffer |
|
573 | 540 | offset_in_samples = NB_SAMPLES_PER_SNAPSHOT-1; |
|
574 | 541 | } |
|
575 | 542 | else |
|
576 | 543 | { |
|
577 | 544 | offset_in_samples = 0; |
|
578 | 545 | PRINTF2("ERR *** in get_v_e1_e2_f3 *** coarseTime = %x, acquisitionTime = %x\n", coarseTime, acquisitionTime) |
|
579 | 546 | } |
|
580 | 547 | |
|
581 | 548 | if ( offset_in_samples > (NB_SAMPLES_PER_SNAPSHOT - 1) ) |
|
582 | 549 | { |
|
583 | 550 | PRINTF1("ERR *** in get_v_e1_e2_f3 *** trying to read out of the buffer, counter = %d\n", offset_in_samples) |
|
584 | 551 | offset_in_samples = NB_SAMPLES_PER_SNAPSHOT -1; |
|
585 | 552 | } |
|
586 | 553 | offset_in_bytes = TIME_OFFSET_IN_BYTES + offset_in_samples * NB_WORDS_SWF_BLK * 4; |
|
587 | 554 | spacecraft_potential[0] = bufferPtr[ offset_in_bytes + 0]; |
|
588 | 555 | spacecraft_potential[1] = bufferPtr[ offset_in_bytes + 1]; |
|
589 | 556 | spacecraft_potential[2] = bufferPtr[ offset_in_bytes + 2]; |
|
590 | 557 | spacecraft_potential[3] = bufferPtr[ offset_in_bytes + 3]; |
|
591 | 558 | spacecraft_potential[4] = bufferPtr[ offset_in_bytes + 4]; |
|
592 | 559 | spacecraft_potential[5] = bufferPtr[ offset_in_bytes + 5]; |
|
593 | 560 | } |
|
594 | 561 | } |
|
595 | 562 | |
|
596 | 563 | void get_cpu_load( unsigned char *resource_statistics ) |
|
597 | 564 | { |
|
598 | 565 | unsigned char cpu_load; |
|
599 | 566 | |
|
600 | 567 | cpu_load = lfr_rtems_cpu_usage_report(); |
|
601 | 568 | |
|
602 | 569 | // HK_LFR_CPU_LOAD |
|
603 | 570 | resource_statistics[0] = cpu_load; |
|
604 | 571 | |
|
605 | 572 | // HK_LFR_CPU_LOAD_MAX |
|
606 | 573 | if (cpu_load > resource_statistics[1]) |
|
607 | 574 | { |
|
608 | 575 | resource_statistics[1] = cpu_load; |
|
609 | 576 | } |
|
610 | 577 | |
|
611 | 578 | // CPU_LOAD_AVE |
|
612 | 579 | resource_statistics[2] = 0; |
|
613 | 580 | |
|
614 | 581 | #ifndef PRINT_TASK_STATISTICS |
|
615 | 582 | rtems_cpu_usage_reset(); |
|
616 | 583 | #endif |
|
617 | 584 | |
|
618 | 585 | } |
|
619 | 586 | |
|
620 | 587 | |
|
621 | 588 |
General Comments 0
You need to be logged in to leave comments.
Login now