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