@@ -1,233 +1,233 | |||||
1 | ############################################################################# |
|
1 | ############################################################################# | |
2 | # Makefile for building: bin/fsw |
|
2 | # Makefile for building: bin/fsw | |
3 |
# Generated by qmake (2.01a) (Qt 4.8.5) on: |
|
3 | # Generated by qmake (2.01a) (Qt 4.8.5) on: Fri Oct 4 15:16:59 2013 | |
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=0 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=13 -DPRINT_MESSAGES_ON_CONSOLE |
|
13 | DEFINES = -DSW_VERSION_N1=0 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=13 -DPRINT_MESSAGES_ON_CONSOLE -DPRINT_TASK_STATISTICS -DPRINT_STACK_REPORT | |
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 |
|
16 | INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header | |
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_processing.c \ |
|
48 | ../src/fsw_processing.c \ | |
49 | ../src/fsw_misc.c \ |
|
49 | ../src/fsw_misc.c \ | |
50 | ../src/fsw_init.c \ |
|
50 | ../src/fsw_init.c \ | |
51 | ../src/fsw_globals.c \ |
|
51 | ../src/fsw_globals.c \ | |
52 | ../src/fsw_spacewire.c |
|
52 | ../src/fsw_spacewire.c | |
53 | OBJECTS = obj/wf_handler.o \ |
|
53 | OBJECTS = obj/wf_handler.o \ | |
54 | obj/tc_handler.o \ |
|
54 | obj/tc_handler.o \ | |
55 | obj/fsw_processing.o \ |
|
55 | obj/fsw_processing.o \ | |
56 | obj/fsw_misc.o \ |
|
56 | obj/fsw_misc.o \ | |
57 | obj/fsw_init.o \ |
|
57 | obj/fsw_init.o \ | |
58 | obj/fsw_globals.o \ |
|
58 | obj/fsw_globals.o \ | |
59 | obj/fsw_spacewire.o |
|
59 | obj/fsw_spacewire.o | |
60 | DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \ |
|
60 | DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \ | |
61 | /usr/lib64/qt4/mkspecs/common/linux.conf \ |
|
61 | /usr/lib64/qt4/mkspecs/common/linux.conf \ | |
62 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ |
|
62 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ | |
63 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ |
|
63 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ | |
64 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ |
|
64 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ | |
65 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ |
|
65 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ | |
66 | /usr/lib64/qt4/mkspecs/qconfig.pri \ |
|
66 | /usr/lib64/qt4/mkspecs/qconfig.pri \ | |
67 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ |
|
67 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ | |
68 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ |
|
68 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ | |
69 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ |
|
69 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ | |
70 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ |
|
70 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ | |
71 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ |
|
71 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ | |
72 | sparc.pri \ |
|
72 | sparc.pri \ | |
73 | /usr/lib64/qt4/mkspecs/features/release.prf \ |
|
73 | /usr/lib64/qt4/mkspecs/features/release.prf \ | |
74 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ |
|
74 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ | |
75 | /usr/lib64/qt4/mkspecs/features/shared.prf \ |
|
75 | /usr/lib64/qt4/mkspecs/features/shared.prf \ | |
76 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ |
|
76 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ | |
77 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ |
|
77 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ | |
78 | /usr/lib64/qt4/mkspecs/features/resources.prf \ |
|
78 | /usr/lib64/qt4/mkspecs/features/resources.prf \ | |
79 | /usr/lib64/qt4/mkspecs/features/uic.prf \ |
|
79 | /usr/lib64/qt4/mkspecs/features/uic.prf \ | |
80 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ |
|
80 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ | |
81 | /usr/lib64/qt4/mkspecs/features/lex.prf \ |
|
81 | /usr/lib64/qt4/mkspecs/features/lex.prf \ | |
82 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \ |
|
82 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \ | |
83 | fsw-qt.pro |
|
83 | fsw-qt.pro | |
84 | QMAKE_TARGET = fsw |
|
84 | QMAKE_TARGET = fsw | |
85 | DESTDIR = bin/ |
|
85 | DESTDIR = bin/ | |
86 | TARGET = bin/fsw |
|
86 | TARGET = bin/fsw | |
87 |
|
87 | |||
88 | first: all |
|
88 | first: all | |
89 | ####### Implicit rules |
|
89 | ####### Implicit rules | |
90 |
|
90 | |||
91 | .SUFFIXES: .o .c .cpp .cc .cxx .C |
|
91 | .SUFFIXES: .o .c .cpp .cc .cxx .C | |
92 |
|
92 | |||
93 | .cpp.o: |
|
93 | .cpp.o: | |
94 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
94 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" | |
95 |
|
95 | |||
96 | .cc.o: |
|
96 | .cc.o: | |
97 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
97 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" | |
98 |
|
98 | |||
99 | .cxx.o: |
|
99 | .cxx.o: | |
100 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
100 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" | |
101 |
|
101 | |||
102 | .C.o: |
|
102 | .C.o: | |
103 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
103 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" | |
104 |
|
104 | |||
105 | .c.o: |
|
105 | .c.o: | |
106 | $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<" |
|
106 | $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<" | |
107 |
|
107 | |||
108 | ####### Build rules |
|
108 | ####### Build rules | |
109 |
|
109 | |||
110 | all: Makefile $(TARGET) |
|
110 | all: Makefile $(TARGET) | |
111 |
|
111 | |||
112 | $(TARGET): $(OBJECTS) |
|
112 | $(TARGET): $(OBJECTS) | |
113 | @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/ |
|
113 | @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/ | |
114 | $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) |
|
114 | $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) | |
115 |
|
115 | |||
116 | Makefile: fsw-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \ |
|
116 | Makefile: fsw-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \ | |
117 | /usr/lib64/qt4/mkspecs/common/linux.conf \ |
|
117 | /usr/lib64/qt4/mkspecs/common/linux.conf \ | |
118 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ |
|
118 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ | |
119 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ |
|
119 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ | |
120 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ |
|
120 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ | |
121 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ |
|
121 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ | |
122 | /usr/lib64/qt4/mkspecs/qconfig.pri \ |
|
122 | /usr/lib64/qt4/mkspecs/qconfig.pri \ | |
123 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ |
|
123 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ | |
124 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ |
|
124 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ | |
125 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ |
|
125 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ | |
126 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ |
|
126 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ | |
127 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ |
|
127 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ | |
128 | sparc.pri \ |
|
128 | sparc.pri \ | |
129 | /usr/lib64/qt4/mkspecs/features/release.prf \ |
|
129 | /usr/lib64/qt4/mkspecs/features/release.prf \ | |
130 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ |
|
130 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ | |
131 | /usr/lib64/qt4/mkspecs/features/shared.prf \ |
|
131 | /usr/lib64/qt4/mkspecs/features/shared.prf \ | |
132 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ |
|
132 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ | |
133 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ |
|
133 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ | |
134 | /usr/lib64/qt4/mkspecs/features/resources.prf \ |
|
134 | /usr/lib64/qt4/mkspecs/features/resources.prf \ | |
135 | /usr/lib64/qt4/mkspecs/features/uic.prf \ |
|
135 | /usr/lib64/qt4/mkspecs/features/uic.prf \ | |
136 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ |
|
136 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ | |
137 | /usr/lib64/qt4/mkspecs/features/lex.prf \ |
|
137 | /usr/lib64/qt4/mkspecs/features/lex.prf \ | |
138 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf |
|
138 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf | |
139 | $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro |
|
139 | $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro | |
140 | /usr/lib64/qt4/mkspecs/common/unix.conf: |
|
140 | /usr/lib64/qt4/mkspecs/common/unix.conf: | |
141 | /usr/lib64/qt4/mkspecs/common/linux.conf: |
|
141 | /usr/lib64/qt4/mkspecs/common/linux.conf: | |
142 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf: |
|
142 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf: | |
143 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf: |
|
143 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf: | |
144 | /usr/lib64/qt4/mkspecs/common/g++-base.conf: |
|
144 | /usr/lib64/qt4/mkspecs/common/g++-base.conf: | |
145 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf: |
|
145 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf: | |
146 | /usr/lib64/qt4/mkspecs/qconfig.pri: |
|
146 | /usr/lib64/qt4/mkspecs/qconfig.pri: | |
147 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri: |
|
147 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri: | |
148 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf: |
|
148 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf: | |
149 | /usr/lib64/qt4/mkspecs/features/qt_config.prf: |
|
149 | /usr/lib64/qt4/mkspecs/features/qt_config.prf: | |
150 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf: |
|
150 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf: | |
151 | /usr/lib64/qt4/mkspecs/features/default_pre.prf: |
|
151 | /usr/lib64/qt4/mkspecs/features/default_pre.prf: | |
152 | sparc.pri: |
|
152 | sparc.pri: | |
153 | /usr/lib64/qt4/mkspecs/features/release.prf: |
|
153 | /usr/lib64/qt4/mkspecs/features/release.prf: | |
154 | /usr/lib64/qt4/mkspecs/features/default_post.prf: |
|
154 | /usr/lib64/qt4/mkspecs/features/default_post.prf: | |
155 | /usr/lib64/qt4/mkspecs/features/shared.prf: |
|
155 | /usr/lib64/qt4/mkspecs/features/shared.prf: | |
156 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf: |
|
156 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf: | |
157 | /usr/lib64/qt4/mkspecs/features/warn_on.prf: |
|
157 | /usr/lib64/qt4/mkspecs/features/warn_on.prf: | |
158 | /usr/lib64/qt4/mkspecs/features/resources.prf: |
|
158 | /usr/lib64/qt4/mkspecs/features/resources.prf: | |
159 | /usr/lib64/qt4/mkspecs/features/uic.prf: |
|
159 | /usr/lib64/qt4/mkspecs/features/uic.prf: | |
160 | /usr/lib64/qt4/mkspecs/features/yacc.prf: |
|
160 | /usr/lib64/qt4/mkspecs/features/yacc.prf: | |
161 | /usr/lib64/qt4/mkspecs/features/lex.prf: |
|
161 | /usr/lib64/qt4/mkspecs/features/lex.prf: | |
162 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf: |
|
162 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf: | |
163 | qmake: FORCE |
|
163 | qmake: FORCE | |
164 | @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro |
|
164 | @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro | |
165 |
|
165 | |||
166 | dist: |
|
166 | dist: | |
167 | @$(CHK_DIR_EXISTS) obj/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0 |
|
167 | @$(CHK_DIR_EXISTS) obj/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0 | |
168 | $(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 |
|
168 | $(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 | |
169 |
|
169 | |||
170 |
|
170 | |||
171 | clean:compiler_clean |
|
171 | clean:compiler_clean | |
172 | -$(DEL_FILE) $(OBJECTS) |
|
172 | -$(DEL_FILE) $(OBJECTS) | |
173 | -$(DEL_FILE) *~ core *.core |
|
173 | -$(DEL_FILE) *~ core *.core | |
174 |
|
174 | |||
175 |
|
175 | |||
176 | ####### Sub-libraries |
|
176 | ####### Sub-libraries | |
177 |
|
177 | |||
178 | distclean: clean |
|
178 | distclean: clean | |
179 | -$(DEL_FILE) $(TARGET) |
|
179 | -$(DEL_FILE) $(TARGET) | |
180 | -$(DEL_FILE) Makefile |
|
180 | -$(DEL_FILE) Makefile | |
181 |
|
181 | |||
182 |
|
182 | |||
183 | grmon: |
|
183 | grmon: | |
184 | cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u |
|
184 | cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u | |
185 |
|
185 | |||
186 | check: first |
|
186 | check: first | |
187 |
|
187 | |||
188 | compiler_rcc_make_all: |
|
188 | compiler_rcc_make_all: | |
189 | compiler_rcc_clean: |
|
189 | compiler_rcc_clean: | |
190 | compiler_uic_make_all: |
|
190 | compiler_uic_make_all: | |
191 | compiler_uic_clean: |
|
191 | compiler_uic_clean: | |
192 | compiler_image_collection_make_all: qmake_image_collection.cpp |
|
192 | compiler_image_collection_make_all: qmake_image_collection.cpp | |
193 | compiler_image_collection_clean: |
|
193 | compiler_image_collection_clean: | |
194 | -$(DEL_FILE) qmake_image_collection.cpp |
|
194 | -$(DEL_FILE) qmake_image_collection.cpp | |
195 | compiler_yacc_decl_make_all: |
|
195 | compiler_yacc_decl_make_all: | |
196 | compiler_yacc_decl_clean: |
|
196 | compiler_yacc_decl_clean: | |
197 | compiler_yacc_impl_make_all: |
|
197 | compiler_yacc_impl_make_all: | |
198 | compiler_yacc_impl_clean: |
|
198 | compiler_yacc_impl_clean: | |
199 | compiler_lex_make_all: |
|
199 | compiler_lex_make_all: | |
200 | compiler_lex_clean: |
|
200 | compiler_lex_clean: | |
201 | compiler_clean: |
|
201 | compiler_clean: | |
202 |
|
202 | |||
203 | ####### Compile |
|
203 | ####### Compile | |
204 |
|
204 | |||
205 | obj/wf_handler.o: ../src/wf_handler.c |
|
205 | obj/wf_handler.o: ../src/wf_handler.c | |
206 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/wf_handler.o ../src/wf_handler.c |
|
206 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/wf_handler.o ../src/wf_handler.c | |
207 |
|
207 | |||
208 | obj/tc_handler.o: ../src/tc_handler.c |
|
208 | obj/tc_handler.o: ../src/tc_handler.c | |
209 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o ../src/tc_handler.c |
|
209 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o ../src/tc_handler.c | |
210 |
|
210 | |||
211 | obj/fsw_processing.o: ../src/fsw_processing.c |
|
211 | obj/fsw_processing.o: ../src/fsw_processing.c | |
212 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/fsw_processing.c |
|
212 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/fsw_processing.c | |
213 |
|
213 | |||
214 | obj/fsw_misc.o: ../src/fsw_misc.c |
|
214 | obj/fsw_misc.o: ../src/fsw_misc.c | |
215 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c |
|
215 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c | |
216 |
|
216 | |||
217 | obj/fsw_init.o: ../src/fsw_init.c |
|
217 | obj/fsw_init.o: ../src/fsw_init.c | |
218 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o ../src/fsw_init.c |
|
218 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o ../src/fsw_init.c | |
219 |
|
219 | |||
220 | obj/fsw_globals.o: ../src/fsw_globals.c |
|
220 | obj/fsw_globals.o: ../src/fsw_globals.c | |
221 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c |
|
221 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c | |
222 |
|
222 | |||
223 | obj/fsw_spacewire.o: ../src/fsw_spacewire.c |
|
223 | obj/fsw_spacewire.o: ../src/fsw_spacewire.c | |
224 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spacewire.o ../src/fsw_spacewire.c |
|
224 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spacewire.o ../src/fsw_spacewire.c | |
225 |
|
225 | |||
226 | ####### Install |
|
226 | ####### Install | |
227 |
|
227 | |||
228 | install: FORCE |
|
228 | install: FORCE | |
229 |
|
229 | |||
230 | uninstall: FORCE |
|
230 | uninstall: FORCE | |
231 |
|
231 | |||
232 | FORCE: |
|
232 | FORCE: | |
233 |
|
233 |
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
@@ -1,54 +1,58 | |||||
1 | TEMPLATE = app |
|
1 | TEMPLATE = app | |
2 | # CONFIG += console v8 sim |
|
2 | # CONFIG += console v8 sim | |
3 | # CONFIG options = verbose *** cpu_usage_report *** gsa |
|
3 | # CONFIG options = verbose *** cpu_usage_report *** gsa *** stack_report | |
4 | CONFIG += console verbose |
|
4 | CONFIG += console verbose stack_report cpu_usage_report | |
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=-0-13 |
|
10 | SWVERSION=-0-13 | |
11 | DEFINES += SW_VERSION_N1=0 |
|
11 | DEFINES += SW_VERSION_N1=0 | |
12 | DEFINES += SW_VERSION_N2=0 |
|
12 | DEFINES += SW_VERSION_N2=0 | |
13 | DEFINES += SW_VERSION_N3=0 |
|
13 | DEFINES += SW_VERSION_N3=0 | |
14 | DEFINES += SW_VERSION_N4=13 |
|
14 | DEFINES += SW_VERSION_N4=13 | |
15 |
|
15 | |||
16 | contains( CONFIG, verbose ) { |
|
16 | contains( CONFIG, verbose ) { | |
17 | DEFINES += PRINT_MESSAGES_ON_CONSOLE |
|
17 | DEFINES += PRINT_MESSAGES_ON_CONSOLE | |
18 | } |
|
18 | } | |
19 |
|
19 | |||
20 | contains( CONFIG, cpu_usage_report ) { |
|
20 | contains( CONFIG, cpu_usage_report ) { | |
21 | DEFINES += PRINT_TASK_STATISTICS |
|
21 | DEFINES += PRINT_TASK_STATISTICS | |
22 | } |
|
22 | } | |
23 |
|
23 | |||
|
24 | contains( CONFIG, stack_report ) { | |||
|
25 | DEFINES += PRINT_STACK_REPORT | |||
|
26 | } | |||
|
27 | ||||
24 | TARGET = fsw |
|
28 | TARGET = fsw | |
25 | contains( CONFIG, gsa ) { |
|
29 | contains( CONFIG, gsa ) { | |
26 | DEFINES += GSA |
|
30 | DEFINES += GSA | |
27 | TARGET = fsw-gsa |
|
31 | TARGET = fsw-gsa | |
28 | } |
|
32 | } | |
29 |
|
33 | |||
30 | INCLUDEPATH += \ |
|
34 | INCLUDEPATH += \ | |
31 | ../src \ |
|
35 | ../src \ | |
32 | ../header |
|
36 | ../header | |
33 |
|
37 | |||
34 | SOURCES += \ |
|
38 | SOURCES += \ | |
35 | ../src/wf_handler.c \ |
|
39 | ../src/wf_handler.c \ | |
36 | ../src/tc_handler.c \ |
|
40 | ../src/tc_handler.c \ | |
37 | ../src/fsw_processing.c \ |
|
41 | ../src/fsw_processing.c \ | |
38 | ../src/fsw_misc.c \ |
|
42 | ../src/fsw_misc.c \ | |
39 | ../src/fsw_init.c \ |
|
43 | ../src/fsw_init.c \ | |
40 | ../src/fsw_globals.c \ |
|
44 | ../src/fsw_globals.c \ | |
41 | ../src/fsw_spacewire.c |
|
45 | ../src/fsw_spacewire.c | |
42 |
|
46 | |||
43 | HEADERS += \ |
|
47 | HEADERS += \ | |
44 | ../header/wf_handler.h \ |
|
48 | ../header/wf_handler.h \ | |
45 | ../header/tc_handler.h \ |
|
49 | ../header/tc_handler.h \ | |
46 | ../header/grlib_regs.h \ |
|
50 | ../header/grlib_regs.h \ | |
47 | ../header/fsw_processing.h \ |
|
51 | ../header/fsw_processing.h \ | |
48 | ../header/fsw_params.h \ |
|
52 | ../header/fsw_params.h \ | |
49 | ../header/fsw_misc.h \ |
|
53 | ../header/fsw_misc.h \ | |
50 | ../header/fsw_init.h \ |
|
54 | ../header/fsw_init.h \ | |
51 | ../header/ccsds_types.h \ |
|
55 | ../header/ccsds_types.h \ | |
52 | ../header/fsw_params_processing.h \ |
|
56 | ../header/fsw_params_processing.h \ | |
53 | ../header/fsw_spacewire.h |
|
57 | ../header/fsw_spacewire.h | |
54 |
|
58 |
@@ -1,257 +1,257 | |||||
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 2.8.0, 2013-10-0 |
|
3 | <!-- Written by QtCreator 2.8.0, 2013-10-04T15:45:21. --> | |
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="QString" key="CurrentPreferences">CppGlobal</value> |
|
18 | <value type="QString" 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="QString" key="CurrentPreferences">QmlJSGlobal</value> |
|
24 | <value type="QString" 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">System</value> |
|
28 | <value type="QByteArray" key="EditorConfiguration.Codec">System</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 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|
61 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> | |
62 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
62 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> | |
63 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
63 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> | |
64 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> |
|
64 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> | |
65 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
65 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
66 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> |
|
66 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> | |
67 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> |
|
67 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> | |
68 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value> |
|
68 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value> | |
69 | <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> |
|
69 | <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> | |
70 | <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> |
|
70 | <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> | |
71 | </valuemap> |
|
71 | </valuemap> | |
72 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> |
|
72 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> | |
73 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
73 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> | |
74 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
74 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> | |
75 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
75 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
76 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
76 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> | |
77 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
77 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> | |
78 | <value type="QString">-w</value> |
|
78 | <value type="QString">-w</value> | |
79 | <value type="QString">-r</value> |
|
79 | <value type="QString">-r</value> | |
80 | </valuelist> |
|
80 | </valuelist> | |
81 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> |
|
81 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> | |
82 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w </value> |
|
82 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w </value> | |
83 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
83 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> | |
84 | </valuemap> |
|
84 | </valuemap> | |
85 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> |
|
85 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> | |
86 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> |
|
86 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> | |
87 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
87 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
88 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> |
|
88 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> | |
89 | </valuemap> |
|
89 | </valuemap> | |
90 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> |
|
90 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> | |
91 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
91 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> | |
92 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
92 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> | |
93 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
93 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> | |
94 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
94 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
95 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
95 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> | |
96 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
96 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> | |
97 | <value type="QString">-w</value> |
|
97 | <value type="QString">-w</value> | |
98 | <value type="QString">-r</value> |
|
98 | <value type="QString">-r</value> | |
99 | </valuelist> |
|
99 | </valuelist> | |
100 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> |
|
100 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> | |
101 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w clean</value> |
|
101 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w clean</value> | |
102 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
102 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> | |
103 | </valuemap> |
|
103 | </valuemap> | |
104 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> |
|
104 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> | |
105 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> |
|
105 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> | |
106 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
106 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
107 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> |
|
107 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> | |
108 | </valuemap> |
|
108 | </valuemap> | |
109 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> |
|
109 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> | |
110 | <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> |
|
110 | <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> | |
111 | <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> |
|
111 | <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> | |
112 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 4.8.2 in PATH (System) Release</value> |
|
112 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 4.8.2 in PATH (System) Release</value> | |
113 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
113 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
114 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> |
|
114 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> | |
115 | <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> |
|
115 | <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> | |
116 | <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/DEV_PLE/FSW-qt</value> |
|
116 | <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/DEV_PLE/FSW-qt</value> | |
117 | <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value> |
|
117 | <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value> | |
118 | </valuemap> |
|
118 | </valuemap> | |
119 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1"> |
|
119 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1"> | |
120 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|
120 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> | |
121 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
121 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> | |
122 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
122 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> | |
123 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> |
|
123 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</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">QtProjectManager.QMakeBuildStep</value> |
|
125 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> | |
126 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> |
|
126 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> | |
127 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value> |
|
127 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value> | |
128 | <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> |
|
128 | <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> | |
129 | <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> |
|
129 | <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> | |
130 | </valuemap> |
|
130 | </valuemap> | |
131 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> |
|
131 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> | |
132 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
132 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> | |
133 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
133 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> | |
134 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
134 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
135 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
135 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> | |
136 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
136 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> | |
137 | <value type="QString">-w</value> |
|
137 | <value type="QString">-w</value> | |
138 | <value type="QString">-r</value> |
|
138 | <value type="QString">-r</value> | |
139 | </valuelist> |
|
139 | </valuelist> | |
140 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> |
|
140 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> | |
141 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w </value> |
|
141 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w </value> | |
142 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
142 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> | |
143 | </valuemap> |
|
143 | </valuemap> | |
144 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> |
|
144 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> | |
145 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> |
|
145 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> | |
146 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
146 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
147 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> |
|
147 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> | |
148 | </valuemap> |
|
148 | </valuemap> | |
149 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> |
|
149 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> | |
150 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
150 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> | |
151 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
151 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> | |
152 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
152 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> | |
153 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
153 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
154 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
154 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> | |
155 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
155 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> | |
156 | <value type="QString">-w</value> |
|
156 | <value type="QString">-w</value> | |
157 | <value type="QString">-r</value> |
|
157 | <value type="QString">-r</value> | |
158 | </valuelist> |
|
158 | </valuelist> | |
159 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> |
|
159 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> | |
160 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w clean</value> |
|
160 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w clean</value> | |
161 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
161 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> | |
162 | </valuemap> |
|
162 | </valuemap> | |
163 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> |
|
163 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> | |
164 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> |
|
164 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> | |
165 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
165 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
166 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> |
|
166 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> | |
167 | </valuemap> |
|
167 | </valuemap> | |
168 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> |
|
168 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> | |
169 | <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> |
|
169 | <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> | |
170 | <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> |
|
170 | <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> | |
171 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 4.8.2 in PATH (System) Debug</value> |
|
171 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 4.8.2 in PATH (System) Debug</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.Qt4BuildConfiguration</value> |
|
173 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> | |
174 | <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value> |
|
174 | <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value> | |
175 | <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/DEV_PLE/FSW-qt</value> |
|
175 | <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/DEV_PLE/FSW-qt</value> | |
176 | <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value> |
|
176 | <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value> | |
177 | </valuemap> |
|
177 | </valuemap> | |
178 | <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value> |
|
178 | <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value> | |
179 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0"> |
|
179 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0"> | |
180 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|
180 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> | |
181 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value> |
|
181 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value> | |
182 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value> |
|
182 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value> | |
183 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
183 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
184 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value> |
|
184 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value> | |
185 | </valuemap> |
|
185 | </valuemap> | |
186 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value> |
|
186 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value> | |
187 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">No deployment</value> |
|
187 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">No deployment</value> | |
188 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
188 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
189 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value> |
|
189 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value> | |
190 | </valuemap> |
|
190 | </valuemap> | |
191 | <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> |
|
191 | <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> | |
192 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/> |
|
192 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/> | |
193 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> |
|
193 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> | |
194 | <value type="bool" key="Analyzer.Project.UseGlobal">true</value> |
|
194 | <value type="bool" key="Analyzer.Project.UseGlobal">true</value> | |
195 | <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> |
|
195 | <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> | |
196 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> |
|
196 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> | |
197 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> |
|
197 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> | |
198 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> |
|
198 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> | |
199 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> |
|
199 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> | |
200 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> |
|
200 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> | |
201 | <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> |
|
201 | <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> | |
202 | <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> |
|
202 | <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> | |
203 | <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> |
|
203 | <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> | |
204 | <value type="int" key="Analyzer.Valgrind.NumCallers">25</value> |
|
204 | <value type="int" key="Analyzer.Valgrind.NumCallers">25</value> | |
205 | <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> |
|
205 | <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> | |
206 | <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> |
|
206 | <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> | |
207 | <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> |
|
207 | <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> | |
208 | <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> |
|
208 | <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> | |
209 | <value type="int">0</value> |
|
209 | <value type="int">0</value> | |
210 | <value type="int">1</value> |
|
210 | <value type="int">1</value> | |
211 | <value type="int">2</value> |
|
211 | <value type="int">2</value> | |
212 | <value type="int">3</value> |
|
212 | <value type="int">3</value> | |
213 | <value type="int">4</value> |
|
213 | <value type="int">4</value> | |
214 | <value type="int">5</value> |
|
214 | <value type="int">5</value> | |
215 | <value type="int">6</value> |
|
215 | <value type="int">6</value> | |
216 | <value type="int">7</value> |
|
216 | <value type="int">7</value> | |
217 | <value type="int">8</value> |
|
217 | <value type="int">8</value> | |
218 | <value type="int">9</value> |
|
218 | <value type="int">9</value> | |
219 | <value type="int">10</value> |
|
219 | <value type="int">10</value> | |
220 | <value type="int">11</value> |
|
220 | <value type="int">11</value> | |
221 | <value type="int">12</value> |
|
221 | <value type="int">12</value> | |
222 | <value type="int">13</value> |
|
222 | <value type="int">13</value> | |
223 | <value type="int">14</value> |
|
223 | <value type="int">14</value> | |
224 | </valuelist> |
|
224 | </valuelist> | |
225 | <value type="int" key="PE.EnvironmentAspect.Base">2</value> |
|
225 | <value type="int" key="PE.EnvironmentAspect.Base">2</value> | |
226 | <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> |
|
226 | <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> | |
227 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value> |
|
227 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value> | |
228 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
228 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
229 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value> |
|
229 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value> | |
230 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value> |
|
230 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value> | |
231 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value> |
|
231 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value> | |
232 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value> |
|
232 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value> | |
233 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value> |
|
233 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value> | |
234 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value> |
|
234 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value> | |
235 | <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> |
|
235 | <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> | |
236 | <value type="bool" key="RunConfiguration.UseCppDebugger">true</value> |
|
236 | <value type="bool" key="RunConfiguration.UseCppDebugger">true</value> | |
237 | <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value> |
|
237 | <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value> | |
238 | <value type="bool" key="RunConfiguration.UseMultiProcess">false</value> |
|
238 | <value type="bool" key="RunConfiguration.UseMultiProcess">false</value> | |
239 | <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> |
|
239 | <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> | |
240 | <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">false</value> |
|
240 | <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">false</value> | |
241 | </valuemap> |
|
241 | </valuemap> | |
242 | <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value> |
|
242 | <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value> | |
243 | </valuemap> |
|
243 | </valuemap> | |
244 | </data> |
|
244 | </data> | |
245 | <data> |
|
245 | <data> | |
246 | <variable>ProjectExplorer.Project.TargetCount</variable> |
|
246 | <variable>ProjectExplorer.Project.TargetCount</variable> | |
247 | <value type="int">1</value> |
|
247 | <value type="int">1</value> | |
248 | </data> |
|
248 | </data> | |
249 | <data> |
|
249 | <data> | |
250 | <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable> |
|
250 | <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable> | |
251 | <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value> |
|
251 | <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value> | |
252 | </data> |
|
252 | </data> | |
253 | <data> |
|
253 | <data> | |
254 | <variable>ProjectExplorer.Project.Updater.FileVersion</variable> |
|
254 | <variable>ProjectExplorer.Project.Updater.FileVersion</variable> | |
255 | <value type="int">14</value> |
|
255 | <value type="int">14</value> | |
256 | </data> |
|
256 | </data> | |
257 | </qtcreator> |
|
257 | </qtcreator> |
@@ -1,508 +1,508 | |||||
1 | #ifndef CCSDS_H_INCLUDED |
|
1 | #ifndef CCSDS_H_INCLUDED | |
2 | #define CCSDS_H_INCLUDED |
|
2 | #define CCSDS_H_INCLUDED | |
3 |
|
3 | |||
4 | #define CCSDS_PROTOCOLE_EXTRA_BYTES 4 |
|
4 | #define CCSDS_PROTOCOLE_EXTRA_BYTES 4 | |
5 | #define CCSDS_TELEMETRY_HEADER_LENGTH 16+4 |
|
5 | #define CCSDS_TELEMETRY_HEADER_LENGTH 16+4 | |
6 | #define CCSDS_TM_PKT_MAX_SIZE 4412 |
|
6 | #define CCSDS_TM_PKT_MAX_SIZE 4412 | |
7 | #define CCSDS_TELECOMMAND_HEADER_LENGTH 10+4 |
|
7 | #define CCSDS_TELECOMMAND_HEADER_LENGTH 10+4 | |
8 | #define CCSDS_TC_PKT_MAX_SIZE 256 |
|
8 | #define CCSDS_TC_PKT_MAX_SIZE 256 | |
9 | #define CCSDS_TC_PKT_MIN_SIZE 16 |
|
9 | #define CCSDS_TC_PKT_MIN_SIZE 16 | |
10 | #define CCSDS_TC_TM_PACKET_OFFSET 7 |
|
10 | #define CCSDS_TC_TM_PACKET_OFFSET 7 | |
11 | #define CCSDS_PROCESS_ID 76 |
|
11 | #define CCSDS_PROCESS_ID 76 | |
12 | #define CCSDS_PACKET_CATEGORY 12 |
|
12 | #define CCSDS_PACKET_CATEGORY 12 | |
13 | #define CCSDS_NODE_ADDRESS 0xfe |
|
13 | #define CCSDS_NODE_ADDRESS 0xfe | |
14 | #define CCSDS_USER_APP 0x00 |
|
14 | #define CCSDS_USER_APP 0x00 | |
15 |
|
15 | |||
16 | #define DEFAULT_SPARE1_PUSVERSION_SPARE2 0x10 |
|
16 | #define DEFAULT_SPARE1_PUSVERSION_SPARE2 0x10 | |
17 | #define DEFAULT_RESERVED 0x00 |
|
17 | #define DEFAULT_RESERVED 0x00 | |
18 |
#define DEFAULT_HKBIA 0x1 |
|
18 | #define DEFAULT_HKBIA 0x1e // 0001 1110 | |
19 |
|
19 | |||
20 | // PACKET ID |
|
20 | // PACKET ID | |
21 | #define TM_PACKET_ID_TC_EXE 0x0cc1 // PID 76 CAT 1 |
|
21 | #define TM_PACKET_ID_TC_EXE 0x0cc1 // PID 76 CAT 1 | |
22 | #define TM_PACKET_ID_HK 0x0cc4 // PID 76 CAT 4 |
|
22 | #define TM_PACKET_ID_HK 0x0cc4 // PID 76 CAT 4 | |
23 | #define TM_PACKET_ID_PARAMETER_DUMP 0x0cc9 // PID 76 CAT 9 |
|
23 | #define TM_PACKET_ID_PARAMETER_DUMP 0x0cc9 // PID 76 CAT 9 | |
24 |
#define TM_PACKET_ID_SCIENCE_NORMAL |
|
24 | #define TM_PACKET_ID_SCIENCE_NORMAL_BURST 0x0ccc // PID 76 CAT 12 | |
25 |
#define TM_PACKET_ID_SCIENCE_ |
|
25 | #define TM_PACKET_ID_SCIENCE_SBM1_SBM2 0x0cfc // PID 79 CAT 12 | |
26 | #define TM_PACKET_PID_DEFAULT 76 |
|
26 | #define TM_PACKET_PID_DEFAULT 76 | |
27 | #define TM_PACKET_PID_BURST_SBM1_SBM2 79 |
|
27 | #define TM_PACKET_PID_BURST_SBM1_SBM2 79 | |
28 | #define TM_PACKET_CAT_TC_EXE 1 |
|
28 | #define TM_PACKET_CAT_TC_EXE 1 | |
29 | #define TM_PACKET_CAT_HK 4 |
|
29 | #define TM_PACKET_CAT_HK 4 | |
30 | #define TM_PACKET_CAT_PARAMETER_DUMP 9 |
|
30 | #define TM_PACKET_CAT_PARAMETER_DUMP 9 | |
31 | #define TM_PACKET_CAT_SCIENCE 12 |
|
31 | #define TM_PACKET_CAT_SCIENCE 12 | |
32 |
|
32 | |||
33 | // PACKET SEQUENCE CONTROL |
|
33 | // PACKET SEQUENCE CONTROL | |
34 | #define TM_PACKET_SEQ_CTRL_CONTINUATION 0x00 // [0000 0000] |
|
34 | #define TM_PACKET_SEQ_CTRL_CONTINUATION 0x00 // [0000 0000] | |
35 | #define TM_PACKET_SEQ_CTRL_FIRST 0x40 // [0100 0000] |
|
35 | #define TM_PACKET_SEQ_CTRL_FIRST 0x40 // [0100 0000] | |
36 | #define TM_PACKET_SEQ_CTRL_LAST 0x80 // [1000 0000] |
|
36 | #define TM_PACKET_SEQ_CTRL_LAST 0x80 // [1000 0000] | |
37 | #define TM_PACKET_SEQ_CTRL_STANDALONE 0xc0 // [1100 0000] |
|
37 | #define TM_PACKET_SEQ_CTRL_STANDALONE 0xc0 // [1100 0000] | |
38 | #define TM_PACKET_SEQ_CNT_DEFAULT 0x00 // [0000 0000] |
|
38 | #define TM_PACKET_SEQ_CNT_DEFAULT 0x00 // [0000 0000] | |
39 |
|
39 | |||
40 | // DESTINATION ID |
|
40 | // DESTINATION ID | |
41 | #define TM_DESTINATION_ID_GROUND 0 |
|
41 | #define TM_DESTINATION_ID_GROUND 0 | |
42 | #define TM_DESTINATION_ID_MISSION_TIMELINE 110 |
|
42 | #define TM_DESTINATION_ID_MISSION_TIMELINE 110 | |
43 | #define TM_DESTINATION_ID_TC_SEQUENCES 111 |
|
43 | #define TM_DESTINATION_ID_TC_SEQUENCES 111 | |
44 | #define TM_DESTINATION_ID_RECOVERY_ACTION_COMMAND 112 |
|
44 | #define TM_DESTINATION_ID_RECOVERY_ACTION_COMMAND 112 | |
45 | #define TM_DESTINATION_ID_BACKUP_MISSION_TIMELINE 113 |
|
45 | #define TM_DESTINATION_ID_BACKUP_MISSION_TIMELINE 113 | |
46 | #define TM_DESTINATION_ID_DIRECT_CMD 120 |
|
46 | #define TM_DESTINATION_ID_DIRECT_CMD 120 | |
47 | #define TM_DESTINATION_ID_SPARE_GRD_SRC1 121 |
|
47 | #define TM_DESTINATION_ID_SPARE_GRD_SRC1 121 | |
48 | #define TM_DESTINATION_ID_SPARE_GRD_SRC2 122 |
|
48 | #define TM_DESTINATION_ID_SPARE_GRD_SRC2 122 | |
49 | #define TM_DESTINATION_ID_OBCP 15 |
|
49 | #define TM_DESTINATION_ID_OBCP 15 | |
50 | #define TM_DESTINATION_ID_SYSTEM_CONTROL 14 |
|
50 | #define TM_DESTINATION_ID_SYSTEM_CONTROL 14 | |
51 | #define TM_DESTINATION_ID_AOCS 11 |
|
51 | #define TM_DESTINATION_ID_AOCS 11 | |
52 |
|
52 | |||
53 | #define CCSDS_DESTINATION_ID 0x01 |
|
53 | #define CCSDS_DESTINATION_ID 0x01 | |
54 | #define CCSDS_PROTOCOLE_ID 0x02 |
|
54 | #define CCSDS_PROTOCOLE_ID 0x02 | |
55 | #define CCSDS_RESERVED 0x00 |
|
55 | #define CCSDS_RESERVED 0x00 | |
56 | #define CCSDS_USER_APP 0x00 |
|
56 | #define CCSDS_USER_APP 0x00 | |
57 |
|
57 | |||
58 | #define SIZE_TM_LFR_TC_EXE_NOT_IMPLEMENTED 24 |
|
58 | #define SIZE_TM_LFR_TC_EXE_NOT_IMPLEMENTED 24 | |
59 | #define SIZE_TM_LFR_TC_EXE_CORRUPTED 32 |
|
59 | #define SIZE_TM_LFR_TC_EXE_CORRUPTED 32 | |
60 | #define SIZE_HK_PARAMETERS 112 |
|
60 | #define SIZE_HK_PARAMETERS 112 | |
61 |
|
61 | |||
62 | // TC TYPES |
|
62 | // TC TYPES | |
63 | #define TC_TYPE_GEN 181 |
|
63 | #define TC_TYPE_GEN 181 | |
64 | #define TC_TYPE_TIME 9 |
|
64 | #define TC_TYPE_TIME 9 | |
65 |
|
65 | |||
66 | // TC SUBTYPES |
|
66 | // TC SUBTYPES | |
67 | #define TC_SUBTYPE_RESET 1 |
|
67 | #define TC_SUBTYPE_RESET 1 | |
68 | #define TC_SUBTYPE_LOAD_COMM 11 |
|
68 | #define TC_SUBTYPE_LOAD_COMM 11 | |
69 | #define TC_SUBTYPE_LOAD_NORM 13 |
|
69 | #define TC_SUBTYPE_LOAD_NORM 13 | |
70 | #define TC_SUBTYPE_LOAD_BURST 19 |
|
70 | #define TC_SUBTYPE_LOAD_BURST 19 | |
71 | #define TC_SUBTYPE_LOAD_SBM1 25 |
|
71 | #define TC_SUBTYPE_LOAD_SBM1 25 | |
72 | #define TC_SUBTYPE_LOAD_SBM2 27 |
|
72 | #define TC_SUBTYPE_LOAD_SBM2 27 | |
73 | #define TC_SUBTYPE_DUMP 31 |
|
73 | #define TC_SUBTYPE_DUMP 31 | |
74 | #define TC_SUBTYPE_ENTER 41 |
|
74 | #define TC_SUBTYPE_ENTER 41 | |
75 | #define TC_SUBTYPE_UPDT_INFO 51 |
|
75 | #define TC_SUBTYPE_UPDT_INFO 51 | |
76 | #define TC_SUBTYPE_EN_CAL 61 |
|
76 | #define TC_SUBTYPE_EN_CAL 61 | |
77 | #define TC_SUBTYPE_DIS_CAL 63 |
|
77 | #define TC_SUBTYPE_DIS_CAL 63 | |
78 | #define TC_SUBTYPE_UPDT_TIME 129 |
|
78 | #define TC_SUBTYPE_UPDT_TIME 129 | |
79 |
|
79 | |||
80 | // TC LEN |
|
80 | // TC LEN | |
81 | #define TC_LEN_RESET 12 |
|
81 | #define TC_LEN_RESET 12 | |
82 | #define TC_LEN_LOAD_COMM 14 |
|
82 | #define TC_LEN_LOAD_COMM 14 | |
83 | #define TC_LEN_LOAD_NORM 20 |
|
83 | #define TC_LEN_LOAD_NORM 20 | |
84 | #define TC_LEN_LOAD_BURST 14 |
|
84 | #define TC_LEN_LOAD_BURST 14 | |
85 | #define TC_LEN_LOAD_SBM1 14 |
|
85 | #define TC_LEN_LOAD_SBM1 14 | |
86 | #define TC_LEN_LOAD_SBM2 14 |
|
86 | #define TC_LEN_LOAD_SBM2 14 | |
87 | #define TC_LEN_DUMP 12 |
|
87 | #define TC_LEN_DUMP 12 | |
88 | #define TC_LEN_ENTER 20 |
|
88 | #define TC_LEN_ENTER 20 | |
89 | #define TC_LEN_UPDT_INFO 48 |
|
89 | #define TC_LEN_UPDT_INFO 48 | |
90 | #define TC_LEN_EN_CAL 12 |
|
90 | #define TC_LEN_EN_CAL 12 | |
91 | #define TC_LEN_DIS_CAL 12 |
|
91 | #define TC_LEN_DIS_CAL 12 | |
92 | #define TC_LEN_UPDT_TIME 18 |
|
92 | #define TC_LEN_UPDT_TIME 18 | |
93 |
|
93 | |||
94 | // TM TYPES |
|
94 | // TM TYPES | |
95 | #define TM_TYPE_TC_EXE 1 |
|
95 | #define TM_TYPE_TC_EXE 1 | |
96 | #define TM_TYPE_HK 3 |
|
96 | #define TM_TYPE_HK 3 | |
97 | #define TM_TYPE_PARAMETER_DUMP 3 |
|
97 | #define TM_TYPE_PARAMETER_DUMP 3 | |
98 | #define TM_TYPE_LFR_SCIENCE 21 |
|
98 | #define TM_TYPE_LFR_SCIENCE 21 | |
99 |
|
99 | |||
100 | // TM SUBTYPES |
|
100 | // TM SUBTYPES | |
101 | #define TM_SUBTYPE_EXE_OK 7 |
|
101 | #define TM_SUBTYPE_EXE_OK 7 | |
102 | #define TM_SUBTYPE_EXE_NOK 8 |
|
102 | #define TM_SUBTYPE_EXE_NOK 8 | |
103 | #define TM_SUBTYPE_HK 25 |
|
103 | #define TM_SUBTYPE_HK 25 | |
104 | #define TM_SUBTYPE_PARAMETER_DUMP 25 |
|
104 | #define TM_SUBTYPE_PARAMETER_DUMP 25 | |
105 | #define TM_SUBTYPE_SCIENCE 3 |
|
105 | #define TM_SUBTYPE_SCIENCE 3 | |
106 | #define TM_SUBTYPE_LFR_SCIENCE 3 |
|
106 | #define TM_SUBTYPE_LFR_SCIENCE 3 | |
107 |
|
107 | |||
108 | // FAILURE CODES |
|
108 | // FAILURE CODES | |
109 | #define ILLEGAL_APID 0 |
|
109 | #define ILLEGAL_APID 0 | |
110 | #define WRONG_LEN_PACKET 1 |
|
110 | #define WRONG_LEN_PACKET 1 | |
111 | #define INCOR_CHECKSUM 2 |
|
111 | #define INCOR_CHECKSUM 2 | |
112 | #define ILL_TYPE 3 |
|
112 | #define ILL_TYPE 3 | |
113 | #define ILL_SUBTYPE 4 |
|
113 | #define ILL_SUBTYPE 4 | |
114 | #define WRONG_APP_DATA 5 |
|
114 | #define WRONG_APP_DATA 5 | |
115 | // |
|
115 | // | |
116 | #define WRONG_CMD_CODE 6 |
|
116 | #define WRONG_CMD_CODE 6 | |
117 | #define CCSDS_TM_VALID 7 |
|
117 | #define CCSDS_TM_VALID 7 | |
118 | #define FAILURE_CODE_INCONSISTENT 5 // 0x00 0x05 |
|
118 | #define FAILURE_CODE_INCONSISTENT 5 // 0x00 0x05 | |
119 | #define FAILURE_CODE_NOT_EXECUTABLE 42000 // 0xa4 0x10 |
|
119 | #define FAILURE_CODE_NOT_EXECUTABLE 42000 // 0xa4 0x10 | |
120 | #define FAILURE_CODE_NOT_IMPLEMENTED 42002 // 0xa4 0x12 |
|
120 | #define FAILURE_CODE_NOT_IMPLEMENTED 42002 // 0xa4 0x12 | |
121 | #define FAILURE_CODE_ERROR 42003 // 0xa4 0x13 |
|
121 | #define FAILURE_CODE_ERROR 42003 // 0xa4 0x13 | |
122 | #define FAILURE_CODE_CORRUPTED 42005 // 0xa4 0x15 |
|
122 | #define FAILURE_CODE_CORRUPTED 42005 // 0xa4 0x15 | |
123 |
|
123 | |||
124 | // TM SID |
|
124 | // TM SID | |
125 | #define SID_DEFAULT 0 |
|
125 | #define SID_DEFAULT 0 | |
126 | #define SID_EXE_INC 5 |
|
126 | #define SID_EXE_INC 5 | |
127 | #define SID_NOT_EXE 42000 // 0xa4 0x10 |
|
127 | #define SID_NOT_EXE 42000 // 0xa4 0x10 | |
128 | #define SID_NOT_IMP 42002 // 0xa4 0x12 |
|
128 | #define SID_NOT_IMP 42002 // 0xa4 0x12 | |
129 | #define SID_EXE_ERR 42003 // 0xa4 0x13 |
|
129 | #define SID_EXE_ERR 42003 // 0xa4 0x13 | |
130 | #define SID_EXE_CORR 42005 // 0xa4 0x15 |
|
130 | #define SID_EXE_CORR 42005 // 0xa4 0x15 | |
131 | #define SID_HK 1 |
|
131 | #define SID_HK 1 | |
132 | #define SID_PARAMETER_DUMP 10 |
|
132 | #define SID_PARAMETER_DUMP 10 | |
133 |
|
133 | |||
134 | #define SID_NORM_SWF_F0 3 |
|
134 | #define SID_NORM_SWF_F0 3 | |
135 | #define SID_NORM_SWF_F1 4 |
|
135 | #define SID_NORM_SWF_F1 4 | |
136 | #define SID_NORM_SWF_F2 5 |
|
136 | #define SID_NORM_SWF_F2 5 | |
137 | #define SID_NORM_CWF_F3 1 |
|
137 | #define SID_NORM_CWF_F3 1 | |
138 | #define SID_BURST_CWF_F2 2 |
|
138 | #define SID_BURST_CWF_F2 2 | |
139 | #define SID_SBM1_CWF_F1 24 |
|
139 | #define SID_SBM1_CWF_F1 24 | |
140 | #define SID_SBM2_CWF_F2 25 |
|
140 | #define SID_SBM2_CWF_F2 25 | |
141 | #define SID_NORM_ASM_F0 11 |
|
141 | #define SID_NORM_ASM_F0 11 | |
142 | #define SID_NORM_ASM_F1 12 |
|
142 | #define SID_NORM_ASM_F1 12 | |
143 | #define SID_NORM_ASM_F2 13 |
|
143 | #define SID_NORM_ASM_F2 13 | |
144 | #define SID_NORM_BP1_F0 14 |
|
144 | #define SID_NORM_BP1_F0 14 | |
145 | #define SID_NORM_BP1_F1 15 |
|
145 | #define SID_NORM_BP1_F1 15 | |
146 | #define SID_NORM_BP1_F2 16 |
|
146 | #define SID_NORM_BP1_F2 16 | |
147 | #define SID_NORM_BP2_F0 19 |
|
147 | #define SID_NORM_BP2_F0 19 | |
148 | #define SID_NORM_BP2_F1 20 |
|
148 | #define SID_NORM_BP2_F1 20 | |
149 | #define SID_NORM_BP2_F2 21 |
|
149 | #define SID_NORM_BP2_F2 21 | |
150 | #define SID_BURST_BP1_F0 17 |
|
150 | #define SID_BURST_BP1_F0 17 | |
151 | #define SID_BURST_BP2_F0 22 |
|
151 | #define SID_BURST_BP2_F0 22 | |
152 | #define SID_BURST_BP1_F1 18 |
|
152 | #define SID_BURST_BP1_F1 18 | |
153 | #define SID_BURST_BP2_F1 23 |
|
153 | #define SID_BURST_BP2_F1 23 | |
154 | #define SID_SBM1_BP1_F0 28 |
|
154 | #define SID_SBM1_BP1_F0 28 | |
155 | #define SID_SBM1_BP2_F0 31 |
|
155 | #define SID_SBM1_BP2_F0 31 | |
156 | #define SID_SBM2_BP1_F0 29 |
|
156 | #define SID_SBM2_BP1_F0 29 | |
157 | #define SID_SBM2_BP2_F0 32 |
|
157 | #define SID_SBM2_BP2_F0 32 | |
158 | #define SID_SBM2_BP1_F1 30 |
|
158 | #define SID_SBM2_BP1_F1 30 | |
159 | #define SID_SBM2_BP2_F1 33 |
|
159 | #define SID_SBM2_BP2_F1 33 | |
160 |
|
160 | |||
161 | // LENGTH (BYTES) |
|
161 | // LENGTH (BYTES) | |
162 | #define LENGTH_TM_LFR_TC_EXE_MAX 32 |
|
162 | #define LENGTH_TM_LFR_TC_EXE_MAX 32 | |
163 | #define LENGTH_TM_LFR_HK 126 |
|
163 | #define LENGTH_TM_LFR_HK 126 | |
164 |
|
164 | |||
165 | // HEADER_LENGTH |
|
165 | // HEADER_LENGTH | |
166 | #define TM_HEADER_LEN 16 |
|
166 | #define TM_HEADER_LEN 16 | |
167 | #define HEADER_LENGTH_TM_LFR_SCIENCE_ASM 28 |
|
167 | #define HEADER_LENGTH_TM_LFR_SCIENCE_ASM 28 | |
168 | // PACKET_LENGTH |
|
168 | // PACKET_LENGTH | |
169 | #define PACKET_LENGTH_TC_EXE_SUCCESS (20 - CCSDS_TC_TM_PACKET_OFFSET) |
|
169 | #define PACKET_LENGTH_TC_EXE_SUCCESS (20 - CCSDS_TC_TM_PACKET_OFFSET) | |
170 | #define PACKET_LENGTH_TC_EXE_INCONSISTENT (26 - CCSDS_TC_TM_PACKET_OFFSET) |
|
170 | #define PACKET_LENGTH_TC_EXE_INCONSISTENT (26 - CCSDS_TC_TM_PACKET_OFFSET) | |
171 | #define PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE (26 - CCSDS_TC_TM_PACKET_OFFSET) |
|
171 | #define PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE (26 - CCSDS_TC_TM_PACKET_OFFSET) | |
172 | #define PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED (24 - CCSDS_TC_TM_PACKET_OFFSET) |
|
172 | #define PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED (24 - CCSDS_TC_TM_PACKET_OFFSET) | |
173 | #define PACKET_LENGTH_TC_EXE_ERROR (24 - CCSDS_TC_TM_PACKET_OFFSET) |
|
173 | #define PACKET_LENGTH_TC_EXE_ERROR (24 - CCSDS_TC_TM_PACKET_OFFSET) | |
174 | #define PACKET_LENGTH_TC_EXE_CORRUPTED (32 - CCSDS_TC_TM_PACKET_OFFSET) |
|
174 | #define PACKET_LENGTH_TC_EXE_CORRUPTED (32 - CCSDS_TC_TM_PACKET_OFFSET) | |
175 | #define PACKET_LENGTH_HK (126 - CCSDS_TC_TM_PACKET_OFFSET) |
|
175 | #define PACKET_LENGTH_HK (126 - CCSDS_TC_TM_PACKET_OFFSET) | |
176 | #define PACKET_LENGTH_PARAMETER_DUMP (34 - CCSDS_TC_TM_PACKET_OFFSET) |
|
176 | #define PACKET_LENGTH_PARAMETER_DUMP (34 - CCSDS_TC_TM_PACKET_OFFSET) | |
177 | #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM (TOTAL_SIZE_SM + HEADER_LENGTH_TM_LFR_SCIENCE_ASM - CCSDS_TC_TM_PACKET_OFFSET) |
|
177 | #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM (TOTAL_SIZE_SM + HEADER_LENGTH_TM_LFR_SCIENCE_ASM - CCSDS_TC_TM_PACKET_OFFSET) | |
178 |
|
178 | |||
179 | #define SPARE1_PUSVERSION_SPARE2 0x10 |
|
179 | #define SPARE1_PUSVERSION_SPARE2 0x10 | |
180 |
|
180 | |||
181 | #define LEN_TM_LFR_HK 126 + 4 |
|
181 | #define LEN_TM_LFR_HK 126 + 4 | |
182 | #define LEN_TM_LFR_TC_EXE_NOT_IMP 24 +4 |
|
182 | #define LEN_TM_LFR_TC_EXE_NOT_IMP 24 +4 | |
183 |
|
183 | |||
184 | #define TM_LEN_SCI_SWF_340 (340 * 12 + 10 + 12 - 1) |
|
184 | #define TM_LEN_SCI_SWF_340 (340 * 12 + 10 + 12 - 1) | |
185 | #define TM_LEN_SCI_SWF_8 (8 * 12 + 10 + 12 - 1) |
|
185 | #define TM_LEN_SCI_SWF_8 (8 * 12 + 10 + 12 - 1) | |
186 | #define TM_LEN_SCI_CWF_340 (340 * 12 + 10 + 10 - 1) |
|
186 | #define TM_LEN_SCI_CWF_340 (340 * 12 + 10 + 10 - 1) | |
187 | #define TM_LEN_SCI_CWF_8 (8 * 12 + 10 + 10 - 1) |
|
187 | #define TM_LEN_SCI_CWF_8 (8 * 12 + 10 + 10 - 1) | |
188 | #define DEFAULT_PKTCNT 0x07 |
|
188 | #define DEFAULT_PKTCNT 0x07 | |
189 | #define BLK_NR_340 0x0154 |
|
189 | #define BLK_NR_340 0x0154 | |
190 | #define BLK_NR_8 0x0008 |
|
190 | #define BLK_NR_8 0x0008 | |
191 |
|
191 | |||
192 | enum TM_TYPE{ |
|
192 | enum TM_TYPE{ | |
193 | TM_LFR_TC_EXE_OK, |
|
193 | TM_LFR_TC_EXE_OK, | |
194 | TM_LFR_TC_EXE_ERR, |
|
194 | TM_LFR_TC_EXE_ERR, | |
195 | TM_LFR_HK, |
|
195 | TM_LFR_HK, | |
196 | TM_LFR_SCI, |
|
196 | TM_LFR_SCI, | |
197 | TM_LFR_SCI_SBM, |
|
197 | TM_LFR_SCI_SBM, | |
198 | TM_LFR_PAR_DUMP |
|
198 | TM_LFR_PAR_DUMP | |
199 | }; |
|
199 | }; | |
200 |
|
200 | |||
201 | struct TMHeader_str |
|
201 | struct TMHeader_str | |
202 | { |
|
202 | { | |
203 | volatile unsigned char targetLogicalAddress; |
|
203 | volatile unsigned char targetLogicalAddress; | |
204 | volatile unsigned char protocolIdentifier; |
|
204 | volatile unsigned char protocolIdentifier; | |
205 | volatile unsigned char reserved; |
|
205 | volatile unsigned char reserved; | |
206 | volatile unsigned char userApplication; |
|
206 | volatile unsigned char userApplication; | |
207 | volatile unsigned char packetID[2]; |
|
207 | volatile unsigned char packetID[2]; | |
208 | volatile unsigned char packetSequenceControl[2]; |
|
208 | volatile unsigned char packetSequenceControl[2]; | |
209 | volatile unsigned char packetLength[2]; |
|
209 | volatile unsigned char packetLength[2]; | |
210 | // DATA FIELD HEADER |
|
210 | // DATA FIELD HEADER | |
211 | volatile unsigned char spare1_pusVersion_spare2; |
|
211 | volatile unsigned char spare1_pusVersion_spare2; | |
212 | volatile unsigned char serviceType; |
|
212 | volatile unsigned char serviceType; | |
213 | volatile unsigned char serviceSubType; |
|
213 | volatile unsigned char serviceSubType; | |
214 | volatile unsigned char destinationID; |
|
214 | volatile unsigned char destinationID; | |
215 | volatile unsigned char time[6]; |
|
215 | volatile unsigned char time[6]; | |
216 | }; |
|
216 | }; | |
217 | typedef struct TMHeader_str TMHeader_t; |
|
217 | typedef struct TMHeader_str TMHeader_t; | |
218 |
|
218 | |||
219 | struct Packet_TM_LFR_TC_EXE_str |
|
219 | struct Packet_TM_LFR_TC_EXE_str | |
220 | { |
|
220 | { | |
221 | volatile unsigned char targetLogicalAddress; |
|
221 | volatile unsigned char targetLogicalAddress; | |
222 | volatile unsigned char protocolIdentifier; |
|
222 | volatile unsigned char protocolIdentifier; | |
223 | volatile unsigned char reserved; |
|
223 | volatile unsigned char reserved; | |
224 | volatile unsigned char userApplication; |
|
224 | volatile unsigned char userApplication; | |
225 | volatile unsigned char packetID[2]; |
|
225 | volatile unsigned char packetID[2]; | |
226 | volatile unsigned char packetSequenceControl[2]; |
|
226 | volatile unsigned char packetSequenceControl[2]; | |
227 | volatile unsigned char packetLength[2]; |
|
227 | volatile unsigned char packetLength[2]; | |
228 | // DATA FIELD HEADER |
|
228 | // DATA FIELD HEADER | |
229 | volatile unsigned char spare1_pusVersion_spare2; |
|
229 | volatile unsigned char spare1_pusVersion_spare2; | |
230 | volatile unsigned char serviceType; |
|
230 | volatile unsigned char serviceType; | |
231 | volatile unsigned char serviceSubType; |
|
231 | volatile unsigned char serviceSubType; | |
232 | volatile unsigned char destinationID; |
|
232 | volatile unsigned char destinationID; | |
233 | volatile unsigned char time[6]; |
|
233 | volatile unsigned char time[6]; | |
234 | volatile unsigned char data[LENGTH_TM_LFR_TC_EXE_MAX - 10 + 1]; |
|
234 | volatile unsigned char data[LENGTH_TM_LFR_TC_EXE_MAX - 10 + 1]; | |
235 | }; |
|
235 | }; | |
236 | typedef struct Packet_TM_LFR_TC_EXE_str Packet_TM_LFR_TC_EXE_t; |
|
236 | typedef struct Packet_TM_LFR_TC_EXE_str Packet_TM_LFR_TC_EXE_t; | |
237 |
|
237 | |||
238 | struct Packet_TM_LFR_TC_EXE_CORRUPTED_str |
|
238 | struct Packet_TM_LFR_TC_EXE_CORRUPTED_str | |
239 | { |
|
239 | { | |
240 | volatile unsigned char targetLogicalAddress; |
|
240 | volatile unsigned char targetLogicalAddress; | |
241 | volatile unsigned char protocolIdentifier; |
|
241 | volatile unsigned char protocolIdentifier; | |
242 | volatile unsigned char reserved; |
|
242 | volatile unsigned char reserved; | |
243 | volatile unsigned char userApplication; |
|
243 | volatile unsigned char userApplication; | |
244 | // PACKET HEADER |
|
244 | // PACKET HEADER | |
245 | volatile unsigned char packetID[2]; |
|
245 | volatile unsigned char packetID[2]; | |
246 | volatile unsigned char packetSequenceControl[2]; |
|
246 | volatile unsigned char packetSequenceControl[2]; | |
247 | volatile unsigned char packetLength[2]; |
|
247 | volatile unsigned char packetLength[2]; | |
248 | // DATA FIELD HEADER |
|
248 | // DATA FIELD HEADER | |
249 | volatile unsigned char spare1_pusVersion_spare2; |
|
249 | volatile unsigned char spare1_pusVersion_spare2; | |
250 | volatile unsigned char serviceType; |
|
250 | volatile unsigned char serviceType; | |
251 | volatile unsigned char serviceSubType; |
|
251 | volatile unsigned char serviceSubType; | |
252 | volatile unsigned char destinationID; |
|
252 | volatile unsigned char destinationID; | |
253 | volatile unsigned char time[6]; |
|
253 | volatile unsigned char time[6]; | |
254 | // |
|
254 | // | |
255 | volatile unsigned char tc_failure_code[2]; |
|
255 | volatile unsigned char tc_failure_code[2]; | |
256 | volatile unsigned char telecommand_pkt_id[2]; |
|
256 | volatile unsigned char telecommand_pkt_id[2]; | |
257 | volatile unsigned char pkt_seq_control[2]; |
|
257 | volatile unsigned char pkt_seq_control[2]; | |
258 | volatile unsigned char tc_service; |
|
258 | volatile unsigned char tc_service; | |
259 | volatile unsigned char tc_subtype; |
|
259 | volatile unsigned char tc_subtype; | |
260 | volatile unsigned char pkt_len_rcv_value[2]; |
|
260 | volatile unsigned char pkt_len_rcv_value[2]; | |
261 | volatile unsigned char pkt_datafieldsize_cnt[2]; |
|
261 | volatile unsigned char pkt_datafieldsize_cnt[2]; | |
262 | volatile unsigned char rcv_crc[2]; |
|
262 | volatile unsigned char rcv_crc[2]; | |
263 | volatile unsigned char computed_crc[2]; |
|
263 | volatile unsigned char computed_crc[2]; | |
264 | }; |
|
264 | }; | |
265 | typedef struct Packet_TM_LFR_TC_EXE_CORRUPTED_str Packet_TM_LFR_TC_EXE_CORRUPTED_t; |
|
265 | typedef struct Packet_TM_LFR_TC_EXE_CORRUPTED_str Packet_TM_LFR_TC_EXE_CORRUPTED_t; | |
266 |
|
266 | |||
267 | struct Header_TM_LFR_SCIENCE_SWF_str |
|
267 | struct Header_TM_LFR_SCIENCE_SWF_str | |
268 | { |
|
268 | { | |
269 | volatile unsigned char targetLogicalAddress; |
|
269 | volatile unsigned char targetLogicalAddress; | |
270 | volatile unsigned char protocolIdentifier; |
|
270 | volatile unsigned char protocolIdentifier; | |
271 | volatile unsigned char reserved; |
|
271 | volatile unsigned char reserved; | |
272 | volatile unsigned char userApplication; |
|
272 | volatile unsigned char userApplication; | |
273 | volatile unsigned char packetID[2]; |
|
273 | volatile unsigned char packetID[2]; | |
274 | volatile unsigned char packetSequenceControl[2]; |
|
274 | volatile unsigned char packetSequenceControl[2]; | |
275 | volatile unsigned char packetLength[2]; |
|
275 | volatile unsigned char packetLength[2]; | |
276 | // DATA FIELD HEADER |
|
276 | // DATA FIELD HEADER | |
277 | volatile unsigned char spare1_pusVersion_spare2; |
|
277 | volatile unsigned char spare1_pusVersion_spare2; | |
278 | volatile unsigned char serviceType; |
|
278 | volatile unsigned char serviceType; | |
279 | volatile unsigned char serviceSubType; |
|
279 | volatile unsigned char serviceSubType; | |
280 | volatile unsigned char destinationID; |
|
280 | volatile unsigned char destinationID; | |
281 | volatile unsigned char time[6]; |
|
281 | volatile unsigned char time[6]; | |
282 | // AUXILIARY HEADER |
|
282 | // AUXILIARY HEADER | |
283 | volatile unsigned char sid; |
|
283 | volatile unsigned char sid; | |
284 | volatile unsigned char hkBIA; |
|
284 | volatile unsigned char hkBIA; | |
285 | volatile unsigned char pktCnt; |
|
285 | volatile unsigned char pktCnt; | |
286 | volatile unsigned char pktNr; |
|
286 | volatile unsigned char pktNr; | |
287 | volatile unsigned char acquisitionTime[6]; |
|
287 | volatile unsigned char acquisitionTime[6]; | |
288 | volatile unsigned char blkNr[2]; |
|
288 | volatile unsigned char blkNr[2]; | |
289 | }; |
|
289 | }; | |
290 | typedef struct Header_TM_LFR_SCIENCE_SWF_str Header_TM_LFR_SCIENCE_SWF_t; |
|
290 | typedef struct Header_TM_LFR_SCIENCE_SWF_str Header_TM_LFR_SCIENCE_SWF_t; | |
291 |
|
291 | |||
292 | struct Header_TM_LFR_SCIENCE_CWF_str |
|
292 | struct Header_TM_LFR_SCIENCE_CWF_str | |
293 | { |
|
293 | { | |
294 | volatile unsigned char targetLogicalAddress; |
|
294 | volatile unsigned char targetLogicalAddress; | |
295 | volatile unsigned char protocolIdentifier; |
|
295 | volatile unsigned char protocolIdentifier; | |
296 | volatile unsigned char reserved; |
|
296 | volatile unsigned char reserved; | |
297 | volatile unsigned char userApplication; |
|
297 | volatile unsigned char userApplication; | |
298 | volatile unsigned char packetID[2]; |
|
298 | volatile unsigned char packetID[2]; | |
299 | volatile unsigned char packetSequenceControl[2]; |
|
299 | volatile unsigned char packetSequenceControl[2]; | |
300 | volatile unsigned char packetLength[2]; |
|
300 | volatile unsigned char packetLength[2]; | |
301 | // DATA FIELD HEADER |
|
301 | // DATA FIELD HEADER | |
302 | volatile unsigned char spare1_pusVersion_spare2; |
|
302 | volatile unsigned char spare1_pusVersion_spare2; | |
303 | volatile unsigned char serviceType; |
|
303 | volatile unsigned char serviceType; | |
304 | volatile unsigned char serviceSubType; |
|
304 | volatile unsigned char serviceSubType; | |
305 | volatile unsigned char destinationID; |
|
305 | volatile unsigned char destinationID; | |
306 | volatile unsigned char time[6]; |
|
306 | volatile unsigned char time[6]; | |
307 | // AUXILIARY DATA HEADER |
|
307 | // AUXILIARY DATA HEADER | |
308 | volatile unsigned char sid; |
|
308 | volatile unsigned char sid; | |
309 | volatile unsigned char hkBIA; |
|
309 | volatile unsigned char hkBIA; | |
310 | volatile unsigned char acquisitionTime[6]; |
|
310 | volatile unsigned char acquisitionTime[6]; | |
311 | volatile unsigned char blkNr[2]; |
|
311 | volatile unsigned char blkNr[2]; | |
312 | }; |
|
312 | }; | |
313 | typedef struct Header_TM_LFR_SCIENCE_CWF_str Header_TM_LFR_SCIENCE_CWF_t; |
|
313 | typedef struct Header_TM_LFR_SCIENCE_CWF_str Header_TM_LFR_SCIENCE_CWF_t; | |
314 |
|
314 | |||
315 | struct Header_TM_LFR_SCIENCE_ASM_str |
|
315 | struct Header_TM_LFR_SCIENCE_ASM_str | |
316 | { |
|
316 | { | |
317 | volatile unsigned char targetLogicalAddress; |
|
317 | volatile unsigned char targetLogicalAddress; | |
318 | volatile unsigned char protocolIdentifier; |
|
318 | volatile unsigned char protocolIdentifier; | |
319 | volatile unsigned char reserved; |
|
319 | volatile unsigned char reserved; | |
320 | volatile unsigned char userApplication; |
|
320 | volatile unsigned char userApplication; | |
321 | volatile unsigned char packetID[2]; |
|
321 | volatile unsigned char packetID[2]; | |
322 | volatile unsigned char packetSequenceControl[2]; |
|
322 | volatile unsigned char packetSequenceControl[2]; | |
323 | volatile unsigned char packetLength[2]; |
|
323 | volatile unsigned char packetLength[2]; | |
324 | // DATA FIELD HEADER |
|
324 | // DATA FIELD HEADER | |
325 | volatile unsigned char spare1_pusVersion_spare2; |
|
325 | volatile unsigned char spare1_pusVersion_spare2; | |
326 | volatile unsigned char serviceType; |
|
326 | volatile unsigned char serviceType; | |
327 | volatile unsigned char serviceSubType; |
|
327 | volatile unsigned char serviceSubType; | |
328 | volatile unsigned char destinationID; |
|
328 | volatile unsigned char destinationID; | |
329 | volatile unsigned char time[6]; |
|
329 | volatile unsigned char time[6]; | |
330 | // AUXILIARY HEADER |
|
330 | // AUXILIARY HEADER | |
331 | volatile unsigned char sid; |
|
331 | volatile unsigned char sid; | |
332 | volatile unsigned char biaStatusInfo; |
|
332 | volatile unsigned char biaStatusInfo; | |
333 | volatile unsigned char cntASM; |
|
333 | volatile unsigned char cntASM; | |
334 | volatile unsigned char nrASM; |
|
334 | volatile unsigned char nrASM; | |
335 | volatile unsigned char acquisitionTime[6]; |
|
335 | volatile unsigned char acquisitionTime[6]; | |
336 | volatile unsigned char blkNr[2]; |
|
336 | volatile unsigned char blkNr[2]; | |
337 | }; |
|
337 | }; | |
338 | typedef struct Header_TM_LFR_SCIENCE_ASM_str Header_TM_LFR_SCIENCE_ASM_t; |
|
338 | typedef struct Header_TM_LFR_SCIENCE_ASM_str Header_TM_LFR_SCIENCE_ASM_t; | |
339 |
|
339 | |||
340 | struct ccsdsTelecommandPacket_str |
|
340 | struct ccsdsTelecommandPacket_str | |
341 | { |
|
341 | { | |
342 | //unsigned char targetLogicalAddress; // removed by the grspw module |
|
342 | //unsigned char targetLogicalAddress; // removed by the grspw module | |
343 | volatile unsigned char protocolIdentifier; |
|
343 | volatile unsigned char protocolIdentifier; | |
344 | volatile unsigned char reserved; |
|
344 | volatile unsigned char reserved; | |
345 | volatile unsigned char userApplication; |
|
345 | volatile unsigned char userApplication; | |
346 | volatile unsigned char packetID[2]; |
|
346 | volatile unsigned char packetID[2]; | |
347 | volatile unsigned char packetSequenceControl[2]; |
|
347 | volatile unsigned char packetSequenceControl[2]; | |
348 | volatile unsigned char packetLength[2]; |
|
348 | volatile unsigned char packetLength[2]; | |
349 | // DATA FIELD HEADER |
|
349 | // DATA FIELD HEADER | |
350 | volatile unsigned char headerFlag_pusVersion_Ack; |
|
350 | volatile unsigned char headerFlag_pusVersion_Ack; | |
351 | volatile unsigned char serviceType; |
|
351 | volatile unsigned char serviceType; | |
352 | volatile unsigned char serviceSubType; |
|
352 | volatile unsigned char serviceSubType; | |
353 | volatile unsigned char sourceID; |
|
353 | volatile unsigned char sourceID; | |
354 | volatile unsigned char dataAndCRC[CCSDS_TC_PKT_MAX_SIZE-10]; |
|
354 | volatile unsigned char dataAndCRC[CCSDS_TC_PKT_MAX_SIZE-10]; | |
355 | }; |
|
355 | }; | |
356 | typedef struct ccsdsTelecommandPacket_str ccsdsTelecommandPacket_t; |
|
356 | typedef struct ccsdsTelecommandPacket_str ccsdsTelecommandPacket_t; | |
357 |
|
357 | |||
358 | struct Packet_TM_LFR_HK_str |
|
358 | struct Packet_TM_LFR_HK_str | |
359 | { |
|
359 | { | |
360 | volatile unsigned char targetLogicalAddress; |
|
360 | volatile unsigned char targetLogicalAddress; | |
361 | volatile unsigned char protocolIdentifier; |
|
361 | volatile unsigned char protocolIdentifier; | |
362 | volatile unsigned char reserved; |
|
362 | volatile unsigned char reserved; | |
363 | volatile unsigned char userApplication; |
|
363 | volatile unsigned char userApplication; | |
364 | volatile unsigned char packetID[2]; |
|
364 | volatile unsigned char packetID[2]; | |
365 | volatile unsigned char packetSequenceControl[2]; |
|
365 | volatile unsigned char packetSequenceControl[2]; | |
366 | volatile unsigned char packetLength[2]; |
|
366 | volatile unsigned char packetLength[2]; | |
367 | volatile unsigned char spare1_pusVersion_spare2; |
|
367 | volatile unsigned char spare1_pusVersion_spare2; | |
368 | volatile unsigned char serviceType; |
|
368 | volatile unsigned char serviceType; | |
369 | volatile unsigned char serviceSubType; |
|
369 | volatile unsigned char serviceSubType; | |
370 | volatile unsigned char destinationID; |
|
370 | volatile unsigned char destinationID; | |
371 | volatile unsigned char time[6]; |
|
371 | volatile unsigned char time[6]; | |
372 | volatile unsigned char sid; |
|
372 | volatile unsigned char sid; | |
373 |
|
373 | |||
374 | //************** |
|
374 | //************** | |
375 | // HK PARAMETERS |
|
375 | // HK PARAMETERS | |
376 | unsigned char lfr_status_word[2]; |
|
376 | unsigned char lfr_status_word[2]; | |
377 | unsigned char lfr_sw_version[4]; |
|
377 | unsigned char lfr_sw_version[4]; | |
378 | // tc statistics |
|
378 | // tc statistics | |
379 | unsigned char hk_lfr_update_info_tc_cnt[2]; |
|
379 | unsigned char hk_lfr_update_info_tc_cnt[2]; | |
380 | unsigned char hk_lfr_update_time_tc_cnt[2]; |
|
380 | unsigned char hk_lfr_update_time_tc_cnt[2]; | |
381 | unsigned char hk_dpu_exe_tc_lfr_cnt[2]; |
|
381 | unsigned char hk_dpu_exe_tc_lfr_cnt[2]; | |
382 | unsigned char hk_dpu_rej_tc_lfr_cnt[2]; |
|
382 | unsigned char hk_dpu_rej_tc_lfr_cnt[2]; | |
383 | unsigned char hk_lfr_last_exe_tc_id[2]; |
|
383 | unsigned char hk_lfr_last_exe_tc_id[2]; | |
384 | unsigned char hk_lfr_last_exe_tc_type[2]; |
|
384 | unsigned char hk_lfr_last_exe_tc_type[2]; | |
385 | unsigned char hk_lfr_last_exe_tc_subtype[2]; |
|
385 | unsigned char hk_lfr_last_exe_tc_subtype[2]; | |
386 | unsigned char hk_lfr_last_exe_tc_time[6]; |
|
386 | unsigned char hk_lfr_last_exe_tc_time[6]; | |
387 | unsigned char hk_lfr_last_rej_tc_id[2]; |
|
387 | unsigned char hk_lfr_last_rej_tc_id[2]; | |
388 | unsigned char hk_lfr_last_rej_tc_type[2]; |
|
388 | unsigned char hk_lfr_last_rej_tc_type[2]; | |
389 | unsigned char hk_lfr_last_rej_tc_subtype[2]; |
|
389 | unsigned char hk_lfr_last_rej_tc_subtype[2]; | |
390 | unsigned char hk_lfr_last_rej_tc_time[6]; |
|
390 | unsigned char hk_lfr_last_rej_tc_time[6]; | |
391 | // anomaly statistics |
|
391 | // anomaly statistics | |
392 | unsigned char hk_lfr_le_cnt[2]; |
|
392 | unsigned char hk_lfr_le_cnt[2]; | |
393 | unsigned char hk_lfr_me_cnt[2]; |
|
393 | unsigned char hk_lfr_me_cnt[2]; | |
394 | unsigned char hk_lfr_he_cnt[2]; |
|
394 | unsigned char hk_lfr_he_cnt[2]; | |
395 | unsigned char hk_lfr_last_er_rid[2]; |
|
395 | unsigned char hk_lfr_last_er_rid[2]; | |
396 | unsigned char hk_lfr_last_er_code; |
|
396 | unsigned char hk_lfr_last_er_code; | |
397 | unsigned char hk_lfr_last_er_time[6]; |
|
397 | unsigned char hk_lfr_last_er_time[6]; | |
398 | // vhdl_blk_status |
|
398 | // vhdl_blk_status | |
399 | unsigned char hk_lfr_vhdl_aa_sm; |
|
399 | unsigned char hk_lfr_vhdl_aa_sm; | |
400 | unsigned char hk_lfr_vhdl_fft_sr; |
|
400 | unsigned char hk_lfr_vhdl_fft_sr; | |
401 | unsigned char hk_lfr_vhdl_cic_hk; |
|
401 | unsigned char hk_lfr_vhdl_cic_hk; | |
402 | unsigned char hk_lfr_vhdl_iir_cal; |
|
402 | unsigned char hk_lfr_vhdl_iir_cal; | |
403 | // spacewire_if_statistics |
|
403 | // spacewire_if_statistics | |
404 | unsigned char hk_lfr_dpu_spw_pkt_rcv_cnt[2]; |
|
404 | unsigned char hk_lfr_dpu_spw_pkt_rcv_cnt[2]; | |
405 | unsigned char hk_lfr_dpu_spw_pkt_sent_cnt[2]; |
|
405 | unsigned char hk_lfr_dpu_spw_pkt_sent_cnt[2]; | |
406 | unsigned char hk_lfr_dpu_spw_tick_out_cnt; |
|
406 | unsigned char hk_lfr_dpu_spw_tick_out_cnt; | |
407 | unsigned char hk_lfr_dpu_spw_last_timc; |
|
407 | unsigned char hk_lfr_dpu_spw_last_timc; | |
408 | // ahb error statistics |
|
408 | // ahb error statistics | |
409 | unsigned int hk_lfr_last_fail_addr; |
|
409 | unsigned int hk_lfr_last_fail_addr; | |
410 | // temperatures |
|
410 | // temperatures | |
411 | unsigned char hk_lfr_temp_scm[2]; |
|
411 | unsigned char hk_lfr_temp_scm[2]; | |
412 | unsigned char hk_lfr_temp_pcb[2]; |
|
412 | unsigned char hk_lfr_temp_pcb[2]; | |
413 | unsigned char hk_lfr_temp_fpga[2]; |
|
413 | unsigned char hk_lfr_temp_fpga[2]; | |
414 | // error counters |
|
414 | // error counters | |
415 | unsigned char hk_lfr_dpu_spw_parity; |
|
415 | unsigned char hk_lfr_dpu_spw_parity; | |
416 | unsigned char hk_lfr_dpu_spw_disconnect; |
|
416 | unsigned char hk_lfr_dpu_spw_disconnect; | |
417 | unsigned char hk_lfr_dpu_spw_escape; |
|
417 | unsigned char hk_lfr_dpu_spw_escape; | |
418 | unsigned char hk_lfr_dpu_spw_credit; |
|
418 | unsigned char hk_lfr_dpu_spw_credit; | |
419 | unsigned char hk_lfr_dpu_spw_write_sync; |
|
419 | unsigned char hk_lfr_dpu_spw_write_sync; | |
420 | unsigned char hk_lfr_dpu_spw_rx_ahb; |
|
420 | unsigned char hk_lfr_dpu_spw_rx_ahb; | |
421 | unsigned char hk_lfr_dpu_spw_tx_ahb; |
|
421 | unsigned char hk_lfr_dpu_spw_tx_ahb; | |
422 | unsigned char hk_lfr_dpu_spw_header_crc; |
|
422 | unsigned char hk_lfr_dpu_spw_header_crc; | |
423 | unsigned char hk_lfr_dpu_spw_data_crc; |
|
423 | unsigned char hk_lfr_dpu_spw_data_crc; | |
424 | unsigned char hk_lfr_dpu_spw_early_eop; |
|
424 | unsigned char hk_lfr_dpu_spw_early_eop; | |
425 | unsigned char hk_lfr_dpu_spw_invalid_addr; |
|
425 | unsigned char hk_lfr_dpu_spw_invalid_addr; | |
426 | unsigned char hk_lfr_dpu_spw_eep; |
|
426 | unsigned char hk_lfr_dpu_spw_eep; | |
427 | unsigned char hk_lfr_dpu_spw_rx_too_big; |
|
427 | unsigned char hk_lfr_dpu_spw_rx_too_big; | |
428 | // timecode |
|
428 | // timecode | |
429 | unsigned char hk_lfr_timecode_erroneous; |
|
429 | unsigned char hk_lfr_timecode_erroneous; | |
430 | unsigned char hk_lfr_timecode_missing; |
|
430 | unsigned char hk_lfr_timecode_missing; | |
431 | unsigned char hk_lfr_timecode_invalid; |
|
431 | unsigned char hk_lfr_timecode_invalid; | |
432 | // time |
|
432 | // time | |
433 | unsigned char hk_lfr_time_timecode_it; |
|
433 | unsigned char hk_lfr_time_timecode_it; | |
434 | unsigned char hk_lfr_time_not_synchro; |
|
434 | unsigned char hk_lfr_time_not_synchro; | |
435 | unsigned char hk_lfr_time_timecode_ctr; |
|
435 | unsigned char hk_lfr_time_timecode_ctr; | |
436 | // hk_lfr_buffer_dpu_ |
|
436 | // hk_lfr_buffer_dpu_ | |
437 | unsigned char hk_lfr_buffer_dpu_tc_fifo; |
|
437 | unsigned char hk_lfr_buffer_dpu_tc_fifo; | |
438 | unsigned char hk_lfr_buffer_dpu_tm_fifo; |
|
438 | unsigned char hk_lfr_buffer_dpu_tm_fifo; | |
439 | // hk_lfr_ahb_ |
|
439 | // hk_lfr_ahb_ | |
440 | unsigned char hk_lfr_ahb_correctable; |
|
440 | unsigned char hk_lfr_ahb_correctable; | |
441 | unsigned char hk_lfr_ahb_uncorrectable; |
|
441 | unsigned char hk_lfr_ahb_uncorrectable; | |
442 | unsigned char hk_lfr_ahb_fails_trans; |
|
442 | unsigned char hk_lfr_ahb_fails_trans; | |
443 | // hk_lfr_adc_ |
|
443 | // hk_lfr_adc_ | |
444 | unsigned char hk_lfr_adc_failure; |
|
444 | unsigned char hk_lfr_adc_failure; | |
445 | unsigned char hk_lfr_adc_timeout; |
|
445 | unsigned char hk_lfr_adc_timeout; | |
446 | unsigned char hk_lfr_toomany_err; |
|
446 | unsigned char hk_lfr_toomany_err; | |
447 | // hk_lfr_cpu_ |
|
447 | // hk_lfr_cpu_ | |
448 | unsigned char hk_lfr_cpu_write_err; |
|
448 | unsigned char hk_lfr_cpu_write_err; | |
449 | unsigned char hk_lfr_cpu_ins_access_err; |
|
449 | unsigned char hk_lfr_cpu_ins_access_err; | |
450 | unsigned char hk_lfr_cpu_illegal_ins; |
|
450 | unsigned char hk_lfr_cpu_illegal_ins; | |
451 | unsigned char hk_lfr_cpu_privilegied_ins; |
|
451 | unsigned char hk_lfr_cpu_privilegied_ins; | |
452 | unsigned char hk_lfr_cpu_register_hw; |
|
452 | unsigned char hk_lfr_cpu_register_hw; | |
453 | unsigned char hk_lfr_cpu_not_aligned; |
|
453 | unsigned char hk_lfr_cpu_not_aligned; | |
454 | unsigned char hk_lfr_cpu_data_exception; |
|
454 | unsigned char hk_lfr_cpu_data_exception; | |
455 | unsigned char hk_lfr_cpu_div_exception; |
|
455 | unsigned char hk_lfr_cpu_div_exception; | |
456 | unsigned char hk_lfr_cpu_arith_overflow; |
|
456 | unsigned char hk_lfr_cpu_arith_overflow; | |
457 | }; |
|
457 | }; | |
458 | typedef struct Packet_TM_LFR_HK_str Packet_TM_LFR_HK_t; |
|
458 | typedef struct Packet_TM_LFR_HK_str Packet_TM_LFR_HK_t; | |
459 |
|
459 | |||
460 | struct Packet_TM_LFR_PARAMETER_DUMP_str |
|
460 | struct Packet_TM_LFR_PARAMETER_DUMP_str | |
461 | { |
|
461 | { | |
462 | volatile unsigned char targetLogicalAddress; |
|
462 | volatile unsigned char targetLogicalAddress; | |
463 | volatile unsigned char protocolIdentifier; |
|
463 | volatile unsigned char protocolIdentifier; | |
464 | volatile unsigned char reserved; |
|
464 | volatile unsigned char reserved; | |
465 | volatile unsigned char userApplication; |
|
465 | volatile unsigned char userApplication; | |
466 | volatile unsigned char packetID[2]; |
|
466 | volatile unsigned char packetID[2]; | |
467 | volatile unsigned char packetSequenceControl[2]; |
|
467 | volatile unsigned char packetSequenceControl[2]; | |
468 | volatile unsigned char packetLength[2]; |
|
468 | volatile unsigned char packetLength[2]; | |
469 | // DATA FIELD HEADER |
|
469 | // DATA FIELD HEADER | |
470 | volatile unsigned char spare1_pusVersion_spare2; |
|
470 | volatile unsigned char spare1_pusVersion_spare2; | |
471 | volatile unsigned char serviceType; |
|
471 | volatile unsigned char serviceType; | |
472 | volatile unsigned char serviceSubType; |
|
472 | volatile unsigned char serviceSubType; | |
473 | volatile unsigned char destinationID; |
|
473 | volatile unsigned char destinationID; | |
474 | volatile unsigned char time[6]; |
|
474 | volatile unsigned char time[6]; | |
475 | volatile unsigned char sid; |
|
475 | volatile unsigned char sid; | |
476 |
|
476 | |||
477 | //****************** |
|
477 | //****************** | |
478 | // COMMON PARAMETERS |
|
478 | // COMMON PARAMETERS | |
479 | volatile unsigned char unused0; |
|
479 | volatile unsigned char unused0; | |
480 | volatile unsigned char bw_sp0_sp1_r0_r1; |
|
480 | volatile unsigned char bw_sp0_sp1_r0_r1; | |
481 |
|
481 | |||
482 | //****************** |
|
482 | //****************** | |
483 | // NORMAL PARAMETERS |
|
483 | // NORMAL PARAMETERS | |
484 | volatile unsigned char sy_lfr_n_swf_l[2]; |
|
484 | volatile unsigned char sy_lfr_n_swf_l[2]; | |
485 | volatile unsigned char sy_lfr_n_swf_p[2]; |
|
485 | volatile unsigned char sy_lfr_n_swf_p[2]; | |
486 | volatile unsigned char sy_lfr_n_asm_p[2]; |
|
486 | volatile unsigned char sy_lfr_n_asm_p[2]; | |
487 | volatile unsigned char sy_lfr_n_bp_p0; |
|
487 | volatile unsigned char sy_lfr_n_bp_p0; | |
488 | volatile unsigned char sy_lfr_n_bp_p1; |
|
488 | volatile unsigned char sy_lfr_n_bp_p1; | |
489 |
|
489 | |||
490 | //***************** |
|
490 | //***************** | |
491 | // BURST PARAMETERS |
|
491 | // BURST PARAMETERS | |
492 | volatile unsigned char sy_lfr_b_bp_p0; |
|
492 | volatile unsigned char sy_lfr_b_bp_p0; | |
493 | volatile unsigned char sy_lfr_b_bp_p1; |
|
493 | volatile unsigned char sy_lfr_b_bp_p1; | |
494 |
|
494 | |||
495 | //**************** |
|
495 | //**************** | |
496 | // SBM1 PARAMETERS |
|
496 | // SBM1 PARAMETERS | |
497 | volatile unsigned char sy_lfr_s1_bp_p0; |
|
497 | volatile unsigned char sy_lfr_s1_bp_p0; | |
498 | volatile unsigned char sy_lfr_s1_bp_p1; |
|
498 | volatile unsigned char sy_lfr_s1_bp_p1; | |
499 |
|
499 | |||
500 | //**************** |
|
500 | //**************** | |
501 | // SBM2 PARAMETERS |
|
501 | // SBM2 PARAMETERS | |
502 | volatile unsigned char sy_lfr_s2_bp_p0; |
|
502 | volatile unsigned char sy_lfr_s2_bp_p0; | |
503 | volatile unsigned char sy_lfr_s2_bp_p1; |
|
503 | volatile unsigned char sy_lfr_s2_bp_p1; | |
504 | }; |
|
504 | }; | |
505 | typedef struct Packet_TM_LFR_PARAMETER_DUMP_str Packet_TM_LFR_PARAMETER_DUMP_t; |
|
505 | typedef struct Packet_TM_LFR_PARAMETER_DUMP_str Packet_TM_LFR_PARAMETER_DUMP_t; | |
506 |
|
506 | |||
507 |
|
507 | |||
508 | #endif // CCSDS_H_INCLUDED |
|
508 | #endif // CCSDS_H_INCLUDED |
@@ -1,55 +1,59 | |||||
1 | #ifndef FSW_RTEMS_H_INCLUDED |
|
1 | #ifndef FSW_RTEMS_H_INCLUDED | |
2 | #define FSW_RTEMS_H_INCLUDED |
|
2 | #define FSW_RTEMS_H_INCLUDED | |
3 |
|
3 | |||
4 | #include <errno.h> |
|
4 | #include <errno.h> | |
5 | #include <fcntl.h> |
|
5 | #include <fcntl.h> | |
6 | #include <stdio.h> |
|
6 | #include <stdio.h> | |
7 | #include <stdlib.h> |
|
7 | #include <stdlib.h> | |
8 |
|
8 | |||
9 | #include <grspw.h> |
|
9 | #include <grspw.h> | |
10 | #include <apbuart.h> |
|
10 | #include <apbuart.h> | |
11 |
|
11 | |||
12 | #include "fsw_params.h" |
|
12 | #include "fsw_params.h" | |
13 | #include "fsw_misc.h" |
|
13 | #include "fsw_misc.h" | |
14 | #include "fsw_processing.h" |
|
14 | #include "fsw_processing.h" | |
15 | #include "tc_handler.h" |
|
15 | #include "tc_handler.h" | |
16 | #include "wf_handler.h" |
|
16 | #include "wf_handler.h" | |
17 | #include "grlib_regs.h" |
|
17 | #include "grlib_regs.h" | |
18 | #include "ccsds_types.h" |
|
18 | #include "ccsds_types.h" | |
19 |
|
19 | |||
20 | #include "fsw_spacewire.h" |
|
20 | #include "fsw_spacewire.h" | |
21 |
|
21 | |||
22 | extern int sched_yield( void ); |
|
22 | extern int sched_yield( void ); | |
23 | extern int errno; |
|
23 | extern int errno; | |
24 | extern rtems_id Task_id[ ]; /* array of task ids */ |
|
24 | extern rtems_id Task_id[ ]; /* array of task ids */ | |
25 | extern rtems_name Task_name[ ]; /* array of task names */ |
|
25 | extern rtems_name Task_name[ ]; /* array of task names */ | |
26 | extern rtems_name misc_name[ ]; /* arry of miscellaneous names for rtems objects */ |
|
26 | extern rtems_name misc_id[ ]; | |
|
27 | extern rtems_name misc_name[ ]; /* array of miscellaneous names for rtems objects */ | |||
|
28 | extern unsigned int maxCount; | |||
27 | extern int fdSPW; // grspw file descriptor |
|
29 | extern int fdSPW; // grspw file descriptor | |
28 | extern int fdUART; // uart file descriptor |
|
30 | extern int fdUART; // uart file descriptor | |
29 | extern unsigned char lfrCurrentMode; |
|
31 | extern unsigned char lfrCurrentMode; | |
30 |
|
32 | |||
31 | // MODE PARAMETERS |
|
33 | // MODE PARAMETERS | |
32 | extern struct param_local_str param_local; |
|
34 | extern struct param_local_str param_local; | |
33 | extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet; |
|
35 | extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet; | |
34 | extern unsigned short sequenceCounters[SEQ_CNT_NB_PID][SEQ_CNT_NB_CAT][SEQ_CNT_NB_DEST_ID]; |
|
36 | extern unsigned short sequenceCounters[SEQ_CNT_NB_PID][SEQ_CNT_NB_CAT][SEQ_CNT_NB_DEST_ID]; | |
35 |
|
37 | |||
36 | // RTEMS TASKS |
|
38 | // RTEMS TASKS | |
37 | rtems_task Init( rtems_task_argument argument); /* forward declaration needed */ |
|
39 | rtems_task Init( rtems_task_argument argument); /* forward declaration needed */ | |
38 | rtems_task recv_task(rtems_task_argument argument); |
|
40 | rtems_task recv_task(rtems_task_argument argument); | |
39 | rtems_task stat_task(rtems_task_argument argument); |
|
41 | rtems_task stat_task(rtems_task_argument argument); | |
40 | rtems_task wfrm_task(rtems_task_argument argument); |
|
42 | rtems_task wfrm_task(rtems_task_argument argument); | |
|
43 | ||||
|
44 | // OTHER functions | |||
41 | int create_names( void ); |
|
45 | int create_names( void ); | |
42 | int create_all_tasks( void ); |
|
46 | int create_all_tasks( void ); | |
43 | int start_all_tasks( void ); |
|
47 | int start_all_tasks( void ); | |
44 | int create_message_queue( void ); |
|
48 | // | |
45 | int create_message_queues( void ); |
|
49 | int create_message_queues( void ); | |
46 |
|
50 | // | ||
47 | // OTHER functions |
|
|||
48 | void init_parameter_dump( void ); |
|
51 | void init_parameter_dump( void ); | |
49 | void init_local_mode_parameters( void ); |
|
52 | void init_local_mode_parameters( void ); | |
50 | void init_housekeeping_parameters( void ); |
|
53 | void init_housekeeping_parameters( void ); | |
51 |
|
54 | |||
52 | extern int rtems_cpu_usage_report( void ); |
|
55 | extern int rtems_cpu_usage_report( void ); | |
53 | extern int rtems_cpu_usage_reset( void ); |
|
56 | extern int rtems_cpu_usage_reset( void ); | |
|
57 | extern void rtems_stack_checker_report_usage( void ); | |||
54 |
|
58 | |||
55 | #endif // FSW_RTEMS_CONFIG_H_INCLUDED |
|
59 | #endif // FSW_RTEMS_CONFIG_H_INCLUDED |
@@ -1,194 +1,199 | |||||
1 | #ifndef FSW_RTEMS_CONFIG_H_INCLUDED |
|
1 | #ifndef FSW_RTEMS_CONFIG_H_INCLUDED | |
2 | #define FSW_RTEMS_CONFIG_H_INCLUDED |
|
2 | #define FSW_RTEMS_CONFIG_H_INCLUDED | |
3 |
|
3 | |||
4 | #include <fsw_params_processing.h> |
|
4 | #include <fsw_params_processing.h> | |
5 |
|
5 | |||
6 | #define GRSPW_DEVICE_NAME "/dev/grspw0" |
|
6 | #define GRSPW_DEVICE_NAME "/dev/grspw0" | |
7 | #define UART_DEVICE_NAME "/dev/console" |
|
7 | #define UART_DEVICE_NAME "/dev/console" | |
8 |
|
8 | |||
9 | //************************ |
|
9 | //************************ | |
10 | // flight software version |
|
10 | // flight software version | |
11 | // this parameters is handled by the Qt project options |
|
11 | // this parameters is handled by the Qt project options | |
12 |
|
12 | |||
13 | //********** |
|
13 | //********** | |
14 | // LFR MODES |
|
14 | // LFR MODES | |
15 | #define LFR_MODE_STANDBY 0 |
|
15 | #define LFR_MODE_STANDBY 0 | |
16 | #define LFR_MODE_NORMAL 1 |
|
16 | #define LFR_MODE_NORMAL 1 | |
17 | #define LFR_MODE_BURST 2 |
|
17 | #define LFR_MODE_BURST 2 | |
18 | #define LFR_MODE_SBM1 3 |
|
18 | #define LFR_MODE_SBM1 3 | |
19 | #define LFR_MODE_SBM2 4 |
|
19 | #define LFR_MODE_SBM2 4 | |
20 | #define LFR_MODE_NORMAL_CWF_F3 5 |
|
20 | #define LFR_MODE_NORMAL_CWF_F3 5 | |
21 |
|
21 | |||
22 | #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0 |
|
22 | #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0 | |
23 | #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1 |
|
23 | #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1 | |
24 | #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2 |
|
24 | #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2 | |
25 | #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3 |
|
25 | #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3 | |
26 | #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4 |
|
26 | #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4 | |
|
27 | #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5 | |||
27 |
|
28 | |||
28 | //**************************** |
|
29 | //**************************** | |
29 | // LFR DEFAULT MODE PARAMETERS |
|
30 | // LFR DEFAULT MODE PARAMETERS | |
30 | // COMMON |
|
31 | // COMMON | |
31 | #define DEFAULT_SY_LFR_COMMON0 0x00 |
|
32 | #define DEFAULT_SY_LFR_COMMON0 0x00 | |
32 | #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0 |
|
33 | #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0 | |
33 | // NORM |
|
34 | // NORM | |
34 | #define DEFAULT_SY_LFR_N_SWF_L 2048 // nb sample |
|
35 | #define DEFAULT_SY_LFR_N_SWF_L 2048 // nb sample | |
35 | #define DEFAULT_SY_LFR_N_SWF_P 16 // sec |
|
36 | #define DEFAULT_SY_LFR_N_SWF_P 16 // sec | |
36 | #define DEFAULT_SY_LFR_N_ASM_P 16 // sec |
|
37 | #define DEFAULT_SY_LFR_N_ASM_P 16 // sec | |
37 | #define DEFAULT_SY_LFR_N_BP_P0 4 // sec |
|
38 | #define DEFAULT_SY_LFR_N_BP_P0 4 // sec | |
38 | #define DEFAULT_SY_LFR_N_BP_P1 20 // sec |
|
39 | #define DEFAULT_SY_LFR_N_BP_P1 20 // sec | |
39 | #define MIN_DELTA_SNAPSHOT 16 // sec |
|
40 | #define MIN_DELTA_SNAPSHOT 16 // sec | |
40 | // BURST |
|
41 | // BURST | |
41 | #define DEFAULT_SY_LFR_B_BP_P0 1 // sec |
|
42 | #define DEFAULT_SY_LFR_B_BP_P0 1 // sec | |
42 | #define DEFAULT_SY_LFR_B_BP_P1 5 // sec |
|
43 | #define DEFAULT_SY_LFR_B_BP_P1 5 // sec | |
43 | // SBM1 |
|
44 | // SBM1 | |
44 | #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec |
|
45 | #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec | |
45 | #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec |
|
46 | #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec | |
46 | // SBM2 |
|
47 | // SBM2 | |
47 | #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec |
|
48 | #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec | |
48 | #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec |
|
49 | #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec | |
49 | // ADDITIONAL PARAMETERS |
|
50 | // ADDITIONAL PARAMETERS | |
50 | #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms |
|
51 | #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms | |
51 | #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s |
|
52 | #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s | |
52 | // |
|
53 | // | |
53 | //**************************** |
|
54 | //**************************** | |
54 |
|
55 | |||
55 | //***************************** |
|
56 | //***************************** | |
56 | // APB REGISTERS BASE ADDRESSES |
|
57 | // APB REGISTERS BASE ADDRESSES | |
57 | #define REGS_ADDR_APBUART 0x80000100 |
|
58 | #define REGS_ADDR_APBUART 0x80000100 | |
58 | #define REGS_ADDR_GPTIMER 0x80000300 |
|
59 | #define REGS_ADDR_GPTIMER 0x80000300 | |
59 | #define REGS_ADDR_GRSPW 0x80000500 |
|
60 | #define REGS_ADDR_GRSPW 0x80000500 | |
60 | #define REGS_ADDR_TIME_MANAGEMENT 0x80000600 |
|
61 | #define REGS_ADDR_TIME_MANAGEMENT 0x80000600 | |
61 | #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00 |
|
62 | #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00 | |
62 |
|
63 | |||
63 | #ifdef GSA |
|
64 | #ifdef GSA | |
64 | #else |
|
65 | #else | |
65 | #define REGS_ADDR_WAVEFORM_PICKER 0x80000f20 |
|
66 | #define REGS_ADDR_WAVEFORM_PICKER 0x80000f20 | |
66 | #endif |
|
67 | #endif | |
67 |
|
68 | |||
68 | #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff |
|
69 | #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff | |
69 | #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50) |
|
70 | #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50) | |
70 |
|
71 | |||
71 | //********** |
|
72 | //********** | |
72 | // IRQ LINES |
|
73 | // IRQ LINES | |
73 | #define IRQ_SM 9 |
|
74 | #define IRQ_SM 9 | |
74 | #define IRQ_SPARC_SM 0x19 // see sparcv8.pdf p.76 for interrupt levels |
|
75 | #define IRQ_SPARC_SM 0x19 // see sparcv8.pdf p.76 for interrupt levels | |
75 | #define IRQ_WF 10 |
|
76 | #define IRQ_WF 10 | |
76 | #define IRQ_SPARC_WF 0x1a // see sparcv8.pdf p.76 for interrupt levels |
|
77 | #define IRQ_SPARC_WF 0x1a // see sparcv8.pdf p.76 for interrupt levels | |
77 | #define IRQ_TIME1 12 |
|
78 | #define IRQ_TIME1 12 | |
78 | #define IRQ_SPARC_TIME1 0x1c // see sparcv8.pdf p.76 for interrupt levels |
|
79 | #define IRQ_SPARC_TIME1 0x1c // see sparcv8.pdf p.76 for interrupt levels | |
79 | #define IRQ_TIME2 13 |
|
80 | #define IRQ_TIME2 13 | |
80 | #define IRQ_SPARC_TIME2 0x1d // see sparcv8.pdf p.76 for interrupt levels |
|
81 | #define IRQ_SPARC_TIME2 0x1d // see sparcv8.pdf p.76 for interrupt levels | |
81 | #define IRQ_WAVEFORM_PICKER 14 |
|
82 | #define IRQ_WAVEFORM_PICKER 14 | |
82 | #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels |
|
83 | #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels | |
83 | #define IRQ_SPECTRAL_MATRIX 6 |
|
84 | #define IRQ_SPECTRAL_MATRIX 6 | |
84 | #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels |
|
85 | #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels | |
85 |
|
86 | |||
86 | //***** |
|
87 | //***** | |
87 | // TIME |
|
88 | // TIME | |
88 | #define CLKDIV_SM_SIMULATOR (10000 - 1) // 10 ms |
|
89 | #define CLKDIV_SM_SIMULATOR (10000 - 1) // 10 ms | |
89 | #define CLKDIV_WF_SIMULATOR (10000000 - 1) // 10 000 000 * 1 us = 10 s |
|
90 | #define CLKDIV_WF_SIMULATOR (10000000 - 1) // 10 000 000 * 1 us = 10 s | |
90 | #define TIMER_SM_SIMULATOR 1 |
|
91 | #define TIMER_SM_SIMULATOR 1 | |
91 | #define TIMER_WF_SIMULATOR 2 |
|
92 | #define TIMER_WF_SIMULATOR 2 | |
92 | #define HK_PERIOD 100 // 100 * 10ms => 1sec |
|
93 | #define HK_PERIOD 100 // 100 * 10ms => 1sec | |
93 |
|
94 | |||
94 | //********** |
|
95 | //********** | |
95 | // LPP CODES |
|
96 | // LPP CODES | |
96 | #define LFR_SUCCESSFUL 0 |
|
97 | #define LFR_SUCCESSFUL 0 | |
97 | #define LFR_DEFAULT 1 |
|
98 | #define LFR_DEFAULT 1 | |
98 |
|
99 | |||
99 | //****** |
|
100 | //****** | |
100 | // RTEMS |
|
101 | // RTEMS | |
101 | #define TASKID_RECV 1 |
|
102 | #define TASKID_RECV 1 | |
102 | #define TASKID_ACTN 2 |
|
103 | #define TASKID_ACTN 2 | |
103 | #define TASKID_SPIQ 3 |
|
104 | #define TASKID_SPIQ 3 | |
104 | #define TASKID_SMIQ 4 |
|
105 | #define TASKID_SMIQ 4 | |
105 | #define TASKID_STAT 5 |
|
106 | #define TASKID_STAT 5 | |
106 | #define TASKID_AVF0 6 |
|
107 | #define TASKID_AVF0 6 | |
107 | #define TASKID_BPF0 7 |
|
108 | #define TASKID_BPF0 7 | |
108 | #define TASKID_WFRM 8 |
|
109 | #define TASKID_WFRM 8 | |
109 | #define TASKID_DUMB 9 |
|
110 | #define TASKID_DUMB 9 | |
110 | #define TASKID_HOUS 10 |
|
111 | #define TASKID_HOUS 10 | |
111 | #define TASKID_MATR 11 |
|
112 | #define TASKID_MATR 11 | |
112 | #define TASKID_CWF3 12 |
|
113 | #define TASKID_CWF3 12 | |
113 | #define TASKID_CWF2 13 |
|
114 | #define TASKID_CWF2 13 | |
114 | #define TASKID_CWF1 14 |
|
115 | #define TASKID_CWF1 14 | |
115 | #define TASKID_SEND 15 |
|
116 | #define TASKID_SEND 15 | |
116 |
|
117 | |||
117 | //********************************************************************* |
|
|||
118 | // ALL TASKS THAT USE THE SPACEWIRE DIRVER SHALL HAVE THE SAME PRIORITY |
|
|||
119 | // OR CHANGE THE SEMAPHORE CREATION IN THE DRIVER... |
|
|||
120 | #define TASK_PRIORITY_SPIQ 5 |
|
118 | #define TASK_PRIORITY_SPIQ 5 | |
121 | #define TASK_PRIORITY_SMIQ 10 |
|
119 | #define TASK_PRIORITY_SMIQ 10 | |
122 | #define TASK_PRIORITY_SEND 11 |
|
120 | // | |
123 |
#define TASK_PRIORITY_ |
|
121 | #define TASK_PRIORITY_SEND 30 | |
124 | #define TASK_PRIORITY_ACTN 12 |
|
122 | // | |
125 |
#define TASK_PRIORITY_ |
|
123 | #define TASK_PRIORITY_RECV 40 | |
126 |
#define TASK_PRIORITY_ |
|
124 | #define TASK_PRIORITY_ACTN 40 | |
127 | #define TASK_PRIORITY_CWF2 15 |
|
125 | // | |
128 |
#define TASK_PRIORITY_ |
|
126 | #define TASK_PRIORITY_HOUS 40 | |
129 |
#define TASK_PRIORITY_CWF |
|
127 | #define TASK_PRIORITY_CWF1 40 | |
130 |
#define TASK_PRIORITY_ |
|
128 | #define TASK_PRIORITY_CWF2 40 | |
131 |
#define TASK_PRIORITY_ |
|
129 | #define TASK_PRIORITY_WFRM 40 | |
132 |
#define TASK_PRIORITY_ |
|
130 | #define TASK_PRIORITY_CWF3 40 | |
133 | #define TASK_PRIORITY_STAT 251 |
|
131 | // | |
134 |
#define TASK_PRIORITY_ |
|
132 | #define TASK_PRIORITY_AVF0 60 | |
|
133 | #define TASK_PRIORITY_BPF0 60 | |||
|
134 | #define TASK_PRIORITY_MATR 100 | |||
|
135 | #define TASK_PRIORITY_STAT 200 | |||
|
136 | #define TASK_PRIORITY_DUMB 200 | |||
135 |
|
137 | |||
136 | #define ACTION_MSG_QUEUE_COUNT 10 |
|
138 | #define ACTION_MSG_QUEUE_COUNT 10 | |
137 | #define ACTION_MSG_PKTS_COUNT 50 |
|
139 | #define ACTION_MSG_PKTS_COUNT 50 | |
138 | #define ACTION_MSG_PKTS_SIZE |
|
140 | #define ACTION_MSG_PKTS_SIZE 24 // hlen *hdr dlen *data sent options | |
|
141 | ||||
|
142 | #define QUEUE_QUEU 0 | |||
|
143 | #define QUEUE_PKTS 1 | |||
139 |
|
144 | |||
140 | //******* |
|
145 | //******* | |
141 | // MACROS |
|
146 | // MACROS | |
142 | #ifdef PRINT_MESSAGES_ON_CONSOLE |
|
147 | #ifdef PRINT_MESSAGES_ON_CONSOLE | |
143 | #define PRINTF(x) printf(x); |
|
148 | #define PRINTF(x) printf(x); | |
144 | #define PRINTF1(x,y) printf(x,y); |
|
149 | #define PRINTF1(x,y) printf(x,y); | |
145 | #define PRINTF2(x,y,z) printf(x,y,z); |
|
150 | #define PRINTF2(x,y,z) printf(x,y,z); | |
146 | #else |
|
151 | #else | |
147 | #define PRINTF(x) ; |
|
152 | #define PRINTF(x) ; | |
148 | #define PRINTF1(x,y) ; |
|
153 | #define PRINTF1(x,y) ; | |
149 | #define PRINTF2(x,y,z) ; |
|
154 | #define PRINTF2(x,y,z) ; | |
150 | #endif |
|
155 | #endif | |
151 |
|
156 | |||
152 | #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period |
|
157 | #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period | |
153 |
|
158 | |||
154 | #define NB_SAMPLES_PER_SNAPSHOT 2048 |
|
159 | #define NB_SAMPLES_PER_SNAPSHOT 2048 | |
155 | #define TIME_OFFSET 2 |
|
160 | #define TIME_OFFSET 2 | |
156 | #define WAVEFORM_EXTENDED_HEADER_OFFSET 22 |
|
161 | #define WAVEFORM_EXTENDED_HEADER_OFFSET 22 | |
157 | #define NB_BYTES_SWF_BLK 2 * 6 |
|
162 | #define NB_BYTES_SWF_BLK 2 * 6 | |
158 | #define NB_WORDS_SWF_BLK 3 |
|
163 | #define NB_WORDS_SWF_BLK 3 | |
159 |
|
164 | |||
160 | //****************** |
|
165 | //****************** | |
161 | // SEQUENCE COUNTERS |
|
166 | // SEQUENCE COUNTERS | |
162 | #define SEQ_CNT_NB_PID 2 |
|
167 | #define SEQ_CNT_NB_PID 2 | |
163 | #define SEQ_CNT_NB_CAT 4 |
|
168 | #define SEQ_CNT_NB_CAT 4 | |
164 | #define SEQ_CNT_NB_DEST_ID 11 |
|
169 | #define SEQ_CNT_NB_DEST_ID 11 | |
165 | // pid |
|
170 | // pid | |
166 | #define SEQ_CNT_PID_76 0 |
|
171 | #define SEQ_CNT_PID_76 0 | |
167 | #define SEQ_CNT_PID_79 1 |
|
172 | #define SEQ_CNT_PID_79 1 | |
168 | //cat |
|
173 | //cat | |
169 | #define SEQ_CNT_CAT_1 0 |
|
174 | #define SEQ_CNT_CAT_1 0 | |
170 | #define SEQ_CNT_CAT_4 1 |
|
175 | #define SEQ_CNT_CAT_4 1 | |
171 | #define SEQ_CNT_CAT_9 2 |
|
176 | #define SEQ_CNT_CAT_9 2 | |
172 | #define SEQ_CNT_CAT_12 3 |
|
177 | #define SEQ_CNT_CAT_12 3 | |
173 | // destination id |
|
178 | // destination id | |
174 | #define SEQ_CNT_DST_ID_GROUND 0 |
|
179 | #define SEQ_CNT_DST_ID_GROUND 0 | |
175 | #define SEQ_CNT_DST_ID_MISSION_TIMELINE 1 |
|
180 | #define SEQ_CNT_DST_ID_MISSION_TIMELINE 1 | |
176 | #define SEQ_CNT_DST_ID_TC_SEQUENCES 2 |
|
181 | #define SEQ_CNT_DST_ID_TC_SEQUENCES 2 | |
177 | #define SEQ_CNT_DST_ID_RECOVERY_ACTION_CMD 3 |
|
182 | #define SEQ_CNT_DST_ID_RECOVERY_ACTION_CMD 3 | |
178 | #define SEQ_CNT_DST_ID_BACKUP_MISSION_TIMELINE 4 |
|
183 | #define SEQ_CNT_DST_ID_BACKUP_MISSION_TIMELINE 4 | |
179 | #define SEQ_CNT_DST_ID_DIRECT_CMD 5 |
|
184 | #define SEQ_CNT_DST_ID_DIRECT_CMD 5 | |
180 | #define SEQ_CNT_DST_ID_SPARE_GRD_SRC1 6 |
|
185 | #define SEQ_CNT_DST_ID_SPARE_GRD_SRC1 6 | |
181 | #define SEQ_CNT_DST_ID_SPARE_GRD_SRC2 7 |
|
186 | #define SEQ_CNT_DST_ID_SPARE_GRD_SRC2 7 | |
182 | #define SEQ_CNT_DST_ID_OBCP 8 |
|
187 | #define SEQ_CNT_DST_ID_OBCP 8 | |
183 | #define SEQ_CNT_DST_ID_SYSTEM_CONTROL 9 |
|
188 | #define SEQ_CNT_DST_ID_SYSTEM_CONTROL 9 | |
184 | #define SEQ_CNT_DST_ID_AOCS 10 |
|
189 | #define SEQ_CNT_DST_ID_AOCS 10 | |
185 |
|
190 | |||
186 | struct param_local_str{ |
|
191 | struct param_local_str{ | |
187 | unsigned int local_sbm1_nb_cwf_sent; |
|
192 | unsigned int local_sbm1_nb_cwf_sent; | |
188 | unsigned int local_sbm1_nb_cwf_max; |
|
193 | unsigned int local_sbm1_nb_cwf_max; | |
189 | unsigned int local_sbm2_nb_cwf_sent; |
|
194 | unsigned int local_sbm2_nb_cwf_sent; | |
190 | unsigned int local_sbm2_nb_cwf_max; |
|
195 | unsigned int local_sbm2_nb_cwf_max; | |
191 | unsigned int local_nb_interrupt_f0_MAX; |
|
196 | unsigned int local_nb_interrupt_f0_MAX; | |
192 | }; |
|
197 | }; | |
193 |
|
198 | |||
194 | #endif // FSW_RTEMS_CONFIG_H_INCLUDED |
|
199 | #endif // FSW_RTEMS_CONFIG_H_INCLUDED |
@@ -1,67 +1,70 | |||||
1 | #ifndef FSW_RTEMS_PROCESSING_H_INCLUDED |
|
1 | #ifndef FSW_RTEMS_PROCESSING_H_INCLUDED | |
2 | #define FSW_RTEMS_PROCESSING_H_INCLUDED |
|
2 | #define FSW_RTEMS_PROCESSING_H_INCLUDED | |
3 |
|
3 | |||
4 | #include <rtems.h> |
|
4 | #include <rtems.h> | |
5 | #include <grspw.h> |
|
5 | #include <grspw.h> | |
6 | #include <leon.h> |
|
6 | #include <leon.h> | |
7 |
|
7 | |||
8 | #include <fsw_init.h> |
|
8 | #include <fsw_init.h> | |
9 | #include <fsw_params.h> |
|
9 | #include <fsw_params.h> | |
10 | #include <grlib_regs.h> |
|
10 | #include <grlib_regs.h> | |
11 | #include <ccsds_types.h> |
|
11 | #include <ccsds_types.h> | |
12 |
|
12 | |||
13 | #include <stdio.h> |
|
13 | #include <stdio.h> | |
14 | #include <stdlib.h> |
|
14 | #include <stdlib.h> | |
15 |
|
15 | |||
16 | extern volatile int spec_mat_f0_0[ ]; |
|
16 | extern volatile int spec_mat_f0_0[ ]; | |
17 | extern volatile int spec_mat_f0_1[ ]; |
|
17 | extern volatile int spec_mat_f0_1[ ]; | |
|
18 | extern volatile int spec_mat_f0_a[ ]; | |||
|
19 | extern volatile int spec_mat_f0_b[ ]; | |||
18 | extern volatile int spec_mat_f0_c[ ]; |
|
20 | extern volatile int spec_mat_f0_c[ ]; | |
19 | extern volatile int spec_mat_f0_d[ ]; |
|
21 | extern volatile int spec_mat_f0_d[ ]; | |
20 | extern volatile int spec_mat_f0_e[ ]; |
|
22 | extern volatile int spec_mat_f0_e[ ]; | |
21 | extern volatile int spec_mat_f0_f[ ]; |
|
23 | extern volatile int spec_mat_f0_f[ ]; | |
22 | extern volatile int spec_mat_f0_g[ ]; |
|
24 | extern volatile int spec_mat_f0_g[ ]; | |
23 | extern volatile int spec_mat_f0_h[ ]; |
|
25 | extern volatile int spec_mat_f0_h[ ]; | |
24 |
|
26 | |||
25 | extern volatile int spec_mat_f1[ ]; |
|
27 | extern volatile int spec_mat_f1[ ]; | |
26 | extern volatile int spec_mat_f2[ ]; |
|
28 | extern volatile int spec_mat_f2[ ]; | |
27 |
|
29 | |||
28 | extern volatile int spec_mat_f1_bis[ ]; |
|
30 | extern volatile int spec_mat_f1_bis[ ]; | |
29 | extern volatile int spec_mat_f2_bis[ ]; |
|
31 | extern volatile int spec_mat_f2_bis[ ]; | |
30 | extern volatile int spec_mat_f0_0_bis[ ]; |
|
32 | extern volatile int spec_mat_f0_0_bis[ ]; | |
31 | extern volatile int spec_mat_f0_1_bis[ ]; |
|
33 | extern volatile int spec_mat_f0_1_bis[ ]; | |
32 |
|
34 | |||
33 | extern rtems_id Task_id[ ]; /* array of task ids */ |
|
35 | extern rtems_id Task_id[ ]; /* array of task ids */ | |
34 |
|
36 | |||
35 | // parameters |
|
37 | // parameters | |
36 | extern struct param_local_str param_local; |
|
38 | extern struct param_local_str param_local; | |
37 |
|
39 | |||
38 | // registers |
|
40 | // registers | |
39 | extern time_management_regs_t *time_management_regs; |
|
41 | extern time_management_regs_t *time_management_regs; | |
40 | extern spectral_matrix_regs_t *spectral_matrix_regs; |
|
42 | extern spectral_matrix_regs_t *spectral_matrix_regs; | |
41 |
|
43 | |||
42 | // ISR |
|
44 | // ISR | |
43 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ); |
|
45 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ); | |
|
46 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ); | |||
44 |
|
47 | |||
45 | // RTEMS TASKS |
|
48 | // RTEMS TASKS | |
46 | rtems_task spw_bppr_task(rtems_task_argument argument); |
|
49 | rtems_task spw_bppr_task(rtems_task_argument argument); | |
47 | rtems_task avf0_task(rtems_task_argument argument); |
|
50 | rtems_task avf0_task(rtems_task_argument argument); | |
48 | rtems_task bpf0_task(rtems_task_argument argument); |
|
51 | rtems_task bpf0_task(rtems_task_argument argument); | |
49 | rtems_task smiq_task(rtems_task_argument argument); // added to test the spectral matrix simulator |
|
52 | rtems_task smiq_task(rtems_task_argument argument); // added to test the spectral matrix simulator | |
50 | rtems_task matr_task(rtems_task_argument argument); |
|
53 | rtems_task matr_task(rtems_task_argument argument); | |
51 |
|
54 | |||
52 | rtems_task spw_bppr_task_rate_monotonic(rtems_task_argument argument); |
|
55 | rtems_task spw_bppr_task_rate_monotonic(rtems_task_argument argument); | |
53 |
|
56 | |||
54 | void matrix_average(volatile int *spec_mat, volatile float *averaged_spec_mat); |
|
57 | void matrix_average(volatile int *spec_mat, volatile float *averaged_spec_mat); | |
55 | void matrix_compression(volatile float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat); |
|
58 | void matrix_compression(volatile float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat); | |
56 | void matrix_reset(volatile float *averaged_spec_mat); |
|
59 | void matrix_reset(volatile float *averaged_spec_mat); | |
57 | void BP1_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1); |
|
60 | void BP1_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1); | |
58 | void BP2_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat); |
|
61 | void BP2_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat); | |
59 | // |
|
62 | // | |
60 | void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header); |
|
63 | void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header); | |
61 | void send_spectral_matrix(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, |
|
64 | void send_spectral_matrix(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, | |
62 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send); |
|
65 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send); | |
63 | void convert_averaged_spectral_matrix(volatile float *input_matrix, char *output_matrix); |
|
66 | void convert_averaged_spectral_matrix(volatile float *input_matrix, char *output_matrix); | |
64 | void fill_averaged_spectral_matrix(); |
|
67 | void fill_averaged_spectral_matrix(); | |
65 | void reset_spectral_matrix_regs(); |
|
68 | void reset_spectral_matrix_regs(); | |
66 |
|
69 | |||
67 | #endif // FSW_RTEMS_PROCESSING_H_INCLUDED |
|
70 | #endif // FSW_RTEMS_PROCESSING_H_INCLUDED |
@@ -1,93 +1,87 | |||||
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 <bsp.h> // for the LEON_Unmask_interrupt function |
|
5 | #include <bsp.h> // for the LEON_Unmask_interrupt function | |
6 | #include <stdio.h> |
|
6 | #include <stdio.h> | |
7 | #include <unistd.h> // for the read call |
|
7 | #include <unistd.h> // for the read call | |
8 | #include <sys/ioctl.h> // for the ioctl call |
|
8 | #include <sys/ioctl.h> // for the ioctl call | |
9 | #include <ccsds_types.h> |
|
9 | #include <ccsds_types.h> | |
10 | #include <grspw.h> |
|
10 | #include <grspw.h> | |
11 |
|
11 | |||
12 | #include "fsw_init.h" |
|
12 | #include "fsw_init.h" | |
13 | #include "fsw_misc.h" |
|
13 | #include "fsw_misc.h" | |
14 |
|
14 | |||
15 | extern int fdSPW; |
|
|||
16 | extern unsigned char lfrCurrentMode; |
|
|||
17 | extern rtems_name misc_name[ ]; |
|
|||
18 | extern rtems_name misc_id[ ]; |
|
|||
19 | extern rtems_id Task_id[ ]; // array of task ids |
|
|||
20 | // MODE PARAMETERS |
|
15 | // MODE PARAMETERS | |
21 | extern struct param_sbm1_str param_sbm1; |
|
16 | extern struct param_sbm1_str param_sbm1; | |
22 | extern struct param_sbm2_str param_sbm2; |
|
17 | extern struct param_sbm2_str param_sbm2; | |
23 | extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet; |
|
|||
24 | extern time_management_regs_t *time_management_regs; |
|
18 | extern time_management_regs_t *time_management_regs; | |
25 | extern waveform_picker_regs_t *waveform_picker_regs; |
|
19 | extern waveform_picker_regs_t *waveform_picker_regs; | |
26 | extern gptimer_regs_t *gptimer_regs; |
|
20 | extern gptimer_regs_t *gptimer_regs; | |
27 |
|
21 | |||
28 | //**** |
|
22 | //**** | |
29 | // ISR |
|
23 | // ISR | |
30 | rtems_isr commutation_isr1( rtems_vector_number vector ); |
|
24 | rtems_isr commutation_isr1( rtems_vector_number vector ); | |
31 | rtems_isr commutation_isr2( rtems_vector_number vector ); |
|
25 | rtems_isr commutation_isr2( rtems_vector_number vector ); | |
32 |
|
26 | |||
33 | //********************** |
|
27 | //********************** | |
34 | // GENERAL USE FUNCTIONS |
|
28 | // GENERAL USE FUNCTIONS | |
35 | unsigned int Crc_opt( unsigned char D, unsigned int Chk); |
|
29 | unsigned int Crc_opt( unsigned char D, unsigned int Chk); | |
36 | void initLookUpTableForCRC( void ); |
|
30 | void initLookUpTableForCRC( void ); | |
37 | void GetCRCAsTwoBytes(unsigned char* data, unsigned char* crcAsTwoBytes, unsigned int sizeOfData); |
|
31 | void GetCRCAsTwoBytes(unsigned char* data, unsigned char* crcAsTwoBytes, unsigned int sizeOfData); | |
38 | void updateLFRCurrentMode(); |
|
32 | void updateLFRCurrentMode(); | |
39 |
|
33 | |||
40 | //********************* |
|
34 | //********************* | |
41 | // ACCEPTANCE FUNCTIONS |
|
35 | // ACCEPTANCE FUNCTIONS | |
42 | int TC_acceptance(ccsdsTelecommandPacket_t *TC, unsigned int TC_LEN_RCV); |
|
36 | int TC_acceptance(ccsdsTelecommandPacket_t *TC, unsigned int TC_LEN_RCV); | |
43 | unsigned char TC_parser(ccsdsTelecommandPacket_t * TMPacket, unsigned int TC_LEN_RCV); |
|
37 | unsigned char TC_parser(ccsdsTelecommandPacket_t * TMPacket, unsigned int TC_LEN_RCV); | |
44 |
|
38 | |||
45 | unsigned char TM_build_header( enum TM_TYPE tm_type, unsigned int packetLength, |
|
39 | unsigned char TM_build_header( enum TM_TYPE tm_type, unsigned int packetLength, | |
46 | TMHeader_t *TMHeader, unsigned char tc_sid); |
|
40 | TMHeader_t *TMHeader, unsigned char tc_sid); | |
47 |
|
41 | |||
48 | //*********** |
|
42 | //*********** | |
49 | // RTEMS TASK |
|
43 | // RTEMS TASK | |
50 | rtems_task recv_task( rtems_task_argument unused ); |
|
44 | rtems_task recv_task( rtems_task_argument unused ); | |
51 | rtems_task actn_task( rtems_task_argument unused ); |
|
45 | rtems_task actn_task( rtems_task_argument unused ); | |
52 | rtems_task dumb_task( rtems_task_argument unused ); |
|
46 | rtems_task dumb_task( rtems_task_argument unused ); | |
53 |
|
47 | |||
54 | //*********** |
|
48 | //*********** | |
55 | // TC ACTIONS |
|
49 | // TC ACTIONS | |
56 | int action_reset(ccsdsTelecommandPacket_t *TC); |
|
50 | int action_reset(ccsdsTelecommandPacket_t *TC); | |
57 | int action_load_common_par(ccsdsTelecommandPacket_t *TC); |
|
51 | int action_load_common_par(ccsdsTelecommandPacket_t *TC); | |
58 | int action_load_normal_par(ccsdsTelecommandPacket_t *TC); |
|
52 | int action_load_normal_par(ccsdsTelecommandPacket_t *TC); | |
59 | int action_load_burst_par(ccsdsTelecommandPacket_t *TC); |
|
53 | int action_load_burst_par(ccsdsTelecommandPacket_t *TC); | |
60 | int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC); |
|
54 | int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC); | |
61 | int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC); |
|
55 | int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC); | |
62 | int action_dump_par(ccsdsTelecommandPacket_t *TC); |
|
56 | int action_dump_par(ccsdsTelecommandPacket_t *TC); | |
63 | int action_enter_mode(ccsdsTelecommandPacket_t *TC); |
|
57 | int action_enter_mode(ccsdsTelecommandPacket_t *TC); | |
64 | int action_update_info(ccsdsTelecommandPacket_t *TC); |
|
58 | int action_update_info(ccsdsTelecommandPacket_t *TC); | |
65 | int action_enable_calibration(ccsdsTelecommandPacket_t *TC); |
|
59 | int action_enable_calibration(ccsdsTelecommandPacket_t *TC); | |
66 | int action_disable_calibration(ccsdsTelecommandPacket_t *TC); |
|
60 | int action_disable_calibration(ccsdsTelecommandPacket_t *TC); | |
67 | int action_update_time(ccsdsTelecommandPacket_t *TC); |
|
61 | int action_update_time(ccsdsTelecommandPacket_t *TC); | |
68 |
|
62 | |||
69 | // mode transition |
|
63 | // mode transition | |
70 | int transition_validation(unsigned char requestedMode); |
|
64 | int transition_validation(unsigned char requestedMode); | |
71 | int stop_current_mode(); |
|
65 | int stop_current_mode(); | |
72 | int enter_mode(unsigned char mode, ccsdsTelecommandPacket_t *TC); |
|
66 | int enter_mode(unsigned char mode, ccsdsTelecommandPacket_t *TC); | |
73 | int enter_standby_mode(); |
|
67 | int enter_standby_mode(); | |
74 | int enter_normal_mode(); |
|
68 | int enter_normal_mode(); | |
75 | int enter_burst_mode(); |
|
69 | int enter_burst_mode(); | |
76 | int enter_sbm1_mode(); |
|
70 | int enter_sbm1_mode(); | |
77 | int enter_sbm2_mode(); |
|
71 | int enter_sbm2_mode(); | |
78 | int restart_science_tasks(); |
|
72 | int restart_science_tasks(); | |
79 | int suspend_science_tasks(); |
|
73 | int suspend_science_tasks(); | |
80 |
|
74 | |||
81 | // other functions |
|
75 | // other functions | |
82 | void update_last_TC_exe(ccsdsTelecommandPacket_t *TC); |
|
76 | void update_last_TC_exe(ccsdsTelecommandPacket_t *TC); | |
83 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC); |
|
77 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC); | |
84 | void close_action(ccsdsTelecommandPacket_t *TC, int result); |
|
78 | void close_action(ccsdsTelecommandPacket_t *TC, int result); | |
85 | int send_tm_lfr_tc_exe_success(ccsdsTelecommandPacket_t *TC); |
|
79 | int send_tm_lfr_tc_exe_success(ccsdsTelecommandPacket_t *TC); | |
86 | int send_tm_lfr_tc_exe_not_executable(ccsdsTelecommandPacket_t *TC); |
|
80 | int send_tm_lfr_tc_exe_not_executable(ccsdsTelecommandPacket_t *TC); | |
87 | int send_tm_lfr_tc_exe_not_implemented(ccsdsTelecommandPacket_t *TC); |
|
81 | int send_tm_lfr_tc_exe_not_implemented(ccsdsTelecommandPacket_t *TC); | |
88 | int send_tm_lfr_tc_exe_error(ccsdsTelecommandPacket_t *TC); |
|
82 | int send_tm_lfr_tc_exe_error(ccsdsTelecommandPacket_t *TC); | |
89 |
|
83 | |||
90 | #endif // TC_HANDLER_H_INCLUDED |
|
84 | #endif // TC_HANDLER_H_INCLUDED | |
91 |
|
85 | |||
92 |
|
86 | |||
93 |
|
87 |
@@ -1,72 +1,71 | |||||
1 | #ifndef WF_HANDLER_H_INCLUDED |
|
1 | #ifndef WF_HANDLER_H_INCLUDED | |
2 | #define WF_HANDLER_H_INCLUDED |
|
2 | #define WF_HANDLER_H_INCLUDED | |
3 |
|
3 | |||
4 | #include <rtems.h> |
|
4 | #include <rtems.h> | |
5 | #include <grspw.h> |
|
5 | #include <grspw.h> | |
6 |
|
6 | |||
7 | #include <stdio.h> |
|
7 | #include <stdio.h> | |
8 | #include <math.h> |
|
8 | #include <math.h> | |
9 |
|
9 | |||
10 | #include "fsw_params.h" |
|
10 | #include "fsw_params.h" | |
11 | #include "grlib_regs.h" |
|
11 | #include "grlib_regs.h" | |
12 | #include "ccsds_types.h" |
|
12 | #include "ccsds_types.h" | |
13 | #include "fsw_init.h" |
|
13 | #include "fsw_init.h" | |
14 |
|
14 | |||
15 | #define pi 3.1415 |
|
15 | #define pi 3.1415 | |
16 |
|
16 | |||
17 | //#include <sys/ioctl.h> |
|
17 | //#include <sys/ioctl.h> | |
18 |
|
18 | |||
19 | extern rtems_id Task_id[]; /* array of task ids */ |
|
19 | extern rtems_id Task_id[]; /* array of task ids */ | |
20 | extern int fdSPW; |
|
20 | extern int fdSPW; | |
21 | extern volatile int wf_snap_f0[ ]; |
|
21 | extern volatile int wf_snap_f0[ ]; | |
22 | // |
|
22 | // | |
23 | extern volatile int wf_snap_f1[ ]; |
|
23 | extern volatile int wf_snap_f1[ ]; | |
24 | extern volatile int wf_snap_f1_bis[ ]; |
|
24 | extern volatile int wf_snap_f1_bis[ ]; | |
25 | extern volatile int wf_snap_f1_norm[ ]; |
|
25 | extern volatile int wf_snap_f1_norm[ ]; | |
26 | // |
|
26 | // | |
27 | extern volatile int wf_snap_f2[ ]; |
|
27 | extern volatile int wf_snap_f2[ ]; | |
28 | extern volatile int wf_snap_f2_bis[ ]; |
|
28 | extern volatile int wf_snap_f2_bis[ ]; | |
29 | extern volatile int wf_snap_f2_norm[ ]; |
|
29 | extern volatile int wf_snap_f2_norm[ ]; | |
30 | // |
|
30 | // | |
31 | extern volatile int wf_cont_f3[ ]; |
|
31 | extern volatile int wf_cont_f3[ ]; | |
32 | extern volatile int wf_cont_f3_bis[ ]; |
|
32 | extern volatile int wf_cont_f3_bis[ ]; | |
33 | extern waveform_picker_regs_t *waveform_picker_regs; |
|
33 | extern waveform_picker_regs_t *waveform_picker_regs; | |
34 | extern unsigned char lfrCurrentMode; |
|
|||
35 |
|
34 | |||
36 | rtems_isr waveforms_isr( rtems_vector_number vector ); |
|
35 | rtems_isr waveforms_isr( rtems_vector_number vector ); | |
37 | rtems_isr waveforms_simulator_isr( rtems_vector_number vector ); |
|
36 | rtems_isr waveforms_simulator_isr( rtems_vector_number vector ); | |
38 | rtems_task wfrm_task(rtems_task_argument argument); |
|
37 | rtems_task wfrm_task(rtems_task_argument argument); | |
39 | rtems_task cwf3_task(rtems_task_argument argument); |
|
38 | rtems_task cwf3_task(rtems_task_argument argument); | |
40 | rtems_task cwf2_task(rtems_task_argument argument); |
|
39 | rtems_task cwf2_task(rtems_task_argument argument); | |
41 | rtems_task cwf1_task(rtems_task_argument argument); |
|
40 | rtems_task cwf1_task(rtems_task_argument argument); | |
42 |
|
41 | |||
43 | //****************** |
|
42 | //****************** | |
44 | // general functions |
|
43 | // general functions | |
45 | void init_waveforms( void ); |
|
44 | void init_waveforms( void ); | |
46 | // |
|
45 | // | |
47 |
int init_header_snapshot_wf_table( |
|
46 | int init_header_snapshot_wf_table(unsigned int sid , Header_TM_LFR_SCIENCE_SWF_t *headerSWF); | |
48 | int init_header_continuous_wf_table(unsigned int sid , Header_TM_LFR_SCIENCE_CWF_t *headerCWF); |
|
47 | int init_header_continuous_wf_table(unsigned int sid , Header_TM_LFR_SCIENCE_CWF_t *headerCWF); | |
49 | // |
|
48 | // | |
50 | void reset_waveforms( void ); |
|
49 | void reset_waveforms( void ); | |
51 |
|
50 | |||
52 | int send_waveform_SWF(volatile int *waveform, unsigned int sid); |
|
51 | int send_waveform_SWF(volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF); | |
53 | int send_waveform_CWF(volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF); |
|
52 | int send_waveform_CWF(volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF); | |
54 |
|
53 | |||
55 | //************** |
|
54 | //************** | |
56 | // wfp registers |
|
55 | // wfp registers | |
57 | void set_wfp_data_shaping(); |
|
56 | void set_wfp_data_shaping(); | |
58 | char set_wfp_delta_snapshot(); |
|
57 | char set_wfp_delta_snapshot(); | |
59 | void set_wfp_burst_enable_register( unsigned char mode); |
|
58 | void set_wfp_burst_enable_register( unsigned char mode); | |
60 | void reset_wfp_burst_enable(); |
|
59 | void reset_wfp_burst_enable(); | |
61 | void reset_wfp_status(); |
|
60 | void reset_wfp_status(); | |
62 | void reset_waveform_picker_regs(); |
|
61 | void reset_waveform_picker_regs(); | |
63 |
|
62 | |||
64 | //***************** |
|
63 | //***************** | |
65 | // local parameters |
|
64 | // local parameters | |
66 | void set_local_sbm1_nb_cwf_max(); |
|
65 | void set_local_sbm1_nb_cwf_max(); | |
67 | void set_local_sbm2_nb_cwf_max(); |
|
66 | void set_local_sbm2_nb_cwf_max(); | |
68 | void set_local_nb_interrupt_f0_MAX(); |
|
67 | void set_local_nb_interrupt_f0_MAX(); | |
69 | void reset_local_sbm1_nb_cwf_sent(); |
|
68 | void reset_local_sbm1_nb_cwf_sent(); | |
70 | void reset_local_sbm2_nb_cwf_sent(); |
|
69 | void reset_local_sbm2_nb_cwf_sent(); | |
71 |
|
70 | |||
72 | #endif // WF_HANDLER_H_INCLUDED |
|
71 | #endif // WF_HANDLER_H_INCLUDED |
@@ -1,69 +1,72 | |||||
1 | //#include <fsw_processing.h> |
|
1 | //#include <fsw_processing.h> | |
2 | #include <rtems.h> |
|
2 | #include <rtems.h> | |
3 | #include <grspw.h> |
|
3 | #include <grspw.h> | |
4 | #include <ccsds_types.h> |
|
4 | #include <ccsds_types.h> | |
5 | #include <grlib_regs.h> |
|
5 | #include <grlib_regs.h> | |
6 | #include <fsw_params.h> |
|
6 | #include <fsw_params.h> | |
7 |
|
7 | |||
8 | // RTEMS GLOBAL VARIABLES |
|
8 | // RTEMS GLOBAL VARIABLES | |
9 | rtems_name misc_name[5]; |
|
9 | rtems_name misc_name[5]; | |
10 | rtems_name misc_id[5]; |
|
10 | rtems_name misc_id[5]; | |
11 | rtems_id Task_id[20]; /* array of task ids */ |
|
11 | rtems_id Task_id[20]; /* array of task ids */ | |
12 | rtems_name Task_name[20]; /* array of task names */ |
|
12 | rtems_name Task_name[20]; /* array of task names */ | |
|
13 | unsigned int maxCount; | |||
13 | int fdSPW = 0; |
|
14 | int fdSPW = 0; | |
14 | int fdUART = 0; |
|
15 | int fdUART = 0; | |
15 | unsigned char lfrCurrentMode; |
|
16 | unsigned char lfrCurrentMode; | |
16 |
|
17 | |||
17 | // APB CONFIGURATION REGISTERS |
|
18 | // APB CONFIGURATION REGISTERS | |
18 | time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT; |
|
19 | time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT; | |
19 | gptimer_regs_t *gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER; |
|
20 | gptimer_regs_t *gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER; | |
20 | #ifdef GSA |
|
21 | #ifdef GSA | |
21 | #else |
|
22 | #else | |
22 | waveform_picker_regs_t *waveform_picker_regs = (waveform_picker_regs_t*) REGS_ADDR_WAVEFORM_PICKER; |
|
23 | waveform_picker_regs_t *waveform_picker_regs = (waveform_picker_regs_t*) REGS_ADDR_WAVEFORM_PICKER; | |
23 | #endif |
|
24 | #endif | |
24 | spectral_matrix_regs_t *spectral_matrix_regs = (spectral_matrix_regs_t*) REGS_ADDR_SPECTRAL_MATRIX; |
|
25 | spectral_matrix_regs_t *spectral_matrix_regs = (spectral_matrix_regs_t*) REGS_ADDR_SPECTRAL_MATRIX; | |
25 |
|
26 | |||
26 | // WAVEFORMS GLOBAL VARIABLES // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes |
|
27 | // WAVEFORMS GLOBAL VARIABLES // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes | |
27 | volatile int wf_snap_f0[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET]; |
|
28 | volatile int wf_snap_f0[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET]; | |
28 | // |
|
29 | // | |
29 | volatile int wf_snap_f1[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET]; |
|
30 | volatile int wf_snap_f1[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET]; | |
30 | volatile int wf_snap_f1_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET]; |
|
31 | volatile int wf_snap_f1_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET]; | |
31 | volatile int wf_snap_f1_norm[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET]; |
|
32 | volatile int wf_snap_f1_norm[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET]; | |
32 | // |
|
33 | // | |
33 | volatile int wf_snap_f2[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET]; |
|
34 | volatile int wf_snap_f2[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET]; | |
34 | volatile int wf_snap_f2_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET]; |
|
35 | volatile int wf_snap_f2_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET]; | |
35 | volatile int wf_snap_f2_norm[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET]; |
|
36 | volatile int wf_snap_f2_norm[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET]; | |
36 | // |
|
37 | // | |
37 | volatile int wf_cont_f3[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET]; |
|
38 | volatile int wf_cont_f3[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET]; | |
38 | volatile int wf_cont_f3_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET]; |
|
39 | volatile int wf_cont_f3_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET]; | |
39 |
|
40 | |||
40 | // SPECTRAL MATRICES GLOBAL VARIABLES |
|
41 | // SPECTRAL MATRICES GLOBAL VARIABLES | |
41 | volatile int spec_mat_f0_0[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
42 | volatile int spec_mat_f0_0[ SM_HEADER + TOTAL_SIZE_SM ]; | |
42 | volatile int spec_mat_f0_1[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
43 | volatile int spec_mat_f0_1[ SM_HEADER + TOTAL_SIZE_SM ]; | |
|
44 | volatile int spec_mat_f0_a[ SM_HEADER + TOTAL_SIZE_SM ]; | |||
|
45 | volatile int spec_mat_f0_b[ SM_HEADER + TOTAL_SIZE_SM ]; | |||
43 | volatile int spec_mat_f0_c[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
46 | volatile int spec_mat_f0_c[ SM_HEADER + TOTAL_SIZE_SM ]; | |
44 | volatile int spec_mat_f0_d[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
47 | volatile int spec_mat_f0_d[ SM_HEADER + TOTAL_SIZE_SM ]; | |
45 | volatile int spec_mat_f0_e[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
48 | volatile int spec_mat_f0_e[ SM_HEADER + TOTAL_SIZE_SM ]; | |
46 | volatile int spec_mat_f0_f[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
49 | volatile int spec_mat_f0_f[ SM_HEADER + TOTAL_SIZE_SM ]; | |
47 | volatile int spec_mat_f0_g[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
50 | volatile int spec_mat_f0_g[ SM_HEADER + TOTAL_SIZE_SM ]; | |
48 | volatile int spec_mat_f0_h[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
51 | volatile int spec_mat_f0_h[ SM_HEADER + TOTAL_SIZE_SM ]; | |
49 | volatile int spec_mat_f0_0_bis[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
52 | volatile int spec_mat_f0_0_bis[ SM_HEADER + TOTAL_SIZE_SM ]; | |
50 | volatile int spec_mat_f0_1_bis[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
53 | volatile int spec_mat_f0_1_bis[ SM_HEADER + TOTAL_SIZE_SM ]; | |
51 | // |
|
54 | // | |
52 | volatile int spec_mat_f1[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
55 | volatile int spec_mat_f1[ SM_HEADER + TOTAL_SIZE_SM ]; | |
53 | volatile int spec_mat_f1_bis[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
56 | volatile int spec_mat_f1_bis[ SM_HEADER + TOTAL_SIZE_SM ]; | |
54 | // |
|
57 | // | |
55 | volatile int spec_mat_f2[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
58 | volatile int spec_mat_f2[ SM_HEADER + TOTAL_SIZE_SM ]; | |
56 | volatile int spec_mat_f2_bis[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
59 | volatile int spec_mat_f2_bis[ SM_HEADER + TOTAL_SIZE_SM ]; | |
57 |
|
60 | |||
58 | // MODE PARAMETERS |
|
61 | // MODE PARAMETERS | |
59 | Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet; |
|
62 | Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet; | |
60 | struct param_local_str param_local; |
|
63 | struct param_local_str param_local; | |
61 |
|
64 | |||
62 | // HK PACKETS |
|
65 | // HK PACKETS | |
63 | Packet_TM_LFR_HK_t housekeeping_packet; |
|
66 | Packet_TM_LFR_HK_t housekeeping_packet; | |
64 | // sequence counters are incremented by APID (PID + CAT) and destination ID |
|
67 | // sequence counters are incremented by APID (PID + CAT) and destination ID | |
65 | unsigned short sequenceCounters[SEQ_CNT_NB_PID][SEQ_CNT_NB_CAT][SEQ_CNT_NB_DEST_ID]; |
|
68 | unsigned short sequenceCounters[SEQ_CNT_NB_PID][SEQ_CNT_NB_CAT][SEQ_CNT_NB_DEST_ID]; | |
66 | spw_stats spacewire_stats; |
|
69 | spw_stats spacewire_stats; | |
67 | spw_stats spacewire_stats_backup; |
|
70 | spw_stats spacewire_stats_backup; | |
68 |
|
71 | |||
69 |
|
72 |
@@ -1,437 +1,451 | |||||
1 | //************************* |
|
1 | //************************* | |
2 | // GPL reminder to be added |
|
2 | // GPL reminder to be added | |
3 | //************************* |
|
3 | //************************* | |
4 |
|
4 | |||
5 | #include <rtems.h> |
|
5 | #include <rtems.h> | |
6 |
|
6 | |||
7 | /* configuration information */ |
|
7 | /* configuration information */ | |
8 |
|
8 | |||
9 | #define CONFIGURE_INIT |
|
9 | #define CONFIGURE_INIT | |
10 |
|
10 | |||
11 | #include <bsp.h> /* for device driver prototypes */ |
|
11 | #include <bsp.h> /* for device driver prototypes */ | |
12 |
|
12 | |||
13 | /* configuration information */ |
|
13 | /* configuration information */ | |
14 |
|
14 | |||
15 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
|
15 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER | |
16 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
|
16 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER | |
17 |
|
17 | |||
18 | #define CONFIGURE_MAXIMUM_TASKS 20 |
|
18 | #define CONFIGURE_MAXIMUM_TASKS 20 | |
19 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
|
19 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE | |
20 | #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE) |
|
20 | #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE) | |
21 | #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32 |
|
21 | #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32 | |
22 |
#define CONFIGURE_INIT_TASK_PRIORITY |
|
22 | #define CONFIGURE_INIT_TASK_PRIORITY 1 // instead of 100 | |
|
23 | #define CONFIGURE_INIT_TASK_MODE (RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT) | |||
23 | #define CONFIGURE_MAXIMUM_DRIVERS 16 |
|
24 | #define CONFIGURE_MAXIMUM_DRIVERS 16 | |
24 | #define CONFIGURE_MAXIMUM_PERIODS 5 |
|
25 | #define CONFIGURE_MAXIMUM_PERIODS 5 | |
|
26 | #define CONFIGURE_MAXIMUM_TIMERS 5 | |||
25 | #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 2 |
|
27 | #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 2 | |
|
28 | #ifdef PRINT_STACK_REPORT | |||
|
29 | #define CONFIGURE_STACK_CHECKER_ENABLED | |||
|
30 | #endif | |||
26 |
|
31 | |||
27 | #include <rtems/confdefs.h> |
|
32 | #include <rtems/confdefs.h> | |
28 |
|
33 | |||
29 | /* If --drvmgr was enabled during the configuration of the RTEMS kernel */ |
|
34 | /* If --drvmgr was enabled during the configuration of the RTEMS kernel */ | |
30 | #ifdef RTEMS_DRVMGR_STARTUP |
|
35 | #ifdef RTEMS_DRVMGR_STARTUP | |
31 | #ifdef LEON3 |
|
36 | #ifdef LEON3 | |
32 | /* Add Timer and UART Driver */ |
|
37 | /* Add Timer and UART Driver */ | |
33 | #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
|
38 | #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER | |
34 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER |
|
39 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER | |
35 | #endif |
|
40 | #endif | |
36 | #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
|
41 | #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER | |
37 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART |
|
42 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART | |
38 | #endif |
|
43 | #endif | |
39 | #endif |
|
44 | #endif | |
40 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */ |
|
45 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */ | |
41 | #include <drvmgr/drvmgr_confdefs.h> |
|
46 | #include <drvmgr/drvmgr_confdefs.h> | |
42 | #endif |
|
47 | #endif | |
43 |
|
48 | |||
44 | #include <fsw_init.h> |
|
49 | #include <fsw_init.h> | |
45 | #include <fsw_config.c> |
|
50 | #include <fsw_config.c> | |
46 |
|
51 | |||
47 | rtems_task Init( rtems_task_argument ignored ) |
|
52 | rtems_task Init( rtems_task_argument ignored ) | |
48 | { |
|
53 | { | |
49 | rtems_status_code status; |
|
54 | rtems_status_code status; | |
50 | rtems_isr_entry old_isr_handler; |
|
55 | rtems_isr_entry old_isr_handler; | |
51 |
|
56 | |||
52 | PRINTF("\n\n\n\n\n") |
|
57 | PRINTF("\n\n\n\n\n") | |
53 | PRINTF("***************************\n") |
|
58 | PRINTF("***************************\n") | |
54 | PRINTF("** START Flight Software **\n") |
|
59 | PRINTF("** START Flight Software **\n") | |
55 | PRINTF("***************************\n") |
|
60 | PRINTF("***************************\n") | |
56 | PRINTF("\n\n") |
|
61 | PRINTF("\n\n") | |
57 |
|
62 | |||
58 | //send_console_outputs_on_apbuart_port(); |
|
63 | //send_console_outputs_on_apbuart_port(); | |
59 | set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE); |
|
64 | set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE); | |
60 |
|
65 | |||
61 | initLookUpTableForCRC(); // in tc_handler.h |
|
66 | initLookUpTableForCRC(); // in tc_handler.h | |
62 | init_parameter_dump(); |
|
67 | init_parameter_dump(); | |
63 | init_local_mode_parameters(); |
|
68 | init_local_mode_parameters(); | |
64 | init_housekeeping_parameters(); |
|
69 | init_housekeeping_parameters(); | |
|
70 | ||||
|
71 | create_names(); // create all names | |||
|
72 | ||||
65 | create_message_queues(); |
|
73 | create_message_queues(); | |
66 |
|
74 | |||
67 | create_names(); // create all names |
|
|||
68 | create_all_tasks(); // create all tasks |
|
75 | create_all_tasks(); // create all tasks | |
69 |
|
76 | |||
70 | start_all_tasks(); // start all tasks |
|
77 | start_all_tasks(); // start all tasks | |
|
78 | ||||
71 | stop_current_mode(); // go in STANDBY mode |
|
79 | stop_current_mode(); // go in STANDBY mode | |
72 |
|
80 | |||
73 | grspw_timecode_callback = &timecode_irq_handler; |
|
81 | grspw_timecode_callback = &timecode_irq_handler; | |
74 |
|
82 | |||
75 | spacewire_configure_link(); |
|
83 | spacewire_configure_link(); | |
76 |
|
84 | |||
77 | #ifdef GSA |
|
85 | #ifdef GSA | |
|
86 | // mask IRQ lines | |||
|
87 | LEON_Mask_interrupt( IRQ_SM ); | |||
|
88 | LEON_Mask_interrupt( IRQ_WF ); | |||
78 | // Spectral Matrices simulator |
|
89 | // Spectral Matrices simulator | |
79 | configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR, |
|
90 | configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR, | |
80 | IRQ_SPARC_SM, spectral_matrices_isr ); |
|
91 | IRQ_SPARC_SM, spectral_matrices_isr ); | |
81 | // WaveForms |
|
92 | // WaveForms | |
82 | configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR, CLKDIV_WF_SIMULATOR, |
|
93 | configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR, CLKDIV_WF_SIMULATOR, | |
83 | IRQ_SPARC_WF, waveforms_simulator_isr ); |
|
94 | IRQ_SPARC_WF, waveforms_simulator_isr ); | |
84 | LEON_Mask_interrupt( IRQ_SM ); |
|
|||
85 | LEON_Mask_interrupt( IRQ_WF ); |
|
|||
86 | #else |
|
95 | #else | |
|
96 | // mask IRQ lines | |||
|
97 | LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); | |||
|
98 | LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); | |||
87 | // reset configuration registers |
|
99 | // reset configuration registers | |
88 | reset_waveform_picker_regs(); |
|
100 | reset_waveform_picker_regs(); | |
89 | reset_spectral_matrix_regs(); |
|
101 | reset_spectral_matrix_regs(); | |
90 | // configure IRQ handling for the waveform picker unit |
|
102 | // configure IRQ handling for the waveform picker unit | |
91 | status = rtems_interrupt_catch( waveforms_isr, |
|
103 | status = rtems_interrupt_catch( waveforms_isr, | |
92 | IRQ_SPARC_WAVEFORM_PICKER, |
|
104 | IRQ_SPARC_WAVEFORM_PICKER, | |
93 | &old_isr_handler) ; |
|
105 | &old_isr_handler) ; | |
94 | // configure IRQ handling for the spectral matrix unit |
|
106 | // configure IRQ handling for the spectral matrix unit | |
95 | status = rtems_interrupt_catch( spectral_matrices_isr, |
|
107 | // status = rtems_interrupt_catch( spectral_matrices_isr, | |
96 | IRQ_SPARC_SPECTRAL_MATRIX, |
|
108 | // IRQ_SPARC_SPECTRAL_MATRIX, | |
97 | &old_isr_handler) ; |
|
109 | // &old_isr_handler) ; | |
98 | // mask IRQ lines |
|
110 | // Spectral Matrices simulator | |
99 | LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); |
|
111 | configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR, | |
100 | LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); |
|
112 | IRQ_SPARC_SM, spectral_matrices_isr_simu ); | |
101 | #endif |
|
113 | #endif | |
102 |
|
114 | |||
|
115 | PRINTF("delete INIT\n") | |||
|
116 | ||||
103 | status = rtems_task_delete(RTEMS_SELF); |
|
117 | status = rtems_task_delete(RTEMS_SELF); | |
104 |
|
118 | |||
105 | } |
|
119 | } | |
106 |
|
120 | |||
107 | void init_parameter_dump(void) |
|
121 | void init_parameter_dump( void ) | |
108 | { |
|
122 | { | |
109 | parameter_dump_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
123 | parameter_dump_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; | |
110 | parameter_dump_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
124 | parameter_dump_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
111 | parameter_dump_packet.reserved = CCSDS_RESERVED; |
|
125 | parameter_dump_packet.reserved = CCSDS_RESERVED; | |
112 | parameter_dump_packet.userApplication = CCSDS_USER_APP; |
|
126 | parameter_dump_packet.userApplication = CCSDS_USER_APP; | |
113 | parameter_dump_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_PARAMETER_DUMP >> 8); |
|
127 | parameter_dump_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_PARAMETER_DUMP >> 8); | |
114 | parameter_dump_packet.packetID[1] = (unsigned char) TM_PACKET_ID_PARAMETER_DUMP; |
|
128 | parameter_dump_packet.packetID[1] = (unsigned char) TM_PACKET_ID_PARAMETER_DUMP; | |
115 | parameter_dump_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
129 | parameter_dump_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
116 | parameter_dump_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
130 | parameter_dump_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
117 | parameter_dump_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_PARAMETER_DUMP >> 8); |
|
131 | parameter_dump_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_PARAMETER_DUMP >> 8); | |
118 | parameter_dump_packet.packetLength[1] = (unsigned char) PACKET_LENGTH_PARAMETER_DUMP; |
|
132 | parameter_dump_packet.packetLength[1] = (unsigned char) PACKET_LENGTH_PARAMETER_DUMP; | |
119 | // DATA FIELD HEADER |
|
133 | // DATA FIELD HEADER | |
120 | parameter_dump_packet.spare1_pusVersion_spare2 = SPARE1_PUSVERSION_SPARE2; |
|
134 | parameter_dump_packet.spare1_pusVersion_spare2 = SPARE1_PUSVERSION_SPARE2; | |
121 | parameter_dump_packet.serviceType = TM_TYPE_PARAMETER_DUMP; |
|
135 | parameter_dump_packet.serviceType = TM_TYPE_PARAMETER_DUMP; | |
122 | parameter_dump_packet.serviceSubType = TM_SUBTYPE_PARAMETER_DUMP; |
|
136 | parameter_dump_packet.serviceSubType = TM_SUBTYPE_PARAMETER_DUMP; | |
123 | parameter_dump_packet.destinationID = TM_DESTINATION_ID_GROUND; |
|
137 | parameter_dump_packet.destinationID = TM_DESTINATION_ID_GROUND; | |
124 | parameter_dump_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
138 | parameter_dump_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
125 | parameter_dump_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
139 | parameter_dump_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
126 | parameter_dump_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
140 | parameter_dump_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
127 | parameter_dump_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
141 | parameter_dump_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); | |
128 | parameter_dump_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
142 | parameter_dump_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
129 | parameter_dump_packet.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
143 | parameter_dump_packet.time[5] = (unsigned char) (time_management_regs->fine_time); | |
130 | parameter_dump_packet.sid = SID_PARAMETER_DUMP; |
|
144 | parameter_dump_packet.sid = SID_PARAMETER_DUMP; | |
131 |
|
145 | |||
132 | //****************** |
|
146 | //****************** | |
133 | // COMMON PARAMETERS |
|
147 | // COMMON PARAMETERS | |
134 | parameter_dump_packet.unused0 = DEFAULT_SY_LFR_COMMON0; |
|
148 | parameter_dump_packet.unused0 = DEFAULT_SY_LFR_COMMON0; | |
135 | parameter_dump_packet.bw_sp0_sp1_r0_r1 = DEFAULT_SY_LFR_COMMON1; |
|
149 | parameter_dump_packet.bw_sp0_sp1_r0_r1 = DEFAULT_SY_LFR_COMMON1; | |
136 |
|
150 | |||
137 | //****************** |
|
151 | //****************** | |
138 | // NORMAL PARAMETERS |
|
152 | // NORMAL PARAMETERS | |
139 | parameter_dump_packet.sy_lfr_n_swf_l[0] = (unsigned char) (DEFAULT_SY_LFR_N_SWF_L >> 8); |
|
153 | parameter_dump_packet.sy_lfr_n_swf_l[0] = (unsigned char) (DEFAULT_SY_LFR_N_SWF_L >> 8); | |
140 | parameter_dump_packet.sy_lfr_n_swf_l[1] = (unsigned char) (DEFAULT_SY_LFR_N_SWF_L ); |
|
154 | parameter_dump_packet.sy_lfr_n_swf_l[1] = (unsigned char) (DEFAULT_SY_LFR_N_SWF_L ); | |
141 | parameter_dump_packet.sy_lfr_n_swf_p[0] = (unsigned char) (DEFAULT_SY_LFR_N_SWF_P >> 8); |
|
155 | parameter_dump_packet.sy_lfr_n_swf_p[0] = (unsigned char) (DEFAULT_SY_LFR_N_SWF_P >> 8); | |
142 | parameter_dump_packet.sy_lfr_n_swf_p[1] = (unsigned char) (DEFAULT_SY_LFR_N_SWF_P ); |
|
156 | parameter_dump_packet.sy_lfr_n_swf_p[1] = (unsigned char) (DEFAULT_SY_LFR_N_SWF_P ); | |
143 | parameter_dump_packet.sy_lfr_n_asm_p[0] = (unsigned char) (DEFAULT_SY_LFR_N_ASM_P >> 8); |
|
157 | parameter_dump_packet.sy_lfr_n_asm_p[0] = (unsigned char) (DEFAULT_SY_LFR_N_ASM_P >> 8); | |
144 | parameter_dump_packet.sy_lfr_n_asm_p[1] = (unsigned char) (DEFAULT_SY_LFR_N_ASM_P ); |
|
158 | parameter_dump_packet.sy_lfr_n_asm_p[1] = (unsigned char) (DEFAULT_SY_LFR_N_ASM_P ); | |
145 | parameter_dump_packet.sy_lfr_n_bp_p0 = (unsigned char) DEFAULT_SY_LFR_N_BP_P0; |
|
159 | parameter_dump_packet.sy_lfr_n_bp_p0 = (unsigned char) DEFAULT_SY_LFR_N_BP_P0; | |
146 | parameter_dump_packet.sy_lfr_n_bp_p1 = (unsigned char) DEFAULT_SY_LFR_N_BP_P1; |
|
160 | parameter_dump_packet.sy_lfr_n_bp_p1 = (unsigned char) DEFAULT_SY_LFR_N_BP_P1; | |
147 |
|
161 | |||
148 | //***************** |
|
162 | //***************** | |
149 | // BURST PARAMETERS |
|
163 | // BURST PARAMETERS | |
150 | parameter_dump_packet.sy_lfr_b_bp_p0 = (unsigned char) DEFAULT_SY_LFR_B_BP_P0; |
|
164 | parameter_dump_packet.sy_lfr_b_bp_p0 = (unsigned char) DEFAULT_SY_LFR_B_BP_P0; | |
151 | parameter_dump_packet.sy_lfr_b_bp_p1 = (unsigned char) DEFAULT_SY_LFR_B_BP_P1; |
|
165 | parameter_dump_packet.sy_lfr_b_bp_p1 = (unsigned char) DEFAULT_SY_LFR_B_BP_P1; | |
152 |
|
166 | |||
153 | //**************** |
|
167 | //**************** | |
154 | // SBM1 PARAMETERS |
|
168 | // SBM1 PARAMETERS | |
155 | parameter_dump_packet.sy_lfr_s1_bp_p0 = (unsigned char) DEFAULT_SY_LFR_S1_BP_P0; // min value is 0.25 s for the period |
|
169 | parameter_dump_packet.sy_lfr_s1_bp_p0 = (unsigned char) DEFAULT_SY_LFR_S1_BP_P0; // min value is 0.25 s for the period | |
156 | parameter_dump_packet.sy_lfr_s1_bp_p1 = (unsigned char) DEFAULT_SY_LFR_S1_BP_P1; |
|
170 | parameter_dump_packet.sy_lfr_s1_bp_p1 = (unsigned char) DEFAULT_SY_LFR_S1_BP_P1; | |
157 |
|
171 | |||
158 | //**************** |
|
172 | //**************** | |
159 | // SBM2 PARAMETERS |
|
173 | // SBM2 PARAMETERS | |
160 | parameter_dump_packet.sy_lfr_s2_bp_p0 = (unsigned char) DEFAULT_SY_LFR_S2_BP_P0; |
|
174 | parameter_dump_packet.sy_lfr_s2_bp_p0 = (unsigned char) DEFAULT_SY_LFR_S2_BP_P0; | |
161 | parameter_dump_packet.sy_lfr_s2_bp_p1 = (unsigned char) DEFAULT_SY_LFR_S2_BP_P1; |
|
175 | parameter_dump_packet.sy_lfr_s2_bp_p1 = (unsigned char) DEFAULT_SY_LFR_S2_BP_P1; | |
162 | } |
|
176 | } | |
163 |
|
177 | |||
164 | void init_local_mode_parameters(void) |
|
178 | void init_local_mode_parameters( void ) | |
165 | { |
|
179 | { | |
166 | // LOCAL PARAMETERS |
|
180 | // LOCAL PARAMETERS | |
167 | set_local_sbm1_nb_cwf_max(); |
|
181 | set_local_sbm1_nb_cwf_max(); | |
168 | set_local_sbm2_nb_cwf_max(); |
|
182 | set_local_sbm2_nb_cwf_max(); | |
169 | set_local_nb_interrupt_f0_MAX(); |
|
183 | set_local_nb_interrupt_f0_MAX(); | |
170 |
|
184 | |||
171 | PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max) |
|
185 | PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max) | |
172 | PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max) |
|
186 | PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max) | |
173 | PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX) |
|
187 | PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX) | |
174 |
|
188 | |||
175 | reset_local_sbm1_nb_cwf_sent(); |
|
189 | reset_local_sbm1_nb_cwf_sent(); | |
176 | reset_local_sbm2_nb_cwf_sent(); |
|
190 | reset_local_sbm2_nb_cwf_sent(); | |
177 | } |
|
191 | } | |
178 |
|
192 | |||
179 | void init_housekeeping_parameters(void) |
|
193 | void init_housekeeping_parameters( void ) | |
180 | { |
|
194 | { | |
181 | unsigned int i = 0; |
|
195 | unsigned int i = 0; | |
182 | unsigned int j = 0; |
|
196 | unsigned int j = 0; | |
183 | unsigned int k = 0; |
|
197 | unsigned int k = 0; | |
184 | char *parameters; |
|
198 | char *parameters; | |
185 |
|
199 | |||
186 | parameters = (char*) &housekeeping_packet.lfr_status_word; |
|
200 | parameters = (char*) &housekeeping_packet.lfr_status_word; | |
187 | for(i = 0; i< SIZE_HK_PARAMETERS; i++) |
|
201 | for(i = 0; i< SIZE_HK_PARAMETERS; i++) | |
188 | { |
|
202 | { | |
189 | parameters[i] = 0x00; |
|
203 | parameters[i] = 0x00; | |
190 | } |
|
204 | } | |
191 | // init status word |
|
205 | // init status word | |
192 | housekeeping_packet.lfr_status_word[0] = 0x00; |
|
206 | housekeeping_packet.lfr_status_word[0] = 0x00; | |
193 | housekeeping_packet.lfr_status_word[1] = 0x00; |
|
207 | housekeeping_packet.lfr_status_word[1] = 0x00; | |
194 | // init software version |
|
208 | // init software version | |
195 | housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1; |
|
209 | housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1; | |
196 | housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2; |
|
210 | housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2; | |
197 | housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3; |
|
211 | housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3; | |
198 | housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4; |
|
212 | housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4; | |
199 | // init sequence counters |
|
213 | // init sequence counters | |
200 | for (i = 0; i<SEQ_CNT_NB_PID; i++) |
|
214 | for (i = 0; i<SEQ_CNT_NB_PID; i++) | |
201 | { |
|
215 | { | |
202 | for(j = 0; j<SEQ_CNT_NB_CAT; j++) |
|
216 | for(j = 0; j<SEQ_CNT_NB_CAT; j++) | |
203 | { |
|
217 | { | |
204 | for(k = 0; k<SEQ_CNT_NB_DEST_ID; k++) |
|
218 | for(k = 0; k<SEQ_CNT_NB_DEST_ID; k++) | |
205 | { |
|
219 | { | |
206 | sequenceCounters[i][j][k] = 0x00; |
|
220 | sequenceCounters[i][j][k] = 0x00; | |
207 | } |
|
221 | } | |
208 | } |
|
222 | } | |
209 | } |
|
223 | } | |
210 | updateLFRCurrentMode(); |
|
224 | updateLFRCurrentMode(); | |
211 | } |
|
225 | } | |
212 |
|
226 | |||
213 | int create_names( void ) |
|
227 | int create_names( void ) | |
214 | { |
|
228 | { | |
215 | // task names |
|
229 | // task names | |
216 | Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' ); |
|
230 | Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' ); | |
217 | Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' ); |
|
231 | Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' ); | |
218 | Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' ); |
|
232 | Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' ); | |
219 | Task_name[TASKID_SMIQ] = rtems_build_name( 'S', 'M', 'I', 'Q' ); |
|
233 | Task_name[TASKID_SMIQ] = rtems_build_name( 'S', 'M', 'I', 'Q' ); | |
220 | Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' ); |
|
234 | Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' ); | |
221 | Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' ); |
|
235 | Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' ); | |
222 | Task_name[TASKID_BPF0] = rtems_build_name( 'B', 'P', 'F', '0' ); |
|
236 | Task_name[TASKID_BPF0] = rtems_build_name( 'B', 'P', 'F', '0' ); | |
223 | Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' ); |
|
237 | Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' ); | |
224 | Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' ); |
|
238 | Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' ); | |
225 | Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' ); |
|
239 | Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' ); | |
226 | Task_name[TASKID_MATR] = rtems_build_name( 'M', 'A', 'T', 'R' ); |
|
240 | Task_name[TASKID_MATR] = rtems_build_name( 'M', 'A', 'T', 'R' ); | |
227 | Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' ); |
|
241 | Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' ); | |
228 | Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' ); |
|
242 | Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' ); | |
229 | Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' ); |
|
243 | Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' ); | |
230 | Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' ); |
|
244 | Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' ); | |
231 |
|
245 | |||
232 | // rate monotonic period name |
|
246 | // rate monotonic period name | |
233 | HK_name = rtems_build_name( 'H', 'O', 'U', 'S' ); |
|
247 | HK_name = rtems_build_name( 'H', 'O', 'U', 'S' ); | |
234 |
|
248 | |||
|
249 | misc_name[QUEUE_QUEU] = rtems_build_name( 'Q', 'U', 'E', 'U' ); | |||
|
250 | misc_name[QUEUE_PKTS] = rtems_build_name( 'P', 'K', 'T', 'S' ); | |||
|
251 | ||||
235 | return 0; |
|
252 | return 0; | |
236 | } |
|
253 | } | |
237 |
|
254 | |||
238 | int create_all_tasks( void ) |
|
255 | int create_all_tasks( void ) | |
239 | { |
|
256 | { | |
240 | rtems_status_code status; |
|
257 | rtems_status_code status; | |
241 |
|
258 | |||
242 | // RECV |
|
259 | // RECV | |
243 | status = rtems_task_create( |
|
260 | status = rtems_task_create( | |
244 |
Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE |
|
261 | Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE, | |
245 | RTEMS_DEFAULT_MODES, |
|
262 | RTEMS_DEFAULT_MODES, | |
246 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV] |
|
263 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV] | |
247 | ); |
|
264 | ); | |
248 | // ACTN |
|
265 | // ACTN | |
249 | status = rtems_task_create( |
|
266 | status = rtems_task_create( | |
250 |
Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE |
|
267 | Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE, | |
251 | RTEMS_DEFAULT_MODES, |
|
268 | RTEMS_DEFAULT_MODES, | |
252 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_ACTN] |
|
269 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN] | |
253 | ); |
|
270 | ); | |
254 | // SPIQ |
|
271 | // SPIQ | |
255 | status = rtems_task_create( |
|
272 | status = rtems_task_create( | |
256 |
Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE |
|
273 | Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE, | |
257 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
274 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, | |
258 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ] |
|
275 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ] | |
259 | ); |
|
276 | ); | |
260 | // SMIQ |
|
277 | // SMIQ | |
261 | status = rtems_task_create( |
|
278 | status = rtems_task_create( | |
262 |
Task_name[TASKID_SMIQ], TASK_PRIORITY_SMIQ, RTEMS_MINIMUM_STACK_SIZE |
|
279 | Task_name[TASKID_SMIQ], TASK_PRIORITY_SMIQ, RTEMS_MINIMUM_STACK_SIZE, | |
263 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
280 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, | |
264 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SMIQ] |
|
281 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SMIQ] | |
265 | ); |
|
282 | ); | |
266 | // STAT |
|
283 | // STAT | |
267 | status = rtems_task_create( |
|
284 | status = rtems_task_create( | |
268 |
Task_name[TASKID_STAT], TASK_PRIORITY_STAT, RTEMS_MINIMUM_STACK_SIZE |
|
285 | Task_name[TASKID_STAT], TASK_PRIORITY_STAT, RTEMS_MINIMUM_STACK_SIZE, | |
269 | RTEMS_DEFAULT_MODES, |
|
286 | RTEMS_DEFAULT_MODES, | |
270 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT] |
|
287 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT] | |
271 | ); |
|
288 | ); | |
272 | // AVF0 |
|
289 | // AVF0 | |
273 | status = rtems_task_create( |
|
290 | status = rtems_task_create( | |
274 |
Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE |
|
291 | Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE, | |
275 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
292 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, | |
276 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0] |
|
293 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0] | |
277 | ); |
|
294 | ); | |
278 | // BPF0 |
|
295 | // BPF0 | |
279 | status = rtems_task_create( |
|
296 | status = rtems_task_create( | |
280 |
Task_name[TASKID_BPF0], TASK_PRIORITY_BPF0, RTEMS_MINIMUM_STACK_SIZE |
|
297 | Task_name[TASKID_BPF0], TASK_PRIORITY_BPF0, RTEMS_MINIMUM_STACK_SIZE, | |
281 | RTEMS_DEFAULT_MODES, |
|
298 | RTEMS_DEFAULT_MODES, | |
282 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_BPF0] |
|
299 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_BPF0] | |
283 | ); |
|
300 | ); | |
284 | // WFRM |
|
301 | // WFRM | |
285 | status = rtems_task_create( |
|
302 | status = rtems_task_create( | |
286 |
Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE |
|
303 | Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE, | |
287 | RTEMS_DEFAULT_MODES, |
|
304 | RTEMS_DEFAULT_MODES, | |
288 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM] |
|
305 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM] | |
289 | ); |
|
306 | ); | |
290 | // DUMB |
|
307 | // DUMB | |
291 | status = rtems_task_create( |
|
308 | status = rtems_task_create( | |
292 |
Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE |
|
309 | Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE, | |
293 | RTEMS_DEFAULT_MODES, |
|
310 | RTEMS_DEFAULT_MODES, | |
294 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB] |
|
311 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB] | |
295 | ); |
|
312 | ); | |
296 | // HOUS |
|
313 | // HOUS | |
297 | status = rtems_task_create( |
|
314 | status = rtems_task_create( | |
298 |
Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE |
|
315 | Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE, | |
299 | RTEMS_DEFAULT_MODES, |
|
316 | RTEMS_DEFAULT_MODES, | |
300 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS] |
|
317 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS] | |
301 | ); |
|
318 | ); | |
302 | // MATR |
|
319 | // MATR | |
303 | status = rtems_task_create( |
|
320 | status = rtems_task_create( | |
304 |
Task_name[TASKID_MATR], TASK_PRIORITY_MATR, RTEMS_MINIMUM_STACK_SIZE |
|
321 | Task_name[TASKID_MATR], TASK_PRIORITY_MATR, RTEMS_MINIMUM_STACK_SIZE, | |
305 | RTEMS_DEFAULT_MODES, |
|
322 | RTEMS_DEFAULT_MODES, | |
306 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_MATR] |
|
323 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_MATR] | |
307 | ); |
|
324 | ); | |
308 | // CWF3 |
|
325 | // CWF3 | |
309 | status = rtems_task_create( |
|
326 | status = rtems_task_create( | |
310 |
Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE |
|
327 | Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE, | |
311 | RTEMS_DEFAULT_MODES, |
|
328 | RTEMS_DEFAULT_MODES, | |
312 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF3] |
|
329 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF3] | |
313 | ); |
|
330 | ); | |
314 | // CWF2 |
|
331 | // CWF2 | |
315 | status = rtems_task_create( |
|
332 | status = rtems_task_create( | |
316 |
Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE |
|
333 | Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE, | |
317 | RTEMS_DEFAULT_MODES, |
|
334 | RTEMS_DEFAULT_MODES, | |
318 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF2] |
|
335 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF2] | |
319 | ); |
|
336 | ); | |
320 | // CWF1 |
|
337 | // CWF1 | |
321 | status = rtems_task_create( |
|
338 | status = rtems_task_create( | |
322 |
Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE |
|
339 | Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE, | |
323 | RTEMS_DEFAULT_MODES, |
|
340 | RTEMS_DEFAULT_MODES, | |
324 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF1] |
|
341 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF1] | |
325 | ); |
|
342 | ); | |
326 | // SEND |
|
343 | // SEND | |
327 | status = rtems_task_create( |
|
344 | status = rtems_task_create( | |
328 |
Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE |
|
345 | Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE, | |
329 | RTEMS_DEFAULT_MODES, |
|
346 | RTEMS_DEFAULT_MODES, | |
330 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SEND] |
|
347 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SEND] | |
331 | ); |
|
348 | ); | |
332 |
|
349 | |||
333 | return 0; |
|
350 | return 0; | |
334 | } |
|
351 | } | |
335 |
|
352 | |||
336 | int start_all_tasks( void ) |
|
353 | int start_all_tasks( void ) | |
337 | { |
|
354 | { | |
338 | rtems_status_code status; |
|
355 | rtems_status_code status; | |
339 |
|
356 | |||
340 | status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 ); |
|
357 | status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 ); | |
341 | if (status!=RTEMS_SUCCESSFUL) { |
|
358 | if (status!=RTEMS_SUCCESSFUL) { | |
342 | PRINTF("in INIT *** Error starting TASK_SPIQ\n") |
|
359 | PRINTF("in INIT *** Error starting TASK_SPIQ\n") | |
343 | } |
|
360 | } | |
344 |
|
361 | |||
345 | status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 ); |
|
362 | status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 ); | |
346 | if (status!=RTEMS_SUCCESSFUL) { |
|
363 | if (status!=RTEMS_SUCCESSFUL) { | |
347 | PRINTF("in INIT *** Error starting TASK_RECV\n") |
|
364 | PRINTF("in INIT *** Error starting TASK_RECV\n") | |
348 | } |
|
365 | } | |
349 |
|
366 | |||
350 | status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 ); |
|
367 | status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 ); | |
351 | if (status!=RTEMS_SUCCESSFUL) { |
|
368 | if (status!=RTEMS_SUCCESSFUL) { | |
352 | PRINTF("in INIT *** Error starting TASK_ACTN\n") |
|
369 | PRINTF("in INIT *** Error starting TASK_ACTN\n") | |
353 | } |
|
370 | } | |
354 |
|
371 | |||
355 | status = rtems_task_start( Task_id[TASKID_SMIQ], smiq_task, 1 ); |
|
372 | status = rtems_task_start( Task_id[TASKID_SMIQ], smiq_task, 1 ); | |
356 | if (status!=RTEMS_SUCCESSFUL) { |
|
373 | if (status!=RTEMS_SUCCESSFUL) { | |
357 | PRINTF("in INIT *** Error starting TASK_BPPR\n") |
|
374 | PRINTF("in INIT *** Error starting TASK_BPPR\n") | |
358 | } |
|
375 | } | |
359 |
|
376 | |||
360 | status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 ); |
|
377 | status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 ); | |
361 | if (status!=RTEMS_SUCCESSFUL) { |
|
378 | if (status!=RTEMS_SUCCESSFUL) { | |
362 | PRINTF("in INIT *** Error starting TASK_STAT\n") |
|
379 | PRINTF("in INIT *** Error starting TASK_STAT\n") | |
363 | } |
|
380 | } | |
364 |
|
381 | |||
365 | status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, 1 ); |
|
382 | status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, 1 ); | |
366 | if (status!=RTEMS_SUCCESSFUL) { |
|
383 | if (status!=RTEMS_SUCCESSFUL) { | |
367 | PRINTF("in INIT *** Error starting TASK_AVF0\n") |
|
384 | PRINTF("in INIT *** Error starting TASK_AVF0\n") | |
368 | } |
|
385 | } | |
369 |
|
386 | |||
370 | status = rtems_task_start( Task_id[TASKID_BPF0], bpf0_task, 1 ); |
|
387 | status = rtems_task_start( Task_id[TASKID_BPF0], bpf0_task, 1 ); | |
371 | if (status!=RTEMS_SUCCESSFUL) { |
|
388 | if (status!=RTEMS_SUCCESSFUL) { | |
372 | PRINTF("in INIT *** Error starting TASK_BPF0\n") |
|
389 | PRINTF("in INIT *** Error starting TASK_BPF0\n") | |
373 | } |
|
390 | } | |
374 |
|
391 | |||
375 | status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 ); |
|
392 | status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 ); | |
376 | if (status!=RTEMS_SUCCESSFUL) { |
|
393 | if (status!=RTEMS_SUCCESSFUL) { | |
377 | PRINTF("in INIT *** Error starting TASK_WFRM\n") |
|
394 | PRINTF("in INIT *** Error starting TASK_WFRM\n") | |
378 | } |
|
395 | } | |
379 |
|
396 | |||
380 | status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 ); |
|
397 | status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 ); | |
381 | if (status!=RTEMS_SUCCESSFUL) { |
|
398 | if (status!=RTEMS_SUCCESSFUL) { | |
382 | PRINTF("in INIT *** Error starting TASK_DUMB\n") |
|
399 | PRINTF("in INIT *** Error starting TASK_DUMB\n") | |
383 | } |
|
400 | } | |
384 |
|
401 | |||
385 | status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 ); |
|
402 | status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 ); | |
386 | if (status!=RTEMS_SUCCESSFUL) { |
|
403 | if (status!=RTEMS_SUCCESSFUL) { | |
387 | PRINTF("in INIT *** Error starting TASK_HOUS\n") |
|
404 | PRINTF("in INIT *** Error starting TASK_HOUS\n") | |
388 | } |
|
405 | } | |
389 |
|
406 | |||
390 | status = rtems_task_start( Task_id[TASKID_MATR], matr_task, 1 ); |
|
407 | status = rtems_task_start( Task_id[TASKID_MATR], matr_task, 1 ); | |
391 | if (status!=RTEMS_SUCCESSFUL) { |
|
408 | if (status!=RTEMS_SUCCESSFUL) { | |
392 | PRINTF("in INIT *** Error starting TASK_MATR\n") |
|
409 | PRINTF("in INIT *** Error starting TASK_MATR\n") | |
393 | } |
|
410 | } | |
394 |
|
411 | |||
395 | status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 ); |
|
412 | status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 ); | |
396 | if (status!=RTEMS_SUCCESSFUL) { |
|
413 | if (status!=RTEMS_SUCCESSFUL) { | |
397 | PRINTF("in INIT *** Error starting TASK_CWF3\n") |
|
414 | PRINTF("in INIT *** Error starting TASK_CWF3\n") | |
398 | } |
|
415 | } | |
399 |
|
416 | |||
400 | status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 ); |
|
417 | status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 ); | |
401 | if (status!=RTEMS_SUCCESSFUL) { |
|
418 | if (status!=RTEMS_SUCCESSFUL) { | |
402 | PRINTF("in INIT *** Error starting TASK_CWF2\n") |
|
419 | PRINTF("in INIT *** Error starting TASK_CWF2\n") | |
403 | } |
|
420 | } | |
404 |
|
421 | |||
405 | status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 ); |
|
422 | status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 ); | |
406 | if (status!=RTEMS_SUCCESSFUL) { |
|
423 | if (status!=RTEMS_SUCCESSFUL) { | |
407 | PRINTF("in INIT *** Error starting TASK_CWF1\n") |
|
424 | PRINTF("in INIT *** Error starting TASK_CWF1\n") | |
408 | } |
|
425 | } | |
409 | status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 ); |
|
426 | status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 ); | |
410 | if (status!=RTEMS_SUCCESSFUL) { |
|
427 | if (status!=RTEMS_SUCCESSFUL) { | |
411 | PRINTF("in INIT *** Error starting TASK_SEND\n") |
|
428 | PRINTF("in INIT *** Error starting TASK_SEND\n") | |
412 | } |
|
429 | } | |
413 |
|
430 | |||
414 | return 0; |
|
431 | return 0; | |
415 | } |
|
432 | } | |
416 |
|
433 | |||
417 | int create_message_queues( void ) |
|
434 | int create_message_queues( void ) | |
418 | { |
|
435 | { | |
419 | rtems_status_code status; |
|
436 | rtems_status_code status; | |
420 |
|
437 | |||
421 | misc_name[0] = rtems_build_name( 'Q', 'U', 'E', 'U' ); |
|
438 | status = rtems_message_queue_create( misc_name[QUEUE_QUEU], ACTION_MSG_QUEUE_COUNT, CCSDS_TC_PKT_MAX_SIZE, | |
422 | misc_name[1] = rtems_build_name( 'P', 'K', 'T', 'S' ); |
|
439 | RTEMS_FIFO | RTEMS_LOCAL, &misc_id[QUEUE_QUEU] ); | |
423 |
|
||||
424 | status = rtems_message_queue_create( misc_name[0], ACTION_MSG_QUEUE_COUNT, CCSDS_TC_PKT_MAX_SIZE, |
|
|||
425 | RTEMS_FIFO | RTEMS_LOCAL, &misc_id[0] ); |
|
|||
426 | if (status!=RTEMS_SUCCESSFUL) { |
|
440 | if (status!=RTEMS_SUCCESSFUL) { | |
427 |
PRINTF("in create_message_queues *** |
|
441 | PRINTF("in create_message_queues *** ERR creating QUEU\n") | |
428 | } |
|
442 | } | |
429 |
|
443 | |||
430 |
status = rtems_message_queue_create( misc_name[ |
|
444 | status = rtems_message_queue_create( misc_name[QUEUE_PKTS], ACTION_MSG_PKTS_COUNT, ACTION_MSG_PKTS_SIZE, | |
431 |
RTEMS_FIFO | RTEMS_LOCAL, &misc_id[ |
|
445 | RTEMS_FIFO | RTEMS_LOCAL, &misc_id[QUEUE_PKTS] ); | |
432 | if (status!=RTEMS_SUCCESSFUL) { |
|
446 | if (status!=RTEMS_SUCCESSFUL) { | |
433 |
PRINTF("in create_message_queues *** |
|
447 | PRINTF("in create_message_queues *** ERR creating PKTS\n") | |
434 | } |
|
448 | } | |
435 |
|
449 | |||
436 | return 0; |
|
450 | return 0; | |
437 | } |
|
451 | } |
@@ -1,254 +1,276 | |||||
1 | #include <fsw_misc.h> |
|
1 | #include <fsw_misc.h> | |
2 | #include <fsw_params.h> |
|
2 | #include <fsw_params.h> | |
3 |
|
3 | |||
4 | int configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider, |
|
4 | int configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider, | |
5 | unsigned char interrupt_level, rtems_isr (*timer_isr)() ) |
|
5 | unsigned char interrupt_level, rtems_isr (*timer_isr)() ) | |
6 | { // configure the timer for the waveforms simulation |
|
6 | { // configure the timer for the waveforms simulation | |
7 | rtems_status_code status; |
|
7 | rtems_status_code status; | |
8 | rtems_isr_entry old_isr_handler; |
|
8 | rtems_isr_entry old_isr_handler; | |
9 |
|
9 | |||
10 | status = rtems_interrupt_catch( timer_isr, interrupt_level, &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels |
|
10 | status = rtems_interrupt_catch( timer_isr, interrupt_level, &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels | |
11 | if (status==RTEMS_SUCCESSFUL) |
|
11 | if (status==RTEMS_SUCCESSFUL) | |
12 | { |
|
12 | { | |
13 | PRINTF("In configure_timer *** rtems_interrupt_catch successfullly configured\n") |
|
13 | PRINTF("In configure_timer *** rtems_interrupt_catch successfullly configured\n") | |
14 | } |
|
14 | } | |
15 |
|
15 | |||
16 | timer_set_clock_divider( gptimer_regs, timer, clock_divider); |
|
16 | timer_set_clock_divider( gptimer_regs, timer, clock_divider); | |
17 |
|
17 | |||
18 | return 1; |
|
18 | return 1; | |
19 | } |
|
19 | } | |
20 |
|
20 | |||
21 | int timer_start(gptimer_regs_t *gptimer_regs, unsigned char timer) |
|
21 | int timer_start(gptimer_regs_t *gptimer_regs, unsigned char timer) | |
22 | { |
|
22 | { | |
23 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any |
|
23 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any | |
24 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000004; // LD load value from the reload register |
|
24 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000004; // LD load value from the reload register | |
25 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000001; // EN enable the timer |
|
25 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000001; // EN enable the timer | |
26 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000002; // RS restart |
|
26 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000002; // RS restart | |
27 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000008; // IE interrupt enable |
|
27 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000008; // IE interrupt enable | |
28 |
|
28 | |||
29 | return 1; |
|
29 | return 1; | |
30 | } |
|
30 | } | |
31 |
|
31 | |||
32 | int timer_stop(gptimer_regs_t *gptimer_regs, unsigned char timer) |
|
32 | int timer_stop(gptimer_regs_t *gptimer_regs, unsigned char timer) | |
33 | { |
|
33 | { | |
34 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xfffffffe; // EN enable the timer |
|
34 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xfffffffe; // EN enable the timer | |
35 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xffffffef; // IE interrupt enable |
|
35 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xffffffef; // IE interrupt enable | |
36 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any |
|
36 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any | |
37 |
|
37 | |||
38 | return 1; |
|
38 | return 1; | |
39 | } |
|
39 | } | |
40 |
|
40 | |||
41 | int timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider) |
|
41 | int timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider) | |
42 | { |
|
42 | { | |
43 | gptimer_regs->timer[timer].reload = clock_divider; // base clock frequency is 1 MHz |
|
43 | gptimer_regs->timer[timer].reload = clock_divider; // base clock frequency is 1 MHz | |
44 |
|
44 | |||
45 | return 1; |
|
45 | return 1; | |
46 | } |
|
46 | } | |
47 |
|
47 | |||
48 | void update_spacewire_statistics() |
|
48 | void update_spacewire_statistics() | |
49 | { |
|
49 | { | |
50 | rtems_status_code status; |
|
50 | rtems_status_code status; | |
51 | spw_stats spacewire_stats_grspw; |
|
51 | spw_stats spacewire_stats_grspw; | |
52 |
|
52 | |||
53 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw ); |
|
53 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw ); | |
54 |
|
54 | |||
55 | spacewire_stats.packets_received = spacewire_stats_backup.packets_received |
|
55 | spacewire_stats.packets_received = spacewire_stats_backup.packets_received | |
56 | + spacewire_stats_grspw.packets_received; |
|
56 | + spacewire_stats_grspw.packets_received; | |
57 | spacewire_stats.packets_sent = spacewire_stats_backup.packets_sent |
|
57 | spacewire_stats.packets_sent = spacewire_stats_backup.packets_sent | |
58 | + spacewire_stats_grspw.packets_sent; |
|
58 | + spacewire_stats_grspw.packets_sent; | |
59 | spacewire_stats.parity_err = spacewire_stats_backup.parity_err |
|
59 | spacewire_stats.parity_err = spacewire_stats_backup.parity_err | |
60 | + spacewire_stats_grspw.parity_err; |
|
60 | + spacewire_stats_grspw.parity_err; | |
61 | spacewire_stats.disconnect_err = spacewire_stats_backup.disconnect_err |
|
61 | spacewire_stats.disconnect_err = spacewire_stats_backup.disconnect_err | |
62 | + spacewire_stats_grspw.disconnect_err; |
|
62 | + spacewire_stats_grspw.disconnect_err; | |
63 | spacewire_stats.escape_err = spacewire_stats_backup.escape_err |
|
63 | spacewire_stats.escape_err = spacewire_stats_backup.escape_err | |
64 | + spacewire_stats_grspw.escape_err; |
|
64 | + spacewire_stats_grspw.escape_err; | |
65 | spacewire_stats.credit_err = spacewire_stats_backup.credit_err |
|
65 | spacewire_stats.credit_err = spacewire_stats_backup.credit_err | |
66 | + spacewire_stats_grspw.credit_err; |
|
66 | + spacewire_stats_grspw.credit_err; | |
67 | spacewire_stats.write_sync_err = spacewire_stats_backup.write_sync_err |
|
67 | spacewire_stats.write_sync_err = spacewire_stats_backup.write_sync_err | |
68 | + spacewire_stats_grspw.write_sync_err; |
|
68 | + spacewire_stats_grspw.write_sync_err; | |
69 | spacewire_stats.rx_rmap_header_crc_err = spacewire_stats_backup.rx_rmap_header_crc_err |
|
69 | spacewire_stats.rx_rmap_header_crc_err = spacewire_stats_backup.rx_rmap_header_crc_err | |
70 | + spacewire_stats_grspw.rx_rmap_header_crc_err; |
|
70 | + spacewire_stats_grspw.rx_rmap_header_crc_err; | |
71 | spacewire_stats.rx_rmap_data_crc_err = spacewire_stats_backup.rx_rmap_data_crc_err |
|
71 | spacewire_stats.rx_rmap_data_crc_err = spacewire_stats_backup.rx_rmap_data_crc_err | |
72 | + spacewire_stats_grspw.rx_rmap_data_crc_err; |
|
72 | + spacewire_stats_grspw.rx_rmap_data_crc_err; | |
73 | spacewire_stats.early_ep = spacewire_stats_backup.early_ep |
|
73 | spacewire_stats.early_ep = spacewire_stats_backup.early_ep | |
74 | + spacewire_stats_grspw.early_ep; |
|
74 | + spacewire_stats_grspw.early_ep; | |
75 | spacewire_stats.invalid_address = spacewire_stats_backup.invalid_address |
|
75 | spacewire_stats.invalid_address = spacewire_stats_backup.invalid_address | |
76 | + spacewire_stats_grspw.invalid_address; |
|
76 | + spacewire_stats_grspw.invalid_address; | |
77 | spacewire_stats.rx_eep_err = spacewire_stats_backup.rx_eep_err |
|
77 | spacewire_stats.rx_eep_err = spacewire_stats_backup.rx_eep_err | |
78 | + spacewire_stats_grspw.rx_eep_err; |
|
78 | + spacewire_stats_grspw.rx_eep_err; | |
79 | spacewire_stats.rx_truncated = spacewire_stats_backup.rx_truncated |
|
79 | spacewire_stats.rx_truncated = spacewire_stats_backup.rx_truncated | |
80 | + spacewire_stats_grspw.rx_truncated; |
|
80 | + spacewire_stats_grspw.rx_truncated; | |
81 | //spacewire_stats.tx_link_err; |
|
81 | //spacewire_stats.tx_link_err; | |
82 |
|
82 | |||
83 | //**************************** |
|
83 | //**************************** | |
84 | // DPU_SPACEWIRE_IF_STATISTICS |
|
84 | // DPU_SPACEWIRE_IF_STATISTICS | |
85 | housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[0] = (unsigned char) (spacewire_stats.packets_received >> 8); |
|
85 | housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[0] = (unsigned char) (spacewire_stats.packets_received >> 8); | |
86 | housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[1] = (unsigned char) (spacewire_stats.packets_received); |
|
86 | housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[1] = (unsigned char) (spacewire_stats.packets_received); | |
87 | housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[0] = (unsigned char) (spacewire_stats.packets_sent >> 8); |
|
87 | housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[0] = (unsigned char) (spacewire_stats.packets_sent >> 8); | |
88 | housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[1] = (unsigned char) (spacewire_stats.packets_sent); |
|
88 | housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[1] = (unsigned char) (spacewire_stats.packets_sent); | |
89 | //housekeeping_packet.hk_lfr_dpu_spw_tick_out_cnt; |
|
89 | //housekeeping_packet.hk_lfr_dpu_spw_tick_out_cnt; | |
90 | //housekeeping_packet.hk_lfr_dpu_spw_last_timc; |
|
90 | //housekeeping_packet.hk_lfr_dpu_spw_last_timc; | |
91 |
|
91 | |||
92 | //****************************************** |
|
92 | //****************************************** | |
93 | // ERROR COUNTERS / SPACEWIRE / LOW SEVERITY |
|
93 | // ERROR COUNTERS / SPACEWIRE / LOW SEVERITY | |
94 | housekeeping_packet.hk_lfr_dpu_spw_parity = (unsigned char) spacewire_stats.parity_err; |
|
94 | housekeeping_packet.hk_lfr_dpu_spw_parity = (unsigned char) spacewire_stats.parity_err; | |
95 | housekeeping_packet.hk_lfr_dpu_spw_disconnect = (unsigned char) spacewire_stats.disconnect_err; |
|
95 | housekeeping_packet.hk_lfr_dpu_spw_disconnect = (unsigned char) spacewire_stats.disconnect_err; | |
96 | housekeeping_packet.hk_lfr_dpu_spw_escape = (unsigned char) spacewire_stats.escape_err; |
|
96 | housekeeping_packet.hk_lfr_dpu_spw_escape = (unsigned char) spacewire_stats.escape_err; | |
97 | housekeeping_packet.hk_lfr_dpu_spw_credit = (unsigned char) spacewire_stats.credit_err; |
|
97 | housekeeping_packet.hk_lfr_dpu_spw_credit = (unsigned char) spacewire_stats.credit_err; | |
98 | housekeeping_packet.hk_lfr_dpu_spw_write_sync = (unsigned char) spacewire_stats.write_sync_err; |
|
98 | housekeeping_packet.hk_lfr_dpu_spw_write_sync = (unsigned char) spacewire_stats.write_sync_err; | |
99 | // housekeeping_packet.hk_lfr_dpu_spw_rx_ahb; |
|
99 | // housekeeping_packet.hk_lfr_dpu_spw_rx_ahb; | |
100 | // housekeeping_packet.hk_lfr_dpu_spw_tx_ahb; |
|
100 | // housekeeping_packet.hk_lfr_dpu_spw_tx_ahb; | |
101 | housekeeping_packet.hk_lfr_dpu_spw_header_crc = (unsigned char) spacewire_stats.rx_rmap_header_crc_err; |
|
101 | housekeeping_packet.hk_lfr_dpu_spw_header_crc = (unsigned char) spacewire_stats.rx_rmap_header_crc_err; | |
102 | housekeeping_packet.hk_lfr_dpu_spw_data_crc = (unsigned char) spacewire_stats.rx_rmap_data_crc_err; |
|
102 | housekeeping_packet.hk_lfr_dpu_spw_data_crc = (unsigned char) spacewire_stats.rx_rmap_data_crc_err; | |
103 |
|
103 | |||
104 | //********************************************* |
|
104 | //********************************************* | |
105 | // ERROR COUNTERS / SPACEWIRE / MEDIUM SEVERITY |
|
105 | // ERROR COUNTERS / SPACEWIRE / MEDIUM SEVERITY | |
106 | housekeeping_packet.hk_lfr_dpu_spw_early_eop = (unsigned char) spacewire_stats.early_ep; |
|
106 | housekeeping_packet.hk_lfr_dpu_spw_early_eop = (unsigned char) spacewire_stats.early_ep; | |
107 | housekeeping_packet.hk_lfr_dpu_spw_invalid_addr = (unsigned char) spacewire_stats.invalid_address; |
|
107 | housekeeping_packet.hk_lfr_dpu_spw_invalid_addr = (unsigned char) spacewire_stats.invalid_address; | |
108 | housekeeping_packet.hk_lfr_dpu_spw_eep = (unsigned char) spacewire_stats.rx_eep_err; |
|
108 | housekeeping_packet.hk_lfr_dpu_spw_eep = (unsigned char) spacewire_stats.rx_eep_err; | |
109 | housekeeping_packet.hk_lfr_dpu_spw_rx_too_big = (unsigned char) spacewire_stats.rx_truncated; |
|
109 | housekeeping_packet.hk_lfr_dpu_spw_rx_too_big = (unsigned char) spacewire_stats.rx_truncated; | |
110 |
|
110 | |||
111 | } |
|
111 | } | |
112 |
|
112 | |||
113 | int send_console_outputs_on_apbuart_port( void ) // Send the console outputs on the apbuart port |
|
113 | int send_console_outputs_on_apbuart_port( void ) // Send the console outputs on the apbuart port | |
114 | { |
|
114 | { | |
115 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART; |
|
115 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART; | |
116 |
|
116 | |||
117 | apbuart_regs->ctrl = apbuart_regs->ctrl & APBUART_CTRL_REG_MASK_DB; |
|
117 | apbuart_regs->ctrl = apbuart_regs->ctrl & APBUART_CTRL_REG_MASK_DB; | |
118 | PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n") |
|
118 | PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n") | |
119 |
|
119 | |||
120 | return 0; |
|
120 | return 0; | |
121 | } |
|
121 | } | |
122 |
|
122 | |||
123 | int set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value) |
|
123 | int set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value) | |
124 | { |
|
124 | { | |
125 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) regs; |
|
125 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) regs; | |
126 |
|
126 | |||
127 | apbuart_regs->scaler = value; |
|
127 | apbuart_regs->scaler = value; | |
128 | PRINTF1("OK *** apbuart port scaler reload register set to 0x%x\n", value) |
|
128 | PRINTF1("OK *** apbuart port scaler reload register set to 0x%x\n", value) | |
129 |
|
129 | |||
130 | return 0; |
|
130 | return 0; | |
131 | } |
|
131 | } | |
132 |
|
132 | |||
133 | //************ |
|
133 | //************ | |
134 | // RTEMS TASKS |
|
134 | // RTEMS TASKS | |
135 |
|
135 | |||
136 | rtems_task stat_task(rtems_task_argument argument) |
|
136 | rtems_task stat_task(rtems_task_argument argument) | |
137 | { |
|
137 | { | |
138 | int i; |
|
138 | int i; | |
139 | int j; |
|
139 | int j; | |
140 | i = 0; |
|
140 | i = 0; | |
141 | j = 0; |
|
141 | j = 0; | |
142 | PRINTF("in STAT *** \n") |
|
142 | PRINTF("in STAT *** \n") | |
143 | while(1){ |
|
143 | while(1){ | |
144 | rtems_task_wake_after(1000); |
|
144 | rtems_task_wake_after(1000); | |
145 | PRINTF1("%d\n", j) |
|
145 | PRINTF1("%d\n", j) | |
146 | if (i == CPU_USAGE_REPORT_PERIOD) { |
|
146 | if (i == CPU_USAGE_REPORT_PERIOD) { | |
147 | // #ifdef PRINT_TASK_STATISTICS |
|
147 | // #ifdef PRINT_TASK_STATISTICS | |
148 | // rtems_cpu_usage_report(); |
|
148 | // rtems_cpu_usage_report(); | |
149 | // rtems_cpu_usage_reset(); |
|
149 | // rtems_cpu_usage_reset(); | |
150 | // #endif |
|
150 | // #endif | |
151 | i = 0; |
|
151 | i = 0; | |
152 | } |
|
152 | } | |
153 | else i++; |
|
153 | else i++; | |
154 | j++; |
|
154 | j++; | |
155 | } |
|
155 | } | |
156 | } |
|
156 | } | |
157 |
|
157 | |||
158 | rtems_task hous_task(rtems_task_argument argument) |
|
158 | rtems_task hous_task(rtems_task_argument argument) | |
159 | { |
|
159 | { | |
160 | rtems_status_code status; |
|
160 | rtems_status_code status; | |
161 | spw_ioctl_pkt_send spw_ioctl_send; |
|
161 | spw_ioctl_pkt_send spw_ioctl_send; | |
162 |
|
162 | |||
163 | spw_ioctl_send.hlen = 0; |
|
163 | spw_ioctl_send.hlen = 0; | |
164 | spw_ioctl_send.hdr = NULL; |
|
164 | spw_ioctl_send.hdr = NULL; | |
165 | spw_ioctl_send.dlen = sizeof(spw_ioctl_send); |
|
165 | spw_ioctl_send.dlen = PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; | |
166 | spw_ioctl_send.data = (char*) &housekeeping_packet; |
|
166 | spw_ioctl_send.data = (char*) &housekeeping_packet; | |
167 | spw_ioctl_send.options = 0; |
|
167 | spw_ioctl_send.options = 0; | |
168 |
|
168 | |||
169 | PRINTF("in HOUS ***\n") |
|
169 | PRINTF("in HOUS ***\n") | |
170 |
|
170 | |||
171 | if (rtems_rate_monotonic_ident( HK_name, &HK_id) != RTEMS_SUCCESSFUL) { |
|
171 | if (rtems_rate_monotonic_ident( HK_name, &HK_id) != RTEMS_SUCCESSFUL) { | |
172 | status = rtems_rate_monotonic_create( HK_name, &HK_id ); |
|
172 | status = rtems_rate_monotonic_create( HK_name, &HK_id ); | |
173 | if( status != RTEMS_SUCCESSFUL ) { |
|
173 | if( status != RTEMS_SUCCESSFUL ) { | |
174 | PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status ) |
|
174 | PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status ) | |
175 | } |
|
175 | } | |
176 | } |
|
176 | } | |
177 |
|
177 | |||
178 | housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
178 | housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; | |
179 | housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
179 | housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
180 | housekeeping_packet.reserved = DEFAULT_RESERVED; |
|
180 | housekeeping_packet.reserved = DEFAULT_RESERVED; | |
181 | housekeeping_packet.userApplication = CCSDS_USER_APP; |
|
181 | housekeeping_packet.userApplication = CCSDS_USER_APP; | |
182 | housekeeping_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_HK >> 8); |
|
182 | housekeeping_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_HK >> 8); | |
183 | housekeeping_packet.packetID[1] = (unsigned char) (TM_PACKET_ID_HK); |
|
183 | housekeeping_packet.packetID[1] = (unsigned char) (TM_PACKET_ID_HK); | |
184 | housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
184 | housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
185 | housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
185 | housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
186 | housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8); |
|
186 | housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8); | |
187 | housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK ); |
|
187 | housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK ); | |
188 | housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
188 | housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
189 | housekeeping_packet.serviceType = TM_TYPE_HK; |
|
189 | housekeeping_packet.serviceType = TM_TYPE_HK; | |
190 | housekeeping_packet.serviceSubType = TM_SUBTYPE_HK; |
|
190 | housekeeping_packet.serviceSubType = TM_SUBTYPE_HK; | |
191 | housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND; |
|
191 | housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND; | |
192 |
|
192 | |||
193 | status = rtems_rate_monotonic_cancel(HK_id); |
|
193 | status = rtems_rate_monotonic_cancel(HK_id); | |
194 | if( status != RTEMS_SUCCESSFUL ) { |
|
194 | if( status != RTEMS_SUCCESSFUL ) { | |
195 | PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status ) |
|
195 | PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status ) | |
196 | } |
|
196 | } | |
197 | else { |
|
197 | else { | |
198 | PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n") |
|
198 | PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n") | |
199 | } |
|
199 | } | |
200 |
|
200 | |||
201 | while(1){ // launch the rate monotonic task |
|
201 | while(1){ // launch the rate monotonic task | |
202 | status = rtems_rate_monotonic_period( HK_id, HK_PERIOD ); |
|
202 | status = rtems_rate_monotonic_period( HK_id, HK_PERIOD ); | |
203 | if ( status != RTEMS_SUCCESSFUL ) { |
|
203 | if ( status != RTEMS_SUCCESSFUL ) { | |
204 | PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_period *** code %d\n", status); |
|
204 | PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_period *** code %d\n", status); | |
205 | } |
|
205 | } | |
206 | else { |
|
206 | else { | |
207 | housekeeping_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
207 | housekeeping_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
208 | housekeeping_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
208 | housekeeping_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
209 | housekeeping_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
209 | housekeeping_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
210 | housekeeping_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
210 | housekeeping_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); | |
211 | housekeeping_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
211 | housekeeping_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
212 | housekeeping_packet.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
212 | housekeeping_packet.time[5] = (unsigned char) (time_management_regs->fine_time); | |
213 | housekeeping_packet.sid = SID_HK; |
|
213 | housekeeping_packet.sid = SID_HK; | |
214 |
|
214 | |||
215 | update_spacewire_statistics(); |
|
215 | update_spacewire_statistics(); | |
216 |
|
216 | |||
217 | // SEND PACKET |
|
217 | // SEND PACKET | |
218 | //result = write( fdSPW, &housekeeping_packet, LEN_TM_LFR_HK); |
|
218 | status = rtems_message_queue_send( misc_id[QUEUE_PKTS], &spw_ioctl_send, sizeof(spw_ioctl_send)); | |
219 | status = rtems_message_queue_send( misc_id[1], &spw_ioctl_send, sizeof(spw_ioctl_send)); |
|
|||
220 | if (status != RTEMS_SUCCESSFUL) { |
|
219 | if (status != RTEMS_SUCCESSFUL) { | |
221 | PRINTF1("in HOUS *** ERR %d\n", (int) status) |
|
220 | PRINTF1("in HOUS *** ERR %d\n", (int) status) | |
222 | } |
|
221 | } | |
223 | } |
|
222 | } | |
224 | } |
|
223 | } | |
225 |
|
224 | |||
226 | PRINTF("in HOUS *** deleting task\n") |
|
225 | PRINTF("in HOUS *** deleting task\n") | |
227 |
|
226 | |||
228 | status = rtems_task_delete( RTEMS_SELF ); // should not return |
|
227 | status = rtems_task_delete( RTEMS_SELF ); // should not return | |
229 | printf( "rtems_task_delete returned with status of %d.\n", status ); |
|
228 | printf( "rtems_task_delete returned with status of %d.\n", status ); | |
230 | exit( 1 ); |
|
229 | exit( 1 ); | |
231 | } |
|
230 | } | |
232 |
|
231 | |||
233 | rtems_task send_task( rtems_task_argument argument) |
|
232 | rtems_task send_task( rtems_task_argument argument) | |
234 | { |
|
233 | { | |
235 | rtems_status_code status; // RTEMS status code |
|
234 | rtems_status_code status; // RTEMS status code | |
236 |
spw_ioctl_pkt_send spw_ioctl_send |
|
235 | spw_ioctl_pkt_send spw_ioctl_send; // incoming spw_ioctl_pkt_send structure | |
237 | size_t size; // size of the incoming TC packet |
|
236 | size_t size; // size of the incoming TC packet | |
|
237 | u_int32_t count; | |||
238 |
|
238 | |||
239 | PRINTF("in SEND *** \n") |
|
239 | PRINTF("in SEND *** \n") | |
240 |
|
240 | |||
241 | while(1) |
|
241 | while(1) | |
242 | { |
|
242 | { | |
243 |
status = rtems_message_queue_receive(misc_id[ |
|
243 | status = rtems_message_queue_receive(misc_id[QUEUE_PKTS], (char*) &spw_ioctl_send, &size, | |
244 | RTEMS_WAIT, RTEMS_NO_TIMEOUT); |
|
244 | RTEMS_WAIT, RTEMS_NO_TIMEOUT); | |
245 | if (status!=RTEMS_SUCCESSFUL) PRINTF1("ERR *** in task ACTN *** error receiving a message, code %d \n", status) |
|
245 | if (status!=RTEMS_SUCCESSFUL) | |
|
246 | { | |||
|
247 | PRINTF1("in SEND *** (1) ERR = %d \n", status) | |||
|
248 | } | |||
246 | else |
|
249 | else | |
247 | { |
|
250 | { | |
248 |
status = write_spw(&spw_ioctl_send |
|
251 | status = write_spw(&spw_ioctl_send); | |
249 | if (status != RTEMS_SUCCESSFUL) { |
|
252 | if (status != RTEMS_SUCCESSFUL) { | |
250 | PRINTF("in SEND *** TRAFFIC JAM\n") |
|
253 | PRINTF("in SEND *** TRAFFIC JAM\n") | |
251 | } |
|
254 | } | |
252 | } |
|
255 | } | |
|
256 | ||||
|
257 | status = rtems_message_queue_get_number_pending( misc_id[QUEUE_PKTS], &count ); | |||
|
258 | if (status != RTEMS_SUCCESSFUL) | |||
|
259 | { | |||
|
260 | PRINTF1("in SEND *** (2) ERR = %d \n", status) | |||
|
261 | } | |||
|
262 | else | |||
|
263 | { | |||
|
264 | if (count > maxCount) | |||
|
265 | { | |||
|
266 | maxCount = count; | |||
|
267 | } | |||
|
268 | } | |||
253 | } |
|
269 | } | |
254 | } |
|
270 | } | |
|
271 | ||||
|
272 | ||||
|
273 | ||||
|
274 | ||||
|
275 | ||||
|
276 |
@@ -1,662 +1,690 | |||||
1 | #include <fsw_processing.h> |
|
1 | #include <fsw_processing.h> | |
2 | #include <math.h> |
|
2 | #include <math.h> | |
3 |
|
3 | |||
4 | #include <fsw_processing_globals.c> |
|
4 | #include <fsw_processing_globals.c> | |
5 |
|
5 | |||
6 | unsigned char LFR_BP1_F0[ NB_BINS_COMPRESSED_SM_F0 * 9 ]; |
|
6 | unsigned char LFR_BP1_F0[ NB_BINS_COMPRESSED_SM_F0 * 9 ]; | |
7 | BP1_t data_BP1[ NB_BINS_COMPRESSED_SM_F0 ]; |
|
7 | BP1_t data_BP1[ NB_BINS_COMPRESSED_SM_F0 ]; | |
8 | float averaged_spec_mat_f0[ TOTAL_SIZE_SM ]; |
|
8 | float averaged_spec_mat_f0[ TOTAL_SIZE_SM ]; | |
9 | char averaged_spec_mat_f0_char[ TOTAL_SIZE_SM * 2 ]; |
|
9 | char averaged_spec_mat_f0_char[ TOTAL_SIZE_SM * 2 ]; | |
10 | float compressed_spec_mat_f0[ TOTAL_SIZE_COMPRESSED_MATRIX_f0 ]; |
|
10 | float compressed_spec_mat_f0[ TOTAL_SIZE_COMPRESSED_MATRIX_f0 ]; | |
11 |
|
11 | |||
12 | //*********************************************************** |
|
12 | //*********************************************************** | |
13 | // Interrupt Service Routine for spectral matrices processing |
|
13 | // Interrupt Service Routine for spectral matrices processing | |
14 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ) |
|
14 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ) | |
15 | { |
|
15 | { | |
16 | unsigned char status; |
|
16 | unsigned char status; | |
17 | unsigned char i; |
|
17 | unsigned char i; | |
18 |
|
18 | |||
19 | status = spectral_matrix_regs->status; //[f2 f1 f0_1 f0_0] |
|
19 | status = spectral_matrix_regs->status; //[f2 f1 f0_1 f0_0] | |
20 | for (i=0; i<4; i++) |
|
20 | for (i=0; i<4; i++) | |
21 | { |
|
21 | { | |
22 | if ( ( (status >> i) & 0x01) == 1) // (1) buffer rotation |
|
22 | if ( ( (status >> i) & 0x01) == 1) // (1) buffer rotation | |
23 | { |
|
23 | { | |
24 | switch(i) |
|
24 | switch(i) | |
25 | { |
|
25 | { | |
26 | case 0: |
|
26 | case 0: | |
27 | if (spectral_matrix_regs->matrixF0_Address0 == (int) spec_mat_f0_0) |
|
27 | if (spectral_matrix_regs->matrixF0_Address0 == (int) spec_mat_f0_0) | |
28 | { |
|
28 | { | |
29 | spectral_matrix_regs->matrixF0_Address0 = (int) spec_mat_f0_0_bis; |
|
29 | spectral_matrix_regs->matrixF0_Address0 = (int) spec_mat_f0_0_bis; | |
30 | } |
|
30 | } | |
31 | else |
|
31 | else | |
32 | { |
|
32 | { | |
33 | spectral_matrix_regs->matrixF0_Address0 = (int) spec_mat_f0_0; |
|
33 | spectral_matrix_regs->matrixF0_Address0 = (int) spec_mat_f0_0; | |
34 | } |
|
34 | } | |
35 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe; |
|
35 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe; | |
36 | break; |
|
36 | break; | |
37 | case 1: |
|
37 | case 1: | |
38 | if (spectral_matrix_regs->matrixFO_Address1 == (int) spec_mat_f0_1) |
|
38 | if (spectral_matrix_regs->matrixFO_Address1 == (int) spec_mat_f0_1) | |
39 | { |
|
39 | { | |
40 | spectral_matrix_regs->matrixFO_Address1 = (int) spec_mat_f0_1_bis; |
|
40 | spectral_matrix_regs->matrixFO_Address1 = (int) spec_mat_f0_1_bis; | |
41 | } |
|
41 | } | |
42 | else |
|
42 | else | |
43 | { |
|
43 | { | |
44 | spectral_matrix_regs->matrixFO_Address1 = (int) spec_mat_f0_1; |
|
44 | spectral_matrix_regs->matrixFO_Address1 = (int) spec_mat_f0_1; | |
45 | } |
|
45 | } | |
46 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd; |
|
46 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd; | |
47 | break; |
|
47 | break; | |
48 | case 2: |
|
48 | case 2: | |
49 | if (spectral_matrix_regs->matrixF1_Address == (int) spec_mat_f1) |
|
49 | if (spectral_matrix_regs->matrixF1_Address == (int) spec_mat_f1) | |
50 | { |
|
50 | { | |
51 | spectral_matrix_regs->matrixF1_Address = (int) spec_mat_f1_bis; |
|
51 | spectral_matrix_regs->matrixF1_Address = (int) spec_mat_f1_bis; | |
52 | } |
|
52 | } | |
53 | else |
|
53 | else | |
54 | { |
|
54 | { | |
55 | spectral_matrix_regs->matrixF1_Address = (int) spec_mat_f1; |
|
55 | spectral_matrix_regs->matrixF1_Address = (int) spec_mat_f1; | |
56 | } |
|
56 | } | |
57 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffb; |
|
57 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffb; | |
58 | break; |
|
58 | break; | |
59 | case 3: |
|
59 | case 3: | |
60 | if (spectral_matrix_regs->matrixF2_Address == (int) spec_mat_f2) |
|
60 | if (spectral_matrix_regs->matrixF2_Address == (int) spec_mat_f2) | |
61 | { |
|
61 | { | |
62 | spectral_matrix_regs->matrixF2_Address = (int) spec_mat_f2_bis; |
|
62 | spectral_matrix_regs->matrixF2_Address = (int) spec_mat_f2_bis; | |
63 | } |
|
63 | } | |
64 | else |
|
64 | else | |
65 | { |
|
65 | { | |
66 | spectral_matrix_regs->matrixF2_Address = (int) spec_mat_f2; |
|
66 | spectral_matrix_regs->matrixF2_Address = (int) spec_mat_f2; | |
67 | } |
|
67 | } | |
68 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff7; |
|
68 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff7; | |
69 | break; |
|
69 | break; | |
70 | default: |
|
70 | default: | |
71 | break; |
|
71 | break; | |
72 | } |
|
72 | } | |
73 | } |
|
73 | } | |
74 | } |
|
74 | } | |
75 |
|
75 | |||
76 | // reset error codes to 0 |
|
76 | // reset error codes to 0 | |
77 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xffffffcf; // [1100 1111] |
|
77 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xffffffcf; // [1100 1111] | |
78 |
|
78 | |||
79 | if (rtems_event_send( Task_id[TASKID_SMIQ], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
79 | if (rtems_event_send( Task_id[TASKID_SMIQ], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { | |
80 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_4 ); |
|
80 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_4 ); | |
81 | } |
|
81 | } | |
82 | } |
|
82 | } | |
83 |
|
83 | |||
|
84 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ) | |||
|
85 | { | |||
|
86 | if (rtems_event_send( Task_id[TASKID_SMIQ], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { | |||
|
87 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_4 ); | |||
|
88 | } | |||
|
89 | } | |||
|
90 | ||||
84 | //************ |
|
91 | //************ | |
85 | // RTEMS TASKS |
|
92 | // RTEMS TASKS | |
|
93 | ||||
86 | rtems_task smiq_task(rtems_task_argument argument) // process the Spectral Matrices IRQ |
|
94 | rtems_task smiq_task(rtems_task_argument argument) // process the Spectral Matrices IRQ | |
87 | { |
|
95 | { | |
88 | rtems_event_set event_out; |
|
96 | rtems_event_set event_out; | |
89 | unsigned int nb_interrupt_f0 = 0; |
|
97 | unsigned int nb_interrupt_f0 = 0; | |
90 |
|
98 | |||
91 | PRINTF("in SMIQ *** \n") |
|
99 | PRINTF("in SMIQ *** \n") | |
92 |
|
100 | |||
93 | while(1){ |
|
101 | while(1){ | |
94 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
102 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 | |
95 | nb_interrupt_f0 = nb_interrupt_f0 + 1; |
|
103 | nb_interrupt_f0 = nb_interrupt_f0 + 1; | |
96 | if (nb_interrupt_f0 == param_local.local_nb_interrupt_f0_MAX ){ |
|
104 | if (nb_interrupt_f0 == NB_SM_TO_RECEIVE_BEFORE_AVF0 ){ | |
97 |
if (rtems_event_send( Task_id[TASKID_ |
|
105 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |
98 | { |
|
106 | { | |
99 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
107 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |
100 | } |
|
108 | } | |
101 | nb_interrupt_f0 = 0; |
|
109 | nb_interrupt_f0 = 0; | |
102 | } |
|
110 | } | |
103 | } |
|
111 | } | |
104 | } |
|
112 | } | |
105 |
|
113 | |||
|
114 | //rtems_task smiq_task(rtems_task_argument argument) // process the Spectral Matrices IRQ | |||
|
115 | //{ | |||
|
116 | // rtems_event_set event_out; | |||
|
117 | // unsigned int nb_interrupt_f0 = 0; | |||
|
118 | ||||
|
119 | // PRINTF("in SMIQ *** \n") | |||
|
120 | ||||
|
121 | // while(1){ | |||
|
122 | // rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 | |||
|
123 | // nb_interrupt_f0 = nb_interrupt_f0 + 1; | |||
|
124 | // if (nb_interrupt_f0 == param_local.local_nb_interrupt_f0_MAX ){ | |||
|
125 | // if (rtems_event_send( Task_id[TASKID_MATR], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |||
|
126 | // { | |||
|
127 | // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |||
|
128 | // } | |||
|
129 | // nb_interrupt_f0 = 0; | |||
|
130 | // } | |||
|
131 | // } | |||
|
132 | //} | |||
|
133 | ||||
106 | rtems_task spw_bppr_task(rtems_task_argument argument) |
|
134 | rtems_task spw_bppr_task(rtems_task_argument argument) | |
107 | { |
|
135 | { | |
108 | rtems_status_code status; |
|
136 | rtems_status_code status; | |
109 | rtems_event_set event_out; |
|
137 | rtems_event_set event_out; | |
110 | static int Nb_average_f0 = 0; |
|
138 | static int Nb_average_f0 = 0; | |
111 | //static int nb_average_f1 = 0; |
|
139 | //static int nb_average_f1 = 0; | |
112 | //static int nb_average_f2 = 0; |
|
140 | //static int nb_average_f2 = 0; | |
113 |
|
141 | |||
114 | printf("in BPPR ***\n"); |
|
142 | printf("in BPPR ***\n"); | |
115 |
|
143 | |||
116 | while(true){ // wait for an event to begin with the processing |
|
144 | while(true){ // wait for an event to begin with the processing | |
117 | status = rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); |
|
145 | status = rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); | |
118 | if (status == RTEMS_SUCCESSFUL) { |
|
146 | if (status == RTEMS_SUCCESSFUL) { | |
119 | if ((spectral_matrix_regs->status & 0x00000001)==1) { |
|
147 | if ((spectral_matrix_regs->status & 0x00000001)==1) { | |
120 | matrix_average(spec_mat_f0_0, averaged_spec_mat_f0); |
|
148 | matrix_average(spec_mat_f0_0, averaged_spec_mat_f0); | |
121 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe; |
|
149 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe; | |
122 | //printf("f0_a\n"); |
|
150 | //printf("f0_a\n"); | |
123 | Nb_average_f0++; |
|
151 | Nb_average_f0++; | |
124 | } |
|
152 | } | |
125 | if (((spectral_matrix_regs->status>>1) & 0x00000001)==1) { |
|
153 | if (((spectral_matrix_regs->status>>1) & 0x00000001)==1) { | |
126 | matrix_average(spec_mat_f0_1, compressed_spec_mat_f0); |
|
154 | matrix_average(spec_mat_f0_1, compressed_spec_mat_f0); | |
127 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd; |
|
155 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd; | |
128 | //printf("f0_b\n"); |
|
156 | //printf("f0_b\n"); | |
129 | Nb_average_f0++; |
|
157 | Nb_average_f0++; | |
130 | } |
|
158 | } | |
131 | if (Nb_average_f0 == NB_AVERAGE_NORMAL_f0) { |
|
159 | if (Nb_average_f0 == NB_AVERAGE_NORMAL_f0) { | |
132 | matrix_compression(averaged_spec_mat_f0, 0, compressed_spec_mat_f0); |
|
160 | matrix_compression(averaged_spec_mat_f0, 0, compressed_spec_mat_f0); | |
133 | //printf("f0 compressed\n"); |
|
161 | //printf("f0 compressed\n"); | |
134 | Nb_average_f0 = 0; |
|
162 | Nb_average_f0 = 0; | |
135 | matrix_reset(averaged_spec_mat_f0); |
|
163 | matrix_reset(averaged_spec_mat_f0); | |
136 | } |
|
164 | } | |
137 | } |
|
165 | } | |
138 | } |
|
166 | } | |
139 | } |
|
167 | } | |
140 |
|
168 | |||
141 | rtems_task avf0_task(rtems_task_argument argument) |
|
169 | rtems_task avf0_task(rtems_task_argument argument) | |
142 | { |
|
170 | { | |
143 |
|
|
171 | int i; | |
144 | static int nb_average; |
|
172 | static int nb_average; | |
145 | rtems_event_set event_out; |
|
173 | rtems_event_set event_out; | |
146 | rtems_status_code status; |
|
174 | rtems_status_code status; | |
147 |
|
175 | |||
148 | nb_average = 0; |
|
176 | nb_average = 0; | |
149 |
|
177 | |||
150 | PRINTF("in AVFO *** \n") |
|
178 | PRINTF("in AVFO *** \n") | |
151 |
|
179 | |||
152 | while(1){ |
|
180 | while(1){ | |
153 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
181 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 | |
154 |
|
|
182 | for(i=0; i<TOTAL_SIZE_SM; i++){ | |
155 | averaged_spec_mat_f0[i] = averaged_spec_mat_f0[i] + spec_mat_f0_a[i] |
|
183 | averaged_spec_mat_f0[i] = averaged_spec_mat_f0[i] + spec_mat_f0_a[i] | |
156 | + spec_mat_f0_b[i] |
|
184 | + spec_mat_f0_b[i] | |
157 | + spec_mat_f0_c[i] |
|
185 | + spec_mat_f0_c[i] | |
158 | + spec_mat_f0_d[i] |
|
186 | + spec_mat_f0_d[i] | |
159 | + spec_mat_f0_e[i] |
|
187 | + spec_mat_f0_e[i] | |
160 | + spec_mat_f0_f[i] |
|
188 | + spec_mat_f0_f[i] | |
161 | + spec_mat_f0_g[i] |
|
189 | + spec_mat_f0_g[i] | |
162 | + spec_mat_f0_h[i]; |
|
190 | + spec_mat_f0_h[i]; | |
163 |
|
|
191 | } | |
164 | nb_average = nb_average + NB_SM_TO_RECEIVE_BEFORE_AVF0; |
|
192 | nb_average = nb_average + NB_SM_TO_RECEIVE_BEFORE_AVF0; | |
165 | if (nb_average == NB_AVERAGE_NORMAL_f0) { |
|
193 | if (nb_average == NB_AVERAGE_NORMAL_f0) { | |
166 | nb_average = 0; |
|
194 | nb_average = 0; | |
167 | status = rtems_event_send( Task_id[TASKID_MATR], RTEMS_EVENT_0 ); // sending an event to the task 7, BPF0 |
|
195 | status = rtems_event_send( Task_id[TASKID_MATR], RTEMS_EVENT_0 ); // sending an event to the task 7, BPF0 | |
168 | if (status != RTEMS_SUCCESSFUL) { |
|
196 | if (status != RTEMS_SUCCESSFUL) { | |
169 | printf("in AVF0 *** Error sending RTEMS_EVENT_0, code %d\n", status); |
|
197 | printf("in AVF0 *** Error sending RTEMS_EVENT_0, code %d\n", status); | |
170 | } |
|
198 | } | |
171 | } |
|
199 | } | |
172 | } |
|
200 | } | |
173 | } |
|
201 | } | |
174 |
|
202 | |||
175 | rtems_task bpf0_task(rtems_task_argument argument) |
|
203 | rtems_task bpf0_task(rtems_task_argument argument) | |
176 | { |
|
204 | { | |
177 | rtems_event_set event_out; |
|
205 | rtems_event_set event_out; | |
178 |
|
206 | |||
179 | PRINTF("in BPFO *** \n") |
|
207 | PRINTF("in BPFO *** \n") | |
180 |
|
208 | |||
181 | while(1){ |
|
209 | while(1){ | |
182 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
210 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 | |
183 | matrix_compression(averaged_spec_mat_f0, 0, compressed_spec_mat_f0); |
|
211 | matrix_compression(averaged_spec_mat_f0, 0, compressed_spec_mat_f0); | |
184 | BP1_set(compressed_spec_mat_f0, NB_BINS_COMPRESSED_SM_F0, LFR_BP1_F0); |
|
212 | BP1_set(compressed_spec_mat_f0, NB_BINS_COMPRESSED_SM_F0, LFR_BP1_F0); | |
185 | //PRINTF("IN TASK BPF0 *** Matrix compressed, parameters calculated\n") |
|
213 | //PRINTF("IN TASK BPF0 *** Matrix compressed, parameters calculated\n") | |
186 | } |
|
214 | } | |
187 | } |
|
215 | } | |
188 |
|
216 | |||
189 | rtems_task matr_task(rtems_task_argument argument) |
|
217 | rtems_task matr_task(rtems_task_argument argument) | |
190 | { |
|
218 | { | |
191 | spw_ioctl_pkt_send spw_ioctl_send_ASM; |
|
219 | spw_ioctl_pkt_send spw_ioctl_send_ASM; | |
192 | rtems_event_set event_out; |
|
220 | rtems_event_set event_out; | |
193 | Header_TM_LFR_SCIENCE_ASM_t headerASM; |
|
221 | Header_TM_LFR_SCIENCE_ASM_t headerASM; | |
194 |
|
222 | |||
195 | init_header_asm( &headerASM ); |
|
223 | init_header_asm( &headerASM ); | |
196 |
|
224 | |||
197 | PRINTF("in MATR *** \n") |
|
225 | PRINTF("in MATR *** \n") | |
198 |
|
226 | |||
199 | fill_averaged_spectral_matrix( ); |
|
227 | fill_averaged_spectral_matrix( ); | |
200 |
|
228 | |||
201 | while(1){ |
|
229 | while(1){ | |
202 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
230 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 | |
203 |
|
231 | |||
204 | #ifdef GSA |
|
232 | #ifdef GSA | |
205 | #else |
|
233 | #else | |
206 | fill_averaged_spectral_matrix( ); |
|
234 | fill_averaged_spectral_matrix( ); | |
207 | #endif |
|
235 | #endif | |
208 | convert_averaged_spectral_matrix( averaged_spec_mat_f0, averaged_spec_mat_f0_char); |
|
236 | convert_averaged_spectral_matrix( averaged_spec_mat_f0, averaged_spec_mat_f0_char); | |
209 |
|
237 | |||
210 | send_spectral_matrix( &headerASM, averaged_spec_mat_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM); |
|
238 | send_spectral_matrix( &headerASM, averaged_spec_mat_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM); | |
211 | } |
|
239 | } | |
212 | } |
|
240 | } | |
213 |
|
241 | |||
214 | //***************************** |
|
242 | //***************************** | |
215 | // Spectral matrices processing |
|
243 | // Spectral matrices processing | |
216 | void matrix_average(volatile int *spec_mat, volatile float *averaged_spec_mat) |
|
244 | void matrix_average(volatile int *spec_mat, volatile float *averaged_spec_mat) | |
217 | { |
|
245 | { | |
218 | int i; |
|
246 | int i; | |
219 | for(i=0; i<TOTAL_SIZE_SM; i++){ |
|
247 | for(i=0; i<TOTAL_SIZE_SM; i++){ | |
220 | averaged_spec_mat[i] = averaged_spec_mat[i] + spec_mat_f0_0[i] |
|
248 | averaged_spec_mat[i] = averaged_spec_mat[i] + spec_mat_f0_0[i] | |
221 | + spec_mat_f0_1[i] |
|
249 | + spec_mat_f0_1[i] | |
222 | + spec_mat_f0_c[i] |
|
250 | + spec_mat_f0_c[i] | |
223 | + spec_mat_f0_d[i] |
|
251 | + spec_mat_f0_d[i] | |
224 | + spec_mat_f0_e[i] |
|
252 | + spec_mat_f0_e[i] | |
225 | + spec_mat_f0_f[i] |
|
253 | + spec_mat_f0_f[i] | |
226 | + spec_mat_f0_g[i] |
|
254 | + spec_mat_f0_g[i] | |
227 | + spec_mat_f0_h[i]; |
|
255 | + spec_mat_f0_h[i]; | |
228 | } |
|
256 | } | |
229 | } |
|
257 | } | |
230 |
|
258 | |||
231 | void matrix_reset(volatile float *averaged_spec_mat) |
|
259 | void matrix_reset(volatile float *averaged_spec_mat) | |
232 | { |
|
260 | { | |
233 | // int i; |
|
261 | // int i; | |
234 | // for(i=0; i<TOTAL_SIZE_SM; i++){ |
|
262 | // for(i=0; i<TOTAL_SIZE_SM; i++){ | |
235 | // averaged_spec_mat_f0[i] = 0; |
|
263 | // averaged_spec_mat_f0[i] = 0; | |
236 | // } |
|
264 | // } | |
237 | } |
|
265 | } | |
238 |
|
266 | |||
239 | void matrix_compression(volatile float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat) |
|
267 | void matrix_compression(volatile float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat) | |
240 | { |
|
268 | { | |
241 | int i; |
|
269 | int i; | |
242 | int j; |
|
270 | int j; | |
243 | switch (fChannel){ |
|
271 | switch (fChannel){ | |
244 | case 0: |
|
272 | case 0: | |
245 | for(i=0;i<NB_BINS_COMPRESSED_SM_F0;i++){ |
|
273 | for(i=0;i<NB_BINS_COMPRESSED_SM_F0;i++){ | |
246 | j = 17 + (i * 8); |
|
274 | j = 17 + (i * 8); | |
247 | compressed_spec_mat[i] = (averaged_spec_mat[j] |
|
275 | compressed_spec_mat[i] = (averaged_spec_mat[j] | |
248 | + averaged_spec_mat[j+1] |
|
276 | + averaged_spec_mat[j+1] | |
249 | + averaged_spec_mat[j+2] |
|
277 | + averaged_spec_mat[j+2] | |
250 | + averaged_spec_mat[j+3] |
|
278 | + averaged_spec_mat[j+3] | |
251 | + averaged_spec_mat[j+4] |
|
279 | + averaged_spec_mat[j+4] | |
252 | + averaged_spec_mat[j+5] |
|
280 | + averaged_spec_mat[j+5] | |
253 | + averaged_spec_mat[j+6] |
|
281 | + averaged_spec_mat[j+6] | |
254 | + averaged_spec_mat[j+7])/(8*NB_AVERAGE_NORMAL_f0); |
|
282 | + averaged_spec_mat[j+7])/(8*NB_AVERAGE_NORMAL_f0); | |
255 | } |
|
283 | } | |
256 | break; |
|
284 | break; | |
257 | case 1: |
|
285 | case 1: | |
258 | // case fChannel = f1 to be completed later |
|
286 | // case fChannel = f1 to be completed later | |
259 | break; |
|
287 | break; | |
260 | case 2: |
|
288 | case 2: | |
261 | // case fChannel = f1 to be completed later |
|
289 | // case fChannel = f1 to be completed later | |
262 | break; |
|
290 | break; | |
263 | default: |
|
291 | default: | |
264 | break; |
|
292 | break; | |
265 | } |
|
293 | } | |
266 | } |
|
294 | } | |
267 |
|
295 | |||
268 | void BP1_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1){ |
|
296 | void BP1_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1){ | |
269 | int i; |
|
297 | int i; | |
270 | int j; |
|
298 | int j; | |
271 | unsigned char tmp_u_char; |
|
299 | unsigned char tmp_u_char; | |
272 | unsigned char * pt_char = NULL; |
|
300 | unsigned char * pt_char = NULL; | |
273 | float PSDB, PSDE; |
|
301 | float PSDB, PSDE; | |
274 | float NVEC_V0; |
|
302 | float NVEC_V0; | |
275 | float NVEC_V1; |
|
303 | float NVEC_V1; | |
276 | float NVEC_V2; |
|
304 | float NVEC_V2; | |
277 | //float significand; |
|
305 | //float significand; | |
278 | //int exponent; |
|
306 | //int exponent; | |
279 | float aux; |
|
307 | float aux; | |
280 | float tr_SB_SB; |
|
308 | float tr_SB_SB; | |
281 | float tmp; |
|
309 | float tmp; | |
282 | float sx_re; |
|
310 | float sx_re; | |
283 | float sx_im; |
|
311 | float sx_im; | |
284 | float nebx_re = 0; |
|
312 | float nebx_re = 0; | |
285 | float nebx_im = 0; |
|
313 | float nebx_im = 0; | |
286 | float ny = 0; |
|
314 | float ny = 0; | |
287 | float nz = 0; |
|
315 | float nz = 0; | |
288 | float bx_bx_star = 0; |
|
316 | float bx_bx_star = 0; | |
289 | for(i=0; i<nb_bins_compressed_spec_mat; i++){ |
|
317 | for(i=0; i<nb_bins_compressed_spec_mat; i++){ | |
290 | //============================================== |
|
318 | //============================================== | |
291 | // BP1 PSD == B PAR_LFR_SC_BP1_PE_FL0 == 16 bits |
|
319 | // BP1 PSD == B PAR_LFR_SC_BP1_PE_FL0 == 16 bits | |
292 | PSDB = compressed_spec_mat[i*30] // S11 |
|
320 | PSDB = compressed_spec_mat[i*30] // S11 | |
293 | + compressed_spec_mat[(i*30) + 10] // S22 |
|
321 | + compressed_spec_mat[(i*30) + 10] // S22 | |
294 | + compressed_spec_mat[(i*30) + 18]; // S33 |
|
322 | + compressed_spec_mat[(i*30) + 18]; // S33 | |
295 | //significand = frexp(PSDB, &exponent); |
|
323 | //significand = frexp(PSDB, &exponent); | |
296 | pt_char = (unsigned char*) &PSDB; |
|
324 | pt_char = (unsigned char*) &PSDB; | |
297 | LFR_BP1[(i*9) + 2] = pt_char[0]; // bits 31 downto 24 of the float |
|
325 | LFR_BP1[(i*9) + 2] = pt_char[0]; // bits 31 downto 24 of the float | |
298 | LFR_BP1[(i*9) + 3] = pt_char[1]; // bits 23 downto 16 of the float |
|
326 | LFR_BP1[(i*9) + 3] = pt_char[1]; // bits 23 downto 16 of the float | |
299 | //============================================== |
|
327 | //============================================== | |
300 | // BP1 PSD == E PAR_LFR_SC_BP1_PB_FL0 == 16 bits |
|
328 | // BP1 PSD == E PAR_LFR_SC_BP1_PB_FL0 == 16 bits | |
301 | PSDE = compressed_spec_mat[(i*30) + 24] * K44_pe // S44 |
|
329 | PSDE = compressed_spec_mat[(i*30) + 24] * K44_pe // S44 | |
302 | + compressed_spec_mat[(i*30) + 28] * K55_pe // S55 |
|
330 | + compressed_spec_mat[(i*30) + 28] * K55_pe // S55 | |
303 | + compressed_spec_mat[(i*30) + 26] * K45_pe_re // S45 |
|
331 | + compressed_spec_mat[(i*30) + 26] * K45_pe_re // S45 | |
304 | - compressed_spec_mat[(i*30) + 27] * K45_pe_im; // S45 |
|
332 | - compressed_spec_mat[(i*30) + 27] * K45_pe_im; // S45 | |
305 | pt_char = (unsigned char*) &PSDE; |
|
333 | pt_char = (unsigned char*) &PSDE; | |
306 | LFR_BP1[(i*9) + 0] = pt_char[0]; // bits 31 downto 24 of the float |
|
334 | LFR_BP1[(i*9) + 0] = pt_char[0]; // bits 31 downto 24 of the float | |
307 | LFR_BP1[(i*9) + 1] = pt_char[1]; // bits 23 downto 16 of the float |
|
335 | LFR_BP1[(i*9) + 1] = pt_char[1]; // bits 23 downto 16 of the float | |
308 | //============================================================================== |
|
336 | //============================================================================== | |
309 | // BP1 normal wave vector == PAR_LFR_SC_BP1_NVEC_V0_F0 == 8 bits |
|
337 | // BP1 normal wave vector == PAR_LFR_SC_BP1_NVEC_V0_F0 == 8 bits | |
310 | // == PAR_LFR_SC_BP1_NVEC_V1_F0 == 8 bits |
|
338 | // == PAR_LFR_SC_BP1_NVEC_V1_F0 == 8 bits | |
311 | // == PAR_LFR_SC_BP1_NVEC_V2_F0 == 1 bits |
|
339 | // == PAR_LFR_SC_BP1_NVEC_V2_F0 == 1 bits | |
312 | tmp = sqrt( |
|
340 | tmp = sqrt( | |
313 | compressed_spec_mat[(i*30) + 3]*compressed_spec_mat[(i*30) + 3] //Im S12 |
|
341 | compressed_spec_mat[(i*30) + 3]*compressed_spec_mat[(i*30) + 3] //Im S12 | |
314 | +compressed_spec_mat[(i*30) + 5]*compressed_spec_mat[(i*30) + 5] //Im S13 |
|
342 | +compressed_spec_mat[(i*30) + 5]*compressed_spec_mat[(i*30) + 5] //Im S13 | |
315 | +compressed_spec_mat[(i*30) + 13]*compressed_spec_mat[(i*30) + 13] //Im S23 |
|
343 | +compressed_spec_mat[(i*30) + 13]*compressed_spec_mat[(i*30) + 13] //Im S23 | |
316 | ); |
|
344 | ); | |
317 | NVEC_V0 = compressed_spec_mat[(i*30) + 13] / tmp; // Im S23 |
|
345 | NVEC_V0 = compressed_spec_mat[(i*30) + 13] / tmp; // Im S23 | |
318 | NVEC_V1 = -compressed_spec_mat[(i*30) + 5] / tmp; // Im S13 |
|
346 | NVEC_V1 = -compressed_spec_mat[(i*30) + 5] / tmp; // Im S13 | |
319 | NVEC_V2 = compressed_spec_mat[(i*30) + 3] / tmp; // Im S12 |
|
347 | NVEC_V2 = compressed_spec_mat[(i*30) + 3] / tmp; // Im S12 | |
320 | LFR_BP1[(i*9) + 4] = (char) (NVEC_V0*127); |
|
348 | LFR_BP1[(i*9) + 4] = (char) (NVEC_V0*127); | |
321 | LFR_BP1[(i*9) + 5] = (char) (NVEC_V1*127); |
|
349 | LFR_BP1[(i*9) + 5] = (char) (NVEC_V1*127); | |
322 | pt_char = (unsigned char*) &NVEC_V2; |
|
350 | pt_char = (unsigned char*) &NVEC_V2; | |
323 | LFR_BP1[(i*9) + 6] = pt_char[0] & 0x80; // extract the sign of NVEC_V2 |
|
351 | LFR_BP1[(i*9) + 6] = pt_char[0] & 0x80; // extract the sign of NVEC_V2 | |
324 | //======================================================= |
|
352 | //======================================================= | |
325 | // BP1 ellipticity == PAR_LFR_SC_BP1_ELLIP_F0 == 4 bits |
|
353 | // BP1 ellipticity == PAR_LFR_SC_BP1_ELLIP_F0 == 4 bits | |
326 | aux = 2*tmp / PSDB; // compute the ellipticity |
|
354 | aux = 2*tmp / PSDB; // compute the ellipticity | |
327 | tmp_u_char = (unsigned char) (aux*(16-1)); // convert the ellipticity |
|
355 | tmp_u_char = (unsigned char) (aux*(16-1)); // convert the ellipticity | |
328 | LFR_BP1[i*9+6] = LFR_BP1[i*9+6] | ((tmp_u_char&0x0f)<<3); // keeps 4 bits of the resulting unsigned char |
|
356 | LFR_BP1[i*9+6] = LFR_BP1[i*9+6] | ((tmp_u_char&0x0f)<<3); // keeps 4 bits of the resulting unsigned char | |
329 | //============================================================== |
|
357 | //============================================================== | |
330 | // BP1 degree of polarization == PAR_LFR_SC_BP1_DOP_F0 == 3 bits |
|
358 | // BP1 degree of polarization == PAR_LFR_SC_BP1_DOP_F0 == 3 bits | |
331 | for(j = 0; j<NB_VALUES_PER_SM;j++){ |
|
359 | for(j = 0; j<NB_VALUES_PER_SM;j++){ | |
332 | tr_SB_SB = compressed_spec_mat[i*30] * compressed_spec_mat[i*30] |
|
360 | tr_SB_SB = compressed_spec_mat[i*30] * compressed_spec_mat[i*30] | |
333 | + compressed_spec_mat[(i*30) + 10] * compressed_spec_mat[(i*30) + 10] |
|
361 | + compressed_spec_mat[(i*30) + 10] * compressed_spec_mat[(i*30) + 10] | |
334 | + compressed_spec_mat[(i*30) + 18] * compressed_spec_mat[(i*30) + 18] |
|
362 | + compressed_spec_mat[(i*30) + 18] * compressed_spec_mat[(i*30) + 18] | |
335 | + 2 * compressed_spec_mat[(i*30) + 2] * compressed_spec_mat[(i*30) + 2] |
|
363 | + 2 * compressed_spec_mat[(i*30) + 2] * compressed_spec_mat[(i*30) + 2] | |
336 | + 2 * compressed_spec_mat[(i*30) + 3] * compressed_spec_mat[(i*30) + 3] |
|
364 | + 2 * compressed_spec_mat[(i*30) + 3] * compressed_spec_mat[(i*30) + 3] | |
337 | + 2 * compressed_spec_mat[(i*30) + 4] * compressed_spec_mat[(i*30) + 4] |
|
365 | + 2 * compressed_spec_mat[(i*30) + 4] * compressed_spec_mat[(i*30) + 4] | |
338 | + 2 * compressed_spec_mat[(i*30) + 5] * compressed_spec_mat[(i*30) + 5] |
|
366 | + 2 * compressed_spec_mat[(i*30) + 5] * compressed_spec_mat[(i*30) + 5] | |
339 | + 2 * compressed_spec_mat[(i*30) + 12] * compressed_spec_mat[(i*30) + 12] |
|
367 | + 2 * compressed_spec_mat[(i*30) + 12] * compressed_spec_mat[(i*30) + 12] | |
340 | + 2 * compressed_spec_mat[(i*30) + 13] * compressed_spec_mat[(i*30) + 13]; |
|
368 | + 2 * compressed_spec_mat[(i*30) + 13] * compressed_spec_mat[(i*30) + 13]; | |
341 | } |
|
369 | } | |
342 | aux = PSDB*PSDB; |
|
370 | aux = PSDB*PSDB; | |
343 | tmp = sqrt( abs( ( 3*tr_SB_SB - aux ) / ( 2 * aux ) ) ); |
|
371 | tmp = sqrt( abs( ( 3*tr_SB_SB - aux ) / ( 2 * aux ) ) ); | |
344 | tmp_u_char = (unsigned char) (NVEC_V0*(8-1)); |
|
372 | tmp_u_char = (unsigned char) (NVEC_V0*(8-1)); | |
345 | LFR_BP1[(i*9) + 6] = LFR_BP1[(i*9) + 6] | (tmp_u_char & 0x07); // keeps 3 bits of the resulting unsigned char |
|
373 | LFR_BP1[(i*9) + 6] = LFR_BP1[(i*9) + 6] | (tmp_u_char & 0x07); // keeps 3 bits of the resulting unsigned char | |
346 | //======================================================================================= |
|
374 | //======================================================================================= | |
347 | // BP1 x-component of the normalized Poynting flux == PAR_LFR_SC_BP1_SZ_F0 == 8 bits (7+1) |
|
375 | // BP1 x-component of the normalized Poynting flux == PAR_LFR_SC_BP1_SZ_F0 == 8 bits (7+1) | |
348 | sx_re = compressed_spec_mat[(i*30) + 20] * K34_sx_re |
|
376 | sx_re = compressed_spec_mat[(i*30) + 20] * K34_sx_re | |
349 | + compressed_spec_mat[(i*30) + 6] * K14_sx_re |
|
377 | + compressed_spec_mat[(i*30) + 6] * K14_sx_re | |
350 | + compressed_spec_mat[(i*30) + 8] * K15_sx_re |
|
378 | + compressed_spec_mat[(i*30) + 8] * K15_sx_re | |
351 | + compressed_spec_mat[(i*30) + 14] * K24_sx_re |
|
379 | + compressed_spec_mat[(i*30) + 14] * K24_sx_re | |
352 | + compressed_spec_mat[(i*30) + 16] * K25_sx_re |
|
380 | + compressed_spec_mat[(i*30) + 16] * K25_sx_re | |
353 | + compressed_spec_mat[(i*30) + 22] * K35_sx_re; |
|
381 | + compressed_spec_mat[(i*30) + 22] * K35_sx_re; | |
354 | sx_im = compressed_spec_mat[(i*30) + 21] * K34_sx_im |
|
382 | sx_im = compressed_spec_mat[(i*30) + 21] * K34_sx_im | |
355 | + compressed_spec_mat[(i*30) + 7] * K14_sx_im |
|
383 | + compressed_spec_mat[(i*30) + 7] * K14_sx_im | |
356 | + compressed_spec_mat[(i*30) + 9] * K15_sx_im |
|
384 | + compressed_spec_mat[(i*30) + 9] * K15_sx_im | |
357 | + compressed_spec_mat[(i*30) + 15] * K24_sx_im |
|
385 | + compressed_spec_mat[(i*30) + 15] * K24_sx_im | |
358 | + compressed_spec_mat[(i*30) + 17] * K25_sx_im |
|
386 | + compressed_spec_mat[(i*30) + 17] * K25_sx_im | |
359 | + compressed_spec_mat[(i*30) + 23] * K35_sx_im; |
|
387 | + compressed_spec_mat[(i*30) + 23] * K35_sx_im; | |
360 | LFR_BP1[(i*9) + 7] = ((unsigned char) (sx_re * 128)) & 0x7f; // cf DOC for the compression |
|
388 | LFR_BP1[(i*9) + 7] = ((unsigned char) (sx_re * 128)) & 0x7f; // cf DOC for the compression | |
361 | if ( abs(sx_re) > abs(sx_im) ) { |
|
389 | if ( abs(sx_re) > abs(sx_im) ) { | |
362 | LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] | (0x80); // extract the sector of sx |
|
390 | LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] | (0x80); // extract the sector of sx | |
363 | } |
|
391 | } | |
364 | else { |
|
392 | else { | |
365 | LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] & (0x7f); // extract the sector of sx |
|
393 | LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] & (0x7f); // extract the sector of sx | |
366 | } |
|
394 | } | |
367 | //====================================================================== |
|
395 | //====================================================================== | |
368 | // BP1 phase velocity estimator == PAR_LFR_SC_BP1_VPHI_F0 == 8 bits (7+1) |
|
396 | // BP1 phase velocity estimator == PAR_LFR_SC_BP1_VPHI_F0 == 8 bits (7+1) | |
369 | ny = sin(Alpha_M)*NVEC_V1 + cos(Alpha_M)*NVEC_V2; |
|
397 | ny = sin(Alpha_M)*NVEC_V1 + cos(Alpha_M)*NVEC_V2; | |
370 | nz = NVEC_V0; |
|
398 | nz = NVEC_V0; | |
371 | bx_bx_star = cos(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+10] // re S22 |
|
399 | bx_bx_star = cos(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+10] // re S22 | |
372 | + sin(Alpha_M) * sin(Alpha_M) * compressed_spec_mat[i*30+18] // re S33 |
|
400 | + sin(Alpha_M) * sin(Alpha_M) * compressed_spec_mat[i*30+18] // re S33 | |
373 | - 2 * sin(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+12]; // re S23 |
|
401 | - 2 * sin(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+12]; // re S23 | |
374 | nebx_re = ny * (compressed_spec_mat[(i*30) + 14] * K24_ny_re |
|
402 | nebx_re = ny * (compressed_spec_mat[(i*30) + 14] * K24_ny_re | |
375 | +compressed_spec_mat[(i*30) + 16] * K25_ny_re |
|
403 | +compressed_spec_mat[(i*30) + 16] * K25_ny_re | |
376 | +compressed_spec_mat[(i*30) + 20] * K34_ny_re |
|
404 | +compressed_spec_mat[(i*30) + 20] * K34_ny_re | |
377 | +compressed_spec_mat[(i*30) + 22] * K35_ny_re) |
|
405 | +compressed_spec_mat[(i*30) + 22] * K35_ny_re) | |
378 | + nz * (compressed_spec_mat[(i*30) + 14] * K24_nz_re |
|
406 | + nz * (compressed_spec_mat[(i*30) + 14] * K24_nz_re | |
379 | +compressed_spec_mat[(i*30) + 16] * K25_nz_re |
|
407 | +compressed_spec_mat[(i*30) + 16] * K25_nz_re | |
380 | +compressed_spec_mat[(i*30) + 20] * K34_nz_re |
|
408 | +compressed_spec_mat[(i*30) + 20] * K34_nz_re | |
381 | +compressed_spec_mat[(i*30) + 22] * K35_nz_re); |
|
409 | +compressed_spec_mat[(i*30) + 22] * K35_nz_re); | |
382 | nebx_im = ny * (compressed_spec_mat[(i*30) + 15]*K24_ny_re |
|
410 | nebx_im = ny * (compressed_spec_mat[(i*30) + 15]*K24_ny_re | |
383 | +compressed_spec_mat[(i*30) + 17] * K25_ny_re |
|
411 | +compressed_spec_mat[(i*30) + 17] * K25_ny_re | |
384 | +compressed_spec_mat[(i*30) + 21] * K34_ny_re |
|
412 | +compressed_spec_mat[(i*30) + 21] * K34_ny_re | |
385 | +compressed_spec_mat[(i*30) + 23] * K35_ny_re) |
|
413 | +compressed_spec_mat[(i*30) + 23] * K35_ny_re) | |
386 | + nz * (compressed_spec_mat[(i*30) + 15] * K24_nz_im |
|
414 | + nz * (compressed_spec_mat[(i*30) + 15] * K24_nz_im | |
387 | +compressed_spec_mat[(i*30) + 17] * K25_nz_im |
|
415 | +compressed_spec_mat[(i*30) + 17] * K25_nz_im | |
388 | +compressed_spec_mat[(i*30) + 21] * K34_nz_im |
|
416 | +compressed_spec_mat[(i*30) + 21] * K34_nz_im | |
389 | +compressed_spec_mat[(i*30) + 23] * K35_nz_im); |
|
417 | +compressed_spec_mat[(i*30) + 23] * K35_nz_im); | |
390 | tmp = nebx_re / bx_bx_star; |
|
418 | tmp = nebx_re / bx_bx_star; | |
391 | LFR_BP1[(i*9) + 8] = ((unsigned char) (tmp * 128)) & 0x7f; // cf DOC for the compression |
|
419 | LFR_BP1[(i*9) + 8] = ((unsigned char) (tmp * 128)) & 0x7f; // cf DOC for the compression | |
392 | if ( abs(nebx_re) > abs(nebx_im) ) { |
|
420 | if ( abs(nebx_re) > abs(nebx_im) ) { | |
393 | LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] | (0x80); // extract the sector of nebx |
|
421 | LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] | (0x80); // extract the sector of nebx | |
394 | } |
|
422 | } | |
395 | else { |
|
423 | else { | |
396 | LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] & (0x7f); // extract the sector of nebx |
|
424 | LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] & (0x7f); // extract the sector of nebx | |
397 | } |
|
425 | } | |
398 | } |
|
426 | } | |
399 |
|
427 | |||
400 | } |
|
428 | } | |
401 |
|
429 | |||
402 | void BP2_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat){ |
|
430 | void BP2_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat){ | |
403 | // BP2 autocorrelation |
|
431 | // BP2 autocorrelation | |
404 | int i; |
|
432 | int i; | |
405 | int aux = 0; |
|
433 | int aux = 0; | |
406 |
|
434 | |||
407 | for(i = 0; i<nb_bins_compressed_spec_mat; i++){ |
|
435 | for(i = 0; i<nb_bins_compressed_spec_mat; i++){ | |
408 | // S12 |
|
436 | // S12 | |
409 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 10]); |
|
437 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 10]); | |
410 | compressed_spec_mat[(i*30) + 2] = compressed_spec_mat[(i*30) + 2] / aux; |
|
438 | compressed_spec_mat[(i*30) + 2] = compressed_spec_mat[(i*30) + 2] / aux; | |
411 | compressed_spec_mat[(i*30) + 3] = compressed_spec_mat[(i*30) + 3] / aux; |
|
439 | compressed_spec_mat[(i*30) + 3] = compressed_spec_mat[(i*30) + 3] / aux; | |
412 | // S13 |
|
440 | // S13 | |
413 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 18]); |
|
441 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 18]); | |
414 | compressed_spec_mat[(i*30) + 4] = compressed_spec_mat[(i*30) + 4] / aux; |
|
442 | compressed_spec_mat[(i*30) + 4] = compressed_spec_mat[(i*30) + 4] / aux; | |
415 | compressed_spec_mat[(i*30) + 5] = compressed_spec_mat[(i*30) + 5] / aux; |
|
443 | compressed_spec_mat[(i*30) + 5] = compressed_spec_mat[(i*30) + 5] / aux; | |
416 | // S23 |
|
444 | // S23 | |
417 | aux = sqrt(compressed_spec_mat[i*30+12]*compressed_spec_mat[(i*30) + 18]); |
|
445 | aux = sqrt(compressed_spec_mat[i*30+12]*compressed_spec_mat[(i*30) + 18]); | |
418 | compressed_spec_mat[(i*30) + 12] = compressed_spec_mat[(i*30) + 12] / aux; |
|
446 | compressed_spec_mat[(i*30) + 12] = compressed_spec_mat[(i*30) + 12] / aux; | |
419 | compressed_spec_mat[(i*30) + 13] = compressed_spec_mat[(i*30) + 13] / aux; |
|
447 | compressed_spec_mat[(i*30) + 13] = compressed_spec_mat[(i*30) + 13] / aux; | |
420 | // S45 |
|
448 | // S45 | |
421 | aux = sqrt(compressed_spec_mat[i*30+24]*compressed_spec_mat[(i*30) + 28]); |
|
449 | aux = sqrt(compressed_spec_mat[i*30+24]*compressed_spec_mat[(i*30) + 28]); | |
422 | compressed_spec_mat[(i*30) + 26] = compressed_spec_mat[(i*30) + 26] / aux; |
|
450 | compressed_spec_mat[(i*30) + 26] = compressed_spec_mat[(i*30) + 26] / aux; | |
423 | compressed_spec_mat[(i*30) + 27] = compressed_spec_mat[(i*30) + 27] / aux; |
|
451 | compressed_spec_mat[(i*30) + 27] = compressed_spec_mat[(i*30) + 27] / aux; | |
424 | // S14 |
|
452 | // S14 | |
425 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) +24]); |
|
453 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) +24]); | |
426 | compressed_spec_mat[(i*30) + 6] = compressed_spec_mat[(i*30) + 6] / aux; |
|
454 | compressed_spec_mat[(i*30) + 6] = compressed_spec_mat[(i*30) + 6] / aux; | |
427 | compressed_spec_mat[(i*30) + 7] = compressed_spec_mat[(i*30) + 7] / aux; |
|
455 | compressed_spec_mat[(i*30) + 7] = compressed_spec_mat[(i*30) + 7] / aux; | |
428 | // S15 |
|
456 | // S15 | |
429 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 28]); |
|
457 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 28]); | |
430 | compressed_spec_mat[(i*30) + 8] = compressed_spec_mat[(i*30) + 8] / aux; |
|
458 | compressed_spec_mat[(i*30) + 8] = compressed_spec_mat[(i*30) + 8] / aux; | |
431 | compressed_spec_mat[(i*30) + 9] = compressed_spec_mat[(i*30) + 9] / aux; |
|
459 | compressed_spec_mat[(i*30) + 9] = compressed_spec_mat[(i*30) + 9] / aux; | |
432 | // S24 |
|
460 | // S24 | |
433 | aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 24]); |
|
461 | aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 24]); | |
434 | compressed_spec_mat[(i*30) + 14] = compressed_spec_mat[(i*30) + 14] / aux; |
|
462 | compressed_spec_mat[(i*30) + 14] = compressed_spec_mat[(i*30) + 14] / aux; | |
435 | compressed_spec_mat[(i*30) + 15] = compressed_spec_mat[(i*30) + 15] / aux; |
|
463 | compressed_spec_mat[(i*30) + 15] = compressed_spec_mat[(i*30) + 15] / aux; | |
436 | // S25 |
|
464 | // S25 | |
437 | aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 28]); |
|
465 | aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 28]); | |
438 | compressed_spec_mat[(i*30) + 16] = compressed_spec_mat[(i*30) + 16] / aux; |
|
466 | compressed_spec_mat[(i*30) + 16] = compressed_spec_mat[(i*30) + 16] / aux; | |
439 | compressed_spec_mat[(i*30) + 17] = compressed_spec_mat[(i*30) + 17] / aux; |
|
467 | compressed_spec_mat[(i*30) + 17] = compressed_spec_mat[(i*30) + 17] / aux; | |
440 | // S34 |
|
468 | // S34 | |
441 | aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 24]); |
|
469 | aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 24]); | |
442 | compressed_spec_mat[(i*30) + 20] = compressed_spec_mat[(i*30) + 20] / aux; |
|
470 | compressed_spec_mat[(i*30) + 20] = compressed_spec_mat[(i*30) + 20] / aux; | |
443 | compressed_spec_mat[(i*30) + 21] = compressed_spec_mat[(i*30) + 21] / aux; |
|
471 | compressed_spec_mat[(i*30) + 21] = compressed_spec_mat[(i*30) + 21] / aux; | |
444 | // S35 |
|
472 | // S35 | |
445 | aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 28]); |
|
473 | aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 28]); | |
446 | compressed_spec_mat[(i*30) + 22] = compressed_spec_mat[(i*30) + 22] / aux; |
|
474 | compressed_spec_mat[(i*30) + 22] = compressed_spec_mat[(i*30) + 22] / aux; | |
447 | compressed_spec_mat[(i*30) + 23] = compressed_spec_mat[(i*30) + 23] / aux; |
|
475 | compressed_spec_mat[(i*30) + 23] = compressed_spec_mat[(i*30) + 23] / aux; | |
448 | } |
|
476 | } | |
449 | } |
|
477 | } | |
450 |
|
478 | |||
451 | void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header) |
|
479 | void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header) | |
452 | { |
|
480 | { | |
453 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
481 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; | |
454 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
482 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
455 | header->reserved = 0x00; |
|
483 | header->reserved = 0x00; | |
456 | header->userApplication = CCSDS_USER_APP; |
|
484 | header->userApplication = CCSDS_USER_APP; | |
457 | header->packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL >> 8); |
|
485 | header->packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); | |
458 | header->packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL); |
|
486 | header->packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); | |
459 | header->packetSequenceControl[0] = 0xc0; |
|
487 | header->packetSequenceControl[0] = 0xc0; | |
460 | header->packetSequenceControl[1] = 0x00; |
|
488 | header->packetSequenceControl[1] = 0x00; | |
461 | header->packetLength[0] = 0x00; |
|
489 | header->packetLength[0] = 0x00; | |
462 | header->packetLength[1] = 0x00; |
|
490 | header->packetLength[1] = 0x00; | |
463 | // DATA FIELD HEADER |
|
491 | // DATA FIELD HEADER | |
464 | header->spare1_pusVersion_spare2 = 0x10; |
|
492 | header->spare1_pusVersion_spare2 = 0x10; | |
465 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
493 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
466 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
494 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
467 | header->destinationID = TM_DESTINATION_ID_GROUND; |
|
495 | header->destinationID = TM_DESTINATION_ID_GROUND; | |
468 | // AUXILIARY DATA HEADER |
|
496 | // AUXILIARY DATA HEADER | |
469 | header->sid = 0x00; |
|
497 | header->sid = 0x00; | |
470 | header->biaStatusInfo = 0x00; |
|
498 | header->biaStatusInfo = 0x00; | |
471 | header->cntASM = 0x00; |
|
499 | header->cntASM = 0x00; | |
472 | header->nrASM = 0x00; |
|
500 | header->nrASM = 0x00; | |
473 | header->time[0] = 0x00; |
|
501 | header->time[0] = 0x00; | |
474 | header->time[0] = 0x00; |
|
502 | header->time[0] = 0x00; | |
475 | header->time[0] = 0x00; |
|
503 | header->time[0] = 0x00; | |
476 | header->time[0] = 0x00; |
|
504 | header->time[0] = 0x00; | |
477 | header->time[0] = 0x00; |
|
505 | header->time[0] = 0x00; | |
478 | header->time[0] = 0x00; |
|
506 | header->time[0] = 0x00; | |
479 | header->blkNr[0] = 0x00; // BLK_NR MSB |
|
507 | header->blkNr[0] = 0x00; // BLK_NR MSB | |
480 | header->blkNr[1] = 0x00; // BLK_NR LSB |
|
508 | header->blkNr[1] = 0x00; // BLK_NR LSB | |
481 | } |
|
509 | } | |
482 |
|
510 | |||
483 | void send_spectral_matrix(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, |
|
511 | void send_spectral_matrix(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, | |
484 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send) |
|
512 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send) | |
485 | { |
|
513 | { | |
486 | unsigned int i; |
|
514 | unsigned int i; | |
487 | unsigned int length = 0; |
|
515 | unsigned int length = 0; | |
488 | rtems_status_code status; |
|
516 | rtems_status_code status; | |
489 |
|
517 | |||
490 | header->sid = (unsigned char) sid; |
|
518 | header->sid = (unsigned char) sid; | |
491 |
|
519 | |||
492 | for (i=0; i<2; i++) |
|
520 | for (i=0; i<2; i++) | |
493 | { |
|
521 | { | |
494 | // BUILD THE DATA |
|
522 | // BUILD THE DATA | |
495 | spw_ioctl_send->dlen = TOTAL_SIZE_SM; |
|
523 | spw_ioctl_send->dlen = TOTAL_SIZE_SM; | |
496 | spw_ioctl_send->data = &spectral_matrix[ i * TOTAL_SIZE_SM]; |
|
524 | spw_ioctl_send->data = &spectral_matrix[ i * TOTAL_SIZE_SM]; | |
497 | spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
525 | spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES; | |
498 | spw_ioctl_send->hdr = (char *) header; |
|
526 | spw_ioctl_send->hdr = (char *) header; | |
499 | spw_ioctl_send->options = 0; |
|
527 | spw_ioctl_send->options = 0; | |
500 |
|
528 | |||
501 | // BUILD THE HEADER |
|
529 | // BUILD THE HEADER | |
502 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM; |
|
530 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM; | |
503 | header->packetLength[0] = (unsigned char) (length>>8); |
|
531 | header->packetLength[0] = (unsigned char) (length>>8); | |
504 | header->packetLength[1] = (unsigned char) (length); |
|
532 | header->packetLength[1] = (unsigned char) (length); | |
505 | header->sid = (unsigned char) sid; // SID |
|
533 | header->sid = (unsigned char) sid; // SID | |
506 | header->cntASM = 2; |
|
534 | header->cntASM = 2; | |
507 | header->nrASM = (unsigned char) (i+1); |
|
535 | header->nrASM = (unsigned char) (i+1); | |
508 | header->blkNr[0] =(unsigned char) ( (NB_BINS_PER_SM/2) >> 8 ); // BLK_NR MSB |
|
536 | header->blkNr[0] =(unsigned char) ( (NB_BINS_PER_SM/2) >> 8 ); // BLK_NR MSB | |
509 | header->blkNr[1] = (unsigned char) (NB_BINS_PER_SM/2); // BLK_NR LSB |
|
537 | header->blkNr[1] = (unsigned char) (NB_BINS_PER_SM/2); // BLK_NR LSB | |
510 | // SET PACKET TIME |
|
538 | // SET PACKET TIME | |
511 | header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
539 | header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
512 | header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
540 | header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
513 | header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
541 | header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
514 | header->time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
542 | header->time[3] = (unsigned char) (time_management_regs->coarse_time); | |
515 | header->time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
543 | header->time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
516 | header->time[5] = (unsigned char) (time_management_regs->fine_time); |
|
544 | header->time[5] = (unsigned char) (time_management_regs->fine_time); | |
517 | header->acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
545 | header->acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
518 | header->acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
546 | header->acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
519 | header->acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
547 | header->acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
520 | header->acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time); |
|
548 | header->acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time); | |
521 | header->acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
549 | header->acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
522 | header->acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time); |
|
550 | header->acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time); | |
523 | // SEND PACKET |
|
551 | // SEND PACKET | |
524 | status = write_spw(spw_ioctl_send); |
|
552 | status = write_spw(spw_ioctl_send); | |
525 | if (status != RTEMS_SUCCESSFUL) { |
|
553 | if (status != RTEMS_SUCCESSFUL) { | |
526 | while (true) { |
|
554 | while (true) { | |
527 | if (status != RTEMS_SUCCESSFUL) { |
|
555 | if (status != RTEMS_SUCCESSFUL) { | |
528 | status = write_spw(spw_ioctl_send); |
|
556 | status = write_spw(spw_ioctl_send); | |
529 | //PRINTF1("%d", i) |
|
557 | //PRINTF1("%d", i) | |
530 | sched_yield(); |
|
558 | sched_yield(); | |
531 | } |
|
559 | } | |
532 | else { |
|
560 | else { | |
533 | //PRINTF("\n") |
|
561 | //PRINTF("\n") | |
534 | break; |
|
562 | break; | |
535 | } |
|
563 | } | |
536 | } |
|
564 | } | |
537 | } |
|
565 | } | |
538 | } |
|
566 | } | |
539 | } |
|
567 | } | |
540 |
|
568 | |||
541 | void convert_averaged_spectral_matrix( volatile float *input_matrix, char *output_matrix) |
|
569 | void convert_averaged_spectral_matrix( volatile float *input_matrix, char *output_matrix) | |
542 | { |
|
570 | { | |
543 | unsigned int i; |
|
571 | unsigned int i; | |
544 | unsigned int j; |
|
572 | unsigned int j; | |
545 | char * pt_char_input; |
|
573 | char * pt_char_input; | |
546 | char * pt_char_output; |
|
574 | char * pt_char_output; | |
547 |
|
575 | |||
548 | pt_char_input = NULL; |
|
576 | pt_char_input = NULL; | |
549 | pt_char_output = NULL; |
|
577 | pt_char_output = NULL; | |
550 |
|
578 | |||
551 | for( i=0; i<NB_BINS_PER_SM; i++) |
|
579 | for( i=0; i<NB_BINS_PER_SM; i++) | |
552 | { |
|
580 | { | |
553 | for ( j=0; j<NB_VALUES_PER_SM; j++) |
|
581 | for ( j=0; j<NB_VALUES_PER_SM; j++) | |
554 | { |
|
582 | { | |
555 | pt_char_input = (char*) &input_matrix[ (i*NB_VALUES_PER_SM) + j ]; |
|
583 | pt_char_input = (char*) &input_matrix[ (i*NB_VALUES_PER_SM) + j ]; | |
556 | pt_char_output = (char*) &output_matrix[ 2 * ( (i*NB_VALUES_PER_SM) + j ) ]; |
|
584 | pt_char_output = (char*) &output_matrix[ 2 * ( (i*NB_VALUES_PER_SM) + j ) ]; | |
557 | pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float |
|
585 | pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float | |
558 | pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float |
|
586 | pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float | |
559 | } |
|
587 | } | |
560 | } |
|
588 | } | |
561 | } |
|
589 | } | |
562 |
|
590 | |||
563 | void fill_averaged_spectral_matrix( ) |
|
591 | void fill_averaged_spectral_matrix( ) | |
564 | { |
|
592 | { | |
565 |
|
593 | |||
566 | #ifdef GSA |
|
594 | #ifdef GSA | |
567 | float offset = 10.; |
|
595 | float offset = 10.; | |
568 | float coeff = 100000.; |
|
596 | float coeff = 100000.; | |
569 |
|
597 | |||
570 | averaged_spec_mat_f0[ 0 + 25 * 0 ] = 0. + offset; |
|
598 | averaged_spec_mat_f0[ 0 + 25 * 0 ] = 0. + offset; | |
571 | averaged_spec_mat_f0[ 0 + 25 * 1 ] = 1. + offset; |
|
599 | averaged_spec_mat_f0[ 0 + 25 * 1 ] = 1. + offset; | |
572 | averaged_spec_mat_f0[ 0 + 25 * 2 ] = 2. + offset; |
|
600 | averaged_spec_mat_f0[ 0 + 25 * 2 ] = 2. + offset; | |
573 | averaged_spec_mat_f0[ 0 + 25 * 3 ] = 3. + offset; |
|
601 | averaged_spec_mat_f0[ 0 + 25 * 3 ] = 3. + offset; | |
574 | averaged_spec_mat_f0[ 0 + 25 * 4 ] = 4. + offset; |
|
602 | averaged_spec_mat_f0[ 0 + 25 * 4 ] = 4. + offset; | |
575 | averaged_spec_mat_f0[ 0 + 25 * 5 ] = 5. + offset; |
|
603 | averaged_spec_mat_f0[ 0 + 25 * 5 ] = 5. + offset; | |
576 | averaged_spec_mat_f0[ 0 + 25 * 6 ] = 6. + offset; |
|
604 | averaged_spec_mat_f0[ 0 + 25 * 6 ] = 6. + offset; | |
577 | averaged_spec_mat_f0[ 0 + 25 * 7 ] = 7. + offset; |
|
605 | averaged_spec_mat_f0[ 0 + 25 * 7 ] = 7. + offset; | |
578 | averaged_spec_mat_f0[ 0 + 25 * 8 ] = 8. + offset; |
|
606 | averaged_spec_mat_f0[ 0 + 25 * 8 ] = 8. + offset; | |
579 | averaged_spec_mat_f0[ 0 + 25 * 9 ] = 9. + offset; |
|
607 | averaged_spec_mat_f0[ 0 + 25 * 9 ] = 9. + offset; | |
580 | averaged_spec_mat_f0[ 0 + 25 * 10 ] = 10. + offset; |
|
608 | averaged_spec_mat_f0[ 0 + 25 * 10 ] = 10. + offset; | |
581 | averaged_spec_mat_f0[ 0 + 25 * 11 ] = 11. + offset; |
|
609 | averaged_spec_mat_f0[ 0 + 25 * 11 ] = 11. + offset; | |
582 | averaged_spec_mat_f0[ 0 + 25 * 12 ] = 12. + offset; |
|
610 | averaged_spec_mat_f0[ 0 + 25 * 12 ] = 12. + offset; | |
583 | averaged_spec_mat_f0[ 0 + 25 * 13 ] = 13. + offset; |
|
611 | averaged_spec_mat_f0[ 0 + 25 * 13 ] = 13. + offset; | |
584 | averaged_spec_mat_f0[ 0 + 25 * 14 ] = 14. + offset; |
|
612 | averaged_spec_mat_f0[ 0 + 25 * 14 ] = 14. + offset; | |
585 | averaged_spec_mat_f0[ 9 + 25 * 0 ] = -(0. + offset)* coeff; |
|
613 | averaged_spec_mat_f0[ 9 + 25 * 0 ] = -(0. + offset)* coeff; | |
586 | averaged_spec_mat_f0[ 9 + 25 * 1 ] = -(1. + offset)* coeff; |
|
614 | averaged_spec_mat_f0[ 9 + 25 * 1 ] = -(1. + offset)* coeff; | |
587 | averaged_spec_mat_f0[ 9 + 25 * 2 ] = -(2. + offset)* coeff; |
|
615 | averaged_spec_mat_f0[ 9 + 25 * 2 ] = -(2. + offset)* coeff; | |
588 | averaged_spec_mat_f0[ 9 + 25 * 3 ] = -(3. + offset)* coeff; |
|
616 | averaged_spec_mat_f0[ 9 + 25 * 3 ] = -(3. + offset)* coeff; | |
589 | averaged_spec_mat_f0[ 9 + 25 * 4 ] = -(4. + offset)* coeff; |
|
617 | averaged_spec_mat_f0[ 9 + 25 * 4 ] = -(4. + offset)* coeff; | |
590 | averaged_spec_mat_f0[ 9 + 25 * 5 ] = -(5. + offset)* coeff; |
|
618 | averaged_spec_mat_f0[ 9 + 25 * 5 ] = -(5. + offset)* coeff; | |
591 | averaged_spec_mat_f0[ 9 + 25 * 6 ] = -(6. + offset)* coeff; |
|
619 | averaged_spec_mat_f0[ 9 + 25 * 6 ] = -(6. + offset)* coeff; | |
592 | averaged_spec_mat_f0[ 9 + 25 * 7 ] = -(7. + offset)* coeff; |
|
620 | averaged_spec_mat_f0[ 9 + 25 * 7 ] = -(7. + offset)* coeff; | |
593 | averaged_spec_mat_f0[ 9 + 25 * 8 ] = -(8. + offset)* coeff; |
|
621 | averaged_spec_mat_f0[ 9 + 25 * 8 ] = -(8. + offset)* coeff; | |
594 | averaged_spec_mat_f0[ 9 + 25 * 9 ] = -(9. + offset)* coeff; |
|
622 | averaged_spec_mat_f0[ 9 + 25 * 9 ] = -(9. + offset)* coeff; | |
595 | averaged_spec_mat_f0[ 9 + 25 * 10 ] = -(10. + offset)* coeff; |
|
623 | averaged_spec_mat_f0[ 9 + 25 * 10 ] = -(10. + offset)* coeff; | |
596 | averaged_spec_mat_f0[ 9 + 25 * 11 ] = -(11. + offset)* coeff; |
|
624 | averaged_spec_mat_f0[ 9 + 25 * 11 ] = -(11. + offset)* coeff; | |
597 | averaged_spec_mat_f0[ 9 + 25 * 12 ] = -(12. + offset)* coeff; |
|
625 | averaged_spec_mat_f0[ 9 + 25 * 12 ] = -(12. + offset)* coeff; | |
598 | averaged_spec_mat_f0[ 9 + 25 * 13 ] = -(13. + offset)* coeff; |
|
626 | averaged_spec_mat_f0[ 9 + 25 * 13 ] = -(13. + offset)* coeff; | |
599 | averaged_spec_mat_f0[ 9 + 25 * 14 ] = -(14. + offset)* coeff; |
|
627 | averaged_spec_mat_f0[ 9 + 25 * 14 ] = -(14. + offset)* coeff; | |
600 | offset = 10000000; |
|
628 | offset = 10000000; | |
601 | averaged_spec_mat_f0[ 16 + 25 * 0 ] = (0. + offset)* coeff; |
|
629 | averaged_spec_mat_f0[ 16 + 25 * 0 ] = (0. + offset)* coeff; | |
602 | averaged_spec_mat_f0[ 16 + 25 * 1 ] = (1. + offset)* coeff; |
|
630 | averaged_spec_mat_f0[ 16 + 25 * 1 ] = (1. + offset)* coeff; | |
603 | averaged_spec_mat_f0[ 16 + 25 * 2 ] = (2. + offset)* coeff; |
|
631 | averaged_spec_mat_f0[ 16 + 25 * 2 ] = (2. + offset)* coeff; | |
604 | averaged_spec_mat_f0[ 16 + 25 * 3 ] = (3. + offset)* coeff; |
|
632 | averaged_spec_mat_f0[ 16 + 25 * 3 ] = (3. + offset)* coeff; | |
605 | averaged_spec_mat_f0[ 16 + 25 * 4 ] = (4. + offset)* coeff; |
|
633 | averaged_spec_mat_f0[ 16 + 25 * 4 ] = (4. + offset)* coeff; | |
606 | averaged_spec_mat_f0[ 16 + 25 * 5 ] = (5. + offset)* coeff; |
|
634 | averaged_spec_mat_f0[ 16 + 25 * 5 ] = (5. + offset)* coeff; | |
607 | averaged_spec_mat_f0[ 16 + 25 * 6 ] = (6. + offset)* coeff; |
|
635 | averaged_spec_mat_f0[ 16 + 25 * 6 ] = (6. + offset)* coeff; | |
608 | averaged_spec_mat_f0[ 16 + 25 * 7 ] = (7. + offset)* coeff; |
|
636 | averaged_spec_mat_f0[ 16 + 25 * 7 ] = (7. + offset)* coeff; | |
609 | averaged_spec_mat_f0[ 16 + 25 * 8 ] = (8. + offset)* coeff; |
|
637 | averaged_spec_mat_f0[ 16 + 25 * 8 ] = (8. + offset)* coeff; | |
610 | averaged_spec_mat_f0[ 16 + 25 * 9 ] = (9. + offset)* coeff; |
|
638 | averaged_spec_mat_f0[ 16 + 25 * 9 ] = (9. + offset)* coeff; | |
611 | averaged_spec_mat_f0[ 16 + 25 * 10 ] = (10. + offset)* coeff; |
|
639 | averaged_spec_mat_f0[ 16 + 25 * 10 ] = (10. + offset)* coeff; | |
612 | averaged_spec_mat_f0[ 16 + 25 * 11 ] = (11. + offset)* coeff; |
|
640 | averaged_spec_mat_f0[ 16 + 25 * 11 ] = (11. + offset)* coeff; | |
613 | averaged_spec_mat_f0[ 16 + 25 * 12 ] = (12. + offset)* coeff; |
|
641 | averaged_spec_mat_f0[ 16 + 25 * 12 ] = (12. + offset)* coeff; | |
614 | averaged_spec_mat_f0[ 16 + 25 * 13 ] = (13. + offset)* coeff; |
|
642 | averaged_spec_mat_f0[ 16 + 25 * 13 ] = (13. + offset)* coeff; | |
615 | averaged_spec_mat_f0[ 16 + 25 * 14 ] = (14. + offset)* coeff; |
|
643 | averaged_spec_mat_f0[ 16 + 25 * 14 ] = (14. + offset)* coeff; | |
616 |
|
644 | |||
617 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 0 ] = averaged_spec_mat_f0[ 0 ]; |
|
645 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 0 ] = averaged_spec_mat_f0[ 0 ]; | |
618 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 1 ] = averaged_spec_mat_f0[ 1 ]; |
|
646 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 1 ] = averaged_spec_mat_f0[ 1 ]; | |
619 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 2 ] = averaged_spec_mat_f0[ 2 ]; |
|
647 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 2 ] = averaged_spec_mat_f0[ 2 ]; | |
620 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 3 ] = averaged_spec_mat_f0[ 3 ]; |
|
648 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 3 ] = averaged_spec_mat_f0[ 3 ]; | |
621 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 4 ] = averaged_spec_mat_f0[ 4 ]; |
|
649 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 4 ] = averaged_spec_mat_f0[ 4 ]; | |
622 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 5 ] = averaged_spec_mat_f0[ 5 ]; |
|
650 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 5 ] = averaged_spec_mat_f0[ 5 ]; | |
623 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 6 ] = averaged_spec_mat_f0[ 6 ]; |
|
651 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 6 ] = averaged_spec_mat_f0[ 6 ]; | |
624 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 7 ] = averaged_spec_mat_f0[ 7 ]; |
|
652 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 7 ] = averaged_spec_mat_f0[ 7 ]; | |
625 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 8 ] = averaged_spec_mat_f0[ 8 ]; |
|
653 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 8 ] = averaged_spec_mat_f0[ 8 ]; | |
626 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 9 ] = averaged_spec_mat_f0[ 9 ]; |
|
654 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 9 ] = averaged_spec_mat_f0[ 9 ]; | |
627 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 10 ] = averaged_spec_mat_f0[ 10 ]; |
|
655 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 10 ] = averaged_spec_mat_f0[ 10 ]; | |
628 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 11 ] = averaged_spec_mat_f0[ 11 ]; |
|
656 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 11 ] = averaged_spec_mat_f0[ 11 ]; | |
629 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 12 ] = averaged_spec_mat_f0[ 12 ]; |
|
657 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 12 ] = averaged_spec_mat_f0[ 12 ]; | |
630 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 13 ] = averaged_spec_mat_f0[ 13 ]; |
|
658 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 13 ] = averaged_spec_mat_f0[ 13 ]; | |
631 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 14 ] = averaged_spec_mat_f0[ 14 ]; |
|
659 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 14 ] = averaged_spec_mat_f0[ 14 ]; | |
632 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 15 ] = averaged_spec_mat_f0[ 15 ]; |
|
660 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 15 ] = averaged_spec_mat_f0[ 15 ]; | |
633 | #else |
|
661 | #else | |
634 | unsigned int i; |
|
662 | unsigned int i; | |
635 |
|
663 | |||
636 | for(i=0; i<TOTAL_SIZE_SM; i++) |
|
664 | for(i=0; i<TOTAL_SIZE_SM; i++) | |
637 | { |
|
665 | { | |
638 | if (spectral_matrix_regs->matrixF0_Address0 == (int) spec_mat_f0_0) |
|
666 | if (spectral_matrix_regs->matrixF0_Address0 == (int) spec_mat_f0_0) | |
639 | averaged_spec_mat_f0[i] = (float) spec_mat_f0_0_bis[ SM_HEADER + i ]; |
|
667 | averaged_spec_mat_f0[i] = (float) spec_mat_f0_0_bis[ SM_HEADER + i ]; | |
640 | else |
|
668 | else | |
641 | averaged_spec_mat_f0[i] = (float) spec_mat_f0_0[ SM_HEADER + i ]; |
|
669 | averaged_spec_mat_f0[i] = (float) spec_mat_f0_0[ SM_HEADER + i ]; | |
642 | } |
|
670 | } | |
643 | #endif |
|
671 | #endif | |
644 | } |
|
672 | } | |
645 |
|
673 | |||
646 | void reset_spectral_matrix_regs() |
|
674 | void reset_spectral_matrix_regs() | |
647 | { |
|
675 | { | |
648 | #ifdef GSA |
|
676 | #ifdef GSA | |
649 | #else |
|
677 | #else | |
650 | spectral_matrix_regs->matrixF0_Address0 = (int) spec_mat_f0_0; |
|
678 | spectral_matrix_regs->matrixF0_Address0 = (int) spec_mat_f0_0; | |
651 | spectral_matrix_regs->matrixFO_Address1 = (int) spec_mat_f0_1; |
|
679 | spectral_matrix_regs->matrixFO_Address1 = (int) spec_mat_f0_1; | |
652 | spectral_matrix_regs->matrixF1_Address = (int) spec_mat_f1; |
|
680 | spectral_matrix_regs->matrixF1_Address = (int) spec_mat_f1; | |
653 | spectral_matrix_regs->matrixF2_Address = (int) spec_mat_f2; |
|
681 | spectral_matrix_regs->matrixF2_Address = (int) spec_mat_f2; | |
654 | #endif |
|
682 | #endif | |
655 | } |
|
683 | } | |
656 |
|
684 | |||
657 | //****************** |
|
685 | //****************** | |
658 | // general functions |
|
686 | // general functions | |
659 |
|
687 | |||
660 |
|
688 | |||
661 |
|
689 | |||
662 |
|
690 |
@@ -1,1288 +1,1340 | |||||
1 | #include <tc_handler.h> |
|
1 | #include <tc_handler.h> | |
2 | #include <fsw_params.h> |
|
2 | #include <fsw_params.h> | |
3 |
|
3 | |||
4 | char *DumbMessages[6] = {"in DUMB *** default", // RTEMS_EVENT_0 |
|
4 | char *DumbMessages[6] = {"in DUMB *** default", // RTEMS_EVENT_0 | |
5 | "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1 |
|
5 | "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1 | |
6 | "in DUMB *** waveforms_isr", // RTEMS_EVENT_2 |
|
6 | "in DUMB *** waveforms_isr", // RTEMS_EVENT_2 | |
7 | "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3 |
|
7 | "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3 | |
8 | "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4 |
|
8 | "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4 | |
9 | "in DUMB *** waveforms_simulator_isr" // RTEMS_EVENT_5 |
|
9 | "in DUMB *** waveforms_simulator_isr" // RTEMS_EVENT_5 | |
10 | }; |
|
10 | }; | |
11 |
|
11 | |||
12 | unsigned char currentTC_LEN_RCV[2]; // SHALL be equal to the current TC packet estimated packet length field |
|
12 | unsigned char currentTC_LEN_RCV[2]; // SHALL be equal to the current TC packet estimated packet length field | |
13 | unsigned char currentTC_COMPUTED_CRC[2]; |
|
13 | unsigned char currentTC_COMPUTED_CRC[2]; | |
14 | unsigned int currentTC_LEN_RCV_AsUnsignedInt; |
|
14 | unsigned int currentTC_LEN_RCV_AsUnsignedInt; | |
15 | unsigned int currentTM_length; |
|
15 | unsigned int currentTM_length; | |
16 | unsigned char currentTC_processedFlag; |
|
16 | unsigned char currentTC_processedFlag; | |
17 |
|
17 | |||
18 | unsigned int lookUpTableForCRC[256]; |
|
18 | unsigned int lookUpTableForCRC[256]; | |
19 |
|
19 | |||
20 | //********************** |
|
20 | //********************** | |
21 | // GENERAL USE FUNCTIONS |
|
21 | // GENERAL USE FUNCTIONS | |
22 | unsigned int Crc_opt( unsigned char D, unsigned int Chk) |
|
22 | unsigned int Crc_opt( unsigned char D, unsigned int Chk) | |
23 | { |
|
23 | { | |
24 | return(((Chk << 8) & 0xff00)^lookUpTableForCRC [(((Chk >> 8)^D) & 0x00ff)]); |
|
24 | return(((Chk << 8) & 0xff00)^lookUpTableForCRC [(((Chk >> 8)^D) & 0x00ff)]); | |
25 | } |
|
25 | } | |
26 |
|
26 | |||
27 | void initLookUpTableForCRC( void ) |
|
27 | void initLookUpTableForCRC( void ) | |
28 | { |
|
28 | { | |
29 | unsigned int i; |
|
29 | unsigned int i; | |
30 | unsigned int tmp; |
|
30 | unsigned int tmp; | |
31 |
|
31 | |||
32 | for (i=0; i<256; i++) |
|
32 | for (i=0; i<256; i++) | |
33 | { |
|
33 | { | |
34 | tmp = 0; |
|
34 | tmp = 0; | |
35 | if((i & 1) != 0) { |
|
35 | if((i & 1) != 0) { | |
36 | tmp = tmp ^ 0x1021; |
|
36 | tmp = tmp ^ 0x1021; | |
37 | } |
|
37 | } | |
38 | if((i & 2) != 0) { |
|
38 | if((i & 2) != 0) { | |
39 | tmp = tmp ^ 0x2042; |
|
39 | tmp = tmp ^ 0x2042; | |
40 | } |
|
40 | } | |
41 | if((i & 4) != 0) { |
|
41 | if((i & 4) != 0) { | |
42 | tmp = tmp ^ 0x4084; |
|
42 | tmp = tmp ^ 0x4084; | |
43 | } |
|
43 | } | |
44 | if((i & 8) != 0) { |
|
44 | if((i & 8) != 0) { | |
45 | tmp = tmp ^ 0x8108; |
|
45 | tmp = tmp ^ 0x8108; | |
46 | } |
|
46 | } | |
47 | if((i & 16) != 0) { |
|
47 | if((i & 16) != 0) { | |
48 | tmp = tmp ^ 0x1231; |
|
48 | tmp = tmp ^ 0x1231; | |
49 | } |
|
49 | } | |
50 | if((i & 32) != 0) { |
|
50 | if((i & 32) != 0) { | |
51 | tmp = tmp ^ 0x2462; |
|
51 | tmp = tmp ^ 0x2462; | |
52 | } |
|
52 | } | |
53 | if((i & 64) != 0) { |
|
53 | if((i & 64) != 0) { | |
54 | tmp = tmp ^ 0x48c4; |
|
54 | tmp = tmp ^ 0x48c4; | |
55 | } |
|
55 | } | |
56 | if((i & 128) != 0) { |
|
56 | if((i & 128) != 0) { | |
57 | tmp = tmp ^ 0x9188; |
|
57 | tmp = tmp ^ 0x9188; | |
58 | } |
|
58 | } | |
59 | lookUpTableForCRC[i] = tmp; |
|
59 | lookUpTableForCRC[i] = tmp; | |
60 | } |
|
60 | } | |
61 | } |
|
61 | } | |
62 |
|
62 | |||
63 | void GetCRCAsTwoBytes(unsigned char* data, unsigned char* crcAsTwoBytes, unsigned int sizeOfData) |
|
63 | void GetCRCAsTwoBytes(unsigned char* data, unsigned char* crcAsTwoBytes, unsigned int sizeOfData) | |
64 | { |
|
64 | { | |
65 | unsigned int Chk; |
|
65 | unsigned int Chk; | |
66 | int j; |
|
66 | int j; | |
67 | Chk = 0xffff; // reset the syndrom to all ones |
|
67 | Chk = 0xffff; // reset the syndrom to all ones | |
68 | for (j=0; j<sizeOfData; j++) { |
|
68 | for (j=0; j<sizeOfData; j++) { | |
69 | Chk = Crc_opt(data[j], Chk); |
|
69 | Chk = Crc_opt(data[j], Chk); | |
70 | } |
|
70 | } | |
71 | crcAsTwoBytes[0] = (unsigned char) (Chk >> 8); |
|
71 | crcAsTwoBytes[0] = (unsigned char) (Chk >> 8); | |
72 | crcAsTwoBytes[1] = (unsigned char) (Chk & 0x00ff); |
|
72 | crcAsTwoBytes[1] = (unsigned char) (Chk & 0x00ff); | |
73 | } |
|
73 | } | |
74 |
|
74 | |||
75 | void updateLFRCurrentMode() |
|
75 | void updateLFRCurrentMode() | |
76 | { |
|
76 | { | |
77 | lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
77 | lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
78 | } |
|
78 | } | |
79 |
|
79 | |||
80 | //********************* |
|
80 | //********************* | |
81 | // ACCEPTANCE FUNCTIONS |
|
81 | // ACCEPTANCE FUNCTIONS | |
82 | int TC_acceptance(ccsdsTelecommandPacket_t *TC, unsigned int tc_len_recv) |
|
82 | int TC_acceptance(ccsdsTelecommandPacket_t *TC, unsigned int tc_len_recv) | |
83 | { |
|
83 | { | |
84 | int ret = 0; |
|
84 | int ret = 0; | |
85 | rtems_status_code status; |
|
85 | rtems_status_code status; | |
86 | Packet_TM_LFR_TC_EXE_CORRUPTED_t packet; |
|
86 | Packet_TM_LFR_TC_EXE_CORRUPTED_t packet; | |
87 | unsigned int parserCode = 0; |
|
87 | unsigned int parserCode = 0; | |
88 | unsigned char computed_CRC[2]; |
|
88 | unsigned char computed_CRC[2]; | |
89 | unsigned int packetLength; |
|
89 | unsigned int packetLength; | |
90 |
|
90 | |||
91 | GetCRCAsTwoBytes( (unsigned char*) TC->packetID, computed_CRC, tc_len_recv + 5 ); |
|
91 | GetCRCAsTwoBytes( (unsigned char*) TC->packetID, computed_CRC, tc_len_recv + 5 ); | |
92 | parserCode = TC_parser( TC, tc_len_recv ) ; |
|
92 | parserCode = TC_parser( TC, tc_len_recv ) ; | |
93 | if ( (parserCode == ILLEGAL_APID) | (parserCode == WRONG_LEN_PACKET) | (parserCode == INCOR_CHECKSUM) |
|
93 | if ( (parserCode == ILLEGAL_APID) | (parserCode == WRONG_LEN_PACKET) | (parserCode == INCOR_CHECKSUM) | |
94 | | (parserCode == ILL_TYPE) | (parserCode == ILL_SUBTYPE) | (parserCode == WRONG_APP_DATA) ) |
|
94 | | (parserCode == ILL_TYPE) | (parserCode == ILL_SUBTYPE) | (parserCode == WRONG_APP_DATA) ) | |
95 | { // generate TM_LFR_TC_EXE_CORRUPTED |
|
95 | { // generate TM_LFR_TC_EXE_CORRUPTED | |
96 | packetLength = (TC->packetLength[0] * 256) + TC->packetLength[1]; |
|
96 | packetLength = (TC->packetLength[0] * 256) + TC->packetLength[1]; | |
97 | packet.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
97 | packet.targetLogicalAddress = CCSDS_DESTINATION_ID; | |
98 | packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
98 | packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
99 | packet.reserved = DEFAULT_RESERVED; |
|
99 | packet.reserved = DEFAULT_RESERVED; | |
100 | packet.userApplication = CCSDS_USER_APP; |
|
100 | packet.userApplication = CCSDS_USER_APP; | |
101 | // PACKET HEADER |
|
101 | // PACKET HEADER | |
102 | packet.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); |
|
102 | packet.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); | |
103 | packet.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); |
|
103 | packet.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); | |
104 | packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
104 | packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
105 | packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
105 | packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
106 | packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_CORRUPTED >> 8); |
|
106 | packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_CORRUPTED >> 8); | |
107 | packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_CORRUPTED ); |
|
107 | packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_CORRUPTED ); | |
108 | // DATA FIELD HEADER |
|
108 | // DATA FIELD HEADER | |
109 | packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
109 | packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
110 | packet.serviceType = TM_TYPE_TC_EXE; |
|
110 | packet.serviceType = TM_TYPE_TC_EXE; | |
111 | packet.serviceSubType = TM_SUBTYPE_EXE_NOK; |
|
111 | packet.serviceSubType = TM_SUBTYPE_EXE_NOK; | |
112 | packet.destinationID = TM_DESTINATION_ID_GROUND; |
|
112 | packet.destinationID = TM_DESTINATION_ID_GROUND; | |
113 | packet.time[0] = (time_management_regs->coarse_time>>24 ); |
|
113 | packet.time[0] = (time_management_regs->coarse_time>>24 ); | |
114 | packet.time[1] = (time_management_regs->coarse_time>>16 ); |
|
114 | packet.time[1] = (time_management_regs->coarse_time>>16 ); | |
115 | packet.time[2] = (time_management_regs->coarse_time>>8 ); |
|
115 | packet.time[2] = (time_management_regs->coarse_time>>8 ); | |
116 | packet.time[3] = (time_management_regs->coarse_time ); |
|
116 | packet.time[3] = (time_management_regs->coarse_time ); | |
117 | packet.time[4] = (time_management_regs->fine_time>>8 ); |
|
117 | packet.time[4] = (time_management_regs->fine_time>>8 ); | |
118 | packet.time[5] = (time_management_regs->fine_time ); |
|
118 | packet.time[5] = (time_management_regs->fine_time ); | |
119 | // |
|
119 | // | |
120 | packet.tc_failure_code[0] = (unsigned char) (FAILURE_CODE_CORRUPTED >> 8); |
|
120 | packet.tc_failure_code[0] = (unsigned char) (FAILURE_CODE_CORRUPTED >> 8); | |
121 | packet.tc_failure_code[1] = (unsigned char) (FAILURE_CODE_CORRUPTED ); |
|
121 | packet.tc_failure_code[1] = (unsigned char) (FAILURE_CODE_CORRUPTED ); | |
122 | packet.telecommand_pkt_id[0] = TC->packetID[0]; |
|
122 | packet.telecommand_pkt_id[0] = TC->packetID[0]; | |
123 | packet.telecommand_pkt_id[1] = TC->packetID[1]; |
|
123 | packet.telecommand_pkt_id[1] = TC->packetID[1]; | |
124 | packet.pkt_seq_control[0] = TC->packetSequenceControl[0]; |
|
124 | packet.pkt_seq_control[0] = TC->packetSequenceControl[0]; | |
125 | packet.pkt_seq_control[0] = TC->packetSequenceControl[1]; |
|
125 | packet.pkt_seq_control[0] = TC->packetSequenceControl[1]; | |
126 | packet.tc_service = TC->serviceType; |
|
126 | packet.tc_service = TC->serviceType; | |
127 | packet.tc_subtype = TC->serviceSubType; |
|
127 | packet.tc_subtype = TC->serviceSubType; | |
128 | packet.pkt_len_rcv_value[0] = TC->packetLength[0]; |
|
128 | packet.pkt_len_rcv_value[0] = TC->packetLength[0]; | |
129 | packet.pkt_len_rcv_value[1] = TC->packetLength[1]; |
|
129 | packet.pkt_len_rcv_value[1] = TC->packetLength[1]; | |
130 | packet.pkt_datafieldsize_cnt[0] = currentTC_LEN_RCV[0]; |
|
130 | packet.pkt_datafieldsize_cnt[0] = currentTC_LEN_RCV[0]; | |
131 | packet.pkt_datafieldsize_cnt[1] = currentTC_LEN_RCV[1]; |
|
131 | packet.pkt_datafieldsize_cnt[1] = currentTC_LEN_RCV[1]; | |
132 | packet.rcv_crc[0] = TC->dataAndCRC[packetLength]; |
|
132 | packet.rcv_crc[0] = TC->dataAndCRC[packetLength]; | |
133 | packet.rcv_crc[1] = TC->dataAndCRC[packetLength]; |
|
133 | packet.rcv_crc[1] = TC->dataAndCRC[packetLength]; | |
134 | packet.computed_crc[0] = computed_CRC[0]; |
|
134 | packet.computed_crc[0] = computed_CRC[0]; | |
135 | packet.computed_crc[1] = computed_CRC[1]; |
|
135 | packet.computed_crc[1] = computed_CRC[1]; | |
136 | // SEND PACKET |
|
136 | // SEND PACKET | |
137 | status = write( fdSPW, (char *) &packet, PACKET_LENGTH_TC_EXE_CORRUPTED + CCSDS_TC_TM_PACKET_OFFSET + 4); |
|
137 | status = write( fdSPW, (char *) &packet, PACKET_LENGTH_TC_EXE_CORRUPTED + CCSDS_TC_TM_PACKET_OFFSET + 4); | |
138 | } |
|
138 | } | |
139 | else { // send valid TC to the action launcher |
|
139 | else { // send valid TC to the action launcher | |
140 |
status = rtems_message_queue_send( misc_id[ |
|
140 | status = rtems_message_queue_send( misc_id[QUEUE_QUEU], TC, tc_len_recv + CCSDS_TC_TM_PACKET_OFFSET + 3); | |
141 | ret = -1; |
|
141 | ret = -1; | |
142 | } |
|
142 | } | |
143 | return ret; |
|
143 | return ret; | |
144 | } |
|
144 | } | |
145 |
|
145 | |||
146 | unsigned char TC_parser(ccsdsTelecommandPacket_t * TMPacket, unsigned int TC_LEN_RCV) |
|
146 | unsigned char TC_parser(ccsdsTelecommandPacket_t * TMPacket, unsigned int TC_LEN_RCV) | |
147 | { |
|
147 | { | |
148 | unsigned char ret = 0; |
|
148 | unsigned char ret = 0; | |
149 | unsigned char pid = 0; |
|
149 | unsigned char pid = 0; | |
150 | unsigned char category = 0; |
|
150 | unsigned char category = 0; | |
151 | unsigned int length = 0; |
|
151 | unsigned int length = 0; | |
152 | unsigned char packetType = 0; |
|
152 | unsigned char packetType = 0; | |
153 | unsigned char packetSubtype = 0; |
|
153 | unsigned char packetSubtype = 0; | |
154 | unsigned char * CCSDSContent = NULL; |
|
154 | unsigned char * CCSDSContent = NULL; | |
155 |
|
155 | |||
156 | // APID check *** APID on 2 bytes |
|
156 | // APID check *** APID on 2 bytes | |
157 | pid = ((TMPacket->packetID[0] & 0x07)<<4) + ( (TMPacket->packetID[1]>>4) & 0x0f ); // PID = 11 *** 7 bits xxxxx210 7654xxxx |
|
157 | pid = ((TMPacket->packetID[0] & 0x07)<<4) + ( (TMPacket->packetID[1]>>4) & 0x0f ); // PID = 11 *** 7 bits xxxxx210 7654xxxx | |
158 | category = (TMPacket->packetID[1] & 0x0f); // PACKET_CATEGORY = 12 *** 4 bits xxxxxxxx xxxx3210 |
|
158 | category = (TMPacket->packetID[1] & 0x0f); // PACKET_CATEGORY = 12 *** 4 bits xxxxxxxx xxxx3210 | |
159 | length = (TMPacket->packetLength[0] * 256) + TMPacket->packetLength[1]; |
|
159 | length = (TMPacket->packetLength[0] * 256) + TMPacket->packetLength[1]; | |
160 | packetType = TMPacket->serviceType; |
|
160 | packetType = TMPacket->serviceType; | |
161 | packetSubtype = TMPacket->serviceSubType; |
|
161 | packetSubtype = TMPacket->serviceSubType; | |
162 |
|
162 | |||
163 | if ( pid != CCSDS_PROCESS_ID ) { |
|
163 | if ( pid != CCSDS_PROCESS_ID ) { | |
164 | ret = ILLEGAL_APID; |
|
164 | ret = ILLEGAL_APID; | |
165 | } |
|
165 | } | |
166 | else if ( category != CCSDS_PACKET_CATEGORY ) { |
|
166 | else if ( category != CCSDS_PACKET_CATEGORY ) { | |
167 | ret = ILLEGAL_APID; |
|
167 | ret = ILLEGAL_APID; | |
168 | } |
|
168 | } | |
169 | else if (length != TC_LEN_RCV ) { // packet length check |
|
169 | else if (length != TC_LEN_RCV ) { // packet length check | |
170 | ret = WRONG_LEN_PACKET; // LEN RCV != SIZE FIELD |
|
170 | ret = WRONG_LEN_PACKET; // LEN RCV != SIZE FIELD | |
171 | } |
|
171 | } | |
172 | else if ( length >= CCSDS_TC_PKT_MAX_SIZE ) { |
|
172 | else if ( length >= CCSDS_TC_PKT_MAX_SIZE ) { | |
173 | ret = WRONG_LEN_PACKET; // check that the packet does not exceed the MAX size |
|
173 | ret = WRONG_LEN_PACKET; // check that the packet does not exceed the MAX size | |
174 | } |
|
174 | } | |
175 | else if ( packetType == TC_TYPE_GEN ){ // service type, subtype and packet length check |
|
175 | else if ( packetType == TC_TYPE_GEN ){ // service type, subtype and packet length check | |
176 | switch(packetSubtype){ //subtype, autorized values are 3, 20, 21, 24, 27, 28, 30, 40, 50, 60, 61 |
|
176 | switch(packetSubtype){ //subtype, autorized values are 3, 20, 21, 24, 27, 28, 30, 40, 50, 60, 61 | |
177 | case TC_SUBTYPE_RESET: |
|
177 | case TC_SUBTYPE_RESET: | |
178 | if (length!=(TC_LEN_RESET-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
178 | if (length!=(TC_LEN_RESET-CCSDS_TC_TM_PACKET_OFFSET)) { | |
179 | ret = WRONG_LEN_PACKET; |
|
179 | ret = WRONG_LEN_PACKET; | |
180 | } |
|
180 | } | |
181 | else { |
|
181 | else { | |
182 | ret = CCSDS_TM_VALID; |
|
182 | ret = CCSDS_TM_VALID; | |
183 | } |
|
183 | } | |
184 | break; |
|
184 | break; | |
185 | case TC_SUBTYPE_LOAD_COMM: |
|
185 | case TC_SUBTYPE_LOAD_COMM: | |
186 | if (length!=(TC_LEN_LOAD_COMM-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
186 | if (length!=(TC_LEN_LOAD_COMM-CCSDS_TC_TM_PACKET_OFFSET)) { | |
187 | ret = WRONG_LEN_PACKET; |
|
187 | ret = WRONG_LEN_PACKET; | |
188 | } |
|
188 | } | |
189 | else { |
|
189 | else { | |
190 | ret = CCSDS_TM_VALID; |
|
190 | ret = CCSDS_TM_VALID; | |
191 | } |
|
191 | } | |
192 | break; |
|
192 | break; | |
193 | case TC_SUBTYPE_LOAD_NORM: |
|
193 | case TC_SUBTYPE_LOAD_NORM: | |
194 | if (length!=(TC_LEN_LOAD_NORM-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
194 | if (length!=(TC_LEN_LOAD_NORM-CCSDS_TC_TM_PACKET_OFFSET)) { | |
195 | ret = WRONG_LEN_PACKET; |
|
195 | ret = WRONG_LEN_PACKET; | |
196 | } |
|
196 | } | |
197 | else { |
|
197 | else { | |
198 | ret = CCSDS_TM_VALID; |
|
198 | ret = CCSDS_TM_VALID; | |
199 | } |
|
199 | } | |
200 | break; |
|
200 | break; | |
201 | case TC_SUBTYPE_LOAD_BURST: |
|
201 | case TC_SUBTYPE_LOAD_BURST: | |
202 | if (length!=(TC_LEN_LOAD_BURST-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
202 | if (length!=(TC_LEN_LOAD_BURST-CCSDS_TC_TM_PACKET_OFFSET)) { | |
203 | ret = WRONG_LEN_PACKET; |
|
203 | ret = WRONG_LEN_PACKET; | |
204 | } |
|
204 | } | |
205 | else { |
|
205 | else { | |
206 | ret = CCSDS_TM_VALID; |
|
206 | ret = CCSDS_TM_VALID; | |
207 | } |
|
207 | } | |
208 | break; |
|
208 | break; | |
209 | case TC_SUBTYPE_LOAD_SBM1: |
|
209 | case TC_SUBTYPE_LOAD_SBM1: | |
210 | if (length!=(TC_LEN_LOAD_SBM1-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
210 | if (length!=(TC_LEN_LOAD_SBM1-CCSDS_TC_TM_PACKET_OFFSET)) { | |
211 | ret = WRONG_LEN_PACKET; |
|
211 | ret = WRONG_LEN_PACKET; | |
212 | } |
|
212 | } | |
213 | else { |
|
213 | else { | |
214 | ret = CCSDS_TM_VALID; |
|
214 | ret = CCSDS_TM_VALID; | |
215 | } |
|
215 | } | |
216 | break; |
|
216 | break; | |
217 | case TC_SUBTYPE_LOAD_SBM2: |
|
217 | case TC_SUBTYPE_LOAD_SBM2: | |
218 | if (length!=(TC_LEN_LOAD_SBM2-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
218 | if (length!=(TC_LEN_LOAD_SBM2-CCSDS_TC_TM_PACKET_OFFSET)) { | |
219 | ret = WRONG_LEN_PACKET; |
|
219 | ret = WRONG_LEN_PACKET; | |
220 | } |
|
220 | } | |
221 | else { |
|
221 | else { | |
222 | ret = CCSDS_TM_VALID; |
|
222 | ret = CCSDS_TM_VALID; | |
223 | } |
|
223 | } | |
224 | break; |
|
224 | break; | |
225 | case TC_SUBTYPE_DUMP: |
|
225 | case TC_SUBTYPE_DUMP: | |
226 | if (length!=(TC_LEN_DUMP-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
226 | if (length!=(TC_LEN_DUMP-CCSDS_TC_TM_PACKET_OFFSET)) { | |
227 | ret = WRONG_LEN_PACKET; |
|
227 | ret = WRONG_LEN_PACKET; | |
228 | } |
|
228 | } | |
229 | else { |
|
229 | else { | |
230 | ret = CCSDS_TM_VALID; |
|
230 | ret = CCSDS_TM_VALID; | |
231 | } |
|
231 | } | |
232 | break; |
|
232 | break; | |
233 | case TC_SUBTYPE_ENTER: |
|
233 | case TC_SUBTYPE_ENTER: | |
234 | if (length!=(TC_LEN_ENTER-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
234 | if (length!=(TC_LEN_ENTER-CCSDS_TC_TM_PACKET_OFFSET)) { | |
235 | ret = WRONG_LEN_PACKET; |
|
235 | ret = WRONG_LEN_PACKET; | |
236 | } |
|
236 | } | |
237 | else { |
|
237 | else { | |
238 | ret = CCSDS_TM_VALID; |
|
238 | ret = CCSDS_TM_VALID; | |
239 | } |
|
239 | } | |
240 | break; |
|
240 | break; | |
241 | case TC_SUBTYPE_UPDT_INFO: |
|
241 | case TC_SUBTYPE_UPDT_INFO: | |
242 | if (length!=(TC_LEN_UPDT_INFO-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
242 | if (length!=(TC_LEN_UPDT_INFO-CCSDS_TC_TM_PACKET_OFFSET)) { | |
243 | ret = WRONG_LEN_PACKET; |
|
243 | ret = WRONG_LEN_PACKET; | |
244 | } |
|
244 | } | |
245 | else { |
|
245 | else { | |
246 | ret = CCSDS_TM_VALID; |
|
246 | ret = CCSDS_TM_VALID; | |
247 | } |
|
247 | } | |
248 | break; |
|
248 | break; | |
249 | case TC_SUBTYPE_EN_CAL: |
|
249 | case TC_SUBTYPE_EN_CAL: | |
250 | if (length!=(TC_LEN_EN_CAL-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
250 | if (length!=(TC_LEN_EN_CAL-CCSDS_TC_TM_PACKET_OFFSET)) { | |
251 | ret = WRONG_LEN_PACKET; |
|
251 | ret = WRONG_LEN_PACKET; | |
252 | } |
|
252 | } | |
253 | else { |
|
253 | else { | |
254 | ret = CCSDS_TM_VALID; |
|
254 | ret = CCSDS_TM_VALID; | |
255 | } |
|
255 | } | |
256 | break; |
|
256 | break; | |
257 | case TC_SUBTYPE_DIS_CAL: |
|
257 | case TC_SUBTYPE_DIS_CAL: | |
258 | if (length!=(TC_LEN_DIS_CAL-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
258 | if (length!=(TC_LEN_DIS_CAL-CCSDS_TC_TM_PACKET_OFFSET)) { | |
259 | ret = WRONG_LEN_PACKET; |
|
259 | ret = WRONG_LEN_PACKET; | |
260 | } |
|
260 | } | |
261 | else { |
|
261 | else { | |
262 | ret = CCSDS_TM_VALID; |
|
262 | ret = CCSDS_TM_VALID; | |
263 | } |
|
263 | } | |
264 | break; |
|
264 | break; | |
265 | default: |
|
265 | default: | |
266 | ret = ILL_SUBTYPE; |
|
266 | ret = ILL_SUBTYPE; | |
267 | break; |
|
267 | break; | |
268 | } |
|
268 | } | |
269 | } |
|
269 | } | |
270 | else if ( packetType == TC_TYPE_TIME ){ |
|
270 | else if ( packetType == TC_TYPE_TIME ){ | |
271 | if (packetSubtype!=TC_SUBTYPE_UPDT_TIME) { |
|
271 | if (packetSubtype!=TC_SUBTYPE_UPDT_TIME) { | |
272 | ret = ILL_SUBTYPE; |
|
272 | ret = ILL_SUBTYPE; | |
273 | } |
|
273 | } | |
274 | else if (length!=(TC_LEN_UPDT_TIME-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
274 | else if (length!=(TC_LEN_UPDT_TIME-CCSDS_TC_TM_PACKET_OFFSET)) { | |
275 | ret = WRONG_LEN_PACKET; |
|
275 | ret = WRONG_LEN_PACKET; | |
276 | } |
|
276 | } | |
277 | else { |
|
277 | else { | |
278 | ret = CCSDS_TM_VALID; |
|
278 | ret = CCSDS_TM_VALID; | |
279 | } |
|
279 | } | |
280 | } |
|
280 | } | |
281 | else { |
|
281 | else { | |
282 | ret = ILL_TYPE; |
|
282 | ret = ILL_TYPE; | |
283 | } |
|
283 | } | |
284 |
|
284 | |||
285 | // source ID check // Source ID not documented in the ICD |
|
285 | // source ID check // Source ID not documented in the ICD | |
286 |
|
286 | |||
287 | // packet error control, CRC check |
|
287 | // packet error control, CRC check | |
288 | if ( ret == CCSDS_TM_VALID ) { |
|
288 | if ( ret == CCSDS_TM_VALID ) { | |
289 | CCSDSContent = (unsigned char*) TMPacket->packetID; |
|
289 | CCSDSContent = (unsigned char*) TMPacket->packetID; | |
290 | GetCRCAsTwoBytes(CCSDSContent, currentTC_COMPUTED_CRC, length + CCSDS_TC_TM_PACKET_OFFSET - 2); // 2 CRC bytes removed from the calculation of the CRC |
|
290 | GetCRCAsTwoBytes(CCSDSContent, currentTC_COMPUTED_CRC, length + CCSDS_TC_TM_PACKET_OFFSET - 2); // 2 CRC bytes removed from the calculation of the CRC | |
291 | if (currentTC_COMPUTED_CRC[0] != CCSDSContent[length + CCSDS_TC_TM_PACKET_OFFSET -2]) { |
|
291 | if (currentTC_COMPUTED_CRC[0] != CCSDSContent[length + CCSDS_TC_TM_PACKET_OFFSET -2]) { | |
292 | ret = INCOR_CHECKSUM; |
|
292 | ret = INCOR_CHECKSUM; | |
293 | } |
|
293 | } | |
294 | else if (currentTC_COMPUTED_CRC[1] != CCSDSContent[length + CCSDS_TC_TM_PACKET_OFFSET -1]) { |
|
294 | else if (currentTC_COMPUTED_CRC[1] != CCSDSContent[length + CCSDS_TC_TM_PACKET_OFFSET -1]) { | |
295 | ret = INCOR_CHECKSUM; |
|
295 | ret = INCOR_CHECKSUM; | |
296 | } |
|
296 | } | |
297 | else { |
|
297 | else { | |
298 | ret = CCSDS_TM_VALID; |
|
298 | ret = CCSDS_TM_VALID; | |
299 | } |
|
299 | } | |
300 | } |
|
300 | } | |
301 |
|
301 | |||
302 | return ret; |
|
302 | return ret; | |
303 | } |
|
303 | } | |
304 |
|
304 | |||
305 | unsigned char TM_build_header( enum TM_TYPE tm_type, unsigned int packetLength, |
|
305 | unsigned char TM_build_header( enum TM_TYPE tm_type, unsigned int packetLength, | |
306 | TMHeader_t *TMHeader, unsigned char tc_sid) |
|
306 | TMHeader_t *TMHeader, unsigned char tc_sid) | |
307 | { |
|
307 | { | |
308 | TMHeader->targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
308 | TMHeader->targetLogicalAddress = CCSDS_DESTINATION_ID; | |
309 | TMHeader->protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
309 | TMHeader->protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
310 | TMHeader->reserved = 0x00; |
|
310 | TMHeader->reserved = 0x00; | |
311 | TMHeader->userApplication = 0x00; |
|
311 | TMHeader->userApplication = 0x00; | |
312 | TMHeader->packetID[0] = 0x0c; |
|
312 | TMHeader->packetID[0] = 0x0c; | |
313 | TMHeader->packetSequenceControl[0] = 0xc0; |
|
313 | TMHeader->packetSequenceControl[0] = 0xc0; | |
314 | TMHeader->packetSequenceControl[1] = 0x00; |
|
314 | TMHeader->packetSequenceControl[1] = 0x00; | |
315 | TMHeader->packetLength[0] = (unsigned char) (packetLength>>8); |
|
315 | TMHeader->packetLength[0] = (unsigned char) (packetLength>>8); | |
316 | TMHeader->packetLength[1] = (unsigned char) packetLength; |
|
316 | TMHeader->packetLength[1] = (unsigned char) packetLength; | |
317 | TMHeader->spare1_pusVersion_spare2 = 0x10; |
|
317 | TMHeader->spare1_pusVersion_spare2 = 0x10; | |
318 | TMHeader->destinationID = TM_DESTINATION_ID_GROUND; // default destination id |
|
318 | TMHeader->destinationID = TM_DESTINATION_ID_GROUND; // default destination id | |
319 | switch (tm_type){ |
|
319 | switch (tm_type){ | |
320 | case(TM_LFR_TC_EXE_OK): |
|
320 | case(TM_LFR_TC_EXE_OK): | |
321 | TMHeader->packetID[1] = (unsigned char) TM_PACKET_ID_TC_EXE; |
|
321 | TMHeader->packetID[1] = (unsigned char) TM_PACKET_ID_TC_EXE; | |
322 | TMHeader->serviceType = TM_TYPE_TC_EXE; // type |
|
322 | TMHeader->serviceType = TM_TYPE_TC_EXE; // type | |
323 | TMHeader->serviceSubType = TM_SUBTYPE_EXE_OK; // subtype |
|
323 | TMHeader->serviceSubType = TM_SUBTYPE_EXE_OK; // subtype | |
324 | TMHeader->destinationID = tc_sid; // destination id |
|
324 | TMHeader->destinationID = tc_sid; // destination id | |
325 | break; |
|
325 | break; | |
326 | case(TM_LFR_TC_EXE_ERR): |
|
326 | case(TM_LFR_TC_EXE_ERR): | |
327 | TMHeader->packetID[1] = (unsigned char) TM_PACKET_ID_TC_EXE; |
|
327 | TMHeader->packetID[1] = (unsigned char) TM_PACKET_ID_TC_EXE; | |
328 | TMHeader->serviceType = TM_TYPE_TC_EXE; // type |
|
328 | TMHeader->serviceType = TM_TYPE_TC_EXE; // type | |
329 | TMHeader->serviceSubType = TM_SUBTYPE_EXE_NOK; // subtype |
|
329 | TMHeader->serviceSubType = TM_SUBTYPE_EXE_NOK; // subtype | |
330 | TMHeader->destinationID = tc_sid; |
|
330 | TMHeader->destinationID = tc_sid; | |
331 | break; |
|
331 | break; | |
332 | case(TM_LFR_HK): |
|
332 | case(TM_LFR_HK): | |
333 | TMHeader->packetID[1] = (unsigned char) TM_PACKET_ID_HK; |
|
333 | TMHeader->packetID[1] = (unsigned char) TM_PACKET_ID_HK; | |
334 | TMHeader->serviceType = TM_TYPE_HK; // type |
|
334 | TMHeader->serviceType = TM_TYPE_HK; // type | |
335 | TMHeader->serviceSubType = TM_SUBTYPE_HK; // subtype |
|
335 | TMHeader->serviceSubType = TM_SUBTYPE_HK; // subtype | |
336 | break; |
|
336 | break; | |
337 | case(TM_LFR_SCI): |
|
337 | case(TM_LFR_SCI): | |
338 | TMHeader->packetID[1] = (unsigned char) TM_PACKET_ID_SCIENCE_NORMAL; |
|
338 | TMHeader->packetID[1] = (unsigned char) TM_PACKET_ID_SCIENCE_NORMAL_BURST; | |
339 | TMHeader->serviceType = TM_TYPE_LFR_SCIENCE; // type |
|
339 | TMHeader->serviceType = TM_TYPE_LFR_SCIENCE; // type | |
340 | TMHeader->serviceSubType = TM_SUBTYPE_SCIENCE; // subtype |
|
340 | TMHeader->serviceSubType = TM_SUBTYPE_SCIENCE; // subtype | |
341 | break; |
|
341 | break; | |
342 | case(TM_LFR_SCI_SBM): |
|
342 | case(TM_LFR_SCI_SBM): | |
343 |
TMHeader->packetID[1] = (unsigned char) TM_PACKET_ID_SCIENCE_ |
|
343 | TMHeader->packetID[1] = (unsigned char) TM_PACKET_ID_SCIENCE_SBM1_SBM2; | |
344 | TMHeader->serviceType = TM_TYPE_LFR_SCIENCE; // type |
|
344 | TMHeader->serviceType = TM_TYPE_LFR_SCIENCE; // type | |
345 | TMHeader->serviceSubType = TM_SUBTYPE_SCIENCE; // subtype |
|
345 | TMHeader->serviceSubType = TM_SUBTYPE_SCIENCE; // subtype | |
346 | break; |
|
346 | break; | |
347 | case(TM_LFR_PAR_DUMP): |
|
347 | case(TM_LFR_PAR_DUMP): | |
348 | TMHeader->packetID[1] = (unsigned char) TM_PACKET_ID_PARAMETER_DUMP; |
|
348 | TMHeader->packetID[1] = (unsigned char) TM_PACKET_ID_PARAMETER_DUMP; | |
349 | TMHeader->serviceType = TM_TYPE_HK; // type |
|
349 | TMHeader->serviceType = TM_TYPE_HK; // type | |
350 | TMHeader->serviceSubType = TM_SUBTYPE_HK; // subtype |
|
350 | TMHeader->serviceSubType = TM_SUBTYPE_HK; // subtype | |
351 | break; |
|
351 | break; | |
352 | default: |
|
352 | default: | |
353 | return 0; |
|
353 | return 0; | |
354 | } |
|
354 | } | |
355 | TMHeader->time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
355 | TMHeader->time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
356 | TMHeader->time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
356 | TMHeader->time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
357 | TMHeader->time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
357 | TMHeader->time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
358 | TMHeader->time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
358 | TMHeader->time[3] = (unsigned char) (time_management_regs->coarse_time); | |
359 | TMHeader->time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
359 | TMHeader->time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
360 | TMHeader->time[5] = (unsigned char) (time_management_regs->fine_time); |
|
360 | TMHeader->time[5] = (unsigned char) (time_management_regs->fine_time); | |
361 |
|
361 | |||
362 | return LFR_SUCCESSFUL; |
|
362 | return LFR_SUCCESSFUL; | |
363 | } |
|
363 | } | |
364 |
|
364 | |||
365 | //*********** |
|
365 | //*********** | |
366 | // RTEMS TASK |
|
366 | // RTEMS TASK | |
367 | rtems_task recv_task( rtems_task_argument unused ) |
|
367 | rtems_task recv_task( rtems_task_argument unused ) | |
368 | { |
|
368 | { | |
369 | int len = 0; |
|
369 | int len = 0; | |
370 | unsigned int i = 0; |
|
370 | unsigned int i = 0; | |
371 | unsigned int data_length = 0; |
|
371 | unsigned int data_length = 0; | |
372 | ccsdsTelecommandPacket_t currentTC; |
|
372 | ccsdsTelecommandPacket_t currentTC; | |
373 | char data[100]; |
|
373 | char data[100]; | |
374 |
|
374 | |||
375 | for(i=0; i<100; i++) data[i] = 0; |
|
375 | for(i=0; i<100; i++) data[i] = 0; | |
376 |
|
376 | |||
377 | PRINTF("in RECV *** \n") |
|
377 | PRINTF("in RECV *** \n") | |
378 |
|
378 | |||
379 | while(1) |
|
379 | while(1) | |
380 | { |
|
380 | { | |
381 | len = read(fdSPW, (char*) ¤tTC, CCSDS_TC_PKT_MAX_SIZE); // the call to read is blocking |
|
381 | len = read(fdSPW, (char*) ¤tTC, CCSDS_TC_PKT_MAX_SIZE); // the call to read is blocking | |
382 | if (len == -1){ // error during the read call |
|
382 | if (len == -1){ // error during the read call | |
383 | PRINTF("In RECV *** last read call returned -1\n") |
|
383 | PRINTF("In RECV *** last read call returned -1\n") | |
384 | //if (rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT ) != RTEMS_SUCCESSFUL) { |
|
384 | //if (rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT ) != RTEMS_SUCCESSFUL) { | |
385 | // PRINTF("IN RECV *** Error: rtems_event_send SPW_LINKERR_EVENT\n") |
|
385 | // PRINTF("IN RECV *** Error: rtems_event_send SPW_LINKERR_EVENT\n") | |
386 | //} |
|
386 | //} | |
387 | //if (rtems_task_suspend(RTEMS_SELF) != RTEMS_SUCCESSFUL) { |
|
387 | //if (rtems_task_suspend(RTEMS_SELF) != RTEMS_SUCCESSFUL) { | |
388 | // PRINTF("In RECV *** Error: rtems_task_suspend(RTEMS_SELF)\n") |
|
388 | // PRINTF("In RECV *** Error: rtems_task_suspend(RTEMS_SELF)\n") | |
389 | //} |
|
389 | //} | |
390 | } |
|
390 | } | |
391 | else { |
|
391 | else { | |
392 | PRINTF1("Got pck of length %d\n", len+1) |
|
|||
393 | if ( (len+1) < CCSDS_TC_PKT_MIN_SIZE ) { |
|
392 | if ( (len+1) < CCSDS_TC_PKT_MIN_SIZE ) { | |
394 | PRINTF("In RECV *** packet lenght too short\n") |
|
393 | PRINTF("In RECV *** packet lenght too short\n") | |
395 | } |
|
394 | } | |
396 | else { |
|
395 | else { | |
397 | currentTC_LEN_RCV[0] = 0x00; |
|
396 | currentTC_LEN_RCV[0] = 0x00; | |
398 | currentTC_LEN_RCV[1] = (unsigned char) (len - CCSDS_TC_TM_PACKET_OFFSET - 3); // build the corresponding packet size field |
|
397 | currentTC_LEN_RCV[1] = (unsigned char) (len - CCSDS_TC_TM_PACKET_OFFSET - 3); // build the corresponding packet size field | |
399 | currentTC_LEN_RCV_AsUnsignedInt = (unsigned int) (len - CCSDS_TC_TM_PACKET_OFFSET - 3); // => -3 is for Prot ID, Reserved and User App bytes |
|
398 | currentTC_LEN_RCV_AsUnsignedInt = (unsigned int) (len - CCSDS_TC_TM_PACKET_OFFSET - 3); // => -3 is for Prot ID, Reserved and User App bytes | |
400 | // CHECK THE TC AND BUILD THE APPROPRIATE TM |
|
399 | // CHECK THE TC AND BUILD THE APPROPRIATE TM | |
401 | data_length = TC_acceptance(¤tTC, currentTC_LEN_RCV_AsUnsignedInt); |
|
400 | data_length = TC_acceptance(¤tTC, currentTC_LEN_RCV_AsUnsignedInt); | |
402 | if (data_length!=-1) |
|
401 | if (data_length!=-1) | |
403 | { |
|
402 | { | |
404 | } |
|
403 | } | |
405 | } |
|
404 | } | |
406 | } |
|
405 | } | |
407 | } |
|
406 | } | |
408 | } |
|
407 | } | |
409 |
|
408 | |||
410 | rtems_task actn_task( rtems_task_argument unused ) |
|
409 | rtems_task actn_task( rtems_task_argument unused ) | |
411 | { |
|
410 | { | |
412 | int result; |
|
411 | int result; | |
413 | rtems_status_code status; // RTEMS status code |
|
412 | rtems_status_code status; // RTEMS status code | |
414 | ccsdsTelecommandPacket_t TC; // TC sent to the ACTN task |
|
413 | ccsdsTelecommandPacket_t TC; // TC sent to the ACTN task | |
415 | size_t size; // size of the incoming TC packet |
|
414 | size_t size; // size of the incoming TC packet | |
416 | unsigned char subtype; // subtype of the current TC packet |
|
415 | unsigned char subtype; // subtype of the current TC packet | |
417 |
|
416 | |||
418 | result = LFR_SUCCESSFUL; |
|
417 | result = LFR_SUCCESSFUL; | |
419 | subtype = 0; // subtype of the current TC packet |
|
418 | subtype = 0; // subtype of the current TC packet | |
420 |
|
419 | |||
421 | PRINTF("in ACTN *** \n") |
|
420 | PRINTF("in ACTN *** \n") | |
422 |
|
421 | |||
423 | while(1) |
|
422 | while(1) | |
424 | { |
|
423 | { | |
425 |
status = rtems_message_queue_receive(misc_id[ |
|
424 | status = rtems_message_queue_receive(misc_id[QUEUE_QUEU], (char*) &TC, &size, | |
426 | RTEMS_WAIT, RTEMS_NO_TIMEOUT); |
|
425 | RTEMS_WAIT, RTEMS_NO_TIMEOUT); | |
427 | if (status!=RTEMS_SUCCESSFUL) PRINTF1("ERR *** in task ACTN *** error receiving a message, code %d \n", status) |
|
426 | if (status!=RTEMS_SUCCESSFUL) PRINTF1("ERR *** in task ACTN *** error receiving a message, code %d \n", status) | |
428 | else |
|
427 | else | |
429 | { |
|
428 | { | |
430 | subtype = TC.serviceSubType; |
|
429 | subtype = TC.serviceSubType; | |
431 | switch(subtype) |
|
430 | switch(subtype) | |
432 | { |
|
431 | { | |
433 | case TC_SUBTYPE_RESET: |
|
432 | case TC_SUBTYPE_RESET: | |
434 | result = action_reset( &TC ); |
|
433 | result = action_reset( &TC ); | |
435 | close_action( &TC, result ); |
|
434 | close_action( &TC, result ); | |
436 | break; |
|
435 | break; | |
437 | // |
|
436 | // | |
438 | case TC_SUBTYPE_LOAD_COMM: |
|
437 | case TC_SUBTYPE_LOAD_COMM: | |
439 | result = action_load_common_par( &TC ); |
|
438 | result = action_load_common_par( &TC ); | |
440 | close_action( &TC, result ); |
|
439 | close_action( &TC, result ); | |
441 | break; |
|
440 | break; | |
442 | // |
|
441 | // | |
443 | case TC_SUBTYPE_LOAD_NORM: |
|
442 | case TC_SUBTYPE_LOAD_NORM: | |
444 | result = action_load_normal_par( &TC ); |
|
443 | result = action_load_normal_par( &TC ); | |
445 | close_action( &TC, result ); |
|
444 | close_action( &TC, result ); | |
446 | break; |
|
445 | break; | |
447 | // |
|
446 | // | |
448 | case TC_SUBTYPE_LOAD_BURST: |
|
447 | case TC_SUBTYPE_LOAD_BURST: | |
449 | result = action_load_burst_par( &TC ); |
|
448 | result = action_load_burst_par( &TC ); | |
450 | close_action( &TC, result ); |
|
449 | close_action( &TC, result ); | |
451 | break; |
|
450 | break; | |
452 | // |
|
451 | // | |
453 | case TC_SUBTYPE_LOAD_SBM1: |
|
452 | case TC_SUBTYPE_LOAD_SBM1: | |
454 | result = action_load_sbm1_par( &TC ); |
|
453 | result = action_load_sbm1_par( &TC ); | |
455 | close_action( &TC, result ); |
|
454 | close_action( &TC, result ); | |
456 | break; |
|
455 | break; | |
457 | // |
|
456 | // | |
458 | case TC_SUBTYPE_LOAD_SBM2: |
|
457 | case TC_SUBTYPE_LOAD_SBM2: | |
459 | result = action_load_sbm2_par( &TC ); |
|
458 | result = action_load_sbm2_par( &TC ); | |
460 | close_action( &TC, result ); |
|
459 | close_action( &TC, result ); | |
461 | break; |
|
460 | break; | |
462 | // |
|
461 | // | |
463 | case TC_SUBTYPE_DUMP: |
|
462 | case TC_SUBTYPE_DUMP: | |
464 | result = action_dump_par( &TC ); |
|
463 | result = action_dump_par( &TC ); | |
465 | close_action( &TC, result ); |
|
464 | close_action( &TC, result ); | |
466 | break; |
|
465 | break; | |
467 | // |
|
466 | // | |
468 | case TC_SUBTYPE_ENTER: |
|
467 | case TC_SUBTYPE_ENTER: | |
469 | result = action_enter_mode( &TC ); |
|
468 | result = action_enter_mode( &TC ); | |
470 | close_action( &TC, result ); |
|
469 | close_action( &TC, result ); | |
471 | break; |
|
470 | break; | |
472 | // |
|
471 | // | |
473 | case TC_SUBTYPE_UPDT_INFO: |
|
472 | case TC_SUBTYPE_UPDT_INFO: | |
474 | result = action_update_info( &TC ); |
|
473 | result = action_update_info( &TC ); | |
475 | close_action( &TC, result ); |
|
474 | close_action( &TC, result ); | |
476 | break; |
|
475 | break; | |
477 | // |
|
476 | // | |
478 | case TC_SUBTYPE_EN_CAL: |
|
477 | case TC_SUBTYPE_EN_CAL: | |
479 | result = action_enable_calibration( &TC ); |
|
478 | result = action_enable_calibration( &TC ); | |
480 | close_action( &TC, result ); |
|
479 | close_action( &TC, result ); | |
481 | break; |
|
480 | break; | |
482 | // |
|
481 | // | |
483 | case TC_SUBTYPE_DIS_CAL: |
|
482 | case TC_SUBTYPE_DIS_CAL: | |
484 | result = action_disable_calibration( &TC ); |
|
483 | result = action_disable_calibration( &TC ); | |
485 | close_action( &TC, result ); |
|
484 | close_action( &TC, result ); | |
486 | break; |
|
485 | break; | |
487 | // |
|
486 | // | |
488 | case TC_SUBTYPE_UPDT_TIME: |
|
487 | case TC_SUBTYPE_UPDT_TIME: | |
489 | result = action_update_time( &TC ); |
|
488 | result = action_update_time( &TC ); | |
490 | close_action( &TC, result ); |
|
489 | close_action( &TC, result ); | |
491 | break; |
|
490 | break; | |
492 | // |
|
491 | // | |
493 | default: |
|
492 | default: | |
494 | break; |
|
493 | break; | |
495 | } |
|
494 | } | |
496 | } |
|
495 | } | |
497 | } |
|
496 | } | |
498 | } |
|
497 | } | |
499 |
|
498 | |||
500 | rtems_task dumb_task( rtems_task_argument unused ) |
|
499 | rtems_task dumb_task( rtems_task_argument unused ) | |
501 | { |
|
500 | { | |
502 | unsigned int i; |
|
501 | unsigned int i; | |
503 | unsigned int intEventOut; |
|
502 | unsigned int intEventOut; | |
504 | unsigned int coarse_time = 0; |
|
503 | unsigned int coarse_time = 0; | |
505 | unsigned int fine_time = 0; |
|
504 | unsigned int fine_time = 0; | |
506 | rtems_event_set event_out; |
|
505 | rtems_event_set event_out; | |
507 |
|
506 | |||
508 | PRINTF("in DUMB *** \n") |
|
507 | PRINTF("in DUMB *** \n") | |
509 |
|
508 | |||
510 | while(1){ |
|
509 | while(1){ | |
511 | rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3 | RTEMS_EVENT_4 | RTEMS_EVENT_5, |
|
510 | rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3 | RTEMS_EVENT_4 | RTEMS_EVENT_5, | |
512 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT |
|
511 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT | |
513 | intEventOut = (unsigned int) event_out; |
|
512 | intEventOut = (unsigned int) event_out; | |
514 | for ( i=0; i<32; i++) |
|
513 | for ( i=0; i<32; i++) | |
515 | { |
|
514 | { | |
516 | if ( ((intEventOut >> i) & 0x0001) != 0) |
|
515 | if ( ((intEventOut >> i) & 0x0001) != 0) | |
517 | { |
|
516 | { | |
518 | coarse_time = time_management_regs->coarse_time; |
|
517 | coarse_time = time_management_regs->coarse_time; | |
519 | fine_time = time_management_regs->fine_time; |
|
518 | fine_time = time_management_regs->fine_time; | |
520 | printf("in DUMB *** time = coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]); |
|
519 | printf("in DUMB *** time = coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]); | |
521 | } |
|
520 | } | |
522 | } |
|
521 | } | |
523 | } |
|
522 | } | |
524 | } |
|
523 | } | |
525 |
|
524 | |||
526 | //*********** |
|
525 | //*********** | |
527 | // TC ACTIONS |
|
526 | // TC ACTIONS | |
528 |
|
527 | |||
529 | int action_reset(ccsdsTelecommandPacket_t *TC) |
|
528 | int action_reset(ccsdsTelecommandPacket_t *TC) | |
530 | { |
|
529 | { | |
531 | send_tm_lfr_tc_exe_not_implemented( TC ); |
|
530 | send_tm_lfr_tc_exe_not_implemented( TC ); | |
532 | return LFR_DEFAULT; |
|
531 | return LFR_DEFAULT; | |
533 | } |
|
532 | } | |
534 |
|
533 | |||
535 | int action_load_common_par(ccsdsTelecommandPacket_t *TC) |
|
534 | int action_load_common_par(ccsdsTelecommandPacket_t *TC) | |
536 | { |
|
535 | { | |
537 | parameter_dump_packet.unused0 = TC->dataAndCRC[0]; |
|
536 | parameter_dump_packet.unused0 = TC->dataAndCRC[0]; | |
538 | parameter_dump_packet.bw_sp0_sp1_r0_r1 = TC->dataAndCRC[1]; |
|
537 | parameter_dump_packet.bw_sp0_sp1_r0_r1 = TC->dataAndCRC[1]; | |
539 |
|
538 | |||
540 | set_wfp_data_shaping(parameter_dump_packet.bw_sp0_sp1_r0_r1); |
|
539 | set_wfp_data_shaping(parameter_dump_packet.bw_sp0_sp1_r0_r1); | |
541 |
|
540 | |||
542 | return LFR_SUCCESSFUL; |
|
541 | return LFR_SUCCESSFUL; | |
543 | } |
|
542 | } | |
544 |
|
543 | |||
545 | int action_load_normal_par(ccsdsTelecommandPacket_t *TC) |
|
544 | int action_load_normal_par(ccsdsTelecommandPacket_t *TC) | |
546 | { |
|
545 | { | |
547 | int result; |
|
546 | int result; | |
548 |
unsigned |
|
547 | unsigned int tmp; | |
549 |
|
548 | |||
550 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
549 | result = LFR_SUCCESSFUL; | |
551 |
|
550 | |||
552 | if ( lfrMode == LFR_MODE_NORMAL ) { |
|
551 | if ( lfrCurrentMode == LFR_MODE_NORMAL ) { | |
553 | send_tm_lfr_tc_exe_not_executable( TC ); |
|
552 | send_tm_lfr_tc_exe_not_executable( TC ); | |
554 | result = LFR_DEFAULT; |
|
553 | result = LFR_DEFAULT; | |
555 | } |
|
554 | } | |
556 | else { |
|
555 | else { | |
|
556 | // sy_lfr_n_swf_l | |||
557 | parameter_dump_packet.sy_lfr_n_swf_l[0] = TC->dataAndCRC[0]; |
|
557 | parameter_dump_packet.sy_lfr_n_swf_l[0] = TC->dataAndCRC[0]; | |
558 | parameter_dump_packet.sy_lfr_n_swf_l[1] = TC->dataAndCRC[1]; |
|
558 | parameter_dump_packet.sy_lfr_n_swf_l[1] = TC->dataAndCRC[1]; | |
559 |
|
559 | |||
560 | parameter_dump_packet.sy_lfr_n_swf_p[0] = TC->dataAndCRC[2]; |
|
560 | // sy_lfr_n_swf_p | |
561 | parameter_dump_packet.sy_lfr_n_swf_p[1] = TC->dataAndCRC[3]; |
|
561 | tmp = (unsigned int ) floor( | |
|
562 | (TC->dataAndCRC[2] * 256 | |||
|
563 | + TC->dataAndCRC[3])/8 | |||
|
564 | ) * 8; | |||
|
565 | if ( (tmp < 16) || (tmp>65528) ) | |||
|
566 | { | |||
|
567 | result = LFR_DEFAULT; | |||
|
568 | } | |||
|
569 | else | |||
|
570 | { | |||
|
571 | parameter_dump_packet.sy_lfr_n_swf_p[0] = (unsigned char) (tmp >> 8); | |||
|
572 | parameter_dump_packet.sy_lfr_n_swf_p[1] = (unsigned char) (tmp ); | |||
|
573 | } | |||
562 |
|
574 | |||
|
575 | // sy_lfr_n_asm_p | |||
563 | parameter_dump_packet.sy_lfr_n_asm_p[0] = TC->dataAndCRC[4]; |
|
576 | parameter_dump_packet.sy_lfr_n_asm_p[0] = TC->dataAndCRC[4]; | |
564 | parameter_dump_packet.sy_lfr_n_asm_p[1] = TC->dataAndCRC[5]; |
|
577 | parameter_dump_packet.sy_lfr_n_asm_p[1] = TC->dataAndCRC[5]; | |
565 |
|
578 | |||
|
579 | // sy_lfr_n_bp_p0 | |||
566 | parameter_dump_packet.sy_lfr_n_bp_p0 = TC->dataAndCRC[6]; |
|
580 | parameter_dump_packet.sy_lfr_n_bp_p0 = TC->dataAndCRC[6]; | |
|
581 | ||||
|
582 | // sy_lfr_n_bp_p1 | |||
567 | parameter_dump_packet.sy_lfr_n_bp_p1 = TC->dataAndCRC[7]; |
|
583 | parameter_dump_packet.sy_lfr_n_bp_p1 = TC->dataAndCRC[7]; | |
568 |
|
||||
569 | result = LFR_SUCCESSFUL; |
|
|||
570 | } |
|
584 | } | |
571 |
|
585 | |||
572 | return result; |
|
586 | return result; | |
573 | } |
|
587 | } | |
574 |
|
588 | |||
575 | int action_load_burst_par(ccsdsTelecommandPacket_t *TC) |
|
589 | int action_load_burst_par(ccsdsTelecommandPacket_t *TC) | |
576 | { |
|
590 | { | |
577 | int result; |
|
591 | int result; | |
578 | unsigned char lfrMode; |
|
592 | unsigned char lfrMode; | |
579 |
|
593 | |||
580 | result = LFR_DEFAULT; |
|
594 | result = LFR_DEFAULT; | |
581 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
595 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
582 |
|
596 | |||
583 | if ( lfrMode == LFR_MODE_BURST ) { |
|
597 | if ( lfrMode == LFR_MODE_BURST ) { | |
584 | send_tm_lfr_tc_exe_not_executable( TC ); |
|
598 | send_tm_lfr_tc_exe_not_executable( TC ); | |
585 | result = LFR_DEFAULT; |
|
599 | result = LFR_DEFAULT; | |
586 | } |
|
600 | } | |
587 | else { |
|
601 | else { | |
588 | parameter_dump_packet.sy_lfr_b_bp_p0 = TC->dataAndCRC[0]; |
|
602 | parameter_dump_packet.sy_lfr_b_bp_p0 = TC->dataAndCRC[0]; | |
589 | parameter_dump_packet.sy_lfr_b_bp_p1 = TC->dataAndCRC[1]; |
|
603 | parameter_dump_packet.sy_lfr_b_bp_p1 = TC->dataAndCRC[1]; | |
590 |
|
604 | |||
591 | result = LFR_SUCCESSFUL; |
|
605 | result = LFR_SUCCESSFUL; | |
592 | } |
|
606 | } | |
593 |
|
607 | |||
594 | return result; |
|
608 | return result; | |
595 | } |
|
609 | } | |
596 |
|
610 | |||
597 | int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC) |
|
611 | int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC) | |
598 | { |
|
612 | { | |
599 | int result; |
|
613 | int result; | |
600 | unsigned char lfrMode; |
|
614 | unsigned char lfrMode; | |
601 |
|
615 | |||
602 | result = LFR_DEFAULT; |
|
616 | result = LFR_DEFAULT; | |
603 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
617 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
604 |
|
618 | |||
605 | if ( lfrMode == LFR_MODE_SBM1 ) { |
|
619 | if ( lfrMode == LFR_MODE_SBM1 ) { | |
606 | send_tm_lfr_tc_exe_not_executable( TC ); |
|
620 | send_tm_lfr_tc_exe_not_executable( TC ); | |
607 | result = LFR_DEFAULT; |
|
621 | result = LFR_DEFAULT; | |
608 | } |
|
622 | } | |
609 | else { |
|
623 | else { | |
610 | parameter_dump_packet.sy_lfr_s1_bp_p0 = TC->dataAndCRC[0]; |
|
624 | parameter_dump_packet.sy_lfr_s1_bp_p0 = TC->dataAndCRC[0]; | |
611 | parameter_dump_packet.sy_lfr_s1_bp_p1 = TC->dataAndCRC[1]; |
|
625 | parameter_dump_packet.sy_lfr_s1_bp_p1 = TC->dataAndCRC[1]; | |
612 |
|
626 | |||
613 | result = LFR_SUCCESSFUL; |
|
627 | result = LFR_SUCCESSFUL; | |
614 | } |
|
628 | } | |
615 |
|
629 | |||
616 | return result; |
|
630 | return result; | |
617 | } |
|
631 | } | |
618 |
|
632 | |||
619 | int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC) |
|
633 | int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC) | |
620 | { |
|
634 | { | |
621 | int result; |
|
635 | int result; | |
622 | unsigned char lfrMode; |
|
636 | unsigned char lfrMode; | |
623 |
|
637 | |||
624 | result = LFR_DEFAULT; |
|
638 | result = LFR_DEFAULT; | |
625 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
639 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
626 |
|
640 | |||
627 | if ( lfrMode == LFR_MODE_SBM2 ) { |
|
641 | if ( lfrMode == LFR_MODE_SBM2 ) { | |
628 | send_tm_lfr_tc_exe_not_executable( TC ); |
|
642 | send_tm_lfr_tc_exe_not_executable( TC ); | |
629 | result = LFR_DEFAULT; |
|
643 | result = LFR_DEFAULT; | |
630 | } |
|
644 | } | |
631 | else { |
|
645 | else { | |
632 | parameter_dump_packet.sy_lfr_s2_bp_p0 = TC->dataAndCRC[0]; |
|
646 | parameter_dump_packet.sy_lfr_s2_bp_p0 = TC->dataAndCRC[0]; | |
633 | parameter_dump_packet.sy_lfr_s2_bp_p1 = TC->dataAndCRC[1]; |
|
647 | parameter_dump_packet.sy_lfr_s2_bp_p1 = TC->dataAndCRC[1]; | |
634 |
|
648 | |||
635 | result = LFR_SUCCESSFUL; |
|
649 | result = LFR_SUCCESSFUL; | |
636 | } |
|
650 | } | |
637 |
|
651 | |||
638 | return result; |
|
652 | return result; | |
639 | } |
|
653 | } | |
640 |
|
654 | |||
641 | int action_dump_par(ccsdsTelecommandPacket_t *TC) |
|
655 | int action_dump_par(ccsdsTelecommandPacket_t *TC) | |
642 | { |
|
656 | { | |
643 | int status; |
|
657 | int status; | |
644 | // send parameter dump packet |
|
658 | // send parameter dump packet | |
645 | status = write(fdSPW, (char *) ¶meter_dump_packet, |
|
659 | status = write(fdSPW, (char *) ¶meter_dump_packet, | |
646 | PACKET_LENGTH_PARAMETER_DUMP + CCSDS_TC_TM_PACKET_OFFSET + 4); |
|
660 | PACKET_LENGTH_PARAMETER_DUMP + CCSDS_TC_TM_PACKET_OFFSET + 4); | |
647 | if (status == -1) |
|
661 | if (status == -1) | |
648 | { |
|
662 | { | |
649 | PRINTF1("in action_dump *** ERR sending packet, code %d", status) |
|
663 | PRINTF1("in action_dump *** ERR sending packet, code %d", status) | |
650 | status = RTEMS_UNSATISFIED; |
|
664 | status = RTEMS_UNSATISFIED; | |
651 | } |
|
665 | } | |
652 | else |
|
666 | else | |
653 | { |
|
667 | { | |
654 | status = RTEMS_SUCCESSFUL; |
|
668 | status = RTEMS_SUCCESSFUL; | |
655 | } |
|
669 | } | |
656 |
|
670 | |||
657 | return status; |
|
671 | return status; | |
658 | } |
|
672 | } | |
659 |
|
673 | |||
660 | int action_enter_mode(ccsdsTelecommandPacket_t *TC) |
|
674 | int action_enter_mode(ccsdsTelecommandPacket_t *TC) | |
661 | { |
|
675 | { | |
662 | rtems_status_code status; |
|
676 | rtems_status_code status; | |
663 | unsigned char requestedMode; |
|
677 | unsigned char requestedMode; | |
664 |
|
678 | |||
665 | requestedMode = TC->dataAndCRC[1]; |
|
679 | requestedMode = TC->dataAndCRC[1]; | |
666 |
|
680 | |||
667 | printf("try to enter mode %d\n", requestedMode); |
|
681 | printf("try to enter mode %d\n", requestedMode); | |
668 |
|
682 | |||
669 | #ifdef PRINT_TASK_STATISTICS |
|
683 | #ifdef PRINT_TASK_STATISTICS | |
670 | if (requestedMode != LFR_MODE_STANDBY) |
|
684 | if (requestedMode != LFR_MODE_STANDBY) | |
671 | { |
|
685 | { | |
672 | rtems_cpu_usage_reset(); |
|
686 | rtems_cpu_usage_reset(); | |
|
687 | maxCount = 0; | |||
673 | } |
|
688 | } | |
674 | #endif |
|
689 | #endif | |
675 |
|
690 | |||
676 | status = transition_validation(requestedMode); |
|
691 | status = transition_validation(requestedMode); | |
677 |
|
692 | |||
678 | if ( status == LFR_SUCCESSFUL ) { |
|
693 | if ( status == LFR_SUCCESSFUL ) { | |
679 | if ( lfrCurrentMode != LFR_MODE_STANDBY) |
|
694 | if ( lfrCurrentMode != LFR_MODE_STANDBY) | |
680 | { |
|
695 | { | |
681 | status = stop_current_mode(); |
|
696 | status = stop_current_mode(); | |
682 | } |
|
697 | } | |
683 | if (status != RTEMS_SUCCESSFUL) |
|
698 | if (status != RTEMS_SUCCESSFUL) | |
684 | { |
|
699 | { | |
685 | PRINTF("ERR *** in action_enter *** stop_current_mode\n") |
|
700 | PRINTF("ERR *** in action_enter *** stop_current_mode\n") | |
686 | } |
|
701 | } | |
687 | status = enter_mode(requestedMode, TC); |
|
702 | status = enter_mode(requestedMode, TC); | |
688 | } |
|
703 | } | |
689 | else |
|
704 | else | |
690 | { |
|
705 | { | |
691 | PRINTF("ERR *** in action_enter *** transition rejected\n") |
|
706 | PRINTF("ERR *** in action_enter *** transition rejected\n") | |
692 | send_tm_lfr_tc_exe_not_executable( TC ); |
|
707 | send_tm_lfr_tc_exe_not_executable( TC ); | |
693 | } |
|
708 | } | |
694 |
|
709 | |||
695 | return status; |
|
710 | return status; | |
696 | } |
|
711 | } | |
697 |
|
712 | |||
698 | int action_update_info(ccsdsTelecommandPacket_t *TC) { |
|
713 | int action_update_info(ccsdsTelecommandPacket_t *TC) { | |
699 | unsigned int val; |
|
714 | unsigned int val; | |
700 | int result; |
|
715 | int result; | |
701 | unsigned char lfrMode; |
|
716 | unsigned char lfrMode; | |
702 |
|
717 | |||
703 | result = LFR_DEFAULT; |
|
718 | result = LFR_DEFAULT; | |
704 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
719 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
705 |
|
720 | |||
706 | if ( (lfrMode == LFR_MODE_STANDBY) ) { |
|
721 | if ( (lfrMode == LFR_MODE_STANDBY) ) { | |
707 | send_tm_lfr_tc_exe_not_implemented( TC ); |
|
722 | send_tm_lfr_tc_exe_not_implemented( TC ); | |
708 | result = LFR_DEFAULT; |
|
723 | result = LFR_DEFAULT; | |
709 | } |
|
724 | } | |
710 | else { |
|
725 | else { | |
711 | val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256 |
|
726 | val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256 | |
712 | + housekeeping_packet.hk_lfr_update_info_tc_cnt[1]; |
|
727 | + housekeeping_packet.hk_lfr_update_info_tc_cnt[1]; | |
713 | val++; |
|
728 | val++; | |
714 | housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8); |
|
729 | housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8); | |
715 | housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val); |
|
730 | housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val); | |
716 | result = LFR_SUCCESSFUL; |
|
731 | result = LFR_SUCCESSFUL; | |
717 | } |
|
732 | } | |
718 |
|
733 | |||
719 | return result; |
|
734 | return result; | |
720 | } |
|
735 | } | |
721 |
|
736 | |||
722 | int action_enable_calibration(ccsdsTelecommandPacket_t *TC) |
|
737 | int action_enable_calibration(ccsdsTelecommandPacket_t *TC) | |
723 | { |
|
738 | { | |
724 | int result; |
|
739 | int result; | |
725 | unsigned char lfrMode; |
|
740 | unsigned char lfrMode; | |
726 |
|
741 | |||
727 | result = LFR_DEFAULT; |
|
742 | result = LFR_DEFAULT; | |
728 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
743 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
729 |
|
744 | |||
730 | if ( (lfrMode == LFR_MODE_STANDBY) | (lfrMode == LFR_MODE_BURST) | (lfrMode == LFR_MODE_SBM2) ) { |
|
745 | if ( (lfrMode == LFR_MODE_STANDBY) | (lfrMode == LFR_MODE_BURST) | (lfrMode == LFR_MODE_SBM2) ) { | |
731 | send_tm_lfr_tc_exe_not_executable( TC ); |
|
746 | send_tm_lfr_tc_exe_not_executable( TC ); | |
732 | result = LFR_DEFAULT; |
|
747 | result = LFR_DEFAULT; | |
733 | } |
|
748 | } | |
734 | else { |
|
749 | else { | |
735 | send_tm_lfr_tc_exe_not_implemented( TC ); |
|
750 | send_tm_lfr_tc_exe_not_implemented( TC ); | |
736 | result = LFR_DEFAULT; |
|
751 | result = LFR_DEFAULT; | |
737 | } |
|
752 | } | |
738 | return result; |
|
753 | return result; | |
739 | } |
|
754 | } | |
740 |
|
755 | |||
741 | int action_disable_calibration(ccsdsTelecommandPacket_t *TC) |
|
756 | int action_disable_calibration(ccsdsTelecommandPacket_t *TC) | |
742 | { |
|
757 | { | |
743 | int result; |
|
758 | int result; | |
744 | unsigned char lfrMode; |
|
759 | unsigned char lfrMode; | |
745 |
|
760 | |||
746 | result = LFR_DEFAULT; |
|
761 | result = LFR_DEFAULT; | |
747 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
762 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
748 |
|
763 | |||
749 | if ( (lfrMode == LFR_MODE_STANDBY) | (lfrMode == LFR_MODE_BURST) | (lfrMode == LFR_MODE_SBM2) ) { |
|
764 | if ( (lfrMode == LFR_MODE_STANDBY) | (lfrMode == LFR_MODE_BURST) | (lfrMode == LFR_MODE_SBM2) ) { | |
750 | send_tm_lfr_tc_exe_not_executable( TC ); |
|
765 | send_tm_lfr_tc_exe_not_executable( TC ); | |
751 | result = LFR_DEFAULT; |
|
766 | result = LFR_DEFAULT; | |
752 | } |
|
767 | } | |
753 | else { |
|
768 | else { | |
754 | send_tm_lfr_tc_exe_not_implemented( TC ); |
|
769 | send_tm_lfr_tc_exe_not_implemented( TC ); | |
755 | result = LFR_DEFAULT; |
|
770 | result = LFR_DEFAULT; | |
756 | } |
|
771 | } | |
757 | return result; |
|
772 | return result; | |
758 | } |
|
773 | } | |
759 |
|
774 | |||
760 | int action_update_time(ccsdsTelecommandPacket_t *TC) |
|
775 | int action_update_time(ccsdsTelecommandPacket_t *TC) | |
761 | { |
|
776 | { | |
762 | unsigned int val; |
|
777 | unsigned int val; | |
763 |
|
778 | |||
764 | time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24) |
|
779 | time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24) | |
765 | + (TC->dataAndCRC[1] << 16) |
|
780 | + (TC->dataAndCRC[1] << 16) | |
766 | + (TC->dataAndCRC[2] << 8) |
|
781 | + (TC->dataAndCRC[2] << 8) | |
767 | + TC->dataAndCRC[3]; |
|
782 | + TC->dataAndCRC[3]; | |
768 | val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256 |
|
783 | val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256 | |
769 | + housekeeping_packet.hk_lfr_update_time_tc_cnt[1]; |
|
784 | + housekeeping_packet.hk_lfr_update_time_tc_cnt[1]; | |
770 | val++; |
|
785 | val++; | |
771 | housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8); |
|
786 | housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8); | |
772 | housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val); |
|
787 | housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val); | |
773 | time_management_regs->ctrl = time_management_regs->ctrl | 1; |
|
788 | time_management_regs->ctrl = time_management_regs->ctrl | 1; | |
774 |
|
789 | |||
775 | return LFR_SUCCESSFUL; |
|
790 | return LFR_SUCCESSFUL; | |
776 | } |
|
791 | } | |
777 |
|
792 | |||
778 | //******************* |
|
793 | //******************* | |
779 | // ENTERING THE MODES |
|
794 | // ENTERING THE MODES | |
780 |
|
795 | |||
781 | int transition_validation(unsigned char requestedMode) |
|
796 | int transition_validation(unsigned char requestedMode) | |
782 | { |
|
797 | { | |
783 | int status; |
|
798 | int status; | |
784 |
|
799 | |||
785 | switch (requestedMode) |
|
800 | switch (requestedMode) | |
786 | { |
|
801 | { | |
787 | case LFR_MODE_STANDBY: |
|
802 | case LFR_MODE_STANDBY: | |
788 | if ( lfrCurrentMode == LFR_MODE_STANDBY ) { |
|
803 | if ( lfrCurrentMode == LFR_MODE_STANDBY ) { | |
789 | status = LFR_DEFAULT; |
|
804 | status = LFR_DEFAULT; | |
790 | } |
|
805 | } | |
791 | else |
|
806 | else | |
792 | { |
|
807 | { | |
793 | status = LFR_SUCCESSFUL; |
|
808 | status = LFR_SUCCESSFUL; | |
794 | } |
|
809 | } | |
795 | break; |
|
810 | break; | |
796 | case LFR_MODE_NORMAL: |
|
811 | case LFR_MODE_NORMAL: | |
797 | if ( lfrCurrentMode == LFR_MODE_NORMAL ) { |
|
812 | if ( lfrCurrentMode == LFR_MODE_NORMAL ) { | |
798 | status = LFR_DEFAULT; |
|
813 | status = LFR_DEFAULT; | |
799 | } |
|
814 | } | |
800 | else { |
|
815 | else { | |
801 | status = LFR_SUCCESSFUL; |
|
816 | status = LFR_SUCCESSFUL; | |
802 | } |
|
817 | } | |
803 | break; |
|
818 | break; | |
804 | case LFR_MODE_BURST: |
|
819 | case LFR_MODE_BURST: | |
805 | if ( lfrCurrentMode == LFR_MODE_BURST ) { |
|
820 | if ( lfrCurrentMode == LFR_MODE_BURST ) { | |
806 | status = LFR_DEFAULT; |
|
821 | status = LFR_DEFAULT; | |
807 | } |
|
822 | } | |
808 | else { |
|
823 | else { | |
809 | status = LFR_SUCCESSFUL; |
|
824 | status = LFR_SUCCESSFUL; | |
810 | } |
|
825 | } | |
811 | break; |
|
826 | break; | |
812 | case LFR_MODE_SBM1: |
|
827 | case LFR_MODE_SBM1: | |
813 | if ( lfrCurrentMode == LFR_MODE_SBM1 ) { |
|
828 | if ( lfrCurrentMode == LFR_MODE_SBM1 ) { | |
814 | status = LFR_DEFAULT; |
|
829 | status = LFR_DEFAULT; | |
815 | } |
|
830 | } | |
816 | else { |
|
831 | else { | |
817 | status = LFR_SUCCESSFUL; |
|
832 | status = LFR_SUCCESSFUL; | |
818 | } |
|
833 | } | |
819 | break; |
|
834 | break; | |
820 | case LFR_MODE_SBM2: |
|
835 | case LFR_MODE_SBM2: | |
821 | if ( lfrCurrentMode == LFR_MODE_SBM2 ) { |
|
836 | if ( lfrCurrentMode == LFR_MODE_SBM2 ) { | |
822 | status = LFR_DEFAULT; |
|
837 | status = LFR_DEFAULT; | |
823 | } |
|
838 | } | |
824 | else { |
|
839 | else { | |
825 | status = LFR_SUCCESSFUL; |
|
840 | status = LFR_SUCCESSFUL; | |
826 | } |
|
841 | } | |
827 | break; |
|
842 | break; | |
828 | default: |
|
843 | default: | |
829 | status = LFR_DEFAULT; |
|
844 | status = LFR_DEFAULT; | |
830 | break; |
|
845 | break; | |
831 | } |
|
846 | } | |
832 |
|
847 | |||
833 | return status; |
|
848 | return status; | |
834 | } |
|
849 | } | |
835 |
|
850 | |||
836 | int stop_current_mode() |
|
851 | int stop_current_mode() | |
837 | { |
|
852 | { | |
838 | rtems_status_code status; |
|
853 | rtems_status_code status; | |
839 | unsigned char lfrMode; |
|
854 | unsigned char lfrMode; | |
840 |
|
855 | |||
841 | status = RTEMS_SUCCESSFUL; |
|
856 | status = RTEMS_SUCCESSFUL; | |
842 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; // get the current mode |
|
857 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; // get the current mode | |
843 |
|
858 | |||
844 | // mask all IRQ lines related to signal processing |
|
859 | // mask all IRQ lines related to signal processing | |
845 | LEON_Mask_interrupt( IRQ_SM ); // mask spectral matrices interrupt (coming from the timer VHDL IP) |
|
860 | LEON_Mask_interrupt( IRQ_SM ); // mask spectral matrices interrupt (coming from the timer VHDL IP) | |
846 | LEON_Clear_interrupt( IRQ_SM ); // clear spectral matrices interrupt (coming from the timer VHDL IP) |
|
861 | LEON_Clear_interrupt( IRQ_SM ); // clear spectral matrices interrupt (coming from the timer VHDL IP) | |
847 |
|
862 | |||
848 | #ifdef GSA |
|
863 | #ifdef GSA | |
849 | LEON_Mask_interrupt( IRQ_WF ); // mask waveform interrupt (coming from the timer VHDL IP) |
|
864 | LEON_Mask_interrupt( IRQ_WF ); // mask waveform interrupt (coming from the timer VHDL IP) | |
850 | LEON_Clear_interrupt( IRQ_WF ); // clear waveform interrupt (coming from the timer VHDL IP) |
|
865 | LEON_Clear_interrupt( IRQ_WF ); // clear waveform interrupt (coming from the timer VHDL IP) | |
851 | timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR ); |
|
866 | timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR ); | |
852 | #else |
|
867 | #else | |
853 | LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt |
|
868 | LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt | |
854 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt |
|
869 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt | |
855 | LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // mask spectral matrix interrupt |
|
870 | LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // mask spectral matrix interrupt | |
856 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt |
|
871 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt | |
|
872 | LEON_Mask_interrupt( IRQ_SM ); | |||
857 | #endif |
|
873 | #endif | |
858 | //********************** |
|
874 | //********************** | |
859 | // suspend several tasks |
|
875 | // suspend several tasks | |
860 | if (lfrMode != LFR_MODE_STANDBY) { |
|
876 | if (lfrMode != LFR_MODE_STANDBY) { | |
861 | suspend_science_tasks(); |
|
877 | suspend_science_tasks(); | |
862 | } |
|
878 | } | |
863 |
|
879 | |||
864 | if (status != RTEMS_SUCCESSFUL) |
|
880 | if (status != RTEMS_SUCCESSFUL) | |
865 | { |
|
881 | { | |
866 | PRINTF("ERR *** in stop_current_mode *** suspending tasks\n") |
|
882 | PRINTF("ERR *** in stop_current_mode *** suspending tasks\n") | |
867 | } |
|
883 | } | |
868 |
|
884 | |||
869 | //************************* |
|
885 | //************************* | |
870 | // initialize the registers |
|
886 | // initialize the registers | |
871 | #ifdef GSA |
|
887 | #ifdef GSA | |
872 | #else |
|
888 | #else | |
873 | reset_wfp_burst_enable(); // reset burst and enable bits |
|
889 | reset_wfp_burst_enable(); // reset burst and enable bits | |
874 | reset_wfp_status(); // reset all the status bits |
|
890 | reset_wfp_status(); // reset all the status bits | |
875 | #endif |
|
891 | #endif | |
876 |
|
892 | |||
877 | return status; |
|
893 | return status; | |
878 | } |
|
894 | } | |
879 |
|
895 | |||
880 | int enter_mode(unsigned char mode, ccsdsTelecommandPacket_t *TC ) |
|
896 | int enter_mode(unsigned char mode, ccsdsTelecommandPacket_t *TC ) | |
881 | { |
|
897 | { | |
882 | rtems_status_code status; |
|
898 | rtems_status_code status; | |
883 |
|
899 | |||
884 | status = RTEMS_UNSATISFIED; |
|
900 | status = RTEMS_UNSATISFIED; | |
885 |
|
901 | |||
886 | housekeeping_packet.lfr_status_word[0] = (unsigned char) ((mode << 4) + 0x0d); |
|
902 | housekeeping_packet.lfr_status_word[0] = (unsigned char) ((mode << 4) + 0x0d); | |
887 | lfrCurrentMode = mode; |
|
903 | lfrCurrentMode = mode; | |
888 |
|
904 | |||
889 | switch(mode){ |
|
905 | switch(mode){ | |
890 | case LFR_MODE_STANDBY: |
|
906 | case LFR_MODE_STANDBY: | |
891 | status = enter_standby_mode( TC ); |
|
907 | status = enter_standby_mode( TC ); | |
892 | break; |
|
908 | break; | |
893 | case LFR_MODE_NORMAL: |
|
909 | case LFR_MODE_NORMAL: | |
894 | status = enter_normal_mode( TC ); |
|
910 | status = enter_normal_mode( TC ); | |
895 | break; |
|
911 | break; | |
896 | case LFR_MODE_BURST: |
|
912 | case LFR_MODE_BURST: | |
897 | status = enter_burst_mode( TC ); |
|
913 | status = enter_burst_mode( TC ); | |
898 | break; |
|
914 | break; | |
899 | case LFR_MODE_SBM1: |
|
915 | case LFR_MODE_SBM1: | |
900 | status = enter_sbm1_mode( TC ); |
|
916 | status = enter_sbm1_mode( TC ); | |
901 | break; |
|
917 | break; | |
902 | case LFR_MODE_SBM2: |
|
918 | case LFR_MODE_SBM2: | |
903 | status = enter_sbm2_mode( TC ); |
|
919 | status = enter_sbm2_mode( TC ); | |
904 | break; |
|
920 | break; | |
905 | default: |
|
921 | default: | |
906 | status = RTEMS_UNSATISFIED; |
|
922 | status = RTEMS_UNSATISFIED; | |
907 | } |
|
923 | } | |
908 |
|
924 | |||
909 | if (status != RTEMS_SUCCESSFUL) |
|
925 | if (status != RTEMS_SUCCESSFUL) | |
910 | { |
|
926 | { | |
911 | PRINTF("in enter_mode *** ERR\n") |
|
927 | PRINTF("in enter_mode *** ERR\n") | |
912 | status = RTEMS_UNSATISFIED; |
|
928 | status = RTEMS_UNSATISFIED; | |
913 | } |
|
929 | } | |
914 |
|
930 | |||
915 | return status; |
|
931 | return status; | |
916 | } |
|
932 | } | |
917 |
|
933 | |||
918 | int enter_standby_mode() |
|
934 | int enter_standby_mode() | |
919 | { |
|
935 | { | |
920 | reset_waveform_picker_regs(); |
|
936 | reset_waveform_picker_regs(); | |
|
937 | ||||
|
938 | PRINTF1("maxCount = %d\n", maxCount) | |||
|
939 | ||||
921 | #ifdef PRINT_TASK_STATISTICS |
|
940 | #ifdef PRINT_TASK_STATISTICS | |
922 | rtems_cpu_usage_report(); |
|
941 | rtems_cpu_usage_report(); | |
923 | #endif |
|
942 | #endif | |
|
943 | ||||
|
944 | #ifdef PRINT_STACK_REPORT | |||
|
945 | rtems_stack_checker_report_usage(); | |||
|
946 | #endif | |||
|
947 | ||||
924 | return LFR_SUCCESSFUL; |
|
948 | return LFR_SUCCESSFUL; | |
925 | } |
|
949 | } | |
926 |
|
950 | |||
927 | int enter_normal_mode() |
|
951 | int enter_normal_mode() | |
928 | { |
|
952 | { | |
929 | rtems_status_code status; |
|
953 | rtems_status_code status; | |
930 |
|
954 | |||
931 | status = restart_science_tasks(); |
|
955 | status = restart_science_tasks(); | |
932 |
|
956 | |||
933 | #ifdef GSA |
|
957 | #ifdef GSA | |
934 | timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR ); |
|
958 | timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR ); | |
935 | timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); |
|
959 | timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); | |
936 | LEON_Clear_interrupt( IRQ_WF ); |
|
960 | LEON_Clear_interrupt( IRQ_WF ); | |
937 | LEON_Unmask_interrupt( IRQ_WF ); |
|
961 | LEON_Unmask_interrupt( IRQ_WF ); | |
938 | // |
|
962 | // | |
939 | set_local_nb_interrupt_f0_MAX(); |
|
963 | set_local_nb_interrupt_f0_MAX(); | |
940 | LEON_Clear_interrupt( IRQ_SM ); // the IRQ_SM seems to be incompatible with the IRQ_WF on the xilinx board |
|
964 | LEON_Clear_interrupt( IRQ_SM ); // the IRQ_SM seems to be incompatible with the IRQ_WF on the xilinx board | |
941 | LEON_Unmask_interrupt( IRQ_SM ); |
|
965 | LEON_Unmask_interrupt( IRQ_SM ); | |
942 | #else |
|
966 | #else | |
943 | //**************** |
|
967 | //**************** | |
944 | // waveform picker |
|
968 | // waveform picker | |
945 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); |
|
969 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); | |
946 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); |
|
970 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); | |
947 | reset_waveform_picker_regs(); |
|
971 | reset_waveform_picker_regs(); | |
948 | set_wfp_burst_enable_register(LFR_MODE_NORMAL); |
|
972 | set_wfp_burst_enable_register(LFR_MODE_NORMAL); | |
949 | //**************** |
|
973 | //**************** | |
950 | // spectral matrix |
|
974 | // spectral matrix | |
951 | set_local_nb_interrupt_f0_MAX(); |
|
975 | set_local_nb_interrupt_f0_MAX(); | |
952 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // the IRQ_SM seems to be incompatible with the IRQ_WF on the xilinx board |
|
976 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // the IRQ_SM seems to be incompatible with the IRQ_WF on the xilinx board | |
953 | LEON_Unmask_interrupt( IRQ_SPECTRAL_MATRIX ); |
|
977 | LEON_Unmask_interrupt( IRQ_SPECTRAL_MATRIX ); | |
954 | spectral_matrix_regs->config = 0x01; |
|
978 | spectral_matrix_regs->config = 0x01; | |
955 | spectral_matrix_regs->status = 0x00; |
|
979 | spectral_matrix_regs->status = 0x00; | |
956 | #endif |
|
980 | #endif | |
957 |
|
981 | |||
958 | return status; |
|
982 | return status; | |
959 | } |
|
983 | } | |
960 |
|
984 | |||
961 | int enter_burst_mode() |
|
985 | int enter_burst_mode() | |
962 | { |
|
986 | { | |
963 | rtems_status_code status; |
|
987 | rtems_status_code status; | |
964 | unsigned char lfrMode; |
|
988 | unsigned char lfrMode; | |
965 |
|
989 | |||
966 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
990 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
967 |
|
991 | |||
968 | status = restart_science_tasks(); |
|
992 | status = restart_science_tasks(); | |
969 |
|
993 | |||
970 | #ifdef GSA |
|
994 | #ifdef GSA | |
971 | LEON_Unmask_interrupt( IRQ_SM ); |
|
995 | LEON_Unmask_interrupt( IRQ_SM ); | |
972 | #else |
|
996 | #else | |
973 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); |
|
997 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); | |
974 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); |
|
998 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); | |
975 | reset_waveform_picker_regs(); |
|
999 | reset_waveform_picker_regs(); | |
976 | set_wfp_burst_enable_register(LFR_MODE_BURST); |
|
1000 | set_wfp_burst_enable_register(LFR_MODE_BURST); | |
977 | #endif |
|
1001 | #endif | |
978 |
|
1002 | |||
979 | return status; |
|
1003 | return status; | |
980 | } |
|
1004 | } | |
981 |
|
1005 | |||
982 | int enter_sbm1_mode() |
|
1006 | int enter_sbm1_mode() | |
983 | { |
|
1007 | { | |
984 | rtems_status_code status; |
|
1008 | rtems_status_code status; | |
985 |
|
1009 | |||
986 | status = restart_science_tasks(); |
|
1010 | status = restart_science_tasks(); | |
987 |
|
1011 | |||
988 | set_local_sbm1_nb_cwf_max(); |
|
1012 | set_local_sbm1_nb_cwf_max(); | |
989 |
|
1013 | |||
990 | reset_local_sbm1_nb_cwf_sent(); |
|
1014 | reset_local_sbm1_nb_cwf_sent(); | |
991 |
|
1015 | |||
992 | #ifdef GSA |
|
1016 | #ifdef GSA | |
993 | LEON_Unmask_interrupt( IRQ_SM ); |
|
1017 | LEON_Unmask_interrupt( IRQ_SM ); | |
994 | #else |
|
1018 | #else | |
995 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); |
|
1019 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); | |
996 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); |
|
1020 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); | |
997 | reset_waveform_picker_regs(); |
|
1021 | reset_waveform_picker_regs(); | |
998 | set_wfp_burst_enable_register(LFR_MODE_SBM1); |
|
1022 | set_wfp_burst_enable_register(LFR_MODE_SBM1); | |
|
1023 | // SM simulation | |||
|
1024 | timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); | |||
|
1025 | LEON_Clear_interrupt( IRQ_SM ); // the IRQ_SM seems to be incompatible with the IRQ_WF on the xilinx board | |||
|
1026 | LEON_Unmask_interrupt( IRQ_SM ); | |||
999 | #endif |
|
1027 | #endif | |
1000 |
|
1028 | |||
1001 | return status; |
|
1029 | return status; | |
1002 | } |
|
1030 | } | |
1003 |
|
1031 | |||
1004 | int enter_sbm2_mode() |
|
1032 | int enter_sbm2_mode() | |
1005 | { |
|
1033 | { | |
1006 | rtems_status_code status; |
|
1034 | rtems_status_code status; | |
1007 |
|
1035 | |||
1008 | status = restart_science_tasks(); |
|
1036 | status = restart_science_tasks(); | |
1009 |
|
1037 | |||
1010 | set_local_sbm2_nb_cwf_max(); |
|
1038 | set_local_sbm2_nb_cwf_max(); | |
1011 |
|
1039 | |||
1012 | reset_local_sbm2_nb_cwf_sent(); |
|
1040 | reset_local_sbm2_nb_cwf_sent(); | |
1013 |
|
1041 | |||
1014 | #ifdef GSA |
|
1042 | #ifdef GSA | |
1015 | LEON_Unmask_interrupt( IRQ_SM ); |
|
1043 | LEON_Unmask_interrupt( IRQ_SM ); | |
1016 | #else |
|
1044 | #else | |
1017 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); |
|
1045 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); | |
1018 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); |
|
1046 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); | |
1019 | reset_waveform_picker_regs(); |
|
1047 | reset_waveform_picker_regs(); | |
1020 | set_wfp_burst_enable_register(LFR_MODE_SBM2); |
|
1048 | set_wfp_burst_enable_register(LFR_MODE_SBM2); | |
1021 | #endif |
|
1049 | #endif | |
1022 |
|
1050 | |||
1023 | return status; |
|
1051 | return status; | |
1024 | } |
|
1052 | } | |
1025 |
|
1053 | |||
1026 | int restart_science_tasks() |
|
1054 | int restart_science_tasks() | |
1027 | { |
|
1055 | { | |
1028 | rtems_status_code status[6]; |
|
1056 | rtems_status_code status[6]; | |
1029 | rtems_status_code ret; |
|
1057 | rtems_status_code ret; | |
1030 |
|
1058 | |||
1031 | ret = RTEMS_SUCCESSFUL; |
|
1059 | ret = RTEMS_SUCCESSFUL; | |
1032 |
|
1060 | |||
1033 | status[0] = rtems_task_restart( Task_id[TASKID_AVF0], 1 ); |
|
1061 | status[0] = rtems_task_restart( Task_id[TASKID_AVF0], 1 ); | |
1034 | status[1] = rtems_task_restart( Task_id[TASKID_BPF0],1 ); |
|
1062 | status[1] = rtems_task_restart( Task_id[TASKID_BPF0],1 ); | |
1035 | status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 ); |
|
1063 | status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 ); | |
1036 | status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 ); |
|
1064 | status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 ); | |
1037 | status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 ); |
|
1065 | status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 ); | |
1038 | status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 ); |
|
1066 | status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 ); | |
1039 |
|
1067 | |||
1040 | if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) || |
|
1068 | if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) || | |
1041 | (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) ) |
|
1069 | (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) ) | |
1042 | { |
|
1070 | { | |
1043 | ret = RTEMS_UNSATISFIED; |
|
1071 | ret = RTEMS_UNSATISFIED; | |
1044 | PRINTF("in restart_science_tasks *** ERR\n") |
|
1072 | PRINTF("in restart_science_tasks *** ERR\n") | |
1045 | } |
|
1073 | } | |
1046 |
|
1074 | |||
1047 | return ret; |
|
1075 | return ret; | |
1048 | } |
|
1076 | } | |
1049 |
|
1077 | |||
1050 | int suspend_science_tasks() |
|
1078 | int suspend_science_tasks() | |
1051 | { |
|
1079 | { | |
1052 | rtems_status_code status[6]; |
|
1080 | rtems_status_code status[6]; | |
1053 | rtems_status_code ret; |
|
1081 | rtems_status_code ret; | |
1054 |
|
1082 | |||
1055 | ret = RTEMS_SUCCESSFUL; |
|
1083 | ret = RTEMS_SUCCESSFUL; | |
1056 |
|
1084 | |||
1057 | status[0] = rtems_task_suspend( Task_id[TASKID_AVF0] ); |
|
1085 | status[0] = rtems_task_suspend( Task_id[TASKID_AVF0] ); | |
1058 | status[1] = rtems_task_suspend( Task_id[TASKID_BPF0] ); |
|
1086 | status[1] = rtems_task_suspend( Task_id[TASKID_BPF0] ); | |
1059 | status[2] = rtems_task_suspend( Task_id[TASKID_WFRM] ); |
|
1087 | status[2] = rtems_task_suspend( Task_id[TASKID_WFRM] ); | |
1060 | status[3] = rtems_task_suspend( Task_id[TASKID_CWF3] ); |
|
1088 | status[3] = rtems_task_suspend( Task_id[TASKID_CWF3] ); | |
1061 | status[4] = rtems_task_suspend( Task_id[TASKID_CWF2] ); |
|
1089 | status[4] = rtems_task_suspend( Task_id[TASKID_CWF2] ); | |
1062 | status[5] = rtems_task_suspend( Task_id[TASKID_CWF1] ); |
|
1090 | status[5] = rtems_task_suspend( Task_id[TASKID_CWF1] ); | |
1063 |
|
1091 | |||
1064 | if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) || |
|
1092 | if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) || | |
1065 | (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) ) |
|
1093 | (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) ) | |
1066 | { |
|
1094 | { | |
1067 | ret = RTEMS_UNSATISFIED; |
|
1095 | ret = RTEMS_UNSATISFIED; | |
1068 | PRINTF("in suspend_science_tasks *** ERR\n") |
|
1096 | PRINTF("in suspend_science_tasks *** ERR\n") | |
1069 | } |
|
1097 | } | |
1070 |
|
1098 | |||
1071 | return ret; |
|
1099 | return ret; | |
1072 | } |
|
1100 | } | |
1073 |
|
1101 | |||
1074 | //**************** |
|
1102 | //**************** | |
1075 | // CLOSING ACTIONS |
|
1103 | // CLOSING ACTIONS | |
1076 |
|
1104 | |||
1077 | int send_tm_lfr_tc_exe_success(ccsdsTelecommandPacket_t *TC) |
|
1105 | int send_tm_lfr_tc_exe_success(ccsdsTelecommandPacket_t *TC) | |
1078 | { |
|
1106 | { | |
1079 | int ret; |
|
1107 | int ret; | |
1080 | rtems_status_code status; |
|
1108 | rtems_status_code status; | |
1081 | TMHeader_t TM_header; |
|
1109 | TMHeader_t TM_header; | |
1082 | char data[4]; |
|
1110 | char data[4]; | |
1083 | spw_ioctl_pkt_send spw_ioctl_send; |
|
1111 | spw_ioctl_pkt_send spw_ioctl_send; | |
1084 |
|
1112 | |||
|
1113 | ret = LFR_SUCCESSFUL; | |||
|
1114 | ||||
1085 | TM_build_header( TM_LFR_TC_EXE_OK, PACKET_LENGTH_TC_EXE_SUCCESS, |
|
1115 | TM_build_header( TM_LFR_TC_EXE_OK, PACKET_LENGTH_TC_EXE_SUCCESS, | |
1086 | &TM_header, |
|
1116 | &TM_header, | |
1087 | TC->sourceID); // TC source ID |
|
1117 | TC->sourceID); // TC source ID | |
1088 |
|
1118 | |||
1089 | data[0] = TC->packetID[0]; |
|
1119 | data[0] = TC->packetID[0]; | |
1090 | data[1] = TC->packetID[1]; |
|
1120 | data[1] = TC->packetID[1]; | |
1091 | data[2] = TC->packetSequenceControl[0]; |
|
1121 | data[2] = TC->packetSequenceControl[0]; | |
1092 | data[3] = TC->packetSequenceControl[1]; |
|
1122 | data[3] = TC->packetSequenceControl[1]; | |
1093 |
|
1123 | |||
1094 | // filling the structure for the spacewire transmission |
|
1124 | // filling the structure for the spacewire transmission | |
1095 | spw_ioctl_send.hlen = TM_HEADER_LEN + 4; // + 4 is for the protocole extra header |
|
1125 | spw_ioctl_send.hlen = TM_HEADER_LEN + 4; // + 4 is for the protocole extra header | |
1096 | spw_ioctl_send.hdr = (char*) &TM_header; |
|
1126 | spw_ioctl_send.hdr = (char*) &TM_header; | |
1097 | spw_ioctl_send.dlen = 4; |
|
1127 | spw_ioctl_send.dlen = 4; | |
1098 | spw_ioctl_send.data = data; |
|
1128 | spw_ioctl_send.data = data; | |
1099 | spw_ioctl_send.options = 0; |
|
1129 | spw_ioctl_send.options = 0; | |
1100 |
|
1130 | |||
1101 | // SEND DATA |
|
1131 | // SEND DATA | |
1102 | //status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, &spw_ioctl_send ); |
|
1132 | //status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, &spw_ioctl_send ); | |
1103 |
status = rtems_message_queue_ |
|
1133 | status = rtems_message_queue_urgent( misc_id[QUEUE_PKTS], &spw_ioctl_send, sizeof(spw_ioctl_send)); | |
1104 | if (status != RTEMS_SUCCESSFUL) { |
|
1134 | if (status != RTEMS_SUCCESSFUL) { | |
1105 | PRINTF("in send_tm_lfr_tc_exe_success *** ERR\n") |
|
1135 | PRINTF("in send_tm_lfr_tc_exe_success *** ERR\n") | |
1106 | ret = LFR_DEFAULT; |
|
1136 | ret = LFR_DEFAULT; | |
1107 | } |
|
1137 | } | |
1108 |
|
1138 | |||
1109 | return ret; |
|
1139 | return ret; | |
1110 | } |
|
1140 | } | |
1111 |
|
1141 | |||
1112 | int send_tm_lfr_tc_exe_not_executable(ccsdsTelecommandPacket_t *TC) |
|
1142 | int send_tm_lfr_tc_exe_not_executable(ccsdsTelecommandPacket_t *TC) | |
1113 | { |
|
1143 | { | |
|
1144 | int ret; | |||
1114 | rtems_status_code status; |
|
1145 | rtems_status_code status; | |
1115 | TMHeader_t TM_header; |
|
1146 | TMHeader_t TM_header; | |
1116 | char data[10]; |
|
1147 | char data[10]; | |
1117 | spw_ioctl_pkt_send spw_ioctl_send; |
|
1148 | spw_ioctl_pkt_send spw_ioctl_send; | |
1118 |
|
1149 | |||
|
1150 | ret = LFR_SUCCESSFUL; | |||
|
1151 | ||||
1119 | TM_build_header( TM_LFR_TC_EXE_ERR, PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE, |
|
1152 | TM_build_header( TM_LFR_TC_EXE_ERR, PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE, | |
1120 | &TM_header, |
|
1153 | &TM_header, | |
1121 | TC->sourceID); // TC source ID |
|
1154 | TC->sourceID); // TC source ID | |
1122 |
|
1155 | |||
1123 | data[0] = (char) (FAILURE_CODE_NOT_EXECUTABLE >> 8); |
|
1156 | data[0] = (char) (FAILURE_CODE_NOT_EXECUTABLE >> 8); | |
1124 | data[1] = (char) FAILURE_CODE_NOT_EXECUTABLE; |
|
1157 | data[1] = (char) FAILURE_CODE_NOT_EXECUTABLE; | |
1125 | data[2] = TC->packetID[0]; |
|
1158 | data[2] = TC->packetID[0]; | |
1126 | data[3] = TC->packetID[1]; |
|
1159 | data[3] = TC->packetID[1]; | |
1127 | data[4] = TC->packetSequenceControl[0]; |
|
1160 | data[4] = TC->packetSequenceControl[0]; | |
1128 | data[5] = TC->packetSequenceControl[1]; |
|
1161 | data[5] = TC->packetSequenceControl[1]; | |
1129 | data[6] = TC->serviceType; // type of the rejected TC |
|
1162 | data[6] = TC->serviceType; // type of the rejected TC | |
1130 | data[7] = TC->serviceSubType; // subtype of the rejected TC |
|
1163 | data[7] = TC->serviceSubType; // subtype of the rejected TC | |
1131 | data[8] = housekeeping_packet.lfr_status_word[0]; |
|
1164 | data[8] = housekeeping_packet.lfr_status_word[0]; | |
1132 | data[6] = housekeeping_packet.lfr_status_word[1]; |
|
1165 | data[6] = housekeeping_packet.lfr_status_word[1]; | |
1133 |
|
1166 | |||
1134 | // filling the structure for the spacewire transmission |
|
1167 | // filling the structure for the spacewire transmission | |
1135 | spw_ioctl_send.hlen = TM_HEADER_LEN + 4; // + 4 is for the protocole extra header |
|
1168 | spw_ioctl_send.hlen = TM_HEADER_LEN + 4; // + 4 is for the protocole extra header | |
1136 | spw_ioctl_send.hdr = (char*) &TM_header; |
|
1169 | spw_ioctl_send.hdr = (char*) &TM_header; | |
1137 | spw_ioctl_send.dlen = 10; |
|
1170 | spw_ioctl_send.dlen = 10; | |
1138 | spw_ioctl_send.data = data; |
|
1171 | spw_ioctl_send.data = data; | |
1139 | spw_ioctl_send.options = 0; |
|
1172 | spw_ioctl_send.options = 0; | |
1140 |
|
1173 | |||
1141 | // SEND DATA |
|
1174 | // SEND DATA | |
1142 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, &spw_ioctl_send ); |
|
1175 | //status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, &spw_ioctl_send ); | |
|
1176 | status = rtems_message_queue_urgent( misc_id[QUEUE_PKTS], &spw_ioctl_send, sizeof(spw_ioctl_send)); | |||
|
1177 | if (status != RTEMS_SUCCESSFUL) { | |||
|
1178 | PRINTF("in send_tm_lfr_tc_exe_success *** ERR\n") | |||
|
1179 | ret = LFR_DEFAULT; | |||
|
1180 | } | |||
1143 |
|
1181 | |||
1144 | return LFR_SUCCESSFUL; |
|
1182 | return LFR_SUCCESSFUL; | |
1145 | } |
|
1183 | } | |
1146 |
|
1184 | |||
1147 | int send_tm_lfr_tc_exe_not_implemented(ccsdsTelecommandPacket_t *TC) |
|
1185 | int send_tm_lfr_tc_exe_not_implemented(ccsdsTelecommandPacket_t *TC) | |
1148 | { |
|
1186 | { | |
|
1187 | int ret; | |||
1149 | rtems_status_code status; |
|
1188 | rtems_status_code status; | |
1150 | TMHeader_t TM_header; |
|
1189 | TMHeader_t TM_header; | |
1151 | char data[8]; |
|
1190 | char data[8]; | |
1152 | spw_ioctl_pkt_send spw_ioctl_send; |
|
1191 | spw_ioctl_pkt_send spw_ioctl_send; | |
1153 |
|
1192 | |||
|
1193 | ret = LFR_SUCCESSFUL; | |||
|
1194 | ||||
1154 | TM_build_header( TM_LFR_TC_EXE_ERR, PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED, |
|
1195 | TM_build_header( TM_LFR_TC_EXE_ERR, PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED, | |
1155 | &TM_header, |
|
1196 | &TM_header, | |
1156 | TC->sourceID); // TC source ID |
|
1197 | TC->sourceID); // TC source ID | |
1157 |
|
1198 | |||
1158 | data[0] = (char) (FAILURE_CODE_NOT_IMPLEMENTED >> 8); |
|
1199 | data[0] = (char) (FAILURE_CODE_NOT_IMPLEMENTED >> 8); | |
1159 | data[1] = (char) FAILURE_CODE_NOT_IMPLEMENTED; |
|
1200 | data[1] = (char) FAILURE_CODE_NOT_IMPLEMENTED; | |
1160 | data[2] = TC->packetID[0]; |
|
1201 | data[2] = TC->packetID[0]; | |
1161 | data[3] = TC->packetID[1]; |
|
1202 | data[3] = TC->packetID[1]; | |
1162 | data[4] = TC->packetSequenceControl[0]; |
|
1203 | data[4] = TC->packetSequenceControl[0]; | |
1163 | data[5] = TC->packetSequenceControl[1]; |
|
1204 | data[5] = TC->packetSequenceControl[1]; | |
1164 | data[6] = TC->serviceType; // type of the rejected TC |
|
1205 | data[6] = TC->serviceType; // type of the rejected TC | |
1165 | data[7] = TC->serviceSubType; // subtype of the rejected TC |
|
1206 | data[7] = TC->serviceSubType; // subtype of the rejected TC | |
1166 |
|
1207 | |||
1167 | // filling the structure for the spacewire transmission |
|
1208 | // filling the structure for the spacewire transmission | |
1168 | spw_ioctl_send.hlen = TM_HEADER_LEN + 4; // + 4 is for the protocole extra header |
|
1209 | spw_ioctl_send.hlen = TM_HEADER_LEN + 4; // + 4 is for the protocole extra header | |
1169 | spw_ioctl_send.hdr = (char*) &TM_header; |
|
1210 | spw_ioctl_send.hdr = (char*) &TM_header; | |
1170 | spw_ioctl_send.dlen = 8; |
|
1211 | spw_ioctl_send.dlen = 8; | |
1171 | spw_ioctl_send.data = data; |
|
1212 | spw_ioctl_send.data = data; | |
1172 | spw_ioctl_send.options = 0; |
|
1213 | spw_ioctl_send.options = 0; | |
1173 |
|
1214 | |||
1174 | // SEND DATA |
|
1215 | // SEND DATA | |
1175 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, &spw_ioctl_send ); |
|
1216 | //status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, &spw_ioctl_send ); | |
|
1217 | status = rtems_message_queue_urgent( misc_id[QUEUE_PKTS], &spw_ioctl_send, sizeof(spw_ioctl_send)); | |||
|
1218 | if (status != RTEMS_SUCCESSFUL) { | |||
|
1219 | PRINTF("in send_tm_lfr_tc_exe_not_implemented *** ERR\n") | |||
|
1220 | ret = LFR_DEFAULT; | |||
|
1221 | } | |||
1176 |
|
1222 | |||
1177 | return LFR_SUCCESSFUL; |
|
1223 | return LFR_SUCCESSFUL; | |
1178 | } |
|
1224 | } | |
1179 |
|
1225 | |||
1180 | int send_tm_lfr_tc_exe_error(ccsdsTelecommandPacket_t *TC) |
|
1226 | int send_tm_lfr_tc_exe_error(ccsdsTelecommandPacket_t *TC) | |
1181 | { |
|
1227 | { | |
|
1228 | int ret; | |||
1182 | rtems_status_code status; |
|
1229 | rtems_status_code status; | |
1183 | TMHeader_t TM_header; |
|
1230 | TMHeader_t TM_header; | |
1184 | char data[8]; |
|
1231 | char data[8]; | |
1185 | spw_ioctl_pkt_send spw_ioctl_send; |
|
1232 | spw_ioctl_pkt_send spw_ioctl_send; | |
1186 |
|
1233 | |||
1187 | TM_build_header( TM_LFR_TC_EXE_ERR, PACKET_LENGTH_TC_EXE_ERROR, |
|
1234 | TM_build_header( TM_LFR_TC_EXE_ERR, PACKET_LENGTH_TC_EXE_ERROR, | |
1188 | &TM_header, |
|
1235 | &TM_header, | |
1189 | TC->sourceID); // TC source ID |
|
1236 | TC->sourceID); // TC source ID | |
1190 |
|
1237 | |||
1191 | data[0] = (char) (FAILURE_CODE_ERROR >> 8); |
|
1238 | data[0] = (char) (FAILURE_CODE_ERROR >> 8); | |
1192 | data[1] = (char) FAILURE_CODE_ERROR; |
|
1239 | data[1] = (char) FAILURE_CODE_ERROR; | |
1193 | data[2] = TC->packetID[0]; |
|
1240 | data[2] = TC->packetID[0]; | |
1194 | data[3] = TC->packetID[1]; |
|
1241 | data[3] = TC->packetID[1]; | |
1195 | data[4] = TC->packetSequenceControl[0]; |
|
1242 | data[4] = TC->packetSequenceControl[0]; | |
1196 | data[5] = TC->packetSequenceControl[1]; |
|
1243 | data[5] = TC->packetSequenceControl[1]; | |
1197 | data[6] = TC->serviceType; // type of the rejected TC |
|
1244 | data[6] = TC->serviceType; // type of the rejected TC | |
1198 | data[7] = TC->serviceSubType; // subtype of the rejected TC |
|
1245 | data[7] = TC->serviceSubType; // subtype of the rejected TC | |
1199 |
|
1246 | |||
1200 | // filling the structure for the spacewire transmission |
|
1247 | // filling the structure for the spacewire transmission | |
1201 | spw_ioctl_send.hlen = TM_HEADER_LEN + 4; // + 4 is for the protocole extra header |
|
1248 | spw_ioctl_send.hlen = TM_HEADER_LEN + 4; // + 4 is for the protocole extra header | |
1202 | spw_ioctl_send.hdr = (char*) &TM_header; |
|
1249 | spw_ioctl_send.hdr = (char*) &TM_header; | |
1203 | spw_ioctl_send.dlen = 8; |
|
1250 | spw_ioctl_send.dlen = 8; | |
1204 | spw_ioctl_send.data = data; |
|
1251 | spw_ioctl_send.data = data; | |
1205 | spw_ioctl_send.options = 0; |
|
1252 | spw_ioctl_send.options = 0; | |
1206 |
|
1253 | |||
1207 | // SEND DATA |
|
1254 | // SEND DATA | |
1208 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, &spw_ioctl_send ); |
|
1255 | //status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, &spw_ioctl_send ); | |
|
1256 | status = rtems_message_queue_urgent( misc_id[QUEUE_PKTS], &spw_ioctl_send, sizeof(spw_ioctl_send)); | |||
|
1257 | if (status != RTEMS_SUCCESSFUL) { | |||
|
1258 | PRINTF("in send_tm_lfr_tc_exe_error *** ERR\n") | |||
|
1259 | ret = LFR_DEFAULT; | |||
|
1260 | } | |||
1209 |
|
1261 | |||
1210 | return LFR_SUCCESSFUL; |
|
1262 | return LFR_SUCCESSFUL; | |
1211 | } |
|
1263 | } | |
1212 |
|
1264 | |||
1213 | void update_last_TC_exe(ccsdsTelecommandPacket_t *TC) |
|
1265 | void update_last_TC_exe(ccsdsTelecommandPacket_t *TC) | |
1214 | { |
|
1266 | { | |
1215 | housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0]; |
|
1267 | housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0]; | |
1216 | housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1]; |
|
1268 | housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1]; | |
1217 | housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00; |
|
1269 | housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00; | |
1218 | housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType; |
|
1270 | housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType; | |
1219 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00; |
|
1271 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00; | |
1220 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType; |
|
1272 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType; | |
1221 | housekeeping_packet.hk_lfr_last_exe_tc_time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
1273 | housekeeping_packet.hk_lfr_last_exe_tc_time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
1222 | housekeeping_packet.hk_lfr_last_exe_tc_time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
1274 | housekeeping_packet.hk_lfr_last_exe_tc_time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
1223 | housekeeping_packet.hk_lfr_last_exe_tc_time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
1275 | housekeeping_packet.hk_lfr_last_exe_tc_time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
1224 | housekeeping_packet.hk_lfr_last_exe_tc_time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
1276 | housekeeping_packet.hk_lfr_last_exe_tc_time[3] = (unsigned char) (time_management_regs->coarse_time); | |
1225 | housekeeping_packet.hk_lfr_last_exe_tc_time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
1277 | housekeeping_packet.hk_lfr_last_exe_tc_time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
1226 | housekeeping_packet.hk_lfr_last_exe_tc_time[5] = (unsigned char) (time_management_regs->fine_time); |
|
1278 | housekeeping_packet.hk_lfr_last_exe_tc_time[5] = (unsigned char) (time_management_regs->fine_time); | |
1227 | } |
|
1279 | } | |
1228 |
|
1280 | |||
1229 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC) |
|
1281 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC) | |
1230 | { |
|
1282 | { | |
1231 | housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0]; |
|
1283 | housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0]; | |
1232 | housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1]; |
|
1284 | housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1]; | |
1233 | housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00; |
|
1285 | housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00; | |
1234 | housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType; |
|
1286 | housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType; | |
1235 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00; |
|
1287 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00; | |
1236 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType; |
|
1288 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType; | |
1237 | housekeeping_packet.hk_lfr_last_rej_tc_time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
1289 | housekeeping_packet.hk_lfr_last_rej_tc_time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
1238 | housekeeping_packet.hk_lfr_last_rej_tc_time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
1290 | housekeeping_packet.hk_lfr_last_rej_tc_time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
1239 | housekeeping_packet.hk_lfr_last_rej_tc_time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
1291 | housekeeping_packet.hk_lfr_last_rej_tc_time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
1240 | housekeeping_packet.hk_lfr_last_rej_tc_time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
1292 | housekeeping_packet.hk_lfr_last_rej_tc_time[3] = (unsigned char) (time_management_regs->coarse_time); | |
1241 | housekeeping_packet.hk_lfr_last_rej_tc_time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
1293 | housekeeping_packet.hk_lfr_last_rej_tc_time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
1242 | housekeeping_packet.hk_lfr_last_rej_tc_time[5] = (unsigned char) (time_management_regs->fine_time); |
|
1294 | housekeeping_packet.hk_lfr_last_rej_tc_time[5] = (unsigned char) (time_management_regs->fine_time); | |
1243 | } |
|
1295 | } | |
1244 |
|
1296 | |||
1245 | void close_action(ccsdsTelecommandPacket_t *TC, int result) |
|
1297 | void close_action(ccsdsTelecommandPacket_t *TC, int result) | |
1246 | { |
|
1298 | { | |
1247 | unsigned int val = 0; |
|
1299 | unsigned int val = 0; | |
1248 | if (result == LFR_SUCCESSFUL) |
|
1300 | if (result == LFR_SUCCESSFUL) | |
1249 | { |
|
1301 | { | |
1250 | if ( !( (TC->serviceType==TC_TYPE_TIME) && (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) ) ) |
|
1302 | if ( !( (TC->serviceType==TC_TYPE_TIME) && (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) ) ) | |
1251 | { |
|
1303 | { | |
1252 | send_tm_lfr_tc_exe_success( TC ); |
|
1304 | send_tm_lfr_tc_exe_success( TC ); | |
1253 | } |
|
1305 | } | |
1254 | update_last_TC_exe( TC ); |
|
1306 | update_last_TC_exe( TC ); | |
1255 | val = housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[0] * 256 + housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[1]; |
|
1307 | val = housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[0] * 256 + housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[1]; | |
1256 | val++; |
|
1308 | val++; | |
1257 | housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[0] = (unsigned char) (val >> 8); |
|
1309 | housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[0] = (unsigned char) (val >> 8); | |
1258 | housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[1] = (unsigned char) (val); |
|
1310 | housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[1] = (unsigned char) (val); | |
1259 | } |
|
1311 | } | |
1260 | else |
|
1312 | else | |
1261 | { |
|
1313 | { | |
1262 | update_last_TC_rej( TC ); |
|
1314 | update_last_TC_rej( TC ); | |
1263 | val = housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[0] * 256 + housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[1]; |
|
1315 | val = housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[0] * 256 + housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[1]; | |
1264 | val++; |
|
1316 | val++; | |
1265 | housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[0] = (unsigned char) (val >> 8); |
|
1317 | housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[0] = (unsigned char) (val >> 8); | |
1266 | housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[1] = (unsigned char) (val); |
|
1318 | housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[1] = (unsigned char) (val); | |
1267 | } |
|
1319 | } | |
1268 | } |
|
1320 | } | |
1269 |
|
1321 | |||
1270 | //*************************** |
|
1322 | //*************************** | |
1271 | // Interrupt Service Routines |
|
1323 | // Interrupt Service Routines | |
1272 | rtems_isr commutation_isr1( rtems_vector_number vector ) |
|
1324 | rtems_isr commutation_isr1( rtems_vector_number vector ) | |
1273 | { |
|
1325 | { | |
1274 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
1326 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { | |
1275 | printf("In commutation_isr1 *** Error sending event to DUMB\n"); |
|
1327 | printf("In commutation_isr1 *** Error sending event to DUMB\n"); | |
1276 | } |
|
1328 | } | |
1277 | } |
|
1329 | } | |
1278 |
|
1330 | |||
1279 | rtems_isr commutation_isr2( rtems_vector_number vector ) |
|
1331 | rtems_isr commutation_isr2( rtems_vector_number vector ) | |
1280 | { |
|
1332 | { | |
1281 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
1333 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { | |
1282 | printf("In commutation_isr2 *** Error sending event to DUMB\n"); |
|
1334 | printf("In commutation_isr2 *** Error sending event to DUMB\n"); | |
1283 | } |
|
1335 | } | |
1284 | } |
|
1336 | } | |
1285 |
|
1337 | |||
1286 |
|
1338 | |||
1287 |
|
1339 | |||
1288 |
|
1340 |
@@ -1,818 +1,814 | |||||
1 | #include <wf_handler.h> |
|
1 | #include <wf_handler.h> | |
2 |
|
2 | |||
3 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F0_F1_F2[3][7]; |
|
3 | // SWF | |
|
4 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F0[7]; | |||
|
5 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F1[7]; | |||
|
6 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F2[7]; | |||
|
7 | // CWF | |||
4 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F1[7]; |
|
8 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F1[7]; | |
5 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_BURST[7]; |
|
9 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_BURST[7]; | |
6 |
Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_SBM |
|
10 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_SBM2[7]; | |
7 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3[7]; |
|
11 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3[7]; | |
8 |
|
12 | |||
9 | unsigned char doubleSendCWF1 = 0; |
|
13 | unsigned char doubleSendCWF1 = 0; | |
10 | unsigned char doubleSendCWF2 = 0; |
|
14 | unsigned char doubleSendCWF2 = 0; | |
11 |
|
15 | |||
12 | rtems_isr waveforms_isr( rtems_vector_number vector ) |
|
16 | rtems_isr waveforms_isr( rtems_vector_number vector ) | |
13 | { |
|
17 | { | |
14 |
|
18 | |||
15 | #ifdef GSA |
|
19 | #ifdef GSA | |
16 | #else |
|
20 | #else | |
17 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) |
|
21 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) | |
18 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
22 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) | |
19 | { // in modes other than STANDBY and BURST, send the CWF_F3 data |
|
23 | { // in modes other than STANDBY and BURST, send the CWF_F3 data | |
20 | if ((waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full |
|
24 | if ((waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full | |
21 | // (1) change the receiving buffer for the waveform picker |
|
25 | // (1) change the receiving buffer for the waveform picker | |
22 | if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3) { |
|
26 | if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3) { | |
23 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_bis); |
|
27 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_bis); | |
24 | } |
|
28 | } | |
25 | else { |
|
29 | else { | |
26 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3); |
|
30 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3); | |
27 | } |
|
31 | } | |
28 | // (2) send an event for the waveforms transmission |
|
32 | // (2) send an event for the waveforms transmission | |
29 | if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
33 | if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { | |
30 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
34 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
31 | } |
|
35 | } | |
32 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff777; // reset f3 bits to 0, [1111 0111 0111 0111] |
|
36 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff777; // reset f3 bits to 0, [1111 0111 0111 0111] | |
33 | } |
|
37 | } | |
34 | } |
|
38 | } | |
35 | #endif |
|
39 | #endif | |
36 |
|
40 | |||
37 | switch(lfrCurrentMode) |
|
41 | switch(lfrCurrentMode) | |
38 | { |
|
42 | { | |
39 | //******** |
|
43 | //******** | |
40 | // STANDBY |
|
44 | // STANDBY | |
41 | case(LFR_MODE_STANDBY): |
|
45 | case(LFR_MODE_STANDBY): | |
42 | break; |
|
46 | break; | |
43 |
|
47 | |||
44 | //****** |
|
48 | //****** | |
45 | // NORMAL |
|
49 | // NORMAL | |
46 | case(LFR_MODE_NORMAL): |
|
50 | case(LFR_MODE_NORMAL): | |
47 | #ifdef GSA |
|
51 | #ifdef GSA | |
48 | PRINTF("in waveform_isr *** unexpected waveform picker interruption\n") |
|
52 | PRINTF("in waveform_isr *** unexpected waveform picker interruption\n") | |
49 | #else |
|
53 | #else | |
50 | if ( (waveform_picker_regs->status & 0x7) == 0x7 ){ // [0111] f2 f1 and f0 are full |
|
54 | if ( (waveform_picker_regs->status & 0x7) == 0x7 ){ // [0111] f2 f1 and f0 are full | |
51 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) { |
|
55 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) { | |
52 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
56 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
53 | } |
|
57 | } | |
54 | } |
|
58 | } | |
55 | waveform_picker_regs->status = waveform_picker_regs->status & 0xf888; // [1111 1000 1000 1000] f2, f1, f0 bits =0 |
|
59 | waveform_picker_regs->status = waveform_picker_regs->status & 0xf888; // [1111 1000 1000 1000] f2, f1, f0 bits =0 | |
56 | #endif |
|
60 | #endif | |
57 | break; |
|
61 | break; | |
58 |
|
62 | |||
59 | //****** |
|
63 | //****** | |
60 | // BURST |
|
64 | // BURST | |
61 | case(LFR_MODE_BURST): |
|
65 | case(LFR_MODE_BURST): | |
62 | #ifdef GSA |
|
66 | #ifdef GSA | |
63 | PRINTF("in waveform_isr *** unexpected waveform picker interruption\n") |
|
67 | PRINTF("in waveform_isr *** unexpected waveform picker interruption\n") | |
64 | #else |
|
68 | #else | |
65 | if ((waveform_picker_regs->status & 0x04) == 0x04){ // [0100] check the f2 full bit |
|
69 | if ((waveform_picker_regs->status & 0x04) == 0x04){ // [0100] check the f2 full bit | |
66 | // (1) change the receiving buffer for the waveform picker |
|
70 | // (1) change the receiving buffer for the waveform picker | |
67 | if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) { |
|
71 | if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) { | |
68 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_bis); |
|
72 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_bis); | |
69 | } |
|
73 | } | |
70 | else { |
|
74 | else { | |
71 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); |
|
75 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); | |
72 | } |
|
76 | } | |
73 | // (2) send an event for the waveforms transmission |
|
77 | // (2) send an event for the waveforms transmission | |
74 | if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) { |
|
78 | if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) { | |
75 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
79 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
76 | } |
|
80 | } | |
77 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bits = 0 |
|
81 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bits = 0 | |
78 | } |
|
82 | } | |
79 | #endif |
|
83 | #endif | |
80 | break; |
|
84 | break; | |
81 |
|
85 | |||
82 | //***** |
|
86 | //***** | |
83 | // SBM1 |
|
87 | // SBM1 | |
84 | case(LFR_MODE_SBM1): |
|
88 | case(LFR_MODE_SBM1): | |
85 | #ifdef GSA |
|
89 | #ifdef GSA | |
86 | PRINTF("in waveform_isr *** unexpected waveform picker interruption\n") |
|
90 | PRINTF("in waveform_isr *** unexpected waveform picker interruption\n") | |
87 | #else |
|
91 | #else | |
88 | if ((waveform_picker_regs->status & 0x02) == 0x02){ // [0010] check the f1 full bit |
|
92 | if ((waveform_picker_regs->status & 0x02) == 0x02){ // [0010] check the f1 full bit | |
89 | // (1) change the receiving buffer for the waveform picker |
|
93 | // (1) change the receiving buffer for the waveform picker | |
90 | if ( param_local.local_sbm1_nb_cwf_sent == (param_local.local_sbm1_nb_cwf_max-1) ) |
|
94 | if ( param_local.local_sbm1_nb_cwf_sent == (param_local.local_sbm1_nb_cwf_max-1) ) | |
91 | { |
|
95 | { | |
92 | waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_norm); |
|
96 | waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_norm); | |
93 | } |
|
97 | } | |
94 | else if ( waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1_norm ) |
|
98 | else if ( waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1_norm ) | |
95 | { |
|
99 | { | |
96 | doubleSendCWF1 = 1; |
|
100 | doubleSendCWF1 = 1; | |
97 | waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1); |
|
101 | waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1); | |
98 | } |
|
102 | } | |
99 | else if ( waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1 ) { |
|
103 | else if ( waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1 ) { | |
100 | waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_bis); |
|
104 | waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_bis); | |
101 | } |
|
105 | } | |
102 | else { |
|
106 | else { | |
103 | waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1); |
|
107 | waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1); | |
104 | } |
|
108 | } | |
105 | // (2) send an event for the waveforms transmission |
|
109 | // (2) send an event for the waveforms transmission | |
106 | if (rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 ) != RTEMS_SUCCESSFUL) { |
|
110 | if (rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 ) != RTEMS_SUCCESSFUL) { | |
107 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
111 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
108 | } |
|
112 | } | |
109 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bit = 0 |
|
113 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bit = 0 | |
110 | } |
|
114 | } | |
111 | if ( ( (waveform_picker_regs->status & 0x05) == 0x05 ) ) { // [0101] check the f2 and f0 full bit |
|
115 | if ( ( (waveform_picker_regs->status & 0x05) == 0x05 ) ) { // [0101] check the f2 and f0 full bit | |
112 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) { |
|
116 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) { | |
113 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
117 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
114 | } |
|
118 | } | |
115 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2 and f0 bits = 0 |
|
119 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2 and f0 bits = 0 | |
116 | reset_local_sbm1_nb_cwf_sent(); |
|
120 | reset_local_sbm1_nb_cwf_sent(); | |
117 | } |
|
121 | } | |
118 |
|
122 | |||
119 | #endif |
|
123 | #endif | |
120 | break; |
|
124 | break; | |
121 |
|
125 | |||
122 | //***** |
|
126 | //***** | |
123 | // SBM2 |
|
127 | // SBM2 | |
124 | case(LFR_MODE_SBM2): |
|
128 | case(LFR_MODE_SBM2): | |
125 | #ifdef GSA |
|
129 | #ifdef GSA | |
126 | PRINTF("in waveform_isr *** unexpected waveform picker interruption\n") |
|
130 | PRINTF("in waveform_isr *** unexpected waveform picker interruption\n") | |
127 | #else |
|
131 | #else | |
128 | if ((waveform_picker_regs->status & 0x04) == 0x04){ // [0100] check the f2 full bit |
|
132 | if ((waveform_picker_regs->status & 0x04) == 0x04){ // [0100] check the f2 full bit | |
129 | // (1) change the receiving buffer for the waveform picker |
|
133 | // (1) change the receiving buffer for the waveform picker | |
130 | if ( waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2 ) { |
|
134 | if ( param_local.local_sbm2_nb_cwf_sent == (param_local.local_sbm2_nb_cwf_max-1) ) | |
|
135 | { | |||
|
136 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_norm); | |||
|
137 | } | |||
|
138 | else if ( waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2_norm ) { | |||
|
139 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); | |||
|
140 | doubleSendCWF2 = 1; | |||
|
141 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2_WFRM ) != RTEMS_SUCCESSFUL) { | |||
|
142 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |||
|
143 | } | |||
|
144 | reset_local_sbm2_nb_cwf_sent(); | |||
|
145 | } | |||
|
146 | else if ( waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2 ) { | |||
131 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_bis); |
|
147 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_bis); | |
132 | } |
|
148 | } | |
133 | else { |
|
149 | else { | |
134 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); |
|
150 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); | |
135 | } |
|
151 | } | |
136 | // (2) send an event for the waveforms transmission |
|
152 | // (2) send an event for the waveforms transmission | |
137 | if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) { |
|
153 | if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) { | |
138 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
154 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
139 | } |
|
155 | } | |
140 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0 |
|
156 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0 | |
141 | } |
|
157 | } | |
142 | if ( ( (waveform_picker_regs->status & 0x03) == 0x03 ) ) { // [0011] f3 f2 f1 f0, f1 and f0 are full |
|
158 | if ( ( (waveform_picker_regs->status & 0x03) == 0x03 ) ) { // [0011] f3 f2 f1 f0, f1 and f0 are full | |
143 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) { |
|
159 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) { | |
144 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
160 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
145 | } |
|
161 | } | |
146 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0 |
|
162 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0 | |
147 | doubleSendCWF2 = 1; |
|
|||
148 | reset_local_sbm2_nb_cwf_sent(); |
|
|||
149 | } |
|
163 | } | |
150 | #endif |
|
164 | #endif | |
151 | break; |
|
165 | break; | |
152 |
|
166 | |||
153 | //******** |
|
167 | //******** | |
154 | // DEFAULT |
|
168 | // DEFAULT | |
155 | default: |
|
169 | default: | |
156 | break; |
|
170 | break; | |
157 | } |
|
171 | } | |
158 | } |
|
172 | } | |
159 |
|
173 | |||
160 | rtems_isr waveforms_simulator_isr( rtems_vector_number vector ) |
|
174 | rtems_isr waveforms_simulator_isr( rtems_vector_number vector ) | |
161 | { |
|
175 | { | |
162 | unsigned char lfrMode; |
|
176 | unsigned char lfrMode; | |
163 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
177 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
164 |
|
178 | |||
165 | switch(lfrMode) { |
|
179 | switch(lfrMode) { | |
166 | case (LFR_MODE_STANDBY): |
|
180 | case (LFR_MODE_STANDBY): | |
167 | break; |
|
181 | break; | |
168 | case (LFR_MODE_NORMAL): |
|
182 | case (LFR_MODE_NORMAL): | |
169 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) { |
|
183 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) { | |
170 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_5 ); |
|
184 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_5 ); | |
171 | } |
|
185 | } | |
172 | break; |
|
186 | break; | |
173 | case (LFR_MODE_BURST): |
|
187 | case (LFR_MODE_BURST): | |
174 | break; |
|
188 | break; | |
175 | case (LFR_MODE_SBM1): |
|
189 | case (LFR_MODE_SBM1): | |
176 | break; |
|
190 | break; | |
177 | case (LFR_MODE_SBM2): |
|
191 | case (LFR_MODE_SBM2): | |
178 | break; |
|
192 | break; | |
179 | } |
|
193 | } | |
180 | } |
|
194 | } | |
181 |
|
195 | |||
182 | rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP |
|
196 | rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP | |
183 | { |
|
197 | { | |
184 | rtems_event_set event_out; |
|
198 | rtems_event_set event_out; | |
185 |
|
199 | |||
186 | init_header_snapshot_wf_table( SID_NORM_SWF_F0 ); |
|
200 | init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 ); | |
187 | init_header_snapshot_wf_table( SID_NORM_SWF_F1 ); |
|
201 | init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 ); | |
188 | init_header_snapshot_wf_table( SID_NORM_SWF_F2 ); |
|
202 | init_header_snapshot_wf_table( SID_NORM_SWF_F2, headerSWF_F2 ); | |
189 |
|
203 | |||
190 | init_waveforms(); |
|
204 | init_waveforms(); | |
191 |
|
205 | |||
192 | PRINTF("in WFRM ***\n") |
|
206 | PRINTF("in WFRM ***\n") | |
193 |
|
207 | |||
194 | while(1){ |
|
208 | while(1){ | |
195 | // wait for an RTEMS_EVENT |
|
209 | // wait for an RTEMS_EVENT | |
196 |
rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1 |
|
210 | rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1 | |
|
211 | | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM, | |||
197 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
212 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
198 |
|
213 | |||
199 | switch( event_out) { |
|
214 | switch( event_out) { | |
200 |
|
215 | |||
201 |
|
|
216 | case RTEMS_EVENT_MODE_NORMAL: | |
202 |
|
|
217 | send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0); | |
203 |
|
|
218 | send_waveform_SWF(wf_snap_f1, SID_NORM_SWF_F1, headerSWF_F1); | |
204 |
|
|
219 | send_waveform_SWF(wf_snap_f2, SID_NORM_SWF_F2, headerSWF_F2); | |
205 | #ifdef GSA |
|
220 | #ifdef GSA | |
206 |
|
|
221 | waveform_picker_regs->status = waveform_picker_regs->status & 0xf888; // [1111 1000 1000 1000] f2, f1, f0 bits =0 | |
207 | #endif |
|
|||
208 | break; |
|
|||
209 |
|
||||
210 | case RTEMS_EVENT_MODE_SBM1: |
|
|||
211 | send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0); |
|
|||
212 | send_waveform_SWF(wf_snap_f1_norm, SID_NORM_SWF_F1); |
|
|||
213 | send_waveform_SWF(wf_snap_f2, SID_NORM_SWF_F2); |
|
|||
214 | #ifdef GSA |
|
|||
215 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2, f0 bits = 0 |
|
|||
216 | #endif |
|
222 | #endif | |
217 | break; |
|
223 | break; | |
218 |
|
224 | |||
219 |
|
|
225 | case RTEMS_EVENT_MODE_SBM1: | |
220 |
|
|
226 | send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0); | |
221 |
|
|
227 | send_waveform_SWF(wf_snap_f1_norm, SID_NORM_SWF_F1, headerSWF_F1); | |
|
228 | send_waveform_SWF(wf_snap_f2, SID_NORM_SWF_F2, headerSWF_F2); | |||
222 | #ifdef GSA |
|
229 | #ifdef GSA | |
223 |
|
|
230 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2, f0 bits = 0 | |
224 | #endif |
|
231 | #endif | |
225 |
|
|
232 | break; | |
|
233 | ||||
|
234 | case RTEMS_EVENT_MODE_SBM2: | |||
|
235 | send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0); | |||
|
236 | send_waveform_SWF(wf_snap_f1, SID_NORM_SWF_F1, headerSWF_F1); | |||
|
237 | #ifdef GSA | |||
|
238 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0 | |||
|
239 | #endif | |||
|
240 | break; | |||
|
241 | ||||
|
242 | case RTEMS_EVENT_MODE_SBM2_WFRM: | |||
|
243 | send_waveform_SWF(wf_snap_f2_norm, SID_NORM_SWF_F2, headerSWF_F2); | |||
|
244 | break; | |||
226 |
|
245 | |||
227 | default: |
|
246 | default: | |
228 | break; |
|
247 | break; | |
229 | } |
|
248 | } | |
230 |
|
249 | |||
231 | #ifdef GSA |
|
250 | #ifdef GSA | |
232 | // irq processed, reset the related register of the timer unit |
|
251 | // irq processed, reset the related register of the timer unit | |
233 | gptimer_regs->timer[TIMER_WF_SIMULATOR].ctrl = gptimer_regs->timer[TIMER_WF_SIMULATOR].ctrl | 0x00000010; |
|
252 | gptimer_regs->timer[TIMER_WF_SIMULATOR].ctrl = gptimer_regs->timer[TIMER_WF_SIMULATOR].ctrl | 0x00000010; | |
234 | // clear the interruption |
|
253 | // clear the interruption | |
235 | LEON_Unmask_interrupt( IRQ_WF ); |
|
254 | LEON_Unmask_interrupt( IRQ_WF ); | |
236 | #endif |
|
255 | #endif | |
237 | } |
|
256 | } | |
238 | } |
|
257 | } | |
239 |
|
258 | |||
240 | rtems_task cwf3_task(rtems_task_argument argument) //used with the waveform picker VHDL IP |
|
259 | rtems_task cwf3_task(rtems_task_argument argument) //used with the waveform picker VHDL IP | |
241 | { |
|
260 | { | |
242 | rtems_event_set event_out; |
|
261 | rtems_event_set event_out; | |
243 |
|
262 | |||
244 | init_header_continuous_wf_table( SID_NORM_CWF_F3, headerCWF_F3 ); |
|
263 | init_header_continuous_wf_table( SID_NORM_CWF_F3, headerCWF_F3 ); | |
245 |
|
264 | |||
246 | PRINTF("in CWF3 ***\n") |
|
265 | PRINTF("in CWF3 ***\n") | |
247 |
|
266 | |||
248 | while(1){ |
|
267 | while(1){ | |
249 | // wait for an RTEMS_EVENT |
|
268 | // wait for an RTEMS_EVENT | |
250 | rtems_event_receive( RTEMS_EVENT_0, |
|
269 | rtems_event_receive( RTEMS_EVENT_0, | |
251 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
270 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
252 | PRINTF("send CWF F3 \n") |
|
271 | PRINTF("send CWF F3 \n") | |
253 | #ifdef GSA |
|
272 | #ifdef GSA | |
254 | #else |
|
273 | #else | |
255 | if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3) { |
|
274 | if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3) { | |
256 | send_waveform_CWF( wf_cont_f3_bis, SID_NORM_CWF_F3, headerCWF_F3 ); |
|
275 | send_waveform_CWF( wf_cont_f3_bis, SID_NORM_CWF_F3, headerCWF_F3 ); | |
257 | } |
|
276 | } | |
258 | else { |
|
277 | else { | |
259 | send_waveform_CWF( wf_cont_f3, SID_NORM_CWF_F3, headerCWF_F3 ); |
|
278 | send_waveform_CWF( wf_cont_f3, SID_NORM_CWF_F3, headerCWF_F3 ); | |
260 | } |
|
279 | } | |
261 | #endif |
|
280 | #endif | |
262 | } |
|
281 | } | |
263 | } |
|
282 | } | |
264 |
|
283 | |||
265 | rtems_task cwf2_task(rtems_task_argument argument) // ONLY USED IN BURST AND SBM2 |
|
284 | rtems_task cwf2_task(rtems_task_argument argument) // ONLY USED IN BURST AND SBM2 | |
266 | { |
|
285 | { | |
267 | rtems_event_set event_out; |
|
286 | rtems_event_set event_out; | |
268 |
|
287 | |||
269 | init_header_continuous_wf_table( SID_BURST_CWF_F2, headerCWF_F2_BURST ); |
|
288 | init_header_continuous_wf_table( SID_BURST_CWF_F2, headerCWF_F2_BURST ); | |
270 |
init_header_continuous_wf_table( SID_SBM2_CWF_F2, headerCWF_F2_SBM |
|
289 | init_header_continuous_wf_table( SID_SBM2_CWF_F2, headerCWF_F2_SBM2 ); | |
271 |
|
290 | |||
272 | PRINTF("in CWF2 ***\n") |
|
291 | PRINTF("in CWF2 ***\n") | |
273 |
|
292 | |||
274 | while(1){ |
|
293 | while(1){ | |
275 | // wait for an RTEMS_EVENT |
|
294 | // wait for an RTEMS_EVENT | |
276 | rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2, |
|
295 | rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2, | |
277 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
296 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
278 | if (event_out == RTEMS_EVENT_MODE_BURST) |
|
297 | if (event_out == RTEMS_EVENT_MODE_BURST) | |
279 | { |
|
298 | { | |
280 | // F2 |
|
299 | // F2 | |
281 | #ifdef GSA |
|
300 | #ifdef GSA | |
282 | #else |
|
301 | #else | |
283 | if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) { |
|
302 | if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) { | |
284 | send_waveform_CWF( wf_snap_f2_bis, SID_BURST_CWF_F2, headerCWF_F2_BURST ); |
|
303 | send_waveform_CWF( wf_snap_f2_bis, SID_BURST_CWF_F2, headerCWF_F2_BURST ); | |
285 | } |
|
304 | } | |
286 | else { |
|
305 | else { | |
287 | send_waveform_CWF( wf_snap_f2, SID_BURST_CWF_F2, headerCWF_F2_BURST ); |
|
306 | send_waveform_CWF( wf_snap_f2, SID_BURST_CWF_F2, headerCWF_F2_BURST ); | |
288 | } |
|
307 | } | |
289 | #endif |
|
308 | #endif | |
290 | } |
|
309 | } | |
291 | else if (event_out == RTEMS_EVENT_MODE_SBM2) |
|
310 | else if (event_out == RTEMS_EVENT_MODE_SBM2) | |
292 | { |
|
311 | { | |
293 | #ifdef GSA |
|
312 | #ifdef GSA | |
294 | #else |
|
313 | #else | |
295 | if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) { |
|
314 | if (doubleSendCWF2 == 1) | |
296 | send_waveform_CWF( wf_snap_f2_bis, SID_SBM2_CWF_F2, headerCWF_F2_SBM1 ); |
|
315 | { | |
|
316 | doubleSendCWF2 = 0; | |||
|
317 | send_waveform_CWF( wf_snap_f2_norm, SID_SBM2_CWF_F2, headerCWF_F2_SBM2 ); | |||
|
318 | } | |||
|
319 | else if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) { | |||
|
320 | send_waveform_CWF( wf_snap_f2_bis, SID_SBM2_CWF_F2, headerCWF_F2_SBM2 ); | |||
297 | } |
|
321 | } | |
298 | else { |
|
322 | else { | |
299 |
send_waveform_CWF( wf_snap_f2, SID_SBM2_CWF_F2, headerCWF_F2_SBM |
|
323 | send_waveform_CWF( wf_snap_f2, SID_SBM2_CWF_F2, headerCWF_F2_SBM2 ); | |
300 | } |
|
324 | } | |
|
325 | param_local.local_sbm2_nb_cwf_sent ++; | |||
301 | #endif |
|
326 | #endif | |
302 | } |
|
327 | } | |
303 | else |
|
328 | else | |
304 | { |
|
329 | { | |
305 | PRINTF1("in CWF2 *** ERR mode = %d\n", lfrCurrentMode) |
|
330 | PRINTF1("in CWF2 *** ERR mode = %d\n", lfrCurrentMode) | |
306 | } |
|
331 | } | |
307 | } |
|
332 | } | |
308 | } |
|
333 | } | |
309 |
|
334 | |||
310 | rtems_task cwf1_task(rtems_task_argument argument) // ONLY USED IN SBM1 |
|
335 | rtems_task cwf1_task(rtems_task_argument argument) // ONLY USED IN SBM1 | |
311 | { |
|
336 | { | |
312 | rtems_event_set event_out; |
|
337 | rtems_event_set event_out; | |
313 |
|
338 | |||
314 | init_header_continuous_wf_table( SID_SBM1_CWF_F1, headerCWF_F1 ); |
|
339 | init_header_continuous_wf_table( SID_SBM1_CWF_F1, headerCWF_F1 ); | |
315 |
|
340 | |||
316 | PRINTF("in CWF1 ***\n") |
|
341 | PRINTF("in CWF1 ***\n") | |
317 |
|
342 | |||
318 | while(1){ |
|
343 | while(1){ | |
319 | // wait for an RTEMS_EVENT |
|
344 | // wait for an RTEMS_EVENT | |
320 | rtems_event_receive( RTEMS_EVENT_MODE_SBM1, |
|
345 | rtems_event_receive( RTEMS_EVENT_MODE_SBM1, | |
321 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
346 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
322 | if (event_out == RTEMS_EVENT_MODE_SBM1) |
|
347 | if (event_out == RTEMS_EVENT_MODE_SBM1) | |
323 | { |
|
348 | { | |
324 | #ifdef GSA |
|
349 | #ifdef GSA | |
325 | #else |
|
350 | #else | |
326 | if (doubleSendCWF1 == 1) |
|
351 | if (doubleSendCWF1 == 1) | |
327 | { |
|
352 | { | |
328 | doubleSendCWF1 = 0; |
|
353 | doubleSendCWF1 = 0; | |
329 | send_waveform_CWF( wf_snap_f1_norm, SID_SBM1_CWF_F1, headerCWF_F1 ); |
|
354 | send_waveform_CWF( wf_snap_f1_norm, SID_SBM1_CWF_F1, headerCWF_F1 ); | |
330 | } |
|
355 | } | |
331 | else if (waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1) { |
|
356 | else if (waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1) { | |
332 | send_waveform_CWF( wf_snap_f1_bis, SID_SBM1_CWF_F1, headerCWF_F1 ); |
|
357 | send_waveform_CWF( wf_snap_f1_bis, SID_SBM1_CWF_F1, headerCWF_F1 ); | |
333 | } |
|
358 | } | |
334 | else { |
|
359 | else { | |
335 | send_waveform_CWF( wf_snap_f1, SID_SBM1_CWF_F1, headerCWF_F1); |
|
360 | send_waveform_CWF( wf_snap_f1, SID_SBM1_CWF_F1, headerCWF_F1); | |
336 | } |
|
361 | } | |
337 | param_local.local_sbm1_nb_cwf_sent ++; |
|
362 | param_local.local_sbm1_nb_cwf_sent ++; | |
338 | #endif |
|
363 | #endif | |
339 | } |
|
364 | } | |
340 | else |
|
365 | else | |
341 | { |
|
366 | { | |
342 | PRINTF1("in CWF1 *** ERR mode = %d\n", lfrCurrentMode) |
|
367 | PRINTF1("in CWF1 *** ERR mode = %d\n", lfrCurrentMode) | |
343 | } |
|
368 | } | |
344 | } |
|
369 | } | |
345 | } |
|
370 | } | |
346 |
|
371 | |||
347 | //****************** |
|
372 | //****************** | |
348 | // general functions |
|
373 | // general functions | |
349 | void init_waveforms( void ) |
|
374 | void init_waveforms( void ) | |
350 | { |
|
375 | { | |
351 | int i = 0; |
|
376 | int i = 0; | |
352 |
|
377 | |||
353 | for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++) |
|
378 | for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++) | |
354 | { |
|
379 | { | |
355 | //*** |
|
380 | //*** | |
356 | // F0 |
|
381 | // F0 | |
357 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x88887777; // |
|
382 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x88887777; // | |
358 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; // |
|
383 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; // | |
359 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x44443333; // |
|
384 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x44443333; // | |
360 |
|
385 | |||
361 | //*** |
|
386 | //*** | |
362 | // F1 |
|
387 | // F1 | |
363 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x22221111; |
|
388 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x22221111; | |
364 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x44443333; |
|
389 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x44443333; | |
365 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000; |
|
390 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000; | |
366 |
|
391 | |||
367 | //*** |
|
392 | //*** | |
368 | // F2 |
|
393 | // F2 | |
369 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x44443333; |
|
394 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x44443333; | |
370 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; |
|
395 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; | |
371 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000; |
|
396 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000; | |
372 |
|
397 | |||
373 | //*** |
|
398 | //*** | |
374 | // F3 |
|
399 | // F3 | |
375 | //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 0 ] = val1; |
|
400 | //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 0 ] = val1; | |
376 | //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 1 ] = val2; |
|
401 | //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 1 ] = val2; | |
377 | //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 2 ] = 0xaaaa0000; |
|
402 | //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 2 ] = 0xaaaa0000; | |
378 | } |
|
403 | } | |
379 | } |
|
404 | } | |
380 |
|
405 | |||
381 | int init_header_snapshot_wf_table( unsigned int sid) |
|
406 | int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF) | |
382 | { |
|
407 | { | |
383 | unsigned char i; |
|
408 | unsigned char i; | |
384 | unsigned char j; |
|
|||
385 |
|
||||
386 | j = 0; |
|
|||
387 |
|
||||
388 | switch(sid) |
|
|||
389 | { |
|
|||
390 | case SID_NORM_SWF_F0: |
|
|||
391 | j = 0; |
|
|||
392 | break; |
|
|||
393 | case SID_NORM_SWF_F1: |
|
|||
394 | j = 1; |
|
|||
395 | break; |
|
|||
396 | case SID_NORM_SWF_F2: |
|
|||
397 | j = 2; |
|
|||
398 | break; |
|
|||
399 | default: |
|
|||
400 | return LFR_DEFAULT; |
|
|||
401 | } |
|
|||
402 |
|
409 | |||
403 | for (i=0; i<7; i++) |
|
410 | for (i=0; i<7; i++) | |
404 | { |
|
411 | { | |
405 |
headerSWF |
|
412 | headerSWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; | |
406 |
headerSWF |
|
413 | headerSWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
407 |
headerSWF |
|
414 | headerSWF[ i ].reserved = DEFAULT_RESERVED; | |
408 |
headerSWF |
|
415 | headerSWF[ i ].userApplication = CCSDS_USER_APP; | |
409 |
headerSWF |
|
416 | headerSWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); | |
410 |
headerSWF |
|
417 | headerSWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); | |
411 | if (i == 0) |
|
418 | if (i == 0) | |
412 | { |
|
419 | { | |
413 |
headerSWF |
|
420 | headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST; | |
414 |
headerSWF |
|
421 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_340 >> 8); | |
415 |
headerSWF |
|
422 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_340 ); | |
416 |
headerSWF |
|
423 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8); | |
417 |
headerSWF |
|
424 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 ); | |
418 | } |
|
425 | } | |
419 | else if (i == 6) |
|
426 | else if (i == 6) | |
420 | { |
|
427 | { | |
421 |
headerSWF |
|
428 | headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST; | |
422 |
headerSWF |
|
429 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_8 >> 8); | |
423 |
headerSWF |
|
430 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_8 ); | |
424 |
headerSWF |
|
431 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8); | |
425 |
headerSWF |
|
432 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 ); | |
426 | } |
|
433 | } | |
427 | else |
|
434 | else | |
428 | { |
|
435 | { | |
429 |
headerSWF |
|
436 | headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION; | |
430 |
headerSWF |
|
437 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_340 >> 8); | |
431 |
headerSWF |
|
438 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_340 ); | |
432 |
headerSWF |
|
439 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8); | |
433 |
headerSWF |
|
440 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 ); | |
434 | } |
|
441 | } | |
435 |
headerSWF |
|
442 | headerSWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
436 |
headerSWF |
|
443 | headerSWF[ i ].pktCnt = DEFAULT_PKTCNT; // PKT_CNT | |
437 |
headerSWF |
|
444 | headerSWF[ i ].pktNr = i+1; // PKT_NR | |
438 | // DATA FIELD HEADER |
|
445 | // DATA FIELD HEADER | |
439 |
headerSWF |
|
446 | headerSWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
440 |
headerSWF |
|
447 | headerSWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
441 |
headerSWF |
|
448 | headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
442 |
headerSWF |
|
449 | headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; | |
443 | // AUXILIARY DATA HEADER |
|
450 | // AUXILIARY DATA HEADER | |
444 |
headerSWF |
|
451 | headerSWF[ i ].sid = sid; | |
445 |
headerSWF |
|
452 | headerSWF[ i ].hkBIA = DEFAULT_HKBIA; | |
446 |
headerSWF |
|
453 | headerSWF[ i ].time[0] = 0x00; | |
447 |
headerSWF |
|
454 | headerSWF[ i ].time[0] = 0x00; | |
448 |
headerSWF |
|
455 | headerSWF[ i ].time[0] = 0x00; | |
449 |
headerSWF |
|
456 | headerSWF[ i ].time[0] = 0x00; | |
450 |
headerSWF |
|
457 | headerSWF[ i ].time[0] = 0x00; | |
451 |
headerSWF |
|
458 | headerSWF[ i ].time[0] = 0x00; | |
452 | } |
|
459 | } | |
453 | return LFR_SUCCESSFUL; |
|
460 | return LFR_SUCCESSFUL; | |
454 | } |
|
461 | } | |
455 |
|
462 | |||
456 | int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF ) |
|
463 | int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF ) | |
457 | { |
|
464 | { | |
458 | unsigned int i; |
|
465 | unsigned int i; | |
459 |
|
466 | |||
460 | for (i=0; i<7; i++) |
|
467 | for (i=0; i<7; i++) | |
461 | { |
|
468 | { | |
462 | headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
469 | headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; | |
463 | headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
470 | headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
464 | headerCWF[ i ].reserved = DEFAULT_RESERVED; |
|
471 | headerCWF[ i ].reserved = DEFAULT_RESERVED; | |
465 | headerCWF[ i ].userApplication = CCSDS_USER_APP; |
|
472 | headerCWF[ i ].userApplication = CCSDS_USER_APP; | |
466 | headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_BURST_SBM1_SBM2 >> 8); |
|
473 | if (SID_SBM1_CWF_F1 || SID_SBM2_CWF_F2) | |
467 | headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_BURST_SBM1_SBM2); |
|
474 | { | |
|
475 | headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2 >> 8); | |||
|
476 | headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2); | |||
|
477 | } | |||
|
478 | else | |||
|
479 | { | |||
|
480 | headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); | |||
|
481 | headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); | |||
|
482 | } | |||
468 | if (i == 0) |
|
483 | if (i == 0) | |
469 | { |
|
484 | { | |
470 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST; |
|
485 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST; | |
471 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_340 >> 8); |
|
486 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_340 >> 8); | |
472 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_340 ); |
|
487 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_340 ); | |
473 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8); |
|
488 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8); | |
474 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 ); |
|
489 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 ); | |
475 | } |
|
490 | } | |
476 | else if (i == 6) |
|
491 | else if (i == 6) | |
477 | { |
|
492 | { | |
478 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST; |
|
493 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST; | |
479 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_8 >> 8); |
|
494 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_8 >> 8); | |
480 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_8 ); |
|
495 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_8 ); | |
481 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8); |
|
496 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8); | |
482 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 ); |
|
497 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 ); | |
483 | } |
|
498 | } | |
484 | else |
|
499 | else | |
485 | { |
|
500 | { | |
486 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION; |
|
501 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION; | |
487 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_340 >> 8); |
|
502 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_340 >> 8); | |
488 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_340 ); |
|
503 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_340 ); | |
489 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8); |
|
504 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8); | |
490 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 ); |
|
505 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 ); | |
491 | } |
|
506 | } | |
492 | headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
507 | headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
493 | // PKT_CNT |
|
508 | // PKT_CNT | |
494 | // PKT_NR |
|
509 | // PKT_NR | |
495 | // DATA FIELD HEADER |
|
510 | // DATA FIELD HEADER | |
496 | headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
511 | headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
497 | headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
512 | headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
498 | headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
513 | headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
499 | headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; |
|
514 | headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; | |
500 | // AUXILIARY DATA HEADER |
|
515 | // AUXILIARY DATA HEADER | |
501 | headerCWF[ i ].sid = sid; |
|
516 | headerCWF[ i ].sid = sid; | |
502 | headerCWF[ i ].hkBIA = DEFAULT_HKBIA; |
|
517 | headerCWF[ i ].hkBIA = DEFAULT_HKBIA; | |
503 | headerCWF[ i ].time[0] = 0x00; |
|
518 | headerCWF[ i ].time[0] = 0x00; | |
504 | headerCWF[ i ].time[0] = 0x00; |
|
519 | headerCWF[ i ].time[0] = 0x00; | |
505 | headerCWF[ i ].time[0] = 0x00; |
|
520 | headerCWF[ i ].time[0] = 0x00; | |
506 | headerCWF[ i ].time[0] = 0x00; |
|
521 | headerCWF[ i ].time[0] = 0x00; | |
507 | headerCWF[ i ].time[0] = 0x00; |
|
522 | headerCWF[ i ].time[0] = 0x00; | |
508 | headerCWF[ i ].time[0] = 0x00; |
|
523 | headerCWF[ i ].time[0] = 0x00; | |
509 | } |
|
524 | } | |
510 | return LFR_SUCCESSFUL; |
|
525 | return LFR_SUCCESSFUL; | |
511 | } |
|
526 | } | |
512 |
|
527 | |||
513 | void reset_waveforms( void ) |
|
528 | void reset_waveforms( void ) | |
514 | { |
|
529 | { | |
515 | int i = 0; |
|
530 | int i = 0; | |
516 |
|
531 | |||
517 | for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++) |
|
532 | for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++) | |
518 | { |
|
533 | { | |
519 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x10002000; |
|
534 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x10002000; | |
520 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0x20001000; |
|
535 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0x20001000; | |
521 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x40008000; |
|
536 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x40008000; | |
522 |
|
537 | |||
523 | //*** |
|
538 | //*** | |
524 | // F1 |
|
539 | // F1 | |
525 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x1000f000; |
|
540 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x1000f000; | |
526 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0xf0001000; |
|
541 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0xf0001000; | |
527 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x40008000; |
|
542 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x40008000; | |
528 |
|
543 | |||
529 | //*** |
|
544 | //*** | |
530 | // F2 |
|
545 | // F2 | |
531 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x40008000; |
|
546 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x40008000; | |
532 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0x20001000; |
|
547 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0x20001000; | |
533 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x10002000; |
|
548 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x10002000; | |
534 |
|
549 | |||
535 | //*** |
|
550 | //*** | |
536 | // F3 |
|
551 | // F3 | |
537 | /*wf_cont_f3[ i* NB_WORDS_SWF_BLK + 0 ] = build_value( i, i ); // v and 1 |
|
552 | /*wf_cont_f3[ i* NB_WORDS_SWF_BLK + 0 ] = build_value( i, i ); // v and 1 | |
538 | wf_cont_f3[ i* NB_WORDS_SWF_BLK + 1 ] = build_value( i, i ); // e2 and b1 |
|
553 | wf_cont_f3[ i* NB_WORDS_SWF_BLK + 1 ] = build_value( i, i ); // e2 and b1 | |
539 | wf_cont_f3[ i* NB_WORDS_SWF_BLK + 2 ] = build_value( i, i ); // b2 and b3*/ |
|
554 | wf_cont_f3[ i* NB_WORDS_SWF_BLK + 2 ] = build_value( i, i ); // b2 and b3*/ | |
540 | } |
|
555 | } | |
541 | } |
|
556 | } | |
542 |
|
557 | |||
543 | int send_waveform_SWF( volatile int *waveform, unsigned int sid ) |
|
558 | int send_waveform_SWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF ) | |
544 | { |
|
559 | { | |
545 | unsigned int i; |
|
560 | unsigned int i; | |
546 | unsigned int j; |
|
|||
547 | int ret; |
|
561 | int ret; | |
548 | rtems_status_code status; |
|
562 | rtems_status_code status; | |
549 | spw_ioctl_pkt_send spw_ioctl_send_SWF; |
|
563 | spw_ioctl_pkt_send spw_ioctl_send_SWF; | |
550 |
|
564 | |||
551 | spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header |
|
565 | spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header | |
552 | spw_ioctl_send_SWF.options = 0; |
|
566 | spw_ioctl_send_SWF.options = 0; | |
553 |
|
567 | |||
554 | j = 0; |
|
|||
555 | ret = LFR_DEFAULT; |
|
568 | ret = LFR_DEFAULT; | |
556 |
|
569 | |||
557 | switch(sid) |
|
|||
558 | { |
|
|||
559 | case SID_NORM_SWF_F0: |
|
|||
560 | j = 0; |
|
|||
561 | break; |
|
|||
562 | case SID_NORM_SWF_F1: |
|
|||
563 | j = 1; |
|
|||
564 | break; |
|
|||
565 | case SID_NORM_SWF_F2: |
|
|||
566 | j = 2; |
|
|||
567 | break; |
|
|||
568 | default: |
|
|||
569 | ret = LFR_DEFAULT; |
|
|||
570 | break; |
|
|||
571 | } |
|
|||
572 |
|
||||
573 | for (i=0; i<7; i++) // send waveform |
|
570 | for (i=0; i<7; i++) // send waveform | |
574 | { |
|
571 | { | |
575 | spw_ioctl_send_SWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ]; |
|
572 | spw_ioctl_send_SWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ]; | |
576 |
spw_ioctl_send_SWF.hdr = (char*) &headerSWF |
|
573 | spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ]; | |
577 | // BUILD THE DATA |
|
574 | // BUILD THE DATA | |
578 | if (i==6) { |
|
575 | if (i==6) { | |
579 | spw_ioctl_send_SWF.dlen = 8 * NB_BYTES_SWF_BLK; |
|
576 | spw_ioctl_send_SWF.dlen = 8 * NB_BYTES_SWF_BLK; | |
580 | } |
|
577 | } | |
581 | else { |
|
578 | else { | |
582 | spw_ioctl_send_SWF.dlen = 340 * NB_BYTES_SWF_BLK; |
|
579 | spw_ioctl_send_SWF.dlen = 340 * NB_BYTES_SWF_BLK; | |
583 | } |
|
580 | } | |
584 | // SET PACKET TIME |
|
581 | // SET PACKET TIME | |
585 |
headerSWF |
|
582 | headerSWF[ i ].time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
586 |
headerSWF |
|
583 | headerSWF[ i ].time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
587 |
headerSWF |
|
584 | headerSWF[ i ].time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
588 |
headerSWF |
|
585 | headerSWF[ i ].time[3] = (unsigned char) (time_management_regs->coarse_time); | |
589 |
headerSWF |
|
586 | headerSWF[ i ].time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
590 |
headerSWF |
|
587 | headerSWF[ i ].time[5] = (unsigned char) (time_management_regs->fine_time); | |
591 |
headerSWF |
|
588 | headerSWF[ i ].acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
592 |
headerSWF |
|
589 | headerSWF[ i ].acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
593 |
headerSWF |
|
590 | headerSWF[ i ].acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
594 |
headerSWF |
|
591 | headerSWF[ i ].acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time); | |
595 |
headerSWF |
|
592 | headerSWF[ i ].acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
596 |
headerSWF |
|
593 | headerSWF[ i ].acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time); | |
597 | // SEND PACKET |
|
594 | // SEND PACKET | |
598 | //status = write_spw(&spw_ioctl_send_SWF); |
|
595 | status = rtems_message_queue_send( misc_id[QUEUE_PKTS], &spw_ioctl_send_SWF, ACTION_MSG_PKTS_SIZE); | |
599 | status = rtems_message_queue_send( misc_id[1], &spw_ioctl_send_SWF, sizeof(spw_ioctl_send_SWF)); |
|
|||
600 | if (status != RTEMS_SUCCESSFUL) { |
|
596 | if (status != RTEMS_SUCCESSFUL) { | |
601 |
|
|
597 | printf("%d-%d, ERR %d\n", sid, i, (int) status); | |
602 | ret = LFR_DEFAULT; |
|
598 | ret = LFR_DEFAULT; | |
603 | } |
|
599 | } | |
604 | rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds |
|
600 | rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds | |
605 | } |
|
601 | } | |
606 |
|
602 | |||
607 | return ret; |
|
603 | return ret; | |
608 | } |
|
604 | } | |
609 |
|
605 | |||
610 | int send_waveform_CWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF) |
|
606 | int send_waveform_CWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF) | |
611 | { |
|
607 | { | |
612 | unsigned int i; |
|
608 | unsigned int i; | |
613 | int ret; |
|
609 | int ret; | |
614 | rtems_status_code status; |
|
610 | rtems_status_code status; | |
615 | spw_ioctl_pkt_send spw_ioctl_send_CWF; |
|
611 | spw_ioctl_pkt_send spw_ioctl_send_CWF; | |
616 |
|
612 | |||
617 | spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header |
|
613 | spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header | |
618 | spw_ioctl_send_CWF.options = 0; |
|
614 | spw_ioctl_send_CWF.options = 0; | |
619 |
|
615 | |||
620 | ret = LFR_DEFAULT; |
|
616 | ret = LFR_DEFAULT; | |
621 |
|
617 | |||
622 | for (i=0; i<7; i++) // send waveform |
|
618 | for (i=0; i<7; i++) // send waveform | |
623 | { |
|
619 | { | |
624 | int coarseTime = 0x00; |
|
620 | int coarseTime = 0x00; | |
625 | int fineTime = 0x00; |
|
621 | int fineTime = 0x00; | |
626 | spw_ioctl_send_CWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ]; |
|
622 | spw_ioctl_send_CWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ]; | |
627 | spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ]; |
|
623 | spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ]; | |
628 | // BUILD THE DATA |
|
624 | // BUILD THE DATA | |
629 | if (i==6) { |
|
625 | if (i==6) { | |
630 | spw_ioctl_send_CWF.dlen = 8 * NB_BYTES_SWF_BLK; |
|
626 | spw_ioctl_send_CWF.dlen = 8 * NB_BYTES_SWF_BLK; | |
631 | } |
|
627 | } | |
632 | else { |
|
628 | else { | |
633 | spw_ioctl_send_CWF.dlen = 340 * NB_BYTES_SWF_BLK; |
|
629 | spw_ioctl_send_CWF.dlen = 340 * NB_BYTES_SWF_BLK; | |
634 | } |
|
630 | } | |
635 | // SET PACKET TIME |
|
631 | // SET PACKET TIME | |
636 | coarseTime = time_management_regs->coarse_time; |
|
632 | coarseTime = time_management_regs->coarse_time; | |
637 | fineTime = time_management_regs->fine_time; |
|
633 | fineTime = time_management_regs->fine_time; | |
638 | headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24); |
|
634 | headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24); | |
639 | headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16); |
|
635 | headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16); | |
640 | headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8); |
|
636 | headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8); | |
641 | headerCWF[ i ].time[3] = (unsigned char) (coarseTime); |
|
637 | headerCWF[ i ].time[3] = (unsigned char) (coarseTime); | |
642 | headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8); |
|
638 | headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8); | |
643 | headerCWF[ i ].time[5] = (unsigned char) (fineTime); |
|
639 | headerCWF[ i ].time[5] = (unsigned char) (fineTime); | |
644 | headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24); |
|
640 | headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24); | |
645 | headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16); |
|
641 | headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16); | |
646 | headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8); |
|
642 | headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8); | |
647 | headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime); |
|
643 | headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime); | |
648 | headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8); |
|
644 | headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8); | |
649 | headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime); |
|
645 | headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime); | |
650 | // SEND PACKET |
|
646 | // SEND PACKET | |
651 | //status = write_spw(&spw_ioctl_send_CWF); |
|
647 | if (sid == SID_NORM_CWF_F3) | |
652 | status = rtems_message_queue_urgent( misc_id[1], &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); |
|
648 | { | |
653 | if (status != RTEMS_SUCCESSFUL) { |
|
649 | status = rtems_message_queue_send( misc_id[QUEUE_PKTS], &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); | |
654 | PRINTF2("sid %d, i = %d\n", sid, i) |
|
650 | if (status != RTEMS_SUCCESSFUL) { | |
655 | ret = LFR_DEFAULT; |
|
651 | printf("%d-%d, ERR %d\n", sid, i, (int) status); | |
|
652 | ret = LFR_DEFAULT; | |||
|
653 | } | |||
|
654 | rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS); | |||
656 | } |
|
655 | } | |
657 | else |
|
656 | else | |
658 | { |
|
657 | { | |
659 | sched_yield(); |
|
658 | status = rtems_message_queue_urgent( misc_id[QUEUE_PKTS], &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); | |
660 | } |
|
659 | if (status != RTEMS_SUCCESSFUL) { | |
661 | if (sid == SID_NORM_CWF_F3) |
|
660 | printf("%d-%d, ERR %d\n", sid, i, (int) status); | |
662 | { |
|
661 | ret = LFR_DEFAULT; | |
663 | rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS); |
|
662 | } | |
664 | } |
|
663 | } | |
665 | } |
|
664 | } | |
666 |
|
665 | |||
667 | return ret; |
|
666 | return ret; | |
668 | } |
|
667 | } | |
669 |
|
668 | |||
670 | //************** |
|
669 | //************** | |
671 | // wfp registers |
|
670 | // wfp registers | |
672 | void set_wfp_data_shaping() |
|
671 | void set_wfp_data_shaping() | |
673 | { |
|
672 | { | |
674 | unsigned char data_shaping; |
|
673 | unsigned char data_shaping; | |
675 |
|
674 | |||
676 | // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register |
|
675 | // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register | |
677 | // waveform picker : [R1 R0 SP1 SP0 BW] |
|
676 | // waveform picker : [R1 R0 SP1 SP0 BW] | |
678 |
|
677 | |||
679 | data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1; |
|
678 | data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1; | |
680 |
|
679 | |||
681 | #ifdef GSA |
|
680 | #ifdef GSA | |
682 | #else |
|
681 | #else | |
683 | waveform_picker_regs->data_shaping = |
|
682 | waveform_picker_regs->data_shaping = | |
684 | ( (data_shaping & 0x10) >> 4 ) // BW |
|
683 | ( (data_shaping & 0x10) >> 4 ) // BW | |
685 | + ( (data_shaping & 0x08) >> 2 ) // SP0 |
|
684 | + ( (data_shaping & 0x08) >> 2 ) // SP0 | |
686 | + ( (data_shaping & 0x04) ) // SP1 |
|
685 | + ( (data_shaping & 0x04) ) // SP1 | |
687 | + ( (data_shaping & 0x02) << 2 ) // R0 |
|
686 | + ( (data_shaping & 0x02) << 2 ) // R0 | |
688 | + ( (data_shaping & 0x01) << 4 ); // R1 |
|
687 | + ( (data_shaping & 0x01) << 4 ); // R1 | |
689 | #endif |
|
688 | #endif | |
690 | } |
|
689 | } | |
691 |
|
690 | |||
692 | char set_wfp_delta_snapshot() |
|
691 | char set_wfp_delta_snapshot() | |
693 | { |
|
692 | { | |
694 | char ret; |
|
693 | char ret; | |
695 | unsigned int delta_snapshot; |
|
694 | unsigned int delta_snapshot; | |
696 | ret = LFR_DEFAULT; |
|
695 | ret = LFR_DEFAULT; | |
697 |
|
696 | |||
698 | delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256 |
|
697 | delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256 | |
699 | + parameter_dump_packet.sy_lfr_n_swf_p[1]; |
|
698 | + parameter_dump_packet.sy_lfr_n_swf_p[1]; | |
700 |
|
699 | |||
701 | #ifdef GSA |
|
700 | #ifdef GSA | |
702 | #else |
|
701 | #else | |
703 | unsigned char aux = 0; |
|
702 | unsigned char aux = 0; | |
704 | if ( delta_snapshot < MIN_DELTA_SNAPSHOT ) |
|
703 | if ( delta_snapshot < MIN_DELTA_SNAPSHOT ) | |
705 | { |
|
704 | { | |
706 | aux = MIN_DELTA_SNAPSHOT; |
|
705 | aux = MIN_DELTA_SNAPSHOT; | |
707 | ret = LFR_DEFAULT; |
|
706 | ret = LFR_DEFAULT; | |
708 | } |
|
707 | } | |
709 | else |
|
708 | else | |
710 | { |
|
709 | { | |
711 | aux = delta_snapshot ; |
|
710 | aux = delta_snapshot ; | |
712 | ret = LFR_SUCCESSFUL; |
|
711 | ret = LFR_SUCCESSFUL; | |
713 | } |
|
712 | } | |
714 | waveform_picker_regs->delta_snapshot = aux; // max 2 bytes |
|
713 | waveform_picker_regs->delta_snapshot = aux; // max 2 bytes | |
715 | #endif |
|
714 | #endif | |
716 |
|
715 | |||
717 | return ret; |
|
716 | return ret; | |
718 | } |
|
717 | } | |
719 |
|
718 | |||
720 | void set_wfp_burst_enable_register( unsigned char mode) |
|
719 | void set_wfp_burst_enable_register( unsigned char mode) | |
721 | { |
|
720 | { | |
722 | #ifdef GSA |
|
721 | #ifdef GSA | |
723 | #else |
|
722 | #else | |
724 | // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0 |
|
723 | // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0 | |
725 | // the burst bits shall be set first, before the enable bits |
|
724 | // the burst bits shall be set first, before the enable bits | |
726 | switch(mode) { |
|
725 | switch(mode) { | |
727 | case(LFR_MODE_NORMAL): |
|
726 | case(LFR_MODE_NORMAL): | |
728 | waveform_picker_regs->burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0 |
|
727 | waveform_picker_regs->burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0 | |
729 | break; |
|
728 | break; | |
730 | case(LFR_MODE_BURST): |
|
729 | case(LFR_MODE_BURST): | |
731 | waveform_picker_regs->burst_enable = 0x40; // [0100 0000] f2 burst enabled |
|
730 | waveform_picker_regs->burst_enable = 0x40; // [0100 0000] f2 burst enabled | |
732 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x04; // [0100] enable f2 |
|
731 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x04; // [0100] enable f2 | |
733 | break; |
|
732 | break; | |
734 | case(LFR_MODE_SBM1): |
|
733 | case(LFR_MODE_SBM1): | |
735 | waveform_picker_regs->burst_enable = 0x20; // [0010 0000] f1 burst enabled |
|
734 | waveform_picker_regs->burst_enable = 0x20; // [0010 0000] f1 burst enabled | |
736 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 |
|
735 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 | |
737 | break; |
|
736 | break; | |
738 | case(LFR_MODE_SBM2): |
|
737 | case(LFR_MODE_SBM2): | |
739 | waveform_picker_regs->burst_enable = 0x40; // [0100 0000] f2 burst enabled |
|
738 | waveform_picker_regs->burst_enable = 0x40; // [0100 0000] f2 burst enabled | |
740 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 |
|
739 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 | |
741 | break; |
|
740 | break; | |
742 | default: |
|
741 | default: | |
743 | waveform_picker_regs->burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled |
|
742 | waveform_picker_regs->burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled | |
744 | break; |
|
743 | break; | |
745 | } |
|
744 | } | |
746 | #endif |
|
745 | #endif | |
747 | } |
|
746 | } | |
748 |
|
747 | |||
749 | void reset_wfp_burst_enable() |
|
748 | void reset_wfp_burst_enable() | |
750 | { |
|
749 | { | |
751 | #ifdef GSA |
|
750 | #ifdef GSA | |
752 | #else |
|
751 | #else | |
753 | waveform_picker_regs->burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 |
|
752 | waveform_picker_regs->burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 | |
754 | #endif |
|
753 | #endif | |
755 | } |
|
754 | } | |
756 |
|
755 | |||
757 | void reset_wfp_status() |
|
756 | void reset_wfp_status() | |
758 | { |
|
757 | { | |
759 | #ifdef GSA |
|
758 | #ifdef GSA | |
760 | #else |
|
759 | #else | |
761 | waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 |
|
760 | waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 | |
762 | #endif |
|
761 | #endif | |
763 | } |
|
762 | } | |
764 |
|
763 | |||
765 | void reset_waveform_picker_regs() |
|
764 | void reset_waveform_picker_regs() | |
766 | { |
|
765 | { | |
767 | #ifdef GSA |
|
766 | #ifdef GSA | |
768 | #else |
|
767 | #else | |
769 | set_wfp_data_shaping(); |
|
768 | set_wfp_data_shaping(); | |
770 | reset_wfp_burst_enable(); |
|
769 | reset_wfp_burst_enable(); | |
771 | waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0); // |
|
770 | waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0); // | |
772 | waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1); // |
|
771 | waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1); // | |
773 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); // |
|
772 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); // | |
774 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3); // |
|
773 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3); // | |
775 | set_wfp_delta_snapshot(); // time in seconds between two snapshots |
|
774 | set_wfp_delta_snapshot(); // time in seconds between two snapshots | |
776 | waveform_picker_regs->delta_f2_f1 = 0xffff; // 0x16800 => 92160 (max 4 bytes) |
|
775 | waveform_picker_regs->delta_f2_f1 = 0xffff; // 0x16800 => 92160 (max 4 bytes) | |
777 | waveform_picker_regs->delta_f2_f0 = 0x17c00; // 97 280 (max 5 bytes) |
|
776 | waveform_picker_regs->delta_f2_f0 = 0x17c00; // 97 280 (max 5 bytes) | |
778 | waveform_picker_regs->nb_burst_available = 0x180; // max 3 bytes, size of the buffer in burst (1 burst = 16 x 4 octets) |
|
777 | waveform_picker_regs->nb_burst_available = 0x180; // max 3 bytes, size of the buffer in burst (1 burst = 16 x 4 octets) | |
779 | waveform_picker_regs->nb_snapshot_param = 0x7ff; // max 3 octets, 2048 - 1 |
|
778 | waveform_picker_regs->nb_snapshot_param = 0x7ff; // max 3 octets, 2048 - 1 | |
780 | waveform_picker_regs->status = 0x00; // |
|
779 | waveform_picker_regs->status = 0x00; // | |
781 | #endif |
|
780 | #endif | |
782 | } |
|
781 | } | |
783 |
|
782 | |||
784 | //***************** |
|
783 | //***************** | |
785 | // local parameters |
|
784 | // local parameters | |
786 | void set_local_sbm1_nb_cwf_max() |
|
785 | void set_local_sbm1_nb_cwf_max() | |
787 | { |
|
786 | { | |
788 | // (2 snapshots of 2048 points per seconds) * (period of the NORM snashots) - 8 s (duration of the f2 snapshot) |
|
787 | // (2 snapshots of 2048 points per seconds) * (period of the NORM snashots) - 8 s (duration of the f2 snapshot) | |
789 |
param_local.local_sbm1_nb_cwf_max = 2 * |
|
788 | param_local.local_sbm1_nb_cwf_max = 2 * | |
790 |
|
|
789 | (parameter_dump_packet.sy_lfr_n_swf_p[0] * 256 | |
791 |
|
|
790 | + parameter_dump_packet.sy_lfr_n_swf_p[1]) - 8; // 16 CWF1 parts during 1 SWF2 | |
792 | ) - 8; // 16 CWF1 parts during 1 SWF2 |
|
|||
793 | } |
|
791 | } | |
794 |
|
792 | |||
795 | void set_local_sbm2_nb_cwf_max() |
|
793 | void set_local_sbm2_nb_cwf_max() | |
796 | { |
|
794 | { | |
797 | // (period of the NORM snashots) / (8 seconds per snapshot at f2 = 256 Hz) |
|
795 | // (period of the NORM snashots) / (8 seconds per snapshot at f2 = 256 Hz) | |
798 | param_local.local_sbm2_nb_cwf_max = ( |
|
796 | param_local.local_sbm2_nb_cwf_max = (parameter_dump_packet.sy_lfr_n_swf_p[0] * 256 | |
799 |
|
|
797 | + parameter_dump_packet.sy_lfr_n_swf_p[1]) / 8; | |
800 | + parameter_dump_packet.sy_lfr_n_swf_p[1] |
|
|||
801 | )/ 8; |
|
|||
802 | } |
|
798 | } | |
803 |
|
799 | |||
804 | void set_local_nb_interrupt_f0_MAX() |
|
800 | void set_local_nb_interrupt_f0_MAX() | |
805 | { |
|
801 | { | |
806 | param_local.local_nb_interrupt_f0_MAX = ( (parameter_dump_packet.sy_lfr_n_asm_p[0]) * 256 |
|
802 | param_local.local_nb_interrupt_f0_MAX = ( (parameter_dump_packet.sy_lfr_n_asm_p[0]) * 256 | |
807 | + parameter_dump_packet.sy_lfr_n_asm_p[1] ) * 100; |
|
803 | + parameter_dump_packet.sy_lfr_n_asm_p[1] ) * 100; | |
808 | } |
|
804 | } | |
809 |
|
805 | |||
810 | void reset_local_sbm1_nb_cwf_sent() |
|
806 | void reset_local_sbm1_nb_cwf_sent() | |
811 | { |
|
807 | { | |
812 | param_local.local_sbm1_nb_cwf_sent = 0; |
|
808 | param_local.local_sbm1_nb_cwf_sent = 0; | |
813 | } |
|
809 | } | |
814 |
|
810 | |||
815 | void reset_local_sbm2_nb_cwf_sent() |
|
811 | void reset_local_sbm2_nb_cwf_sent() | |
816 | { |
|
812 | { | |
817 | param_local.local_sbm2_nb_cwf_sent = 0; |
|
813 | param_local.local_sbm2_nb_cwf_sent = 0; | |
818 | } |
|
814 | } |
General Comments 0
You need to be logged in to leave comments.
Login now