@@ -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: Mon Jun 23 07:48:42 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=12 -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,782 +1,780 | |||
|
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 | send_dumb_hk(); | |
|
217 | ||
|
218 | 216 | status = rtems_task_delete(RTEMS_SELF); |
|
219 | 217 | |
|
220 | 218 | } |
|
221 | 219 | |
|
222 | 220 | void init_local_mode_parameters( void ) |
|
223 | 221 | { |
|
224 | 222 | /** This function initialize the param_local global variable with default values. |
|
225 | 223 | * |
|
226 | 224 | */ |
|
227 | 225 | |
|
228 | 226 | unsigned int i; |
|
229 | 227 | |
|
230 | 228 | // LOCAL PARAMETERS |
|
231 | 229 | |
|
232 | 230 | BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max) |
|
233 | 231 | BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max) |
|
234 | 232 | BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX) |
|
235 | 233 | |
|
236 | 234 | // init sequence counters |
|
237 | 235 | |
|
238 | 236 | for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++) |
|
239 | 237 | { |
|
240 | 238 | sequenceCounters_TC_EXE[i] = 0x00; |
|
241 | 239 | } |
|
242 | 240 | sequenceCounters_SCIENCE_NORMAL_BURST = 0x00; |
|
243 | 241 | sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00; |
|
244 | 242 | sequenceCounterHK = TM_PACKET_SEQ_CTRL_STANDALONE << 8; |
|
245 | 243 | sequenceCounterParameterDump = TM_PACKET_SEQ_CTRL_STANDALONE << 8; |
|
246 | 244 | } |
|
247 | 245 | |
|
248 | 246 | void reset_local_time( void ) |
|
249 | 247 | { |
|
250 | 248 | time_management_regs->ctrl = 0x02; // software reset, coarse time = 0x80000000 |
|
251 | 249 | } |
|
252 | 250 | |
|
253 | 251 | void create_names( void ) // create all names for tasks and queues |
|
254 | 252 | { |
|
255 | 253 | /** This function creates all RTEMS names used in the software for tasks and queues. |
|
256 | 254 | * |
|
257 | 255 | * @return RTEMS directive status codes: |
|
258 | 256 | * - RTEMS_SUCCESSFUL - successful completion |
|
259 | 257 | * |
|
260 | 258 | */ |
|
261 | 259 | |
|
262 | 260 | // task names |
|
263 | 261 | Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' ); |
|
264 | 262 | Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' ); |
|
265 | 263 | Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' ); |
|
266 | 264 | Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' ); |
|
267 | 265 | Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' ); |
|
268 | 266 | Task_name[TASKID_SWBD] = rtems_build_name( 'S', 'W', 'B', 'D' ); |
|
269 | 267 | Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' ); |
|
270 | 268 | Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' ); |
|
271 | 269 | Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' ); |
|
272 | 270 | Task_name[TASKID_PRC0] = rtems_build_name( 'P', 'R', 'C', '0' ); |
|
273 | 271 | Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' ); |
|
274 | 272 | Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' ); |
|
275 | 273 | Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' ); |
|
276 | 274 | Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' ); |
|
277 | 275 | Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' ); |
|
278 | 276 | Task_name[TASKID_AVF1] = rtems_build_name( 'A', 'V', 'F', '1' ); |
|
279 | 277 | Task_name[TASKID_PRC1] = rtems_build_name( 'P', 'R', 'C', '1' ); |
|
280 | 278 | Task_name[TASKID_AVF2] = rtems_build_name( 'A', 'V', 'F', '2' ); |
|
281 | 279 | Task_name[TASKID_PRC2] = rtems_build_name( 'P', 'R', 'C', '2' ); |
|
282 | 280 | |
|
283 | 281 | // rate monotonic period names |
|
284 | 282 | name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' ); |
|
285 | 283 | |
|
286 | 284 | misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' ); |
|
287 | 285 | misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' ); |
|
288 | 286 | misc_name[QUEUE_PRC0] = rtems_build_name( 'Q', '_', 'P', '0' ); |
|
289 | 287 | misc_name[QUEUE_PRC1] = rtems_build_name( 'Q', '_', 'P', '1' ); |
|
290 | 288 | misc_name[QUEUE_PRC2] = rtems_build_name( 'Q', '_', 'P', '2' ); |
|
291 | 289 | } |
|
292 | 290 | |
|
293 | 291 | int create_all_tasks( void ) // create all tasks which run in the software |
|
294 | 292 | { |
|
295 | 293 | /** This function creates all RTEMS tasks used in the software. |
|
296 | 294 | * |
|
297 | 295 | * @return RTEMS directive status codes: |
|
298 | 296 | * - RTEMS_SUCCESSFUL - task created successfully |
|
299 | 297 | * - RTEMS_INVALID_ADDRESS - id is NULL |
|
300 | 298 | * - RTEMS_INVALID_NAME - invalid task name |
|
301 | 299 | * - RTEMS_INVALID_PRIORITY - invalid task priority |
|
302 | 300 | * - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured |
|
303 | 301 | * - RTEMS_TOO_MANY - too many tasks created |
|
304 | 302 | * - RTEMS_UNSATISFIED - not enough memory for stack/FP context |
|
305 | 303 | * - RTEMS_TOO_MANY - too many global objects |
|
306 | 304 | * |
|
307 | 305 | */ |
|
308 | 306 | |
|
309 | 307 | rtems_status_code status; |
|
310 | 308 | |
|
311 | 309 | //********** |
|
312 | 310 | // SPACEWIRE |
|
313 | 311 | // RECV |
|
314 | 312 | status = rtems_task_create( |
|
315 | 313 | Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE, |
|
316 | 314 | RTEMS_DEFAULT_MODES, |
|
317 | 315 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV] |
|
318 | 316 | ); |
|
319 | 317 | if (status == RTEMS_SUCCESSFUL) // SEND |
|
320 | 318 | { |
|
321 | 319 | status = rtems_task_create( |
|
322 | 320 | Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE, |
|
323 | 321 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
324 | 322 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SEND] |
|
325 | 323 | ); |
|
326 | 324 | } |
|
327 | 325 | if (status == RTEMS_SUCCESSFUL) // WTDG |
|
328 | 326 | { |
|
329 | 327 | status = rtems_task_create( |
|
330 | 328 | Task_name[TASKID_WTDG], TASK_PRIORITY_WTDG, RTEMS_MINIMUM_STACK_SIZE, |
|
331 | 329 | RTEMS_DEFAULT_MODES, |
|
332 | 330 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_WTDG] |
|
333 | 331 | ); |
|
334 | 332 | } |
|
335 | 333 | if (status == RTEMS_SUCCESSFUL) // ACTN |
|
336 | 334 | { |
|
337 | 335 | status = rtems_task_create( |
|
338 | 336 | Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE, |
|
339 | 337 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
340 | 338 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN] |
|
341 | 339 | ); |
|
342 | 340 | } |
|
343 | 341 | if (status == RTEMS_SUCCESSFUL) // SPIQ |
|
344 | 342 | { |
|
345 | 343 | status = rtems_task_create( |
|
346 | 344 | Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE, |
|
347 | 345 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
348 | 346 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ] |
|
349 | 347 | ); |
|
350 | 348 | } |
|
351 | 349 | |
|
352 | 350 | //****************** |
|
353 | 351 | // SPECTRAL MATRICES |
|
354 | 352 | if (status == RTEMS_SUCCESSFUL) // AVF0 |
|
355 | 353 | { |
|
356 | 354 | status = rtems_task_create( |
|
357 | 355 | Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE, |
|
358 | 356 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
359 | 357 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0] |
|
360 | 358 | ); |
|
361 | 359 | } |
|
362 | 360 | if (status == RTEMS_SUCCESSFUL) // PRC0 |
|
363 | 361 | { |
|
364 | 362 | status = rtems_task_create( |
|
365 | 363 | Task_name[TASKID_PRC0], TASK_PRIORITY_PRC0, RTEMS_MINIMUM_STACK_SIZE * 2, |
|
366 | 364 | RTEMS_DEFAULT_MODES, |
|
367 | 365 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC0] |
|
368 | 366 | ); |
|
369 | 367 | } |
|
370 | 368 | if (status == RTEMS_SUCCESSFUL) // AVF1 |
|
371 | 369 | { |
|
372 | 370 | status = rtems_task_create( |
|
373 | 371 | Task_name[TASKID_AVF1], TASK_PRIORITY_AVF1, RTEMS_MINIMUM_STACK_SIZE, |
|
374 | 372 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
375 | 373 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF1] |
|
376 | 374 | ); |
|
377 | 375 | } |
|
378 | 376 | if (status == RTEMS_SUCCESSFUL) // PRC1 |
|
379 | 377 | { |
|
380 | 378 | status = rtems_task_create( |
|
381 | 379 | Task_name[TASKID_PRC1], TASK_PRIORITY_PRC1, RTEMS_MINIMUM_STACK_SIZE * 2, |
|
382 | 380 | RTEMS_DEFAULT_MODES, |
|
383 | 381 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC1] |
|
384 | 382 | ); |
|
385 | 383 | } |
|
386 | 384 | if (status == RTEMS_SUCCESSFUL) // AVF2 |
|
387 | 385 | { |
|
388 | 386 | status = rtems_task_create( |
|
389 | 387 | Task_name[TASKID_AVF2], TASK_PRIORITY_AVF2, RTEMS_MINIMUM_STACK_SIZE, |
|
390 | 388 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
391 | 389 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF2] |
|
392 | 390 | ); |
|
393 | 391 | } |
|
394 | 392 | if (status == RTEMS_SUCCESSFUL) // PRC2 |
|
395 | 393 | { |
|
396 | 394 | status = rtems_task_create( |
|
397 | 395 | Task_name[TASKID_PRC2], TASK_PRIORITY_PRC2, RTEMS_MINIMUM_STACK_SIZE * 2, |
|
398 | 396 | RTEMS_DEFAULT_MODES, |
|
399 | 397 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC2] |
|
400 | 398 | ); |
|
401 | 399 | } |
|
402 | 400 | |
|
403 | 401 | //**************** |
|
404 | 402 | // WAVEFORM PICKER |
|
405 | 403 | if (status == RTEMS_SUCCESSFUL) // WFRM |
|
406 | 404 | { |
|
407 | 405 | status = rtems_task_create( |
|
408 | 406 | Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE, |
|
409 | 407 | RTEMS_DEFAULT_MODES, |
|
410 | 408 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM] |
|
411 | 409 | ); |
|
412 | 410 | } |
|
413 | 411 | if (status == RTEMS_SUCCESSFUL) // CWF3 |
|
414 | 412 | { |
|
415 | 413 | status = rtems_task_create( |
|
416 | 414 | Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE, |
|
417 | 415 | RTEMS_DEFAULT_MODES, |
|
418 | 416 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF3] |
|
419 | 417 | ); |
|
420 | 418 | } |
|
421 | 419 | if (status == RTEMS_SUCCESSFUL) // CWF2 |
|
422 | 420 | { |
|
423 | 421 | status = rtems_task_create( |
|
424 | 422 | Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE, |
|
425 | 423 | RTEMS_DEFAULT_MODES, |
|
426 | 424 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF2] |
|
427 | 425 | ); |
|
428 | 426 | } |
|
429 | 427 | if (status == RTEMS_SUCCESSFUL) // CWF1 |
|
430 | 428 | { |
|
431 | 429 | status = rtems_task_create( |
|
432 | 430 | Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE, |
|
433 | 431 | RTEMS_DEFAULT_MODES, |
|
434 | 432 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF1] |
|
435 | 433 | ); |
|
436 | 434 | } |
|
437 | 435 | if (status == RTEMS_SUCCESSFUL) // SWBD |
|
438 | 436 | { |
|
439 | 437 | status = rtems_task_create( |
|
440 | 438 | Task_name[TASKID_SWBD], TASK_PRIORITY_SWBD, RTEMS_MINIMUM_STACK_SIZE, |
|
441 | 439 | RTEMS_DEFAULT_MODES, |
|
442 | 440 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_SWBD] |
|
443 | 441 | ); |
|
444 | 442 | } |
|
445 | 443 | |
|
446 | 444 | //***** |
|
447 | 445 | // MISC |
|
448 | 446 | if (status == RTEMS_SUCCESSFUL) // STAT |
|
449 | 447 | { |
|
450 | 448 | status = rtems_task_create( |
|
451 | 449 | Task_name[TASKID_STAT], TASK_PRIORITY_STAT, RTEMS_MINIMUM_STACK_SIZE, |
|
452 | 450 | RTEMS_DEFAULT_MODES, |
|
453 | 451 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT] |
|
454 | 452 | ); |
|
455 | 453 | } |
|
456 | 454 | if (status == RTEMS_SUCCESSFUL) // DUMB |
|
457 | 455 | { |
|
458 | 456 | status = rtems_task_create( |
|
459 | 457 | Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE, |
|
460 | 458 | RTEMS_DEFAULT_MODES, |
|
461 | 459 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB] |
|
462 | 460 | ); |
|
463 | 461 | } |
|
464 | 462 | if (status == RTEMS_SUCCESSFUL) // HOUS |
|
465 | 463 | { |
|
466 | 464 | status = rtems_task_create( |
|
467 | 465 | Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE, |
|
468 | 466 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
469 | 467 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS] |
|
470 | 468 | ); |
|
471 | 469 | } |
|
472 | 470 | |
|
473 | 471 | return status; |
|
474 | 472 | } |
|
475 | 473 | |
|
476 | 474 | int start_recv_send_tasks( void ) |
|
477 | 475 | { |
|
478 | 476 | rtems_status_code status; |
|
479 | 477 | |
|
480 | 478 | status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 ); |
|
481 | 479 | if (status!=RTEMS_SUCCESSFUL) { |
|
482 | 480 | BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n") |
|
483 | 481 | } |
|
484 | 482 | |
|
485 | 483 | if (status == RTEMS_SUCCESSFUL) // SEND |
|
486 | 484 | { |
|
487 | 485 | status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 ); |
|
488 | 486 | if (status!=RTEMS_SUCCESSFUL) { |
|
489 | 487 | BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n") |
|
490 | 488 | } |
|
491 | 489 | } |
|
492 | 490 | |
|
493 | 491 | return status; |
|
494 | 492 | } |
|
495 | 493 | |
|
496 | 494 | int start_all_tasks( void ) // start all tasks except SEND RECV and HOUS |
|
497 | 495 | { |
|
498 | 496 | /** This function starts all RTEMS tasks used in the software. |
|
499 | 497 | * |
|
500 | 498 | * @return RTEMS directive status codes: |
|
501 | 499 | * - RTEMS_SUCCESSFUL - ask started successfully |
|
502 | 500 | * - RTEMS_INVALID_ADDRESS - invalid task entry point |
|
503 | 501 | * - RTEMS_INVALID_ID - invalid task id |
|
504 | 502 | * - RTEMS_INCORRECT_STATE - task not in the dormant state |
|
505 | 503 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot start remote task |
|
506 | 504 | * |
|
507 | 505 | */ |
|
508 | 506 | // starts all the tasks fot eh flight software |
|
509 | 507 | |
|
510 | 508 | rtems_status_code status; |
|
511 | 509 | |
|
512 | 510 | //********** |
|
513 | 511 | // SPACEWIRE |
|
514 | 512 | status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 ); |
|
515 | 513 | if (status!=RTEMS_SUCCESSFUL) { |
|
516 | 514 | BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n") |
|
517 | 515 | } |
|
518 | 516 | |
|
519 | 517 | if (status == RTEMS_SUCCESSFUL) // WTDG |
|
520 | 518 | { |
|
521 | 519 | status = rtems_task_start( Task_id[TASKID_WTDG], wtdg_task, 1 ); |
|
522 | 520 | if (status!=RTEMS_SUCCESSFUL) { |
|
523 | 521 | BOOT_PRINTF("in INIT *** Error starting TASK_WTDG\n") |
|
524 | 522 | } |
|
525 | 523 | } |
|
526 | 524 | |
|
527 | 525 | if (status == RTEMS_SUCCESSFUL) // ACTN |
|
528 | 526 | { |
|
529 | 527 | status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 ); |
|
530 | 528 | if (status!=RTEMS_SUCCESSFUL) { |
|
531 | 529 | BOOT_PRINTF("in INIT *** Error starting TASK_ACTN\n") |
|
532 | 530 | } |
|
533 | 531 | } |
|
534 | 532 | |
|
535 | 533 | //****************** |
|
536 | 534 | // SPECTRAL MATRICES |
|
537 | 535 | if (status == RTEMS_SUCCESSFUL) // AVF0 |
|
538 | 536 | { |
|
539 | 537 | status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, LFR_MODE_STANDBY ); |
|
540 | 538 | if (status!=RTEMS_SUCCESSFUL) { |
|
541 | 539 | BOOT_PRINTF("in INIT *** Error starting TASK_AVF0\n") |
|
542 | 540 | } |
|
543 | 541 | } |
|
544 | 542 | if (status == RTEMS_SUCCESSFUL) // PRC0 |
|
545 | 543 | { |
|
546 | 544 | status = rtems_task_start( Task_id[TASKID_PRC0], prc0_task, LFR_MODE_STANDBY ); |
|
547 | 545 | if (status!=RTEMS_SUCCESSFUL) { |
|
548 | 546 | BOOT_PRINTF("in INIT *** Error starting TASK_PRC0\n") |
|
549 | 547 | } |
|
550 | 548 | } |
|
551 | 549 | if (status == RTEMS_SUCCESSFUL) // AVF1 |
|
552 | 550 | { |
|
553 | 551 | status = rtems_task_start( Task_id[TASKID_AVF1], avf1_task, LFR_MODE_STANDBY ); |
|
554 | 552 | if (status!=RTEMS_SUCCESSFUL) { |
|
555 | 553 | BOOT_PRINTF("in INIT *** Error starting TASK_AVF1\n") |
|
556 | 554 | } |
|
557 | 555 | } |
|
558 | 556 | if (status == RTEMS_SUCCESSFUL) // PRC1 |
|
559 | 557 | { |
|
560 | 558 | status = rtems_task_start( Task_id[TASKID_PRC1], prc1_task, LFR_MODE_STANDBY ); |
|
561 | 559 | if (status!=RTEMS_SUCCESSFUL) { |
|
562 | 560 | BOOT_PRINTF("in INIT *** Error starting TASK_PRC1\n") |
|
563 | 561 | } |
|
564 | 562 | } |
|
565 | 563 | if (status == RTEMS_SUCCESSFUL) // AVF2 |
|
566 | 564 | { |
|
567 | 565 | status = rtems_task_start( Task_id[TASKID_AVF2], avf2_task, 1 ); |
|
568 | 566 | if (status!=RTEMS_SUCCESSFUL) { |
|
569 | 567 | BOOT_PRINTF("in INIT *** Error starting TASK_AVF2\n") |
|
570 | 568 | } |
|
571 | 569 | } |
|
572 | 570 | if (status == RTEMS_SUCCESSFUL) // PRC2 |
|
573 | 571 | { |
|
574 | 572 | status = rtems_task_start( Task_id[TASKID_PRC2], prc2_task, 1 ); |
|
575 | 573 | if (status!=RTEMS_SUCCESSFUL) { |
|
576 | 574 | BOOT_PRINTF("in INIT *** Error starting TASK_PRC2\n") |
|
577 | 575 | } |
|
578 | 576 | } |
|
579 | 577 | |
|
580 | 578 | //**************** |
|
581 | 579 | // WAVEFORM PICKER |
|
582 | 580 | if (status == RTEMS_SUCCESSFUL) // WFRM |
|
583 | 581 | { |
|
584 | 582 | status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 ); |
|
585 | 583 | if (status!=RTEMS_SUCCESSFUL) { |
|
586 | 584 | BOOT_PRINTF("in INIT *** Error starting TASK_WFRM\n") |
|
587 | 585 | } |
|
588 | 586 | } |
|
589 | 587 | if (status == RTEMS_SUCCESSFUL) // CWF3 |
|
590 | 588 | { |
|
591 | 589 | status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 ); |
|
592 | 590 | if (status!=RTEMS_SUCCESSFUL) { |
|
593 | 591 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF3\n") |
|
594 | 592 | } |
|
595 | 593 | } |
|
596 | 594 | if (status == RTEMS_SUCCESSFUL) // CWF2 |
|
597 | 595 | { |
|
598 | 596 | status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 ); |
|
599 | 597 | if (status!=RTEMS_SUCCESSFUL) { |
|
600 | 598 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF2\n") |
|
601 | 599 | } |
|
602 | 600 | } |
|
603 | 601 | if (status == RTEMS_SUCCESSFUL) // CWF1 |
|
604 | 602 | { |
|
605 | 603 | status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 ); |
|
606 | 604 | if (status!=RTEMS_SUCCESSFUL) { |
|
607 | 605 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF1\n") |
|
608 | 606 | } |
|
609 | 607 | } |
|
610 | 608 | if (status == RTEMS_SUCCESSFUL) // SWBD |
|
611 | 609 | { |
|
612 | 610 | status = rtems_task_start( Task_id[TASKID_SWBD], swbd_task, 1 ); |
|
613 | 611 | if (status!=RTEMS_SUCCESSFUL) { |
|
614 | 612 | BOOT_PRINTF("in INIT *** Error starting TASK_SWBD\n") |
|
615 | 613 | } |
|
616 | 614 | } |
|
617 | 615 | |
|
618 | 616 | //***** |
|
619 | 617 | // MISC |
|
620 | 618 | if (status == RTEMS_SUCCESSFUL) // HOUS |
|
621 | 619 | { |
|
622 | 620 | status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 ); |
|
623 | 621 | if (status!=RTEMS_SUCCESSFUL) { |
|
624 | 622 | BOOT_PRINTF("in INIT *** Error starting TASK_HOUS\n") |
|
625 | 623 | } |
|
626 | 624 | } |
|
627 | 625 | if (status == RTEMS_SUCCESSFUL) // DUMB |
|
628 | 626 | { |
|
629 | 627 | status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 ); |
|
630 | 628 | if (status!=RTEMS_SUCCESSFUL) { |
|
631 | 629 | BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n") |
|
632 | 630 | } |
|
633 | 631 | } |
|
634 | 632 | if (status == RTEMS_SUCCESSFUL) // STAT |
|
635 | 633 | { |
|
636 | 634 | status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 ); |
|
637 | 635 | if (status!=RTEMS_SUCCESSFUL) { |
|
638 | 636 | BOOT_PRINTF("in INIT *** Error starting TASK_STAT\n") |
|
639 | 637 | } |
|
640 | 638 | } |
|
641 | 639 | |
|
642 | 640 | return status; |
|
643 | 641 | } |
|
644 | 642 | |
|
645 | 643 | rtems_status_code create_message_queues( void ) // create the two message queues used in the software |
|
646 | 644 | { |
|
647 | 645 | rtems_status_code status_recv; |
|
648 | 646 | rtems_status_code status_send; |
|
649 | 647 | rtems_status_code status_q_p0; |
|
650 | 648 | rtems_status_code status_q_p1; |
|
651 | 649 | rtems_status_code status_q_p2; |
|
652 | 650 | rtems_status_code ret; |
|
653 | 651 | rtems_id queue_id; |
|
654 | 652 | |
|
655 | 653 | //**************************************** |
|
656 | 654 | // create the queue for handling valid TCs |
|
657 | 655 | status_recv = rtems_message_queue_create( misc_name[QUEUE_RECV], |
|
658 | 656 | MSG_QUEUE_COUNT_RECV, CCSDS_TC_PKT_MAX_SIZE, |
|
659 | 657 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); |
|
660 | 658 | if ( status_recv != RTEMS_SUCCESSFUL ) { |
|
661 | 659 | PRINTF1("in create_message_queues *** ERR creating QUEU queue, %d\n", status_recv) |
|
662 | 660 | } |
|
663 | 661 | |
|
664 | 662 | //************************************************ |
|
665 | 663 | // create the queue for handling TM packet sending |
|
666 | 664 | status_send = rtems_message_queue_create( misc_name[QUEUE_SEND], |
|
667 | 665 | MSG_QUEUE_COUNT_SEND, MSG_QUEUE_SIZE_SEND, |
|
668 | 666 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); |
|
669 | 667 | if ( status_send != RTEMS_SUCCESSFUL ) { |
|
670 | 668 | PRINTF1("in create_message_queues *** ERR creating PKTS queue, %d\n", status_send) |
|
671 | 669 | } |
|
672 | 670 | |
|
673 | 671 | //***************************************************************************** |
|
674 | 672 | // create the queue for handling averaged spectral matrices for processing @ f0 |
|
675 | 673 | status_q_p0 = rtems_message_queue_create( misc_name[QUEUE_PRC0], |
|
676 | 674 | MSG_QUEUE_COUNT_PRC0, MSG_QUEUE_SIZE_PRC0, |
|
677 | 675 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); |
|
678 | 676 | if ( status_q_p0 != RTEMS_SUCCESSFUL ) { |
|
679 | 677 | PRINTF1("in create_message_queues *** ERR creating Q_P0 queue, %d\n", status_q_p0) |
|
680 | 678 | } |
|
681 | 679 | |
|
682 | 680 | //***************************************************************************** |
|
683 | 681 | // create the queue for handling averaged spectral matrices for processing @ f1 |
|
684 | 682 | status_q_p1 = rtems_message_queue_create( misc_name[QUEUE_PRC1], |
|
685 | 683 | MSG_QUEUE_COUNT_PRC1, MSG_QUEUE_SIZE_PRC1, |
|
686 | 684 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); |
|
687 | 685 | if ( status_q_p1 != RTEMS_SUCCESSFUL ) { |
|
688 | 686 | PRINTF1("in create_message_queues *** ERR creating Q_P1 queue, %d\n", status_q_p1) |
|
689 | 687 | } |
|
690 | 688 | |
|
691 | 689 | //***************************************************************************** |
|
692 | 690 | // create the queue for handling averaged spectral matrices for processing @ f2 |
|
693 | 691 | status_q_p2 = rtems_message_queue_create( misc_name[QUEUE_PRC2], |
|
694 | 692 | MSG_QUEUE_COUNT_PRC2, MSG_QUEUE_SIZE_PRC2, |
|
695 | 693 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); |
|
696 | 694 | if ( status_q_p2 != RTEMS_SUCCESSFUL ) { |
|
697 | 695 | PRINTF1("in create_message_queues *** ERR creating Q_P2 queue, %d\n", status_q_p2) |
|
698 | 696 | } |
|
699 | 697 | |
|
700 | 698 | if ( status_recv != RTEMS_SUCCESSFUL ) |
|
701 | 699 | { |
|
702 | 700 | ret = status_recv; |
|
703 | 701 | } |
|
704 | 702 | else if( status_send != RTEMS_SUCCESSFUL ) |
|
705 | 703 | { |
|
706 | 704 | ret = status_send; |
|
707 | 705 | } |
|
708 | 706 | else if( status_q_p0 != RTEMS_SUCCESSFUL ) |
|
709 | 707 | { |
|
710 | 708 | ret = status_q_p0; |
|
711 | 709 | } |
|
712 | 710 | else if( status_q_p1 != RTEMS_SUCCESSFUL ) |
|
713 | 711 | { |
|
714 | 712 | ret = status_q_p1; |
|
715 | 713 | } |
|
716 | 714 | else |
|
717 | 715 | { |
|
718 | 716 | ret = status_q_p2; |
|
719 | 717 | } |
|
720 | 718 | |
|
721 | 719 | return ret; |
|
722 | 720 | } |
|
723 | 721 | |
|
724 | 722 | rtems_status_code get_message_queue_id_send( rtems_id *queue_id ) |
|
725 | 723 | { |
|
726 | 724 | rtems_status_code status; |
|
727 | 725 | rtems_name queue_name; |
|
728 | 726 | |
|
729 | 727 | queue_name = rtems_build_name( 'Q', '_', 'S', 'D' ); |
|
730 | 728 | |
|
731 | 729 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); |
|
732 | 730 | |
|
733 | 731 | return status; |
|
734 | 732 | } |
|
735 | 733 | |
|
736 | 734 | rtems_status_code get_message_queue_id_recv( rtems_id *queue_id ) |
|
737 | 735 | { |
|
738 | 736 | rtems_status_code status; |
|
739 | 737 | rtems_name queue_name; |
|
740 | 738 | |
|
741 | 739 | queue_name = rtems_build_name( 'Q', '_', 'R', 'V' ); |
|
742 | 740 | |
|
743 | 741 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); |
|
744 | 742 | |
|
745 | 743 | return status; |
|
746 | 744 | } |
|
747 | 745 | |
|
748 | 746 | rtems_status_code get_message_queue_id_prc0( rtems_id *queue_id ) |
|
749 | 747 | { |
|
750 | 748 | rtems_status_code status; |
|
751 | 749 | rtems_name queue_name; |
|
752 | 750 | |
|
753 | 751 | queue_name = rtems_build_name( 'Q', '_', 'P', '0' ); |
|
754 | 752 | |
|
755 | 753 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); |
|
756 | 754 | |
|
757 | 755 | return status; |
|
758 | 756 | } |
|
759 | 757 | |
|
760 | 758 | rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id ) |
|
761 | 759 | { |
|
762 | 760 | rtems_status_code status; |
|
763 | 761 | rtems_name queue_name; |
|
764 | 762 | |
|
765 | 763 | queue_name = rtems_build_name( 'Q', '_', 'P', '1' ); |
|
766 | 764 | |
|
767 | 765 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); |
|
768 | 766 | |
|
769 | 767 | return status; |
|
770 | 768 | } |
|
771 | 769 | |
|
772 | 770 | rtems_status_code get_message_queue_id_prc2( rtems_id *queue_id ) |
|
773 | 771 | { |
|
774 | 772 | rtems_status_code status; |
|
775 | 773 | rtems_name queue_name; |
|
776 | 774 | |
|
777 | 775 | queue_name = rtems_build_name( 'Q', '_', 'P', '2' ); |
|
778 | 776 | |
|
779 | 777 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); |
|
780 | 778 | |
|
781 | 779 | return status; |
|
782 | 780 | } |
General Comments 0
You need to be logged in to leave comments.
Login now