@@ -0,0 +1,6 | |||||
|
1 | #ifndef LFR_CPU_USAGE_REPORT_H | |||
|
2 | #define LFR_CPU_USAGE_REPORT_H | |||
|
3 | ||||
|
4 | unsigned char lfr_rtems_cpu_usage_report( void ); | |||
|
5 | ||||
|
6 | #endif // LFR_CPU_USAGE_REPORT_H |
@@ -1,268 +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: |
|
3 | # Generated by qmake (2.01a) (Qt 4.8.6) on: Fri May 16 07:58:47 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=7 -DPRINT_MESSAGES_ON_CONSOLE |
|
13 | DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=7 -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/basic_parameters |
|
16 | INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header -I../header/processing -I../src/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/basic_parameters/basic_parameters.c \ |
|
55 | ../src/basic_parameters/basic_parameters.c \ | |
56 | ../src/processing/fsw_processing.c \ |
|
56 | ../src/processing/fsw_processing.c \ | |
57 | ../src/processing/avf0_prc0.c \ |
|
57 | ../src/processing/avf0_prc0.c \ | |
58 | ../src/processing/avf1_prc1.c \ |
|
58 | ../src/processing/avf1_prc1.c \ | |
59 | ../src/processing/avf2_prc2.c |
|
59 | ../src/processing/avf2_prc2.c \ | |
|
60 | ../src/lfr_cpu_usage_report.c | |||
60 | OBJECTS = obj/wf_handler.o \ |
|
61 | OBJECTS = obj/wf_handler.o \ | |
61 | obj/tc_handler.o \ |
|
62 | obj/tc_handler.o \ | |
62 | obj/fsw_misc.o \ |
|
63 | obj/fsw_misc.o \ | |
63 | obj/fsw_init.o \ |
|
64 | obj/fsw_init.o \ | |
64 | obj/fsw_globals.o \ |
|
65 | obj/fsw_globals.o \ | |
65 | obj/fsw_spacewire.o \ |
|
66 | obj/fsw_spacewire.o \ | |
66 | obj/tc_load_dump_parameters.o \ |
|
67 | obj/tc_load_dump_parameters.o \ | |
67 | obj/tm_lfr_tc_exe.o \ |
|
68 | obj/tm_lfr_tc_exe.o \ | |
68 | obj/tc_acceptance.o \ |
|
69 | obj/tc_acceptance.o \ | |
69 | obj/basic_parameters.o \ |
|
70 | obj/basic_parameters.o \ | |
70 | obj/fsw_processing.o \ |
|
71 | obj/fsw_processing.o \ | |
71 | obj/avf0_prc0.o \ |
|
72 | obj/avf0_prc0.o \ | |
72 | obj/avf1_prc1.o \ |
|
73 | obj/avf1_prc1.o \ | |
73 | obj/avf2_prc2.o |
|
74 | obj/avf2_prc2.o \ | |
|
75 | obj/lfr_cpu_usage_report.o | |||
74 | DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \ |
|
76 | DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \ | |
75 | /usr/lib64/qt4/mkspecs/common/linux.conf \ |
|
77 | /usr/lib64/qt4/mkspecs/common/linux.conf \ | |
76 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ |
|
78 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ | |
77 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ |
|
79 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ | |
78 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ |
|
80 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ | |
79 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ |
|
81 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ | |
80 | /usr/lib64/qt4/mkspecs/qconfig.pri \ |
|
82 | /usr/lib64/qt4/mkspecs/qconfig.pri \ | |
81 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ |
|
83 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ | |
82 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ |
|
84 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ | |
83 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ |
|
85 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ | |
84 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ |
|
86 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ | |
85 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ |
|
87 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ | |
86 | sparc.pri \ |
|
88 | sparc.pri \ | |
87 | /usr/lib64/qt4/mkspecs/features/release.prf \ |
|
89 | /usr/lib64/qt4/mkspecs/features/release.prf \ | |
88 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ |
|
90 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ | |
89 | /usr/lib64/qt4/mkspecs/features/shared.prf \ |
|
91 | /usr/lib64/qt4/mkspecs/features/shared.prf \ | |
90 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ |
|
92 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ | |
91 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ |
|
93 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ | |
92 | /usr/lib64/qt4/mkspecs/features/resources.prf \ |
|
94 | /usr/lib64/qt4/mkspecs/features/resources.prf \ | |
93 | /usr/lib64/qt4/mkspecs/features/uic.prf \ |
|
95 | /usr/lib64/qt4/mkspecs/features/uic.prf \ | |
94 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ |
|
96 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ | |
95 | /usr/lib64/qt4/mkspecs/features/lex.prf \ |
|
97 | /usr/lib64/qt4/mkspecs/features/lex.prf \ | |
96 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \ |
|
98 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \ | |
97 | fsw-qt.pro |
|
99 | fsw-qt.pro | |
98 | QMAKE_TARGET = fsw |
|
100 | QMAKE_TARGET = fsw | |
99 | DESTDIR = bin/ |
|
101 | DESTDIR = bin/ | |
100 | TARGET = bin/fsw |
|
102 | TARGET = bin/fsw | |
101 |
|
103 | |||
102 | first: all |
|
104 | first: all | |
103 | ####### Implicit rules |
|
105 | ####### Implicit rules | |
104 |
|
106 | |||
105 | .SUFFIXES: .o .c .cpp .cc .cxx .C |
|
107 | .SUFFIXES: .o .c .cpp .cc .cxx .C | |
106 |
|
108 | |||
107 | .cpp.o: |
|
109 | .cpp.o: | |
108 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
110 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" | |
109 |
|
111 | |||
110 | .cc.o: |
|
112 | .cc.o: | |
111 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
113 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" | |
112 |
|
114 | |||
113 | .cxx.o: |
|
115 | .cxx.o: | |
114 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
116 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" | |
115 |
|
117 | |||
116 | .C.o: |
|
118 | .C.o: | |
117 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
119 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" | |
118 |
|
120 | |||
119 | .c.o: |
|
121 | .c.o: | |
120 | $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<" |
|
122 | $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<" | |
121 |
|
123 | |||
122 | ####### Build rules |
|
124 | ####### Build rules | |
123 |
|
125 | |||
124 | all: Makefile $(TARGET) |
|
126 | all: Makefile $(TARGET) | |
125 |
|
127 | |||
126 | $(TARGET): $(OBJECTS) |
|
128 | $(TARGET): $(OBJECTS) | |
127 | @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/ |
|
129 | @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/ | |
128 | $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) |
|
130 | $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) | |
129 |
|
131 | |||
130 | 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 \ | |
131 | /usr/lib64/qt4/mkspecs/common/linux.conf \ |
|
133 | /usr/lib64/qt4/mkspecs/common/linux.conf \ | |
132 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ |
|
134 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ | |
133 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ |
|
135 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ | |
134 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ |
|
136 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ | |
135 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ |
|
137 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ | |
136 | /usr/lib64/qt4/mkspecs/qconfig.pri \ |
|
138 | /usr/lib64/qt4/mkspecs/qconfig.pri \ | |
137 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ |
|
139 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ | |
138 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ |
|
140 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ | |
139 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ |
|
141 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ | |
140 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ |
|
142 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ | |
141 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ |
|
143 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ | |
142 | sparc.pri \ |
|
144 | sparc.pri \ | |
143 | /usr/lib64/qt4/mkspecs/features/release.prf \ |
|
145 | /usr/lib64/qt4/mkspecs/features/release.prf \ | |
144 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ |
|
146 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ | |
145 | /usr/lib64/qt4/mkspecs/features/shared.prf \ |
|
147 | /usr/lib64/qt4/mkspecs/features/shared.prf \ | |
146 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ |
|
148 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ | |
147 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ |
|
149 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ | |
148 | /usr/lib64/qt4/mkspecs/features/resources.prf \ |
|
150 | /usr/lib64/qt4/mkspecs/features/resources.prf \ | |
149 | /usr/lib64/qt4/mkspecs/features/uic.prf \ |
|
151 | /usr/lib64/qt4/mkspecs/features/uic.prf \ | |
150 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ |
|
152 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ | |
151 | /usr/lib64/qt4/mkspecs/features/lex.prf \ |
|
153 | /usr/lib64/qt4/mkspecs/features/lex.prf \ | |
152 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf |
|
154 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf | |
153 | $(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 | |
154 | /usr/lib64/qt4/mkspecs/common/unix.conf: |
|
156 | /usr/lib64/qt4/mkspecs/common/unix.conf: | |
155 | /usr/lib64/qt4/mkspecs/common/linux.conf: |
|
157 | /usr/lib64/qt4/mkspecs/common/linux.conf: | |
156 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf: |
|
158 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf: | |
157 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf: |
|
159 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf: | |
158 | /usr/lib64/qt4/mkspecs/common/g++-base.conf: |
|
160 | /usr/lib64/qt4/mkspecs/common/g++-base.conf: | |
159 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf: |
|
161 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf: | |
160 | /usr/lib64/qt4/mkspecs/qconfig.pri: |
|
162 | /usr/lib64/qt4/mkspecs/qconfig.pri: | |
161 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri: |
|
163 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri: | |
162 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf: |
|
164 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf: | |
163 | /usr/lib64/qt4/mkspecs/features/qt_config.prf: |
|
165 | /usr/lib64/qt4/mkspecs/features/qt_config.prf: | |
164 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf: |
|
166 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf: | |
165 | /usr/lib64/qt4/mkspecs/features/default_pre.prf: |
|
167 | /usr/lib64/qt4/mkspecs/features/default_pre.prf: | |
166 | sparc.pri: |
|
168 | sparc.pri: | |
167 | /usr/lib64/qt4/mkspecs/features/release.prf: |
|
169 | /usr/lib64/qt4/mkspecs/features/release.prf: | |
168 | /usr/lib64/qt4/mkspecs/features/default_post.prf: |
|
170 | /usr/lib64/qt4/mkspecs/features/default_post.prf: | |
169 | /usr/lib64/qt4/mkspecs/features/shared.prf: |
|
171 | /usr/lib64/qt4/mkspecs/features/shared.prf: | |
170 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf: |
|
172 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf: | |
171 | /usr/lib64/qt4/mkspecs/features/warn_on.prf: |
|
173 | /usr/lib64/qt4/mkspecs/features/warn_on.prf: | |
172 | /usr/lib64/qt4/mkspecs/features/resources.prf: |
|
174 | /usr/lib64/qt4/mkspecs/features/resources.prf: | |
173 | /usr/lib64/qt4/mkspecs/features/uic.prf: |
|
175 | /usr/lib64/qt4/mkspecs/features/uic.prf: | |
174 | /usr/lib64/qt4/mkspecs/features/yacc.prf: |
|
176 | /usr/lib64/qt4/mkspecs/features/yacc.prf: | |
175 | /usr/lib64/qt4/mkspecs/features/lex.prf: |
|
177 | /usr/lib64/qt4/mkspecs/features/lex.prf: | |
176 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf: |
|
178 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf: | |
177 | qmake: FORCE |
|
179 | qmake: FORCE | |
178 | @$(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 | |
179 |
|
181 | |||
180 | dist: |
|
182 | dist: | |
181 | @$(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 | |
182 | $(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 | |
183 |
|
185 | |||
184 |
|
186 | |||
185 | clean:compiler_clean |
|
187 | clean:compiler_clean | |
186 | -$(DEL_FILE) $(OBJECTS) |
|
188 | -$(DEL_FILE) $(OBJECTS) | |
187 | -$(DEL_FILE) *~ core *.core |
|
189 | -$(DEL_FILE) *~ core *.core | |
188 |
|
190 | |||
189 |
|
191 | |||
190 | ####### Sub-libraries |
|
192 | ####### Sub-libraries | |
191 |
|
193 | |||
192 | distclean: clean |
|
194 | distclean: clean | |
193 | -$(DEL_FILE) $(TARGET) |
|
195 | -$(DEL_FILE) $(TARGET) | |
194 | -$(DEL_FILE) Makefile |
|
196 | -$(DEL_FILE) Makefile | |
195 |
|
197 | |||
196 |
|
198 | |||
197 | grmon: |
|
199 | grmon: | |
198 | 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 | |
199 |
|
201 | |||
200 | check: first |
|
202 | check: first | |
201 |
|
203 | |||
202 | compiler_rcc_make_all: |
|
204 | compiler_rcc_make_all: | |
203 | compiler_rcc_clean: |
|
205 | compiler_rcc_clean: | |
204 | compiler_uic_make_all: |
|
206 | compiler_uic_make_all: | |
205 | compiler_uic_clean: |
|
207 | compiler_uic_clean: | |
206 | compiler_image_collection_make_all: qmake_image_collection.cpp |
|
208 | compiler_image_collection_make_all: qmake_image_collection.cpp | |
207 | compiler_image_collection_clean: |
|
209 | compiler_image_collection_clean: | |
208 | -$(DEL_FILE) qmake_image_collection.cpp |
|
210 | -$(DEL_FILE) qmake_image_collection.cpp | |
209 | compiler_yacc_decl_make_all: |
|
211 | compiler_yacc_decl_make_all: | |
210 | compiler_yacc_decl_clean: |
|
212 | compiler_yacc_decl_clean: | |
211 | compiler_yacc_impl_make_all: |
|
213 | compiler_yacc_impl_make_all: | |
212 | compiler_yacc_impl_clean: |
|
214 | compiler_yacc_impl_clean: | |
213 | compiler_lex_make_all: |
|
215 | compiler_lex_make_all: | |
214 | compiler_lex_clean: |
|
216 | compiler_lex_clean: | |
215 | compiler_clean: |
|
217 | compiler_clean: | |
216 |
|
218 | |||
217 | ####### Compile |
|
219 | ####### Compile | |
218 |
|
220 | |||
219 | obj/wf_handler.o: ../src/wf_handler.c |
|
221 | obj/wf_handler.o: ../src/wf_handler.c | |
220 | $(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 | |
221 |
|
223 | |||
222 | obj/tc_handler.o: ../src/tc_handler.c |
|
224 | obj/tc_handler.o: ../src/tc_handler.c | |
223 | $(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 | |
224 |
|
226 | |||
225 | obj/fsw_misc.o: ../src/fsw_misc.c |
|
227 | obj/fsw_misc.o: ../src/fsw_misc.c | |
226 | $(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 | |
227 |
|
229 | |||
228 | 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 | |
229 | $(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 | |
230 |
|
232 | |||
231 | obj/fsw_globals.o: ../src/fsw_globals.c |
|
233 | obj/fsw_globals.o: ../src/fsw_globals.c | |
232 | $(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 | |
233 |
|
235 | |||
234 | obj/fsw_spacewire.o: ../src/fsw_spacewire.c |
|
236 | obj/fsw_spacewire.o: ../src/fsw_spacewire.c | |
235 | $(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 | |
236 |
|
238 | |||
237 | 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 | |
238 | $(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 | |
239 |
|
241 | |||
240 | 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 | |
241 | $(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 | |
242 |
|
244 | |||
243 | obj/tc_acceptance.o: ../src/tc_acceptance.c |
|
245 | obj/tc_acceptance.o: ../src/tc_acceptance.c | |
244 | $(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 | |
245 |
|
247 | |||
246 | obj/basic_parameters.o: ../src/basic_parameters/basic_parameters.c ../src/basic_parameters/basic_parameters.h |
|
248 | obj/basic_parameters.o: ../src/basic_parameters/basic_parameters.c ../src/basic_parameters/basic_parameters.h | |
247 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/basic_parameters.o ../src/basic_parameters/basic_parameters.c |
|
249 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/basic_parameters.o ../src/basic_parameters/basic_parameters.c | |
248 |
|
250 | |||
249 | obj/fsw_processing.o: ../src/processing/fsw_processing.c |
|
251 | obj/fsw_processing.o: ../src/processing/fsw_processing.c | |
250 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/processing/fsw_processing.c |
|
252 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/processing/fsw_processing.c | |
251 |
|
253 | |||
252 | obj/avf0_prc0.o: ../src/processing/avf0_prc0.c |
|
254 | obj/avf0_prc0.o: ../src/processing/avf0_prc0.c | |
253 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf0_prc0.o ../src/processing/avf0_prc0.c |
|
255 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf0_prc0.o ../src/processing/avf0_prc0.c | |
254 |
|
256 | |||
255 | obj/avf1_prc1.o: ../src/processing/avf1_prc1.c |
|
257 | obj/avf1_prc1.o: ../src/processing/avf1_prc1.c | |
256 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf1_prc1.o ../src/processing/avf1_prc1.c |
|
258 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf1_prc1.o ../src/processing/avf1_prc1.c | |
257 |
|
259 | |||
258 | obj/avf2_prc2.o: ../src/processing/avf2_prc2.c |
|
260 | obj/avf2_prc2.o: ../src/processing/avf2_prc2.c | |
259 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf2_prc2.o ../src/processing/avf2_prc2.c |
|
261 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf2_prc2.o ../src/processing/avf2_prc2.c | |
260 |
|
262 | |||
|
263 | obj/lfr_cpu_usage_report.o: ../src/lfr_cpu_usage_report.c | |||
|
264 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/lfr_cpu_usage_report.o ../src/lfr_cpu_usage_report.c | |||
|
265 | ||||
261 | ####### Install |
|
266 | ####### Install | |
262 |
|
267 | |||
263 | install: FORCE |
|
268 | install: FORCE | |
264 |
|
269 | |||
265 | uninstall: FORCE |
|
270 | uninstall: FORCE | |
266 |
|
271 | |||
267 | FORCE: |
|
272 | FORCE: | |
268 |
|
273 |
@@ -1,92 +1,94 | |||||
1 | TEMPLATE = app |
|
1 | TEMPLATE = app | |
2 | # CONFIG += console v8 sim |
|
2 | # CONFIG += console v8 sim | |
3 | # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** vhdl_dev *** debug_tch |
|
3 | # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** vhdl_dev *** debug_tch | |
4 |
CONFIG += console verbose |
|
4 | CONFIG += console verbose | |
5 | CONFIG -= qt |
|
5 | CONFIG -= qt | |
6 |
|
6 | |||
7 | include(./sparc.pri) |
|
7 | include(./sparc.pri) | |
8 |
|
8 | |||
9 | # flight software version |
|
9 | # flight software version | |
10 | SWVERSION=-1-0 |
|
10 | SWVERSION=-1-0 | |
11 | DEFINES += SW_VERSION_N1=1 # major |
|
11 | DEFINES += SW_VERSION_N1=1 # major | |
12 | DEFINES += SW_VERSION_N2=0 # minor |
|
12 | DEFINES += SW_VERSION_N2=0 # minor | |
13 | DEFINES += SW_VERSION_N3=0 # patch |
|
13 | DEFINES += SW_VERSION_N3=0 # patch | |
14 | DEFINES += SW_VERSION_N4=7 # internal |
|
14 | DEFINES += SW_VERSION_N4=7 # internal | |
15 |
|
15 | |||
16 | contains( CONFIG, debug_tch ) { |
|
16 | contains( CONFIG, debug_tch ) { | |
17 | DEFINES += DEBUG_TCH |
|
17 | DEFINES += DEBUG_TCH | |
18 | } |
|
18 | } | |
19 |
|
19 | |||
20 | contains( CONFIG, vhdl_dev ) { |
|
20 | contains( CONFIG, vhdl_dev ) { | |
21 | DEFINES += VHDL_DEV |
|
21 | DEFINES += VHDL_DEV | |
22 | } |
|
22 | } | |
23 |
|
23 | |||
24 | contains( CONFIG, verbose ) { |
|
24 | contains( CONFIG, verbose ) { | |
25 | DEFINES += PRINT_MESSAGES_ON_CONSOLE |
|
25 | DEFINES += PRINT_MESSAGES_ON_CONSOLE | |
26 | } |
|
26 | } | |
27 |
|
27 | |||
28 | contains( CONFIG, debug_messages ) { |
|
28 | contains( CONFIG, debug_messages ) { | |
29 | DEFINES += DEBUG_MESSAGES |
|
29 | DEFINES += DEBUG_MESSAGES | |
30 | } |
|
30 | } | |
31 |
|
31 | |||
32 | contains( CONFIG, cpu_usage_report ) { |
|
32 | contains( CONFIG, cpu_usage_report ) { | |
33 | DEFINES += PRINT_TASK_STATISTICS |
|
33 | DEFINES += PRINT_TASK_STATISTICS | |
34 | } |
|
34 | } | |
35 |
|
35 | |||
36 | contains( CONFIG, stack_report ) { |
|
36 | contains( CONFIG, stack_report ) { | |
37 | DEFINES += PRINT_STACK_REPORT |
|
37 | DEFINES += PRINT_STACK_REPORT | |
38 | } |
|
38 | } | |
39 |
|
39 | |||
40 | contains( CONFIG, boot_messages ) { |
|
40 | contains( CONFIG, boot_messages ) { | |
41 | DEFINES += BOOT_MESSAGES |
|
41 | DEFINES += BOOT_MESSAGES | |
42 | } |
|
42 | } | |
43 |
|
43 | |||
44 | #doxygen.target = doxygen |
|
44 | #doxygen.target = doxygen | |
45 | #doxygen.commands = doxygen ../doc/Doxyfile |
|
45 | #doxygen.commands = doxygen ../doc/Doxyfile | |
46 | #QMAKE_EXTRA_TARGETS += doxygen |
|
46 | #QMAKE_EXTRA_TARGETS += doxygen | |
47 |
|
47 | |||
48 | TARGET = fsw |
|
48 | TARGET = fsw | |
49 |
|
49 | |||
50 | INCLUDEPATH += \ |
|
50 | INCLUDEPATH += \ | |
51 | ../src \ |
|
51 | ../src \ | |
52 | ../header \ |
|
52 | ../header \ | |
53 | ../header/processing \ |
|
53 | ../header/processing \ | |
54 | ../src/basic_parameters |
|
54 | ../src/basic_parameters | |
55 |
|
55 | |||
56 | SOURCES += \ |
|
56 | SOURCES += \ | |
57 | ../src/wf_handler.c \ |
|
57 | ../src/wf_handler.c \ | |
58 | ../src/tc_handler.c \ |
|
58 | ../src/tc_handler.c \ | |
59 | ../src/fsw_misc.c \ |
|
59 | ../src/fsw_misc.c \ | |
60 | ../src/fsw_init.c \ |
|
60 | ../src/fsw_init.c \ | |
61 | ../src/fsw_globals.c \ |
|
61 | ../src/fsw_globals.c \ | |
62 | ../src/fsw_spacewire.c \ |
|
62 | ../src/fsw_spacewire.c \ | |
63 | ../src/tc_load_dump_parameters.c \ |
|
63 | ../src/tc_load_dump_parameters.c \ | |
64 | ../src/tm_lfr_tc_exe.c \ |
|
64 | ../src/tm_lfr_tc_exe.c \ | |
65 | ../src/tc_acceptance.c \ |
|
65 | ../src/tc_acceptance.c \ | |
66 | ../src/basic_parameters/basic_parameters.c \ |
|
66 | ../src/basic_parameters/basic_parameters.c \ | |
67 | ../src/processing/fsw_processing.c \ |
|
67 | ../src/processing/fsw_processing.c \ | |
68 | ../src/processing/avf0_prc0.c \ |
|
68 | ../src/processing/avf0_prc0.c \ | |
69 | ../src/processing/avf1_prc1.c \ |
|
69 | ../src/processing/avf1_prc1.c \ | |
70 | ../src/processing/avf2_prc2.c |
|
70 | ../src/processing/avf2_prc2.c \ | |
|
71 | ../src/lfr_cpu_usage_report.c | |||
71 |
|
72 | |||
72 | HEADERS += \ |
|
73 | HEADERS += \ | |
73 | ../header/wf_handler.h \ |
|
74 | ../header/wf_handler.h \ | |
74 | ../header/tc_handler.h \ |
|
75 | ../header/tc_handler.h \ | |
75 | ../header/grlib_regs.h \ |
|
76 | ../header/grlib_regs.h \ | |
76 | ../header/fsw_params.h \ |
|
77 | ../header/fsw_params.h \ | |
77 | ../header/fsw_misc.h \ |
|
78 | ../header/fsw_misc.h \ | |
78 | ../header/fsw_init.h \ |
|
79 | ../header/fsw_init.h \ | |
79 | ../header/ccsds_types.h \ |
|
80 | ../header/ccsds_types.h \ | |
80 | ../header/fsw_spacewire.h \ |
|
81 | ../header/fsw_spacewire.h \ | |
81 | ../header/tc_load_dump_parameters.h \ |
|
82 | ../header/tc_load_dump_parameters.h \ | |
82 | ../header/tm_lfr_tc_exe.h \ |
|
83 | ../header/tm_lfr_tc_exe.h \ | |
83 | ../header/tc_acceptance.h \ |
|
84 | ../header/tc_acceptance.h \ | |
84 | ../header/fsw_params_nb_bytes.h \ |
|
85 | ../header/fsw_params_nb_bytes.h \ | |
85 | ../src/basic_parameters/basic_parameters.h \ |
|
86 | ../src/basic_parameters/basic_parameters.h \ | |
86 | ../header/fsw_params_processing.h \ |
|
87 | ../header/fsw_params_processing.h \ | |
87 | ../header/processing/fsw_processing.h \ |
|
88 | ../header/processing/fsw_processing.h \ | |
88 | ../header/processing/avf0_prc0.h \ |
|
89 | ../header/processing/avf0_prc0.h \ | |
89 | ../header/processing/avf1_prc1.h \ |
|
90 | ../header/processing/avf1_prc1.h \ | |
90 | ../header/processing/avf2_prc2.h \ |
|
91 | ../header/processing/avf2_prc2.h \ | |
91 | ../header/fsw_params_wf_handler.h |
|
92 | ../header/fsw_params_wf_handler.h \ | |
|
93 | ../header/lfr_cpu_usage_report.h | |||
92 |
|
94 |
@@ -1,201 +1,201 | |||||
1 | <?xml version="1.0" encoding="UTF-8"?> |
|
1 | <?xml version="1.0" encoding="UTF-8"?> | |
2 | <!DOCTYPE QtCreatorProject> |
|
2 | <!DOCTYPE QtCreatorProject> | |
3 |
<!-- Written by QtCreator 3.0.1, 2014-05-1 |
|
3 | <!-- Written by QtCreator 3.0.1, 2014-05-16T15:09:51. --> | |
4 | <qtcreator> |
|
4 | <qtcreator> | |
5 | <data> |
|
5 | <data> | |
6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
|
6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> | |
7 | <value type="int">0</value> |
|
7 | <value type="int">0</value> | |
8 | </data> |
|
8 | </data> | |
9 | <data> |
|
9 | <data> | |
10 | <variable>ProjectExplorer.Project.EditorSettings</variable> |
|
10 | <variable>ProjectExplorer.Project.EditorSettings</variable> | |
11 | <valuemap type="QVariantMap"> |
|
11 | <valuemap type="QVariantMap"> | |
12 | <value type="bool" key="EditorConfiguration.AutoIndent">true</value> |
|
12 | <value type="bool" key="EditorConfiguration.AutoIndent">true</value> | |
13 | <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value> |
|
13 | <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value> | |
14 | <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value> |
|
14 | <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value> | |
15 | <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0"> |
|
15 | <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0"> | |
16 | <value type="QString" key="language">Cpp</value> |
|
16 | <value type="QString" key="language">Cpp</value> | |
17 | <valuemap type="QVariantMap" key="value"> |
|
17 | <valuemap type="QVariantMap" key="value"> | |
18 | <value type="QByteArray" key="CurrentPreferences">CppGlobal</value> |
|
18 | <value type="QByteArray" key="CurrentPreferences">CppGlobal</value> | |
19 | </valuemap> |
|
19 | </valuemap> | |
20 | </valuemap> |
|
20 | </valuemap> | |
21 | <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1"> |
|
21 | <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1"> | |
22 | <value type="QString" key="language">QmlJS</value> |
|
22 | <value type="QString" key="language">QmlJS</value> | |
23 | <valuemap type="QVariantMap" key="value"> |
|
23 | <valuemap type="QVariantMap" key="value"> | |
24 | <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value> |
|
24 | <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value> | |
25 | </valuemap> |
|
25 | </valuemap> | |
26 | </valuemap> |
|
26 | </valuemap> | |
27 | <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value> |
|
27 | <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value> | |
28 | <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value> |
|
28 | <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value> | |
29 | <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value> |
|
29 | <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value> | |
30 | <value type="int" key="EditorConfiguration.IndentSize">4</value> |
|
30 | <value type="int" key="EditorConfiguration.IndentSize">4</value> | |
31 | <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value> |
|
31 | <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value> | |
32 | <value type="bool" key="EditorConfiguration.MouseNavigation">true</value> |
|
32 | <value type="bool" key="EditorConfiguration.MouseNavigation">true</value> | |
33 | <value type="int" key="EditorConfiguration.PaddingMode">1</value> |
|
33 | <value type="int" key="EditorConfiguration.PaddingMode">1</value> | |
34 | <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value> |
|
34 | <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value> | |
35 | <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value> |
|
35 | <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value> | |
36 | <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value> |
|
36 | <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value> | |
37 | <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value> |
|
37 | <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value> | |
38 | <value type="int" key="EditorConfiguration.TabSize">8</value> |
|
38 | <value type="int" key="EditorConfiguration.TabSize">8</value> | |
39 | <value type="bool" key="EditorConfiguration.UseGlobal">true</value> |
|
39 | <value type="bool" key="EditorConfiguration.UseGlobal">true</value> | |
40 | <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value> |
|
40 | <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value> | |
41 | <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value> |
|
41 | <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value> | |
42 | <value type="bool" key="EditorConfiguration.cleanIndentation">true</value> |
|
42 | <value type="bool" key="EditorConfiguration.cleanIndentation">true</value> | |
43 | <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value> |
|
43 | <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value> | |
44 | <value type="bool" key="EditorConfiguration.inEntireDocument">false</value> |
|
44 | <value type="bool" key="EditorConfiguration.inEntireDocument">false</value> | |
45 | </valuemap> |
|
45 | </valuemap> | |
46 | </data> |
|
46 | </data> | |
47 | <data> |
|
47 | <data> | |
48 | <variable>ProjectExplorer.Project.PluginSettings</variable> |
|
48 | <variable>ProjectExplorer.Project.PluginSettings</variable> | |
49 | <valuemap type="QVariantMap"/> |
|
49 | <valuemap type="QVariantMap"/> | |
50 | </data> |
|
50 | </data> | |
51 | <data> |
|
51 | <data> | |
52 | <variable>ProjectExplorer.Project.Target.0</variable> |
|
52 | <variable>ProjectExplorer.Project.Target.0</variable> | |
53 | <valuemap type="QVariantMap"> |
|
53 | <valuemap type="QVariantMap"> | |
54 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.2 in PATH (System)</value> |
|
54 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.2 in PATH (System)</value> | |
55 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.2 in PATH (System)</value> |
|
55 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.2 in PATH (System)</value> | |
56 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{5289e843-9ef2-45ce-88c6-ad27d8e08def}</value> |
|
56 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{5289e843-9ef2-45ce-88c6-ad27d8e08def}</value> | |
57 | <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value> |
|
57 | <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value> | |
58 | <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> |
|
58 | <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> | |
59 | <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> |
|
59 | <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> | |
60 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> |
|
60 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> | |
61 | <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory"></value> |
|
61 | <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory"></value> | |
62 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|
62 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> | |
63 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
63 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> | |
64 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
64 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> | |
65 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> |
|
65 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> | |
66 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
66 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
67 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> |
|
67 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> | |
68 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> |
|
68 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> | |
69 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value> |
|
69 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value> | |
70 | <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> |
|
70 | <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> | |
71 | <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> |
|
71 | <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> | |
72 | </valuemap> |
|
72 | </valuemap> | |
73 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> |
|
73 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> | |
74 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
74 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> | |
75 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
75 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> | |
76 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
76 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
77 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
77 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> | |
78 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
78 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> | |
79 | <value type="QString">-w</value> |
|
79 | <value type="QString">-w</value> | |
80 | <value type="QString">-r</value> |
|
80 | <value type="QString">-r</value> | |
81 | </valuelist> |
|
81 | </valuelist> | |
82 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> |
|
82 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> | |
83 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> |
|
83 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> | |
84 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
84 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> | |
85 | </valuemap> |
|
85 | </valuemap> | |
86 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> |
|
86 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> | |
87 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> |
|
87 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> | |
88 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
88 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
89 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> |
|
89 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> | |
90 | </valuemap> |
|
90 | </valuemap> | |
91 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> |
|
91 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> | |
92 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
92 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> | |
93 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
93 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> | |
94 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
94 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> | |
95 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
95 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
96 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
96 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> | |
97 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
97 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> | |
98 | <value type="QString">-w</value> |
|
98 | <value type="QString">-w</value> | |
99 | <value type="QString">-r</value> |
|
99 | <value type="QString">-r</value> | |
100 | </valuelist> |
|
100 | </valuelist> | |
101 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> |
|
101 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> | |
102 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> |
|
102 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> | |
103 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
103 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> | |
104 | </valuemap> |
|
104 | </valuemap> | |
105 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> |
|
105 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> | |
106 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> |
|
106 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> | |
107 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
107 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
108 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> |
|
108 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> | |
109 | </valuemap> |
|
109 | </valuemap> | |
110 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> |
|
110 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> | |
111 | <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> |
|
111 | <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> | |
112 | <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> |
|
112 | <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> | |
113 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value> |
|
113 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value> | |
114 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
114 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
115 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> |
|
115 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> | |
116 | <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> |
|
116 | <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> | |
117 | <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> |
|
117 | <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> | |
118 | </valuemap> |
|
118 | </valuemap> | |
119 | <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value> |
|
119 | <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value> | |
120 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0"> |
|
120 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0"> | |
121 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|
121 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> | |
122 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value> |
|
122 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value> | |
123 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value> |
|
123 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value> | |
124 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
124 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
125 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value> |
|
125 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value> | |
126 | </valuemap> |
|
126 | </valuemap> | |
127 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value> |
|
127 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value> | |
128 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value> |
|
128 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value> | |
129 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
129 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
130 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value> |
|
130 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value> | |
131 | </valuemap> |
|
131 | </valuemap> | |
132 | <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> |
|
132 | <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> | |
133 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/> |
|
133 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/> | |
134 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> |
|
134 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> | |
135 | <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> |
|
135 | <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> | |
136 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> |
|
136 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> | |
137 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> |
|
137 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> | |
138 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> |
|
138 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> | |
139 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> |
|
139 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> | |
140 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> |
|
140 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> | |
141 | <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> |
|
141 | <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> | |
142 | <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> |
|
142 | <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> | |
143 | <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> |
|
143 | <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> | |
144 | <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value> |
|
144 | <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value> | |
145 | <value type="int" key="Analyzer.Valgrind.NumCallers">25</value> |
|
145 | <value type="int" key="Analyzer.Valgrind.NumCallers">25</value> | |
146 | <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> |
|
146 | <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> | |
147 | <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value> |
|
147 | <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value> | |
148 | <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value> |
|
148 | <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value> | |
149 | <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value> |
|
149 | <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value> | |
150 | <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> |
|
150 | <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> | |
151 | <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> |
|
151 | <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> | |
152 | <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> |
|
152 | <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> | |
153 | <value type="int">0</value> |
|
153 | <value type="int">0</value> | |
154 | <value type="int">1</value> |
|
154 | <value type="int">1</value> | |
155 | <value type="int">2</value> |
|
155 | <value type="int">2</value> | |
156 | <value type="int">3</value> |
|
156 | <value type="int">3</value> | |
157 | <value type="int">4</value> |
|
157 | <value type="int">4</value> | |
158 | <value type="int">5</value> |
|
158 | <value type="int">5</value> | |
159 | <value type="int">6</value> |
|
159 | <value type="int">6</value> | |
160 | <value type="int">7</value> |
|
160 | <value type="int">7</value> | |
161 | <value type="int">8</value> |
|
161 | <value type="int">8</value> | |
162 | <value type="int">9</value> |
|
162 | <value type="int">9</value> | |
163 | <value type="int">10</value> |
|
163 | <value type="int">10</value> | |
164 | <value type="int">11</value> |
|
164 | <value type="int">11</value> | |
165 | <value type="int">12</value> |
|
165 | <value type="int">12</value> | |
166 | <value type="int">13</value> |
|
166 | <value type="int">13</value> | |
167 | <value type="int">14</value> |
|
167 | <value type="int">14</value> | |
168 | </valuelist> |
|
168 | </valuelist> | |
169 | <value type="int" key="PE.EnvironmentAspect.Base">2</value> |
|
169 | <value type="int" key="PE.EnvironmentAspect.Base">2</value> | |
170 | <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> |
|
170 | <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> | |
171 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value> |
|
171 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value> | |
172 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
172 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
173 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value> |
|
173 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value> | |
174 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value> |
|
174 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value> | |
175 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value> |
|
175 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value> | |
176 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value> |
|
176 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value> | |
177 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value> |
|
177 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value> | |
178 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value> |
|
178 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value> | |
179 | <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> |
|
179 | <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> | |
180 | <value type="bool" key="RunConfiguration.UseCppDebugger">true</value> |
|
180 | <value type="bool" key="RunConfiguration.UseCppDebugger">true</value> | |
181 | <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value> |
|
181 | <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value> | |
182 | <value type="bool" key="RunConfiguration.UseMultiProcess">false</value> |
|
182 | <value type="bool" key="RunConfiguration.UseMultiProcess">false</value> | |
183 | <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> |
|
183 | <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> | |
184 | <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> |
|
184 | <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> | |
185 | </valuemap> |
|
185 | </valuemap> | |
186 | <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value> |
|
186 | <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value> | |
187 | </valuemap> |
|
187 | </valuemap> | |
188 | </data> |
|
188 | </data> | |
189 | <data> |
|
189 | <data> | |
190 | <variable>ProjectExplorer.Project.TargetCount</variable> |
|
190 | <variable>ProjectExplorer.Project.TargetCount</variable> | |
191 | <value type="int">1</value> |
|
191 | <value type="int">1</value> | |
192 | </data> |
|
192 | </data> | |
193 | <data> |
|
193 | <data> | |
194 | <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable> |
|
194 | <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable> | |
195 | <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value> |
|
195 | <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value> | |
196 | </data> |
|
196 | </data> | |
197 | <data> |
|
197 | <data> | |
198 | <variable>ProjectExplorer.Project.Updater.FileVersion</variable> |
|
198 | <variable>ProjectExplorer.Project.Updater.FileVersion</variable> | |
199 | <value type="int">15</value> |
|
199 | <value type="int">15</value> | |
200 | </data> |
|
200 | </data> | |
201 | </qtcreator> |
|
201 | </qtcreator> |
@@ -1,665 +1,665 | |||||
1 | #ifndef CCSDS_TYPES_H_INCLUDED |
|
1 | #ifndef CCSDS_TYPES_H_INCLUDED | |
2 | #define CCSDS_TYPES_H_INCLUDED |
|
2 | #define CCSDS_TYPES_H_INCLUDED | |
3 |
|
3 | |||
4 | #include "fsw_params_processing.h" |
|
4 | #include "fsw_params_processing.h" | |
5 |
|
5 | |||
6 | #define CCSDS_PROTOCOLE_EXTRA_BYTES 4 |
|
6 | #define CCSDS_PROTOCOLE_EXTRA_BYTES 4 | |
7 | #define CCSDS_TC_TM_PACKET_OFFSET 7 |
|
7 | #define CCSDS_TC_TM_PACKET_OFFSET 7 | |
8 | #define CCSDS_TELEMETRY_HEADER_LENGTH 16+4 |
|
8 | #define CCSDS_TELEMETRY_HEADER_LENGTH 16+4 | |
9 | #define CCSDS_TM_PKT_MAX_SIZE 4412 |
|
9 | #define CCSDS_TM_PKT_MAX_SIZE 4412 | |
10 | #define CCSDS_TELECOMMAND_HEADER_LENGTH 10+4 |
|
10 | #define CCSDS_TELECOMMAND_HEADER_LENGTH 10+4 | |
11 | #define CCSDS_TC_PKT_MAX_SIZE 256 |
|
11 | #define CCSDS_TC_PKT_MAX_SIZE 256 | |
12 | #define CCSDS_TC_PKT_MIN_SIZE 16 |
|
12 | #define CCSDS_TC_PKT_MIN_SIZE 16 | |
13 | #define CCSDS_PROCESS_ID 76 |
|
13 | #define CCSDS_PROCESS_ID 76 | |
14 | #define CCSDS_PACKET_CATEGORY 12 |
|
14 | #define CCSDS_PACKET_CATEGORY 12 | |
15 | #define CCSDS_NODE_ADDRESS 0xfe |
|
15 | #define CCSDS_NODE_ADDRESS 0xfe | |
16 | #define CCSDS_USER_APP 0x00 |
|
16 | #define CCSDS_USER_APP 0x00 | |
17 |
|
17 | |||
18 | #define DEFAULT_SPARE1_PUSVERSION_SPARE2 0x10 |
|
18 | #define DEFAULT_SPARE1_PUSVERSION_SPARE2 0x10 | |
19 | #define DEFAULT_RESERVED 0x00 |
|
19 | #define DEFAULT_RESERVED 0x00 | |
20 | #define DEFAULT_HKBIA 0x1e // 0001 1110 |
|
20 | #define DEFAULT_HKBIA 0x1e // 0001 1110 | |
21 |
|
21 | |||
22 | // PACKET ID |
|
22 | // PACKET ID | |
23 | #define APID_TM_TC_EXE 0x0cc1 // PID 76 CAT 1 |
|
23 | #define APID_TM_TC_EXE 0x0cc1 // PID 76 CAT 1 | |
24 | #define APID_TM_HK 0x0cc4 // PID 76 CAT 4 |
|
24 | #define APID_TM_HK 0x0cc4 // PID 76 CAT 4 | |
25 | #define APID_TM_PARAMETER_DUMP 0x0cc9 // PID 76 CAT 9 |
|
25 | #define APID_TM_PARAMETER_DUMP 0x0cc9 // PID 76 CAT 9 | |
26 | #define APID_TM_SCIENCE_NORMAL_BURST 0x0ccc // PID 76 CAT 12 |
|
26 | #define APID_TM_SCIENCE_NORMAL_BURST 0x0ccc // PID 76 CAT 12 | |
27 | #define APID_TM_SCIENCE_SBM1_SBM2 0x0cfc // PID 79 CAT 12 |
|
27 | #define APID_TM_SCIENCE_SBM1_SBM2 0x0cfc // PID 79 CAT 12 | |
28 | #define TM_PACKET_PID_DEFAULT 76 |
|
28 | #define TM_PACKET_PID_DEFAULT 76 | |
29 | #define TM_PACKET_PID_BURST_SBM1_SBM2 79 |
|
29 | #define TM_PACKET_PID_BURST_SBM1_SBM2 79 | |
30 | #define TM_PACKET_CAT_TC_EXE 1 |
|
30 | #define TM_PACKET_CAT_TC_EXE 1 | |
31 | #define TM_PACKET_CAT_HK 4 |
|
31 | #define TM_PACKET_CAT_HK 4 | |
32 | #define TM_PACKET_CAT_PARAMETER_DUMP 9 |
|
32 | #define TM_PACKET_CAT_PARAMETER_DUMP 9 | |
33 | #define TM_PACKET_CAT_SCIENCE 12 |
|
33 | #define TM_PACKET_CAT_SCIENCE 12 | |
34 | #define TC_PACKET_CAT 12 |
|
34 | #define TC_PACKET_CAT 12 | |
35 |
|
35 | |||
36 | // PACKET SEQUENCE CONTROL |
|
36 | // PACKET SEQUENCE CONTROL | |
37 | #define TM_PACKET_SEQ_CTRL_CONTINUATION 0x00 // [0000 0000] |
|
37 | #define TM_PACKET_SEQ_CTRL_CONTINUATION 0x00 // [0000 0000] | |
38 | #define TM_PACKET_SEQ_CTRL_FIRST 0x40 // [0100 0000] |
|
38 | #define TM_PACKET_SEQ_CTRL_FIRST 0x40 // [0100 0000] | |
39 | #define TM_PACKET_SEQ_CTRL_LAST 0x80 // [1000 0000] |
|
39 | #define TM_PACKET_SEQ_CTRL_LAST 0x80 // [1000 0000] | |
40 | #define TM_PACKET_SEQ_CTRL_STANDALONE 0xc0 // [1100 0000] |
|
40 | #define TM_PACKET_SEQ_CTRL_STANDALONE 0xc0 // [1100 0000] | |
41 | #define TM_PACKET_SEQ_CNT_DEFAULT 0x00 // [0000 0000] |
|
41 | #define TM_PACKET_SEQ_CNT_DEFAULT 0x00 // [0000 0000] | |
42 |
|
42 | |||
43 | // DESTINATION ID |
|
43 | // DESTINATION ID | |
44 | #define TM_DESTINATION_ID_GROUND 0 |
|
44 | #define TM_DESTINATION_ID_GROUND 0 | |
45 | #define TM_DESTINATION_ID_MISSION_TIMELINE 110 |
|
45 | #define TM_DESTINATION_ID_MISSION_TIMELINE 110 | |
46 | #define TM_DESTINATION_ID_TC_SEQUENCES 111 |
|
46 | #define TM_DESTINATION_ID_TC_SEQUENCES 111 | |
47 | #define TM_DESTINATION_ID_RECOVERY_ACTION_COMMAND 112 |
|
47 | #define TM_DESTINATION_ID_RECOVERY_ACTION_COMMAND 112 | |
48 | #define TM_DESTINATION_ID_BACKUP_MISSION_TIMELINE 113 |
|
48 | #define TM_DESTINATION_ID_BACKUP_MISSION_TIMELINE 113 | |
49 | #define TM_DESTINATION_ID_DIRECT_CMD 120 |
|
49 | #define TM_DESTINATION_ID_DIRECT_CMD 120 | |
50 | #define TM_DESTINATION_ID_SPARE_GRD_SRC1 121 |
|
50 | #define TM_DESTINATION_ID_SPARE_GRD_SRC1 121 | |
51 | #define TM_DESTINATION_ID_SPARE_GRD_SRC2 122 |
|
51 | #define TM_DESTINATION_ID_SPARE_GRD_SRC2 122 | |
52 | #define TM_DESTINATION_ID_OBCP 15 |
|
52 | #define TM_DESTINATION_ID_OBCP 15 | |
53 | #define TM_DESTINATION_ID_SYSTEM_CONTROL 14 |
|
53 | #define TM_DESTINATION_ID_SYSTEM_CONTROL 14 | |
54 | #define TM_DESTINATION_ID_AOCS 11 |
|
54 | #define TM_DESTINATION_ID_AOCS 11 | |
55 |
|
55 | |||
56 | #define CCSDS_DESTINATION_ID 0x01 |
|
56 | #define CCSDS_DESTINATION_ID 0x01 | |
57 | #define CCSDS_PROTOCOLE_ID 0x02 |
|
57 | #define CCSDS_PROTOCOLE_ID 0x02 | |
58 | #define CCSDS_RESERVED 0x00 |
|
58 | #define CCSDS_RESERVED 0x00 | |
59 | #define CCSDS_USER_APP 0x00 |
|
59 | #define CCSDS_USER_APP 0x00 | |
60 |
|
60 | |||
61 | #define SIZE_TM_LFR_TC_EXE_NOT_IMPLEMENTED 24 |
|
61 | #define SIZE_TM_LFR_TC_EXE_NOT_IMPLEMENTED 24 | |
62 | #define SIZE_TM_LFR_TC_EXE_CORRUPTED 32 |
|
62 | #define SIZE_TM_LFR_TC_EXE_CORRUPTED 32 | |
63 | #define SIZE_HK_PARAMETERS 112 |
|
63 | #define SIZE_HK_PARAMETERS 112 | |
64 |
|
64 | |||
65 | // TC TYPES |
|
65 | // TC TYPES | |
66 | #define TC_TYPE_GEN 181 |
|
66 | #define TC_TYPE_GEN 181 | |
67 | #define TC_TYPE_TIME 9 |
|
67 | #define TC_TYPE_TIME 9 | |
68 |
|
68 | |||
69 | // TC SUBTYPES |
|
69 | // TC SUBTYPES | |
70 | #define TC_SUBTYPE_RESET 1 |
|
70 | #define TC_SUBTYPE_RESET 1 | |
71 | #define TC_SUBTYPE_LOAD_COMM 11 |
|
71 | #define TC_SUBTYPE_LOAD_COMM 11 | |
72 | #define TC_SUBTYPE_LOAD_NORM 13 |
|
72 | #define TC_SUBTYPE_LOAD_NORM 13 | |
73 | #define TC_SUBTYPE_LOAD_BURST 19 |
|
73 | #define TC_SUBTYPE_LOAD_BURST 19 | |
74 | #define TC_SUBTYPE_LOAD_SBM1 25 |
|
74 | #define TC_SUBTYPE_LOAD_SBM1 25 | |
75 | #define TC_SUBTYPE_LOAD_SBM2 27 |
|
75 | #define TC_SUBTYPE_LOAD_SBM2 27 | |
76 | #define TC_SUBTYPE_DUMP 31 |
|
76 | #define TC_SUBTYPE_DUMP 31 | |
77 | #define TC_SUBTYPE_ENTER 41 |
|
77 | #define TC_SUBTYPE_ENTER 41 | |
78 | #define TC_SUBTYPE_UPDT_INFO 51 |
|
78 | #define TC_SUBTYPE_UPDT_INFO 51 | |
79 | #define TC_SUBTYPE_EN_CAL 61 |
|
79 | #define TC_SUBTYPE_EN_CAL 61 | |
80 | #define TC_SUBTYPE_DIS_CAL 63 |
|
80 | #define TC_SUBTYPE_DIS_CAL 63 | |
81 | #define TC_SUBTYPE_UPDT_TIME 129 |
|
81 | #define TC_SUBTYPE_UPDT_TIME 129 | |
82 |
|
82 | |||
83 | // TC LEN |
|
83 | // TC LEN | |
84 | #define TC_LEN_RESET 12 |
|
84 | #define TC_LEN_RESET 12 | |
85 | #define TC_LEN_LOAD_COMM 14 |
|
85 | #define TC_LEN_LOAD_COMM 14 | |
86 | #define TC_LEN_LOAD_NORM 22 |
|
86 | #define TC_LEN_LOAD_NORM 22 | |
87 | #define TC_LEN_LOAD_BURST 14 |
|
87 | #define TC_LEN_LOAD_BURST 14 | |
88 | #define TC_LEN_LOAD_SBM1 14 |
|
88 | #define TC_LEN_LOAD_SBM1 14 | |
89 | #define TC_LEN_LOAD_SBM2 14 |
|
89 | #define TC_LEN_LOAD_SBM2 14 | |
90 | #define TC_LEN_DUMP 12 |
|
90 | #define TC_LEN_DUMP 12 | |
91 | #define TC_LEN_ENTER 20 |
|
91 | #define TC_LEN_ENTER 20 | |
92 | #define TC_LEN_UPDT_INFO 46 |
|
92 | #define TC_LEN_UPDT_INFO 46 | |
93 | #define TC_LEN_EN_CAL 12 |
|
93 | #define TC_LEN_EN_CAL 12 | |
94 | #define TC_LEN_DIS_CAL 12 |
|
94 | #define TC_LEN_DIS_CAL 12 | |
95 | #define TC_LEN_UPDT_TIME 18 |
|
95 | #define TC_LEN_UPDT_TIME 18 | |
96 |
|
96 | |||
97 | // TM TYPES |
|
97 | // TM TYPES | |
98 | #define TM_TYPE_TC_EXE 1 |
|
98 | #define TM_TYPE_TC_EXE 1 | |
99 | #define TM_TYPE_HK 3 |
|
99 | #define TM_TYPE_HK 3 | |
100 | #define TM_TYPE_PARAMETER_DUMP 3 |
|
100 | #define TM_TYPE_PARAMETER_DUMP 3 | |
101 | #define TM_TYPE_LFR_SCIENCE 21 |
|
101 | #define TM_TYPE_LFR_SCIENCE 21 | |
102 |
|
102 | |||
103 | // TM SUBTYPES |
|
103 | // TM SUBTYPES | |
104 | #define TM_SUBTYPE_EXE_OK 7 |
|
104 | #define TM_SUBTYPE_EXE_OK 7 | |
105 | #define TM_SUBTYPE_EXE_NOK 8 |
|
105 | #define TM_SUBTYPE_EXE_NOK 8 | |
106 | #define TM_SUBTYPE_HK 25 |
|
106 | #define TM_SUBTYPE_HK 25 | |
107 | #define TM_SUBTYPE_PARAMETER_DUMP 25 |
|
107 | #define TM_SUBTYPE_PARAMETER_DUMP 25 | |
108 | #define TM_SUBTYPE_SCIENCE 3 |
|
108 | #define TM_SUBTYPE_SCIENCE 3 | |
109 | #define TM_SUBTYPE_LFR_SCIENCE 3 |
|
109 | #define TM_SUBTYPE_LFR_SCIENCE 3 | |
110 |
|
110 | |||
111 | // FAILURE CODES |
|
111 | // FAILURE CODES | |
112 | #define ILLEGAL_APID 0 |
|
112 | #define ILLEGAL_APID 0 | |
113 | #define WRONG_LEN_PKT 1 |
|
113 | #define WRONG_LEN_PKT 1 | |
114 | #define INCOR_CHECKSUM 2 |
|
114 | #define INCOR_CHECKSUM 2 | |
115 | #define ILL_TYPE 3 |
|
115 | #define ILL_TYPE 3 | |
116 | #define ILL_SUBTYPE 4 |
|
116 | #define ILL_SUBTYPE 4 | |
117 | #define WRONG_APP_DATA 5 // 0x00 0x05 |
|
117 | #define WRONG_APP_DATA 5 // 0x00 0x05 | |
118 | #define TC_NOT_EXE 42000 // 0xa4 0x10 |
|
118 | #define TC_NOT_EXE 42000 // 0xa4 0x10 | |
119 | #define WRONG_SRC_ID 42001 // 0xa4 0x11 |
|
119 | #define WRONG_SRC_ID 42001 // 0xa4 0x11 | |
120 | #define FUNCT_NOT_IMPL 42002 // 0xa4 0x12 |
|
120 | #define FUNCT_NOT_IMPL 42002 // 0xa4 0x12 | |
121 | #define FAIL_DETECTED 42003 // 0xa4 0x13 |
|
121 | #define FAIL_DETECTED 42003 // 0xa4 0x13 | |
122 | #define NOT_ALLOWED 42004 // 0xa4 0x14 |
|
122 | #define NOT_ALLOWED 42004 // 0xa4 0x14 | |
123 | #define CORRUPTED 42005 // 0xa4 0x15 |
|
123 | #define CORRUPTED 42005 // 0xa4 0x15 | |
124 | #define CCSDS_TM_VALID 7 |
|
124 | #define CCSDS_TM_VALID 7 | |
125 |
|
125 | |||
126 | // TC SID |
|
126 | // TC SID | |
127 | #define SID_TC_GROUND 0 |
|
127 | #define SID_TC_GROUND 0 | |
128 | #define SID_TC_MISSION_TIMELINE 110 |
|
128 | #define SID_TC_MISSION_TIMELINE 110 | |
129 | #define SID_TC_TC_SEQUENCES 111 |
|
129 | #define SID_TC_TC_SEQUENCES 111 | |
130 | #define SID_TC_RECOVERY_ACTION_CMD 112 |
|
130 | #define SID_TC_RECOVERY_ACTION_CMD 112 | |
131 | #define SID_TC_BACKUP_MISSION_TIMELINE 113 |
|
131 | #define SID_TC_BACKUP_MISSION_TIMELINE 113 | |
132 | #define SID_TC_DIRECT_CMD 120 |
|
132 | #define SID_TC_DIRECT_CMD 120 | |
133 | #define SID_TC_SPARE_GRD_SRC1 121 |
|
133 | #define SID_TC_SPARE_GRD_SRC1 121 | |
134 | #define SID_TC_SPARE_GRD_SRC2 122 |
|
134 | #define SID_TC_SPARE_GRD_SRC2 122 | |
135 | #define SID_TC_OBCP 15 |
|
135 | #define SID_TC_OBCP 15 | |
136 | #define SID_TC_SYSTEM_CONTROL 14 |
|
136 | #define SID_TC_SYSTEM_CONTROL 14 | |
137 | #define SID_TC_AOCS 11 |
|
137 | #define SID_TC_AOCS 11 | |
138 | #define SID_TC_RPW_INTERNAL 254 |
|
138 | #define SID_TC_RPW_INTERNAL 254 | |
139 |
|
139 | |||
140 | enum apid_destid{ |
|
140 | enum apid_destid{ | |
141 | GROUND, |
|
141 | GROUND, | |
142 | MISSION_TIMELINE, |
|
142 | MISSION_TIMELINE, | |
143 | TC_SEQUENCES, |
|
143 | TC_SEQUENCES, | |
144 | RECOVERY_ACTION_CMD, |
|
144 | RECOVERY_ACTION_CMD, | |
145 | BACKUP_MISSION_TIMELINE, |
|
145 | BACKUP_MISSION_TIMELINE, | |
146 | DIRECT_CMD, |
|
146 | DIRECT_CMD, | |
147 | SPARE_GRD_SRC1, |
|
147 | SPARE_GRD_SRC1, | |
148 | SPARE_GRD_SRC2, |
|
148 | SPARE_GRD_SRC2, | |
149 | OBCP, |
|
149 | OBCP, | |
150 | SYSTEM_CONTROL, |
|
150 | SYSTEM_CONTROL, | |
151 | AOCS, |
|
151 | AOCS, | |
152 | RPW_INTERNAL |
|
152 | RPW_INTERNAL | |
153 | }; |
|
153 | }; | |
154 | // SEQUENCE COUNTERS |
|
154 | // SEQUENCE COUNTERS | |
155 | #define SEQ_CNT_MAX 16383 |
|
155 | #define SEQ_CNT_MAX 16383 | |
156 | #define SEQ_CNT_NB_DEST_ID 12 |
|
156 | #define SEQ_CNT_NB_DEST_ID 12 | |
157 |
|
157 | |||
158 | // TM SID |
|
158 | // TM SID | |
159 | #define SID_HK 1 |
|
159 | #define SID_HK 1 | |
160 | #define SID_PARAMETER_DUMP 10 |
|
160 | #define SID_PARAMETER_DUMP 10 | |
161 |
|
161 | |||
162 | #define SID_NORM_SWF_F0 3 |
|
162 | #define SID_NORM_SWF_F0 3 | |
163 | #define SID_NORM_SWF_F1 4 |
|
163 | #define SID_NORM_SWF_F1 4 | |
164 | #define SID_NORM_SWF_F2 5 |
|
164 | #define SID_NORM_SWF_F2 5 | |
165 | #define SID_NORM_CWF_F3 1 |
|
165 | #define SID_NORM_CWF_F3 1 | |
166 | #define SID_BURST_CWF_F2 2 |
|
166 | #define SID_BURST_CWF_F2 2 | |
167 | #define SID_SBM1_CWF_F1 24 |
|
167 | #define SID_SBM1_CWF_F1 24 | |
168 | #define SID_SBM2_CWF_F2 25 |
|
168 | #define SID_SBM2_CWF_F2 25 | |
169 | #define SID_NORM_ASM_F0 11 |
|
169 | #define SID_NORM_ASM_F0 11 | |
170 | #define SID_NORM_ASM_F1 12 |
|
170 | #define SID_NORM_ASM_F1 12 | |
171 | #define SID_NORM_ASM_F2 13 |
|
171 | #define SID_NORM_ASM_F2 13 | |
172 | #define SID_NORM_BP1_F0 14 |
|
172 | #define SID_NORM_BP1_F0 14 | |
173 | #define SID_NORM_BP1_F1 15 |
|
173 | #define SID_NORM_BP1_F1 15 | |
174 | #define SID_NORM_BP1_F2 16 |
|
174 | #define SID_NORM_BP1_F2 16 | |
175 | #define SID_NORM_BP2_F0 19 |
|
175 | #define SID_NORM_BP2_F0 19 | |
176 | #define SID_NORM_BP2_F1 20 |
|
176 | #define SID_NORM_BP2_F1 20 | |
177 | #define SID_NORM_BP2_F2 21 |
|
177 | #define SID_NORM_BP2_F2 21 | |
178 | #define SID_BURST_BP1_F0 17 |
|
178 | #define SID_BURST_BP1_F0 17 | |
179 | #define SID_BURST_BP2_F0 22 |
|
179 | #define SID_BURST_BP2_F0 22 | |
180 | #define SID_BURST_BP1_F1 18 |
|
180 | #define SID_BURST_BP1_F1 18 | |
181 | #define SID_BURST_BP2_F1 23 |
|
181 | #define SID_BURST_BP2_F1 23 | |
182 | #define SID_SBM1_BP1_F0 28 |
|
182 | #define SID_SBM1_BP1_F0 28 | |
183 | #define SID_SBM1_BP2_F0 31 |
|
183 | #define SID_SBM1_BP2_F0 31 | |
184 | #define SID_SBM2_BP1_F0 29 |
|
184 | #define SID_SBM2_BP1_F0 29 | |
185 | #define SID_SBM2_BP2_F0 32 |
|
185 | #define SID_SBM2_BP2_F0 32 | |
186 | #define SID_SBM2_BP1_F1 30 |
|
186 | #define SID_SBM2_BP1_F1 30 | |
187 | #define SID_SBM2_BP2_F1 33 |
|
187 | #define SID_SBM2_BP2_F1 33 | |
188 | #define SID_NORM_CWF_LONG_F3 34 |
|
188 | #define SID_NORM_CWF_LONG_F3 34 | |
189 |
|
189 | |||
190 | // LENGTH (BYTES) |
|
190 | // LENGTH (BYTES) | |
191 | #define LENGTH_TM_LFR_TC_EXE_MAX 32 |
|
191 | #define LENGTH_TM_LFR_TC_EXE_MAX 32 | |
192 | #define LENGTH_TM_LFR_HK 126 |
|
192 | #define LENGTH_TM_LFR_HK 126 | |
193 |
|
193 | |||
194 | // HEADER_LENGTH |
|
194 | // HEADER_LENGTH | |
195 | #define TM_HEADER_LEN 16 |
|
195 | #define TM_HEADER_LEN 16 | |
196 | #define HEADER_LENGTH_TM_LFR_SCIENCE_ASM 28 |
|
196 | #define HEADER_LENGTH_TM_LFR_SCIENCE_ASM 28 | |
197 | // PACKET_LENGTH |
|
197 | // PACKET_LENGTH | |
198 | #define PACKET_LENGTH_TC_EXE_SUCCESS (20 - CCSDS_TC_TM_PACKET_OFFSET) |
|
198 | #define PACKET_LENGTH_TC_EXE_SUCCESS (20 - CCSDS_TC_TM_PACKET_OFFSET) | |
199 | #define PACKET_LENGTH_TC_EXE_INCONSISTENT (26 - CCSDS_TC_TM_PACKET_OFFSET) |
|
199 | #define PACKET_LENGTH_TC_EXE_INCONSISTENT (26 - CCSDS_TC_TM_PACKET_OFFSET) | |
200 | #define PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE (26 - CCSDS_TC_TM_PACKET_OFFSET) |
|
200 | #define PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE (26 - CCSDS_TC_TM_PACKET_OFFSET) | |
201 | #define PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED (24 - CCSDS_TC_TM_PACKET_OFFSET) |
|
201 | #define PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED (24 - CCSDS_TC_TM_PACKET_OFFSET) | |
202 | #define PACKET_LENGTH_TC_EXE_ERROR (24 - CCSDS_TC_TM_PACKET_OFFSET) |
|
202 | #define PACKET_LENGTH_TC_EXE_ERROR (24 - CCSDS_TC_TM_PACKET_OFFSET) | |
203 | #define PACKET_LENGTH_TC_EXE_CORRUPTED (32 - CCSDS_TC_TM_PACKET_OFFSET) |
|
203 | #define PACKET_LENGTH_TC_EXE_CORRUPTED (32 - CCSDS_TC_TM_PACKET_OFFSET) | |
204 | #define PACKET_LENGTH_HK (124 - CCSDS_TC_TM_PACKET_OFFSET) |
|
204 | #define PACKET_LENGTH_HK (124 - CCSDS_TC_TM_PACKET_OFFSET) | |
205 | #define PACKET_LENGTH_PARAMETER_DUMP (36 - CCSDS_TC_TM_PACKET_OFFSET) |
|
205 | #define PACKET_LENGTH_PARAMETER_DUMP (36 - CCSDS_TC_TM_PACKET_OFFSET) | |
206 | #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0 (2228 - CCSDS_TC_TM_PACKET_OFFSET) // 44 * 25 * 2 + 28 |
|
206 | #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0 (2228 - CCSDS_TC_TM_PACKET_OFFSET) // 44 * 25 * 2 + 28 | |
207 | #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F1 (2628 - CCSDS_TC_TM_PACKET_OFFSET) // 52 * 25 * 2 + 28 |
|
207 | #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F1 (2628 - CCSDS_TC_TM_PACKET_OFFSET) // 52 * 25 * 2 + 28 | |
208 | #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F2 (2428 - CCSDS_TC_TM_PACKET_OFFSET) // 48 * 25 * 2 + 28 |
|
208 | #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F2 (2428 - CCSDS_TC_TM_PACKET_OFFSET) // 48 * 25 * 2 + 28 | |
209 | #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 (126 - CCSDS_TC_TM_PACKET_OFFSET) // 11 * 9 + 27 |
|
209 | #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 (126 - CCSDS_TC_TM_PACKET_OFFSET) // 11 * 9 + 27 | |
210 | #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0 (356 - CCSDS_TC_TM_PACKET_OFFSET) // 11 * 30 + 26 |
|
210 | #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0 (356 - CCSDS_TC_TM_PACKET_OFFSET) // 11 * 30 + 26 | |
211 | #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F1 (144 - CCSDS_TC_TM_PACKET_OFFSET) // 13 * 9 + 27 |
|
211 | #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F1 (144 - CCSDS_TC_TM_PACKET_OFFSET) // 13 * 9 + 27 | |
212 | #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F1 (416 - CCSDS_TC_TM_PACKET_OFFSET) // 13 * 30 + 26 |
|
212 | #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F1 (416 - CCSDS_TC_TM_PACKET_OFFSET) // 13 * 30 + 26 | |
213 | #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F2 (134 - CCSDS_TC_TM_PACKET_OFFSET) // 12 * 9 + 26 |
|
213 | #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F2 (134 - CCSDS_TC_TM_PACKET_OFFSET) // 12 * 9 + 26 | |
214 | #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F2 (386 - CCSDS_TC_TM_PACKET_OFFSET) // 12 * 30 + 26 |
|
214 | #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F2 (386 - CCSDS_TC_TM_PACKET_OFFSET) // 12 * 30 + 26 | |
215 | #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0 (224 - CCSDS_TC_TM_PACKET_OFFSET) // 22 * 9 + 26 |
|
215 | #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0 (224 - CCSDS_TC_TM_PACKET_OFFSET) // 22 * 9 + 26 | |
216 | #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0 (686 - CCSDS_TC_TM_PACKET_OFFSET) // 22 * 30 + 26 |
|
216 | #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0 (686 - CCSDS_TC_TM_PACKET_OFFSET) // 22 * 30 + 26 | |
217 | #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F1 (260 - CCSDS_TC_TM_PACKET_OFFSET) // 26 * 9 + 26 |
|
217 | #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F1 (260 - CCSDS_TC_TM_PACKET_OFFSET) // 26 * 9 + 26 | |
218 | #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F1 (806 - CCSDS_TC_TM_PACKET_OFFSET) // 26 * 30 + 26 |
|
218 | #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F1 (806 - CCSDS_TC_TM_PACKET_OFFSET) // 26 * 30 + 26 | |
219 |
|
219 | |||
220 | #define PACKET_LENGTH_DELTA 11 // 7 + 4 |
|
220 | #define PACKET_LENGTH_DELTA 11 // 7 + 4 | |
221 |
|
221 | |||
222 | #define SPARE1_PUSVERSION_SPARE2 0x10 |
|
222 | #define SPARE1_PUSVERSION_SPARE2 0x10 | |
223 |
|
223 | |||
224 | // R1 |
|
224 | // R1 | |
225 | #define TM_LEN_SCI_SWF_340 4101 // 340 * 12 + 10 + 12 - 1 |
|
225 | #define TM_LEN_SCI_SWF_340 4101 // 340 * 12 + 10 + 12 - 1 | |
226 | #define TM_LEN_SCI_SWF_8 117 // 8 * 12 + 10 + 12 - 1 |
|
226 | #define TM_LEN_SCI_SWF_8 117 // 8 * 12 + 10 + 12 - 1 | |
227 | #define TM_LEN_SCI_CWF_340 4099 // 340 * 12 + 10 + 10 - 1 |
|
227 | #define TM_LEN_SCI_CWF_340 4099 // 340 * 12 + 10 + 10 - 1 | |
228 | #define TM_LEN_SCI_CWF_8 115 // 8 * 12 + 10 + 10 - 1 |
|
228 | #define TM_LEN_SCI_CWF_8 115 // 8 * 12 + 10 + 10 - 1 | |
229 | #define TM_LEN_SCI_CWF3_LIGHT_340 2059 // 340 * 6 + 10 + 10 - 1 |
|
229 | #define TM_LEN_SCI_CWF3_LIGHT_340 2059 // 340 * 6 + 10 + 10 - 1 | |
230 | #define TM_LEN_SCI_CWF3_LIGHT_8 67 // 8 * 6 + 10 + 10 - 1 |
|
230 | #define TM_LEN_SCI_CWF3_LIGHT_8 67 // 8 * 6 + 10 + 10 - 1 | |
231 | // R2 |
|
231 | // R2 | |
232 | #define TM_LEN_SCI_SWF_304 3669 // 304 * 12 + 10 + 12 - 1 |
|
232 | #define TM_LEN_SCI_SWF_304 3669 // 304 * 12 + 10 + 12 - 1 | |
233 | #define TM_LEN_SCI_SWF_224 2709 // 224 * 12 + 10 + 12 - 1 |
|
233 | #define TM_LEN_SCI_SWF_224 2709 // 224 * 12 + 10 + 12 - 1 | |
234 | #define TM_LEN_SCI_CWF_336 4051 // 336 * 12 + 10 + 10 - 1 |
|
234 | #define TM_LEN_SCI_CWF_336 4051 // 336 * 12 + 10 + 10 - 1 | |
235 | #define TM_LEN_SCI_CWF_672 4051 // 672 * 6 + 10 + 10 - 1 |
|
235 | #define TM_LEN_SCI_CWF_672 4051 // 672 * 6 + 10 + 10 - 1 | |
236 | // |
|
236 | // | |
237 | #define DEFAULT_PKTCNT 0x07 |
|
237 | #define DEFAULT_PKTCNT 0x07 | |
238 | #define BLK_NR_304 0x0130 |
|
238 | #define BLK_NR_304 0x0130 | |
239 | #define BLK_NR_224 0x00e0 |
|
239 | #define BLK_NR_224 0x00e0 | |
240 | #define BLK_NR_CWF 0x0150 // 336 |
|
240 | #define BLK_NR_CWF 0x0150 // 336 | |
241 | #define BLK_NR_CWF_SHORT_F3 0x02a0 // 672 |
|
241 | #define BLK_NR_CWF_SHORT_F3 0x02a0 // 672 | |
242 |
|
242 | |||
243 | enum TM_TYPE{ |
|
243 | enum TM_TYPE{ | |
244 | TM_LFR_TC_EXE_OK, |
|
244 | TM_LFR_TC_EXE_OK, | |
245 | TM_LFR_TC_EXE_ERR, |
|
245 | TM_LFR_TC_EXE_ERR, | |
246 | TM_LFR_HK, |
|
246 | TM_LFR_HK, | |
247 | TM_LFR_SCI, |
|
247 | TM_LFR_SCI, | |
248 | TM_LFR_SCI_SBM, |
|
248 | TM_LFR_SCI_SBM, | |
249 | TM_LFR_PAR_DUMP |
|
249 | TM_LFR_PAR_DUMP | |
250 | }; |
|
250 | }; | |
251 |
|
251 | |||
252 | typedef struct { |
|
252 | typedef struct { | |
253 | unsigned char targetLogicalAddress; |
|
253 | unsigned char targetLogicalAddress; | |
254 | unsigned char protocolIdentifier; |
|
254 | unsigned char protocolIdentifier; | |
255 | unsigned char reserved; |
|
255 | unsigned char reserved; | |
256 | unsigned char userApplication; |
|
256 | unsigned char userApplication; | |
257 | // PACKET HEADER |
|
257 | // PACKET HEADER | |
258 | unsigned char packetID[2]; |
|
258 | unsigned char packetID[2]; | |
259 | unsigned char packetSequenceControl[2]; |
|
259 | unsigned char packetSequenceControl[2]; | |
260 | unsigned char packetLength[2]; |
|
260 | unsigned char packetLength[2]; | |
261 | // DATA FIELD HEADER |
|
261 | // DATA FIELD HEADER | |
262 | unsigned char spare1_pusVersion_spare2; |
|
262 | unsigned char spare1_pusVersion_spare2; | |
263 | unsigned char serviceType; |
|
263 | unsigned char serviceType; | |
264 | unsigned char serviceSubType; |
|
264 | unsigned char serviceSubType; | |
265 | unsigned char destinationID; |
|
265 | unsigned char destinationID; | |
266 | unsigned char time[6]; |
|
266 | unsigned char time[6]; | |
267 | // |
|
267 | // | |
268 | unsigned char telecommand_pkt_id[2]; |
|
268 | unsigned char telecommand_pkt_id[2]; | |
269 | unsigned char pkt_seq_control[2]; |
|
269 | unsigned char pkt_seq_control[2]; | |
270 | } Packet_TM_LFR_TC_EXE_SUCCESS_t; |
|
270 | } Packet_TM_LFR_TC_EXE_SUCCESS_t; | |
271 |
|
271 | |||
272 | typedef struct { |
|
272 | typedef struct { | |
273 | unsigned char targetLogicalAddress; |
|
273 | unsigned char targetLogicalAddress; | |
274 | unsigned char protocolIdentifier; |
|
274 | unsigned char protocolIdentifier; | |
275 | unsigned char reserved; |
|
275 | unsigned char reserved; | |
276 | unsigned char userApplication; |
|
276 | unsigned char userApplication; | |
277 | // PACKET HEADER |
|
277 | // PACKET HEADER | |
278 | unsigned char packetID[2]; |
|
278 | unsigned char packetID[2]; | |
279 | unsigned char packetSequenceControl[2]; |
|
279 | unsigned char packetSequenceControl[2]; | |
280 | unsigned char packetLength[2]; |
|
280 | unsigned char packetLength[2]; | |
281 | // DATA FIELD HEADER |
|
281 | // DATA FIELD HEADER | |
282 | unsigned char spare1_pusVersion_spare2; |
|
282 | unsigned char spare1_pusVersion_spare2; | |
283 | unsigned char serviceType; |
|
283 | unsigned char serviceType; | |
284 | unsigned char serviceSubType; |
|
284 | unsigned char serviceSubType; | |
285 | unsigned char destinationID; |
|
285 | unsigned char destinationID; | |
286 | unsigned char time[6]; |
|
286 | unsigned char time[6]; | |
287 | // |
|
287 | // | |
288 | unsigned char tc_failure_code[2]; |
|
288 | unsigned char tc_failure_code[2]; | |
289 | unsigned char telecommand_pkt_id[2]; |
|
289 | unsigned char telecommand_pkt_id[2]; | |
290 | unsigned char pkt_seq_control[2]; |
|
290 | unsigned char pkt_seq_control[2]; | |
291 | unsigned char tc_service; |
|
291 | unsigned char tc_service; | |
292 | unsigned char tc_subtype; |
|
292 | unsigned char tc_subtype; | |
293 | unsigned char byte_position; |
|
293 | unsigned char byte_position; | |
294 | unsigned char rcv_value; |
|
294 | unsigned char rcv_value; | |
295 | } Packet_TM_LFR_TC_EXE_INCONSISTENT_t; |
|
295 | } Packet_TM_LFR_TC_EXE_INCONSISTENT_t; | |
296 |
|
296 | |||
297 | typedef struct { |
|
297 | typedef struct { | |
298 | unsigned char targetLogicalAddress; |
|
298 | unsigned char targetLogicalAddress; | |
299 | unsigned char protocolIdentifier; |
|
299 | unsigned char protocolIdentifier; | |
300 | unsigned char reserved; |
|
300 | unsigned char reserved; | |
301 | unsigned char userApplication; |
|
301 | unsigned char userApplication; | |
302 | // PACKET HEADER |
|
302 | // PACKET HEADER | |
303 | unsigned char packetID[2]; |
|
303 | unsigned char packetID[2]; | |
304 | unsigned char packetSequenceControl[2]; |
|
304 | unsigned char packetSequenceControl[2]; | |
305 | unsigned char packetLength[2]; |
|
305 | unsigned char packetLength[2]; | |
306 | // DATA FIELD HEADER |
|
306 | // DATA FIELD HEADER | |
307 | unsigned char spare1_pusVersion_spare2; |
|
307 | unsigned char spare1_pusVersion_spare2; | |
308 | unsigned char serviceType; |
|
308 | unsigned char serviceType; | |
309 | unsigned char serviceSubType; |
|
309 | unsigned char serviceSubType; | |
310 | unsigned char destinationID; |
|
310 | unsigned char destinationID; | |
311 | unsigned char time[6]; |
|
311 | unsigned char time[6]; | |
312 | // |
|
312 | // | |
313 | unsigned char tc_failure_code[2]; |
|
313 | unsigned char tc_failure_code[2]; | |
314 | unsigned char telecommand_pkt_id[2]; |
|
314 | unsigned char telecommand_pkt_id[2]; | |
315 | unsigned char pkt_seq_control[2]; |
|
315 | unsigned char pkt_seq_control[2]; | |
316 | unsigned char tc_service; |
|
316 | unsigned char tc_service; | |
317 | unsigned char tc_subtype; |
|
317 | unsigned char tc_subtype; | |
318 | unsigned char lfr_status_word[2]; |
|
318 | unsigned char lfr_status_word[2]; | |
319 | } Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t; |
|
319 | } Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t; | |
320 |
|
320 | |||
321 | typedef struct { |
|
321 | typedef struct { | |
322 | unsigned char targetLogicalAddress; |
|
322 | unsigned char targetLogicalAddress; | |
323 | unsigned char protocolIdentifier; |
|
323 | unsigned char protocolIdentifier; | |
324 | unsigned char reserved; |
|
324 | unsigned char reserved; | |
325 | unsigned char userApplication; |
|
325 | unsigned char userApplication; | |
326 | // PACKET HEADER |
|
326 | // PACKET HEADER | |
327 | unsigned char packetID[2]; |
|
327 | unsigned char packetID[2]; | |
328 | unsigned char packetSequenceControl[2]; |
|
328 | unsigned char packetSequenceControl[2]; | |
329 | unsigned char packetLength[2]; |
|
329 | unsigned char packetLength[2]; | |
330 | // DATA FIELD HEADER |
|
330 | // DATA FIELD HEADER | |
331 | unsigned char spare1_pusVersion_spare2; |
|
331 | unsigned char spare1_pusVersion_spare2; | |
332 | unsigned char serviceType; |
|
332 | unsigned char serviceType; | |
333 | unsigned char serviceSubType; |
|
333 | unsigned char serviceSubType; | |
334 | unsigned char destinationID; |
|
334 | unsigned char destinationID; | |
335 | unsigned char time[6]; |
|
335 | unsigned char time[6]; | |
336 | // |
|
336 | // | |
337 | unsigned char tc_failure_code[2]; |
|
337 | unsigned char tc_failure_code[2]; | |
338 | unsigned char telecommand_pkt_id[2]; |
|
338 | unsigned char telecommand_pkt_id[2]; | |
339 | unsigned char pkt_seq_control[2]; |
|
339 | unsigned char pkt_seq_control[2]; | |
340 | unsigned char tc_service; |
|
340 | unsigned char tc_service; | |
341 | unsigned char tc_subtype; |
|
341 | unsigned char tc_subtype; | |
342 | } Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t; |
|
342 | } Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t; | |
343 |
|
343 | |||
344 | typedef struct { |
|
344 | typedef struct { | |
345 | unsigned char targetLogicalAddress; |
|
345 | unsigned char targetLogicalAddress; | |
346 | unsigned char protocolIdentifier; |
|
346 | unsigned char protocolIdentifier; | |
347 | unsigned char reserved; |
|
347 | unsigned char reserved; | |
348 | unsigned char userApplication; |
|
348 | unsigned char userApplication; | |
349 | // PACKET HEADER |
|
349 | // PACKET HEADER | |
350 | unsigned char packetID[2]; |
|
350 | unsigned char packetID[2]; | |
351 | unsigned char packetSequenceControl[2]; |
|
351 | unsigned char packetSequenceControl[2]; | |
352 | unsigned char packetLength[2]; |
|
352 | unsigned char packetLength[2]; | |
353 | // DATA FIELD HEADER |
|
353 | // DATA FIELD HEADER | |
354 | unsigned char spare1_pusVersion_spare2; |
|
354 | unsigned char spare1_pusVersion_spare2; | |
355 | unsigned char serviceType; |
|
355 | unsigned char serviceType; | |
356 | unsigned char serviceSubType; |
|
356 | unsigned char serviceSubType; | |
357 | unsigned char destinationID; |
|
357 | unsigned char destinationID; | |
358 | unsigned char time[6]; |
|
358 | unsigned char time[6]; | |
359 | // |
|
359 | // | |
360 | unsigned char tc_failure_code[2]; |
|
360 | unsigned char tc_failure_code[2]; | |
361 | unsigned char telecommand_pkt_id[2]; |
|
361 | unsigned char telecommand_pkt_id[2]; | |
362 | unsigned char pkt_seq_control[2]; |
|
362 | unsigned char pkt_seq_control[2]; | |
363 | unsigned char tc_service; |
|
363 | unsigned char tc_service; | |
364 | unsigned char tc_subtype; |
|
364 | unsigned char tc_subtype; | |
365 | } Packet_TM_LFR_TC_EXE_ERROR_t; |
|
365 | } Packet_TM_LFR_TC_EXE_ERROR_t; | |
366 |
|
366 | |||
367 | typedef struct { |
|
367 | typedef struct { | |
368 | unsigned char targetLogicalAddress; |
|
368 | unsigned char targetLogicalAddress; | |
369 | unsigned char protocolIdentifier; |
|
369 | unsigned char protocolIdentifier; | |
370 | unsigned char reserved; |
|
370 | unsigned char reserved; | |
371 | unsigned char userApplication; |
|
371 | unsigned char userApplication; | |
372 | // PACKET HEADER |
|
372 | // PACKET HEADER | |
373 | unsigned char packetID[2]; |
|
373 | unsigned char packetID[2]; | |
374 | unsigned char packetSequenceControl[2]; |
|
374 | unsigned char packetSequenceControl[2]; | |
375 | unsigned char packetLength[2]; |
|
375 | unsigned char packetLength[2]; | |
376 | // DATA FIELD HEADER |
|
376 | // DATA FIELD HEADER | |
377 | unsigned char spare1_pusVersion_spare2; |
|
377 | unsigned char spare1_pusVersion_spare2; | |
378 | unsigned char serviceType; |
|
378 | unsigned char serviceType; | |
379 | unsigned char serviceSubType; |
|
379 | unsigned char serviceSubType; | |
380 | unsigned char destinationID; |
|
380 | unsigned char destinationID; | |
381 | unsigned char time[6]; |
|
381 | unsigned char time[6]; | |
382 | // |
|
382 | // | |
383 | unsigned char tc_failure_code[2]; |
|
383 | unsigned char tc_failure_code[2]; | |
384 | unsigned char telecommand_pkt_id[2]; |
|
384 | unsigned char telecommand_pkt_id[2]; | |
385 | unsigned char pkt_seq_control[2]; |
|
385 | unsigned char pkt_seq_control[2]; | |
386 | unsigned char tc_service; |
|
386 | unsigned char tc_service; | |
387 | unsigned char tc_subtype; |
|
387 | unsigned char tc_subtype; | |
388 | unsigned char pkt_len_rcv_value[2]; |
|
388 | unsigned char pkt_len_rcv_value[2]; | |
389 | unsigned char pkt_datafieldsize_cnt[2]; |
|
389 | unsigned char pkt_datafieldsize_cnt[2]; | |
390 | unsigned char rcv_crc[2]; |
|
390 | unsigned char rcv_crc[2]; | |
391 | unsigned char computed_crc[2]; |
|
391 | unsigned char computed_crc[2]; | |
392 | } Packet_TM_LFR_TC_EXE_CORRUPTED_t; |
|
392 | } Packet_TM_LFR_TC_EXE_CORRUPTED_t; | |
393 |
|
393 | |||
394 | typedef struct { |
|
394 | typedef struct { | |
395 | unsigned char targetLogicalAddress; |
|
395 | unsigned char targetLogicalAddress; | |
396 | unsigned char protocolIdentifier; |
|
396 | unsigned char protocolIdentifier; | |
397 | unsigned char reserved; |
|
397 | unsigned char reserved; | |
398 | unsigned char userApplication; |
|
398 | unsigned char userApplication; | |
399 | unsigned char packetID[2]; |
|
399 | unsigned char packetID[2]; | |
400 | unsigned char packetSequenceControl[2]; |
|
400 | unsigned char packetSequenceControl[2]; | |
401 | unsigned char packetLength[2]; |
|
401 | unsigned char packetLength[2]; | |
402 | // DATA FIELD HEADER |
|
402 | // DATA FIELD HEADER | |
403 | unsigned char spare1_pusVersion_spare2; |
|
403 | unsigned char spare1_pusVersion_spare2; | |
404 | unsigned char serviceType; |
|
404 | unsigned char serviceType; | |
405 | unsigned char serviceSubType; |
|
405 | unsigned char serviceSubType; | |
406 | unsigned char destinationID; |
|
406 | unsigned char destinationID; | |
407 | unsigned char time[6]; |
|
407 | unsigned char time[6]; | |
408 | // AUXILIARY HEADER |
|
408 | // AUXILIARY HEADER | |
409 | unsigned char sid; |
|
409 | unsigned char sid; | |
410 | unsigned char hkBIA; |
|
410 | unsigned char hkBIA; | |
411 | unsigned char pktCnt; |
|
411 | unsigned char pktCnt; | |
412 | unsigned char pktNr; |
|
412 | unsigned char pktNr; | |
413 | unsigned char acquisitionTime[6]; |
|
413 | unsigned char acquisitionTime[6]; | |
414 | unsigned char blkNr[2]; |
|
414 | unsigned char blkNr[2]; | |
415 | } Header_TM_LFR_SCIENCE_SWF_t; |
|
415 | } Header_TM_LFR_SCIENCE_SWF_t; | |
416 |
|
416 | |||
417 | typedef struct { |
|
417 | typedef struct { | |
418 | unsigned char targetLogicalAddress; |
|
418 | unsigned char targetLogicalAddress; | |
419 | unsigned char protocolIdentifier; |
|
419 | unsigned char protocolIdentifier; | |
420 | unsigned char reserved; |
|
420 | unsigned char reserved; | |
421 | unsigned char userApplication; |
|
421 | unsigned char userApplication; | |
422 | unsigned char packetID[2]; |
|
422 | unsigned char packetID[2]; | |
423 | unsigned char packetSequenceControl[2]; |
|
423 | unsigned char packetSequenceControl[2]; | |
424 | unsigned char packetLength[2]; |
|
424 | unsigned char packetLength[2]; | |
425 | // DATA FIELD HEADER |
|
425 | // DATA FIELD HEADER | |
426 | unsigned char spare1_pusVersion_spare2; |
|
426 | unsigned char spare1_pusVersion_spare2; | |
427 | unsigned char serviceType; |
|
427 | unsigned char serviceType; | |
428 | unsigned char serviceSubType; |
|
428 | unsigned char serviceSubType; | |
429 | unsigned char destinationID; |
|
429 | unsigned char destinationID; | |
430 | unsigned char time[6]; |
|
430 | unsigned char time[6]; | |
431 | // AUXILIARY DATA HEADER |
|
431 | // AUXILIARY DATA HEADER | |
432 | unsigned char sid; |
|
432 | unsigned char sid; | |
433 | unsigned char hkBIA; |
|
433 | unsigned char hkBIA; | |
434 | unsigned char acquisitionTime[6]; |
|
434 | unsigned char acquisitionTime[6]; | |
435 | unsigned char blkNr[2]; |
|
435 | unsigned char blkNr[2]; | |
436 | } Header_TM_LFR_SCIENCE_CWF_t; |
|
436 | } Header_TM_LFR_SCIENCE_CWF_t; | |
437 |
|
437 | |||
438 | typedef struct { |
|
438 | typedef struct { | |
439 | unsigned char targetLogicalAddress; |
|
439 | unsigned char targetLogicalAddress; | |
440 | unsigned char protocolIdentifier; |
|
440 | unsigned char protocolIdentifier; | |
441 | unsigned char reserved; |
|
441 | unsigned char reserved; | |
442 | unsigned char userApplication; |
|
442 | unsigned char userApplication; | |
443 | unsigned char packetID[2]; |
|
443 | unsigned char packetID[2]; | |
444 | unsigned char packetSequenceControl[2]; |
|
444 | unsigned char packetSequenceControl[2]; | |
445 | unsigned char packetLength[2]; |
|
445 | unsigned char packetLength[2]; | |
446 | // DATA FIELD HEADER |
|
446 | // DATA FIELD HEADER | |
447 | unsigned char spare1_pusVersion_spare2; |
|
447 | unsigned char spare1_pusVersion_spare2; | |
448 | unsigned char serviceType; |
|
448 | unsigned char serviceType; | |
449 | unsigned char serviceSubType; |
|
449 | unsigned char serviceSubType; | |
450 | unsigned char destinationID; |
|
450 | unsigned char destinationID; | |
451 | unsigned char time[6]; |
|
451 | unsigned char time[6]; | |
452 | // AUXILIARY HEADER |
|
452 | // AUXILIARY HEADER | |
453 | unsigned char sid; |
|
453 | unsigned char sid; | |
454 | unsigned char biaStatusInfo; |
|
454 | unsigned char biaStatusInfo; | |
455 | unsigned char pa_lfr_pkt_cnt_asm; |
|
455 | unsigned char pa_lfr_pkt_cnt_asm; | |
456 | unsigned char pa_lfr_pkt_nr_asm; |
|
456 | unsigned char pa_lfr_pkt_nr_asm; | |
457 | unsigned char acquisitionTime[6]; |
|
457 | unsigned char acquisitionTime[6]; | |
458 | unsigned char pa_lfr_asm_blk_nr[2]; |
|
458 | unsigned char pa_lfr_asm_blk_nr[2]; | |
459 | } Header_TM_LFR_SCIENCE_ASM_t; |
|
459 | } Header_TM_LFR_SCIENCE_ASM_t; | |
460 |
|
460 | |||
461 | typedef struct { |
|
461 | typedef struct { | |
462 | unsigned char targetLogicalAddress; |
|
462 | unsigned char targetLogicalAddress; | |
463 | unsigned char protocolIdentifier; |
|
463 | unsigned char protocolIdentifier; | |
464 | unsigned char reserved; |
|
464 | unsigned char reserved; | |
465 | unsigned char userApplication; |
|
465 | unsigned char userApplication; | |
466 | unsigned char packetID[2]; |
|
466 | unsigned char packetID[2]; | |
467 | unsigned char packetSequenceControl[2]; |
|
467 | unsigned char packetSequenceControl[2]; | |
468 | unsigned char packetLength[2]; |
|
468 | unsigned char packetLength[2]; | |
469 | // DATA FIELD HEADER |
|
469 | // DATA FIELD HEADER | |
470 | unsigned char spare1_pusVersion_spare2; |
|
470 | unsigned char spare1_pusVersion_spare2; | |
471 | unsigned char serviceType; |
|
471 | unsigned char serviceType; | |
472 | unsigned char serviceSubType; |
|
472 | unsigned char serviceSubType; | |
473 | unsigned char destinationID; |
|
473 | unsigned char destinationID; | |
474 | unsigned char time[6]; |
|
474 | unsigned char time[6]; | |
475 | // AUXILIARY HEADER |
|
475 | // AUXILIARY HEADER | |
476 | unsigned char sid; |
|
476 | unsigned char sid; | |
477 | unsigned char biaStatusInfo; |
|
477 | unsigned char biaStatusInfo; | |
478 | unsigned char acquisitionTime[6]; |
|
478 | unsigned char acquisitionTime[6]; | |
479 |
unsigned char source_data_spare |
|
479 | unsigned char source_data_spare; | |
480 | unsigned char pa_lfr_bp_blk_nr[2]; |
|
480 | unsigned char pa_lfr_bp_blk_nr[2]; | |
481 | } Header_TM_LFR_SCIENCE_BP_with_spare_t; |
|
481 | } Header_TM_LFR_SCIENCE_BP_with_spare_t; | |
482 |
|
482 | |||
483 | typedef struct { |
|
483 | typedef struct { | |
484 | unsigned char targetLogicalAddress; |
|
484 | unsigned char targetLogicalAddress; | |
485 | unsigned char protocolIdentifier; |
|
485 | unsigned char protocolIdentifier; | |
486 | unsigned char reserved; |
|
486 | unsigned char reserved; | |
487 | unsigned char userApplication; |
|
487 | unsigned char userApplication; | |
488 | unsigned char packetID[2]; |
|
488 | unsigned char packetID[2]; | |
489 | unsigned char packetSequenceControl[2]; |
|
489 | unsigned char packetSequenceControl[2]; | |
490 | unsigned char packetLength[2]; |
|
490 | unsigned char packetLength[2]; | |
491 | // DATA FIELD HEADER |
|
491 | // DATA FIELD HEADER | |
492 | unsigned char spare1_pusVersion_spare2; |
|
492 | unsigned char spare1_pusVersion_spare2; | |
493 | unsigned char serviceType; |
|
493 | unsigned char serviceType; | |
494 | unsigned char serviceSubType; |
|
494 | unsigned char serviceSubType; | |
495 | unsigned char destinationID; |
|
495 | unsigned char destinationID; | |
496 | unsigned char time[6]; |
|
496 | unsigned char time[6]; | |
497 | // AUXILIARY HEADER |
|
497 | // AUXILIARY HEADER | |
498 | unsigned char sid; |
|
498 | unsigned char sid; | |
499 | unsigned char biaStatusInfo; |
|
499 | unsigned char biaStatusInfo; | |
500 | unsigned char acquisitionTime[6]; |
|
500 | unsigned char acquisitionTime[6]; | |
501 | unsigned char pa_lfr_bp_blk_nr[2]; |
|
501 | unsigned char pa_lfr_bp_blk_nr[2]; | |
502 | } Header_TM_LFR_SCIENCE_BP_t; |
|
502 | } Header_TM_LFR_SCIENCE_BP_t; | |
503 |
|
503 | |||
504 | typedef struct { |
|
504 | typedef struct { | |
505 | //targetLogicalAddress is removed by the grspw module |
|
505 | //targetLogicalAddress is removed by the grspw module | |
506 | unsigned char protocolIdentifier; |
|
506 | unsigned char protocolIdentifier; | |
507 | unsigned char reserved; |
|
507 | unsigned char reserved; | |
508 | unsigned char userApplication; |
|
508 | unsigned char userApplication; | |
509 | unsigned char packetID[2]; |
|
509 | unsigned char packetID[2]; | |
510 | unsigned char packetSequenceControl[2]; |
|
510 | unsigned char packetSequenceControl[2]; | |
511 | unsigned char packetLength[2]; |
|
511 | unsigned char packetLength[2]; | |
512 | // DATA FIELD HEADER |
|
512 | // DATA FIELD HEADER | |
513 | unsigned char headerFlag_pusVersion_Ack; |
|
513 | unsigned char headerFlag_pusVersion_Ack; | |
514 | unsigned char serviceType; |
|
514 | unsigned char serviceType; | |
515 | unsigned char serviceSubType; |
|
515 | unsigned char serviceSubType; | |
516 | unsigned char sourceID; |
|
516 | unsigned char sourceID; | |
517 | unsigned char dataAndCRC[CCSDS_TC_PKT_MAX_SIZE-10]; |
|
517 | unsigned char dataAndCRC[CCSDS_TC_PKT_MAX_SIZE-10]; | |
518 | } ccsdsTelecommandPacket_t; |
|
518 | } ccsdsTelecommandPacket_t; | |
519 |
|
519 | |||
520 | typedef struct { |
|
520 | typedef struct { | |
521 | unsigned char targetLogicalAddress; |
|
521 | unsigned char targetLogicalAddress; | |
522 | unsigned char protocolIdentifier; |
|
522 | unsigned char protocolIdentifier; | |
523 | unsigned char reserved; |
|
523 | unsigned char reserved; | |
524 | unsigned char userApplication; |
|
524 | unsigned char userApplication; | |
525 | unsigned char packetID[2]; |
|
525 | unsigned char packetID[2]; | |
526 | unsigned char packetSequenceControl[2]; |
|
526 | unsigned char packetSequenceControl[2]; | |
527 | unsigned char packetLength[2]; |
|
527 | unsigned char packetLength[2]; | |
528 | unsigned char spare1_pusVersion_spare2; |
|
528 | unsigned char spare1_pusVersion_spare2; | |
529 | unsigned char serviceType; |
|
529 | unsigned char serviceType; | |
530 | unsigned char serviceSubType; |
|
530 | unsigned char serviceSubType; | |
531 | unsigned char destinationID; |
|
531 | unsigned char destinationID; | |
532 | unsigned char time[6]; |
|
532 | unsigned char time[6]; | |
533 | unsigned char sid; |
|
533 | unsigned char sid; | |
534 |
|
534 | |||
535 | //************** |
|
535 | //************** | |
536 | // HK PARAMETERS |
|
536 | // HK PARAMETERS | |
537 | unsigned char lfr_status_word[2]; |
|
537 | unsigned char lfr_status_word[2]; | |
538 | unsigned char lfr_sw_version[4]; |
|
538 | unsigned char lfr_sw_version[4]; | |
539 | unsigned char lfr_fpga_version[3]; |
|
539 | unsigned char lfr_fpga_version[3]; | |
540 | // ressource statistics |
|
540 | // ressource statistics | |
541 | unsigned char hk_lfr_cpu_load; |
|
541 | unsigned char hk_lfr_cpu_load; | |
542 | unsigned char hk_lfr_load_max; |
|
542 | unsigned char hk_lfr_cpu_load_max; | |
543 | unsigned char hk_lfr_load_aver; |
|
543 | unsigned char hk_lfr_cpu_load_aver; | |
544 | // tc statistics |
|
544 | // tc statistics | |
545 | unsigned char hk_lfr_update_info_tc_cnt[2]; |
|
545 | unsigned char hk_lfr_update_info_tc_cnt[2]; | |
546 | unsigned char hk_lfr_update_time_tc_cnt[2]; |
|
546 | unsigned char hk_lfr_update_time_tc_cnt[2]; | |
547 | unsigned char hk_lfr_exe_tc_cnt[2]; |
|
547 | unsigned char hk_lfr_exe_tc_cnt[2]; | |
548 | unsigned char hk_lfr_rej_tc_cnt[2]; |
|
548 | unsigned char hk_lfr_rej_tc_cnt[2]; | |
549 | unsigned char hk_lfr_last_exe_tc_id[2]; |
|
549 | unsigned char hk_lfr_last_exe_tc_id[2]; | |
550 | unsigned char hk_lfr_last_exe_tc_type[2]; |
|
550 | unsigned char hk_lfr_last_exe_tc_type[2]; | |
551 | unsigned char hk_lfr_last_exe_tc_subtype[2]; |
|
551 | unsigned char hk_lfr_last_exe_tc_subtype[2]; | |
552 | unsigned char hk_lfr_last_exe_tc_time[6]; |
|
552 | unsigned char hk_lfr_last_exe_tc_time[6]; | |
553 | unsigned char hk_lfr_last_rej_tc_id[2]; |
|
553 | unsigned char hk_lfr_last_rej_tc_id[2]; | |
554 | unsigned char hk_lfr_last_rej_tc_type[2]; |
|
554 | unsigned char hk_lfr_last_rej_tc_type[2]; | |
555 | unsigned char hk_lfr_last_rej_tc_subtype[2]; |
|
555 | unsigned char hk_lfr_last_rej_tc_subtype[2]; | |
556 | unsigned char hk_lfr_last_rej_tc_time[6]; |
|
556 | unsigned char hk_lfr_last_rej_tc_time[6]; | |
557 | // anomaly statistics |
|
557 | // anomaly statistics | |
558 | unsigned char hk_lfr_le_cnt[2]; |
|
558 | unsigned char hk_lfr_le_cnt[2]; | |
559 | unsigned char hk_lfr_me_cnt[2]; |
|
559 | unsigned char hk_lfr_me_cnt[2]; | |
560 | unsigned char hk_lfr_he_cnt[2]; |
|
560 | unsigned char hk_lfr_he_cnt[2]; | |
561 | unsigned char hk_lfr_last_er_rid[2]; |
|
561 | unsigned char hk_lfr_last_er_rid[2]; | |
562 | unsigned char hk_lfr_last_er_code; |
|
562 | unsigned char hk_lfr_last_er_code; | |
563 | unsigned char hk_lfr_last_er_time[6]; |
|
563 | unsigned char hk_lfr_last_er_time[6]; | |
564 | // vhdl_blk_status |
|
564 | // vhdl_blk_status | |
565 | unsigned char hk_lfr_vhdl_aa_sm; |
|
565 | unsigned char hk_lfr_vhdl_aa_sm; | |
566 | unsigned char hk_lfr_vhdl_fft_sr; |
|
566 | unsigned char hk_lfr_vhdl_fft_sr; | |
567 | unsigned char hk_lfr_vhdl_cic_hk; |
|
567 | unsigned char hk_lfr_vhdl_cic_hk; | |
568 | unsigned char hk_lfr_vhdl_iir_cal; |
|
568 | unsigned char hk_lfr_vhdl_iir_cal; | |
569 | // spacewire_if_statistics |
|
569 | // spacewire_if_statistics | |
570 | unsigned char hk_lfr_dpu_spw_pkt_rcv_cnt[2]; |
|
570 | unsigned char hk_lfr_dpu_spw_pkt_rcv_cnt[2]; | |
571 | unsigned char hk_lfr_dpu_spw_pkt_sent_cnt[2]; |
|
571 | unsigned char hk_lfr_dpu_spw_pkt_sent_cnt[2]; | |
572 | unsigned char hk_lfr_dpu_spw_tick_out_cnt; |
|
572 | unsigned char hk_lfr_dpu_spw_tick_out_cnt; | |
573 | unsigned char hk_lfr_dpu_spw_last_timc; |
|
573 | unsigned char hk_lfr_dpu_spw_last_timc; | |
574 | // ahb error statistics |
|
574 | // ahb error statistics | |
575 | unsigned char hk_lfr_last_fail_addr[4]; |
|
575 | unsigned char hk_lfr_last_fail_addr[4]; | |
576 | // temperatures |
|
576 | // temperatures | |
577 | unsigned char hk_lfr_temp_scm[2]; |
|
577 | unsigned char hk_lfr_temp_scm[2]; | |
578 | unsigned char hk_lfr_temp_pcb[2]; |
|
578 | unsigned char hk_lfr_temp_pcb[2]; | |
579 | unsigned char hk_lfr_temp_fpga[2]; |
|
579 | unsigned char hk_lfr_temp_fpga[2]; | |
580 | // spacecraft potential |
|
580 | // spacecraft potential | |
581 | unsigned char hk_lfr_sc_v_f3[2]; |
|
581 | unsigned char hk_lfr_sc_v_f3[2]; | |
582 | unsigned char hk_lfr_sc_e1_f3[2]; |
|
582 | unsigned char hk_lfr_sc_e1_f3[2]; | |
583 | unsigned char hk_lfr_sc_e2_f3[2]; |
|
583 | unsigned char hk_lfr_sc_e2_f3[2]; | |
584 | // error counters |
|
584 | // error counters | |
585 | unsigned char hk_lfr_dpu_spw_parity; |
|
585 | unsigned char hk_lfr_dpu_spw_parity; | |
586 | unsigned char hk_lfr_dpu_spw_disconnect; |
|
586 | unsigned char hk_lfr_dpu_spw_disconnect; | |
587 | unsigned char hk_lfr_dpu_spw_escape; |
|
587 | unsigned char hk_lfr_dpu_spw_escape; | |
588 | unsigned char hk_lfr_dpu_spw_credit; |
|
588 | unsigned char hk_lfr_dpu_spw_credit; | |
589 | unsigned char hk_lfr_dpu_spw_write_sync; |
|
589 | unsigned char hk_lfr_dpu_spw_write_sync; | |
590 | unsigned char hk_lfr_dpu_spw_rx_ahb; |
|
590 | unsigned char hk_lfr_dpu_spw_rx_ahb; | |
591 | unsigned char hk_lfr_dpu_spw_tx_ahb; |
|
591 | unsigned char hk_lfr_dpu_spw_tx_ahb; | |
592 | unsigned char hk_lfr_dpu_spw_early_eop; |
|
592 | unsigned char hk_lfr_dpu_spw_early_eop; | |
593 | unsigned char hk_lfr_dpu_spw_invalid_addr; |
|
593 | unsigned char hk_lfr_dpu_spw_invalid_addr; | |
594 | unsigned char hk_lfr_dpu_spw_eep; |
|
594 | unsigned char hk_lfr_dpu_spw_eep; | |
595 | unsigned char hk_lfr_dpu_spw_rx_too_big; |
|
595 | unsigned char hk_lfr_dpu_spw_rx_too_big; | |
596 | // timecode |
|
596 | // timecode | |
597 | unsigned char hk_lfr_timecode_erroneous; |
|
597 | unsigned char hk_lfr_timecode_erroneous; | |
598 | unsigned char hk_lfr_timecode_missing; |
|
598 | unsigned char hk_lfr_timecode_missing; | |
599 | unsigned char hk_lfr_timecode_invalid; |
|
599 | unsigned char hk_lfr_timecode_invalid; | |
600 | // time |
|
600 | // time | |
601 | unsigned char hk_lfr_time_timecode_it; |
|
601 | unsigned char hk_lfr_time_timecode_it; | |
602 | unsigned char hk_lfr_time_not_synchro; |
|
602 | unsigned char hk_lfr_time_not_synchro; | |
603 | unsigned char hk_lfr_time_timecode_ctr; |
|
603 | unsigned char hk_lfr_time_timecode_ctr; | |
604 | // hk_lfr_buffer_dpu_ |
|
604 | // hk_lfr_buffer_dpu_ | |
605 | unsigned char hk_lfr_buffer_dpu_tc_fifo; |
|
605 | unsigned char hk_lfr_buffer_dpu_tc_fifo; | |
606 | unsigned char hk_lfr_buffer_dpu_tm_fifo; |
|
606 | unsigned char hk_lfr_buffer_dpu_tm_fifo; | |
607 | // hk_lfr_ahb_ |
|
607 | // hk_lfr_ahb_ | |
608 | unsigned char hk_lfr_ahb_correctable; |
|
608 | unsigned char hk_lfr_ahb_correctable; | |
609 | unsigned char hk_lfr_ahb_uncorrectable; |
|
609 | unsigned char hk_lfr_ahb_uncorrectable; | |
610 | // spare |
|
610 | // spare | |
611 | unsigned char parameters_spare; |
|
611 | unsigned char parameters_spare; | |
612 | } Packet_TM_LFR_HK_t; |
|
612 | } Packet_TM_LFR_HK_t; | |
613 |
|
613 | |||
614 | typedef struct { |
|
614 | typedef struct { | |
615 | unsigned char targetLogicalAddress; |
|
615 | unsigned char targetLogicalAddress; | |
616 | unsigned char protocolIdentifier; |
|
616 | unsigned char protocolIdentifier; | |
617 | unsigned char reserved; |
|
617 | unsigned char reserved; | |
618 | unsigned char userApplication; |
|
618 | unsigned char userApplication; | |
619 | unsigned char packetID[2]; |
|
619 | unsigned char packetID[2]; | |
620 | unsigned char packetSequenceControl[2]; |
|
620 | unsigned char packetSequenceControl[2]; | |
621 | unsigned char packetLength[2]; |
|
621 | unsigned char packetLength[2]; | |
622 | // DATA FIELD HEADER |
|
622 | // DATA FIELD HEADER | |
623 | unsigned char spare1_pusVersion_spare2; |
|
623 | unsigned char spare1_pusVersion_spare2; | |
624 | unsigned char serviceType; |
|
624 | unsigned char serviceType; | |
625 | unsigned char serviceSubType; |
|
625 | unsigned char serviceSubType; | |
626 | unsigned char destinationID; |
|
626 | unsigned char destinationID; | |
627 | unsigned char time[6]; |
|
627 | unsigned char time[6]; | |
628 | unsigned char sid; |
|
628 | unsigned char sid; | |
629 |
|
629 | |||
630 | //****************** |
|
630 | //****************** | |
631 | // COMMON PARAMETERS |
|
631 | // COMMON PARAMETERS | |
632 | unsigned char unused0; |
|
632 | unsigned char unused0; | |
633 | unsigned char bw_sp0_sp1_r0_r1; |
|
633 | unsigned char bw_sp0_sp1_r0_r1; | |
634 |
|
634 | |||
635 | //****************** |
|
635 | //****************** | |
636 | // NORMAL PARAMETERS |
|
636 | // NORMAL PARAMETERS | |
637 | unsigned char sy_lfr_n_swf_l[2]; |
|
637 | unsigned char sy_lfr_n_swf_l[2]; | |
638 | unsigned char sy_lfr_n_swf_p[2]; |
|
638 | unsigned char sy_lfr_n_swf_p[2]; | |
639 | unsigned char sy_lfr_n_asm_p[2]; |
|
639 | unsigned char sy_lfr_n_asm_p[2]; | |
640 | unsigned char sy_lfr_n_bp_p0; |
|
640 | unsigned char sy_lfr_n_bp_p0; | |
641 | unsigned char sy_lfr_n_bp_p1; |
|
641 | unsigned char sy_lfr_n_bp_p1; | |
642 | unsigned char sy_lfr_n_cwf_long_f3; |
|
642 | unsigned char sy_lfr_n_cwf_long_f3; | |
643 | unsigned char lfr_normal_parameters_spare; |
|
643 | unsigned char lfr_normal_parameters_spare; | |
644 |
|
644 | |||
645 | //***************** |
|
645 | //***************** | |
646 | // BURST PARAMETERS |
|
646 | // BURST PARAMETERS | |
647 | unsigned char sy_lfr_b_bp_p0; |
|
647 | unsigned char sy_lfr_b_bp_p0; | |
648 | unsigned char sy_lfr_b_bp_p1; |
|
648 | unsigned char sy_lfr_b_bp_p1; | |
649 |
|
649 | |||
650 | //**************** |
|
650 | //**************** | |
651 | // SBM1 PARAMETERS |
|
651 | // SBM1 PARAMETERS | |
652 | unsigned char sy_lfr_s1_bp_p0; |
|
652 | unsigned char sy_lfr_s1_bp_p0; | |
653 | unsigned char sy_lfr_s1_bp_p1; |
|
653 | unsigned char sy_lfr_s1_bp_p1; | |
654 |
|
654 | |||
655 | //**************** |
|
655 | //**************** | |
656 | // SBM2 PARAMETERS |
|
656 | // SBM2 PARAMETERS | |
657 | unsigned char sy_lfr_s2_bp_p0; |
|
657 | unsigned char sy_lfr_s2_bp_p0; | |
658 | unsigned char sy_lfr_s2_bp_p1; |
|
658 | unsigned char sy_lfr_s2_bp_p1; | |
659 |
|
659 | |||
660 | // SPARE |
|
660 | // SPARE | |
661 | unsigned char source_data_spare; |
|
661 | unsigned char source_data_spare; | |
662 | } Packet_TM_LFR_PARAMETER_DUMP_t; |
|
662 | } Packet_TM_LFR_PARAMETER_DUMP_t; | |
663 |
|
663 | |||
664 |
|
664 | |||
665 | #endif // CCSDS_TYPES_H_INCLUDED |
|
665 | #endif // CCSDS_TYPES_H_INCLUDED |
@@ -1,45 +1,48 | |||||
1 | #ifndef FSW_MISC_H_INCLUDED |
|
1 | #ifndef FSW_MISC_H_INCLUDED | |
2 | #define FSW_MISC_H_INCLUDED |
|
2 | #define FSW_MISC_H_INCLUDED | |
3 |
|
3 | |||
4 | #include <rtems.h> |
|
4 | #include <rtems.h> | |
5 | #include <stdio.h> |
|
5 | #include <stdio.h> | |
6 | #include <grspw.h> |
|
6 | #include <grspw.h> | |
7 |
|
7 | |||
8 | #include "fsw_params.h" |
|
8 | #include "fsw_params.h" | |
9 | #include "fsw_spacewire.h" |
|
9 | #include "fsw_spacewire.h" | |
|
10 | #include "lfr_cpu_usage_report.h" | |||
10 |
|
11 | |||
11 | rtems_name name_hk_rate_monotonic; // name of the HK rate monotonic |
|
12 | rtems_name name_hk_rate_monotonic; // name of the HK rate monotonic | |
12 | rtems_id HK_id; // id of the HK rate monotonic period |
|
13 | rtems_id HK_id; // id of the HK rate monotonic period | |
13 |
|
14 | |||
14 | //extern rtems_name misc_name[5]; |
|
15 | //extern rtems_name misc_name[5]; | |
15 | //time_management_regs_t *time_management_regs; |
|
16 | //time_management_regs_t *time_management_regs; | |
16 | //extern Packet_TM_LFR_HK_t housekeeping_packet; |
|
17 | //extern Packet_TM_LFR_HK_t housekeeping_packet; | |
17 |
|
18 | |||
18 | void configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider, |
|
19 | void configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider, | |
19 | unsigned char interrupt_level, rtems_isr (*timer_isr)() ); |
|
20 | unsigned char interrupt_level, rtems_isr (*timer_isr)() ); | |
20 | void timer_start( gptimer_regs_t *gptimer_regs, unsigned char timer ); |
|
21 | void timer_start( gptimer_regs_t *gptimer_regs, unsigned char timer ); | |
21 | void timer_stop( gptimer_regs_t *gptimer_regs, unsigned char timer ); |
|
22 | void timer_stop( gptimer_regs_t *gptimer_regs, unsigned char timer ); | |
22 | void timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider); |
|
23 | void timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider); | |
23 |
|
24 | |||
24 | // SERIAL LINK |
|
25 | // SERIAL LINK | |
25 | int send_console_outputs_on_apbuart_port( void ); |
|
26 | int send_console_outputs_on_apbuart_port( void ); | |
26 | int enable_apbuart_transmitter( void ); |
|
27 | int enable_apbuart_transmitter( void ); | |
27 | void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value); |
|
28 | void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value); | |
28 |
|
29 | |||
29 | // RTEMS TASKS |
|
30 | // RTEMS TASKS | |
30 | rtems_task stat_task( rtems_task_argument argument ); |
|
31 | rtems_task stat_task( rtems_task_argument argument ); | |
31 | rtems_task hous_task( rtems_task_argument argument ); |
|
32 | rtems_task hous_task( rtems_task_argument argument ); | |
32 | rtems_task dumb_task( rtems_task_argument unused ); |
|
33 | rtems_task dumb_task( rtems_task_argument unused ); | |
33 |
|
34 | |||
34 | void init_housekeeping_parameters( void ); |
|
35 | void init_housekeeping_parameters( void ); | |
35 | void increment_seq_counter( unsigned char *packet_sequence_control); |
|
36 | void increment_seq_counter( unsigned char *packet_sequence_control); | |
36 | void getTime( unsigned char *time); |
|
37 | void getTime( unsigned char *time); | |
37 | unsigned long long int getTimeAsUnsignedLongLongInt( ); |
|
38 | unsigned long long int getTimeAsUnsignedLongLongInt( ); | |
38 | void send_dumb_hk( void ); |
|
39 | void send_dumb_hk( void ); | |
39 |
void get_v_e1_e2_f3 (unsigned char * |
|
40 | void get_v_e1_e2_f3 (unsigned char *spacecraft_potential); | |
|
41 | void get_cpu_load( unsigned char *resource_statistics ); | |||
40 |
|
42 | |||
41 | extern int sched_yield( void ); |
|
43 | extern int sched_yield( void ); | |
|
44 | extern int rtems_cpu_usage_reset(); | |||
42 | extern ring_node *current_ring_node_f3; |
|
45 | extern ring_node *current_ring_node_f3; | |
43 | extern ring_node *ring_node_to_send_cwf_f3; |
|
46 | extern ring_node *ring_node_to_send_cwf_f3; | |
44 |
|
47 | |||
45 | #endif // FSW_MISC_H_INCLUDED |
|
48 | #endif // FSW_MISC_H_INCLUDED |
@@ -1,60 +1,62 | |||||
1 | #ifndef TC_HANDLER_H_INCLUDED |
|
1 | #ifndef TC_HANDLER_H_INCLUDED | |
2 | #define TC_HANDLER_H_INCLUDED |
|
2 | #define TC_HANDLER_H_INCLUDED | |
3 |
|
3 | |||
4 | #include <rtems.h> |
|
4 | #include <rtems.h> | |
5 | #include <leon.h> |
|
5 | #include <leon.h> | |
6 |
|
6 | |||
7 | #include "tc_load_dump_parameters.h" |
|
7 | #include "tc_load_dump_parameters.h" | |
8 | #include "tc_acceptance.h" |
|
8 | #include "tc_acceptance.h" | |
9 | #include "tm_lfr_tc_exe.h" |
|
9 | #include "tm_lfr_tc_exe.h" | |
10 | #include "wf_handler.h" |
|
10 | #include "wf_handler.h" | |
11 | #include "fsw_processing.h" |
|
11 | #include "fsw_processing.h" | |
12 |
|
12 | |||
|
13 | #include "lfr_cpu_usage_report.h" | |||
|
14 | ||||
13 | // MODE PARAMETERS |
|
15 | // MODE PARAMETERS | |
14 | extern unsigned int maxCount; |
|
16 | extern unsigned int maxCount; | |
15 |
|
17 | |||
16 | //**** |
|
18 | //**** | |
17 | // ISR |
|
19 | // ISR | |
18 | rtems_isr commutation_isr1( rtems_vector_number vector ); |
|
20 | rtems_isr commutation_isr1( rtems_vector_number vector ); | |
19 | rtems_isr commutation_isr2( rtems_vector_number vector ); |
|
21 | rtems_isr commutation_isr2( rtems_vector_number vector ); | |
20 |
|
22 | |||
21 | //*********** |
|
23 | //*********** | |
22 | // RTEMS TASK |
|
24 | // RTEMS TASK | |
23 | rtems_task actn_task( rtems_task_argument unused ); |
|
25 | rtems_task actn_task( rtems_task_argument unused ); | |
24 |
|
26 | |||
25 | //*********** |
|
27 | //*********** | |
26 | // TC ACTIONS |
|
28 | // TC ACTIONS | |
27 | int action_reset( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time ); |
|
29 | int action_reset( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time ); | |
28 | int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); |
|
30 | int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); | |
29 | int action_update_info( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); |
|
31 | int action_update_info( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); | |
30 | int action_enable_calibration( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time ); |
|
32 | int action_enable_calibration( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time ); | |
31 | int action_disable_calibration( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time ); |
|
33 | int action_disable_calibration( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time ); | |
32 | int action_update_time( ccsdsTelecommandPacket_t *TC); |
|
34 | int action_update_time( ccsdsTelecommandPacket_t *TC); | |
33 |
|
35 | |||
34 | // mode transition |
|
36 | // mode transition | |
35 | int check_mode_value( unsigned char requestedMode ); |
|
37 | int check_mode_value( unsigned char requestedMode ); | |
36 | int check_mode_transition( unsigned char requestedMode ); |
|
38 | int check_mode_transition( unsigned char requestedMode ); | |
37 | int check_transition_date( unsigned int transitionCoarseTime ); |
|
39 | int check_transition_date( unsigned int transitionCoarseTime ); | |
38 | int stop_current_mode( void ); |
|
40 | int stop_current_mode( void ); | |
39 | int enter_mode( unsigned char mode , unsigned int transitionCoarseTime ); |
|
41 | int enter_mode( unsigned char mode , unsigned int transitionCoarseTime ); | |
40 | int restart_science_tasks(unsigned char lfrRequestedMode ); |
|
42 | int restart_science_tasks(unsigned char lfrRequestedMode ); | |
41 | int suspend_science_tasks(); |
|
43 | int suspend_science_tasks(); | |
42 | void launch_waveform_picker(unsigned char mode , unsigned int transitionCoarseTime); |
|
44 | void launch_waveform_picker(unsigned char mode , unsigned int transitionCoarseTime); | |
43 | void launch_spectral_matrix( void ); |
|
45 | void launch_spectral_matrix( void ); | |
44 | void launch_spectral_matrix_simu( void ); |
|
46 | void launch_spectral_matrix_simu( void ); | |
45 | void set_irq_on_new_ready_matrix(unsigned char value ); |
|
47 | void set_irq_on_new_ready_matrix(unsigned char value ); | |
46 | void set_run_matrix_spectral( unsigned char value ); |
|
48 | void set_run_matrix_spectral( unsigned char value ); | |
47 |
|
49 | |||
48 | // other functions |
|
50 | // other functions | |
49 | void updateLFRCurrentMode(); |
|
51 | void updateLFRCurrentMode(); | |
50 | void update_last_TC_exe( ccsdsTelecommandPacket_t *TC , unsigned char *time ); |
|
52 | void update_last_TC_exe( ccsdsTelecommandPacket_t *TC , unsigned char *time ); | |
51 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC , unsigned char *time ); |
|
53 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC , unsigned char *time ); | |
52 | void close_action( ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id ); |
|
54 | void close_action( ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id ); | |
53 |
|
55 | |||
54 | extern rtems_status_code get_message_queue_id_send( rtems_id *queue_id ); |
|
56 | extern rtems_status_code get_message_queue_id_send( rtems_id *queue_id ); | |
55 | extern rtems_status_code get_message_queue_id_recv( rtems_id *queue_id ); |
|
57 | extern rtems_status_code get_message_queue_id_recv( rtems_id *queue_id ); | |
56 |
|
58 | |||
57 | #endif // TC_HANDLER_H_INCLUDED |
|
59 | #endif // TC_HANDLER_H_INCLUDED | |
58 |
|
60 | |||
59 |
|
61 | |||
60 |
|
62 |
@@ -1,766 +1,768 | |||||
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_MAXIMUM_DRIVERS 16 |
|
35 | #define CONFIGURE_MAXIMUM_DRIVERS 16 | |
36 | #define CONFIGURE_MAXIMUM_PERIODS 5 |
|
36 | #define CONFIGURE_MAXIMUM_PERIODS 5 | |
37 | #define CONFIGURE_MAXIMUM_TIMERS 5 // STAT (1s), send SWF (0.3s), send CWF3 (1s) |
|
37 | #define CONFIGURE_MAXIMUM_TIMERS 5 // STAT (1s), send SWF (0.3s), send CWF3 (1s) | |
38 | #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 5 |
|
38 | #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 5 | |
39 | #ifdef PRINT_STACK_REPORT |
|
39 | #ifdef PRINT_STACK_REPORT | |
40 | #define CONFIGURE_STACK_CHECKER_ENABLED |
|
40 | #define CONFIGURE_STACK_CHECKER_ENABLED | |
41 | #endif |
|
41 | #endif | |
42 |
|
42 | |||
43 | #include <rtems/confdefs.h> |
|
43 | #include <rtems/confdefs.h> | |
44 |
|
44 | |||
45 | /* If --drvmgr was enabled during the configuration of the RTEMS kernel */ |
|
45 | /* If --drvmgr was enabled during the configuration of the RTEMS kernel */ | |
46 | #ifdef RTEMS_DRVMGR_STARTUP |
|
46 | #ifdef RTEMS_DRVMGR_STARTUP | |
47 | #ifdef LEON3 |
|
47 | #ifdef LEON3 | |
48 | /* Add Timer and UART Driver */ |
|
48 | /* Add Timer and UART Driver */ | |
49 | #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
|
49 | #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER | |
50 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER |
|
50 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER | |
51 | #endif |
|
51 | #endif | |
52 | #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
|
52 | #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER | |
53 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART |
|
53 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART | |
54 | #endif |
|
54 | #endif | |
55 | #endif |
|
55 | #endif | |
56 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */ |
|
56 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */ | |
57 | #include <drvmgr/drvmgr_confdefs.h> |
|
57 | #include <drvmgr/drvmgr_confdefs.h> | |
58 | #endif |
|
58 | #endif | |
59 |
|
59 | |||
60 | #include "fsw_init.h" |
|
60 | #include "fsw_init.h" | |
61 | #include "fsw_config.c" |
|
61 | #include "fsw_config.c" | |
62 |
|
62 | |||
63 | rtems_task Init( rtems_task_argument ignored ) |
|
63 | rtems_task Init( rtems_task_argument ignored ) | |
64 | { |
|
64 | { | |
65 | /** This is the RTEMS INIT taks, it the first task launched by the system. |
|
65 | /** This is the RTEMS INIT taks, it the first task launched by the system. | |
66 | * |
|
66 | * | |
67 | * @param unused is the starting argument of the RTEMS task |
|
67 | * @param unused is the starting argument of the RTEMS task | |
68 | * |
|
68 | * | |
69 | * The INIT task create and run all other RTEMS tasks. |
|
69 | * The INIT task create and run all other RTEMS tasks. | |
70 | * |
|
70 | * | |
71 | */ |
|
71 | */ | |
72 |
|
72 | |||
73 | reset_local_time(); |
|
73 | reset_local_time(); | |
74 |
|
74 | |||
|
75 | rtems_cpu_usage_reset(); | |||
|
76 | ||||
75 | rtems_status_code status; |
|
77 | rtems_status_code status; | |
76 | rtems_status_code status_spw; |
|
78 | rtems_status_code status_spw; | |
77 | rtems_isr_entry old_isr_handler; |
|
79 | rtems_isr_entry old_isr_handler; | |
78 |
|
80 | |||
79 | // UART settings |
|
81 | // UART settings | |
80 | send_console_outputs_on_apbuart_port(); |
|
82 | send_console_outputs_on_apbuart_port(); | |
81 | set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE); |
|
83 | set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE); | |
82 | enable_apbuart_transmitter(); |
|
84 | enable_apbuart_transmitter(); | |
83 | DEBUG_PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n") |
|
85 | DEBUG_PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n") | |
84 |
|
86 | |||
85 | PRINTF("\n\n\n\n\n") |
|
87 | PRINTF("\n\n\n\n\n") | |
86 | PRINTF("*************************\n") |
|
88 | PRINTF("*************************\n") | |
87 | PRINTF("** LFR Flight Software **\n") |
|
89 | PRINTF("** LFR Flight Software **\n") | |
88 | PRINTF1("** %d.", SW_VERSION_N1) |
|
90 | PRINTF1("** %d.", SW_VERSION_N1) | |
89 | PRINTF1("%d." , SW_VERSION_N2) |
|
91 | PRINTF1("%d." , SW_VERSION_N2) | |
90 | PRINTF1("%d." , SW_VERSION_N3) |
|
92 | PRINTF1("%d." , SW_VERSION_N3) | |
91 | PRINTF1("%d **\n", SW_VERSION_N4) |
|
93 | PRINTF1("%d **\n", SW_VERSION_N4) | |
92 | PRINTF("*************************\n") |
|
94 | PRINTF("*************************\n") | |
93 | PRINTF("\n\n") |
|
95 | PRINTF("\n\n") | |
94 |
|
96 | |||
95 | init_parameter_dump(); |
|
97 | init_parameter_dump(); | |
96 | init_local_mode_parameters(); |
|
98 | init_local_mode_parameters(); | |
97 | init_housekeeping_parameters(); |
|
99 | init_housekeeping_parameters(); | |
98 |
|
100 | |||
99 | init_waveform_rings(); // initialize the waveform rings |
|
101 | init_waveform_rings(); // initialize the waveform rings | |
100 | SM_init_rings(); // initialize spectral matrices rings |
|
102 | SM_init_rings(); // initialize spectral matrices rings | |
101 |
|
103 | |||
102 | reset_wfp_burst_enable(); |
|
104 | reset_wfp_burst_enable(); | |
103 | reset_wfp_status(); |
|
105 | reset_wfp_status(); | |
104 | set_wfp_data_shaping(); |
|
106 | set_wfp_data_shaping(); | |
105 |
|
107 | |||
106 | updateLFRCurrentMode(); |
|
108 | updateLFRCurrentMode(); | |
107 |
|
109 | |||
108 | BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode) |
|
110 | BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode) | |
109 |
|
111 | |||
110 | create_names(); // create all names |
|
112 | create_names(); // create all names | |
111 |
|
113 | |||
112 | status = create_message_queues(); // create message queues |
|
114 | status = create_message_queues(); // create message queues | |
113 | if (status != RTEMS_SUCCESSFUL) |
|
115 | if (status != RTEMS_SUCCESSFUL) | |
114 | { |
|
116 | { | |
115 | PRINTF1("in INIT *** ERR in create_message_queues, code %d", status) |
|
117 | PRINTF1("in INIT *** ERR in create_message_queues, code %d", status) | |
116 | } |
|
118 | } | |
117 |
|
119 | |||
118 | status = create_all_tasks(); // create all tasks |
|
120 | status = create_all_tasks(); // create all tasks | |
119 | if (status != RTEMS_SUCCESSFUL) |
|
121 | if (status != RTEMS_SUCCESSFUL) | |
120 | { |
|
122 | { | |
121 | PRINTF1("in INIT *** ERR in create_all_tasks, code %d\n", status) |
|
123 | PRINTF1("in INIT *** ERR in create_all_tasks, code %d\n", status) | |
122 | } |
|
124 | } | |
123 |
|
125 | |||
124 | // ************************** |
|
126 | // ************************** | |
125 | // <SPACEWIRE INITIALIZATION> |
|
127 | // <SPACEWIRE INITIALIZATION> | |
126 | grspw_timecode_callback = &timecode_irq_handler; |
|
128 | grspw_timecode_callback = &timecode_irq_handler; | |
127 |
|
129 | |||
128 | status_spw = spacewire_open_link(); // (1) open the link |
|
130 | status_spw = spacewire_open_link(); // (1) open the link | |
129 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
131 | if ( status_spw != RTEMS_SUCCESSFUL ) | |
130 | { |
|
132 | { | |
131 | PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw ) |
|
133 | PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw ) | |
132 | } |
|
134 | } | |
133 |
|
135 | |||
134 | if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link |
|
136 | if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link | |
135 | { |
|
137 | { | |
136 | status_spw = spacewire_configure_link( fdSPW ); |
|
138 | status_spw = spacewire_configure_link( fdSPW ); | |
137 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
139 | if ( status_spw != RTEMS_SUCCESSFUL ) | |
138 | { |
|
140 | { | |
139 | PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw ) |
|
141 | PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw ) | |
140 | } |
|
142 | } | |
141 | } |
|
143 | } | |
142 |
|
144 | |||
143 | if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link |
|
145 | if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link | |
144 | { |
|
146 | { | |
145 | status_spw = spacewire_start_link( fdSPW ); |
|
147 | status_spw = spacewire_start_link( fdSPW ); | |
146 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
148 | if ( status_spw != RTEMS_SUCCESSFUL ) | |
147 | { |
|
149 | { | |
148 | PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw ) |
|
150 | PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw ) | |
149 | } |
|
151 | } | |
150 | } |
|
152 | } | |
151 | // </SPACEWIRE INITIALIZATION> |
|
153 | // </SPACEWIRE INITIALIZATION> | |
152 | // *************************** |
|
154 | // *************************** | |
153 |
|
155 | |||
154 | status = start_all_tasks(); // start all tasks |
|
156 | status = start_all_tasks(); // start all tasks | |
155 | if (status != RTEMS_SUCCESSFUL) |
|
157 | if (status != RTEMS_SUCCESSFUL) | |
156 | { |
|
158 | { | |
157 | PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status) |
|
159 | PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status) | |
158 | } |
|
160 | } | |
159 |
|
161 | |||
160 | // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization |
|
162 | // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization | |
161 | status = start_recv_send_tasks(); |
|
163 | status = start_recv_send_tasks(); | |
162 | if ( status != RTEMS_SUCCESSFUL ) |
|
164 | if ( status != RTEMS_SUCCESSFUL ) | |
163 | { |
|
165 | { | |
164 | PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status ) |
|
166 | PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status ) | |
165 | } |
|
167 | } | |
166 |
|
168 | |||
167 | // suspend science tasks, they will be restarted later depending on the mode |
|
169 | // suspend science tasks, they will be restarted later depending on the mode | |
168 | status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY) |
|
170 | status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY) | |
169 | if (status != RTEMS_SUCCESSFUL) |
|
171 | if (status != RTEMS_SUCCESSFUL) | |
170 | { |
|
172 | { | |
171 | PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status) |
|
173 | PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status) | |
172 | } |
|
174 | } | |
173 |
|
175 | |||
174 | //****************************** |
|
176 | //****************************** | |
175 | // <SPECTRAL MATRICES SIMULATOR> |
|
177 | // <SPECTRAL MATRICES SIMULATOR> | |
176 | LEON_Mask_interrupt( IRQ_SM_SIMULATOR ); |
|
178 | LEON_Mask_interrupt( IRQ_SM_SIMULATOR ); | |
177 | configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR, |
|
179 | configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR, | |
178 | IRQ_SPARC_SM_SIMULATOR, spectral_matrices_isr_simu ); |
|
180 | IRQ_SPARC_SM_SIMULATOR, spectral_matrices_isr_simu ); | |
179 | // </SPECTRAL MATRICES SIMULATOR> |
|
181 | // </SPECTRAL MATRICES SIMULATOR> | |
180 | //******************************* |
|
182 | //******************************* | |
181 |
|
183 | |||
182 | // configure IRQ handling for the waveform picker unit |
|
184 | // configure IRQ handling for the waveform picker unit | |
183 | status = rtems_interrupt_catch( waveforms_isr, |
|
185 | status = rtems_interrupt_catch( waveforms_isr, | |
184 | IRQ_SPARC_WAVEFORM_PICKER, |
|
186 | IRQ_SPARC_WAVEFORM_PICKER, | |
185 | &old_isr_handler) ; |
|
187 | &old_isr_handler) ; | |
186 | // configure IRQ handling for the spectral matrices unit |
|
188 | // configure IRQ handling for the spectral matrices unit | |
187 | status = rtems_interrupt_catch( spectral_matrices_isr, |
|
189 | status = rtems_interrupt_catch( spectral_matrices_isr, | |
188 | IRQ_SPARC_SPECTRAL_MATRIX, |
|
190 | IRQ_SPARC_SPECTRAL_MATRIX, | |
189 | &old_isr_handler) ; |
|
191 | &old_isr_handler) ; | |
190 |
|
192 | |||
191 | // if the spacewire link is not up then send an event to the SPIQ task for link recovery |
|
193 | // if the spacewire link is not up then send an event to the SPIQ task for link recovery | |
192 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
194 | if ( status_spw != RTEMS_SUCCESSFUL ) | |
193 | { |
|
195 | { | |
194 | status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT ); |
|
196 | status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT ); | |
195 | if ( status != RTEMS_SUCCESSFUL ) { |
|
197 | if ( status != RTEMS_SUCCESSFUL ) { | |
196 | PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status ) |
|
198 | PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status ) | |
197 | } |
|
199 | } | |
198 | } |
|
200 | } | |
199 |
|
201 | |||
200 | BOOT_PRINTF("delete INIT\n") |
|
202 | BOOT_PRINTF("delete INIT\n") | |
201 |
|
203 | |||
202 | send_dumb_hk(); |
|
204 | send_dumb_hk(); | |
203 |
|
205 | |||
204 | status = rtems_task_delete(RTEMS_SELF); |
|
206 | status = rtems_task_delete(RTEMS_SELF); | |
205 |
|
207 | |||
206 | } |
|
208 | } | |
207 |
|
209 | |||
208 | void init_local_mode_parameters( void ) |
|
210 | void init_local_mode_parameters( void ) | |
209 | { |
|
211 | { | |
210 | /** This function initialize the param_local global variable with default values. |
|
212 | /** This function initialize the param_local global variable with default values. | |
211 | * |
|
213 | * | |
212 | */ |
|
214 | */ | |
213 |
|
215 | |||
214 | unsigned int i; |
|
216 | unsigned int i; | |
215 |
|
217 | |||
216 | // LOCAL PARAMETERS |
|
218 | // LOCAL PARAMETERS | |
217 |
|
219 | |||
218 | BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max) |
|
220 | BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max) | |
219 | BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max) |
|
221 | BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max) | |
220 | BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX) |
|
222 | BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX) | |
221 |
|
223 | |||
222 | // init sequence counters |
|
224 | // init sequence counters | |
223 |
|
225 | |||
224 | for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++) |
|
226 | for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++) | |
225 | { |
|
227 | { | |
226 | sequenceCounters_TC_EXE[i] = 0x00; |
|
228 | sequenceCounters_TC_EXE[i] = 0x00; | |
227 | } |
|
229 | } | |
228 | sequenceCounters_SCIENCE_NORMAL_BURST = 0x00; |
|
230 | sequenceCounters_SCIENCE_NORMAL_BURST = 0x00; | |
229 | sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00; |
|
231 | sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00; | |
230 | } |
|
232 | } | |
231 |
|
233 | |||
232 | void reset_local_time( void ) |
|
234 | void reset_local_time( void ) | |
233 | { |
|
235 | { | |
234 | time_management_regs->ctrl = 0x02; // software reset, coarse time = 0x80000000 |
|
236 | time_management_regs->ctrl = 0x02; // software reset, coarse time = 0x80000000 | |
235 | } |
|
237 | } | |
236 |
|
238 | |||
237 | void create_names( void ) // create all names for tasks and queues |
|
239 | void create_names( void ) // create all names for tasks and queues | |
238 | { |
|
240 | { | |
239 | /** This function creates all RTEMS names used in the software for tasks and queues. |
|
241 | /** This function creates all RTEMS names used in the software for tasks and queues. | |
240 | * |
|
242 | * | |
241 | * @return RTEMS directive status codes: |
|
243 | * @return RTEMS directive status codes: | |
242 | * - RTEMS_SUCCESSFUL - successful completion |
|
244 | * - RTEMS_SUCCESSFUL - successful completion | |
243 | * |
|
245 | * | |
244 | */ |
|
246 | */ | |
245 |
|
247 | |||
246 | // task names |
|
248 | // task names | |
247 | Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' ); |
|
249 | Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' ); | |
248 | Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' ); |
|
250 | Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' ); | |
249 | Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' ); |
|
251 | Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' ); | |
250 | Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' ); |
|
252 | Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' ); | |
251 | Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' ); |
|
253 | Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' ); | |
252 | Task_name[TASKID_SWBD] = rtems_build_name( 'S', 'W', 'B', 'D' ); |
|
254 | Task_name[TASKID_SWBD] = rtems_build_name( 'S', 'W', 'B', 'D' ); | |
253 | Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' ); |
|
255 | Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' ); | |
254 | Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' ); |
|
256 | Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' ); | |
255 | Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' ); |
|
257 | Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' ); | |
256 | Task_name[TASKID_PRC0] = rtems_build_name( 'P', 'R', 'C', '0' ); |
|
258 | Task_name[TASKID_PRC0] = rtems_build_name( 'P', 'R', 'C', '0' ); | |
257 | Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' ); |
|
259 | Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' ); | |
258 | Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' ); |
|
260 | Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' ); | |
259 | Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' ); |
|
261 | Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' ); | |
260 | Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' ); |
|
262 | Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' ); | |
261 | Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' ); |
|
263 | Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' ); | |
262 | Task_name[TASKID_AVF1] = rtems_build_name( 'A', 'V', 'F', '1' ); |
|
264 | Task_name[TASKID_AVF1] = rtems_build_name( 'A', 'V', 'F', '1' ); | |
263 | Task_name[TASKID_PRC1] = rtems_build_name( 'P', 'R', 'C', '1' ); |
|
265 | Task_name[TASKID_PRC1] = rtems_build_name( 'P', 'R', 'C', '1' ); | |
264 | Task_name[TASKID_AVF2] = rtems_build_name( 'A', 'V', 'F', '2' ); |
|
266 | Task_name[TASKID_AVF2] = rtems_build_name( 'A', 'V', 'F', '2' ); | |
265 | Task_name[TASKID_PRC2] = rtems_build_name( 'P', 'R', 'C', '2' ); |
|
267 | Task_name[TASKID_PRC2] = rtems_build_name( 'P', 'R', 'C', '2' ); | |
266 |
|
268 | |||
267 | // rate monotonic period names |
|
269 | // rate monotonic period names | |
268 | name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' ); |
|
270 | name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' ); | |
269 |
|
271 | |||
270 | misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' ); |
|
272 | misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' ); | |
271 | misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' ); |
|
273 | misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' ); | |
272 | misc_name[QUEUE_PRC0] = rtems_build_name( 'Q', '_', 'P', '0' ); |
|
274 | misc_name[QUEUE_PRC0] = rtems_build_name( 'Q', '_', 'P', '0' ); | |
273 | misc_name[QUEUE_PRC1] = rtems_build_name( 'Q', '_', 'P', '1' ); |
|
275 | misc_name[QUEUE_PRC1] = rtems_build_name( 'Q', '_', 'P', '1' ); | |
274 | misc_name[QUEUE_PRC2] = rtems_build_name( 'Q', '_', 'P', '2' ); |
|
276 | misc_name[QUEUE_PRC2] = rtems_build_name( 'Q', '_', 'P', '2' ); | |
275 | } |
|
277 | } | |
276 |
|
278 | |||
277 | int create_all_tasks( void ) // create all tasks which run in the software |
|
279 | int create_all_tasks( void ) // create all tasks which run in the software | |
278 | { |
|
280 | { | |
279 | /** This function creates all RTEMS tasks used in the software. |
|
281 | /** This function creates all RTEMS tasks used in the software. | |
280 | * |
|
282 | * | |
281 | * @return RTEMS directive status codes: |
|
283 | * @return RTEMS directive status codes: | |
282 | * - RTEMS_SUCCESSFUL - task created successfully |
|
284 | * - RTEMS_SUCCESSFUL - task created successfully | |
283 | * - RTEMS_INVALID_ADDRESS - id is NULL |
|
285 | * - RTEMS_INVALID_ADDRESS - id is NULL | |
284 | * - RTEMS_INVALID_NAME - invalid task name |
|
286 | * - RTEMS_INVALID_NAME - invalid task name | |
285 | * - RTEMS_INVALID_PRIORITY - invalid task priority |
|
287 | * - RTEMS_INVALID_PRIORITY - invalid task priority | |
286 | * - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured |
|
288 | * - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured | |
287 | * - RTEMS_TOO_MANY - too many tasks created |
|
289 | * - RTEMS_TOO_MANY - too many tasks created | |
288 | * - RTEMS_UNSATISFIED - not enough memory for stack/FP context |
|
290 | * - RTEMS_UNSATISFIED - not enough memory for stack/FP context | |
289 | * - RTEMS_TOO_MANY - too many global objects |
|
291 | * - RTEMS_TOO_MANY - too many global objects | |
290 | * |
|
292 | * | |
291 | */ |
|
293 | */ | |
292 |
|
294 | |||
293 | rtems_status_code status; |
|
295 | rtems_status_code status; | |
294 |
|
296 | |||
295 | //********** |
|
297 | //********** | |
296 | // SPACEWIRE |
|
298 | // SPACEWIRE | |
297 | // RECV |
|
299 | // RECV | |
298 | status = rtems_task_create( |
|
300 | status = rtems_task_create( | |
299 | Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE, |
|
301 | Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE, | |
300 | RTEMS_DEFAULT_MODES, |
|
302 | RTEMS_DEFAULT_MODES, | |
301 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV] |
|
303 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV] | |
302 | ); |
|
304 | ); | |
303 | if (status == RTEMS_SUCCESSFUL) // SEND |
|
305 | if (status == RTEMS_SUCCESSFUL) // SEND | |
304 | { |
|
306 | { | |
305 | status = rtems_task_create( |
|
307 | status = rtems_task_create( | |
306 | Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE, |
|
308 | Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE, | |
307 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
309 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, | |
308 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SEND] |
|
310 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SEND] | |
309 | ); |
|
311 | ); | |
310 | } |
|
312 | } | |
311 | if (status == RTEMS_SUCCESSFUL) // WTDG |
|
313 | if (status == RTEMS_SUCCESSFUL) // WTDG | |
312 | { |
|
314 | { | |
313 | status = rtems_task_create( |
|
315 | status = rtems_task_create( | |
314 | Task_name[TASKID_WTDG], TASK_PRIORITY_WTDG, RTEMS_MINIMUM_STACK_SIZE, |
|
316 | Task_name[TASKID_WTDG], TASK_PRIORITY_WTDG, RTEMS_MINIMUM_STACK_SIZE, | |
315 | RTEMS_DEFAULT_MODES, |
|
317 | RTEMS_DEFAULT_MODES, | |
316 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_WTDG] |
|
318 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_WTDG] | |
317 | ); |
|
319 | ); | |
318 | } |
|
320 | } | |
319 | if (status == RTEMS_SUCCESSFUL) // ACTN |
|
321 | if (status == RTEMS_SUCCESSFUL) // ACTN | |
320 | { |
|
322 | { | |
321 | status = rtems_task_create( |
|
323 | status = rtems_task_create( | |
322 | Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE, |
|
324 | Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE, | |
323 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
325 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, | |
324 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN] |
|
326 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN] | |
325 | ); |
|
327 | ); | |
326 | } |
|
328 | } | |
327 | if (status == RTEMS_SUCCESSFUL) // SPIQ |
|
329 | if (status == RTEMS_SUCCESSFUL) // SPIQ | |
328 | { |
|
330 | { | |
329 | status = rtems_task_create( |
|
331 | status = rtems_task_create( | |
330 | Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE, |
|
332 | Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE, | |
331 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
333 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, | |
332 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ] |
|
334 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ] | |
333 | ); |
|
335 | ); | |
334 | } |
|
336 | } | |
335 |
|
337 | |||
336 | //****************** |
|
338 | //****************** | |
337 | // SPECTRAL MATRICES |
|
339 | // SPECTRAL MATRICES | |
338 | if (status == RTEMS_SUCCESSFUL) // AVF0 |
|
340 | if (status == RTEMS_SUCCESSFUL) // AVF0 | |
339 | { |
|
341 | { | |
340 | status = rtems_task_create( |
|
342 | status = rtems_task_create( | |
341 | Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE, |
|
343 | Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE, | |
342 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
344 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, | |
343 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0] |
|
345 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0] | |
344 | ); |
|
346 | ); | |
345 | } |
|
347 | } | |
346 | if (status == RTEMS_SUCCESSFUL) // PRC0 |
|
348 | if (status == RTEMS_SUCCESSFUL) // PRC0 | |
347 | { |
|
349 | { | |
348 | status = rtems_task_create( |
|
350 | status = rtems_task_create( | |
349 | Task_name[TASKID_PRC0], TASK_PRIORITY_PRC0, RTEMS_MINIMUM_STACK_SIZE * 2, |
|
351 | Task_name[TASKID_PRC0], TASK_PRIORITY_PRC0, RTEMS_MINIMUM_STACK_SIZE * 2, | |
350 | RTEMS_DEFAULT_MODES, |
|
352 | RTEMS_DEFAULT_MODES, | |
351 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC0] |
|
353 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC0] | |
352 | ); |
|
354 | ); | |
353 | } |
|
355 | } | |
354 | if (status == RTEMS_SUCCESSFUL) // AVF1 |
|
356 | if (status == RTEMS_SUCCESSFUL) // AVF1 | |
355 | { |
|
357 | { | |
356 | status = rtems_task_create( |
|
358 | status = rtems_task_create( | |
357 | Task_name[TASKID_AVF1], TASK_PRIORITY_AVF1, RTEMS_MINIMUM_STACK_SIZE, |
|
359 | Task_name[TASKID_AVF1], TASK_PRIORITY_AVF1, RTEMS_MINIMUM_STACK_SIZE, | |
358 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
360 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, | |
359 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF1] |
|
361 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF1] | |
360 | ); |
|
362 | ); | |
361 | } |
|
363 | } | |
362 | if (status == RTEMS_SUCCESSFUL) // PRC1 |
|
364 | if (status == RTEMS_SUCCESSFUL) // PRC1 | |
363 | { |
|
365 | { | |
364 | status = rtems_task_create( |
|
366 | status = rtems_task_create( | |
365 | Task_name[TASKID_PRC1], TASK_PRIORITY_PRC1, RTEMS_MINIMUM_STACK_SIZE * 2, |
|
367 | Task_name[TASKID_PRC1], TASK_PRIORITY_PRC1, RTEMS_MINIMUM_STACK_SIZE * 2, | |
366 | RTEMS_DEFAULT_MODES, |
|
368 | RTEMS_DEFAULT_MODES, | |
367 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC1] |
|
369 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC1] | |
368 | ); |
|
370 | ); | |
369 | } |
|
371 | } | |
370 | if (status == RTEMS_SUCCESSFUL) // AVF2 |
|
372 | if (status == RTEMS_SUCCESSFUL) // AVF2 | |
371 | { |
|
373 | { | |
372 | status = rtems_task_create( |
|
374 | status = rtems_task_create( | |
373 | Task_name[TASKID_AVF2], TASK_PRIORITY_AVF2, RTEMS_MINIMUM_STACK_SIZE, |
|
375 | Task_name[TASKID_AVF2], TASK_PRIORITY_AVF2, RTEMS_MINIMUM_STACK_SIZE, | |
374 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
376 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, | |
375 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF2] |
|
377 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF2] | |
376 | ); |
|
378 | ); | |
377 | } |
|
379 | } | |
378 | if (status == RTEMS_SUCCESSFUL) // PRC2 |
|
380 | if (status == RTEMS_SUCCESSFUL) // PRC2 | |
379 | { |
|
381 | { | |
380 | status = rtems_task_create( |
|
382 | status = rtems_task_create( | |
381 | Task_name[TASKID_PRC2], TASK_PRIORITY_PRC2, RTEMS_MINIMUM_STACK_SIZE * 2, |
|
383 | Task_name[TASKID_PRC2], TASK_PRIORITY_PRC2, RTEMS_MINIMUM_STACK_SIZE * 2, | |
382 | RTEMS_DEFAULT_MODES, |
|
384 | RTEMS_DEFAULT_MODES, | |
383 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC2] |
|
385 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC2] | |
384 | ); |
|
386 | ); | |
385 | } |
|
387 | } | |
386 |
|
388 | |||
387 | //**************** |
|
389 | //**************** | |
388 | // WAVEFORM PICKER |
|
390 | // WAVEFORM PICKER | |
389 | if (status == RTEMS_SUCCESSFUL) // WFRM |
|
391 | if (status == RTEMS_SUCCESSFUL) // WFRM | |
390 | { |
|
392 | { | |
391 | status = rtems_task_create( |
|
393 | status = rtems_task_create( | |
392 | Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE, |
|
394 | Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE, | |
393 | RTEMS_DEFAULT_MODES, |
|
395 | RTEMS_DEFAULT_MODES, | |
394 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM] |
|
396 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM] | |
395 | ); |
|
397 | ); | |
396 | } |
|
398 | } | |
397 | if (status == RTEMS_SUCCESSFUL) // CWF3 |
|
399 | if (status == RTEMS_SUCCESSFUL) // CWF3 | |
398 | { |
|
400 | { | |
399 | status = rtems_task_create( |
|
401 | status = rtems_task_create( | |
400 | Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE, |
|
402 | Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE, | |
401 | RTEMS_DEFAULT_MODES, |
|
403 | RTEMS_DEFAULT_MODES, | |
402 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF3] |
|
404 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF3] | |
403 | ); |
|
405 | ); | |
404 | } |
|
406 | } | |
405 | if (status == RTEMS_SUCCESSFUL) // CWF2 |
|
407 | if (status == RTEMS_SUCCESSFUL) // CWF2 | |
406 | { |
|
408 | { | |
407 | status = rtems_task_create( |
|
409 | status = rtems_task_create( | |
408 | Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE, |
|
410 | Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE, | |
409 | RTEMS_DEFAULT_MODES, |
|
411 | RTEMS_DEFAULT_MODES, | |
410 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF2] |
|
412 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF2] | |
411 | ); |
|
413 | ); | |
412 | } |
|
414 | } | |
413 | if (status == RTEMS_SUCCESSFUL) // CWF1 |
|
415 | if (status == RTEMS_SUCCESSFUL) // CWF1 | |
414 | { |
|
416 | { | |
415 | status = rtems_task_create( |
|
417 | status = rtems_task_create( | |
416 | Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE, |
|
418 | Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE, | |
417 | RTEMS_DEFAULT_MODES, |
|
419 | RTEMS_DEFAULT_MODES, | |
418 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF1] |
|
420 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF1] | |
419 | ); |
|
421 | ); | |
420 | } |
|
422 | } | |
421 | if (status == RTEMS_SUCCESSFUL) // SWBD |
|
423 | if (status == RTEMS_SUCCESSFUL) // SWBD | |
422 | { |
|
424 | { | |
423 | status = rtems_task_create( |
|
425 | status = rtems_task_create( | |
424 | Task_name[TASKID_SWBD], TASK_PRIORITY_SWBD, RTEMS_MINIMUM_STACK_SIZE, |
|
426 | Task_name[TASKID_SWBD], TASK_PRIORITY_SWBD, RTEMS_MINIMUM_STACK_SIZE, | |
425 | RTEMS_DEFAULT_MODES, |
|
427 | RTEMS_DEFAULT_MODES, | |
426 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_SWBD] |
|
428 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_SWBD] | |
427 | ); |
|
429 | ); | |
428 | } |
|
430 | } | |
429 |
|
431 | |||
430 | //***** |
|
432 | //***** | |
431 | // MISC |
|
433 | // MISC | |
432 | if (status == RTEMS_SUCCESSFUL) // STAT |
|
434 | if (status == RTEMS_SUCCESSFUL) // STAT | |
433 | { |
|
435 | { | |
434 | status = rtems_task_create( |
|
436 | status = rtems_task_create( | |
435 | Task_name[TASKID_STAT], TASK_PRIORITY_STAT, RTEMS_MINIMUM_STACK_SIZE, |
|
437 | Task_name[TASKID_STAT], TASK_PRIORITY_STAT, RTEMS_MINIMUM_STACK_SIZE, | |
436 | RTEMS_DEFAULT_MODES, |
|
438 | RTEMS_DEFAULT_MODES, | |
437 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT] |
|
439 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT] | |
438 | ); |
|
440 | ); | |
439 | } |
|
441 | } | |
440 | if (status == RTEMS_SUCCESSFUL) // DUMB |
|
442 | if (status == RTEMS_SUCCESSFUL) // DUMB | |
441 | { |
|
443 | { | |
442 | status = rtems_task_create( |
|
444 | status = rtems_task_create( | |
443 | Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE, |
|
445 | Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE, | |
444 | RTEMS_DEFAULT_MODES, |
|
446 | RTEMS_DEFAULT_MODES, | |
445 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB] |
|
447 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB] | |
446 | ); |
|
448 | ); | |
447 | } |
|
449 | } | |
448 | if (status == RTEMS_SUCCESSFUL) // HOUS |
|
450 | if (status == RTEMS_SUCCESSFUL) // HOUS | |
449 | { |
|
451 | { | |
450 | status = rtems_task_create( |
|
452 | status = rtems_task_create( | |
451 | Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE, |
|
453 | Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE, | |
452 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
454 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, | |
453 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS] |
|
455 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS] | |
454 | ); |
|
456 | ); | |
455 | } |
|
457 | } | |
456 |
|
458 | |||
457 | return status; |
|
459 | return status; | |
458 | } |
|
460 | } | |
459 |
|
461 | |||
460 | int start_recv_send_tasks( void ) |
|
462 | int start_recv_send_tasks( void ) | |
461 | { |
|
463 | { | |
462 | rtems_status_code status; |
|
464 | rtems_status_code status; | |
463 |
|
465 | |||
464 | status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 ); |
|
466 | status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 ); | |
465 | if (status!=RTEMS_SUCCESSFUL) { |
|
467 | if (status!=RTEMS_SUCCESSFUL) { | |
466 | BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n") |
|
468 | BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n") | |
467 | } |
|
469 | } | |
468 |
|
470 | |||
469 | if (status == RTEMS_SUCCESSFUL) // SEND |
|
471 | if (status == RTEMS_SUCCESSFUL) // SEND | |
470 | { |
|
472 | { | |
471 | status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 ); |
|
473 | status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 ); | |
472 | if (status!=RTEMS_SUCCESSFUL) { |
|
474 | if (status!=RTEMS_SUCCESSFUL) { | |
473 | BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n") |
|
475 | BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n") | |
474 | } |
|
476 | } | |
475 | } |
|
477 | } | |
476 |
|
478 | |||
477 | return status; |
|
479 | return status; | |
478 | } |
|
480 | } | |
479 |
|
481 | |||
480 | int start_all_tasks( void ) // start all tasks except SEND RECV and HOUS |
|
482 | int start_all_tasks( void ) // start all tasks except SEND RECV and HOUS | |
481 | { |
|
483 | { | |
482 | /** This function starts all RTEMS tasks used in the software. |
|
484 | /** This function starts all RTEMS tasks used in the software. | |
483 | * |
|
485 | * | |
484 | * @return RTEMS directive status codes: |
|
486 | * @return RTEMS directive status codes: | |
485 | * - RTEMS_SUCCESSFUL - ask started successfully |
|
487 | * - RTEMS_SUCCESSFUL - ask started successfully | |
486 | * - RTEMS_INVALID_ADDRESS - invalid task entry point |
|
488 | * - RTEMS_INVALID_ADDRESS - invalid task entry point | |
487 | * - RTEMS_INVALID_ID - invalid task id |
|
489 | * - RTEMS_INVALID_ID - invalid task id | |
488 | * - RTEMS_INCORRECT_STATE - task not in the dormant state |
|
490 | * - RTEMS_INCORRECT_STATE - task not in the dormant state | |
489 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot start remote task |
|
491 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot start remote task | |
490 | * |
|
492 | * | |
491 | */ |
|
493 | */ | |
492 | // starts all the tasks fot eh flight software |
|
494 | // starts all the tasks fot eh flight software | |
493 |
|
495 | |||
494 | rtems_status_code status; |
|
496 | rtems_status_code status; | |
495 |
|
497 | |||
496 | //********** |
|
498 | //********** | |
497 | // SPACEWIRE |
|
499 | // SPACEWIRE | |
498 | status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 ); |
|
500 | status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 ); | |
499 | if (status!=RTEMS_SUCCESSFUL) { |
|
501 | if (status!=RTEMS_SUCCESSFUL) { | |
500 | BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n") |
|
502 | BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n") | |
501 | } |
|
503 | } | |
502 |
|
504 | |||
503 | if (status == RTEMS_SUCCESSFUL) // WTDG |
|
505 | if (status == RTEMS_SUCCESSFUL) // WTDG | |
504 | { |
|
506 | { | |
505 | status = rtems_task_start( Task_id[TASKID_WTDG], wtdg_task, 1 ); |
|
507 | status = rtems_task_start( Task_id[TASKID_WTDG], wtdg_task, 1 ); | |
506 | if (status!=RTEMS_SUCCESSFUL) { |
|
508 | if (status!=RTEMS_SUCCESSFUL) { | |
507 | BOOT_PRINTF("in INIT *** Error starting TASK_WTDG\n") |
|
509 | BOOT_PRINTF("in INIT *** Error starting TASK_WTDG\n") | |
508 | } |
|
510 | } | |
509 | } |
|
511 | } | |
510 |
|
512 | |||
511 | if (status == RTEMS_SUCCESSFUL) // ACTN |
|
513 | if (status == RTEMS_SUCCESSFUL) // ACTN | |
512 | { |
|
514 | { | |
513 | status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 ); |
|
515 | status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 ); | |
514 | if (status!=RTEMS_SUCCESSFUL) { |
|
516 | if (status!=RTEMS_SUCCESSFUL) { | |
515 | BOOT_PRINTF("in INIT *** Error starting TASK_ACTN\n") |
|
517 | BOOT_PRINTF("in INIT *** Error starting TASK_ACTN\n") | |
516 | } |
|
518 | } | |
517 | } |
|
519 | } | |
518 |
|
520 | |||
519 | //****************** |
|
521 | //****************** | |
520 | // SPECTRAL MATRICES |
|
522 | // SPECTRAL MATRICES | |
521 | if (status == RTEMS_SUCCESSFUL) // AVF0 |
|
523 | if (status == RTEMS_SUCCESSFUL) // AVF0 | |
522 | { |
|
524 | { | |
523 | status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, LFR_MODE_STANDBY ); |
|
525 | status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, LFR_MODE_STANDBY ); | |
524 | if (status!=RTEMS_SUCCESSFUL) { |
|
526 | if (status!=RTEMS_SUCCESSFUL) { | |
525 | BOOT_PRINTF("in INIT *** Error starting TASK_AVF0\n") |
|
527 | BOOT_PRINTF("in INIT *** Error starting TASK_AVF0\n") | |
526 | } |
|
528 | } | |
527 | } |
|
529 | } | |
528 | if (status == RTEMS_SUCCESSFUL) // PRC0 |
|
530 | if (status == RTEMS_SUCCESSFUL) // PRC0 | |
529 | { |
|
531 | { | |
530 | status = rtems_task_start( Task_id[TASKID_PRC0], prc0_task, LFR_MODE_STANDBY ); |
|
532 | status = rtems_task_start( Task_id[TASKID_PRC0], prc0_task, LFR_MODE_STANDBY ); | |
531 | if (status!=RTEMS_SUCCESSFUL) { |
|
533 | if (status!=RTEMS_SUCCESSFUL) { | |
532 | BOOT_PRINTF("in INIT *** Error starting TASK_PRC0\n") |
|
534 | BOOT_PRINTF("in INIT *** Error starting TASK_PRC0\n") | |
533 | } |
|
535 | } | |
534 | } |
|
536 | } | |
535 | if (status == RTEMS_SUCCESSFUL) // AVF1 |
|
537 | if (status == RTEMS_SUCCESSFUL) // AVF1 | |
536 | { |
|
538 | { | |
537 | status = rtems_task_start( Task_id[TASKID_AVF1], avf1_task, LFR_MODE_STANDBY ); |
|
539 | status = rtems_task_start( Task_id[TASKID_AVF1], avf1_task, LFR_MODE_STANDBY ); | |
538 | if (status!=RTEMS_SUCCESSFUL) { |
|
540 | if (status!=RTEMS_SUCCESSFUL) { | |
539 | BOOT_PRINTF("in INIT *** Error starting TASK_AVF1\n") |
|
541 | BOOT_PRINTF("in INIT *** Error starting TASK_AVF1\n") | |
540 | } |
|
542 | } | |
541 | } |
|
543 | } | |
542 | if (status == RTEMS_SUCCESSFUL) // PRC1 |
|
544 | if (status == RTEMS_SUCCESSFUL) // PRC1 | |
543 | { |
|
545 | { | |
544 | status = rtems_task_start( Task_id[TASKID_PRC1], prc1_task, LFR_MODE_STANDBY ); |
|
546 | status = rtems_task_start( Task_id[TASKID_PRC1], prc1_task, LFR_MODE_STANDBY ); | |
545 | if (status!=RTEMS_SUCCESSFUL) { |
|
547 | if (status!=RTEMS_SUCCESSFUL) { | |
546 | BOOT_PRINTF("in INIT *** Error starting TASK_PRC1\n") |
|
548 | BOOT_PRINTF("in INIT *** Error starting TASK_PRC1\n") | |
547 | } |
|
549 | } | |
548 | } |
|
550 | } | |
549 | if (status == RTEMS_SUCCESSFUL) // AVF2 |
|
551 | if (status == RTEMS_SUCCESSFUL) // AVF2 | |
550 | { |
|
552 | { | |
551 | status = rtems_task_start( Task_id[TASKID_AVF2], avf2_task, 1 ); |
|
553 | status = rtems_task_start( Task_id[TASKID_AVF2], avf2_task, 1 ); | |
552 | if (status!=RTEMS_SUCCESSFUL) { |
|
554 | if (status!=RTEMS_SUCCESSFUL) { | |
553 | BOOT_PRINTF("in INIT *** Error starting TASK_AVF2\n") |
|
555 | BOOT_PRINTF("in INIT *** Error starting TASK_AVF2\n") | |
554 | } |
|
556 | } | |
555 | } |
|
557 | } | |
556 | if (status == RTEMS_SUCCESSFUL) // PRC2 |
|
558 | if (status == RTEMS_SUCCESSFUL) // PRC2 | |
557 | { |
|
559 | { | |
558 | status = rtems_task_start( Task_id[TASKID_PRC2], prc2_task, 1 ); |
|
560 | status = rtems_task_start( Task_id[TASKID_PRC2], prc2_task, 1 ); | |
559 | if (status!=RTEMS_SUCCESSFUL) { |
|
561 | if (status!=RTEMS_SUCCESSFUL) { | |
560 | BOOT_PRINTF("in INIT *** Error starting TASK_PRC2\n") |
|
562 | BOOT_PRINTF("in INIT *** Error starting TASK_PRC2\n") | |
561 | } |
|
563 | } | |
562 | } |
|
564 | } | |
563 |
|
565 | |||
564 | //**************** |
|
566 | //**************** | |
565 | // WAVEFORM PICKER |
|
567 | // WAVEFORM PICKER | |
566 | if (status == RTEMS_SUCCESSFUL) // WFRM |
|
568 | if (status == RTEMS_SUCCESSFUL) // WFRM | |
567 | { |
|
569 | { | |
568 | status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 ); |
|
570 | status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 ); | |
569 | if (status!=RTEMS_SUCCESSFUL) { |
|
571 | if (status!=RTEMS_SUCCESSFUL) { | |
570 | BOOT_PRINTF("in INIT *** Error starting TASK_WFRM\n") |
|
572 | BOOT_PRINTF("in INIT *** Error starting TASK_WFRM\n") | |
571 | } |
|
573 | } | |
572 | } |
|
574 | } | |
573 | if (status == RTEMS_SUCCESSFUL) // CWF3 |
|
575 | if (status == RTEMS_SUCCESSFUL) // CWF3 | |
574 | { |
|
576 | { | |
575 | status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 ); |
|
577 | status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 ); | |
576 | if (status!=RTEMS_SUCCESSFUL) { |
|
578 | if (status!=RTEMS_SUCCESSFUL) { | |
577 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF3\n") |
|
579 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF3\n") | |
578 | } |
|
580 | } | |
579 | } |
|
581 | } | |
580 | if (status == RTEMS_SUCCESSFUL) // CWF2 |
|
582 | if (status == RTEMS_SUCCESSFUL) // CWF2 | |
581 | { |
|
583 | { | |
582 | status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 ); |
|
584 | status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 ); | |
583 | if (status!=RTEMS_SUCCESSFUL) { |
|
585 | if (status!=RTEMS_SUCCESSFUL) { | |
584 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF2\n") |
|
586 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF2\n") | |
585 | } |
|
587 | } | |
586 | } |
|
588 | } | |
587 | if (status == RTEMS_SUCCESSFUL) // CWF1 |
|
589 | if (status == RTEMS_SUCCESSFUL) // CWF1 | |
588 | { |
|
590 | { | |
589 | status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 ); |
|
591 | status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 ); | |
590 | if (status!=RTEMS_SUCCESSFUL) { |
|
592 | if (status!=RTEMS_SUCCESSFUL) { | |
591 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF1\n") |
|
593 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF1\n") | |
592 | } |
|
594 | } | |
593 | } |
|
595 | } | |
594 | if (status == RTEMS_SUCCESSFUL) // SWBD |
|
596 | if (status == RTEMS_SUCCESSFUL) // SWBD | |
595 | { |
|
597 | { | |
596 | status = rtems_task_start( Task_id[TASKID_SWBD], swbd_task, 1 ); |
|
598 | status = rtems_task_start( Task_id[TASKID_SWBD], swbd_task, 1 ); | |
597 | if (status!=RTEMS_SUCCESSFUL) { |
|
599 | if (status!=RTEMS_SUCCESSFUL) { | |
598 | BOOT_PRINTF("in INIT *** Error starting TASK_SWBD\n") |
|
600 | BOOT_PRINTF("in INIT *** Error starting TASK_SWBD\n") | |
599 | } |
|
601 | } | |
600 | } |
|
602 | } | |
601 |
|
603 | |||
602 | //***** |
|
604 | //***** | |
603 | // MISC |
|
605 | // MISC | |
604 | if (status == RTEMS_SUCCESSFUL) // HOUS |
|
606 | if (status == RTEMS_SUCCESSFUL) // HOUS | |
605 | { |
|
607 | { | |
606 | status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 ); |
|
608 | status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 ); | |
607 | if (status!=RTEMS_SUCCESSFUL) { |
|
609 | if (status!=RTEMS_SUCCESSFUL) { | |
608 | BOOT_PRINTF("in INIT *** Error starting TASK_HOUS\n") |
|
610 | BOOT_PRINTF("in INIT *** Error starting TASK_HOUS\n") | |
609 | } |
|
611 | } | |
610 | } |
|
612 | } | |
611 | if (status == RTEMS_SUCCESSFUL) // DUMB |
|
613 | if (status == RTEMS_SUCCESSFUL) // DUMB | |
612 | { |
|
614 | { | |
613 | status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 ); |
|
615 | status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 ); | |
614 | if (status!=RTEMS_SUCCESSFUL) { |
|
616 | if (status!=RTEMS_SUCCESSFUL) { | |
615 | BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n") |
|
617 | BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n") | |
616 | } |
|
618 | } | |
617 | } |
|
619 | } | |
618 | if (status == RTEMS_SUCCESSFUL) // STAT |
|
620 | if (status == RTEMS_SUCCESSFUL) // STAT | |
619 | { |
|
621 | { | |
620 | status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 ); |
|
622 | status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 ); | |
621 | if (status!=RTEMS_SUCCESSFUL) { |
|
623 | if (status!=RTEMS_SUCCESSFUL) { | |
622 | BOOT_PRINTF("in INIT *** Error starting TASK_STAT\n") |
|
624 | BOOT_PRINTF("in INIT *** Error starting TASK_STAT\n") | |
623 | } |
|
625 | } | |
624 | } |
|
626 | } | |
625 |
|
627 | |||
626 | return status; |
|
628 | return status; | |
627 | } |
|
629 | } | |
628 |
|
630 | |||
629 | rtems_status_code create_message_queues( void ) // create the two message queues used in the software |
|
631 | rtems_status_code create_message_queues( void ) // create the two message queues used in the software | |
630 | { |
|
632 | { | |
631 | rtems_status_code status_recv; |
|
633 | rtems_status_code status_recv; | |
632 | rtems_status_code status_send; |
|
634 | rtems_status_code status_send; | |
633 | rtems_status_code status_q_p0; |
|
635 | rtems_status_code status_q_p0; | |
634 | rtems_status_code status_q_p1; |
|
636 | rtems_status_code status_q_p1; | |
635 | rtems_status_code status_q_p2; |
|
637 | rtems_status_code status_q_p2; | |
636 | rtems_status_code ret; |
|
638 | rtems_status_code ret; | |
637 | rtems_id queue_id; |
|
639 | rtems_id queue_id; | |
638 |
|
640 | |||
639 | //**************************************** |
|
641 | //**************************************** | |
640 | // create the queue for handling valid TCs |
|
642 | // create the queue for handling valid TCs | |
641 | status_recv = rtems_message_queue_create( misc_name[QUEUE_RECV], |
|
643 | status_recv = rtems_message_queue_create( misc_name[QUEUE_RECV], | |
642 | MSG_QUEUE_COUNT_RECV, CCSDS_TC_PKT_MAX_SIZE, |
|
644 | MSG_QUEUE_COUNT_RECV, CCSDS_TC_PKT_MAX_SIZE, | |
643 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); |
|
645 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); | |
644 | if ( status_recv != RTEMS_SUCCESSFUL ) { |
|
646 | if ( status_recv != RTEMS_SUCCESSFUL ) { | |
645 | PRINTF1("in create_message_queues *** ERR creating QUEU queue, %d\n", status_recv) |
|
647 | PRINTF1("in create_message_queues *** ERR creating QUEU queue, %d\n", status_recv) | |
646 | } |
|
648 | } | |
647 |
|
649 | |||
648 | //************************************************ |
|
650 | //************************************************ | |
649 | // create the queue for handling TM packet sending |
|
651 | // create the queue for handling TM packet sending | |
650 | status_send = rtems_message_queue_create( misc_name[QUEUE_SEND], |
|
652 | status_send = rtems_message_queue_create( misc_name[QUEUE_SEND], | |
651 | MSG_QUEUE_COUNT_SEND, MSG_QUEUE_SIZE_SEND, |
|
653 | MSG_QUEUE_COUNT_SEND, MSG_QUEUE_SIZE_SEND, | |
652 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); |
|
654 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); | |
653 | if ( status_send != RTEMS_SUCCESSFUL ) { |
|
655 | if ( status_send != RTEMS_SUCCESSFUL ) { | |
654 | PRINTF1("in create_message_queues *** ERR creating PKTS queue, %d\n", status_send) |
|
656 | PRINTF1("in create_message_queues *** ERR creating PKTS queue, %d\n", status_send) | |
655 | } |
|
657 | } | |
656 |
|
658 | |||
657 | //***************************************************************************** |
|
659 | //***************************************************************************** | |
658 | // create the queue for handling averaged spectral matrices for processing @ f0 |
|
660 | // create the queue for handling averaged spectral matrices for processing @ f0 | |
659 | status_q_p0 = rtems_message_queue_create( misc_name[QUEUE_PRC0], |
|
661 | status_q_p0 = rtems_message_queue_create( misc_name[QUEUE_PRC0], | |
660 | MSG_QUEUE_COUNT_PRC0, MSG_QUEUE_SIZE_PRC0, |
|
662 | MSG_QUEUE_COUNT_PRC0, MSG_QUEUE_SIZE_PRC0, | |
661 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); |
|
663 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); | |
662 | if ( status_q_p0 != RTEMS_SUCCESSFUL ) { |
|
664 | if ( status_q_p0 != RTEMS_SUCCESSFUL ) { | |
663 | PRINTF1("in create_message_queues *** ERR creating Q_P0 queue, %d\n", status_q_p0) |
|
665 | PRINTF1("in create_message_queues *** ERR creating Q_P0 queue, %d\n", status_q_p0) | |
664 | } |
|
666 | } | |
665 |
|
667 | |||
666 | //***************************************************************************** |
|
668 | //***************************************************************************** | |
667 | // create the queue for handling averaged spectral matrices for processing @ f1 |
|
669 | // create the queue for handling averaged spectral matrices for processing @ f1 | |
668 | status_q_p1 = rtems_message_queue_create( misc_name[QUEUE_PRC1], |
|
670 | status_q_p1 = rtems_message_queue_create( misc_name[QUEUE_PRC1], | |
669 | MSG_QUEUE_COUNT_PRC1, MSG_QUEUE_SIZE_PRC1, |
|
671 | MSG_QUEUE_COUNT_PRC1, MSG_QUEUE_SIZE_PRC1, | |
670 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); |
|
672 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); | |
671 | if ( status_q_p1 != RTEMS_SUCCESSFUL ) { |
|
673 | if ( status_q_p1 != RTEMS_SUCCESSFUL ) { | |
672 | PRINTF1("in create_message_queues *** ERR creating Q_P1 queue, %d\n", status_q_p1) |
|
674 | PRINTF1("in create_message_queues *** ERR creating Q_P1 queue, %d\n", status_q_p1) | |
673 | } |
|
675 | } | |
674 |
|
676 | |||
675 | //***************************************************************************** |
|
677 | //***************************************************************************** | |
676 | // create the queue for handling averaged spectral matrices for processing @ f2 |
|
678 | // create the queue for handling averaged spectral matrices for processing @ f2 | |
677 | status_q_p2 = rtems_message_queue_create( misc_name[QUEUE_PRC2], |
|
679 | status_q_p2 = rtems_message_queue_create( misc_name[QUEUE_PRC2], | |
678 | MSG_QUEUE_COUNT_PRC2, MSG_QUEUE_SIZE_PRC2, |
|
680 | MSG_QUEUE_COUNT_PRC2, MSG_QUEUE_SIZE_PRC2, | |
679 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); |
|
681 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); | |
680 | if ( status_q_p2 != RTEMS_SUCCESSFUL ) { |
|
682 | if ( status_q_p2 != RTEMS_SUCCESSFUL ) { | |
681 | PRINTF1("in create_message_queues *** ERR creating Q_P2 queue, %d\n", status_q_p2) |
|
683 | PRINTF1("in create_message_queues *** ERR creating Q_P2 queue, %d\n", status_q_p2) | |
682 | } |
|
684 | } | |
683 |
|
685 | |||
684 | if ( status_recv != RTEMS_SUCCESSFUL ) |
|
686 | if ( status_recv != RTEMS_SUCCESSFUL ) | |
685 | { |
|
687 | { | |
686 | ret = status_recv; |
|
688 | ret = status_recv; | |
687 | } |
|
689 | } | |
688 | else if( status_send != RTEMS_SUCCESSFUL ) |
|
690 | else if( status_send != RTEMS_SUCCESSFUL ) | |
689 | { |
|
691 | { | |
690 | ret = status_send; |
|
692 | ret = status_send; | |
691 | } |
|
693 | } | |
692 | else if( status_q_p0 != RTEMS_SUCCESSFUL ) |
|
694 | else if( status_q_p0 != RTEMS_SUCCESSFUL ) | |
693 | { |
|
695 | { | |
694 | ret = status_q_p0; |
|
696 | ret = status_q_p0; | |
695 | } |
|
697 | } | |
696 | else if( status_q_p1 != RTEMS_SUCCESSFUL ) |
|
698 | else if( status_q_p1 != RTEMS_SUCCESSFUL ) | |
697 | { |
|
699 | { | |
698 | ret = status_q_p1; |
|
700 | ret = status_q_p1; | |
699 | } |
|
701 | } | |
700 | else |
|
702 | else | |
701 | { |
|
703 | { | |
702 | ret = status_q_p2; |
|
704 | ret = status_q_p2; | |
703 | } |
|
705 | } | |
704 |
|
706 | |||
705 | return ret; |
|
707 | return ret; | |
706 | } |
|
708 | } | |
707 |
|
709 | |||
708 | rtems_status_code get_message_queue_id_send( rtems_id *queue_id ) |
|
710 | rtems_status_code get_message_queue_id_send( rtems_id *queue_id ) | |
709 | { |
|
711 | { | |
710 | rtems_status_code status; |
|
712 | rtems_status_code status; | |
711 | rtems_name queue_name; |
|
713 | rtems_name queue_name; | |
712 |
|
714 | |||
713 | queue_name = rtems_build_name( 'Q', '_', 'S', 'D' ); |
|
715 | queue_name = rtems_build_name( 'Q', '_', 'S', 'D' ); | |
714 |
|
716 | |||
715 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); |
|
717 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); | |
716 |
|
718 | |||
717 | return status; |
|
719 | return status; | |
718 | } |
|
720 | } | |
719 |
|
721 | |||
720 | rtems_status_code get_message_queue_id_recv( rtems_id *queue_id ) |
|
722 | rtems_status_code get_message_queue_id_recv( rtems_id *queue_id ) | |
721 | { |
|
723 | { | |
722 | rtems_status_code status; |
|
724 | rtems_status_code status; | |
723 | rtems_name queue_name; |
|
725 | rtems_name queue_name; | |
724 |
|
726 | |||
725 | queue_name = rtems_build_name( 'Q', '_', 'R', 'V' ); |
|
727 | queue_name = rtems_build_name( 'Q', '_', 'R', 'V' ); | |
726 |
|
728 | |||
727 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); |
|
729 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); | |
728 |
|
730 | |||
729 | return status; |
|
731 | return status; | |
730 | } |
|
732 | } | |
731 |
|
733 | |||
732 | rtems_status_code get_message_queue_id_prc0( rtems_id *queue_id ) |
|
734 | rtems_status_code get_message_queue_id_prc0( rtems_id *queue_id ) | |
733 | { |
|
735 | { | |
734 | rtems_status_code status; |
|
736 | rtems_status_code status; | |
735 | rtems_name queue_name; |
|
737 | rtems_name queue_name; | |
736 |
|
738 | |||
737 | queue_name = rtems_build_name( 'Q', '_', 'P', '0' ); |
|
739 | queue_name = rtems_build_name( 'Q', '_', 'P', '0' ); | |
738 |
|
740 | |||
739 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); |
|
741 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); | |
740 |
|
742 | |||
741 | return status; |
|
743 | return status; | |
742 | } |
|
744 | } | |
743 |
|
745 | |||
744 | rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id ) |
|
746 | rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id ) | |
745 | { |
|
747 | { | |
746 | rtems_status_code status; |
|
748 | rtems_status_code status; | |
747 | rtems_name queue_name; |
|
749 | rtems_name queue_name; | |
748 |
|
750 | |||
749 | queue_name = rtems_build_name( 'Q', '_', 'P', '1' ); |
|
751 | queue_name = rtems_build_name( 'Q', '_', 'P', '1' ); | |
750 |
|
752 | |||
751 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); |
|
753 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); | |
752 |
|
754 | |||
753 | return status; |
|
755 | return status; | |
754 | } |
|
756 | } | |
755 |
|
757 | |||
756 | rtems_status_code get_message_queue_id_prc2( rtems_id *queue_id ) |
|
758 | rtems_status_code get_message_queue_id_prc2( rtems_id *queue_id ) | |
757 | { |
|
759 | { | |
758 | rtems_status_code status; |
|
760 | rtems_status_code status; | |
759 | rtems_name queue_name; |
|
761 | rtems_name queue_name; | |
760 |
|
762 | |||
761 | queue_name = rtems_build_name( 'Q', '_', 'P', '2' ); |
|
763 | queue_name = rtems_build_name( 'Q', '_', 'P', '2' ); | |
762 |
|
764 | |||
763 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); |
|
765 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); | |
764 |
|
766 | |||
765 | return status; |
|
767 | return status; | |
766 | } |
|
768 | } |
@@ -1,501 +1,523 | |||||
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( |
|
224 | get_v_e1_e2_f3( housekeeping_packet.hk_lfr_sc_v_f3 ); | |
225 | housekeeping_packet.hk_lfr_sc_v_f3, housekeeping_packet.hk_lfr_sc_e1_f3, housekeeping_packet.hk_lfr_sc_e2_f3 ); |
|
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 | } |
|
286 | } | |
287 | } |
|
287 | } | |
288 | } |
|
288 | } | |
289 | } |
|
289 | } | |
290 |
|
290 | |||
291 | //***************************** |
|
291 | //***************************** | |
292 | // init housekeeping parameters |
|
292 | // init housekeeping parameters | |
293 |
|
293 | |||
294 | void init_housekeeping_parameters( void ) |
|
294 | void init_housekeeping_parameters( void ) | |
295 | { |
|
295 | { | |
296 | /** This function initialize the housekeeping_packet global variable with default values. |
|
296 | /** This function initialize the housekeeping_packet global variable with default values. | |
297 | * |
|
297 | * | |
298 | */ |
|
298 | */ | |
299 |
|
299 | |||
300 | unsigned int i = 0; |
|
300 | unsigned int i = 0; | |
301 | unsigned char *parameters; |
|
301 | unsigned char *parameters; | |
302 |
|
302 | |||
303 | parameters = (unsigned char*) &housekeeping_packet.lfr_status_word; |
|
303 | parameters = (unsigned char*) &housekeeping_packet.lfr_status_word; | |
304 | for(i = 0; i< SIZE_HK_PARAMETERS; i++) |
|
304 | for(i = 0; i< SIZE_HK_PARAMETERS; i++) | |
305 | { |
|
305 | { | |
306 | parameters[i] = 0x00; |
|
306 | parameters[i] = 0x00; | |
307 | } |
|
307 | } | |
308 | // init status word |
|
308 | // init status word | |
309 | housekeeping_packet.lfr_status_word[0] = DEFAULT_STATUS_WORD_BYTE0; |
|
309 | housekeeping_packet.lfr_status_word[0] = DEFAULT_STATUS_WORD_BYTE0; | |
310 | housekeeping_packet.lfr_status_word[1] = DEFAULT_STATUS_WORD_BYTE1; |
|
310 | housekeeping_packet.lfr_status_word[1] = DEFAULT_STATUS_WORD_BYTE1; | |
311 | // init software version |
|
311 | // init software version | |
312 | housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1; |
|
312 | housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1; | |
313 | housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2; |
|
313 | housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2; | |
314 | housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3; |
|
314 | housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3; | |
315 | housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4; |
|
315 | housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4; | |
316 | // init fpga version |
|
316 | // init fpga version | |
317 | parameters = (unsigned char *) (REGS_ADDR_WAVEFORM_PICKER + 0xb0); |
|
317 | parameters = (unsigned char *) (REGS_ADDR_WAVEFORM_PICKER + 0xb0); | |
318 | housekeeping_packet.lfr_fpga_version[0] = parameters[1]; // n1 |
|
318 | housekeeping_packet.lfr_fpga_version[0] = parameters[1]; // n1 | |
319 | housekeeping_packet.lfr_fpga_version[1] = parameters[2]; // n2 |
|
319 | housekeeping_packet.lfr_fpga_version[1] = parameters[2]; // n2 | |
320 | housekeeping_packet.lfr_fpga_version[2] = parameters[3]; // n3 |
|
320 | housekeeping_packet.lfr_fpga_version[2] = parameters[3]; // n3 | |
321 | } |
|
321 | } | |
322 |
|
322 | |||
323 | void increment_seq_counter( unsigned char *packet_sequence_control) |
|
323 | void increment_seq_counter( unsigned char *packet_sequence_control) | |
324 | { |
|
324 | { | |
325 | /** This function increment the sequence counter psased in argument. |
|
325 | /** This function increment the sequence counter psased in argument. | |
326 | * |
|
326 | * | |
327 | * The increment does not affect the grouping flag. In case of an overflow, the counter is reset to 0. |
|
327 | * The increment does not affect the grouping flag. In case of an overflow, the counter is reset to 0. | |
328 | * |
|
328 | * | |
329 | */ |
|
329 | */ | |
330 |
|
330 | |||
331 | unsigned short sequence_cnt; |
|
331 | unsigned short sequence_cnt; | |
332 | unsigned short segmentation_grouping_flag; |
|
332 | unsigned short segmentation_grouping_flag; | |
333 | unsigned short new_packet_sequence_control; |
|
333 | unsigned short new_packet_sequence_control; | |
334 |
|
334 | |||
335 | segmentation_grouping_flag = TM_PACKET_SEQ_CTRL_STANDALONE << 8; // keep bits 7 downto 6 |
|
335 | segmentation_grouping_flag = TM_PACKET_SEQ_CTRL_STANDALONE << 8; // keep bits 7 downto 6 | |
336 | sequence_cnt = (unsigned short) ( |
|
336 | sequence_cnt = (unsigned short) ( | |
337 | ( (packet_sequence_control[0] & 0x3f) << 8 ) // keep bits 5 downto 0 |
|
337 | ( (packet_sequence_control[0] & 0x3f) << 8 ) // keep bits 5 downto 0 | |
338 | + packet_sequence_control[1] |
|
338 | + packet_sequence_control[1] | |
339 | ); |
|
339 | ); | |
340 |
|
340 | |||
341 | if ( sequence_cnt < SEQ_CNT_MAX) |
|
341 | if ( sequence_cnt < SEQ_CNT_MAX) | |
342 | { |
|
342 | { | |
343 | sequence_cnt = sequence_cnt + 1; |
|
343 | sequence_cnt = sequence_cnt + 1; | |
344 | } |
|
344 | } | |
345 | else |
|
345 | else | |
346 | { |
|
346 | { | |
347 | sequence_cnt = 0; |
|
347 | sequence_cnt = 0; | |
348 | } |
|
348 | } | |
349 |
|
349 | |||
350 | new_packet_sequence_control = segmentation_grouping_flag | sequence_cnt ; |
|
350 | new_packet_sequence_control = segmentation_grouping_flag | sequence_cnt ; | |
351 |
|
351 | |||
352 | packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8); |
|
352 | packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8); | |
353 | packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control ); |
|
353 | packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control ); | |
354 | } |
|
354 | } | |
355 |
|
355 | |||
356 | void getTime( unsigned char *time) |
|
356 | void getTime( unsigned char *time) | |
357 | { |
|
357 | { | |
358 | /** This function write the current local time in the time buffer passed in argument. |
|
358 | /** This function write the current local time in the time buffer passed in argument. | |
359 | * |
|
359 | * | |
360 | */ |
|
360 | */ | |
361 |
|
361 | |||
362 | time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
362 | time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
363 | time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
363 | time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
364 | time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
364 | time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
365 | time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
365 | time[3] = (unsigned char) (time_management_regs->coarse_time); | |
366 | time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
366 | time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
367 | time[5] = (unsigned char) (time_management_regs->fine_time); |
|
367 | time[5] = (unsigned char) (time_management_regs->fine_time); | |
368 | } |
|
368 | } | |
369 |
|
369 | |||
370 | unsigned long long int getTimeAsUnsignedLongLongInt( ) |
|
370 | unsigned long long int getTimeAsUnsignedLongLongInt( ) | |
371 | { |
|
371 | { | |
372 | /** This function write the current local time in the time buffer passed in argument. |
|
372 | /** This function write the current local time in the time buffer passed in argument. | |
373 | * |
|
373 | * | |
374 | */ |
|
374 | */ | |
375 | unsigned long long int time; |
|
375 | unsigned long long int time; | |
376 |
|
376 | |||
377 | time = ( (unsigned long long int) (time_management_regs->coarse_time & 0x7fffffff) << 16 ) |
|
377 | time = ( (unsigned long long int) (time_management_regs->coarse_time & 0x7fffffff) << 16 ) | |
378 | + time_management_regs->fine_time; |
|
378 | + time_management_regs->fine_time; | |
379 |
|
379 | |||
380 | return time; |
|
380 | return time; | |
381 | } |
|
381 | } | |
382 |
|
382 | |||
383 | void send_dumb_hk( void ) |
|
383 | void send_dumb_hk( void ) | |
384 | { |
|
384 | { | |
385 | Packet_TM_LFR_HK_t dummy_hk_packet; |
|
385 | Packet_TM_LFR_HK_t dummy_hk_packet; | |
386 | unsigned char *parameters; |
|
386 | unsigned char *parameters; | |
387 | unsigned int i; |
|
387 | unsigned int i; | |
388 | rtems_id queue_id; |
|
388 | rtems_id queue_id; | |
389 |
|
389 | |||
390 | dummy_hk_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
390 | dummy_hk_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; | |
391 | dummy_hk_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
391 | dummy_hk_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
392 | dummy_hk_packet.reserved = DEFAULT_RESERVED; |
|
392 | dummy_hk_packet.reserved = DEFAULT_RESERVED; | |
393 | dummy_hk_packet.userApplication = CCSDS_USER_APP; |
|
393 | dummy_hk_packet.userApplication = CCSDS_USER_APP; | |
394 | dummy_hk_packet.packetID[0] = (unsigned char) (APID_TM_HK >> 8); |
|
394 | dummy_hk_packet.packetID[0] = (unsigned char) (APID_TM_HK >> 8); | |
395 | dummy_hk_packet.packetID[1] = (unsigned char) (APID_TM_HK); |
|
395 | dummy_hk_packet.packetID[1] = (unsigned char) (APID_TM_HK); | |
396 | dummy_hk_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
396 | dummy_hk_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
397 | dummy_hk_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
397 | dummy_hk_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
398 | dummy_hk_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8); |
|
398 | dummy_hk_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8); | |
399 | dummy_hk_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK ); |
|
399 | dummy_hk_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK ); | |
400 | dummy_hk_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
400 | dummy_hk_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
401 | dummy_hk_packet.serviceType = TM_TYPE_HK; |
|
401 | dummy_hk_packet.serviceType = TM_TYPE_HK; | |
402 | dummy_hk_packet.serviceSubType = TM_SUBTYPE_HK; |
|
402 | dummy_hk_packet.serviceSubType = TM_SUBTYPE_HK; | |
403 | dummy_hk_packet.destinationID = TM_DESTINATION_ID_GROUND; |
|
403 | dummy_hk_packet.destinationID = TM_DESTINATION_ID_GROUND; | |
404 | dummy_hk_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
404 | dummy_hk_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
405 | dummy_hk_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
405 | dummy_hk_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
406 | dummy_hk_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
406 | dummy_hk_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
407 | dummy_hk_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
407 | dummy_hk_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); | |
408 | dummy_hk_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
408 | dummy_hk_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
409 | dummy_hk_packet.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
409 | dummy_hk_packet.time[5] = (unsigned char) (time_management_regs->fine_time); | |
410 | dummy_hk_packet.sid = SID_HK; |
|
410 | dummy_hk_packet.sid = SID_HK; | |
411 |
|
411 | |||
412 | // init status word |
|
412 | // init status word | |
413 | dummy_hk_packet.lfr_status_word[0] = 0xff; |
|
413 | dummy_hk_packet.lfr_status_word[0] = 0xff; | |
414 | dummy_hk_packet.lfr_status_word[1] = 0xff; |
|
414 | dummy_hk_packet.lfr_status_word[1] = 0xff; | |
415 | // init software version |
|
415 | // init software version | |
416 | dummy_hk_packet.lfr_sw_version[0] = SW_VERSION_N1; |
|
416 | dummy_hk_packet.lfr_sw_version[0] = SW_VERSION_N1; | |
417 | dummy_hk_packet.lfr_sw_version[1] = SW_VERSION_N2; |
|
417 | dummy_hk_packet.lfr_sw_version[1] = SW_VERSION_N2; | |
418 | dummy_hk_packet.lfr_sw_version[2] = SW_VERSION_N3; |
|
418 | dummy_hk_packet.lfr_sw_version[2] = SW_VERSION_N3; | |
419 | dummy_hk_packet.lfr_sw_version[3] = SW_VERSION_N4; |
|
419 | dummy_hk_packet.lfr_sw_version[3] = SW_VERSION_N4; | |
420 | // init fpga version |
|
420 | // init fpga version | |
421 | parameters = (unsigned char *) (REGS_ADDR_WAVEFORM_PICKER + 0xb0); |
|
421 | parameters = (unsigned char *) (REGS_ADDR_WAVEFORM_PICKER + 0xb0); | |
422 | dummy_hk_packet.lfr_fpga_version[0] = parameters[1]; // n1 |
|
422 | dummy_hk_packet.lfr_fpga_version[0] = parameters[1]; // n1 | |
423 | dummy_hk_packet.lfr_fpga_version[1] = parameters[2]; // n2 |
|
423 | dummy_hk_packet.lfr_fpga_version[1] = parameters[2]; // n2 | |
424 | dummy_hk_packet.lfr_fpga_version[2] = parameters[3]; // n3 |
|
424 | dummy_hk_packet.lfr_fpga_version[2] = parameters[3]; // n3 | |
425 |
|
425 | |||
426 | parameters = (unsigned char *) &dummy_hk_packet.hk_lfr_cpu_load; |
|
426 | parameters = (unsigned char *) &dummy_hk_packet.hk_lfr_cpu_load; | |
427 |
|
427 | |||
428 | for (i=0; i<100; i++) |
|
428 | for (i=0; i<100; i++) | |
429 | { |
|
429 | { | |
430 | parameters[i] = 0xff; |
|
430 | parameters[i] = 0xff; | |
431 | } |
|
431 | } | |
432 |
|
432 | |||
433 | get_message_queue_id_send( &queue_id ); |
|
433 | get_message_queue_id_send( &queue_id ); | |
434 |
|
434 | |||
435 | rtems_message_queue_urgent( queue_id, &dummy_hk_packet, |
|
435 | rtems_message_queue_urgent( queue_id, &dummy_hk_packet, | |
436 | PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES); |
|
436 | PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES); | |
437 | } |
|
437 | } | |
438 |
|
438 | |||
439 |
void get_v_e1_e2_f3( unsigned char * |
|
439 | void get_v_e1_e2_f3( unsigned char *spacecraft_potential ) | |
440 | { |
|
440 | { | |
441 | unsigned int coarseTime; |
|
441 | unsigned int coarseTime; | |
442 | unsigned int acquisitionTime; |
|
442 | unsigned int acquisitionTime; | |
443 | unsigned int deltaT = 0; |
|
443 | unsigned int deltaT = 0; | |
444 | unsigned char *bufferPtr; |
|
444 | unsigned char *bufferPtr; | |
445 |
|
445 | |||
446 | unsigned int offset_in_samples; |
|
446 | unsigned int offset_in_samples; | |
447 | unsigned int offset_in_bytes; |
|
447 | unsigned int offset_in_bytes; | |
448 | unsigned char f3 = 16; // v, e1 and e2 will be picked up each second, f3 = 16 Hz |
|
448 | unsigned char f3 = 16; // v, e1 and e2 will be picked up each second, f3 = 16 Hz | |
449 |
|
449 | |||
450 | if (lfrCurrentMode == LFR_MODE_STANDBY) |
|
450 | if (lfrCurrentMode == LFR_MODE_STANDBY) | |
451 | { |
|
451 | { | |
452 |
|
|
452 | spacecraft_potential[0] = 0x00; | |
453 |
|
|
453 | spacecraft_potential[1] = 0x00; | |
454 |
|
|
454 | spacecraft_potential[2] = 0x00; | |
455 |
|
|
455 | spacecraft_potential[3] = 0x00; | |
456 |
|
|
456 | spacecraft_potential[4] = 0x00; | |
457 |
|
|
457 | spacecraft_potential[5] = 0x00; | |
458 | } |
|
458 | } | |
459 | else |
|
459 | else | |
460 | { |
|
460 | { | |
461 | coarseTime = time_management_regs->coarse_time & 0x7fffffff; |
|
461 | coarseTime = time_management_regs->coarse_time & 0x7fffffff; | |
462 | bufferPtr = (unsigned char*) current_ring_node_f3->buffer_address; |
|
462 | bufferPtr = (unsigned char*) current_ring_node_f3->buffer_address; | |
463 | acquisitionTime = (unsigned int) ( ( bufferPtr[2] & 0x7f ) << 24 ) |
|
463 | acquisitionTime = (unsigned int) ( ( bufferPtr[2] & 0x7f ) << 24 ) | |
464 | + (unsigned int) ( bufferPtr[3] << 16 ) |
|
464 | + (unsigned int) ( bufferPtr[3] << 16 ) | |
465 | + (unsigned int) ( bufferPtr[0] << 8 ) |
|
465 | + (unsigned int) ( bufferPtr[0] << 8 ) | |
466 | + (unsigned int) ( bufferPtr[1] ); |
|
466 | + (unsigned int) ( bufferPtr[1] ); | |
467 | if ( coarseTime > acquisitionTime ) |
|
467 | if ( coarseTime > acquisitionTime ) | |
468 | { |
|
468 | { | |
469 | deltaT = coarseTime - acquisitionTime; |
|
469 | deltaT = coarseTime - acquisitionTime; | |
470 | offset_in_samples = (deltaT-1) * f3 ; |
|
470 | offset_in_samples = (deltaT-1) * f3 ; | |
471 | } |
|
471 | } | |
472 | else if( coarseTime == acquisitionTime ) |
|
472 | else if( coarseTime == acquisitionTime ) | |
473 | { |
|
473 | { | |
474 | bufferPtr = (unsigned char*) current_ring_node_f3->previous->buffer_address; // pick up v e1 and e2 in the previous f3 buffer |
|
474 | bufferPtr = (unsigned char*) current_ring_node_f3->previous->buffer_address; // pick up v e1 and e2 in the previous f3 buffer | |
475 | offset_in_samples = NB_SAMPLES_PER_SNAPSHOT-1; |
|
475 | offset_in_samples = NB_SAMPLES_PER_SNAPSHOT-1; | |
476 | } |
|
476 | } | |
477 | else |
|
477 | else | |
478 | { |
|
478 | { | |
479 | offset_in_samples = 0; |
|
479 | offset_in_samples = 0; | |
480 | PRINTF2("ERR *** in get_v_e1_e2_f3 *** coarseTime = %x, acquisitionTime = %x\n", coarseTime, acquisitionTime) |
|
480 | PRINTF2("ERR *** in get_v_e1_e2_f3 *** coarseTime = %x, acquisitionTime = %x\n", coarseTime, acquisitionTime) | |
481 | } |
|
481 | } | |
482 |
|
482 | |||
483 | if ( offset_in_samples > (NB_SAMPLES_PER_SNAPSHOT - 1) ) |
|
483 | if ( offset_in_samples > (NB_SAMPLES_PER_SNAPSHOT - 1) ) | |
484 | { |
|
484 | { | |
485 | PRINTF1("ERR *** in get_v_e1_e2_f3 *** trying to read out of the buffer, counter = %d\n", offset_in_samples) |
|
485 | PRINTF1("ERR *** in get_v_e1_e2_f3 *** trying to read out of the buffer, counter = %d\n", offset_in_samples) | |
486 | offset_in_samples = NB_SAMPLES_PER_SNAPSHOT -1; |
|
486 | offset_in_samples = NB_SAMPLES_PER_SNAPSHOT -1; | |
487 | } |
|
487 | } | |
488 | offset_in_bytes = TIME_OFFSET_IN_BYTES + offset_in_samples * NB_WORDS_SWF_BLK * 4; |
|
488 | offset_in_bytes = TIME_OFFSET_IN_BYTES + offset_in_samples * NB_WORDS_SWF_BLK * 4; | |
489 |
|
|
489 | spacecraft_potential[0] = bufferPtr[ offset_in_bytes + 0]; | |
490 |
|
|
490 | spacecraft_potential[1] = bufferPtr[ offset_in_bytes + 1]; | |
491 |
|
|
491 | spacecraft_potential[2] = bufferPtr[ offset_in_bytes + 2]; | |
492 |
|
|
492 | spacecraft_potential[3] = bufferPtr[ offset_in_bytes + 3]; | |
493 |
|
|
493 | spacecraft_potential[4] = bufferPtr[ offset_in_bytes + 4]; | |
494 |
|
|
494 | spacecraft_potential[5] = bufferPtr[ offset_in_bytes + 5]; | |
|
495 | } | |||
495 | } |
|
496 | } | |
|
497 | ||||
|
498 | void get_cpu_load( unsigned char *resource_statistics ) | |||
|
499 | { | |||
|
500 | unsigned char cpu_load; | |||
|
501 | ||||
|
502 | cpu_load = lfr_rtems_cpu_usage_report(); | |||
|
503 | ||||
|
504 | // HK_LFR_CPU_LOAD | |||
|
505 | resource_statistics[0] = cpu_load; | |||
|
506 | ||||
|
507 | // HK_LFR_CPU_LOAD_MAX | |||
|
508 | if (cpu_load > resource_statistics[1]) | |||
|
509 | { | |||
|
510 | resource_statistics[1] = cpu_load; | |||
|
511 | } | |||
|
512 | ||||
|
513 | // CPU_LOAD_AVE | |||
|
514 | resource_statistics[2] = 0; | |||
|
515 | ||||
|
516 | #ifndef PRINT_TASK_STATISTICS | |||
|
517 | rtems_cpu_usage_reset(); | |||
|
518 | #endif | |||
|
519 | ||||
496 | } |
|
520 | } | |
497 |
|
521 | |||
498 |
|
522 | |||
499 |
|
523 | |||
500 |
|
||||
501 |
|
@@ -1,370 +1,370 | |||||
1 | /** Functions related to data processing. |
|
1 | /** Functions related to data processing. | |
2 | * |
|
2 | * | |
3 | * @file |
|
3 | * @file | |
4 | * @author P. LEROY |
|
4 | * @author P. LEROY | |
5 | * |
|
5 | * | |
6 | * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation. |
|
6 | * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation. | |
7 | * |
|
7 | * | |
8 | */ |
|
8 | */ | |
9 |
|
9 | |||
10 | #include "avf0_prc0.h" |
|
10 | #include "avf0_prc0.h" | |
11 | #include "fsw_processing.h" |
|
11 | #include "fsw_processing.h" | |
12 |
|
12 | |||
13 | nb_sm_before_bp_asm_f0 nb_sm_before_f0; |
|
13 | nb_sm_before_bp_asm_f0 nb_sm_before_f0; | |
14 |
|
14 | |||
15 | //*** |
|
15 | //*** | |
16 | // F0 |
|
16 | // F0 | |
17 | ring_node_asm asm_ring_norm_f0 [ NB_RING_NODES_ASM_NORM_F0 ]; |
|
17 | ring_node_asm asm_ring_norm_f0 [ NB_RING_NODES_ASM_NORM_F0 ]; | |
18 | ring_node_asm asm_ring_burst_sbm_f0[ NB_RING_NODES_ASM_BURST_SBM_F0 ]; |
|
18 | ring_node_asm asm_ring_burst_sbm_f0[ NB_RING_NODES_ASM_BURST_SBM_F0 ]; | |
19 |
|
19 | |||
20 | float asm_f0_reorganized [ TOTAL_SIZE_SM ]; |
|
20 | float asm_f0_reorganized [ TOTAL_SIZE_SM ]; | |
21 | char asm_f0_char [ TIME_OFFSET_IN_BYTES + (TOTAL_SIZE_SM * 2) ]; |
|
21 | char asm_f0_char [ TIME_OFFSET_IN_BYTES + (TOTAL_SIZE_SM * 2) ]; | |
22 | float compressed_sm_norm_f0[ TOTAL_SIZE_COMPRESSED_ASM_NORM_F0]; |
|
22 | float compressed_sm_norm_f0[ TOTAL_SIZE_COMPRESSED_ASM_NORM_F0]; | |
23 | float compressed_sm_sbm_f0 [ TOTAL_SIZE_COMPRESSED_ASM_SBM_F0 ]; |
|
23 | float compressed_sm_sbm_f0 [ TOTAL_SIZE_COMPRESSED_ASM_SBM_F0 ]; | |
24 | //unsigned char bp1_norm_f0 [ TOTAL_SIZE_BP1_NORM_F0 ]; |
|
24 | //unsigned char bp1_norm_f0 [ TOTAL_SIZE_BP1_NORM_F0 ]; | |
25 | //unsigned char bp1_sbm_f0 [ TOTAL_SIZE_BP1_SBM_F0 ]; |
|
25 | //unsigned char bp1_sbm_f0 [ TOTAL_SIZE_BP1_SBM_F0 ]; | |
26 |
|
26 | |||
27 | //************ |
|
27 | //************ | |
28 | // RTEMS TASKS |
|
28 | // RTEMS TASKS | |
29 |
|
29 | |||
30 | rtems_task avf0_task( rtems_task_argument lfrRequestedMode ) |
|
30 | rtems_task avf0_task( rtems_task_argument lfrRequestedMode ) | |
31 | { |
|
31 | { | |
32 | int i; |
|
32 | int i; | |
33 |
|
33 | |||
34 | rtems_event_set event_out; |
|
34 | rtems_event_set event_out; | |
35 | rtems_status_code status; |
|
35 | rtems_status_code status; | |
36 | rtems_id queue_id_prc0; |
|
36 | rtems_id queue_id_prc0; | |
37 | asm_msg msgForMATR; |
|
37 | asm_msg msgForMATR; | |
38 | ring_node_sm *ring_node_tab[8]; |
|
38 | ring_node_sm *ring_node_tab[8]; | |
39 | ring_node_asm *current_ring_node_asm_burst_sbm_f0; |
|
39 | ring_node_asm *current_ring_node_asm_burst_sbm_f0; | |
40 | ring_node_asm *current_ring_node_asm_norm_f0; |
|
40 | ring_node_asm *current_ring_node_asm_norm_f0; | |
41 |
|
41 | |||
42 | unsigned int nb_norm_bp1; |
|
42 | unsigned int nb_norm_bp1; | |
43 | unsigned int nb_norm_bp2; |
|
43 | unsigned int nb_norm_bp2; | |
44 | unsigned int nb_norm_asm; |
|
44 | unsigned int nb_norm_asm; | |
45 | unsigned int nb_sbm_bp1; |
|
45 | unsigned int nb_sbm_bp1; | |
46 | unsigned int nb_sbm_bp2; |
|
46 | unsigned int nb_sbm_bp2; | |
47 |
|
47 | |||
48 | nb_norm_bp1 = 0; |
|
48 | nb_norm_bp1 = 0; | |
49 | nb_norm_bp2 = 0; |
|
49 | nb_norm_bp2 = 0; | |
50 | nb_norm_asm = 0; |
|
50 | nb_norm_asm = 0; | |
51 | nb_sbm_bp1 = 0; |
|
51 | nb_sbm_bp1 = 0; | |
52 | nb_sbm_bp2 = 0; |
|
52 | nb_sbm_bp2 = 0; | |
53 |
|
53 | |||
54 | reset_nb_sm_f0( lfrRequestedMode ); // reset the sm counters that drive the BP and ASM computations / transmissions |
|
54 | reset_nb_sm_f0( lfrRequestedMode ); // reset the sm counters that drive the BP and ASM computations / transmissions | |
55 | ASM_generic_init_ring( asm_ring_norm_f0, NB_RING_NODES_ASM_NORM_F0 ); |
|
55 | ASM_generic_init_ring( asm_ring_norm_f0, NB_RING_NODES_ASM_NORM_F0 ); | |
56 | ASM_generic_init_ring( asm_ring_burst_sbm_f0, NB_RING_NODES_ASM_BURST_SBM_F0 ); |
|
56 | ASM_generic_init_ring( asm_ring_burst_sbm_f0, NB_RING_NODES_ASM_BURST_SBM_F0 ); | |
57 | current_ring_node_asm_norm_f0 = asm_ring_norm_f0; |
|
57 | current_ring_node_asm_norm_f0 = asm_ring_norm_f0; | |
58 | current_ring_node_asm_burst_sbm_f0 = asm_ring_burst_sbm_f0; |
|
58 | current_ring_node_asm_burst_sbm_f0 = asm_ring_burst_sbm_f0; | |
59 |
|
59 | |||
60 | BOOT_PRINTF1("in AVFO *** lfrRequestedMode = %d\n", (int) lfrRequestedMode) |
|
60 | BOOT_PRINTF1("in AVFO *** lfrRequestedMode = %d\n", (int) lfrRequestedMode) | |
61 |
|
61 | |||
62 | status = get_message_queue_id_prc0( &queue_id_prc0 ); |
|
62 | status = get_message_queue_id_prc0( &queue_id_prc0 ); | |
63 | if (status != RTEMS_SUCCESSFUL) |
|
63 | if (status != RTEMS_SUCCESSFUL) | |
64 | { |
|
64 | { | |
65 | PRINTF1("in MATR *** ERR get_message_queue_id_prc0 %d\n", status) |
|
65 | PRINTF1("in MATR *** ERR get_message_queue_id_prc0 %d\n", status) | |
66 | } |
|
66 | } | |
67 |
|
67 | |||
68 | while(1){ |
|
68 | while(1){ | |
69 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
69 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 | |
70 | ring_node_tab[NB_SM_BEFORE_AVF0-1] = ring_node_for_averaging_sm_f0; |
|
70 | ring_node_tab[NB_SM_BEFORE_AVF0-1] = ring_node_for_averaging_sm_f0; | |
71 | for ( i = 2; i < (NB_SM_BEFORE_AVF0+1); i++ ) |
|
71 | for ( i = 2; i < (NB_SM_BEFORE_AVF0+1); i++ ) | |
72 | { |
|
72 | { | |
73 | ring_node_for_averaging_sm_f0 = ring_node_for_averaging_sm_f0->previous; |
|
73 | ring_node_for_averaging_sm_f0 = ring_node_for_averaging_sm_f0->previous; | |
74 | ring_node_tab[NB_SM_BEFORE_AVF0-i] = ring_node_for_averaging_sm_f0; |
|
74 | ring_node_tab[NB_SM_BEFORE_AVF0-i] = ring_node_for_averaging_sm_f0; | |
75 | } |
|
75 | } | |
76 |
|
76 | |||
77 | // compute the average and store it in the averaged_sm_f1 buffer |
|
77 | // compute the average and store it in the averaged_sm_f1 buffer | |
78 | SM_average( current_ring_node_asm_norm_f0->matrix, |
|
78 | SM_average( current_ring_node_asm_norm_f0->matrix, | |
79 | current_ring_node_asm_burst_sbm_f0->matrix, |
|
79 | current_ring_node_asm_burst_sbm_f0->matrix, | |
80 | ring_node_tab, |
|
80 | ring_node_tab, | |
81 | nb_norm_bp1, nb_sbm_bp1 ); |
|
81 | nb_norm_bp1, nb_sbm_bp1 ); | |
82 |
|
82 | |||
83 | // update nb_average |
|
83 | // update nb_average | |
84 | nb_norm_bp1 = nb_norm_bp1 + NB_SM_BEFORE_AVF0; |
|
84 | nb_norm_bp1 = nb_norm_bp1 + NB_SM_BEFORE_AVF0; | |
85 | nb_norm_bp2 = nb_norm_bp2 + NB_SM_BEFORE_AVF0; |
|
85 | nb_norm_bp2 = nb_norm_bp2 + NB_SM_BEFORE_AVF0; | |
86 | nb_norm_asm = nb_norm_asm + NB_SM_BEFORE_AVF0; |
|
86 | nb_norm_asm = nb_norm_asm + NB_SM_BEFORE_AVF0; | |
87 | nb_sbm_bp1 = nb_sbm_bp1 + NB_SM_BEFORE_AVF0; |
|
87 | nb_sbm_bp1 = nb_sbm_bp1 + NB_SM_BEFORE_AVF0; | |
88 | nb_sbm_bp2 = nb_sbm_bp2 + NB_SM_BEFORE_AVF0; |
|
88 | nb_sbm_bp2 = nb_sbm_bp2 + NB_SM_BEFORE_AVF0; | |
89 |
|
89 | |||
90 | //**************************************** |
|
90 | //**************************************** | |
91 | // initialize the mesage for the MATR task |
|
91 | // initialize the mesage for the MATR task | |
92 | msgForMATR.event = 0x00; // this composite event will be sent to the MATR task |
|
92 | msgForMATR.event = 0x00; // this composite event will be sent to the MATR task | |
93 | msgForMATR.burst_sbm = current_ring_node_asm_burst_sbm_f0; |
|
93 | msgForMATR.burst_sbm = current_ring_node_asm_burst_sbm_f0; | |
94 | msgForMATR.norm = current_ring_node_asm_norm_f0; |
|
94 | msgForMATR.norm = current_ring_node_asm_norm_f0; | |
95 | // msgForMATR.coarseTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[0]; |
|
95 | // msgForMATR.coarseTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[0]; | |
96 | // msgForMATR.fineTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[1]; |
|
96 | // msgForMATR.fineTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[1]; | |
97 | msgForMATR.coarseTime = time_management_regs->coarse_time; |
|
97 | msgForMATR.coarseTime = time_management_regs->coarse_time; | |
98 | msgForMATR.fineTime = time_management_regs->fine_time; |
|
98 | msgForMATR.fineTime = time_management_regs->fine_time; | |
99 |
|
99 | |||
100 | if (nb_sbm_bp1 == nb_sm_before_f0.burst_sbm_bp1) |
|
100 | if (nb_sbm_bp1 == nb_sm_before_f0.burst_sbm_bp1) | |
101 | { |
|
101 | { | |
102 | nb_sbm_bp1 = 0; |
|
102 | nb_sbm_bp1 = 0; | |
103 | // set another ring for the ASM storage |
|
103 | // set another ring for the ASM storage | |
104 | current_ring_node_asm_burst_sbm_f0 = current_ring_node_asm_burst_sbm_f0->next; |
|
104 | current_ring_node_asm_burst_sbm_f0 = current_ring_node_asm_burst_sbm_f0->next; | |
105 | if ( (lfrCurrentMode == LFR_MODE_BURST) |
|
105 | if ( (lfrCurrentMode == LFR_MODE_BURST) | |
106 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
106 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) | |
107 | { |
|
107 | { | |
108 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_SBM_BP1_F0; |
|
108 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_SBM_BP1_F0; | |
109 | } |
|
109 | } | |
110 | } |
|
110 | } | |
111 |
|
111 | |||
112 | if (nb_sbm_bp2 == nb_sm_before_f0.burst_sbm_bp2) |
|
112 | if (nb_sbm_bp2 == nb_sm_before_f0.burst_sbm_bp2) | |
113 | { |
|
113 | { | |
114 | nb_sbm_bp2 = 0; |
|
114 | nb_sbm_bp2 = 0; | |
115 | if ( (lfrCurrentMode == LFR_MODE_BURST) |
|
115 | if ( (lfrCurrentMode == LFR_MODE_BURST) | |
116 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
116 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) | |
117 | { |
|
117 | { | |
118 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_SBM_BP2_F0; |
|
118 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_SBM_BP2_F0; | |
119 | } |
|
119 | } | |
120 | } |
|
120 | } | |
121 |
|
121 | |||
122 | if (nb_norm_bp1 == nb_sm_before_f0.norm_bp1) |
|
122 | if (nb_norm_bp1 == nb_sm_before_f0.norm_bp1) | |
123 | { |
|
123 | { | |
124 | nb_norm_bp1 = 0; |
|
124 | nb_norm_bp1 = 0; | |
125 | // set another ring for the ASM storage |
|
125 | // set another ring for the ASM storage | |
126 | current_ring_node_asm_norm_f0 = current_ring_node_asm_norm_f0->next; |
|
126 | current_ring_node_asm_norm_f0 = current_ring_node_asm_norm_f0->next; | |
127 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) |
|
127 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) | |
128 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
128 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) | |
129 | { |
|
129 | { | |
130 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP1_F0; |
|
130 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP1_F0; | |
131 | } |
|
131 | } | |
132 | } |
|
132 | } | |
133 |
|
133 | |||
134 | if (nb_norm_bp2 == nb_sm_before_f0.norm_bp2) |
|
134 | if (nb_norm_bp2 == nb_sm_before_f0.norm_bp2) | |
135 | { |
|
135 | { | |
136 | nb_norm_bp2 = 0; |
|
136 | nb_norm_bp2 = 0; | |
137 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) |
|
137 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) | |
138 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
138 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) | |
139 | { |
|
139 | { | |
140 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP2_F0; |
|
140 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP2_F0; | |
141 | } |
|
141 | } | |
142 | } |
|
142 | } | |
143 |
|
143 | |||
144 | if (nb_norm_asm == nb_sm_before_f0.norm_asm) |
|
144 | if (nb_norm_asm == nb_sm_before_f0.norm_asm) | |
145 | { |
|
145 | { | |
146 | nb_norm_asm = 0; |
|
146 | nb_norm_asm = 0; | |
147 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) |
|
147 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) | |
148 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
148 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) | |
149 | { |
|
149 | { | |
150 | // PRINTF1("%lld\n", localTime) |
|
150 | // PRINTF1("%lld\n", localTime) | |
151 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_ASM_F0; |
|
151 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_ASM_F0; | |
152 | } |
|
152 | } | |
153 | } |
|
153 | } | |
154 |
|
154 | |||
155 | //************************* |
|
155 | //************************* | |
156 | // send the message to MATR |
|
156 | // send the message to MATR | |
157 | if (msgForMATR.event != 0x00) |
|
157 | if (msgForMATR.event != 0x00) | |
158 | { |
|
158 | { | |
159 | status = rtems_message_queue_send( queue_id_prc0, (char *) &msgForMATR, MSG_QUEUE_SIZE_PRC0); |
|
159 | status = rtems_message_queue_send( queue_id_prc0, (char *) &msgForMATR, MSG_QUEUE_SIZE_PRC0); | |
160 | } |
|
160 | } | |
161 |
|
161 | |||
162 | if (status != RTEMS_SUCCESSFUL) { |
|
162 | if (status != RTEMS_SUCCESSFUL) { | |
163 | printf("in AVF0 *** Error sending message to MATR, code %d\n", status); |
|
163 | printf("in AVF0 *** Error sending message to MATR, code %d\n", status); | |
164 | } |
|
164 | } | |
165 | } |
|
165 | } | |
166 | } |
|
166 | } | |
167 |
|
167 | |||
168 | rtems_task prc0_task( rtems_task_argument lfrRequestedMode ) |
|
168 | rtems_task prc0_task( rtems_task_argument lfrRequestedMode ) | |
169 | { |
|
169 | { | |
170 | char incomingData[MSG_QUEUE_SIZE_SEND]; // incoming data buffer |
|
170 | char incomingData[MSG_QUEUE_SIZE_SEND]; // incoming data buffer | |
171 | size_t size; // size of the incoming TC packet |
|
171 | size_t size; // size of the incoming TC packet | |
172 | asm_msg *incomingMsg; |
|
172 | asm_msg *incomingMsg; | |
173 | // |
|
173 | // | |
174 | spw_ioctl_pkt_send spw_ioctl_send_ASM; |
|
174 | spw_ioctl_pkt_send spw_ioctl_send_ASM; | |
175 | rtems_status_code status; |
|
175 | rtems_status_code status; | |
176 | rtems_id queue_id; |
|
176 | rtems_id queue_id; | |
177 | rtems_id queue_id_q_p0; |
|
177 | rtems_id queue_id_q_p0; | |
178 | Header_TM_LFR_SCIENCE_ASM_t headerASM; |
|
178 | Header_TM_LFR_SCIENCE_ASM_t headerASM; | |
179 | bp_packet_with_spare packet_norm_bp1_f0; |
|
179 | bp_packet_with_spare packet_norm_bp1_f0; | |
180 | bp_packet packet_norm_bp2_f0; |
|
180 | bp_packet packet_norm_bp2_f0; | |
181 | bp_packet packet_sbm_bp1_f0; |
|
181 | bp_packet packet_sbm_bp1_f0; | |
182 | bp_packet packet_sbm_bp2_f0; |
|
182 | bp_packet packet_sbm_bp2_f0; | |
183 |
|
183 | |||
184 | unsigned long long int localTime; |
|
184 | unsigned long long int localTime; | |
185 |
|
185 | |||
186 | ASM_init_header( &headerASM ); |
|
186 | ASM_init_header( &headerASM ); | |
187 |
|
187 | |||
188 | //************* |
|
188 | //************* | |
189 | // NORM headers |
|
189 | // NORM headers | |
190 | BP_init_header_with_spare( &packet_norm_bp1_f0.header, |
|
190 | BP_init_header_with_spare( &packet_norm_bp1_f0.header, | |
191 | APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F0, |
|
191 | APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F0, | |
192 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0, NB_BINS_COMPRESSED_SM_F0 ); |
|
192 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0, NB_BINS_COMPRESSED_SM_F0 ); | |
193 | BP_init_header( &packet_norm_bp2_f0.header, |
|
193 | BP_init_header( &packet_norm_bp2_f0.header, | |
194 | APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP2_F0, |
|
194 | APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP2_F0, | |
195 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0, NB_BINS_COMPRESSED_SM_F0); |
|
195 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0, NB_BINS_COMPRESSED_SM_F0); | |
196 |
|
196 | |||
197 | //**************************** |
|
197 | //**************************** | |
198 | // BURST SBM1 and SBM2 headers |
|
198 | // BURST SBM1 and SBM2 headers | |
199 | if ( lfrRequestedMode == LFR_MODE_BURST ) |
|
199 | if ( lfrRequestedMode == LFR_MODE_BURST ) | |
200 | { |
|
200 | { | |
201 | BP_init_header( &packet_sbm_bp1_f0.header, |
|
201 | BP_init_header( &packet_sbm_bp1_f0.header, | |
202 | APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP1_F0, |
|
202 | APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP1_F0, | |
203 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0); |
|
203 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0); | |
204 | BP_init_header( &packet_sbm_bp2_f0.header, |
|
204 | BP_init_header( &packet_sbm_bp2_f0.header, | |
205 | APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP2_F0, |
|
205 | APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP2_F0, | |
206 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0); |
|
206 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0); | |
207 | } |
|
207 | } | |
208 | else if ( lfrRequestedMode == LFR_MODE_SBM1 ) |
|
208 | else if ( lfrRequestedMode == LFR_MODE_SBM1 ) | |
209 | { |
|
209 | { | |
210 | BP_init_header( &packet_sbm_bp1_f0.header, |
|
210 | BP_init_header( &packet_sbm_bp1_f0.header, | |
211 | APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP1_F0, |
|
211 | APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP1_F0, | |
212 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0); |
|
212 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0); | |
213 | BP_init_header( &packet_sbm_bp2_f0.header, |
|
213 | BP_init_header( &packet_sbm_bp2_f0.header, | |
214 | APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP2_F0, |
|
214 | APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP2_F0, | |
215 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0); |
|
215 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0); | |
216 | } |
|
216 | } | |
217 | else if ( lfrRequestedMode == LFR_MODE_SBM2 ) |
|
217 | else if ( lfrRequestedMode == LFR_MODE_SBM2 ) | |
218 | { |
|
218 | { | |
219 | BP_init_header( &packet_sbm_bp1_f0.header, |
|
219 | BP_init_header( &packet_sbm_bp1_f0.header, | |
220 | APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP1_F0, |
|
220 | APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP1_F0, | |
221 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0); |
|
221 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0); | |
222 | BP_init_header( &packet_sbm_bp2_f0.header, |
|
222 | BP_init_header( &packet_sbm_bp2_f0.header, | |
223 | APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP2_F0, |
|
223 | APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP2_F0, | |
224 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0); |
|
224 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0); | |
225 | } |
|
225 | } | |
226 | else |
|
226 | else | |
227 | { |
|
227 | { | |
228 | PRINTF1("in PRC0 *** lfrRequestedMode is %d, several headers not initialized\n", (unsigned int) lfrRequestedMode) |
|
228 | PRINTF1("in PRC0 *** lfrRequestedMode is %d, several headers not initialized\n", (unsigned int) lfrRequestedMode) | |
229 | } |
|
229 | } | |
230 |
|
230 | |||
231 | status = get_message_queue_id_send( &queue_id ); |
|
231 | status = get_message_queue_id_send( &queue_id ); | |
232 | if (status != RTEMS_SUCCESSFUL) |
|
232 | if (status != RTEMS_SUCCESSFUL) | |
233 | { |
|
233 | { | |
234 | PRINTF1("in PRC0 *** ERR get_message_queue_id_send %d\n", status) |
|
234 | PRINTF1("in PRC0 *** ERR get_message_queue_id_send %d\n", status) | |
235 | } |
|
235 | } | |
236 | status = get_message_queue_id_prc0( &queue_id_q_p0); |
|
236 | status = get_message_queue_id_prc0( &queue_id_q_p0); | |
237 | if (status != RTEMS_SUCCESSFUL) |
|
237 | if (status != RTEMS_SUCCESSFUL) | |
238 | { |
|
238 | { | |
239 | PRINTF1("in PRC0 *** ERR get_message_queue_id_prc0 %d\n", status) |
|
239 | PRINTF1("in PRC0 *** ERR get_message_queue_id_prc0 %d\n", status) | |
240 | } |
|
240 | } | |
241 |
|
241 | |||
242 | BOOT_PRINTF1("in PRC0 *** lfrRequestedMode = %d\n", (int) lfrRequestedMode) |
|
242 | BOOT_PRINTF1("in PRC0 *** lfrRequestedMode = %d\n", (int) lfrRequestedMode) | |
243 |
|
243 | |||
244 | while(1){ |
|
244 | while(1){ | |
245 | status = rtems_message_queue_receive( queue_id_q_p0, incomingData, &size, //************************************ |
|
245 | status = rtems_message_queue_receive( queue_id_q_p0, incomingData, &size, //************************************ | |
246 | RTEMS_WAIT, RTEMS_NO_TIMEOUT ); // wait for a message coming from AVF0 |
|
246 | RTEMS_WAIT, RTEMS_NO_TIMEOUT ); // wait for a message coming from AVF0 | |
247 |
|
247 | |||
248 | incomingMsg = (asm_msg*) incomingData; |
|
248 | incomingMsg = (asm_msg*) incomingData; | |
249 |
|
249 | |||
250 | localTime = getTimeAsUnsignedLongLongInt( ); |
|
250 | localTime = getTimeAsUnsignedLongLongInt( ); | |
251 | //**************** |
|
251 | //**************** | |
252 | //**************** |
|
252 | //**************** | |
253 | // BURST SBM1 SBM2 |
|
253 | // BURST SBM1 SBM2 | |
254 | //**************** |
|
254 | //**************** | |
255 | //**************** |
|
255 | //**************** | |
256 | if (incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP1_F0 ) |
|
256 | if (incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP1_F0 ) | |
257 | { |
|
257 | { | |
258 | // 1) compress the matrix for Basic Parameters calculation |
|
258 | // 1) compress the matrix for Basic Parameters calculation | |
259 | ASM_compress_reorganize_and_divide( incomingMsg->burst_sbm->matrix, compressed_sm_sbm_f0, |
|
259 | ASM_compress_reorganize_and_divide( incomingMsg->burst_sbm->matrix, compressed_sm_sbm_f0, | |
260 | nb_sm_before_f0.burst_sbm_bp1, |
|
260 | nb_sm_before_f0.burst_sbm_bp1, | |
261 | NB_BINS_COMPRESSED_SM_SBM_F0, NB_BINS_TO_AVERAGE_ASM_SBM_F0, |
|
261 | NB_BINS_COMPRESSED_SM_SBM_F0, NB_BINS_TO_AVERAGE_ASM_SBM_F0, | |
262 | ASM_F0_INDICE_START); |
|
262 | ASM_F0_INDICE_START); | |
263 | // 2) compute the BP1 set |
|
263 | // 2) compute the BP1 set | |
264 | // BP1_set( compressed_sm_norm_f0, NB_BINS_COMPRESSED_SM_SBM_F0, bp1_sbm_f0 ); |
|
264 | // BP1_set( compressed_sm_norm_f0, NB_BINS_COMPRESSED_SM_SBM_F0, bp1_sbm_f0 ); | |
265 | // 3) send the BP1 set |
|
265 | // 3) send the BP1 set | |
266 | set_time( packet_sbm_bp1_f0.header.time, (unsigned char *) &incomingMsg->coarseTime ); |
|
266 | set_time( packet_sbm_bp1_f0.header.time, (unsigned char *) &incomingMsg->coarseTime ); | |
267 |
set_time( packet_sbm_bp1_f0.header.acquisitionTime, (unsigned char *) &incomingMsg-> |
|
267 | set_time( packet_sbm_bp1_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime ); | |
268 | BP_send( (char *) &packet_sbm_bp1_f0, queue_id, |
|
268 | BP_send( (char *) &packet_sbm_bp1_f0, queue_id, | |
269 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0 + PACKET_LENGTH_DELTA, |
|
269 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0 + PACKET_LENGTH_DELTA, | |
270 | SID_SBM1_BP1_F0); |
|
270 | SID_SBM1_BP1_F0); | |
271 | // 4) compute the BP2 set if needed |
|
271 | // 4) compute the BP2 set if needed | |
272 | if ( incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP2_F0 ) |
|
272 | if ( incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP2_F0 ) | |
273 | { |
|
273 | { | |
274 | // 1) compute the BP2 set |
|
274 | // 1) compute the BP2 set | |
275 |
|
275 | |||
276 | // 2) send the BP2 set |
|
276 | // 2) send the BP2 set | |
277 | set_time( packet_sbm_bp2_f0.header.time, (unsigned char *) &incomingMsg->coarseTime ); |
|
277 | set_time( packet_sbm_bp2_f0.header.time, (unsigned char *) &incomingMsg->coarseTime ); | |
278 |
set_time( packet_sbm_bp2_f0.header.acquisitionTime, (unsigned char *) &incomingMsg-> |
|
278 | set_time( packet_sbm_bp2_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime ); | |
279 | BP_send( (char *) &packet_sbm_bp2_f0, queue_id, |
|
279 | BP_send( (char *) &packet_sbm_bp2_f0, queue_id, | |
280 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0 + PACKET_LENGTH_DELTA, |
|
280 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0 + PACKET_LENGTH_DELTA, | |
281 | SID_SBM1_BP2_F0); |
|
281 | SID_SBM1_BP2_F0); | |
282 | } |
|
282 | } | |
283 | } |
|
283 | } | |
284 |
|
284 | |||
285 | //***** |
|
285 | //***** | |
286 | //***** |
|
286 | //***** | |
287 | // NORM |
|
287 | // NORM | |
288 | //***** |
|
288 | //***** | |
289 | //***** |
|
289 | //***** | |
290 | if (incomingMsg->event & RTEMS_EVENT_NORM_BP1_F0) |
|
290 | if (incomingMsg->event & RTEMS_EVENT_NORM_BP1_F0) | |
291 | { |
|
291 | { | |
292 | // 1) compress the matrix for Basic Parameters calculation |
|
292 | // 1) compress the matrix for Basic Parameters calculation | |
293 | ASM_compress_reorganize_and_divide( incomingMsg->norm->matrix, compressed_sm_norm_f0, |
|
293 | ASM_compress_reorganize_and_divide( incomingMsg->norm->matrix, compressed_sm_norm_f0, | |
294 | nb_sm_before_f0.norm_bp1, |
|
294 | nb_sm_before_f0.norm_bp1, | |
295 | NB_BINS_COMPRESSED_SM_F0, NB_BINS_TO_AVERAGE_ASM_F0, |
|
295 | NB_BINS_COMPRESSED_SM_F0, NB_BINS_TO_AVERAGE_ASM_F0, | |
296 | ASM_F0_INDICE_START ); |
|
296 | ASM_F0_INDICE_START ); | |
297 | // 2) compute the BP1 set |
|
297 | // 2) compute the BP1 set | |
298 | // BP1_set( compressed_sm_norm_f0, NB_BINS_COMPRESSED_SM_F0, bp1_norm_f0 ); |
|
298 | // BP1_set( compressed_sm_norm_f0, NB_BINS_COMPRESSED_SM_F0, bp1_norm_f0 ); | |
299 | // 3) send the BP1 set |
|
299 | // 3) send the BP1 set | |
300 | set_time( packet_norm_bp1_f0.header.time, (unsigned char *) &incomingMsg->coarseTime ); |
|
300 | set_time( packet_norm_bp1_f0.header.time, (unsigned char *) &incomingMsg->coarseTime ); | |
301 |
set_time( packet_norm_bp1_f0.header.acquisitionTime, (unsigned char *) &incomingMsg-> |
|
301 | set_time( packet_norm_bp1_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime ); | |
302 | BP_send( (char *) &packet_norm_bp1_f0, queue_id, |
|
302 | BP_send( (char *) &packet_norm_bp1_f0, queue_id, | |
303 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 + PACKET_LENGTH_DELTA, |
|
303 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 + PACKET_LENGTH_DELTA, | |
304 | SID_NORM_BP1_F0 ); |
|
304 | SID_NORM_BP1_F0 ); | |
305 | if (incomingMsg->event & RTEMS_EVENT_NORM_BP2_F0) |
|
305 | if (incomingMsg->event & RTEMS_EVENT_NORM_BP2_F0) | |
306 | { |
|
306 | { | |
307 | // 1) compute the BP2 set using the same ASM as the one used for BP1 |
|
307 | // 1) compute the BP2 set using the same ASM as the one used for BP1 | |
308 |
|
308 | |||
309 | // 2) send the BP2 set |
|
309 | // 2) send the BP2 set | |
310 | set_time( packet_norm_bp2_f0.header.time, (unsigned char *) &incomingMsg->coarseTime ); |
|
310 | set_time( packet_norm_bp2_f0.header.time, (unsigned char *) &incomingMsg->coarseTime ); | |
311 |
set_time( packet_norm_bp2_f0.header.acquisitionTime, (unsigned char *) &incomingMsg-> |
|
311 | set_time( packet_norm_bp2_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime ); | |
312 | BP_send( (char *) &packet_norm_bp2_f0, queue_id, |
|
312 | BP_send( (char *) &packet_norm_bp2_f0, queue_id, | |
313 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0 + PACKET_LENGTH_DELTA, |
|
313 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0 + PACKET_LENGTH_DELTA, | |
314 | SID_NORM_BP2_F0); |
|
314 | SID_NORM_BP2_F0); | |
315 | } |
|
315 | } | |
316 | } |
|
316 | } | |
317 |
|
317 | |||
318 | if (incomingMsg->event & RTEMS_EVENT_NORM_ASM_F0) |
|
318 | if (incomingMsg->event & RTEMS_EVENT_NORM_ASM_F0) | |
319 | { |
|
319 | { | |
320 | // 1) reorganize the ASM and divide |
|
320 | // 1) reorganize the ASM and divide | |
321 | ASM_reorganize_and_divide( incomingMsg->norm->matrix, |
|
321 | ASM_reorganize_and_divide( incomingMsg->norm->matrix, | |
322 | asm_f0_reorganized, |
|
322 | asm_f0_reorganized, | |
323 | nb_sm_before_f0.norm_bp1 ); |
|
323 | nb_sm_before_f0.norm_bp1 ); | |
324 | // 2) convert the float array in a char array |
|
324 | // 2) convert the float array in a char array | |
325 | ASM_convert( asm_f0_reorganized, asm_f0_char); |
|
325 | ASM_convert( asm_f0_reorganized, asm_f0_char); | |
326 | // 3) send the spectral matrix packets |
|
326 | // 3) send the spectral matrix packets | |
327 | set_time( headerASM.time , (unsigned char *) &incomingMsg->coarseTime ); |
|
327 | set_time( headerASM.time , (unsigned char *) &incomingMsg->coarseTime ); | |
328 | set_time( headerASM.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime ); |
|
328 | set_time( headerASM.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime ); | |
329 | ASM_send( &headerASM, asm_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id); |
|
329 | ASM_send( &headerASM, asm_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id); | |
330 | } |
|
330 | } | |
331 |
|
331 | |||
332 | } |
|
332 | } | |
333 | } |
|
333 | } | |
334 |
|
334 | |||
335 | //********** |
|
335 | //********** | |
336 | // FUNCTIONS |
|
336 | // FUNCTIONS | |
337 |
|
337 | |||
338 | void reset_nb_sm_f0( unsigned char lfrMode ) |
|
338 | void reset_nb_sm_f0( unsigned char lfrMode ) | |
339 | { |
|
339 | { | |
340 | nb_sm_before_f0.norm_bp1 = parameter_dump_packet.sy_lfr_n_bp_p0 * 96; |
|
340 | nb_sm_before_f0.norm_bp1 = parameter_dump_packet.sy_lfr_n_bp_p0 * 96; | |
341 | nb_sm_before_f0.norm_bp2 = parameter_dump_packet.sy_lfr_n_bp_p1 * 96; |
|
341 | nb_sm_before_f0.norm_bp2 = parameter_dump_packet.sy_lfr_n_bp_p1 * 96; | |
342 | nb_sm_before_f0.norm_asm = (parameter_dump_packet.sy_lfr_n_asm_p[0] * 256 + parameter_dump_packet.sy_lfr_n_asm_p[1]) * 96; |
|
342 | nb_sm_before_f0.norm_asm = (parameter_dump_packet.sy_lfr_n_asm_p[0] * 256 + parameter_dump_packet.sy_lfr_n_asm_p[1]) * 96; | |
343 | nb_sm_before_f0.sbm1_bp1 = parameter_dump_packet.sy_lfr_s1_bp_p0 * 24; |
|
343 | nb_sm_before_f0.sbm1_bp1 = parameter_dump_packet.sy_lfr_s1_bp_p0 * 24; | |
344 | nb_sm_before_f0.sbm1_bp2 = parameter_dump_packet.sy_lfr_s1_bp_p1 * 96; |
|
344 | nb_sm_before_f0.sbm1_bp2 = parameter_dump_packet.sy_lfr_s1_bp_p1 * 96; | |
345 | nb_sm_before_f0.sbm2_bp1 = parameter_dump_packet.sy_lfr_s2_bp_p0 * 96; |
|
345 | nb_sm_before_f0.sbm2_bp1 = parameter_dump_packet.sy_lfr_s2_bp_p0 * 96; | |
346 | nb_sm_before_f0.sbm2_bp2 = parameter_dump_packet.sy_lfr_s2_bp_p1 * 96; |
|
346 | nb_sm_before_f0.sbm2_bp2 = parameter_dump_packet.sy_lfr_s2_bp_p1 * 96; | |
347 | nb_sm_before_f0.burst_bp1 = parameter_dump_packet.sy_lfr_b_bp_p0 * 96; |
|
347 | nb_sm_before_f0.burst_bp1 = parameter_dump_packet.sy_lfr_b_bp_p0 * 96; | |
348 | nb_sm_before_f0.burst_bp2 = parameter_dump_packet.sy_lfr_b_bp_p1 * 96; |
|
348 | nb_sm_before_f0.burst_bp2 = parameter_dump_packet.sy_lfr_b_bp_p1 * 96; | |
349 |
|
349 | |||
350 | if (lfrMode == LFR_MODE_SBM1) |
|
350 | if (lfrMode == LFR_MODE_SBM1) | |
351 | { |
|
351 | { | |
352 | nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.sbm1_bp1; |
|
352 | nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.sbm1_bp1; | |
353 | nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.sbm1_bp2; |
|
353 | nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.sbm1_bp2; | |
354 | } |
|
354 | } | |
355 | else if (lfrMode == LFR_MODE_SBM2) |
|
355 | else if (lfrMode == LFR_MODE_SBM2) | |
356 | { |
|
356 | { | |
357 | nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.sbm2_bp1; |
|
357 | nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.sbm2_bp1; | |
358 | nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.sbm2_bp2; |
|
358 | nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.sbm2_bp2; | |
359 | } |
|
359 | } | |
360 | else if (lfrMode == LFR_MODE_BURST) |
|
360 | else if (lfrMode == LFR_MODE_BURST) | |
361 | { |
|
361 | { | |
362 | nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.burst_bp1; |
|
362 | nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.burst_bp1; | |
363 | nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.burst_bp2; |
|
363 | nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.burst_bp2; | |
364 | } |
|
364 | } | |
365 | else |
|
365 | else | |
366 | { |
|
366 | { | |
367 | nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.burst_bp1; |
|
367 | nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.burst_bp1; | |
368 | nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.burst_bp2; |
|
368 | nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.burst_bp2; | |
369 | } |
|
369 | } | |
370 | } |
|
370 | } |
@@ -1,349 +1,349 | |||||
1 | /** Functions related to data processing. |
|
1 | /** Functions related to data processing. | |
2 | * |
|
2 | * | |
3 | * @file |
|
3 | * @file | |
4 | * @author P. LEROY |
|
4 | * @author P. LEROY | |
5 | * |
|
5 | * | |
6 | * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation. |
|
6 | * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation. | |
7 | * |
|
7 | * | |
8 | */ |
|
8 | */ | |
9 |
|
9 | |||
10 | #include "avf1_prc1.h" |
|
10 | #include "avf1_prc1.h" | |
11 |
|
11 | |||
12 | nb_sm_before_bp_asm_f1 nb_sm_before_f1; |
|
12 | nb_sm_before_bp_asm_f1 nb_sm_before_f1; | |
13 |
|
13 | |||
14 | //*** |
|
14 | //*** | |
15 | // F1 |
|
15 | // F1 | |
16 | ring_node_asm asm_ring_norm_f1 [ NB_RING_NODES_ASM_NORM_F1 ]; |
|
16 | ring_node_asm asm_ring_norm_f1 [ NB_RING_NODES_ASM_NORM_F1 ]; | |
17 | ring_node_asm asm_ring_burst_sbm_f1[ NB_RING_NODES_ASM_BURST_SBM_F1 ]; |
|
17 | ring_node_asm asm_ring_burst_sbm_f1[ NB_RING_NODES_ASM_BURST_SBM_F1 ]; | |
18 |
|
18 | |||
19 | float asm_f1_reorganized [ TOTAL_SIZE_SM ]; |
|
19 | float asm_f1_reorganized [ TOTAL_SIZE_SM ]; | |
20 | char asm_f1_char [ TIME_OFFSET_IN_BYTES + (TOTAL_SIZE_SM * 2) ]; |
|
20 | char asm_f1_char [ TIME_OFFSET_IN_BYTES + (TOTAL_SIZE_SM * 2) ]; | |
21 | float compressed_sm_norm_f1[ TOTAL_SIZE_COMPRESSED_ASM_NORM_F1]; |
|
21 | float compressed_sm_norm_f1[ TOTAL_SIZE_COMPRESSED_ASM_NORM_F1]; | |
22 | float compressed_sm_sbm_f1 [ TOTAL_SIZE_COMPRESSED_ASM_SBM_F1 ]; |
|
22 | float compressed_sm_sbm_f1 [ TOTAL_SIZE_COMPRESSED_ASM_SBM_F1 ]; | |
23 |
|
23 | |||
24 | //************ |
|
24 | //************ | |
25 | // RTEMS TASKS |
|
25 | // RTEMS TASKS | |
26 |
|
26 | |||
27 | rtems_task avf1_task( rtems_task_argument lfrRequestedMode ) |
|
27 | rtems_task avf1_task( rtems_task_argument lfrRequestedMode ) | |
28 | { |
|
28 | { | |
29 | int i; |
|
29 | int i; | |
30 |
|
30 | |||
31 | rtems_event_set event_out; |
|
31 | rtems_event_set event_out; | |
32 | rtems_status_code status; |
|
32 | rtems_status_code status; | |
33 | rtems_id queue_id_prc1; |
|
33 | rtems_id queue_id_prc1; | |
34 | asm_msg msgForMATR; |
|
34 | asm_msg msgForMATR; | |
35 | ring_node_sm *ring_node_tab[8]; |
|
35 | ring_node_sm *ring_node_tab[8]; | |
36 | ring_node_asm *current_ring_node_asm_burst_sbm_f1; |
|
36 | ring_node_asm *current_ring_node_asm_burst_sbm_f1; | |
37 | ring_node_asm *current_ring_node_asm_norm_f1; |
|
37 | ring_node_asm *current_ring_node_asm_norm_f1; | |
38 |
|
38 | |||
39 | unsigned int nb_norm_bp1; |
|
39 | unsigned int nb_norm_bp1; | |
40 | unsigned int nb_norm_bp2; |
|
40 | unsigned int nb_norm_bp2; | |
41 | unsigned int nb_norm_asm; |
|
41 | unsigned int nb_norm_asm; | |
42 | unsigned int nb_sbm_bp1; |
|
42 | unsigned int nb_sbm_bp1; | |
43 | unsigned int nb_sbm_bp2; |
|
43 | unsigned int nb_sbm_bp2; | |
44 |
|
44 | |||
45 | nb_norm_bp1 = 0; |
|
45 | nb_norm_bp1 = 0; | |
46 | nb_norm_bp2 = 0; |
|
46 | nb_norm_bp2 = 0; | |
47 | nb_norm_asm = 0; |
|
47 | nb_norm_asm = 0; | |
48 | nb_sbm_bp1 = 0; |
|
48 | nb_sbm_bp1 = 0; | |
49 | nb_sbm_bp2 = 0; |
|
49 | nb_sbm_bp2 = 0; | |
50 |
|
50 | |||
51 | reset_nb_sm_f1( lfrRequestedMode ); // reset the sm counters that drive the BP and ASM computations / transmissions |
|
51 | reset_nb_sm_f1( lfrRequestedMode ); // reset the sm counters that drive the BP and ASM computations / transmissions | |
52 | ASM_generic_init_ring( asm_ring_norm_f1, NB_RING_NODES_ASM_NORM_F1 ); |
|
52 | ASM_generic_init_ring( asm_ring_norm_f1, NB_RING_NODES_ASM_NORM_F1 ); | |
53 | ASM_generic_init_ring( asm_ring_burst_sbm_f1, NB_RING_NODES_ASM_BURST_SBM_F1 ); |
|
53 | ASM_generic_init_ring( asm_ring_burst_sbm_f1, NB_RING_NODES_ASM_BURST_SBM_F1 ); | |
54 | current_ring_node_asm_norm_f1 = asm_ring_norm_f1; |
|
54 | current_ring_node_asm_norm_f1 = asm_ring_norm_f1; | |
55 | current_ring_node_asm_burst_sbm_f1 = asm_ring_burst_sbm_f1; |
|
55 | current_ring_node_asm_burst_sbm_f1 = asm_ring_burst_sbm_f1; | |
56 |
|
56 | |||
57 | BOOT_PRINTF1("in AVF1 *** lfrRequestedMode = %d\n", (int) lfrRequestedMode) |
|
57 | BOOT_PRINTF1("in AVF1 *** lfrRequestedMode = %d\n", (int) lfrRequestedMode) | |
58 |
|
58 | |||
59 | status = get_message_queue_id_prc1( &queue_id_prc1 ); |
|
59 | status = get_message_queue_id_prc1( &queue_id_prc1 ); | |
60 | if (status != RTEMS_SUCCESSFUL) |
|
60 | if (status != RTEMS_SUCCESSFUL) | |
61 | { |
|
61 | { | |
62 | PRINTF1("in AVF1 *** ERR get_message_queue_id_prc1 %d\n", status) |
|
62 | PRINTF1("in AVF1 *** ERR get_message_queue_id_prc1 %d\n", status) | |
63 | } |
|
63 | } | |
64 |
|
64 | |||
65 | while(1){ |
|
65 | while(1){ | |
66 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
66 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 | |
67 | ring_node_tab[NB_SM_BEFORE_AVF1-1] = ring_node_for_averaging_sm_f1; |
|
67 | ring_node_tab[NB_SM_BEFORE_AVF1-1] = ring_node_for_averaging_sm_f1; | |
68 | for ( i = 2; i < (NB_SM_BEFORE_AVF1+1); i++ ) |
|
68 | for ( i = 2; i < (NB_SM_BEFORE_AVF1+1); i++ ) | |
69 | { |
|
69 | { | |
70 | ring_node_for_averaging_sm_f1 = ring_node_for_averaging_sm_f1->previous; |
|
70 | ring_node_for_averaging_sm_f1 = ring_node_for_averaging_sm_f1->previous; | |
71 | ring_node_tab[NB_SM_BEFORE_AVF1-i] = ring_node_for_averaging_sm_f1; |
|
71 | ring_node_tab[NB_SM_BEFORE_AVF1-i] = ring_node_for_averaging_sm_f1; | |
72 | } |
|
72 | } | |
73 |
|
73 | |||
74 | // compute the average and store it in the averaged_sm_f1 buffer |
|
74 | // compute the average and store it in the averaged_sm_f1 buffer | |
75 | SM_average( current_ring_node_asm_norm_f1->matrix, |
|
75 | SM_average( current_ring_node_asm_norm_f1->matrix, | |
76 | current_ring_node_asm_burst_sbm_f1->matrix, |
|
76 | current_ring_node_asm_burst_sbm_f1->matrix, | |
77 | ring_node_tab, |
|
77 | ring_node_tab, | |
78 | nb_norm_bp1, nb_sbm_bp1 ); |
|
78 | nb_norm_bp1, nb_sbm_bp1 ); | |
79 |
|
79 | |||
80 | // update nb_average |
|
80 | // update nb_average | |
81 | nb_norm_bp1 = nb_norm_bp1 + NB_SM_BEFORE_AVF1; |
|
81 | nb_norm_bp1 = nb_norm_bp1 + NB_SM_BEFORE_AVF1; | |
82 | nb_norm_bp2 = nb_norm_bp2 + NB_SM_BEFORE_AVF1; |
|
82 | nb_norm_bp2 = nb_norm_bp2 + NB_SM_BEFORE_AVF1; | |
83 | nb_norm_asm = nb_norm_asm + NB_SM_BEFORE_AVF1; |
|
83 | nb_norm_asm = nb_norm_asm + NB_SM_BEFORE_AVF1; | |
84 | nb_sbm_bp1 = nb_sbm_bp1 + NB_SM_BEFORE_AVF1; |
|
84 | nb_sbm_bp1 = nb_sbm_bp1 + NB_SM_BEFORE_AVF1; | |
85 | nb_sbm_bp2 = nb_sbm_bp2 + NB_SM_BEFORE_AVF1; |
|
85 | nb_sbm_bp2 = nb_sbm_bp2 + NB_SM_BEFORE_AVF1; | |
86 |
|
86 | |||
87 | //**************************************** |
|
87 | //**************************************** | |
88 | // initialize the mesage for the MATR task |
|
88 | // initialize the mesage for the MATR task | |
89 | msgForMATR.event = 0x00; // this composite event will be sent to the PRC1 task |
|
89 | msgForMATR.event = 0x00; // this composite event will be sent to the PRC1 task | |
90 | msgForMATR.burst_sbm = current_ring_node_asm_burst_sbm_f1; |
|
90 | msgForMATR.burst_sbm = current_ring_node_asm_burst_sbm_f1; | |
91 | msgForMATR.norm = current_ring_node_asm_norm_f1; |
|
91 | msgForMATR.norm = current_ring_node_asm_norm_f1; | |
92 | // msgForMATR.coarseTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[0]; |
|
92 | // msgForMATR.coarseTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[0]; | |
93 | // msgForMATR.fineTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[1]; |
|
93 | // msgForMATR.fineTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[1]; | |
94 | msgForMATR.coarseTime = time_management_regs->coarse_time; |
|
94 | msgForMATR.coarseTime = time_management_regs->coarse_time; | |
95 | msgForMATR.fineTime = time_management_regs->fine_time; |
|
95 | msgForMATR.fineTime = time_management_regs->fine_time; | |
96 |
|
96 | |||
97 | if (nb_sbm_bp1 == nb_sm_before_f1.burst_sbm_bp1) |
|
97 | if (nb_sbm_bp1 == nb_sm_before_f1.burst_sbm_bp1) | |
98 | { |
|
98 | { | |
99 | nb_sbm_bp1 = 0; |
|
99 | nb_sbm_bp1 = 0; | |
100 | // set another ring for the ASM storage |
|
100 | // set another ring for the ASM storage | |
101 | current_ring_node_asm_burst_sbm_f1 = current_ring_node_asm_burst_sbm_f1->next; |
|
101 | current_ring_node_asm_burst_sbm_f1 = current_ring_node_asm_burst_sbm_f1->next; | |
102 | if ( (lfrCurrentMode == LFR_MODE_BURST) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
102 | if ( (lfrCurrentMode == LFR_MODE_BURST) || (lfrCurrentMode == LFR_MODE_SBM2) ) | |
103 | { |
|
103 | { | |
104 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_SBM_BP1_F1; |
|
104 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_SBM_BP1_F1; | |
105 | } |
|
105 | } | |
106 | } |
|
106 | } | |
107 |
|
107 | |||
108 | if (nb_sbm_bp2 == nb_sm_before_f1.burst_sbm_bp2) |
|
108 | if (nb_sbm_bp2 == nb_sm_before_f1.burst_sbm_bp2) | |
109 | { |
|
109 | { | |
110 | nb_sbm_bp2 = 0; |
|
110 | nb_sbm_bp2 = 0; | |
111 | if ( (lfrCurrentMode == LFR_MODE_BURST) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
111 | if ( (lfrCurrentMode == LFR_MODE_BURST) || (lfrCurrentMode == LFR_MODE_SBM2) ) | |
112 | { |
|
112 | { | |
113 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_SBM_BP2_F1; |
|
113 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_SBM_BP2_F1; | |
114 | } |
|
114 | } | |
115 | } |
|
115 | } | |
116 |
|
116 | |||
117 | if (nb_norm_bp1 == nb_sm_before_f1.norm_bp1) |
|
117 | if (nb_norm_bp1 == nb_sm_before_f1.norm_bp1) | |
118 | { |
|
118 | { | |
119 | nb_norm_bp1 = 0; |
|
119 | nb_norm_bp1 = 0; | |
120 | // set another ring for the ASM storage |
|
120 | // set another ring for the ASM storage | |
121 | current_ring_node_asm_norm_f1 = current_ring_node_asm_norm_f1->next; |
|
121 | current_ring_node_asm_norm_f1 = current_ring_node_asm_norm_f1->next; | |
122 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) |
|
122 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) | |
123 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
123 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) | |
124 | { |
|
124 | { | |
125 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP1_F1; |
|
125 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP1_F1; | |
126 | } |
|
126 | } | |
127 | } |
|
127 | } | |
128 |
|
128 | |||
129 | if (nb_norm_bp2 == nb_sm_before_f1.norm_bp2) |
|
129 | if (nb_norm_bp2 == nb_sm_before_f1.norm_bp2) | |
130 | { |
|
130 | { | |
131 | nb_norm_bp2 = 0; |
|
131 | nb_norm_bp2 = 0; | |
132 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) |
|
132 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) | |
133 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
133 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) | |
134 | { |
|
134 | { | |
135 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP2_F1; |
|
135 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP2_F1; | |
136 | } |
|
136 | } | |
137 | } |
|
137 | } | |
138 |
|
138 | |||
139 | if (nb_norm_asm == nb_sm_before_f1.norm_asm) |
|
139 | if (nb_norm_asm == nb_sm_before_f1.norm_asm) | |
140 | { |
|
140 | { | |
141 | nb_norm_asm = 0; |
|
141 | nb_norm_asm = 0; | |
142 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) |
|
142 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) | |
143 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
143 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) | |
144 | { |
|
144 | { | |
145 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_ASM_F1; |
|
145 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_ASM_F1; | |
146 | } |
|
146 | } | |
147 | } |
|
147 | } | |
148 |
|
148 | |||
149 | //************************* |
|
149 | //************************* | |
150 | // send the message to MATR |
|
150 | // send the message to MATR | |
151 | if (msgForMATR.event != 0x00) |
|
151 | if (msgForMATR.event != 0x00) | |
152 | { |
|
152 | { | |
153 | status = rtems_message_queue_send( queue_id_prc1, (char *) &msgForMATR, MSG_QUEUE_SIZE_PRC1); |
|
153 | status = rtems_message_queue_send( queue_id_prc1, (char *) &msgForMATR, MSG_QUEUE_SIZE_PRC1); | |
154 | } |
|
154 | } | |
155 |
|
155 | |||
156 | if (status != RTEMS_SUCCESSFUL) { |
|
156 | if (status != RTEMS_SUCCESSFUL) { | |
157 | printf("in AVF1 *** Error sending message to PRC1, code %d\n", status); |
|
157 | printf("in AVF1 *** Error sending message to PRC1, code %d\n", status); | |
158 | } |
|
158 | } | |
159 | } |
|
159 | } | |
160 | } |
|
160 | } | |
161 |
|
161 | |||
162 | rtems_task prc1_task( rtems_task_argument lfrRequestedMode ) |
|
162 | rtems_task prc1_task( rtems_task_argument lfrRequestedMode ) | |
163 | { |
|
163 | { | |
164 | char incomingData[MSG_QUEUE_SIZE_SEND]; // incoming data buffer |
|
164 | char incomingData[MSG_QUEUE_SIZE_SEND]; // incoming data buffer | |
165 | size_t size; // size of the incoming TC packet |
|
165 | size_t size; // size of the incoming TC packet | |
166 | asm_msg *incomingMsg; |
|
166 | asm_msg *incomingMsg; | |
167 | // |
|
167 | // | |
168 | spw_ioctl_pkt_send spw_ioctl_send_ASM; |
|
168 | spw_ioctl_pkt_send spw_ioctl_send_ASM; | |
169 | rtems_status_code status; |
|
169 | rtems_status_code status; | |
170 | rtems_id queue_id_send; |
|
170 | rtems_id queue_id_send; | |
171 | rtems_id queue_id_q_p1; |
|
171 | rtems_id queue_id_q_p1; | |
172 | Header_TM_LFR_SCIENCE_ASM_t headerASM; |
|
172 | Header_TM_LFR_SCIENCE_ASM_t headerASM; | |
173 | bp_packet_with_spare packet_norm_bp1; |
|
173 | bp_packet_with_spare packet_norm_bp1; | |
174 | bp_packet packet_norm_bp2; |
|
174 | bp_packet packet_norm_bp2; | |
175 | bp_packet packet_sbm_bp1; |
|
175 | bp_packet packet_sbm_bp1; | |
176 | bp_packet packet_sbm_bp2; |
|
176 | bp_packet packet_sbm_bp2; | |
177 |
|
177 | |||
178 | unsigned long long int localTime; |
|
178 | unsigned long long int localTime; | |
179 |
|
179 | |||
180 | ASM_init_header( &headerASM ); |
|
180 | ASM_init_header( &headerASM ); | |
181 |
|
181 | |||
182 | //************* |
|
182 | //************* | |
183 | // NORM headers |
|
183 | // NORM headers | |
184 | BP_init_header_with_spare( &packet_norm_bp1.header, |
|
184 | BP_init_header_with_spare( &packet_norm_bp1.header, | |
185 | APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F1, |
|
185 | APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F1, | |
186 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F1, NB_BINS_COMPRESSED_SM_F1 ); |
|
186 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F1, NB_BINS_COMPRESSED_SM_F1 ); | |
187 | BP_init_header( &packet_norm_bp2.header, |
|
187 | BP_init_header( &packet_norm_bp2.header, | |
188 | APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP2_F1, |
|
188 | APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP2_F1, | |
189 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F1, NB_BINS_COMPRESSED_SM_F1); |
|
189 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F1, NB_BINS_COMPRESSED_SM_F1); | |
190 |
|
190 | |||
191 | //*********************** |
|
191 | //*********************** | |
192 | // BURST and SBM2 headers |
|
192 | // BURST and SBM2 headers | |
193 | if ( lfrRequestedMode == LFR_MODE_BURST ) |
|
193 | if ( lfrRequestedMode == LFR_MODE_BURST ) | |
194 | { |
|
194 | { | |
195 | BP_init_header( &packet_sbm_bp1.header, |
|
195 | BP_init_header( &packet_sbm_bp1.header, | |
196 | APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP1_F1, |
|
196 | APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP1_F1, | |
197 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F1); |
|
197 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F1); | |
198 | BP_init_header( &packet_sbm_bp2.header, |
|
198 | BP_init_header( &packet_sbm_bp2.header, | |
199 | APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP2_F1, |
|
199 | APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP2_F1, | |
200 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F1); |
|
200 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F1); | |
201 | } |
|
201 | } | |
202 | else if ( lfrRequestedMode == LFR_MODE_SBM2 ) |
|
202 | else if ( lfrRequestedMode == LFR_MODE_SBM2 ) | |
203 | { |
|
203 | { | |
204 | BP_init_header( &packet_sbm_bp1.header, |
|
204 | BP_init_header( &packet_sbm_bp1.header, | |
205 | APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP1_F1, |
|
205 | APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP1_F1, | |
206 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F1, NB_BINS_COMPRESSED_SM_SBM_F1); |
|
206 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F1, NB_BINS_COMPRESSED_SM_SBM_F1); | |
207 | BP_init_header( &packet_sbm_bp2.header, |
|
207 | BP_init_header( &packet_sbm_bp2.header, | |
208 | APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP2_F1, |
|
208 | APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP2_F1, | |
209 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F1, NB_BINS_COMPRESSED_SM_SBM_F1); |
|
209 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F1, NB_BINS_COMPRESSED_SM_SBM_F1); | |
210 | } |
|
210 | } | |
211 | else |
|
211 | else | |
212 | { |
|
212 | { | |
213 | PRINTF1("in PRC1 *** lfrRequestedMode is %d, several headers not initialized\n", (unsigned int) lfrRequestedMode) |
|
213 | PRINTF1("in PRC1 *** lfrRequestedMode is %d, several headers not initialized\n", (unsigned int) lfrRequestedMode) | |
214 | } |
|
214 | } | |
215 |
|
215 | |||
216 | status = get_message_queue_id_send( &queue_id_send ); |
|
216 | status = get_message_queue_id_send( &queue_id_send ); | |
217 | if (status != RTEMS_SUCCESSFUL) |
|
217 | if (status != RTEMS_SUCCESSFUL) | |
218 | { |
|
218 | { | |
219 | PRINTF1("in PRC1 *** ERR get_message_queue_id_send %d\n", status) |
|
219 | PRINTF1("in PRC1 *** ERR get_message_queue_id_send %d\n", status) | |
220 | } |
|
220 | } | |
221 | status = get_message_queue_id_prc1( &queue_id_q_p1); |
|
221 | status = get_message_queue_id_prc1( &queue_id_q_p1); | |
222 | if (status != RTEMS_SUCCESSFUL) |
|
222 | if (status != RTEMS_SUCCESSFUL) | |
223 | { |
|
223 | { | |
224 | PRINTF1("in PRC1 *** ERR get_message_queue_id_prc1 %d\n", status) |
|
224 | PRINTF1("in PRC1 *** ERR get_message_queue_id_prc1 %d\n", status) | |
225 | } |
|
225 | } | |
226 |
|
226 | |||
227 | BOOT_PRINTF1("in PRC1 *** lfrRequestedMode = %d\n", (int) lfrRequestedMode) |
|
227 | BOOT_PRINTF1("in PRC1 *** lfrRequestedMode = %d\n", (int) lfrRequestedMode) | |
228 |
|
228 | |||
229 | while(1){ |
|
229 | while(1){ | |
230 | status = rtems_message_queue_receive( queue_id_q_p1, incomingData, &size, //************************************ |
|
230 | status = rtems_message_queue_receive( queue_id_q_p1, incomingData, &size, //************************************ | |
231 | RTEMS_WAIT, RTEMS_NO_TIMEOUT ); // wait for a message coming from AVF0 |
|
231 | RTEMS_WAIT, RTEMS_NO_TIMEOUT ); // wait for a message coming from AVF0 | |
232 |
|
232 | |||
233 | incomingMsg = (asm_msg*) incomingData; |
|
233 | incomingMsg = (asm_msg*) incomingData; | |
234 |
|
234 | |||
235 | localTime = getTimeAsUnsignedLongLongInt( ); |
|
235 | localTime = getTimeAsUnsignedLongLongInt( ); | |
236 | //*********** |
|
236 | //*********** | |
237 | //*********** |
|
237 | //*********** | |
238 | // BURST SBM2 |
|
238 | // BURST SBM2 | |
239 | //*********** |
|
239 | //*********** | |
240 | //*********** |
|
240 | //*********** | |
241 | if (incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP1_F1 ) |
|
241 | if (incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP1_F1 ) | |
242 | { |
|
242 | { | |
243 | // 1) compress the matrix for Basic Parameters calculation |
|
243 | // 1) compress the matrix for Basic Parameters calculation | |
244 | ASM_compress_reorganize_and_divide( incomingMsg->burst_sbm->matrix, compressed_sm_sbm_f1, |
|
244 | ASM_compress_reorganize_and_divide( incomingMsg->burst_sbm->matrix, compressed_sm_sbm_f1, | |
245 | nb_sm_before_f1.burst_sbm_bp1, |
|
245 | nb_sm_before_f1.burst_sbm_bp1, | |
246 | NB_BINS_COMPRESSED_SM_SBM_F1, NB_BINS_TO_AVERAGE_ASM_SBM_F1, |
|
246 | NB_BINS_COMPRESSED_SM_SBM_F1, NB_BINS_TO_AVERAGE_ASM_SBM_F1, | |
247 | ASM_F1_INDICE_START); |
|
247 | ASM_F1_INDICE_START); | |
248 | // 2) compute the BP1 set |
|
248 | // 2) compute the BP1 set | |
249 |
|
249 | |||
250 | // 3) send the BP1 set |
|
250 | // 3) send the BP1 set | |
251 | set_time( packet_sbm_bp1.header.time, (unsigned char *) &incomingMsg->coarseTime ); |
|
251 | set_time( packet_sbm_bp1.header.time, (unsigned char *) &incomingMsg->coarseTime ); | |
252 |
set_time( packet_sbm_bp1.header.acquisitionTime, (unsigned char *) &incomingMsg-> |
|
252 | set_time( packet_sbm_bp1.header.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime ); | |
253 | BP_send( (char *) &packet_sbm_bp1, queue_id_send, |
|
253 | BP_send( (char *) &packet_sbm_bp1, queue_id_send, | |
254 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F1 + PACKET_LENGTH_DELTA, |
|
254 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F1 + PACKET_LENGTH_DELTA, | |
255 | SID_SBM2_BP1_F1 ); |
|
255 | SID_SBM2_BP1_F1 ); | |
256 | // 4) compute the BP2 set if needed |
|
256 | // 4) compute the BP2 set if needed | |
257 | if ( incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP2_F1 ) |
|
257 | if ( incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP2_F1 ) | |
258 | { |
|
258 | { | |
259 | // 1) compute the BP2 set |
|
259 | // 1) compute the BP2 set | |
260 |
|
260 | |||
261 | // 2) send the BP2 set |
|
261 | // 2) send the BP2 set | |
262 | set_time( packet_sbm_bp2.header.time, (unsigned char *) &incomingMsg->coarseTime ); |
|
262 | set_time( packet_sbm_bp2.header.time, (unsigned char *) &incomingMsg->coarseTime ); | |
263 |
set_time( packet_sbm_bp2.header.acquisitionTime, (unsigned char *) &incomingMsg-> |
|
263 | set_time( packet_sbm_bp2.header.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime ); | |
264 | BP_send( (char *) &packet_sbm_bp2, queue_id_send, |
|
264 | BP_send( (char *) &packet_sbm_bp2, queue_id_send, | |
265 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F1 + PACKET_LENGTH_DELTA, |
|
265 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F1 + PACKET_LENGTH_DELTA, | |
266 | SID_SBM2_BP2_F1 ); |
|
266 | SID_SBM2_BP2_F1 ); | |
267 | } |
|
267 | } | |
268 | } |
|
268 | } | |
269 |
|
269 | |||
270 | //***** |
|
270 | //***** | |
271 | //***** |
|
271 | //***** | |
272 | // NORM |
|
272 | // NORM | |
273 | //***** |
|
273 | //***** | |
274 | //***** |
|
274 | //***** | |
275 | if (incomingMsg->event & RTEMS_EVENT_NORM_BP1_F1) |
|
275 | if (incomingMsg->event & RTEMS_EVENT_NORM_BP1_F1) | |
276 | { |
|
276 | { | |
277 | // 1) compress the matrix for Basic Parameters calculation |
|
277 | // 1) compress the matrix for Basic Parameters calculation | |
278 | ASM_compress_reorganize_and_divide( incomingMsg->norm->matrix, compressed_sm_norm_f1, |
|
278 | ASM_compress_reorganize_and_divide( incomingMsg->norm->matrix, compressed_sm_norm_f1, | |
279 | nb_sm_before_f1.norm_bp1, |
|
279 | nb_sm_before_f1.norm_bp1, | |
280 | NB_BINS_COMPRESSED_SM_F0, NB_BINS_TO_AVERAGE_ASM_F0, |
|
280 | NB_BINS_COMPRESSED_SM_F0, NB_BINS_TO_AVERAGE_ASM_F0, | |
281 | ASM_F0_INDICE_START ); |
|
281 | ASM_F0_INDICE_START ); | |
282 | // 2) compute the BP1 set |
|
282 | // 2) compute the BP1 set | |
283 |
|
283 | |||
284 | // 3) send the BP1 set |
|
284 | // 3) send the BP1 set | |
285 | set_time( packet_norm_bp1.header.time, (unsigned char *) &incomingMsg->coarseTime ); |
|
285 | set_time( packet_norm_bp1.header.time, (unsigned char *) &incomingMsg->coarseTime ); | |
286 | set_time( packet_norm_bp1.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime ); |
|
286 | set_time( packet_norm_bp1.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime ); | |
287 | BP_send( (char *) &packet_norm_bp1, queue_id_send, |
|
287 | BP_send( (char *) &packet_norm_bp1, queue_id_send, | |
288 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F1 + PACKET_LENGTH_DELTA, |
|
288 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F1 + PACKET_LENGTH_DELTA, | |
289 | SID_NORM_BP1_F1 ); |
|
289 | SID_NORM_BP1_F1 ); | |
290 | if (incomingMsg->event & RTEMS_EVENT_NORM_BP2_F1) |
|
290 | if (incomingMsg->event & RTEMS_EVENT_NORM_BP2_F1) | |
291 | { |
|
291 | { | |
292 | // 1) compute the BP2 set |
|
292 | // 1) compute the BP2 set | |
293 |
|
293 | |||
294 | // 2) send the BP2 set |
|
294 | // 2) send the BP2 set | |
295 | set_time( packet_norm_bp2.header.time, (unsigned char *) &incomingMsg->coarseTime ); |
|
295 | set_time( packet_norm_bp2.header.time, (unsigned char *) &incomingMsg->coarseTime ); | |
296 |
set_time( packet_norm_bp2.header.acquisitionTime, (unsigned char *) &incomingMsg-> |
|
296 | set_time( packet_norm_bp2.header.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime ); | |
297 | BP_send( (char *) &packet_norm_bp2, queue_id_send, |
|
297 | BP_send( (char *) &packet_norm_bp2, queue_id_send, | |
298 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F1 + PACKET_LENGTH_DELTA, |
|
298 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F1 + PACKET_LENGTH_DELTA, | |
299 | SID_NORM_BP2_F1 ); |
|
299 | SID_NORM_BP2_F1 ); | |
300 | } |
|
300 | } | |
301 | } |
|
301 | } | |
302 |
|
302 | |||
303 | if (incomingMsg->event & RTEMS_EVENT_NORM_ASM_F1) |
|
303 | if (incomingMsg->event & RTEMS_EVENT_NORM_ASM_F1) | |
304 | { |
|
304 | { | |
305 | // 1) reorganize the ASM and divide |
|
305 | // 1) reorganize the ASM and divide | |
306 | ASM_reorganize_and_divide( incomingMsg->norm->matrix, |
|
306 | ASM_reorganize_and_divide( incomingMsg->norm->matrix, | |
307 | asm_f1_reorganized, |
|
307 | asm_f1_reorganized, | |
308 | nb_sm_before_f1.norm_bp1 ); |
|
308 | nb_sm_before_f1.norm_bp1 ); | |
309 | // 2) convert the float array in a char array |
|
309 | // 2) convert the float array in a char array | |
310 | ASM_convert( asm_f1_reorganized, asm_f1_char); |
|
310 | ASM_convert( asm_f1_reorganized, asm_f1_char); | |
311 | // 3) send the spectral matrix packets |
|
311 | // 3) send the spectral matrix packets | |
312 | set_time( headerASM.time , (unsigned char *) &incomingMsg->coarseTime ); |
|
312 | set_time( headerASM.time , (unsigned char *) &incomingMsg->coarseTime ); | |
313 | set_time( headerASM.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime ); |
|
313 | set_time( headerASM.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime ); | |
314 | ASM_send( &headerASM, asm_f1_char, SID_NORM_ASM_F1, &spw_ioctl_send_ASM, queue_id_send); |
|
314 | ASM_send( &headerASM, asm_f1_char, SID_NORM_ASM_F1, &spw_ioctl_send_ASM, queue_id_send); | |
315 | } |
|
315 | } | |
316 |
|
316 | |||
317 | } |
|
317 | } | |
318 | } |
|
318 | } | |
319 |
|
319 | |||
320 | //********** |
|
320 | //********** | |
321 | // FUNCTIONS |
|
321 | // FUNCTIONS | |
322 |
|
322 | |||
323 | void reset_nb_sm_f1( unsigned char lfrMode ) |
|
323 | void reset_nb_sm_f1( unsigned char lfrMode ) | |
324 | { |
|
324 | { | |
325 | nb_sm_before_f1.norm_bp1 = parameter_dump_packet.sy_lfr_n_bp_p0 * 16; |
|
325 | nb_sm_before_f1.norm_bp1 = parameter_dump_packet.sy_lfr_n_bp_p0 * 16; | |
326 | nb_sm_before_f1.norm_bp2 = parameter_dump_packet.sy_lfr_n_bp_p1 * 16; |
|
326 | nb_sm_before_f1.norm_bp2 = parameter_dump_packet.sy_lfr_n_bp_p1 * 16; | |
327 | nb_sm_before_f1.norm_asm = (parameter_dump_packet.sy_lfr_n_asm_p[0] * 256 + parameter_dump_packet.sy_lfr_n_asm_p[1]) * 16; |
|
327 | nb_sm_before_f1.norm_asm = (parameter_dump_packet.sy_lfr_n_asm_p[0] * 256 + parameter_dump_packet.sy_lfr_n_asm_p[1]) * 16; | |
328 | nb_sm_before_f1.sbm2_bp1 = parameter_dump_packet.sy_lfr_s2_bp_p0 * 16; |
|
328 | nb_sm_before_f1.sbm2_bp1 = parameter_dump_packet.sy_lfr_s2_bp_p0 * 16; | |
329 | nb_sm_before_f1.sbm2_bp2 = parameter_dump_packet.sy_lfr_s2_bp_p1 * 16; |
|
329 | nb_sm_before_f1.sbm2_bp2 = parameter_dump_packet.sy_lfr_s2_bp_p1 * 16; | |
330 | nb_sm_before_f1.burst_bp1 = parameter_dump_packet.sy_lfr_b_bp_p0 * 16; |
|
330 | nb_sm_before_f1.burst_bp1 = parameter_dump_packet.sy_lfr_b_bp_p0 * 16; | |
331 | nb_sm_before_f1.burst_bp2 = parameter_dump_packet.sy_lfr_b_bp_p1 * 16; |
|
331 | nb_sm_before_f1.burst_bp2 = parameter_dump_packet.sy_lfr_b_bp_p1 * 16; | |
332 |
|
332 | |||
333 | if (lfrMode == LFR_MODE_SBM2) |
|
333 | if (lfrMode == LFR_MODE_SBM2) | |
334 | { |
|
334 | { | |
335 | nb_sm_before_f1.burst_sbm_bp1 = nb_sm_before_f1.sbm2_bp1; |
|
335 | nb_sm_before_f1.burst_sbm_bp1 = nb_sm_before_f1.sbm2_bp1; | |
336 | nb_sm_before_f1.burst_sbm_bp2 = nb_sm_before_f1.sbm2_bp2; |
|
336 | nb_sm_before_f1.burst_sbm_bp2 = nb_sm_before_f1.sbm2_bp2; | |
337 | } |
|
337 | } | |
338 | else if (lfrMode == LFR_MODE_BURST) |
|
338 | else if (lfrMode == LFR_MODE_BURST) | |
339 | { |
|
339 | { | |
340 | nb_sm_before_f1.burst_sbm_bp1 = nb_sm_before_f1.burst_bp1; |
|
340 | nb_sm_before_f1.burst_sbm_bp1 = nb_sm_before_f1.burst_bp1; | |
341 | nb_sm_before_f1.burst_sbm_bp2 = nb_sm_before_f1.burst_bp2; |
|
341 | nb_sm_before_f1.burst_sbm_bp2 = nb_sm_before_f1.burst_bp2; | |
342 | } |
|
342 | } | |
343 | else |
|
343 | else | |
344 | { |
|
344 | { | |
345 | nb_sm_before_f1.burst_sbm_bp1 = nb_sm_before_f1.burst_bp1; |
|
345 | nb_sm_before_f1.burst_sbm_bp1 = nb_sm_before_f1.burst_bp1; | |
346 | nb_sm_before_f1.burst_sbm_bp2 = nb_sm_before_f1.burst_bp2; |
|
346 | nb_sm_before_f1.burst_sbm_bp2 = nb_sm_before_f1.burst_bp2; | |
347 | } |
|
347 | } | |
348 | } |
|
348 | } | |
349 |
|
349 |
@@ -1,253 +1,253 | |||||
1 | /** Functions related to data processing. |
|
1 | /** Functions related to data processing. | |
2 | * |
|
2 | * | |
3 | * @file |
|
3 | * @file | |
4 | * @author P. LEROY |
|
4 | * @author P. LEROY | |
5 | * |
|
5 | * | |
6 | * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation. |
|
6 | * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation. | |
7 | * |
|
7 | * | |
8 | */ |
|
8 | */ | |
9 |
|
9 | |||
10 | #include "avf2_prc2.h" |
|
10 | #include "avf2_prc2.h" | |
11 |
|
11 | |||
12 | nb_sm_before_bp_asm_f2 nb_sm_before_f2; |
|
12 | nb_sm_before_bp_asm_f2 nb_sm_before_f2; | |
13 |
|
13 | |||
14 | //*** |
|
14 | //*** | |
15 | // F2 |
|
15 | // F2 | |
16 | ring_node_asm asm_ring_norm_f2 [ NB_RING_NODES_ASM_NORM_F2 ]; |
|
16 | ring_node_asm asm_ring_norm_f2 [ NB_RING_NODES_ASM_NORM_F2 ]; | |
17 | ring_node_asm asm_ring_burst_sbm_f2[ NB_RING_NODES_ASM_BURST_SBM_F2 ]; |
|
17 | ring_node_asm asm_ring_burst_sbm_f2[ NB_RING_NODES_ASM_BURST_SBM_F2 ]; | |
18 |
|
18 | |||
19 | float asm_f2_reorganized [ TOTAL_SIZE_SM ]; |
|
19 | float asm_f2_reorganized [ TOTAL_SIZE_SM ]; | |
20 | char asm_f2_char [ TIME_OFFSET_IN_BYTES + (TOTAL_SIZE_SM * 2) ]; |
|
20 | char asm_f2_char [ TIME_OFFSET_IN_BYTES + (TOTAL_SIZE_SM * 2) ]; | |
21 | float compressed_sm_norm_f2[ TOTAL_SIZE_COMPRESSED_ASM_NORM_F2]; |
|
21 | float compressed_sm_norm_f2[ TOTAL_SIZE_COMPRESSED_ASM_NORM_F2]; | |
22 | float compressed_sm_sbm_f2 [ TOTAL_SIZE_COMPRESSED_ASM_SBM_F2 ]; |
|
22 | float compressed_sm_sbm_f2 [ TOTAL_SIZE_COMPRESSED_ASM_SBM_F2 ]; | |
23 |
|
23 | |||
24 | //************ |
|
24 | //************ | |
25 | // RTEMS TASKS |
|
25 | // RTEMS TASKS | |
26 |
|
26 | |||
27 | //*** |
|
27 | //*** | |
28 | // F2 |
|
28 | // F2 | |
29 | rtems_task avf2_task( rtems_task_argument argument ) |
|
29 | rtems_task avf2_task( rtems_task_argument argument ) | |
30 | { |
|
30 | { | |
31 | rtems_event_set event_out; |
|
31 | rtems_event_set event_out; | |
32 | rtems_status_code status; |
|
32 | rtems_status_code status; | |
33 | rtems_id queue_id_prc2; |
|
33 | rtems_id queue_id_prc2; | |
34 | asm_msg msgForMATR; |
|
34 | asm_msg msgForMATR; | |
35 | ring_node_asm *current_ring_node_asm_norm_f2; |
|
35 | ring_node_asm *current_ring_node_asm_norm_f2; | |
36 |
|
36 | |||
37 | unsigned int nb_norm_bp1; |
|
37 | unsigned int nb_norm_bp1; | |
38 | unsigned int nb_norm_bp2; |
|
38 | unsigned int nb_norm_bp2; | |
39 | unsigned int nb_norm_asm; |
|
39 | unsigned int nb_norm_asm; | |
40 |
|
40 | |||
41 | nb_norm_bp1 = 0; |
|
41 | nb_norm_bp1 = 0; | |
42 | nb_norm_bp2 = 0; |
|
42 | nb_norm_bp2 = 0; | |
43 | nb_norm_asm = 0; |
|
43 | nb_norm_asm = 0; | |
44 |
|
44 | |||
45 | reset_nb_sm_f2( ); // reset the sm counters that drive the BP and ASM computations / transmissions |
|
45 | reset_nb_sm_f2( ); // reset the sm counters that drive the BP and ASM computations / transmissions | |
46 | ASM_generic_init_ring( asm_ring_norm_f2, NB_RING_NODES_ASM_NORM_F2 ); |
|
46 | ASM_generic_init_ring( asm_ring_norm_f2, NB_RING_NODES_ASM_NORM_F2 ); | |
47 | current_ring_node_asm_norm_f2 = asm_ring_norm_f2; |
|
47 | current_ring_node_asm_norm_f2 = asm_ring_norm_f2; | |
48 |
|
48 | |||
49 | BOOT_PRINTF("in AVF2 ***\n") |
|
49 | BOOT_PRINTF("in AVF2 ***\n") | |
50 |
|
50 | |||
51 | status = get_message_queue_id_prc2( &queue_id_prc2 ); |
|
51 | status = get_message_queue_id_prc2( &queue_id_prc2 ); | |
52 | if (status != RTEMS_SUCCESSFUL) |
|
52 | if (status != RTEMS_SUCCESSFUL) | |
53 | { |
|
53 | { | |
54 | PRINTF1("in AVF2 *** ERR get_message_queue_id_prc2 %d\n", status) |
|
54 | PRINTF1("in AVF2 *** ERR get_message_queue_id_prc2 %d\n", status) | |
55 | } |
|
55 | } | |
56 |
|
56 | |||
57 | while(1){ |
|
57 | while(1){ | |
58 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
58 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 | |
59 |
|
59 | |||
60 | // compute the average and store it in the averaged_sm_f2 buffer |
|
60 | // compute the average and store it in the averaged_sm_f2 buffer | |
61 | SM_average_f2( current_ring_node_asm_norm_f2->matrix, |
|
61 | SM_average_f2( current_ring_node_asm_norm_f2->matrix, | |
62 | ring_node_for_averaging_sm_f2, |
|
62 | ring_node_for_averaging_sm_f2, | |
63 | nb_norm_bp1 ); |
|
63 | nb_norm_bp1 ); | |
64 |
|
64 | |||
65 | // update nb_average |
|
65 | // update nb_average | |
66 | nb_norm_bp1 = nb_norm_bp1 + NB_SM_BEFORE_AVF2; |
|
66 | nb_norm_bp1 = nb_norm_bp1 + NB_SM_BEFORE_AVF2; | |
67 | nb_norm_bp2 = nb_norm_bp2 + NB_SM_BEFORE_AVF2; |
|
67 | nb_norm_bp2 = nb_norm_bp2 + NB_SM_BEFORE_AVF2; | |
68 | nb_norm_asm = nb_norm_asm + NB_SM_BEFORE_AVF2; |
|
68 | nb_norm_asm = nb_norm_asm + NB_SM_BEFORE_AVF2; | |
69 |
|
69 | |||
70 | //**************************************** |
|
70 | //**************************************** | |
71 | // initialize the mesage for the MATR task |
|
71 | // initialize the mesage for the MATR task | |
72 | msgForMATR.event = 0x00; // this composite event will be sent to the MATR task |
|
72 | msgForMATR.event = 0x00; // this composite event will be sent to the MATR task | |
73 | msgForMATR.burst_sbm = NULL; |
|
73 | msgForMATR.burst_sbm = NULL; | |
74 | msgForMATR.norm = current_ring_node_asm_norm_f2; |
|
74 | msgForMATR.norm = current_ring_node_asm_norm_f2; | |
75 | // msgForMATR.coarseTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[0]; |
|
75 | // msgForMATR.coarseTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[0]; | |
76 | // msgForMATR.fineTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[1]; |
|
76 | // msgForMATR.fineTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[1]; | |
77 | msgForMATR.coarseTime = time_management_regs->coarse_time; |
|
77 | msgForMATR.coarseTime = time_management_regs->coarse_time; | |
78 | msgForMATR.fineTime = time_management_regs->fine_time; |
|
78 | msgForMATR.fineTime = time_management_regs->fine_time; | |
79 |
|
79 | |||
80 | if (nb_norm_bp1 == nb_sm_before_f2.norm_bp1) |
|
80 | if (nb_norm_bp1 == nb_sm_before_f2.norm_bp1) | |
81 | { |
|
81 | { | |
82 | nb_norm_bp1 = 0; |
|
82 | nb_norm_bp1 = 0; | |
83 | // set another ring for the ASM storage |
|
83 | // set another ring for the ASM storage | |
84 | current_ring_node_asm_norm_f2 = current_ring_node_asm_norm_f2->next; |
|
84 | current_ring_node_asm_norm_f2 = current_ring_node_asm_norm_f2->next; | |
85 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) || (lfrCurrentMode == LFR_MODE_SBM1) |
|
85 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) || (lfrCurrentMode == LFR_MODE_SBM1) | |
86 | || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
86 | || (lfrCurrentMode == LFR_MODE_SBM2) ) | |
87 | { |
|
87 | { | |
88 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP1_F2; |
|
88 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP1_F2; | |
89 | } |
|
89 | } | |
90 | } |
|
90 | } | |
91 |
|
91 | |||
92 | if (nb_norm_bp2 == nb_sm_before_f2.norm_bp2) |
|
92 | if (nb_norm_bp2 == nb_sm_before_f2.norm_bp2) | |
93 | { |
|
93 | { | |
94 | nb_norm_bp2 = 0; |
|
94 | nb_norm_bp2 = 0; | |
95 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) || (lfrCurrentMode == LFR_MODE_SBM1) |
|
95 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) || (lfrCurrentMode == LFR_MODE_SBM1) | |
96 | || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
96 | || (lfrCurrentMode == LFR_MODE_SBM2) ) | |
97 | { |
|
97 | { | |
98 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP2_F2; |
|
98 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP2_F2; | |
99 | } |
|
99 | } | |
100 | } |
|
100 | } | |
101 |
|
101 | |||
102 | if (nb_norm_asm == nb_sm_before_f2.norm_asm) |
|
102 | if (nb_norm_asm == nb_sm_before_f2.norm_asm) | |
103 | { |
|
103 | { | |
104 | nb_norm_asm = 0; |
|
104 | nb_norm_asm = 0; | |
105 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) || (lfrCurrentMode == LFR_MODE_SBM1) |
|
105 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) || (lfrCurrentMode == LFR_MODE_SBM1) | |
106 | || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
106 | || (lfrCurrentMode == LFR_MODE_SBM2) ) | |
107 | { |
|
107 | { | |
108 | // PRINTF1("%lld\n", localTime) |
|
108 | // PRINTF1("%lld\n", localTime) | |
109 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_ASM_F2; |
|
109 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_ASM_F2; | |
110 | } |
|
110 | } | |
111 | } |
|
111 | } | |
112 |
|
112 | |||
113 | //************************* |
|
113 | //************************* | |
114 | // send the message to MATR |
|
114 | // send the message to MATR | |
115 | if (msgForMATR.event != 0x00) |
|
115 | if (msgForMATR.event != 0x00) | |
116 | { |
|
116 | { | |
117 | status = rtems_message_queue_send( queue_id_prc2, (char *) &msgForMATR, MSG_QUEUE_SIZE_PRC0); |
|
117 | status = rtems_message_queue_send( queue_id_prc2, (char *) &msgForMATR, MSG_QUEUE_SIZE_PRC0); | |
118 | } |
|
118 | } | |
119 |
|
119 | |||
120 | if (status != RTEMS_SUCCESSFUL) { |
|
120 | if (status != RTEMS_SUCCESSFUL) { | |
121 | printf("in AVF2 *** Error sending message to MATR, code %d\n", status); |
|
121 | printf("in AVF2 *** Error sending message to MATR, code %d\n", status); | |
122 | } |
|
122 | } | |
123 | } |
|
123 | } | |
124 | } |
|
124 | } | |
125 |
|
125 | |||
126 | rtems_task prc2_task( rtems_task_argument argument ) |
|
126 | rtems_task prc2_task( rtems_task_argument argument ) | |
127 | { |
|
127 | { | |
128 | char incomingData[MSG_QUEUE_SIZE_SEND]; // incoming data buffer |
|
128 | char incomingData[MSG_QUEUE_SIZE_SEND]; // incoming data buffer | |
129 | size_t size; // size of the incoming TC packet |
|
129 | size_t size; // size of the incoming TC packet | |
130 | asm_msg *incomingMsg; |
|
130 | asm_msg *incomingMsg; | |
131 | // |
|
131 | // | |
132 | spw_ioctl_pkt_send spw_ioctl_send_ASM; |
|
132 | spw_ioctl_pkt_send spw_ioctl_send_ASM; | |
133 | rtems_status_code status; |
|
133 | rtems_status_code status; | |
134 | rtems_id queue_id; |
|
134 | rtems_id queue_id; | |
135 | rtems_id queue_id_q_p2; |
|
135 | rtems_id queue_id_q_p2; | |
136 | Header_TM_LFR_SCIENCE_ASM_t headerASM; |
|
136 | Header_TM_LFR_SCIENCE_ASM_t headerASM; | |
137 | bp_packet packet_norm_bp1_f2; |
|
137 | bp_packet packet_norm_bp1_f2; | |
138 | bp_packet packet_norm_bp2_f2; |
|
138 | bp_packet packet_norm_bp2_f2; | |
139 |
|
139 | |||
140 | unsigned long long int localTime; |
|
140 | unsigned long long int localTime; | |
141 |
|
141 | |||
142 | ASM_init_header( &headerASM ); |
|
142 | ASM_init_header( &headerASM ); | |
143 |
|
143 | |||
144 | //************* |
|
144 | //************* | |
145 | // NORM headers |
|
145 | // NORM headers | |
146 | BP_init_header( &packet_norm_bp1_f2.header, |
|
146 | BP_init_header( &packet_norm_bp1_f2.header, | |
147 | APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F2, |
|
147 | APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F2, | |
148 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F2, NB_BINS_COMPRESSED_SM_F2 ); |
|
148 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F2, NB_BINS_COMPRESSED_SM_F2 ); | |
149 | BP_init_header( &packet_norm_bp2_f2.header, |
|
149 | BP_init_header( &packet_norm_bp2_f2.header, | |
150 | APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP2_F2, |
|
150 | APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP2_F2, | |
151 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F2, NB_BINS_COMPRESSED_SM_F2 ); |
|
151 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F2, NB_BINS_COMPRESSED_SM_F2 ); | |
152 |
|
152 | |||
153 | status = get_message_queue_id_send( &queue_id ); |
|
153 | status = get_message_queue_id_send( &queue_id ); | |
154 | if (status != RTEMS_SUCCESSFUL) |
|
154 | if (status != RTEMS_SUCCESSFUL) | |
155 | { |
|
155 | { | |
156 | PRINTF1("in PRC2 *** ERR get_message_queue_id_send %d\n", status) |
|
156 | PRINTF1("in PRC2 *** ERR get_message_queue_id_send %d\n", status) | |
157 | } |
|
157 | } | |
158 | status = get_message_queue_id_prc2( &queue_id_q_p2); |
|
158 | status = get_message_queue_id_prc2( &queue_id_q_p2); | |
159 | if (status != RTEMS_SUCCESSFUL) |
|
159 | if (status != RTEMS_SUCCESSFUL) | |
160 | { |
|
160 | { | |
161 | PRINTF1("in PRC2 *** ERR get_message_queue_id_prc2 %d\n", status) |
|
161 | PRINTF1("in PRC2 *** ERR get_message_queue_id_prc2 %d\n", status) | |
162 | } |
|
162 | } | |
163 |
|
163 | |||
164 | BOOT_PRINTF("in PRC2 ***\n") |
|
164 | BOOT_PRINTF("in PRC2 ***\n") | |
165 |
|
165 | |||
166 | while(1){ |
|
166 | while(1){ | |
167 | status = rtems_message_queue_receive( queue_id_q_p2, incomingData, &size, //************************************ |
|
167 | status = rtems_message_queue_receive( queue_id_q_p2, incomingData, &size, //************************************ | |
168 | RTEMS_WAIT, RTEMS_NO_TIMEOUT ); // wait for a message coming from AVF0 |
|
168 | RTEMS_WAIT, RTEMS_NO_TIMEOUT ); // wait for a message coming from AVF0 | |
169 |
|
169 | |||
170 | incomingMsg = (asm_msg*) incomingData; |
|
170 | incomingMsg = (asm_msg*) incomingData; | |
171 |
|
171 | |||
172 | localTime = getTimeAsUnsignedLongLongInt( ); |
|
172 | localTime = getTimeAsUnsignedLongLongInt( ); | |
173 |
|
173 | |||
174 | //***** |
|
174 | //***** | |
175 | //***** |
|
175 | //***** | |
176 | // NORM |
|
176 | // NORM | |
177 | //***** |
|
177 | //***** | |
178 | //***** |
|
178 | //***** | |
179 | if (incomingMsg->event & RTEMS_EVENT_NORM_BP1_F2) |
|
179 | if (incomingMsg->event & RTEMS_EVENT_NORM_BP1_F2) | |
180 | { |
|
180 | { | |
181 | // 1) compress the matrix for Basic Parameters calculation |
|
181 | // 1) compress the matrix for Basic Parameters calculation | |
182 | ASM_compress_reorganize_and_divide( incomingMsg->norm->matrix, compressed_sm_norm_f2, |
|
182 | ASM_compress_reorganize_and_divide( incomingMsg->norm->matrix, compressed_sm_norm_f2, | |
183 | nb_sm_before_f2.norm_bp1, |
|
183 | nb_sm_before_f2.norm_bp1, | |
184 | NB_BINS_COMPRESSED_SM_F2, NB_BINS_TO_AVERAGE_ASM_F2, |
|
184 | NB_BINS_COMPRESSED_SM_F2, NB_BINS_TO_AVERAGE_ASM_F2, | |
185 | ASM_F2_INDICE_START ); |
|
185 | ASM_F2_INDICE_START ); | |
186 | // 2) compute the BP1 set |
|
186 | // 2) compute the BP1 set | |
187 |
|
187 | |||
188 | // 3) send the BP1 set |
|
188 | // 3) send the BP1 set | |
189 | set_time( packet_norm_bp1_f2.header.time, (unsigned char *) &incomingMsg->coarseTime ); |
|
189 | set_time( packet_norm_bp1_f2.header.time, (unsigned char *) &incomingMsg->coarseTime ); | |
190 |
set_time( packet_norm_bp1_f2.header.acquisitionTime, (unsigned char *) &incomingMsg-> |
|
190 | set_time( packet_norm_bp1_f2.header.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime ); | |
191 | BP_send( (char *) &packet_norm_bp1_f2, queue_id, |
|
191 | BP_send( (char *) &packet_norm_bp1_f2, queue_id, | |
192 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F2 + PACKET_LENGTH_DELTA, |
|
192 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F2 + PACKET_LENGTH_DELTA, | |
193 | SID_NORM_BP1_F2 ); |
|
193 | SID_NORM_BP1_F2 ); | |
194 | if (incomingMsg->event & RTEMS_EVENT_NORM_BP2_F2) |
|
194 | if (incomingMsg->event & RTEMS_EVENT_NORM_BP2_F2) | |
195 | { |
|
195 | { | |
196 | // 1) compute the BP2 set using the same ASM as the one used for BP1 |
|
196 | // 1) compute the BP2 set using the same ASM as the one used for BP1 | |
197 |
|
197 | |||
198 | // 2) send the BP2 set |
|
198 | // 2) send the BP2 set | |
199 | set_time( packet_norm_bp2_f2.header.time, (unsigned char *) &incomingMsg->coarseTime ); |
|
199 | set_time( packet_norm_bp2_f2.header.time, (unsigned char *) &incomingMsg->coarseTime ); | |
200 |
set_time( packet_norm_bp2_f2.header.acquisitionTime, (unsigned char *) &incomingMsg-> |
|
200 | set_time( packet_norm_bp2_f2.header.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime ); | |
201 | BP_send( (char *) &packet_norm_bp2_f2, queue_id, |
|
201 | BP_send( (char *) &packet_norm_bp2_f2, queue_id, | |
202 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F2 + PACKET_LENGTH_DELTA, |
|
202 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F2 + PACKET_LENGTH_DELTA, | |
203 | SID_NORM_BP2_F2 ); |
|
203 | SID_NORM_BP2_F2 ); | |
204 | } |
|
204 | } | |
205 | } |
|
205 | } | |
206 |
|
206 | |||
207 | if (incomingMsg->event & RTEMS_EVENT_NORM_ASM_F2) |
|
207 | if (incomingMsg->event & RTEMS_EVENT_NORM_ASM_F2) | |
208 | { |
|
208 | { | |
209 | // 1) reorganize the ASM and divide |
|
209 | // 1) reorganize the ASM and divide | |
210 | ASM_reorganize_and_divide( incomingMsg->norm->matrix, |
|
210 | ASM_reorganize_and_divide( incomingMsg->norm->matrix, | |
211 | asm_f2_reorganized, |
|
211 | asm_f2_reorganized, | |
212 | nb_sm_before_f2.norm_bp1 ); |
|
212 | nb_sm_before_f2.norm_bp1 ); | |
213 | // 2) convert the float array in a char array |
|
213 | // 2) convert the float array in a char array | |
214 | ASM_convert( asm_f2_reorganized, asm_f2_char); |
|
214 | ASM_convert( asm_f2_reorganized, asm_f2_char); | |
215 | // 3) send the spectral matrix packets |
|
215 | // 3) send the spectral matrix packets | |
216 | set_time( headerASM.time , (unsigned char *) &incomingMsg->coarseTime ); |
|
216 | set_time( headerASM.time , (unsigned char *) &incomingMsg->coarseTime ); | |
217 | set_time( headerASM.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime ); |
|
217 | set_time( headerASM.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime ); | |
218 | ASM_send( &headerASM, asm_f2_char, SID_NORM_ASM_F2, &spw_ioctl_send_ASM, queue_id); |
|
218 | ASM_send( &headerASM, asm_f2_char, SID_NORM_ASM_F2, &spw_ioctl_send_ASM, queue_id); | |
219 | } |
|
219 | } | |
220 |
|
220 | |||
221 | } |
|
221 | } | |
222 | } |
|
222 | } | |
223 |
|
223 | |||
224 | //********** |
|
224 | //********** | |
225 | // FUNCTIONS |
|
225 | // FUNCTIONS | |
226 |
|
226 | |||
227 | void reset_nb_sm_f2( void ) |
|
227 | void reset_nb_sm_f2( void ) | |
228 | { |
|
228 | { | |
229 | nb_sm_before_f2.norm_bp1 = parameter_dump_packet.sy_lfr_n_bp_p0; |
|
229 | nb_sm_before_f2.norm_bp1 = parameter_dump_packet.sy_lfr_n_bp_p0; | |
230 | nb_sm_before_f2.norm_bp2 = parameter_dump_packet.sy_lfr_n_bp_p1; |
|
230 | nb_sm_before_f2.norm_bp2 = parameter_dump_packet.sy_lfr_n_bp_p1; | |
231 | nb_sm_before_f2.norm_asm = parameter_dump_packet.sy_lfr_n_asm_p[0] * 256 + parameter_dump_packet.sy_lfr_n_asm_p[1]; |
|
231 | nb_sm_before_f2.norm_asm = parameter_dump_packet.sy_lfr_n_asm_p[0] * 256 + parameter_dump_packet.sy_lfr_n_asm_p[1]; | |
232 | } |
|
232 | } | |
233 |
|
233 | |||
234 | void SM_average_f2( float *averaged_spec_mat_f2, |
|
234 | void SM_average_f2( float *averaged_spec_mat_f2, | |
235 | ring_node_sm *ring_node, |
|
235 | ring_node_sm *ring_node, | |
236 | unsigned int nbAverageNormF2 ) |
|
236 | unsigned int nbAverageNormF2 ) | |
237 | { |
|
237 | { | |
238 | float sum; |
|
238 | float sum; | |
239 | unsigned int i; |
|
239 | unsigned int i; | |
240 |
|
240 | |||
241 | for(i=0; i<TOTAL_SIZE_SM; i++) |
|
241 | for(i=0; i<TOTAL_SIZE_SM; i++) | |
242 | { |
|
242 | { | |
243 | sum = ( (int *) (ring_node->buffer_address) ) [ i ]; |
|
243 | sum = ( (int *) (ring_node->buffer_address) ) [ i ]; | |
244 | if ( (nbAverageNormF2 == 0) ) |
|
244 | if ( (nbAverageNormF2 == 0) ) | |
245 | { |
|
245 | { | |
246 | averaged_spec_mat_f2[ i ] = sum; |
|
246 | averaged_spec_mat_f2[ i ] = sum; | |
247 | } |
|
247 | } | |
248 | else |
|
248 | else | |
249 | { |
|
249 | { | |
250 | averaged_spec_mat_f2[ i ] = ( averaged_spec_mat_f2[ i ] + sum ); |
|
250 | averaged_spec_mat_f2[ i ] = ( averaged_spec_mat_f2[ i ] + sum ); | |
251 | } |
|
251 | } | |
252 | } |
|
252 | } | |
253 | } |
|
253 | } |
@@ -1,458 +1,459 | |||||
1 | /** Functions related to data processing. |
|
1 | /** Functions related to data processing. | |
2 | * |
|
2 | * | |
3 | * @file |
|
3 | * @file | |
4 | * @author P. LEROY |
|
4 | * @author P. LEROY | |
5 | * |
|
5 | * | |
6 | * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation. |
|
6 | * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation. | |
7 | * |
|
7 | * | |
8 | */ |
|
8 | */ | |
9 |
|
9 | |||
10 | #include "fsw_processing.h" |
|
10 | #include "fsw_processing.h" | |
11 | #include "fsw_processing_globals.c" |
|
11 | #include "fsw_processing_globals.c" | |
12 |
|
12 | |||
13 | unsigned int nb_sm_f0; |
|
13 | unsigned int nb_sm_f0; | |
14 | unsigned int nb_sm_f0_aux_f1; |
|
14 | unsigned int nb_sm_f0_aux_f1; | |
15 | unsigned int nb_sm_f1; |
|
15 | unsigned int nb_sm_f1; | |
16 | unsigned int nb_sm_f0_aux_f2; |
|
16 | unsigned int nb_sm_f0_aux_f2; | |
17 |
|
17 | |||
18 | //************************ |
|
18 | //************************ | |
19 | // spectral matrices rings |
|
19 | // spectral matrices rings | |
20 | ring_node_sm sm_ring_f0[ NB_RING_NODES_SM_F0 ]; |
|
20 | ring_node_sm sm_ring_f0[ NB_RING_NODES_SM_F0 ]; | |
21 | ring_node_sm sm_ring_f1[ NB_RING_NODES_SM_F1 ]; |
|
21 | ring_node_sm sm_ring_f1[ NB_RING_NODES_SM_F1 ]; | |
22 | ring_node_sm sm_ring_f2[ NB_RING_NODES_SM_F2 ]; |
|
22 | ring_node_sm sm_ring_f2[ NB_RING_NODES_SM_F2 ]; | |
23 | ring_node_sm *current_ring_node_sm_f0; |
|
23 | ring_node_sm *current_ring_node_sm_f0; | |
24 | ring_node_sm *current_ring_node_sm_f1; |
|
24 | ring_node_sm *current_ring_node_sm_f1; | |
25 | ring_node_sm *current_ring_node_sm_f2; |
|
25 | ring_node_sm *current_ring_node_sm_f2; | |
26 | ring_node_sm *ring_node_for_averaging_sm_f0; |
|
26 | ring_node_sm *ring_node_for_averaging_sm_f0; | |
27 | ring_node_sm *ring_node_for_averaging_sm_f1; |
|
27 | ring_node_sm *ring_node_for_averaging_sm_f1; | |
28 | ring_node_sm *ring_node_for_averaging_sm_f2; |
|
28 | ring_node_sm *ring_node_for_averaging_sm_f2; | |
29 |
|
29 | |||
30 | //*********************************************************** |
|
30 | //*********************************************************** | |
31 | // Interrupt Service Routine for spectral matrices processing |
|
31 | // Interrupt Service Routine for spectral matrices processing | |
32 |
|
32 | |||
33 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ) |
|
33 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ) | |
34 | { |
|
34 | { | |
35 | // ring_node_sm *previous_ring_node_sm_f0; |
|
35 | // ring_node_sm *previous_ring_node_sm_f0; | |
36 |
|
36 | |||
37 | //// rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); |
|
37 | //// rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); | |
38 |
|
38 | |||
39 | // previous_ring_node_sm_f0 = current_ring_node_sm_f0; |
|
39 | // previous_ring_node_sm_f0 = current_ring_node_sm_f0; | |
40 |
|
40 | |||
41 | // if ( (spectral_matrix_regs->status & 0x2) == 0x02) // check ready matrix bit f0_1 |
|
41 | // if ( (spectral_matrix_regs->status & 0x2) == 0x02) // check ready matrix bit f0_1 | |
42 | // { |
|
42 | // { | |
43 | // current_ring_node_sm_f0 = current_ring_node_sm_f0->next; |
|
43 | // current_ring_node_sm_f0 = current_ring_node_sm_f0->next; | |
44 | // spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address; |
|
44 | // spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address; | |
45 | // spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd; // 1101 |
|
45 | // spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd; // 1101 | |
46 | // nb_sm_f0 = nb_sm_f0 + 1; |
|
46 | // nb_sm_f0 = nb_sm_f0 + 1; | |
47 | // } |
|
47 | // } | |
48 |
|
48 | |||
49 | // //************************ |
|
49 | // //************************ | |
50 | // // reset status error bits |
|
50 | // // reset status error bits | |
51 | // if ( (spectral_matrix_regs->status & 0x30) != 0x00) |
|
51 | // if ( (spectral_matrix_regs->status & 0x30) != 0x00) | |
52 | // { |
|
52 | // { | |
53 | // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); |
|
53 | // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); | |
54 | // spectral_matrix_regs->status = spectral_matrix_regs->status & 0xffffffcf; // 1100 1111 |
|
54 | // spectral_matrix_regs->status = spectral_matrix_regs->status & 0xffffffcf; // 1100 1111 | |
55 | // } |
|
55 | // } | |
56 |
|
56 | |||
57 | // //************************************** |
|
57 | // //************************************** | |
58 | // // reset ready matrix bits for f0_0, f1 and f2 |
|
58 | // // reset ready matrix bits for f0_0, f1 and f2 | |
59 | // spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff2; // 0010 |
|
59 | // spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff2; // 0010 | |
60 |
|
60 | |||
61 | // if (nb_sm_f0 == NB_SM_BEFORE_AVF0) |
|
61 | // if (nb_sm_f0 == NB_SM_BEFORE_AVF0) | |
62 | // { |
|
62 | // { | |
63 | // ring_node_for_averaging_sm_f0 = previous_ring_node_sm_f0; |
|
63 | // ring_node_for_averaging_sm_f0 = previous_ring_node_sm_f0; | |
64 | // if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
64 | // if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |
65 | // { |
|
65 | // { | |
66 | // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
66 | // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |
67 | // } |
|
67 | // } | |
68 | // nb_sm_f0 = 0; |
|
68 | // nb_sm_f0 = 0; | |
69 | // } |
|
69 | // } | |
70 |
|
70 | |||
71 | } |
|
71 | } | |
72 |
|
72 | |||
73 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ) |
|
73 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ) | |
74 | { |
|
74 | { | |
75 | //*** |
|
75 | //*** | |
76 | // F0 |
|
76 | // F0 | |
77 | nb_sm_f0 = nb_sm_f0 + 1; |
|
77 | nb_sm_f0 = nb_sm_f0 + 1; | |
78 | if (nb_sm_f0 == NB_SM_BEFORE_AVF0 ) |
|
78 | if (nb_sm_f0 == NB_SM_BEFORE_AVF0 ) | |
79 | { |
|
79 | { | |
80 | ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0; |
|
80 | ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0; | |
81 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
81 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |
82 | { |
|
82 | { | |
83 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
83 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |
84 | } |
|
84 | } | |
85 | nb_sm_f0 = 0; |
|
85 | nb_sm_f0 = 0; | |
86 | } |
|
86 | } | |
87 |
|
87 | |||
88 | //*** |
|
88 | //*** | |
89 | // F1 |
|
89 | // F1 | |
90 | nb_sm_f0_aux_f1 = nb_sm_f0_aux_f1 + 1; |
|
90 | nb_sm_f0_aux_f1 = nb_sm_f0_aux_f1 + 1; | |
91 | if (nb_sm_f0_aux_f1 == 6) |
|
91 | if (nb_sm_f0_aux_f1 == 6) | |
92 | { |
|
92 | { | |
93 | nb_sm_f0_aux_f1 = 0; |
|
93 | nb_sm_f0_aux_f1 = 0; | |
94 | nb_sm_f1 = nb_sm_f1 + 1; |
|
94 | nb_sm_f1 = nb_sm_f1 + 1; | |
95 | } |
|
95 | } | |
96 | if (nb_sm_f1 == NB_SM_BEFORE_AVF1 ) |
|
96 | if (nb_sm_f1 == NB_SM_BEFORE_AVF1 ) | |
97 | { |
|
97 | { | |
98 | ring_node_for_averaging_sm_f1 = current_ring_node_sm_f1; |
|
98 | ring_node_for_averaging_sm_f1 = current_ring_node_sm_f1; | |
99 | if (rtems_event_send( Task_id[TASKID_AVF1], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
99 | if (rtems_event_send( Task_id[TASKID_AVF1], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |
100 | { |
|
100 | { | |
101 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
101 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |
102 | } |
|
102 | } | |
103 | nb_sm_f1 = 0; |
|
103 | nb_sm_f1 = 0; | |
104 | } |
|
104 | } | |
105 |
|
105 | |||
106 | //*** |
|
106 | //*** | |
107 | // F2 |
|
107 | // F2 | |
108 | nb_sm_f0_aux_f2 = nb_sm_f0_aux_f2 + 1; |
|
108 | nb_sm_f0_aux_f2 = nb_sm_f0_aux_f2 + 1; | |
109 | if (nb_sm_f0_aux_f2 == 96) |
|
109 | if (nb_sm_f0_aux_f2 == 96) | |
110 | { |
|
110 | { | |
111 | nb_sm_f0_aux_f2 = 0; |
|
111 | nb_sm_f0_aux_f2 = 0; | |
112 | ring_node_for_averaging_sm_f2 = current_ring_node_sm_f2; |
|
112 | ring_node_for_averaging_sm_f2 = current_ring_node_sm_f2; | |
113 | if (rtems_event_send( Task_id[TASKID_AVF2], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
113 | if (rtems_event_send( Task_id[TASKID_AVF2], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |
114 | { |
|
114 | { | |
115 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
115 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |
116 | } |
|
116 | } | |
117 | } |
|
117 | } | |
118 | } |
|
118 | } | |
119 |
|
119 | |||
120 | //****************** |
|
120 | //****************** | |
121 | // Spectral Matrices |
|
121 | // Spectral Matrices | |
122 |
|
122 | |||
123 | void reset_nb_sm( void ) |
|
123 | void reset_nb_sm( void ) | |
124 | { |
|
124 | { | |
125 | nb_sm_f0 = 0; |
|
125 | nb_sm_f0 = 0; | |
126 | nb_sm_f0_aux_f1 = 0; |
|
126 | nb_sm_f0_aux_f1 = 0; | |
127 | nb_sm_f0_aux_f2 = 0; |
|
127 | nb_sm_f0_aux_f2 = 0; | |
128 |
|
128 | |||
129 | nb_sm_f1 = 0; |
|
129 | nb_sm_f1 = 0; | |
130 | } |
|
130 | } | |
131 |
|
131 | |||
132 | void SM_init_rings( void ) |
|
132 | void SM_init_rings( void ) | |
133 | { |
|
133 | { | |
134 | unsigned char i; |
|
134 | unsigned char i; | |
135 |
|
135 | |||
136 | // F0 RING |
|
136 | // F0 RING | |
137 | sm_ring_f0[0].next = (ring_node_sm*) &sm_ring_f0[1]; |
|
137 | sm_ring_f0[0].next = (ring_node_sm*) &sm_ring_f0[1]; | |
138 | sm_ring_f0[0].previous = (ring_node_sm*) &sm_ring_f0[NB_RING_NODES_SM_F0-1]; |
|
138 | sm_ring_f0[0].previous = (ring_node_sm*) &sm_ring_f0[NB_RING_NODES_SM_F0-1]; | |
139 | sm_ring_f0[0].buffer_address = |
|
139 | sm_ring_f0[0].buffer_address = | |
140 | (int) &sm_f0[ 0 ]; |
|
140 | (int) &sm_f0[ 0 ]; | |
141 |
|
141 | |||
142 | sm_ring_f0[NB_RING_NODES_SM_F0-1].next = (ring_node_sm*) &sm_ring_f0[0]; |
|
142 | sm_ring_f0[NB_RING_NODES_SM_F0-1].next = (ring_node_sm*) &sm_ring_f0[0]; | |
143 | sm_ring_f0[NB_RING_NODES_SM_F0-1].previous = (ring_node_sm*) &sm_ring_f0[NB_RING_NODES_SM_F0-2]; |
|
143 | sm_ring_f0[NB_RING_NODES_SM_F0-1].previous = (ring_node_sm*) &sm_ring_f0[NB_RING_NODES_SM_F0-2]; | |
144 | sm_ring_f0[NB_RING_NODES_SM_F0-1].buffer_address = |
|
144 | sm_ring_f0[NB_RING_NODES_SM_F0-1].buffer_address = | |
145 | (int) &sm_f0[ (NB_RING_NODES_SM_F0-1) * TOTAL_SIZE_SM ]; |
|
145 | (int) &sm_f0[ (NB_RING_NODES_SM_F0-1) * TOTAL_SIZE_SM ]; | |
146 |
|
146 | |||
147 | for(i=1; i<NB_RING_NODES_SM_F0-1; i++) |
|
147 | for(i=1; i<NB_RING_NODES_SM_F0-1; i++) | |
148 | { |
|
148 | { | |
149 | sm_ring_f0[i].next = (ring_node_sm*) &sm_ring_f0[i+1]; |
|
149 | sm_ring_f0[i].next = (ring_node_sm*) &sm_ring_f0[i+1]; | |
150 | sm_ring_f0[i].previous = (ring_node_sm*) &sm_ring_f0[i-1]; |
|
150 | sm_ring_f0[i].previous = (ring_node_sm*) &sm_ring_f0[i-1]; | |
151 | sm_ring_f0[i].buffer_address = |
|
151 | sm_ring_f0[i].buffer_address = | |
152 | (int) &sm_f0[ i * TOTAL_SIZE_SM ]; |
|
152 | (int) &sm_f0[ i * TOTAL_SIZE_SM ]; | |
153 | } |
|
153 | } | |
154 |
|
154 | |||
155 | // F1 RING |
|
155 | // F1 RING | |
156 | sm_ring_f1[0].next = (ring_node_sm*) &sm_ring_f1[1]; |
|
156 | sm_ring_f1[0].next = (ring_node_sm*) &sm_ring_f1[1]; | |
157 | sm_ring_f1[0].previous = (ring_node_sm*) &sm_ring_f1[NB_RING_NODES_SM_F1-1]; |
|
157 | sm_ring_f1[0].previous = (ring_node_sm*) &sm_ring_f1[NB_RING_NODES_SM_F1-1]; | |
158 | sm_ring_f1[0].buffer_address = |
|
158 | sm_ring_f1[0].buffer_address = | |
159 | (int) &sm_f1[ 0 ]; |
|
159 | (int) &sm_f1[ 0 ]; | |
160 |
|
160 | |||
161 | sm_ring_f1[NB_RING_NODES_SM_F1-1].next = (ring_node_sm*) &sm_ring_f1[0]; |
|
161 | sm_ring_f1[NB_RING_NODES_SM_F1-1].next = (ring_node_sm*) &sm_ring_f1[0]; | |
162 | sm_ring_f1[NB_RING_NODES_SM_F1-1].previous = (ring_node_sm*) &sm_ring_f1[NB_RING_NODES_SM_F1-2]; |
|
162 | sm_ring_f1[NB_RING_NODES_SM_F1-1].previous = (ring_node_sm*) &sm_ring_f1[NB_RING_NODES_SM_F1-2]; | |
163 | sm_ring_f1[NB_RING_NODES_SM_F1-1].buffer_address = |
|
163 | sm_ring_f1[NB_RING_NODES_SM_F1-1].buffer_address = | |
164 | (int) &sm_f1[ (NB_RING_NODES_SM_F1-1) * TOTAL_SIZE_SM ]; |
|
164 | (int) &sm_f1[ (NB_RING_NODES_SM_F1-1) * TOTAL_SIZE_SM ]; | |
165 |
|
165 | |||
166 | for(i=1; i<NB_RING_NODES_SM_F1-1; i++) |
|
166 | for(i=1; i<NB_RING_NODES_SM_F1-1; i++) | |
167 | { |
|
167 | { | |
168 | sm_ring_f1[i].next = (ring_node_sm*) &sm_ring_f1[i+1]; |
|
168 | sm_ring_f1[i].next = (ring_node_sm*) &sm_ring_f1[i+1]; | |
169 | sm_ring_f1[i].previous = (ring_node_sm*) &sm_ring_f1[i-1]; |
|
169 | sm_ring_f1[i].previous = (ring_node_sm*) &sm_ring_f1[i-1]; | |
170 | sm_ring_f1[i].buffer_address = |
|
170 | sm_ring_f1[i].buffer_address = | |
171 | (int) &sm_f1[ i * TOTAL_SIZE_SM ]; |
|
171 | (int) &sm_f1[ i * TOTAL_SIZE_SM ]; | |
172 | } |
|
172 | } | |
173 |
|
173 | |||
174 | // F2 RING |
|
174 | // F2 RING | |
175 | sm_ring_f2[0].next = (ring_node_sm*) &sm_ring_f2[1]; |
|
175 | sm_ring_f2[0].next = (ring_node_sm*) &sm_ring_f2[1]; | |
176 | sm_ring_f2[0].previous = (ring_node_sm*) &sm_ring_f2[NB_RING_NODES_SM_F2-1]; |
|
176 | sm_ring_f2[0].previous = (ring_node_sm*) &sm_ring_f2[NB_RING_NODES_SM_F2-1]; | |
177 | sm_ring_f2[0].buffer_address = |
|
177 | sm_ring_f2[0].buffer_address = | |
178 | (int) &sm_f2[ 0 ]; |
|
178 | (int) &sm_f2[ 0 ]; | |
179 |
|
179 | |||
180 | sm_ring_f2[NB_RING_NODES_SM_F2-1].next = (ring_node_sm*) &sm_ring_f2[0]; |
|
180 | sm_ring_f2[NB_RING_NODES_SM_F2-1].next = (ring_node_sm*) &sm_ring_f2[0]; | |
181 | sm_ring_f2[NB_RING_NODES_SM_F2-1].previous = (ring_node_sm*) &sm_ring_f2[NB_RING_NODES_SM_F2-2]; |
|
181 | sm_ring_f2[NB_RING_NODES_SM_F2-1].previous = (ring_node_sm*) &sm_ring_f2[NB_RING_NODES_SM_F2-2]; | |
182 | sm_ring_f2[NB_RING_NODES_SM_F2-1].buffer_address = |
|
182 | sm_ring_f2[NB_RING_NODES_SM_F2-1].buffer_address = | |
183 | (int) &sm_f2[ (NB_RING_NODES_SM_F2-1) * TOTAL_SIZE_SM ]; |
|
183 | (int) &sm_f2[ (NB_RING_NODES_SM_F2-1) * TOTAL_SIZE_SM ]; | |
184 |
|
184 | |||
185 | for(i=1; i<NB_RING_NODES_SM_F2-1; i++) |
|
185 | for(i=1; i<NB_RING_NODES_SM_F2-1; i++) | |
186 | { |
|
186 | { | |
187 | sm_ring_f2[i].next = (ring_node_sm*) &sm_ring_f2[i+1]; |
|
187 | sm_ring_f2[i].next = (ring_node_sm*) &sm_ring_f2[i+1]; | |
188 | sm_ring_f2[i].previous = (ring_node_sm*) &sm_ring_f2[i-1]; |
|
188 | sm_ring_f2[i].previous = (ring_node_sm*) &sm_ring_f2[i-1]; | |
189 | sm_ring_f2[i].buffer_address = |
|
189 | sm_ring_f2[i].buffer_address = | |
190 | (int) &sm_f2[ i * TOTAL_SIZE_SM ]; |
|
190 | (int) &sm_f2[ i * TOTAL_SIZE_SM ]; | |
191 | } |
|
191 | } | |
192 |
|
192 | |||
193 | DEBUG_PRINTF1("asm_ring_f0 @%x\n", (unsigned int) sm_ring_f0) |
|
193 | DEBUG_PRINTF1("asm_ring_f0 @%x\n", (unsigned int) sm_ring_f0) | |
194 | DEBUG_PRINTF1("asm_ring_f1 @%x\n", (unsigned int) sm_ring_f1) |
|
194 | DEBUG_PRINTF1("asm_ring_f1 @%x\n", (unsigned int) sm_ring_f1) | |
195 | DEBUG_PRINTF1("asm_ring_f2 @%x\n", (unsigned int) sm_ring_f2) |
|
195 | DEBUG_PRINTF1("asm_ring_f2 @%x\n", (unsigned int) sm_ring_f2) | |
196 |
|
196 | |||
197 | spectral_matrix_regs->matrixF0_Address0 = sm_ring_f0[0].buffer_address; |
|
197 | spectral_matrix_regs->matrixF0_Address0 = sm_ring_f0[0].buffer_address; | |
198 | DEBUG_PRINTF1("spectral_matrix_regs->matrixF0_Address0 @%x\n", spectral_matrix_regs->matrixF0_Address0) |
|
198 | DEBUG_PRINTF1("spectral_matrix_regs->matrixF0_Address0 @%x\n", spectral_matrix_regs->matrixF0_Address0) | |
199 | } |
|
199 | } | |
200 |
|
200 | |||
201 | void ASM_generic_init_ring( ring_node_asm *ring, unsigned char nbNodes ) |
|
201 | void ASM_generic_init_ring( ring_node_asm *ring, unsigned char nbNodes ) | |
202 | { |
|
202 | { | |
203 | unsigned char i; |
|
203 | unsigned char i; | |
204 |
|
204 | |||
205 | ring[ nbNodes - 1 ].next |
|
205 | ring[ nbNodes - 1 ].next | |
206 | = (ring_node_asm*) &ring[ 0 ]; |
|
206 | = (ring_node_asm*) &ring[ 0 ]; | |
207 |
|
207 | |||
208 | for(i=0; i<nbNodes-1; i++) |
|
208 | for(i=0; i<nbNodes-1; i++) | |
209 | { |
|
209 | { | |
210 | ring[ i ].next = (ring_node_asm*) &ring[ i + 1 ]; |
|
210 | ring[ i ].next = (ring_node_asm*) &ring[ i + 1 ]; | |
211 | } |
|
211 | } | |
212 | } |
|
212 | } | |
213 |
|
213 | |||
214 | void SM_reset_current_ring_nodes( void ) |
|
214 | void SM_reset_current_ring_nodes( void ) | |
215 | { |
|
215 | { | |
216 | current_ring_node_sm_f0 = sm_ring_f0; |
|
216 | current_ring_node_sm_f0 = sm_ring_f0; | |
217 | current_ring_node_sm_f1 = sm_ring_f1; |
|
217 | current_ring_node_sm_f1 = sm_ring_f1; | |
218 | current_ring_node_sm_f2 = sm_ring_f2; |
|
218 | current_ring_node_sm_f2 = sm_ring_f2; | |
219 |
|
219 | |||
220 | ring_node_for_averaging_sm_f0 = sm_ring_f0; |
|
220 | ring_node_for_averaging_sm_f0 = sm_ring_f0; | |
221 | ring_node_for_averaging_sm_f1 = sm_ring_f1; |
|
221 | ring_node_for_averaging_sm_f1 = sm_ring_f1; | |
222 | ring_node_for_averaging_sm_f2 = sm_ring_f2; |
|
222 | ring_node_for_averaging_sm_f2 = sm_ring_f2; | |
223 | } |
|
223 | } | |
224 |
|
224 | |||
225 | void ASM_init_header( Header_TM_LFR_SCIENCE_ASM_t *header) |
|
225 | void ASM_init_header( Header_TM_LFR_SCIENCE_ASM_t *header) | |
226 | { |
|
226 | { | |
227 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
227 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; | |
228 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
228 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
229 | header->reserved = 0x00; |
|
229 | header->reserved = 0x00; | |
230 | header->userApplication = CCSDS_USER_APP; |
|
230 | header->userApplication = CCSDS_USER_APP; | |
231 | header->packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8); |
|
231 | header->packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8); | |
232 | header->packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST); |
|
232 | header->packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST); | |
233 | header->packetSequenceControl[0] = 0xc0; |
|
233 | header->packetSequenceControl[0] = 0xc0; | |
234 | header->packetSequenceControl[1] = 0x00; |
|
234 | header->packetSequenceControl[1] = 0x00; | |
235 | header->packetLength[0] = 0x00; |
|
235 | header->packetLength[0] = 0x00; | |
236 | header->packetLength[1] = 0x00; |
|
236 | header->packetLength[1] = 0x00; | |
237 | // DATA FIELD HEADER |
|
237 | // DATA FIELD HEADER | |
238 | header->spare1_pusVersion_spare2 = 0x10; |
|
238 | header->spare1_pusVersion_spare2 = 0x10; | |
239 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
239 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
240 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
240 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
241 | header->destinationID = TM_DESTINATION_ID_GROUND; |
|
241 | header->destinationID = TM_DESTINATION_ID_GROUND; | |
242 | // AUXILIARY DATA HEADER |
|
242 | // AUXILIARY DATA HEADER | |
243 | header->sid = 0x00; |
|
243 | header->sid = 0x00; | |
244 | header->biaStatusInfo = 0x00; |
|
244 | header->biaStatusInfo = 0x00; | |
245 | header->pa_lfr_pkt_cnt_asm = 0x00; |
|
245 | header->pa_lfr_pkt_cnt_asm = 0x00; | |
246 | header->pa_lfr_pkt_nr_asm = 0x00; |
|
246 | header->pa_lfr_pkt_nr_asm = 0x00; | |
247 | header->time[0] = 0x00; |
|
247 | header->time[0] = 0x00; | |
248 | header->time[0] = 0x00; |
|
248 | header->time[0] = 0x00; | |
249 | header->time[0] = 0x00; |
|
249 | header->time[0] = 0x00; | |
250 | header->time[0] = 0x00; |
|
250 | header->time[0] = 0x00; | |
251 | header->time[0] = 0x00; |
|
251 | header->time[0] = 0x00; | |
252 | header->time[0] = 0x00; |
|
252 | header->time[0] = 0x00; | |
253 | header->pa_lfr_asm_blk_nr[0] = 0x00; // BLK_NR MSB |
|
253 | header->pa_lfr_asm_blk_nr[0] = 0x00; // BLK_NR MSB | |
254 | header->pa_lfr_asm_blk_nr[1] = 0x00; // BLK_NR LSB |
|
254 | header->pa_lfr_asm_blk_nr[1] = 0x00; // BLK_NR LSB | |
255 | } |
|
255 | } | |
256 |
|
256 | |||
257 | void ASM_send(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, |
|
257 | void ASM_send(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, | |
258 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id) |
|
258 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id) | |
259 | { |
|
259 | { | |
260 | unsigned int i; |
|
260 | unsigned int i; | |
261 | unsigned int length = 0; |
|
261 | unsigned int length = 0; | |
262 | rtems_status_code status; |
|
262 | rtems_status_code status; | |
263 |
|
263 | |||
264 | for (i=0; i<2; i++) |
|
264 | for (i=0; i<2; i++) | |
265 | { |
|
265 | { | |
266 | // (1) BUILD THE DATA |
|
266 | // (1) BUILD THE DATA | |
267 | switch(sid) |
|
267 | switch(sid) | |
268 | { |
|
268 | { | |
269 | case SID_NORM_ASM_F0: |
|
269 | case SID_NORM_ASM_F0: | |
270 | spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F0_IN_BYTES / 2; // 2 packets will be sent |
|
270 | spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F0_IN_BYTES / 2; // 2 packets will be sent | |
271 | spw_ioctl_send->data = &spectral_matrix[ |
|
271 | spw_ioctl_send->data = &spectral_matrix[ | |
272 | ( (ASM_F0_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F0) ) * NB_VALUES_PER_SM ) * 2 |
|
272 | ( (ASM_F0_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F0) ) * NB_VALUES_PER_SM ) * 2 | |
273 | ]; |
|
273 | ]; | |
274 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0; |
|
274 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0; | |
275 | header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F0) >> 8 ); // BLK_NR MSB |
|
275 | header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F0) >> 8 ); // BLK_NR MSB | |
276 | header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F0); // BLK_NR LSB |
|
276 | header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F0); // BLK_NR LSB | |
277 | break; |
|
277 | break; | |
278 | case SID_NORM_ASM_F1: |
|
278 | case SID_NORM_ASM_F1: | |
279 | spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F1_IN_BYTES / 2; // 2 packets will be sent |
|
279 | spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F1_IN_BYTES / 2; // 2 packets will be sent | |
280 | spw_ioctl_send->data = &spectral_matrix[ |
|
280 | spw_ioctl_send->data = &spectral_matrix[ | |
281 | ( (ASM_F1_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F1) ) * NB_VALUES_PER_SM ) * 2 |
|
281 | ( (ASM_F1_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F1) ) * NB_VALUES_PER_SM ) * 2 | |
282 | ]; |
|
282 | ]; | |
283 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F1; |
|
283 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F1; | |
284 | header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F1) >> 8 ); // BLK_NR MSB |
|
284 | header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F1) >> 8 ); // BLK_NR MSB | |
285 | header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F1); // BLK_NR LSB |
|
285 | header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F1); // BLK_NR LSB | |
286 | break; |
|
286 | break; | |
287 | case SID_NORM_ASM_F2: |
|
287 | case SID_NORM_ASM_F2: | |
288 | spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F2_IN_BYTES / 2; // 2 packets will be sent |
|
288 | spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F2_IN_BYTES / 2; // 2 packets will be sent | |
289 | spw_ioctl_send->data = &spectral_matrix[ |
|
289 | spw_ioctl_send->data = &spectral_matrix[ | |
290 | ( (ASM_F2_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F2) ) * NB_VALUES_PER_SM ) * 2 |
|
290 | ( (ASM_F2_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F2) ) * NB_VALUES_PER_SM ) * 2 | |
291 | ]; |
|
291 | ]; | |
292 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F2; |
|
292 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F2; | |
293 | header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F2) >> 8 ); // BLK_NR MSB |
|
293 | header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F2) >> 8 ); // BLK_NR MSB | |
294 | header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F2); // BLK_NR LSB |
|
294 | header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F2); // BLK_NR LSB | |
295 | break; |
|
295 | break; | |
296 | default: |
|
296 | default: | |
297 | PRINTF1("ERR *** in ASM_send *** unexpected sid %d\n", sid) |
|
297 | PRINTF1("ERR *** in ASM_send *** unexpected sid %d\n", sid) | |
298 | break; |
|
298 | break; | |
299 | } |
|
299 | } | |
300 | spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
300 | spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES; | |
301 | spw_ioctl_send->hdr = (char *) header; |
|
301 | spw_ioctl_send->hdr = (char *) header; | |
302 | spw_ioctl_send->options = 0; |
|
302 | spw_ioctl_send->options = 0; | |
303 |
|
303 | |||
304 | // (2) BUILD THE HEADER |
|
304 | // (2) BUILD THE HEADER | |
305 | increment_seq_counter_source_id( header->packetSequenceControl, sid ); |
|
305 | increment_seq_counter_source_id( header->packetSequenceControl, sid ); | |
306 | header->packetLength[0] = (unsigned char) (length>>8); |
|
306 | header->packetLength[0] = (unsigned char) (length>>8); | |
307 | header->packetLength[1] = (unsigned char) (length); |
|
307 | header->packetLength[1] = (unsigned char) (length); | |
308 | header->sid = (unsigned char) sid; // SID |
|
308 | header->sid = (unsigned char) sid; // SID | |
309 | header->pa_lfr_pkt_cnt_asm = 2; |
|
309 | header->pa_lfr_pkt_cnt_asm = 2; | |
310 | header->pa_lfr_pkt_nr_asm = (unsigned char) (i+1); |
|
310 | header->pa_lfr_pkt_nr_asm = (unsigned char) (i+1); | |
311 |
|
311 | |||
312 | // (3) SET PACKET TIME |
|
312 | // (3) SET PACKET TIME | |
313 | header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
313 | header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
314 | header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
314 | header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
315 | header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
315 | header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
316 | header->time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
316 | header->time[3] = (unsigned char) (time_management_regs->coarse_time); | |
317 | header->time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
317 | header->time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
318 | header->time[5] = (unsigned char) (time_management_regs->fine_time); |
|
318 | header->time[5] = (unsigned char) (time_management_regs->fine_time); | |
319 | // |
|
319 | // | |
320 |
header->acquisitionTime[0] = |
|
320 | header->acquisitionTime[0] = header->time[0]; | |
321 |
header->acquisitionTime[1] = |
|
321 | header->acquisitionTime[1] = header->time[1]; | |
322 |
header->acquisitionTime[2] = |
|
322 | header->acquisitionTime[2] = header->time[2]; | |
323 |
header->acquisitionTime[3] = |
|
323 | header->acquisitionTime[3] = header->time[3]; | |
324 |
header->acquisitionTime[4] = |
|
324 | header->acquisitionTime[4] = header->time[4]; | |
325 |
header->acquisitionTime[5] = |
|
325 | header->acquisitionTime[5] = header->time[5]; | |
326 |
|
326 | |||
327 | // (4) SEND PACKET |
|
327 | // (4) SEND PACKET | |
328 | status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE); |
|
328 | status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE); | |
329 | if (status != RTEMS_SUCCESSFUL) { |
|
329 | if (status != RTEMS_SUCCESSFUL) { | |
330 | printf("in ASM_send *** ERR %d\n", (int) status); |
|
330 | printf("in ASM_send *** ERR %d\n", (int) status); | |
331 | } |
|
331 | } | |
332 | } |
|
332 | } | |
333 | } |
|
333 | } | |
334 |
|
334 | |||
335 | //***************** |
|
335 | //***************** | |
336 | // Basic Parameters |
|
336 | // Basic Parameters | |
337 |
|
337 | |||
338 | void BP_init_header( Header_TM_LFR_SCIENCE_BP_t *header, |
|
338 | void BP_init_header( Header_TM_LFR_SCIENCE_BP_t *header, | |
339 | unsigned int apid, unsigned char sid, |
|
339 | unsigned int apid, unsigned char sid, | |
340 | unsigned int packetLength, unsigned char blkNr ) |
|
340 | unsigned int packetLength, unsigned char blkNr ) | |
341 | { |
|
341 | { | |
342 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
342 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; | |
343 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
343 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
344 | header->reserved = 0x00; |
|
344 | header->reserved = 0x00; | |
345 | header->userApplication = CCSDS_USER_APP; |
|
345 | header->userApplication = CCSDS_USER_APP; | |
346 | header->packetID[0] = (unsigned char) (apid >> 8); |
|
346 | header->packetID[0] = (unsigned char) (apid >> 8); | |
347 | header->packetID[1] = (unsigned char) (apid); |
|
347 | header->packetID[1] = (unsigned char) (apid); | |
348 | header->packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
348 | header->packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
349 | header->packetSequenceControl[1] = 0x00; |
|
349 | header->packetSequenceControl[1] = 0x00; | |
350 | header->packetLength[0] = (unsigned char) (packetLength >> 8); |
|
350 | header->packetLength[0] = (unsigned char) (packetLength >> 8); | |
351 | header->packetLength[1] = (unsigned char) (packetLength); |
|
351 | header->packetLength[1] = (unsigned char) (packetLength); | |
352 | // DATA FIELD HEADER |
|
352 | // DATA FIELD HEADER | |
353 | header->spare1_pusVersion_spare2 = 0x10; |
|
353 | header->spare1_pusVersion_spare2 = 0x10; | |
354 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
354 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
355 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
355 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
356 | header->destinationID = TM_DESTINATION_ID_GROUND; |
|
356 | header->destinationID = TM_DESTINATION_ID_GROUND; | |
357 | // AUXILIARY DATA HEADER |
|
357 | // AUXILIARY DATA HEADER | |
358 | header->sid = sid; |
|
358 | header->sid = sid; | |
359 | header->biaStatusInfo = 0x00; |
|
359 | header->biaStatusInfo = 0x00; | |
360 | header->time[0] = 0x00; |
|
360 | header->time[0] = 0x00; | |
361 | header->time[0] = 0x00; |
|
361 | header->time[0] = 0x00; | |
362 | header->time[0] = 0x00; |
|
362 | header->time[0] = 0x00; | |
363 | header->time[0] = 0x00; |
|
363 | header->time[0] = 0x00; | |
364 | header->time[0] = 0x00; |
|
364 | header->time[0] = 0x00; | |
365 | header->time[0] = 0x00; |
|
365 | header->time[0] = 0x00; | |
366 | header->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB |
|
366 | header->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB | |
367 | header->pa_lfr_bp_blk_nr[1] = blkNr; // BLK_NR LSB |
|
367 | header->pa_lfr_bp_blk_nr[1] = blkNr; // BLK_NR LSB | |
368 | } |
|
368 | } | |
369 |
|
369 | |||
370 | void BP_init_header_with_spare(Header_TM_LFR_SCIENCE_BP_with_spare_t *header, |
|
370 | void BP_init_header_with_spare(Header_TM_LFR_SCIENCE_BP_with_spare_t *header, | |
371 | unsigned int apid, unsigned char sid, |
|
371 | unsigned int apid, unsigned char sid, | |
372 | unsigned int packetLength , unsigned char blkNr) |
|
372 | unsigned int packetLength , unsigned char blkNr) | |
373 | { |
|
373 | { | |
374 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
374 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; | |
375 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
375 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
376 | header->reserved = 0x00; |
|
376 | header->reserved = 0x00; | |
377 | header->userApplication = CCSDS_USER_APP; |
|
377 | header->userApplication = CCSDS_USER_APP; | |
378 | header->packetID[0] = (unsigned char) (apid >> 8); |
|
378 | header->packetID[0] = (unsigned char) (apid >> 8); | |
379 | header->packetID[1] = (unsigned char) (apid); |
|
379 | header->packetID[1] = (unsigned char) (apid); | |
380 | header->packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
380 | header->packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
381 | header->packetSequenceControl[1] = 0x00; |
|
381 | header->packetSequenceControl[1] = 0x00; | |
382 | header->packetLength[0] = (unsigned char) (packetLength >> 8); |
|
382 | header->packetLength[0] = (unsigned char) (packetLength >> 8); | |
383 | header->packetLength[1] = (unsigned char) (packetLength); |
|
383 | header->packetLength[1] = (unsigned char) (packetLength); | |
384 | // DATA FIELD HEADER |
|
384 | // DATA FIELD HEADER | |
385 | header->spare1_pusVersion_spare2 = 0x10; |
|
385 | header->spare1_pusVersion_spare2 = 0x10; | |
386 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
386 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
387 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
387 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
388 | header->destinationID = TM_DESTINATION_ID_GROUND; |
|
388 | header->destinationID = TM_DESTINATION_ID_GROUND; | |
389 | // AUXILIARY DATA HEADER |
|
389 | // AUXILIARY DATA HEADER | |
390 | header->sid = sid; |
|
390 | header->sid = sid; | |
391 | header->biaStatusInfo = 0x00; |
|
391 | header->biaStatusInfo = 0x00; | |
392 | header->time[0] = 0x00; |
|
392 | header->time[0] = 0x00; | |
393 | header->time[0] = 0x00; |
|
393 | header->time[0] = 0x00; | |
394 | header->time[0] = 0x00; |
|
394 | header->time[0] = 0x00; | |
395 | header->time[0] = 0x00; |
|
395 | header->time[0] = 0x00; | |
396 | header->time[0] = 0x00; |
|
396 | header->time[0] = 0x00; | |
397 | header->time[0] = 0x00; |
|
397 | header->time[0] = 0x00; | |
|
398 | header->source_data_spare = 0x00; | |||
398 | header->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB |
|
399 | header->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB | |
399 | header->pa_lfr_bp_blk_nr[1] = blkNr; // BLK_NR LSB |
|
400 | header->pa_lfr_bp_blk_nr[1] = blkNr; // BLK_NR LSB | |
400 | } |
|
401 | } | |
401 |
|
402 | |||
402 | void BP_send(char *data, rtems_id queue_id, unsigned int nbBytesToSend, unsigned int sid ) |
|
403 | void BP_send(char *data, rtems_id queue_id, unsigned int nbBytesToSend, unsigned int sid ) | |
403 | { |
|
404 | { | |
404 | rtems_status_code status; |
|
405 | rtems_status_code status; | |
405 |
|
406 | |||
406 | // SET THE SEQUENCE_CNT PARAMETER |
|
407 | // SET THE SEQUENCE_CNT PARAMETER | |
407 | increment_seq_counter_source_id( (unsigned char*) &data[ PACKET_POS_SEQUENCE_CNT ], sid ); |
|
408 | increment_seq_counter_source_id( (unsigned char*) &data[ PACKET_POS_SEQUENCE_CNT ], sid ); | |
408 | // SEND PACKET |
|
409 | // SEND PACKET | |
409 | status = rtems_message_queue_send( queue_id, data, nbBytesToSend); |
|
410 | status = rtems_message_queue_send( queue_id, data, nbBytesToSend); | |
410 | if (status != RTEMS_SUCCESSFUL) |
|
411 | if (status != RTEMS_SUCCESSFUL) | |
411 | { |
|
412 | { | |
412 | printf("ERR *** in BP_send *** ERR %d\n", (int) status); |
|
413 | printf("ERR *** in BP_send *** ERR %d\n", (int) status); | |
413 | } |
|
414 | } | |
414 | } |
|
415 | } | |
415 |
|
416 | |||
416 | //****************** |
|
417 | //****************** | |
417 | // general functions |
|
418 | // general functions | |
418 |
|
419 | |||
419 | void reset_spectral_matrix_regs( void ) |
|
420 | void reset_spectral_matrix_regs( void ) | |
420 | { |
|
421 | { | |
421 | /** This function resets the spectral matrices module registers. |
|
422 | /** This function resets the spectral matrices module registers. | |
422 | * |
|
423 | * | |
423 | * The registers affected by this function are located at the following offset addresses: |
|
424 | * The registers affected by this function are located at the following offset addresses: | |
424 | * |
|
425 | * | |
425 | * - 0x00 config |
|
426 | * - 0x00 config | |
426 | * - 0x04 status |
|
427 | * - 0x04 status | |
427 | * - 0x08 matrixF0_Address0 |
|
428 | * - 0x08 matrixF0_Address0 | |
428 | * - 0x10 matrixFO_Address1 |
|
429 | * - 0x10 matrixFO_Address1 | |
429 | * - 0x14 matrixF1_Address |
|
430 | * - 0x14 matrixF1_Address | |
430 | * - 0x18 matrixF2_Address |
|
431 | * - 0x18 matrixF2_Address | |
431 | * |
|
432 | * | |
432 | */ |
|
433 | */ | |
433 |
|
434 | |||
434 | spectral_matrix_regs->config = 0x00; |
|
435 | spectral_matrix_regs->config = 0x00; | |
435 | spectral_matrix_regs->status = 0x00; |
|
436 | spectral_matrix_regs->status = 0x00; | |
436 |
|
437 | |||
437 | spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address; |
|
438 | spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address; | |
438 | spectral_matrix_regs->matrixFO_Address1 = current_ring_node_sm_f0->buffer_address; |
|
439 | spectral_matrix_regs->matrixFO_Address1 = current_ring_node_sm_f0->buffer_address; | |
439 | spectral_matrix_regs->matrixF1_Address = current_ring_node_sm_f1->buffer_address; |
|
440 | spectral_matrix_regs->matrixF1_Address = current_ring_node_sm_f1->buffer_address; | |
440 | spectral_matrix_regs->matrixF2_Address = current_ring_node_sm_f2->buffer_address; |
|
441 | spectral_matrix_regs->matrixF2_Address = current_ring_node_sm_f2->buffer_address; | |
441 | } |
|
442 | } | |
442 |
|
443 | |||
443 | void set_time( unsigned char *time, unsigned char * timeInBuffer ) |
|
444 | void set_time( unsigned char *time, unsigned char * timeInBuffer ) | |
444 | { |
|
445 | { | |
445 | // time[0] = timeInBuffer[2]; |
|
446 | // time[0] = timeInBuffer[2]; | |
446 | // time[1] = timeInBuffer[3]; |
|
447 | // time[1] = timeInBuffer[3]; | |
447 | // time[2] = timeInBuffer[0]; |
|
448 | // time[2] = timeInBuffer[0]; | |
448 | // time[3] = timeInBuffer[1]; |
|
449 | // time[3] = timeInBuffer[1]; | |
449 | // time[4] = timeInBuffer[6]; |
|
450 | // time[4] = timeInBuffer[6]; | |
450 | // time[5] = timeInBuffer[7]; |
|
451 | // time[5] = timeInBuffer[7]; | |
451 |
|
452 | |||
452 | time[0] = timeInBuffer[0]; |
|
453 | time[0] = timeInBuffer[0]; | |
453 | time[1] = timeInBuffer[1]; |
|
454 | time[1] = timeInBuffer[1]; | |
454 | time[2] = timeInBuffer[2]; |
|
455 | time[2] = timeInBuffer[2]; | |
455 | time[3] = timeInBuffer[3]; |
|
456 | time[3] = timeInBuffer[3]; | |
456 | time[4] = timeInBuffer[6]; |
|
457 | time[4] = timeInBuffer[6]; | |
457 | time[5] = timeInBuffer[7]; |
|
458 | time[5] = timeInBuffer[7]; | |
458 | } |
|
459 | } |
@@ -1,949 +1,949 | |||||
1 | /** Functions and tasks related to TeleCommand handling. |
|
1 | /** Functions and tasks related to TeleCommand handling. | |
2 | * |
|
2 | * | |
3 | * @file |
|
3 | * @file | |
4 | * @author P. LEROY |
|
4 | * @author P. LEROY | |
5 | * |
|
5 | * | |
6 | * A group of functions to handle TeleCommands:\n |
|
6 | * A group of functions to handle TeleCommands:\n | |
7 | * action launching\n |
|
7 | * action launching\n | |
8 | * TC parsing\n |
|
8 | * TC parsing\n | |
9 | * ... |
|
9 | * ... | |
10 | * |
|
10 | * | |
11 | */ |
|
11 | */ | |
12 |
|
12 | |||
13 | #include "tc_handler.h" |
|
13 | #include "tc_handler.h" | |
14 |
|
14 | |||
15 | //*********** |
|
15 | //*********** | |
16 | // RTEMS TASK |
|
16 | // RTEMS TASK | |
17 |
|
17 | |||
18 | rtems_task actn_task( rtems_task_argument unused ) |
|
18 | rtems_task actn_task( rtems_task_argument unused ) | |
19 | { |
|
19 | { | |
20 | /** This RTEMS task is responsible for launching actions upton the reception of valid TeleCommands. |
|
20 | /** This RTEMS task is responsible for launching actions upton the reception of valid TeleCommands. | |
21 | * |
|
21 | * | |
22 | * @param unused is the starting argument of the RTEMS task |
|
22 | * @param unused is the starting argument of the RTEMS task | |
23 | * |
|
23 | * | |
24 | * The ACTN task waits for data coming from an RTEMS msesage queue. When data arrives, it launches specific actions depending |
|
24 | * The ACTN task waits for data coming from an RTEMS msesage queue. When data arrives, it launches specific actions depending | |
25 | * on the incoming TeleCommand. |
|
25 | * on the incoming TeleCommand. | |
26 | * |
|
26 | * | |
27 | */ |
|
27 | */ | |
28 |
|
28 | |||
29 | int result; |
|
29 | int result; | |
30 | rtems_status_code status; // RTEMS status code |
|
30 | rtems_status_code status; // RTEMS status code | |
31 | ccsdsTelecommandPacket_t TC; // TC sent to the ACTN task |
|
31 | ccsdsTelecommandPacket_t TC; // TC sent to the ACTN task | |
32 | size_t size; // size of the incoming TC packet |
|
32 | size_t size; // size of the incoming TC packet | |
33 | unsigned char subtype; // subtype of the current TC packet |
|
33 | unsigned char subtype; // subtype of the current TC packet | |
34 | unsigned char time[6]; |
|
34 | unsigned char time[6]; | |
35 | rtems_id queue_rcv_id; |
|
35 | rtems_id queue_rcv_id; | |
36 | rtems_id queue_snd_id; |
|
36 | rtems_id queue_snd_id; | |
37 |
|
37 | |||
38 | status = get_message_queue_id_recv( &queue_rcv_id ); |
|
38 | status = get_message_queue_id_recv( &queue_rcv_id ); | |
39 | if (status != RTEMS_SUCCESSFUL) |
|
39 | if (status != RTEMS_SUCCESSFUL) | |
40 | { |
|
40 | { | |
41 | PRINTF1("in ACTN *** ERR get_message_queue_id_recv %d\n", status) |
|
41 | PRINTF1("in ACTN *** ERR get_message_queue_id_recv %d\n", status) | |
42 | } |
|
42 | } | |
43 |
|
43 | |||
44 | status = get_message_queue_id_send( &queue_snd_id ); |
|
44 | status = get_message_queue_id_send( &queue_snd_id ); | |
45 | if (status != RTEMS_SUCCESSFUL) |
|
45 | if (status != RTEMS_SUCCESSFUL) | |
46 | { |
|
46 | { | |
47 | PRINTF1("in ACTN *** ERR get_message_queue_id_send %d\n", status) |
|
47 | PRINTF1("in ACTN *** ERR get_message_queue_id_send %d\n", status) | |
48 | } |
|
48 | } | |
49 |
|
49 | |||
50 | result = LFR_SUCCESSFUL; |
|
50 | result = LFR_SUCCESSFUL; | |
51 | subtype = 0; // subtype of the current TC packet |
|
51 | subtype = 0; // subtype of the current TC packet | |
52 |
|
52 | |||
53 | BOOT_PRINTF("in ACTN *** \n") |
|
53 | BOOT_PRINTF("in ACTN *** \n") | |
54 |
|
54 | |||
55 | while(1) |
|
55 | while(1) | |
56 | { |
|
56 | { | |
57 | status = rtems_message_queue_receive( queue_rcv_id, (char*) &TC, &size, |
|
57 | status = rtems_message_queue_receive( queue_rcv_id, (char*) &TC, &size, | |
58 | RTEMS_WAIT, RTEMS_NO_TIMEOUT); |
|
58 | RTEMS_WAIT, RTEMS_NO_TIMEOUT); | |
59 | getTime( time ); // set time to the current time |
|
59 | getTime( time ); // set time to the current time | |
60 | if (status!=RTEMS_SUCCESSFUL) |
|
60 | if (status!=RTEMS_SUCCESSFUL) | |
61 | { |
|
61 | { | |
62 | PRINTF1("ERR *** in task ACTN *** error receiving a message, code %d \n", status) |
|
62 | PRINTF1("ERR *** in task ACTN *** error receiving a message, code %d \n", status) | |
63 | } |
|
63 | } | |
64 | else |
|
64 | else | |
65 | { |
|
65 | { | |
66 | subtype = TC.serviceSubType; |
|
66 | subtype = TC.serviceSubType; | |
67 | switch(subtype) |
|
67 | switch(subtype) | |
68 | { |
|
68 | { | |
69 | case TC_SUBTYPE_RESET: |
|
69 | case TC_SUBTYPE_RESET: | |
70 | result = action_reset( &TC, queue_snd_id, time ); |
|
70 | result = action_reset( &TC, queue_snd_id, time ); | |
71 | close_action( &TC, result, queue_snd_id ); |
|
71 | close_action( &TC, result, queue_snd_id ); | |
72 | break; |
|
72 | break; | |
73 | // |
|
73 | // | |
74 | case TC_SUBTYPE_LOAD_COMM: |
|
74 | case TC_SUBTYPE_LOAD_COMM: | |
75 | result = action_load_common_par( &TC ); |
|
75 | result = action_load_common_par( &TC ); | |
76 | close_action( &TC, result, queue_snd_id ); |
|
76 | close_action( &TC, result, queue_snd_id ); | |
77 | break; |
|
77 | break; | |
78 | // |
|
78 | // | |
79 | case TC_SUBTYPE_LOAD_NORM: |
|
79 | case TC_SUBTYPE_LOAD_NORM: | |
80 | result = action_load_normal_par( &TC, queue_snd_id, time ); |
|
80 | result = action_load_normal_par( &TC, queue_snd_id, time ); | |
81 | close_action( &TC, result, queue_snd_id ); |
|
81 | close_action( &TC, result, queue_snd_id ); | |
82 | break; |
|
82 | break; | |
83 | // |
|
83 | // | |
84 | case TC_SUBTYPE_LOAD_BURST: |
|
84 | case TC_SUBTYPE_LOAD_BURST: | |
85 | result = action_load_burst_par( &TC, queue_snd_id, time ); |
|
85 | result = action_load_burst_par( &TC, queue_snd_id, time ); | |
86 | close_action( &TC, result, queue_snd_id ); |
|
86 | close_action( &TC, result, queue_snd_id ); | |
87 | break; |
|
87 | break; | |
88 | // |
|
88 | // | |
89 | case TC_SUBTYPE_LOAD_SBM1: |
|
89 | case TC_SUBTYPE_LOAD_SBM1: | |
90 | result = action_load_sbm1_par( &TC, queue_snd_id, time ); |
|
90 | result = action_load_sbm1_par( &TC, queue_snd_id, time ); | |
91 | close_action( &TC, result, queue_snd_id ); |
|
91 | close_action( &TC, result, queue_snd_id ); | |
92 | break; |
|
92 | break; | |
93 | // |
|
93 | // | |
94 | case TC_SUBTYPE_LOAD_SBM2: |
|
94 | case TC_SUBTYPE_LOAD_SBM2: | |
95 | result = action_load_sbm2_par( &TC, queue_snd_id, time ); |
|
95 | result = action_load_sbm2_par( &TC, queue_snd_id, time ); | |
96 | close_action( &TC, result, queue_snd_id ); |
|
96 | close_action( &TC, result, queue_snd_id ); | |
97 | break; |
|
97 | break; | |
98 | // |
|
98 | // | |
99 | case TC_SUBTYPE_DUMP: |
|
99 | case TC_SUBTYPE_DUMP: | |
100 | result = action_dump_par( queue_snd_id ); |
|
100 | result = action_dump_par( queue_snd_id ); | |
101 | close_action( &TC, result, queue_snd_id ); |
|
101 | close_action( &TC, result, queue_snd_id ); | |
102 | break; |
|
102 | break; | |
103 | // |
|
103 | // | |
104 | case TC_SUBTYPE_ENTER: |
|
104 | case TC_SUBTYPE_ENTER: | |
105 | result = action_enter_mode( &TC, queue_snd_id ); |
|
105 | result = action_enter_mode( &TC, queue_snd_id ); | |
106 | close_action( &TC, result, queue_snd_id ); |
|
106 | close_action( &TC, result, queue_snd_id ); | |
107 | break; |
|
107 | break; | |
108 | // |
|
108 | // | |
109 | case TC_SUBTYPE_UPDT_INFO: |
|
109 | case TC_SUBTYPE_UPDT_INFO: | |
110 | result = action_update_info( &TC, queue_snd_id ); |
|
110 | result = action_update_info( &TC, queue_snd_id ); | |
111 | close_action( &TC, result, queue_snd_id ); |
|
111 | close_action( &TC, result, queue_snd_id ); | |
112 | break; |
|
112 | break; | |
113 | // |
|
113 | // | |
114 | case TC_SUBTYPE_EN_CAL: |
|
114 | case TC_SUBTYPE_EN_CAL: | |
115 | result = action_enable_calibration( &TC, queue_snd_id, time ); |
|
115 | result = action_enable_calibration( &TC, queue_snd_id, time ); | |
116 | close_action( &TC, result, queue_snd_id ); |
|
116 | close_action( &TC, result, queue_snd_id ); | |
117 | break; |
|
117 | break; | |
118 | // |
|
118 | // | |
119 | case TC_SUBTYPE_DIS_CAL: |
|
119 | case TC_SUBTYPE_DIS_CAL: | |
120 | result = action_disable_calibration( &TC, queue_snd_id, time ); |
|
120 | result = action_disable_calibration( &TC, queue_snd_id, time ); | |
121 | close_action( &TC, result, queue_snd_id ); |
|
121 | close_action( &TC, result, queue_snd_id ); | |
122 | break; |
|
122 | break; | |
123 | // |
|
123 | // | |
124 | case TC_SUBTYPE_UPDT_TIME: |
|
124 | case TC_SUBTYPE_UPDT_TIME: | |
125 | result = action_update_time( &TC ); |
|
125 | result = action_update_time( &TC ); | |
126 | close_action( &TC, result, queue_snd_id ); |
|
126 | close_action( &TC, result, queue_snd_id ); | |
127 | break; |
|
127 | break; | |
128 | // |
|
128 | // | |
129 | default: |
|
129 | default: | |
130 | break; |
|
130 | break; | |
131 | } |
|
131 | } | |
132 | } |
|
132 | } | |
133 | } |
|
133 | } | |
134 | } |
|
134 | } | |
135 |
|
135 | |||
136 | //*********** |
|
136 | //*********** | |
137 | // TC ACTIONS |
|
137 | // TC ACTIONS | |
138 |
|
138 | |||
139 | int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
139 | int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) | |
140 | { |
|
140 | { | |
141 | /** This function executes specific actions when a TC_LFR_RESET TeleCommand has been received. |
|
141 | /** This function executes specific actions when a TC_LFR_RESET TeleCommand has been received. | |
142 | * |
|
142 | * | |
143 | * @param TC points to the TeleCommand packet that is being processed |
|
143 | * @param TC points to the TeleCommand packet that is being processed | |
144 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
144 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver | |
145 | * |
|
145 | * | |
146 | */ |
|
146 | */ | |
147 |
|
147 | |||
148 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); |
|
148 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); | |
149 | return LFR_DEFAULT; |
|
149 | return LFR_DEFAULT; | |
150 | } |
|
150 | } | |
151 |
|
151 | |||
152 | int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) |
|
152 | int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) | |
153 | { |
|
153 | { | |
154 | /** This function executes specific actions when a TC_LFR_ENTER_MODE TeleCommand has been received. |
|
154 | /** This function executes specific actions when a TC_LFR_ENTER_MODE TeleCommand has been received. | |
155 | * |
|
155 | * | |
156 | * @param TC points to the TeleCommand packet that is being processed |
|
156 | * @param TC points to the TeleCommand packet that is being processed | |
157 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
157 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver | |
158 | * |
|
158 | * | |
159 | */ |
|
159 | */ | |
160 |
|
160 | |||
161 | rtems_status_code status; |
|
161 | rtems_status_code status; | |
162 | unsigned char requestedMode; |
|
162 | unsigned char requestedMode; | |
163 | unsigned int *transitionCoarseTime_ptr; |
|
163 | unsigned int *transitionCoarseTime_ptr; | |
164 | unsigned int transitionCoarseTime; |
|
164 | unsigned int transitionCoarseTime; | |
165 | unsigned char * bytePosPtr; |
|
165 | unsigned char * bytePosPtr; | |
166 |
|
166 | |||
167 | bytePosPtr = (unsigned char *) &TC->packetID; |
|
167 | bytePosPtr = (unsigned char *) &TC->packetID; | |
168 |
|
168 | |||
169 | requestedMode = bytePosPtr[ BYTE_POS_CP_MODE_LFR_SET ]; |
|
169 | requestedMode = bytePosPtr[ BYTE_POS_CP_MODE_LFR_SET ]; | |
170 | transitionCoarseTime_ptr = (unsigned int *) ( &bytePosPtr[ BYTE_POS_CP_LFR_ENTER_MODE_TIME ] ); |
|
170 | transitionCoarseTime_ptr = (unsigned int *) ( &bytePosPtr[ BYTE_POS_CP_LFR_ENTER_MODE_TIME ] ); | |
171 | transitionCoarseTime = (*transitionCoarseTime_ptr) & 0x7fffffff; |
|
171 | transitionCoarseTime = (*transitionCoarseTime_ptr) & 0x7fffffff; | |
172 |
|
172 | |||
173 | status = check_mode_value( requestedMode ); |
|
173 | status = check_mode_value( requestedMode ); | |
174 |
|
174 | |||
175 | if ( status != LFR_SUCCESSFUL ) // the mode value is inconsistent |
|
175 | if ( status != LFR_SUCCESSFUL ) // the mode value is inconsistent | |
176 | { |
|
176 | { | |
177 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_MODE_LFR_SET, requestedMode ); |
|
177 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_MODE_LFR_SET, requestedMode ); | |
178 | } |
|
178 | } | |
179 | else // the mode value is consistent, check the transition |
|
179 | else // the mode value is consistent, check the transition | |
180 | { |
|
180 | { | |
181 | status = check_mode_transition(requestedMode); |
|
181 | status = check_mode_transition(requestedMode); | |
182 | if (status != LFR_SUCCESSFUL) |
|
182 | if (status != LFR_SUCCESSFUL) | |
183 | { |
|
183 | { | |
184 | PRINTF("ERR *** in action_enter_mode *** check_mode_transition\n") |
|
184 | PRINTF("ERR *** in action_enter_mode *** check_mode_transition\n") | |
185 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); |
|
185 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); | |
186 | } |
|
186 | } | |
187 | } |
|
187 | } | |
188 |
|
188 | |||
189 | if ( status == LFR_SUCCESSFUL ) // the transition is valid, enter the mode |
|
189 | if ( status == LFR_SUCCESSFUL ) // the transition is valid, enter the mode | |
190 | { |
|
190 | { | |
191 | status = check_transition_date( transitionCoarseTime ); |
|
191 | status = check_transition_date( transitionCoarseTime ); | |
192 | if (status != LFR_SUCCESSFUL) |
|
192 | if (status != LFR_SUCCESSFUL) | |
193 | { |
|
193 | { | |
194 | PRINTF("ERR *** in action_enter_mode *** check_transition_date\n") |
|
194 | PRINTF("ERR *** in action_enter_mode *** check_transition_date\n") | |
195 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, |
|
195 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, | |
196 | BYTE_POS_CP_LFR_ENTER_MODE_TIME, |
|
196 | BYTE_POS_CP_LFR_ENTER_MODE_TIME, | |
197 | bytePosPtr[ BYTE_POS_CP_LFR_ENTER_MODE_TIME + 3 ] ); |
|
197 | bytePosPtr[ BYTE_POS_CP_LFR_ENTER_MODE_TIME + 3 ] ); | |
198 | } |
|
198 | } | |
199 | } |
|
199 | } | |
200 |
|
200 | |||
201 | if ( status == LFR_SUCCESSFUL ) // the date is valid, enter the mode |
|
201 | if ( status == LFR_SUCCESSFUL ) // the date is valid, enter the mode | |
202 | { |
|
202 | { | |
203 | PRINTF1("OK *** in action_enter_mode *** enter mode %d\n", requestedMode); |
|
203 | PRINTF1("OK *** in action_enter_mode *** enter mode %d\n", requestedMode); | |
204 | status = enter_mode( requestedMode, transitionCoarseTime ); |
|
204 | status = enter_mode( requestedMode, transitionCoarseTime ); | |
205 | } |
|
205 | } | |
206 |
|
206 | |||
207 | return status; |
|
207 | return status; | |
208 | } |
|
208 | } | |
209 |
|
209 | |||
210 | int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
210 | int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) | |
211 | { |
|
211 | { | |
212 | /** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received. |
|
212 | /** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received. | |
213 | * |
|
213 | * | |
214 | * @param TC points to the TeleCommand packet that is being processed |
|
214 | * @param TC points to the TeleCommand packet that is being processed | |
215 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
215 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver | |
216 | * |
|
216 | * | |
217 | * @return LFR directive status code: |
|
217 | * @return LFR directive status code: | |
218 | * - LFR_DEFAULT |
|
218 | * - LFR_DEFAULT | |
219 | * - LFR_SUCCESSFUL |
|
219 | * - LFR_SUCCESSFUL | |
220 | * |
|
220 | * | |
221 | */ |
|
221 | */ | |
222 |
|
222 | |||
223 | unsigned int val; |
|
223 | unsigned int val; | |
224 | int result; |
|
224 | int result; | |
225 | unsigned int status; |
|
225 | unsigned int status; | |
226 | unsigned char mode; |
|
226 | unsigned char mode; | |
227 | unsigned char * bytePosPtr; |
|
227 | unsigned char * bytePosPtr; | |
228 |
|
228 | |||
229 | bytePosPtr = (unsigned char *) &TC->packetID; |
|
229 | bytePosPtr = (unsigned char *) &TC->packetID; | |
230 |
|
230 | |||
231 | // check LFR mode |
|
231 | // check LFR mode | |
232 | mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET5 ] & 0x1e) >> 1; |
|
232 | mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET5 ] & 0x1e) >> 1; | |
233 | status = check_update_info_hk_lfr_mode( mode ); |
|
233 | status = check_update_info_hk_lfr_mode( mode ); | |
234 | if (status == LFR_SUCCESSFUL) // check TDS mode |
|
234 | if (status == LFR_SUCCESSFUL) // check TDS mode | |
235 | { |
|
235 | { | |
236 | mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 ] & 0xf0) >> 4; |
|
236 | mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 ] & 0xf0) >> 4; | |
237 | status = check_update_info_hk_tds_mode( mode ); |
|
237 | status = check_update_info_hk_tds_mode( mode ); | |
238 | } |
|
238 | } | |
239 | if (status == LFR_SUCCESSFUL) // check THR mode |
|
239 | if (status == LFR_SUCCESSFUL) // check THR mode | |
240 | { |
|
240 | { | |
241 | mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 ] & 0x0f); |
|
241 | mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 ] & 0x0f); | |
242 | status = check_update_info_hk_thr_mode( mode ); |
|
242 | status = check_update_info_hk_thr_mode( mode ); | |
243 | } |
|
243 | } | |
244 | if (status == LFR_SUCCESSFUL) // if the parameter check is successful |
|
244 | if (status == LFR_SUCCESSFUL) // if the parameter check is successful | |
245 | { |
|
245 | { | |
246 | val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256 |
|
246 | val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256 | |
247 | + housekeeping_packet.hk_lfr_update_info_tc_cnt[1]; |
|
247 | + housekeeping_packet.hk_lfr_update_info_tc_cnt[1]; | |
248 | val++; |
|
248 | val++; | |
249 | housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8); |
|
249 | housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8); | |
250 | housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val); |
|
250 | housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val); | |
251 | } |
|
251 | } | |
252 |
|
252 | |||
253 | result = status; |
|
253 | result = status; | |
254 |
|
254 | |||
255 | return result; |
|
255 | return result; | |
256 | } |
|
256 | } | |
257 |
|
257 | |||
258 | int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
258 | int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) | |
259 | { |
|
259 | { | |
260 | /** This function executes specific actions when a TC_LFR_ENABLE_CALIBRATION TeleCommand has been received. |
|
260 | /** This function executes specific actions when a TC_LFR_ENABLE_CALIBRATION TeleCommand has been received. | |
261 | * |
|
261 | * | |
262 | * @param TC points to the TeleCommand packet that is being processed |
|
262 | * @param TC points to the TeleCommand packet that is being processed | |
263 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
263 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver | |
264 | * |
|
264 | * | |
265 | */ |
|
265 | */ | |
266 |
|
266 | |||
267 | int result; |
|
267 | int result; | |
268 | unsigned char lfrMode; |
|
268 | unsigned char lfrMode; | |
269 |
|
269 | |||
270 | result = LFR_DEFAULT; |
|
270 | result = LFR_DEFAULT; | |
271 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
271 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
272 |
|
272 | |||
273 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); |
|
273 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); | |
274 | result = LFR_DEFAULT; |
|
274 | result = LFR_DEFAULT; | |
275 |
|
275 | |||
276 | return result; |
|
276 | return result; | |
277 | } |
|
277 | } | |
278 |
|
278 | |||
279 | int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
279 | int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) | |
280 | { |
|
280 | { | |
281 | /** This function executes specific actions when a TC_LFR_DISABLE_CALIBRATION TeleCommand has been received. |
|
281 | /** This function executes specific actions when a TC_LFR_DISABLE_CALIBRATION TeleCommand has been received. | |
282 | * |
|
282 | * | |
283 | * @param TC points to the TeleCommand packet that is being processed |
|
283 | * @param TC points to the TeleCommand packet that is being processed | |
284 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
284 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver | |
285 | * |
|
285 | * | |
286 | */ |
|
286 | */ | |
287 |
|
287 | |||
288 | int result; |
|
288 | int result; | |
289 | unsigned char lfrMode; |
|
289 | unsigned char lfrMode; | |
290 |
|
290 | |||
291 | result = LFR_DEFAULT; |
|
291 | result = LFR_DEFAULT; | |
292 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
292 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
293 |
|
293 | |||
294 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); |
|
294 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); | |
295 | result = LFR_DEFAULT; |
|
295 | result = LFR_DEFAULT; | |
296 |
|
296 | |||
297 | return result; |
|
297 | return result; | |
298 | } |
|
298 | } | |
299 |
|
299 | |||
300 | int action_update_time(ccsdsTelecommandPacket_t *TC) |
|
300 | int action_update_time(ccsdsTelecommandPacket_t *TC) | |
301 | { |
|
301 | { | |
302 | /** This function executes specific actions when a TC_LFR_UPDATE_TIME TeleCommand has been received. |
|
302 | /** This function executes specific actions when a TC_LFR_UPDATE_TIME TeleCommand has been received. | |
303 | * |
|
303 | * | |
304 | * @param TC points to the TeleCommand packet that is being processed |
|
304 | * @param TC points to the TeleCommand packet that is being processed | |
305 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
305 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver | |
306 | * |
|
306 | * | |
307 | * @return LFR_SUCCESSFUL |
|
307 | * @return LFR_SUCCESSFUL | |
308 | * |
|
308 | * | |
309 | */ |
|
309 | */ | |
310 |
|
310 | |||
311 | unsigned int val; |
|
311 | unsigned int val; | |
312 |
|
312 | |||
313 | time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24) |
|
313 | time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24) | |
314 | + (TC->dataAndCRC[1] << 16) |
|
314 | + (TC->dataAndCRC[1] << 16) | |
315 | + (TC->dataAndCRC[2] << 8) |
|
315 | + (TC->dataAndCRC[2] << 8) | |
316 | + TC->dataAndCRC[3]; |
|
316 | + TC->dataAndCRC[3]; | |
317 |
|
317 | |||
318 | PRINTF1("time received: %x\n", time_management_regs->coarse_time_load) |
|
318 | PRINTF1("time received: %x\n", time_management_regs->coarse_time_load) | |
319 |
|
319 | |||
320 | val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256 |
|
320 | val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256 | |
321 | + housekeeping_packet.hk_lfr_update_time_tc_cnt[1]; |
|
321 | + housekeeping_packet.hk_lfr_update_time_tc_cnt[1]; | |
322 | val++; |
|
322 | val++; | |
323 | housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8); |
|
323 | housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8); | |
324 | housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val); |
|
324 | housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val); | |
325 | // time_management_regs->ctrl = time_management_regs->ctrl | 1; // force tick |
|
325 | // time_management_regs->ctrl = time_management_regs->ctrl | 1; // force tick | |
326 |
|
326 | |||
327 | return LFR_SUCCESSFUL; |
|
327 | return LFR_SUCCESSFUL; | |
328 | } |
|
328 | } | |
329 |
|
329 | |||
330 | //******************* |
|
330 | //******************* | |
331 | // ENTERING THE MODES |
|
331 | // ENTERING THE MODES | |
332 | int check_mode_value( unsigned char requestedMode ) |
|
332 | int check_mode_value( unsigned char requestedMode ) | |
333 | { |
|
333 | { | |
334 | int status; |
|
334 | int status; | |
335 |
|
335 | |||
336 | if ( (requestedMode != LFR_MODE_STANDBY) |
|
336 | if ( (requestedMode != LFR_MODE_STANDBY) | |
337 | && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST) |
|
337 | && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST) | |
338 | && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) ) |
|
338 | && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) ) | |
339 | { |
|
339 | { | |
340 | status = LFR_DEFAULT; |
|
340 | status = LFR_DEFAULT; | |
341 | } |
|
341 | } | |
342 | else |
|
342 | else | |
343 | { |
|
343 | { | |
344 | status = LFR_SUCCESSFUL; |
|
344 | status = LFR_SUCCESSFUL; | |
345 | } |
|
345 | } | |
346 |
|
346 | |||
347 | return status; |
|
347 | return status; | |
348 | } |
|
348 | } | |
349 |
|
349 | |||
350 | int check_mode_transition( unsigned char requestedMode ) |
|
350 | int check_mode_transition( unsigned char requestedMode ) | |
351 | { |
|
351 | { | |
352 | /** This function checks the validity of the transition requested by the TC_LFR_ENTER_MODE. |
|
352 | /** This function checks the validity of the transition requested by the TC_LFR_ENTER_MODE. | |
353 | * |
|
353 | * | |
354 | * @param requestedMode is the mode requested by the TC_LFR_ENTER_MODE |
|
354 | * @param requestedMode is the mode requested by the TC_LFR_ENTER_MODE | |
355 | * |
|
355 | * | |
356 | * @return LFR directive status codes: |
|
356 | * @return LFR directive status codes: | |
357 | * - LFR_SUCCESSFUL - the transition is authorized |
|
357 | * - LFR_SUCCESSFUL - the transition is authorized | |
358 | * - LFR_DEFAULT - the transition is not authorized |
|
358 | * - LFR_DEFAULT - the transition is not authorized | |
359 | * |
|
359 | * | |
360 | */ |
|
360 | */ | |
361 |
|
361 | |||
362 | int status; |
|
362 | int status; | |
363 |
|
363 | |||
364 | switch (requestedMode) |
|
364 | switch (requestedMode) | |
365 | { |
|
365 | { | |
366 | case LFR_MODE_STANDBY: |
|
366 | case LFR_MODE_STANDBY: | |
367 | if ( lfrCurrentMode == LFR_MODE_STANDBY ) { |
|
367 | if ( lfrCurrentMode == LFR_MODE_STANDBY ) { | |
368 | status = LFR_DEFAULT; |
|
368 | status = LFR_DEFAULT; | |
369 | } |
|
369 | } | |
370 | else |
|
370 | else | |
371 | { |
|
371 | { | |
372 | status = LFR_SUCCESSFUL; |
|
372 | status = LFR_SUCCESSFUL; | |
373 | } |
|
373 | } | |
374 | break; |
|
374 | break; | |
375 | case LFR_MODE_NORMAL: |
|
375 | case LFR_MODE_NORMAL: | |
376 | if ( lfrCurrentMode == LFR_MODE_NORMAL ) { |
|
376 | if ( lfrCurrentMode == LFR_MODE_NORMAL ) { | |
377 | status = LFR_DEFAULT; |
|
377 | status = LFR_DEFAULT; | |
378 | } |
|
378 | } | |
379 | else { |
|
379 | else { | |
380 | status = LFR_SUCCESSFUL; |
|
380 | status = LFR_SUCCESSFUL; | |
381 | } |
|
381 | } | |
382 | break; |
|
382 | break; | |
383 | case LFR_MODE_BURST: |
|
383 | case LFR_MODE_BURST: | |
384 | if ( lfrCurrentMode == LFR_MODE_BURST ) { |
|
384 | if ( lfrCurrentMode == LFR_MODE_BURST ) { | |
385 | status = LFR_DEFAULT; |
|
385 | status = LFR_DEFAULT; | |
386 | } |
|
386 | } | |
387 | else { |
|
387 | else { | |
388 | status = LFR_SUCCESSFUL; |
|
388 | status = LFR_SUCCESSFUL; | |
389 | } |
|
389 | } | |
390 | break; |
|
390 | break; | |
391 | case LFR_MODE_SBM1: |
|
391 | case LFR_MODE_SBM1: | |
392 | if ( lfrCurrentMode == LFR_MODE_SBM1 ) { |
|
392 | if ( lfrCurrentMode == LFR_MODE_SBM1 ) { | |
393 | status = LFR_DEFAULT; |
|
393 | status = LFR_DEFAULT; | |
394 | } |
|
394 | } | |
395 | else { |
|
395 | else { | |
396 | status = LFR_SUCCESSFUL; |
|
396 | status = LFR_SUCCESSFUL; | |
397 | } |
|
397 | } | |
398 | break; |
|
398 | break; | |
399 | case LFR_MODE_SBM2: |
|
399 | case LFR_MODE_SBM2: | |
400 | if ( lfrCurrentMode == LFR_MODE_SBM2 ) { |
|
400 | if ( lfrCurrentMode == LFR_MODE_SBM2 ) { | |
401 | status = LFR_DEFAULT; |
|
401 | status = LFR_DEFAULT; | |
402 | } |
|
402 | } | |
403 | else { |
|
403 | else { | |
404 | status = LFR_SUCCESSFUL; |
|
404 | status = LFR_SUCCESSFUL; | |
405 | } |
|
405 | } | |
406 | break; |
|
406 | break; | |
407 | default: |
|
407 | default: | |
408 | status = LFR_DEFAULT; |
|
408 | status = LFR_DEFAULT; | |
409 | break; |
|
409 | break; | |
410 | } |
|
410 | } | |
411 |
|
411 | |||
412 | return status; |
|
412 | return status; | |
413 | } |
|
413 | } | |
414 |
|
414 | |||
415 | int check_transition_date( unsigned int transitionCoarseTime ) |
|
415 | int check_transition_date( unsigned int transitionCoarseTime ) | |
416 | { |
|
416 | { | |
417 | int status; |
|
417 | int status; | |
418 | unsigned int localCoarseTime; |
|
418 | unsigned int localCoarseTime; | |
419 | unsigned int deltaCoarseTime; |
|
419 | unsigned int deltaCoarseTime; | |
420 |
|
420 | |||
421 | status = LFR_SUCCESSFUL; |
|
421 | status = LFR_SUCCESSFUL; | |
422 |
|
422 | |||
423 | if (transitionCoarseTime == 0) // transition time = 0 means an instant transition |
|
423 | if (transitionCoarseTime == 0) // transition time = 0 means an instant transition | |
424 | { |
|
424 | { | |
425 | status = LFR_SUCCESSFUL; |
|
425 | status = LFR_SUCCESSFUL; | |
426 | } |
|
426 | } | |
427 | else |
|
427 | else | |
428 | { |
|
428 | { | |
429 | localCoarseTime = time_management_regs->coarse_time & 0x7fffffff; |
|
429 | localCoarseTime = time_management_regs->coarse_time & 0x7fffffff; | |
430 |
|
430 | |||
431 | if ( transitionCoarseTime <= localCoarseTime ) // SSS-CP-EQS-322 |
|
431 | if ( transitionCoarseTime <= localCoarseTime ) // SSS-CP-EQS-322 | |
432 | { |
|
432 | { | |
433 | status = LFR_DEFAULT; |
|
433 | status = LFR_DEFAULT; | |
434 | PRINTF2("ERR *** in check_transition_date *** transition = %x, local = %x\n", transitionCoarseTime, localCoarseTime) |
|
434 | PRINTF2("ERR *** in check_transition_date *** transition = %x, local = %x\n", transitionCoarseTime, localCoarseTime) | |
435 | } |
|
435 | } | |
436 |
|
436 | |||
437 | if (status == LFR_SUCCESSFUL) |
|
437 | if (status == LFR_SUCCESSFUL) | |
438 | { |
|
438 | { | |
439 | deltaCoarseTime = transitionCoarseTime - localCoarseTime; |
|
439 | deltaCoarseTime = transitionCoarseTime - localCoarseTime; | |
440 | if ( deltaCoarseTime > 3 ) // SSS-CP-EQS-323 |
|
440 | if ( deltaCoarseTime > 3 ) // SSS-CP-EQS-323 | |
441 | { |
|
441 | { | |
442 | status = LFR_DEFAULT; |
|
442 | status = LFR_DEFAULT; | |
443 | PRINTF1("ERR *** in check_transition_date *** deltaCoarseTime = %x\n", deltaCoarseTime) |
|
443 | PRINTF1("ERR *** in check_transition_date *** deltaCoarseTime = %x\n", deltaCoarseTime) | |
444 | } |
|
444 | } | |
445 | } |
|
445 | } | |
446 | } |
|
446 | } | |
447 |
|
447 | |||
448 | return status; |
|
448 | return status; | |
449 | } |
|
449 | } | |
450 |
|
450 | |||
451 | int stop_current_mode( void ) |
|
451 | int stop_current_mode( void ) | |
452 | { |
|
452 | { | |
453 | /** This function stops the current mode by masking interrupt lines and suspending science tasks. |
|
453 | /** This function stops the current mode by masking interrupt lines and suspending science tasks. | |
454 | * |
|
454 | * | |
455 | * @return RTEMS directive status codes: |
|
455 | * @return RTEMS directive status codes: | |
456 | * - RTEMS_SUCCESSFUL - task restarted successfully |
|
456 | * - RTEMS_SUCCESSFUL - task restarted successfully | |
457 | * - RTEMS_INVALID_ID - task id invalid |
|
457 | * - RTEMS_INVALID_ID - task id invalid | |
458 | * - RTEMS_ALREADY_SUSPENDED - task already suspended |
|
458 | * - RTEMS_ALREADY_SUSPENDED - task already suspended | |
459 | * |
|
459 | * | |
460 | */ |
|
460 | */ | |
461 |
|
461 | |||
462 | rtems_status_code status; |
|
462 | rtems_status_code status; | |
463 |
|
463 | |||
464 | status = RTEMS_SUCCESSFUL; |
|
464 | status = RTEMS_SUCCESSFUL; | |
465 |
|
465 | |||
466 | // (1) mask interruptions |
|
466 | // (1) mask interruptions | |
467 | LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt |
|
467 | LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt | |
468 | LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt |
|
468 | LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt | |
469 |
|
469 | |||
470 | // (2) clear interruptions |
|
470 | // (2) clear interruptions | |
471 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt |
|
471 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt | |
472 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt |
|
472 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt | |
473 |
|
473 | |||
474 | // (3) reset waveform picker registers |
|
474 | // (3) reset waveform picker registers | |
475 | reset_wfp_burst_enable(); // reset burst and enable bits |
|
475 | reset_wfp_burst_enable(); // reset burst and enable bits | |
476 | reset_wfp_status(); // reset all the status bits |
|
476 | reset_wfp_status(); // reset all the status bits | |
477 |
|
477 | |||
478 | // (4) reset spectral matrices registers |
|
478 | // (4) reset spectral matrices registers | |
479 | set_irq_on_new_ready_matrix( 0 ); // stop the spectral matrices |
|
479 | set_irq_on_new_ready_matrix( 0 ); // stop the spectral matrices | |
480 | set_run_matrix_spectral( 0 ); // run_matrix_spectral is set to 0 |
|
480 | set_run_matrix_spectral( 0 ); // run_matrix_spectral is set to 0 | |
481 | reset_extractSWF(); // reset the extractSWF flag to false |
|
481 | reset_extractSWF(); // reset the extractSWF flag to false | |
482 |
|
482 | |||
483 | // <Spectral Matrices simulator> |
|
483 | // <Spectral Matrices simulator> | |
484 | LEON_Mask_interrupt( IRQ_SM_SIMULATOR ); // mask spectral matrix interrupt simulator |
|
484 | LEON_Mask_interrupt( IRQ_SM_SIMULATOR ); // mask spectral matrix interrupt simulator | |
485 | timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); |
|
485 | timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); | |
486 | LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); // clear spectral matrix interrupt simulator |
|
486 | LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); // clear spectral matrix interrupt simulator | |
487 | // </Spectral Matrices simulator> |
|
487 | // </Spectral Matrices simulator> | |
488 |
|
488 | |||
489 | // suspend several tasks |
|
489 | // suspend several tasks | |
490 | if (lfrCurrentMode != LFR_MODE_STANDBY) { |
|
490 | if (lfrCurrentMode != LFR_MODE_STANDBY) { | |
491 | status = suspend_science_tasks(); |
|
491 | status = suspend_science_tasks(); | |
492 | } |
|
492 | } | |
493 |
|
493 | |||
494 | if (status != RTEMS_SUCCESSFUL) |
|
494 | if (status != RTEMS_SUCCESSFUL) | |
495 | { |
|
495 | { | |
496 | PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status) |
|
496 | PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status) | |
497 | } |
|
497 | } | |
498 |
|
498 | |||
499 | return status; |
|
499 | return status; | |
500 | } |
|
500 | } | |
501 |
|
501 | |||
502 | int enter_mode( unsigned char mode, unsigned int transitionCoarseTime ) |
|
502 | int enter_mode( unsigned char mode, unsigned int transitionCoarseTime ) | |
503 | { |
|
503 | { | |
504 | /** This function is launched after a mode transition validation. |
|
504 | /** This function is launched after a mode transition validation. | |
505 | * |
|
505 | * | |
506 | * @param mode is the mode in which LFR will be put. |
|
506 | * @param mode is the mode in which LFR will be put. | |
507 | * |
|
507 | * | |
508 | * @return RTEMS directive status codes: |
|
508 | * @return RTEMS directive status codes: | |
509 | * - RTEMS_SUCCESSFUL - the mode has been entered successfully |
|
509 | * - RTEMS_SUCCESSFUL - the mode has been entered successfully | |
510 | * - RTEMS_NOT_SATISFIED - the mode has not been entered successfully |
|
510 | * - RTEMS_NOT_SATISFIED - the mode has not been entered successfully | |
511 | * |
|
511 | * | |
512 | */ |
|
512 | */ | |
513 |
|
513 | |||
514 | rtems_status_code status; |
|
514 | rtems_status_code status; | |
515 |
|
515 | |||
516 | //********************** |
|
516 | //********************** | |
517 | // STOP THE CURRENT MODE |
|
517 | // STOP THE CURRENT MODE | |
518 | status = stop_current_mode(); |
|
518 | status = stop_current_mode(); | |
519 | if (status != RTEMS_SUCCESSFUL) |
|
519 | if (status != RTEMS_SUCCESSFUL) | |
520 | { |
|
520 | { | |
521 | PRINTF1("ERR *** in enter_mode *** stop_current_mode with mode = %d\n", mode) |
|
521 | PRINTF1("ERR *** in enter_mode *** stop_current_mode with mode = %d\n", mode) | |
522 | } |
|
522 | } | |
523 |
|
523 | |||
524 | //************************* |
|
524 | //************************* | |
525 | // ENTER THE REQUESTED MODE |
|
525 | // ENTER THE REQUESTED MODE | |
526 | if ( (mode == LFR_MODE_NORMAL) || (mode == LFR_MODE_BURST) |
|
526 | if ( (mode == LFR_MODE_NORMAL) || (mode == LFR_MODE_BURST) | |
527 | || (mode == LFR_MODE_SBM1) || (mode == LFR_MODE_SBM2) ) |
|
527 | || (mode == LFR_MODE_SBM1) || (mode == LFR_MODE_SBM2) ) | |
528 | { |
|
528 | { | |
529 | #ifdef PRINT_TASK_STATISTICS |
|
529 | #ifdef PRINT_TASK_STATISTICS | |
530 | rtems_cpu_usage_reset(); |
|
530 | rtems_cpu_usage_reset(); | |
531 | maxCount = 0; |
|
531 | maxCount = 0; | |
532 | #endif |
|
532 | #endif | |
533 | status = restart_science_tasks( mode ); |
|
533 | status = restart_science_tasks( mode ); | |
534 | launch_waveform_picker( mode, transitionCoarseTime ); |
|
534 | launch_waveform_picker( mode, transitionCoarseTime ); | |
535 |
|
|
535 | launch_spectral_matrix( ); | |
536 | launch_spectral_matrix_simu( ); |
|
536 | launch_spectral_matrix_simu( ); | |
537 | } |
|
537 | } | |
538 | else if ( mode == LFR_MODE_STANDBY ) |
|
538 | else if ( mode == LFR_MODE_STANDBY ) | |
539 | { |
|
539 | { | |
540 | #ifdef PRINT_TASK_STATISTICS |
|
540 | #ifdef PRINT_TASK_STATISTICS | |
541 | rtems_cpu_usage_report(); |
|
541 | rtems_cpu_usage_report(); | |
542 | #endif |
|
542 | #endif | |
543 |
|
543 | |||
544 | #ifdef PRINT_STACK_REPORT |
|
544 | #ifdef PRINT_STACK_REPORT | |
545 | PRINTF("stack report selected\n") |
|
545 | PRINTF("stack report selected\n") | |
546 | rtems_stack_checker_report_usage(); |
|
546 | rtems_stack_checker_report_usage(); | |
547 | #endif |
|
547 | #endif | |
548 | PRINTF1("maxCount = %d\n", maxCount) |
|
548 | PRINTF1("maxCount = %d\n", maxCount) | |
549 | } |
|
549 | } | |
550 | else |
|
550 | else | |
551 | { |
|
551 | { | |
552 | status = RTEMS_UNSATISFIED; |
|
552 | status = RTEMS_UNSATISFIED; | |
553 | } |
|
553 | } | |
554 |
|
554 | |||
555 | if (status != RTEMS_SUCCESSFUL) |
|
555 | if (status != RTEMS_SUCCESSFUL) | |
556 | { |
|
556 | { | |
557 | PRINTF1("ERR *** in enter_mode *** status = %d\n", status) |
|
557 | PRINTF1("ERR *** in enter_mode *** status = %d\n", status) | |
558 | status = RTEMS_UNSATISFIED; |
|
558 | status = RTEMS_UNSATISFIED; | |
559 | } |
|
559 | } | |
560 |
|
560 | |||
561 | return status; |
|
561 | return status; | |
562 | } |
|
562 | } | |
563 |
|
563 | |||
564 | int restart_science_tasks(unsigned char lfrRequestedMode ) |
|
564 | int restart_science_tasks(unsigned char lfrRequestedMode ) | |
565 | { |
|
565 | { | |
566 | /** This function is used to restart all science tasks. |
|
566 | /** This function is used to restart all science tasks. | |
567 | * |
|
567 | * | |
568 | * @return RTEMS directive status codes: |
|
568 | * @return RTEMS directive status codes: | |
569 | * - RTEMS_SUCCESSFUL - task restarted successfully |
|
569 | * - RTEMS_SUCCESSFUL - task restarted successfully | |
570 | * - RTEMS_INVALID_ID - task id invalid |
|
570 | * - RTEMS_INVALID_ID - task id invalid | |
571 | * - RTEMS_INCORRECT_STATE - task never started |
|
571 | * - RTEMS_INCORRECT_STATE - task never started | |
572 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task |
|
572 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task | |
573 | * |
|
573 | * | |
574 | * Science tasks are AVF0, PRC0, WFRM, CWF3, CW2, CWF1 |
|
574 | * Science tasks are AVF0, PRC0, WFRM, CWF3, CW2, CWF1 | |
575 | * |
|
575 | * | |
576 | */ |
|
576 | */ | |
577 |
|
577 | |||
578 | rtems_status_code status[10]; |
|
578 | rtems_status_code status[10]; | |
579 | rtems_status_code ret; |
|
579 | rtems_status_code ret; | |
580 |
|
580 | |||
581 | ret = RTEMS_SUCCESSFUL; |
|
581 | ret = RTEMS_SUCCESSFUL; | |
582 |
|
582 | |||
583 | status[0] = rtems_task_restart( Task_id[TASKID_AVF0], lfrRequestedMode ); |
|
583 | status[0] = rtems_task_restart( Task_id[TASKID_AVF0], lfrRequestedMode ); | |
584 | if (status[0] != RTEMS_SUCCESSFUL) |
|
584 | if (status[0] != RTEMS_SUCCESSFUL) | |
585 | { |
|
585 | { | |
586 | PRINTF1("in restart_science_task *** AVF0 ERR %d\n", status[0]) |
|
586 | PRINTF1("in restart_science_task *** AVF0 ERR %d\n", status[0]) | |
587 | } |
|
587 | } | |
588 |
|
588 | |||
589 | status[1] = rtems_task_restart( Task_id[TASKID_PRC0], lfrRequestedMode ); |
|
589 | status[1] = rtems_task_restart( Task_id[TASKID_PRC0], lfrRequestedMode ); | |
590 | if (status[1] != RTEMS_SUCCESSFUL) |
|
590 | if (status[1] != RTEMS_SUCCESSFUL) | |
591 | { |
|
591 | { | |
592 | PRINTF1("in restart_science_task *** PRC0 ERR %d\n", status[1]) |
|
592 | PRINTF1("in restart_science_task *** PRC0 ERR %d\n", status[1]) | |
593 | } |
|
593 | } | |
594 |
|
594 | |||
595 | status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 ); |
|
595 | status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 ); | |
596 | if (status[2] != RTEMS_SUCCESSFUL) |
|
596 | if (status[2] != RTEMS_SUCCESSFUL) | |
597 | { |
|
597 | { | |
598 | PRINTF1("in restart_science_task *** WFRM ERR %d\n", status[2]) |
|
598 | PRINTF1("in restart_science_task *** WFRM ERR %d\n", status[2]) | |
599 | } |
|
599 | } | |
600 |
|
600 | |||
601 | status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 ); |
|
601 | status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 ); | |
602 | if (status[3] != RTEMS_SUCCESSFUL) |
|
602 | if (status[3] != RTEMS_SUCCESSFUL) | |
603 | { |
|
603 | { | |
604 | PRINTF1("in restart_science_task *** CWF3 ERR %d\n", status[3]) |
|
604 | PRINTF1("in restart_science_task *** CWF3 ERR %d\n", status[3]) | |
605 | } |
|
605 | } | |
606 |
|
606 | |||
607 | status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 ); |
|
607 | status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 ); | |
608 | if (status[4] != RTEMS_SUCCESSFUL) |
|
608 | if (status[4] != RTEMS_SUCCESSFUL) | |
609 | { |
|
609 | { | |
610 | PRINTF1("in restart_science_task *** CWF2 ERR %d\n", status[4]) |
|
610 | PRINTF1("in restart_science_task *** CWF2 ERR %d\n", status[4]) | |
611 | } |
|
611 | } | |
612 |
|
612 | |||
613 | status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 ); |
|
613 | status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 ); | |
614 | if (status[5] != RTEMS_SUCCESSFUL) |
|
614 | if (status[5] != RTEMS_SUCCESSFUL) | |
615 | { |
|
615 | { | |
616 | PRINTF1("in restart_science_task *** CWF1 ERR %d\n", status[5]) |
|
616 | PRINTF1("in restart_science_task *** CWF1 ERR %d\n", status[5]) | |
617 | } |
|
617 | } | |
618 |
|
618 | |||
619 | status[6] = rtems_task_restart( Task_id[TASKID_AVF1], lfrRequestedMode ); |
|
619 | status[6] = rtems_task_restart( Task_id[TASKID_AVF1], lfrRequestedMode ); | |
620 | if (status[6] != RTEMS_SUCCESSFUL) |
|
620 | if (status[6] != RTEMS_SUCCESSFUL) | |
621 | { |
|
621 | { | |
622 | PRINTF1("in restart_science_task *** AVF1 ERR %d\n", status[6]) |
|
622 | PRINTF1("in restart_science_task *** AVF1 ERR %d\n", status[6]) | |
623 | } |
|
623 | } | |
624 |
|
624 | |||
625 | status[7] = rtems_task_restart( Task_id[TASKID_PRC1],lfrRequestedMode ); |
|
625 | status[7] = rtems_task_restart( Task_id[TASKID_PRC1],lfrRequestedMode ); | |
626 | if (status[7] != RTEMS_SUCCESSFUL) |
|
626 | if (status[7] != RTEMS_SUCCESSFUL) | |
627 | { |
|
627 | { | |
628 | PRINTF1("in restart_science_task *** PRC1 ERR %d\n", status[7]) |
|
628 | PRINTF1("in restart_science_task *** PRC1 ERR %d\n", status[7]) | |
629 | } |
|
629 | } | |
630 |
|
630 | |||
631 | status[8] = rtems_task_restart( Task_id[TASKID_AVF2], 1 ); |
|
631 | status[8] = rtems_task_restart( Task_id[TASKID_AVF2], 1 ); | |
632 | if (status[8] != RTEMS_SUCCESSFUL) |
|
632 | if (status[8] != RTEMS_SUCCESSFUL) | |
633 | { |
|
633 | { | |
634 | PRINTF1("in restart_science_task *** AVF2 ERR %d\n", status[8]) |
|
634 | PRINTF1("in restart_science_task *** AVF2 ERR %d\n", status[8]) | |
635 | } |
|
635 | } | |
636 |
|
636 | |||
637 | status[9] = rtems_task_restart( Task_id[TASKID_PRC2], 1 ); |
|
637 | status[9] = rtems_task_restart( Task_id[TASKID_PRC2], 1 ); | |
638 | if (status[9] != RTEMS_SUCCESSFUL) |
|
638 | if (status[9] != RTEMS_SUCCESSFUL) | |
639 | { |
|
639 | { | |
640 | PRINTF1("in restart_science_task *** PRC2 ERR %d\n", status[9]) |
|
640 | PRINTF1("in restart_science_task *** PRC2 ERR %d\n", status[9]) | |
641 | } |
|
641 | } | |
642 |
|
642 | |||
643 | if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) || |
|
643 | if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) || | |
644 | (status[2] != RTEMS_SUCCESSFUL) || (status[3] != RTEMS_SUCCESSFUL) || |
|
644 | (status[2] != RTEMS_SUCCESSFUL) || (status[3] != RTEMS_SUCCESSFUL) || | |
645 | (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) || |
|
645 | (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) || | |
646 | (status[6] != RTEMS_SUCCESSFUL) || (status[7] != RTEMS_SUCCESSFUL) || |
|
646 | (status[6] != RTEMS_SUCCESSFUL) || (status[7] != RTEMS_SUCCESSFUL) || | |
647 | (status[8] != RTEMS_SUCCESSFUL) || (status[9] != RTEMS_SUCCESSFUL) ) |
|
647 | (status[8] != RTEMS_SUCCESSFUL) || (status[9] != RTEMS_SUCCESSFUL) ) | |
648 | { |
|
648 | { | |
649 | ret = RTEMS_UNSATISFIED; |
|
649 | ret = RTEMS_UNSATISFIED; | |
650 | } |
|
650 | } | |
651 |
|
651 | |||
652 | return ret; |
|
652 | return ret; | |
653 | } |
|
653 | } | |
654 |
|
654 | |||
655 | int suspend_science_tasks() |
|
655 | int suspend_science_tasks() | |
656 | { |
|
656 | { | |
657 | /** This function suspends the science tasks. |
|
657 | /** This function suspends the science tasks. | |
658 | * |
|
658 | * | |
659 | * @return RTEMS directive status codes: |
|
659 | * @return RTEMS directive status codes: | |
660 | * - RTEMS_SUCCESSFUL - task restarted successfully |
|
660 | * - RTEMS_SUCCESSFUL - task restarted successfully | |
661 | * - RTEMS_INVALID_ID - task id invalid |
|
661 | * - RTEMS_INVALID_ID - task id invalid | |
662 | * - RTEMS_ALREADY_SUSPENDED - task already suspended |
|
662 | * - RTEMS_ALREADY_SUSPENDED - task already suspended | |
663 | * |
|
663 | * | |
664 | */ |
|
664 | */ | |
665 |
|
665 | |||
666 | rtems_status_code status; |
|
666 | rtems_status_code status; | |
667 |
|
667 | |||
668 | status = rtems_task_suspend( Task_id[TASKID_AVF0] ); // suspend AVF0 |
|
668 | status = rtems_task_suspend( Task_id[TASKID_AVF0] ); // suspend AVF0 | |
669 | if (status != RTEMS_SUCCESSFUL) |
|
669 | if (status != RTEMS_SUCCESSFUL) | |
670 | { |
|
670 | { | |
671 | PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status) |
|
671 | PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status) | |
672 | } |
|
672 | } | |
673 | if (status == RTEMS_SUCCESSFUL) // suspend PRC0 |
|
673 | if (status == RTEMS_SUCCESSFUL) // suspend PRC0 | |
674 | { |
|
674 | { | |
675 | status = rtems_task_suspend( Task_id[TASKID_PRC0] ); |
|
675 | status = rtems_task_suspend( Task_id[TASKID_PRC0] ); | |
676 | if (status != RTEMS_SUCCESSFUL) |
|
676 | if (status != RTEMS_SUCCESSFUL) | |
677 | { |
|
677 | { | |
678 | PRINTF1("in suspend_science_task *** PRC0 ERR %d\n", status) |
|
678 | PRINTF1("in suspend_science_task *** PRC0 ERR %d\n", status) | |
679 | } |
|
679 | } | |
680 | } |
|
680 | } | |
681 | if (status == RTEMS_SUCCESSFUL) // suspend AVF1 |
|
681 | if (status == RTEMS_SUCCESSFUL) // suspend AVF1 | |
682 | { |
|
682 | { | |
683 | status = rtems_task_suspend( Task_id[TASKID_AVF1] ); |
|
683 | status = rtems_task_suspend( Task_id[TASKID_AVF1] ); | |
684 | if (status != RTEMS_SUCCESSFUL) |
|
684 | if (status != RTEMS_SUCCESSFUL) | |
685 | { |
|
685 | { | |
686 | PRINTF1("in suspend_science_task *** AVF1 ERR %d\n", status) |
|
686 | PRINTF1("in suspend_science_task *** AVF1 ERR %d\n", status) | |
687 | } |
|
687 | } | |
688 | } |
|
688 | } | |
689 | if (status == RTEMS_SUCCESSFUL) // suspend PRC1 |
|
689 | if (status == RTEMS_SUCCESSFUL) // suspend PRC1 | |
690 | { |
|
690 | { | |
691 | status = rtems_task_suspend( Task_id[TASKID_PRC1] ); |
|
691 | status = rtems_task_suspend( Task_id[TASKID_PRC1] ); | |
692 | if (status != RTEMS_SUCCESSFUL) |
|
692 | if (status != RTEMS_SUCCESSFUL) | |
693 | { |
|
693 | { | |
694 | PRINTF1("in suspend_science_task *** PRC1 ERR %d\n", status) |
|
694 | PRINTF1("in suspend_science_task *** PRC1 ERR %d\n", status) | |
695 | } |
|
695 | } | |
696 | } |
|
696 | } | |
697 | if (status == RTEMS_SUCCESSFUL) // suspend AVF2 |
|
697 | if (status == RTEMS_SUCCESSFUL) // suspend AVF2 | |
698 | { |
|
698 | { | |
699 | status = rtems_task_suspend( Task_id[TASKID_AVF2] ); |
|
699 | status = rtems_task_suspend( Task_id[TASKID_AVF2] ); | |
700 | if (status != RTEMS_SUCCESSFUL) |
|
700 | if (status != RTEMS_SUCCESSFUL) | |
701 | { |
|
701 | { | |
702 | PRINTF1("in suspend_science_task *** AVF2 ERR %d\n", status) |
|
702 | PRINTF1("in suspend_science_task *** AVF2 ERR %d\n", status) | |
703 | } |
|
703 | } | |
704 | } |
|
704 | } | |
705 | if (status == RTEMS_SUCCESSFUL) // suspend PRC2 |
|
705 | if (status == RTEMS_SUCCESSFUL) // suspend PRC2 | |
706 | { |
|
706 | { | |
707 | status = rtems_task_suspend( Task_id[TASKID_PRC2] ); |
|
707 | status = rtems_task_suspend( Task_id[TASKID_PRC2] ); | |
708 | if (status != RTEMS_SUCCESSFUL) |
|
708 | if (status != RTEMS_SUCCESSFUL) | |
709 | { |
|
709 | { | |
710 | PRINTF1("in suspend_science_task *** PRC2 ERR %d\n", status) |
|
710 | PRINTF1("in suspend_science_task *** PRC2 ERR %d\n", status) | |
711 | } |
|
711 | } | |
712 | } |
|
712 | } | |
713 | if (status == RTEMS_SUCCESSFUL) // suspend WFRM |
|
713 | if (status == RTEMS_SUCCESSFUL) // suspend WFRM | |
714 | { |
|
714 | { | |
715 | status = rtems_task_suspend( Task_id[TASKID_WFRM] ); |
|
715 | status = rtems_task_suspend( Task_id[TASKID_WFRM] ); | |
716 | if (status != RTEMS_SUCCESSFUL) |
|
716 | if (status != RTEMS_SUCCESSFUL) | |
717 | { |
|
717 | { | |
718 | PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status) |
|
718 | PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status) | |
719 | } |
|
719 | } | |
720 | } |
|
720 | } | |
721 | if (status == RTEMS_SUCCESSFUL) // suspend CWF3 |
|
721 | if (status == RTEMS_SUCCESSFUL) // suspend CWF3 | |
722 | { |
|
722 | { | |
723 | status = rtems_task_suspend( Task_id[TASKID_CWF3] ); |
|
723 | status = rtems_task_suspend( Task_id[TASKID_CWF3] ); | |
724 | if (status != RTEMS_SUCCESSFUL) |
|
724 | if (status != RTEMS_SUCCESSFUL) | |
725 | { |
|
725 | { | |
726 | PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status) |
|
726 | PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status) | |
727 | } |
|
727 | } | |
728 | } |
|
728 | } | |
729 | if (status == RTEMS_SUCCESSFUL) // suspend CWF2 |
|
729 | if (status == RTEMS_SUCCESSFUL) // suspend CWF2 | |
730 | { |
|
730 | { | |
731 | status = rtems_task_suspend( Task_id[TASKID_CWF2] ); |
|
731 | status = rtems_task_suspend( Task_id[TASKID_CWF2] ); | |
732 | if (status != RTEMS_SUCCESSFUL) |
|
732 | if (status != RTEMS_SUCCESSFUL) | |
733 | { |
|
733 | { | |
734 | PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status) |
|
734 | PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status) | |
735 | } |
|
735 | } | |
736 | } |
|
736 | } | |
737 | if (status == RTEMS_SUCCESSFUL) // suspend CWF1 |
|
737 | if (status == RTEMS_SUCCESSFUL) // suspend CWF1 | |
738 | { |
|
738 | { | |
739 | status = rtems_task_suspend( Task_id[TASKID_CWF1] ); |
|
739 | status = rtems_task_suspend( Task_id[TASKID_CWF1] ); | |
740 | if (status != RTEMS_SUCCESSFUL) |
|
740 | if (status != RTEMS_SUCCESSFUL) | |
741 | { |
|
741 | { | |
742 | PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status) |
|
742 | PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status) | |
743 | } |
|
743 | } | |
744 | } |
|
744 | } | |
745 |
|
745 | |||
746 | return status; |
|
746 | return status; | |
747 | } |
|
747 | } | |
748 |
|
748 | |||
749 | void launch_waveform_picker( unsigned char mode, unsigned int transitionCoarseTime ) |
|
749 | void launch_waveform_picker( unsigned char mode, unsigned int transitionCoarseTime ) | |
750 | { |
|
750 | { | |
751 | reset_current_ring_nodes(); |
|
751 | reset_current_ring_nodes(); | |
752 | reset_waveform_picker_regs(); |
|
752 | reset_waveform_picker_regs(); | |
753 | set_wfp_burst_enable_register( mode ); |
|
753 | set_wfp_burst_enable_register( mode ); | |
754 |
|
754 | |||
755 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); |
|
755 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); | |
756 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); |
|
756 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); | |
757 |
|
757 | |||
758 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x80; // [1000 0000] |
|
758 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x80; // [1000 0000] | |
759 | if (transitionCoarseTime == 0) |
|
759 | if (transitionCoarseTime == 0) | |
760 | { |
|
760 | { | |
761 | waveform_picker_regs->start_date = time_management_regs->coarse_time; |
|
761 | waveform_picker_regs->start_date = time_management_regs->coarse_time; | |
762 | } |
|
762 | } | |
763 | else |
|
763 | else | |
764 | { |
|
764 | { | |
765 | waveform_picker_regs->start_date = transitionCoarseTime; |
|
765 | waveform_picker_regs->start_date = transitionCoarseTime; | |
766 | } |
|
766 | } | |
767 | } |
|
767 | } | |
768 |
|
768 | |||
769 | void launch_spectral_matrix( void ) |
|
769 | void launch_spectral_matrix( void ) | |
770 | { |
|
770 | { | |
771 | SM_reset_current_ring_nodes(); |
|
771 | SM_reset_current_ring_nodes(); | |
772 | reset_spectral_matrix_regs(); |
|
772 | reset_spectral_matrix_regs(); | |
773 | reset_nb_sm(); |
|
773 | reset_nb_sm(); | |
774 |
|
774 | |||
775 | struct grgpio_regs_str *grgpio_regs = (struct grgpio_regs_str *) REGS_ADDR_GRGPIO; |
|
775 | struct grgpio_regs_str *grgpio_regs = (struct grgpio_regs_str *) REGS_ADDR_GRGPIO; | |
776 | grgpio_regs->io_port_direction_register = |
|
776 | grgpio_regs->io_port_direction_register = | |
777 | grgpio_regs->io_port_direction_register | 0x01; // [0000 0001], 0 = output disabled, 1 = output enabled |
|
777 | grgpio_regs->io_port_direction_register | 0x01; // [0000 0001], 0 = output disabled, 1 = output enabled | |
778 | grgpio_regs->io_port_output_register = grgpio_regs->io_port_output_register & 0xfffffffe; // set the bit 0 to 0 |
|
778 | grgpio_regs->io_port_output_register = grgpio_regs->io_port_output_register & 0xfffffffe; // set the bit 0 to 0 | |
779 | set_irq_on_new_ready_matrix( 1 ); |
|
779 | set_irq_on_new_ready_matrix( 1 ); | |
780 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); |
|
780 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); | |
781 | LEON_Unmask_interrupt( IRQ_SPECTRAL_MATRIX ); |
|
781 | LEON_Unmask_interrupt( IRQ_SPECTRAL_MATRIX ); | |
782 | set_run_matrix_spectral( 1 ); |
|
782 | set_run_matrix_spectral( 1 ); | |
783 |
|
783 | |||
784 | } |
|
784 | } | |
785 |
|
785 | |||
786 | void launch_spectral_matrix_simu( void ) |
|
786 | void launch_spectral_matrix_simu( void ) | |
787 | { |
|
787 | { | |
788 | SM_reset_current_ring_nodes(); |
|
788 | SM_reset_current_ring_nodes(); | |
789 | reset_spectral_matrix_regs(); |
|
789 | reset_spectral_matrix_regs(); | |
790 | reset_nb_sm(); |
|
790 | reset_nb_sm(); | |
791 |
|
791 | |||
792 | // Spectral Matrices simulator |
|
792 | // Spectral Matrices simulator | |
793 | timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); |
|
793 | timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); | |
794 | LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); |
|
794 | LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); | |
795 | LEON_Unmask_interrupt( IRQ_SM_SIMULATOR ); |
|
795 | LEON_Unmask_interrupt( IRQ_SM_SIMULATOR ); | |
796 | } |
|
796 | } | |
797 |
|
797 | |||
798 | void set_irq_on_new_ready_matrix( unsigned char value ) |
|
798 | void set_irq_on_new_ready_matrix( unsigned char value ) | |
799 | { |
|
799 | { | |
800 | if (value == 1) |
|
800 | if (value == 1) | |
801 | { |
|
801 | { | |
802 | spectral_matrix_regs->config = spectral_matrix_regs->config | 0x01; |
|
802 | spectral_matrix_regs->config = spectral_matrix_regs->config | 0x01; | |
803 | } |
|
803 | } | |
804 | else |
|
804 | else | |
805 | { |
|
805 | { | |
806 | spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffe; // 1110 |
|
806 | spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffe; // 1110 | |
807 | } |
|
807 | } | |
808 | } |
|
808 | } | |
809 |
|
809 | |||
810 | void set_run_matrix_spectral( unsigned char value ) |
|
810 | void set_run_matrix_spectral( unsigned char value ) | |
811 | { |
|
811 | { | |
812 | if (value == 1) |
|
812 | if (value == 1) | |
813 | { |
|
813 | { | |
814 | spectral_matrix_regs->config = spectral_matrix_regs->config | 0x4; // [0100] set run_matrix spectral to 1 |
|
814 | spectral_matrix_regs->config = spectral_matrix_regs->config | 0x4; // [0100] set run_matrix spectral to 1 | |
815 | } |
|
815 | } | |
816 | else |
|
816 | else | |
817 | { |
|
817 | { | |
818 | spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffb; // [1011] set run_matrix spectral to 0 |
|
818 | spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffb; // [1011] set run_matrix spectral to 0 | |
819 | } |
|
819 | } | |
820 | } |
|
820 | } | |
821 |
|
821 | |||
822 | //**************** |
|
822 | //**************** | |
823 | // CLOSING ACTIONS |
|
823 | // CLOSING ACTIONS | |
824 | void update_last_TC_exe( ccsdsTelecommandPacket_t *TC, unsigned char * time ) |
|
824 | void update_last_TC_exe( ccsdsTelecommandPacket_t *TC, unsigned char * time ) | |
825 | { |
|
825 | { | |
826 | /** This function is used to update the HK packets statistics after a successful TC execution. |
|
826 | /** This function is used to update the HK packets statistics after a successful TC execution. | |
827 | * |
|
827 | * | |
828 | * @param TC points to the TC being processed |
|
828 | * @param TC points to the TC being processed | |
829 | * @param time is the time used to date the TC execution |
|
829 | * @param time is the time used to date the TC execution | |
830 | * |
|
830 | * | |
831 | */ |
|
831 | */ | |
832 |
|
832 | |||
833 | unsigned int val; |
|
833 | unsigned int val; | |
834 |
|
834 | |||
835 | housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0]; |
|
835 | housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0]; | |
836 | housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1]; |
|
836 | housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1]; | |
837 | housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00; |
|
837 | housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00; | |
838 | housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType; |
|
838 | housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType; | |
839 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00; |
|
839 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00; | |
840 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType; |
|
840 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType; | |
841 | housekeeping_packet.hk_lfr_last_exe_tc_time[0] = time[0]; |
|
841 | housekeeping_packet.hk_lfr_last_exe_tc_time[0] = time[0]; | |
842 | housekeeping_packet.hk_lfr_last_exe_tc_time[1] = time[1]; |
|
842 | housekeeping_packet.hk_lfr_last_exe_tc_time[1] = time[1]; | |
843 | housekeeping_packet.hk_lfr_last_exe_tc_time[2] = time[2]; |
|
843 | housekeeping_packet.hk_lfr_last_exe_tc_time[2] = time[2]; | |
844 | housekeeping_packet.hk_lfr_last_exe_tc_time[3] = time[3]; |
|
844 | housekeeping_packet.hk_lfr_last_exe_tc_time[3] = time[3]; | |
845 | housekeeping_packet.hk_lfr_last_exe_tc_time[4] = time[4]; |
|
845 | housekeeping_packet.hk_lfr_last_exe_tc_time[4] = time[4]; | |
846 | housekeeping_packet.hk_lfr_last_exe_tc_time[5] = time[5]; |
|
846 | housekeeping_packet.hk_lfr_last_exe_tc_time[5] = time[5]; | |
847 |
|
847 | |||
848 | val = housekeeping_packet.hk_lfr_exe_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_exe_tc_cnt[1]; |
|
848 | val = housekeeping_packet.hk_lfr_exe_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_exe_tc_cnt[1]; | |
849 | val++; |
|
849 | val++; | |
850 | housekeeping_packet.hk_lfr_exe_tc_cnt[0] = (unsigned char) (val >> 8); |
|
850 | housekeeping_packet.hk_lfr_exe_tc_cnt[0] = (unsigned char) (val >> 8); | |
851 | housekeeping_packet.hk_lfr_exe_tc_cnt[1] = (unsigned char) (val); |
|
851 | housekeeping_packet.hk_lfr_exe_tc_cnt[1] = (unsigned char) (val); | |
852 | } |
|
852 | } | |
853 |
|
853 | |||
854 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char * time ) |
|
854 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char * time ) | |
855 | { |
|
855 | { | |
856 | /** This function is used to update the HK packets statistics after a TC rejection. |
|
856 | /** This function is used to update the HK packets statistics after a TC rejection. | |
857 | * |
|
857 | * | |
858 | * @param TC points to the TC being processed |
|
858 | * @param TC points to the TC being processed | |
859 | * @param time is the time used to date the TC rejection |
|
859 | * @param time is the time used to date the TC rejection | |
860 | * |
|
860 | * | |
861 | */ |
|
861 | */ | |
862 |
|
862 | |||
863 | unsigned int val; |
|
863 | unsigned int val; | |
864 |
|
864 | |||
865 | housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0]; |
|
865 | housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0]; | |
866 | housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1]; |
|
866 | housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1]; | |
867 | housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00; |
|
867 | housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00; | |
868 | housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType; |
|
868 | housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType; | |
869 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00; |
|
869 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00; | |
870 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType; |
|
870 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType; | |
871 | housekeeping_packet.hk_lfr_last_rej_tc_time[0] = time[0]; |
|
871 | housekeeping_packet.hk_lfr_last_rej_tc_time[0] = time[0]; | |
872 | housekeeping_packet.hk_lfr_last_rej_tc_time[1] = time[1]; |
|
872 | housekeeping_packet.hk_lfr_last_rej_tc_time[1] = time[1]; | |
873 | housekeeping_packet.hk_lfr_last_rej_tc_time[2] = time[2]; |
|
873 | housekeeping_packet.hk_lfr_last_rej_tc_time[2] = time[2]; | |
874 | housekeeping_packet.hk_lfr_last_rej_tc_time[3] = time[3]; |
|
874 | housekeeping_packet.hk_lfr_last_rej_tc_time[3] = time[3]; | |
875 | housekeeping_packet.hk_lfr_last_rej_tc_time[4] = time[4]; |
|
875 | housekeeping_packet.hk_lfr_last_rej_tc_time[4] = time[4]; | |
876 | housekeeping_packet.hk_lfr_last_rej_tc_time[5] = time[5]; |
|
876 | housekeeping_packet.hk_lfr_last_rej_tc_time[5] = time[5]; | |
877 |
|
877 | |||
878 | val = housekeeping_packet.hk_lfr_rej_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_rej_tc_cnt[1]; |
|
878 | val = housekeeping_packet.hk_lfr_rej_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_rej_tc_cnt[1]; | |
879 | val++; |
|
879 | val++; | |
880 | housekeeping_packet.hk_lfr_rej_tc_cnt[0] = (unsigned char) (val >> 8); |
|
880 | housekeeping_packet.hk_lfr_rej_tc_cnt[0] = (unsigned char) (val >> 8); | |
881 | housekeeping_packet.hk_lfr_rej_tc_cnt[1] = (unsigned char) (val); |
|
881 | housekeeping_packet.hk_lfr_rej_tc_cnt[1] = (unsigned char) (val); | |
882 | } |
|
882 | } | |
883 |
|
883 | |||
884 | void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id ) |
|
884 | void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id ) | |
885 | { |
|
885 | { | |
886 | /** This function is the last step of the TC execution workflow. |
|
886 | /** This function is the last step of the TC execution workflow. | |
887 | * |
|
887 | * | |
888 | * @param TC points to the TC being processed |
|
888 | * @param TC points to the TC being processed | |
889 | * @param result is the result of the TC execution (LFR_SUCCESSFUL / LFR_DEFAULT) |
|
889 | * @param result is the result of the TC execution (LFR_SUCCESSFUL / LFR_DEFAULT) | |
890 | * @param queue_id is the id of the RTEMS message queue used to send TM packets |
|
890 | * @param queue_id is the id of the RTEMS message queue used to send TM packets | |
891 | * @param time is the time used to date the TC execution |
|
891 | * @param time is the time used to date the TC execution | |
892 | * |
|
892 | * | |
893 | */ |
|
893 | */ | |
894 |
|
894 | |||
895 | unsigned char requestedMode; |
|
895 | unsigned char requestedMode; | |
896 |
|
896 | |||
897 | if (result == LFR_SUCCESSFUL) |
|
897 | if (result == LFR_SUCCESSFUL) | |
898 | { |
|
898 | { | |
899 | if ( !( (TC->serviceType==TC_TYPE_TIME) & (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) ) |
|
899 | if ( !( (TC->serviceType==TC_TYPE_TIME) & (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) ) | |
900 | & |
|
900 | & | |
901 | !( (TC->serviceType==TC_TYPE_GEN) & (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO)) |
|
901 | !( (TC->serviceType==TC_TYPE_GEN) & (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO)) | |
902 | ) |
|
902 | ) | |
903 | { |
|
903 | { | |
904 | send_tm_lfr_tc_exe_success( TC, queue_id ); |
|
904 | send_tm_lfr_tc_exe_success( TC, queue_id ); | |
905 | } |
|
905 | } | |
906 | if ( (TC->serviceType == TC_TYPE_GEN) & (TC->serviceSubType == TC_SUBTYPE_ENTER) ) |
|
906 | if ( (TC->serviceType == TC_TYPE_GEN) & (TC->serviceSubType == TC_SUBTYPE_ENTER) ) | |
907 | { |
|
907 | { | |
908 | //********************************** |
|
908 | //********************************** | |
909 | // UPDATE THE LFRMODE LOCAL VARIABLE |
|
909 | // UPDATE THE LFRMODE LOCAL VARIABLE | |
910 | requestedMode = TC->dataAndCRC[1]; |
|
910 | requestedMode = TC->dataAndCRC[1]; | |
911 | housekeeping_packet.lfr_status_word[0] = (unsigned char) ((requestedMode << 4) + 0x0d); |
|
911 | housekeeping_packet.lfr_status_word[0] = (unsigned char) ((requestedMode << 4) + 0x0d); | |
912 | updateLFRCurrentMode(); |
|
912 | updateLFRCurrentMode(); | |
913 | } |
|
913 | } | |
914 | } |
|
914 | } | |
915 | else if (result == LFR_EXE_ERROR) |
|
915 | else if (result == LFR_EXE_ERROR) | |
916 | { |
|
916 | { | |
917 | send_tm_lfr_tc_exe_error( TC, queue_id ); |
|
917 | send_tm_lfr_tc_exe_error( TC, queue_id ); | |
918 | } |
|
918 | } | |
919 | } |
|
919 | } | |
920 |
|
920 | |||
921 | //*************************** |
|
921 | //*************************** | |
922 | // Interrupt Service Routines |
|
922 | // Interrupt Service Routines | |
923 | rtems_isr commutation_isr1( rtems_vector_number vector ) |
|
923 | rtems_isr commutation_isr1( rtems_vector_number vector ) | |
924 | { |
|
924 | { | |
925 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
925 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { | |
926 | printf("In commutation_isr1 *** Error sending event to DUMB\n"); |
|
926 | printf("In commutation_isr1 *** Error sending event to DUMB\n"); | |
927 | } |
|
927 | } | |
928 | } |
|
928 | } | |
929 |
|
929 | |||
930 | rtems_isr commutation_isr2( rtems_vector_number vector ) |
|
930 | rtems_isr commutation_isr2( rtems_vector_number vector ) | |
931 | { |
|
931 | { | |
932 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
932 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { | |
933 | printf("In commutation_isr2 *** Error sending event to DUMB\n"); |
|
933 | printf("In commutation_isr2 *** Error sending event to DUMB\n"); | |
934 | } |
|
934 | } | |
935 | } |
|
935 | } | |
936 |
|
936 | |||
937 | //**************** |
|
937 | //**************** | |
938 | // OTHER FUNCTIONS |
|
938 | // OTHER FUNCTIONS | |
939 | void updateLFRCurrentMode() |
|
939 | void updateLFRCurrentMode() | |
940 | { |
|
940 | { | |
941 | /** This function updates the value of the global variable lfrCurrentMode. |
|
941 | /** This function updates the value of the global variable lfrCurrentMode. | |
942 | * |
|
942 | * | |
943 | * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running. |
|
943 | * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running. | |
944 | * |
|
944 | * | |
945 | */ |
|
945 | */ | |
946 | // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure |
|
946 | // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure | |
947 | lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
947 | lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
948 | } |
|
948 | } | |
949 |
|
949 |
General Comments 0
You need to be logged in to leave comments.
Login now