@@ -0,0 +1,6 | |||||
|
1 | #ifndef TM_BYTE_POSITIONS_H | |||
|
2 | #define TM_BYTE_POSITIONS_H | |||
|
3 | ||||
|
4 | #define BYTE_POS_CP_LFR_MODE 11 | |||
|
5 | ||||
|
6 | #endif // TM_BYTE_POSITIONS_H |
@@ -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: Thu Oct 10 |
|
3 | # Generated by qmake (2.01a) (Qt 4.8.5) on: Thu Oct 10 15:46:11 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=14 -DPRINT_MESSAGES_ON_CONSOLE |
|
13 | DEFINES = -DSW_VERSION_N1=0 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=14 -DPRINT_MESSAGES_ON_CONSOLE | |
14 | CFLAGS = -pipe -O3 -Wall $(DEFINES) |
|
14 | CFLAGS = -pipe -O3 -Wall $(DEFINES) | |
15 | CXXFLAGS = -pipe -O3 -Wall $(DEFINES) |
|
15 | CXXFLAGS = -pipe -O3 -Wall $(DEFINES) | |
16 | INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header |
|
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,62 +1,63 | |||||
1 | TEMPLATE = app |
|
1 | TEMPLATE = app | |
2 | # CONFIG += console v8 sim |
|
2 | # CONFIG += console v8 sim | |
3 | # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** gsa |
|
3 | # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** gsa | |
4 | CONFIG += console verbose |
|
4 | CONFIG += console verbose | |
5 | CONFIG -= qt |
|
5 | CONFIG -= qt | |
6 |
|
6 | |||
7 | include(./sparc.pri) |
|
7 | include(./sparc.pri) | |
8 |
|
8 | |||
9 | # flight software version |
|
9 | # flight software version | |
10 | SWVERSION=-0-14 |
|
10 | SWVERSION=-0-14 | |
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=14 |
|
14 | DEFINES += SW_VERSION_N4=14 | |
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 ) { |
|
24 | contains( CONFIG, stack_report ) { | |
25 | DEFINES += PRINT_STACK_REPORT |
|
25 | DEFINES += PRINT_STACK_REPORT | |
26 | } |
|
26 | } | |
27 |
|
27 | |||
28 | contains( CONFIG, boot_messages ) { |
|
28 | contains( CONFIG, boot_messages ) { | |
29 | DEFINES += BOOT_MESSAGES |
|
29 | DEFINES += BOOT_MESSAGES | |
30 | } |
|
30 | } | |
31 |
|
31 | |||
32 | TARGET = fsw |
|
32 | TARGET = fsw | |
33 | contains( CONFIG, gsa ) { |
|
33 | contains( CONFIG, gsa ) { | |
34 | DEFINES += GSA |
|
34 | DEFINES += GSA | |
35 | TARGET = fsw-gsa |
|
35 | TARGET = fsw-gsa | |
36 | } |
|
36 | } | |
37 |
|
37 | |||
38 | INCLUDEPATH += \ |
|
38 | INCLUDEPATH += \ | |
39 | ../src \ |
|
39 | ../src \ | |
40 | ../header |
|
40 | ../header | |
41 |
|
41 | |||
42 | SOURCES += \ |
|
42 | SOURCES += \ | |
43 | ../src/wf_handler.c \ |
|
43 | ../src/wf_handler.c \ | |
44 | ../src/tc_handler.c \ |
|
44 | ../src/tc_handler.c \ | |
45 | ../src/fsw_processing.c \ |
|
45 | ../src/fsw_processing.c \ | |
46 | ../src/fsw_misc.c \ |
|
46 | ../src/fsw_misc.c \ | |
47 | ../src/fsw_init.c \ |
|
47 | ../src/fsw_init.c \ | |
48 | ../src/fsw_globals.c \ |
|
48 | ../src/fsw_globals.c \ | |
49 | ../src/fsw_spacewire.c |
|
49 | ../src/fsw_spacewire.c | |
50 |
|
50 | |||
51 | HEADERS += \ |
|
51 | HEADERS += \ | |
52 | ../header/wf_handler.h \ |
|
52 | ../header/wf_handler.h \ | |
53 | ../header/tc_handler.h \ |
|
53 | ../header/tc_handler.h \ | |
54 | ../header/grlib_regs.h \ |
|
54 | ../header/grlib_regs.h \ | |
55 | ../header/fsw_processing.h \ |
|
55 | ../header/fsw_processing.h \ | |
56 | ../header/fsw_params.h \ |
|
56 | ../header/fsw_params.h \ | |
57 | ../header/fsw_misc.h \ |
|
57 | ../header/fsw_misc.h \ | |
58 | ../header/fsw_init.h \ |
|
58 | ../header/fsw_init.h \ | |
59 | ../header/ccsds_types.h \ |
|
59 | ../header/ccsds_types.h \ | |
60 | ../header/fsw_params_processing.h \ |
|
60 | ../header/fsw_params_processing.h \ | |
61 | ../header/fsw_spacewire.h |
|
61 | ../header/fsw_spacewire.h \ | |
|
62 | ../header/tm_byte_positions.h | |||
62 |
|
63 |
@@ -1,508 +1,633 | |||||
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 0x1e // 0001 1110 |
|
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_BURST 0x0ccc // PID 76 CAT 12 |
|
24 | #define TM_PACKET_ID_SCIENCE_NORMAL_BURST 0x0ccc // PID 76 CAT 12 | |
25 | #define TM_PACKET_ID_SCIENCE_SBM1_SBM2 0x0cfc // PID 79 CAT 12 |
|
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_SUCCESS_str | |||
|
239 | { | |||
|
240 | volatile unsigned char targetLogicalAddress; | |||
|
241 | volatile unsigned char protocolIdentifier; | |||
|
242 | volatile unsigned char reserved; | |||
|
243 | volatile unsigned char userApplication; | |||
|
244 | // PACKET HEADER | |||
|
245 | volatile unsigned char packetID[2]; | |||
|
246 | volatile unsigned char packetSequenceControl[2]; | |||
|
247 | volatile unsigned char packetLength[2]; | |||
|
248 | // DATA FIELD HEADER | |||
|
249 | volatile unsigned char spare1_pusVersion_spare2; | |||
|
250 | volatile unsigned char serviceType; | |||
|
251 | volatile unsigned char serviceSubType; | |||
|
252 | volatile unsigned char destinationID; | |||
|
253 | volatile unsigned char time[6]; | |||
|
254 | // | |||
|
255 | volatile unsigned char telecommand_pkt_id[2]; | |||
|
256 | volatile unsigned char pkt_seq_control[2]; | |||
|
257 | }; | |||
|
258 | typedef struct Packet_TM_LFR_TC_EXE_SUCCESS_str Packet_TM_LFR_TC_EXE_SUCCESS_t; | |||
|
259 | ||||
|
260 | struct Packet_TM_LFR_TC_EXE_INCONSISTENT_str | |||
|
261 | { | |||
|
262 | volatile unsigned char targetLogicalAddress; | |||
|
263 | volatile unsigned char protocolIdentifier; | |||
|
264 | volatile unsigned char reserved; | |||
|
265 | volatile unsigned char userApplication; | |||
|
266 | // PACKET HEADER | |||
|
267 | volatile unsigned char packetID[2]; | |||
|
268 | volatile unsigned char packetSequenceControl[2]; | |||
|
269 | volatile unsigned char packetLength[2]; | |||
|
270 | // DATA FIELD HEADER | |||
|
271 | volatile unsigned char spare1_pusVersion_spare2; | |||
|
272 | volatile unsigned char serviceType; | |||
|
273 | volatile unsigned char serviceSubType; | |||
|
274 | volatile unsigned char destinationID; | |||
|
275 | volatile unsigned char time[6]; | |||
|
276 | // | |||
|
277 | volatile unsigned char tc_failure_code[2]; | |||
|
278 | volatile unsigned char telecommand_pkt_id[2]; | |||
|
279 | volatile unsigned char pkt_seq_control[2]; | |||
|
280 | volatile unsigned char tc_service; | |||
|
281 | volatile unsigned char tc_subtype; | |||
|
282 | volatile unsigned char byte_position; | |||
|
283 | volatile unsigned char rcv_value; | |||
|
284 | }; | |||
|
285 | typedef struct Packet_TM_LFR_TC_EXE_INCONSISTENT_str Packet_TM_LFR_TC_EXE_INCONSISTENT_t; | |||
|
286 | ||||
|
287 | struct Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_str | |||
|
288 | { | |||
|
289 | volatile unsigned char targetLogicalAddress; | |||
|
290 | volatile unsigned char protocolIdentifier; | |||
|
291 | volatile unsigned char reserved; | |||
|
292 | volatile unsigned char userApplication; | |||
|
293 | // PACKET HEADER | |||
|
294 | volatile unsigned char packetID[2]; | |||
|
295 | volatile unsigned char packetSequenceControl[2]; | |||
|
296 | volatile unsigned char packetLength[2]; | |||
|
297 | // DATA FIELD HEADER | |||
|
298 | volatile unsigned char spare1_pusVersion_spare2; | |||
|
299 | volatile unsigned char serviceType; | |||
|
300 | volatile unsigned char serviceSubType; | |||
|
301 | volatile unsigned char destinationID; | |||
|
302 | volatile unsigned char time[6]; | |||
|
303 | // | |||
|
304 | volatile unsigned char tc_failure_code[2]; | |||
|
305 | volatile unsigned char telecommand_pkt_id[2]; | |||
|
306 | volatile unsigned char pkt_seq_control[2]; | |||
|
307 | volatile unsigned char tc_service; | |||
|
308 | volatile unsigned char tc_subtype; | |||
|
309 | volatile unsigned char lfr_status_word[2]; | |||
|
310 | }; | |||
|
311 | typedef struct Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_str Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t; | |||
|
312 | ||||
|
313 | struct Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_str | |||
|
314 | { | |||
|
315 | volatile unsigned char targetLogicalAddress; | |||
|
316 | volatile unsigned char protocolIdentifier; | |||
|
317 | volatile unsigned char reserved; | |||
|
318 | volatile unsigned char userApplication; | |||
|
319 | // PACKET HEADER | |||
|
320 | volatile unsigned char packetID[2]; | |||
|
321 | volatile unsigned char packetSequenceControl[2]; | |||
|
322 | volatile unsigned char packetLength[2]; | |||
|
323 | // DATA FIELD HEADER | |||
|
324 | volatile unsigned char spare1_pusVersion_spare2; | |||
|
325 | volatile unsigned char serviceType; | |||
|
326 | volatile unsigned char serviceSubType; | |||
|
327 | volatile unsigned char destinationID; | |||
|
328 | volatile unsigned char time[6]; | |||
|
329 | // | |||
|
330 | volatile unsigned char tc_failure_code[2]; | |||
|
331 | volatile unsigned char telecommand_pkt_id[2]; | |||
|
332 | volatile unsigned char pkt_seq_control[2]; | |||
|
333 | volatile unsigned char tc_service; | |||
|
334 | volatile unsigned char tc_subtype; | |||
|
335 | }; | |||
|
336 | typedef struct Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_str Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t; | |||
|
337 | ||||
|
338 | struct Packet_TM_LFR_TC_EXE_ERROR_str | |||
|
339 | { | |||
|
340 | volatile unsigned char targetLogicalAddress; | |||
|
341 | volatile unsigned char protocolIdentifier; | |||
|
342 | volatile unsigned char reserved; | |||
|
343 | volatile unsigned char userApplication; | |||
|
344 | // PACKET HEADER | |||
|
345 | volatile unsigned char packetID[2]; | |||
|
346 | volatile unsigned char packetSequenceControl[2]; | |||
|
347 | volatile unsigned char packetLength[2]; | |||
|
348 | // DATA FIELD HEADER | |||
|
349 | volatile unsigned char spare1_pusVersion_spare2; | |||
|
350 | volatile unsigned char serviceType; | |||
|
351 | volatile unsigned char serviceSubType; | |||
|
352 | volatile unsigned char destinationID; | |||
|
353 | volatile unsigned char time[6]; | |||
|
354 | // | |||
|
355 | volatile unsigned char tc_failure_code[2]; | |||
|
356 | volatile unsigned char telecommand_pkt_id[2]; | |||
|
357 | volatile unsigned char pkt_seq_control[2]; | |||
|
358 | volatile unsigned char tc_service; | |||
|
359 | volatile unsigned char tc_subtype; | |||
|
360 | }; | |||
|
361 | typedef struct Packet_TM_LFR_TC_EXE_ERROR_str Packet_TM_LFR_TC_EXE_ERROR_t; | |||
|
362 | ||||
238 | struct Packet_TM_LFR_TC_EXE_CORRUPTED_str |
|
363 | struct Packet_TM_LFR_TC_EXE_CORRUPTED_str | |
239 | { |
|
364 | { | |
240 | volatile unsigned char targetLogicalAddress; |
|
365 | volatile unsigned char targetLogicalAddress; | |
241 | volatile unsigned char protocolIdentifier; |
|
366 | volatile unsigned char protocolIdentifier; | |
242 | volatile unsigned char reserved; |
|
367 | volatile unsigned char reserved; | |
243 | volatile unsigned char userApplication; |
|
368 | volatile unsigned char userApplication; | |
244 | // PACKET HEADER |
|
369 | // PACKET HEADER | |
245 | volatile unsigned char packetID[2]; |
|
370 | volatile unsigned char packetID[2]; | |
246 | volatile unsigned char packetSequenceControl[2]; |
|
371 | volatile unsigned char packetSequenceControl[2]; | |
247 | volatile unsigned char packetLength[2]; |
|
372 | volatile unsigned char packetLength[2]; | |
248 | // DATA FIELD HEADER |
|
373 | // DATA FIELD HEADER | |
249 | volatile unsigned char spare1_pusVersion_spare2; |
|
374 | volatile unsigned char spare1_pusVersion_spare2; | |
250 | volatile unsigned char serviceType; |
|
375 | volatile unsigned char serviceType; | |
251 | volatile unsigned char serviceSubType; |
|
376 | volatile unsigned char serviceSubType; | |
252 | volatile unsigned char destinationID; |
|
377 | volatile unsigned char destinationID; | |
253 | volatile unsigned char time[6]; |
|
378 | volatile unsigned char time[6]; | |
254 | // |
|
379 | // | |
255 | volatile unsigned char tc_failure_code[2]; |
|
380 | volatile unsigned char tc_failure_code[2]; | |
256 | volatile unsigned char telecommand_pkt_id[2]; |
|
381 | volatile unsigned char telecommand_pkt_id[2]; | |
257 | volatile unsigned char pkt_seq_control[2]; |
|
382 | volatile unsigned char pkt_seq_control[2]; | |
258 | volatile unsigned char tc_service; |
|
383 | volatile unsigned char tc_service; | |
259 | volatile unsigned char tc_subtype; |
|
384 | volatile unsigned char tc_subtype; | |
260 | volatile unsigned char pkt_len_rcv_value[2]; |
|
385 | volatile unsigned char pkt_len_rcv_value[2]; | |
261 | volatile unsigned char pkt_datafieldsize_cnt[2]; |
|
386 | volatile unsigned char pkt_datafieldsize_cnt[2]; | |
262 | volatile unsigned char rcv_crc[2]; |
|
387 | volatile unsigned char rcv_crc[2]; | |
263 | volatile unsigned char computed_crc[2]; |
|
388 | volatile unsigned char computed_crc[2]; | |
264 | }; |
|
389 | }; | |
265 | typedef struct Packet_TM_LFR_TC_EXE_CORRUPTED_str Packet_TM_LFR_TC_EXE_CORRUPTED_t; |
|
390 | typedef struct Packet_TM_LFR_TC_EXE_CORRUPTED_str Packet_TM_LFR_TC_EXE_CORRUPTED_t; | |
266 |
|
391 | |||
267 | struct Header_TM_LFR_SCIENCE_SWF_str |
|
392 | struct Header_TM_LFR_SCIENCE_SWF_str | |
268 | { |
|
393 | { | |
269 | volatile unsigned char targetLogicalAddress; |
|
394 | volatile unsigned char targetLogicalAddress; | |
270 | volatile unsigned char protocolIdentifier; |
|
395 | volatile unsigned char protocolIdentifier; | |
271 | volatile unsigned char reserved; |
|
396 | volatile unsigned char reserved; | |
272 | volatile unsigned char userApplication; |
|
397 | volatile unsigned char userApplication; | |
273 | volatile unsigned char packetID[2]; |
|
398 | volatile unsigned char packetID[2]; | |
274 | volatile unsigned char packetSequenceControl[2]; |
|
399 | volatile unsigned char packetSequenceControl[2]; | |
275 | volatile unsigned char packetLength[2]; |
|
400 | volatile unsigned char packetLength[2]; | |
276 | // DATA FIELD HEADER |
|
401 | // DATA FIELD HEADER | |
277 | volatile unsigned char spare1_pusVersion_spare2; |
|
402 | volatile unsigned char spare1_pusVersion_spare2; | |
278 | volatile unsigned char serviceType; |
|
403 | volatile unsigned char serviceType; | |
279 | volatile unsigned char serviceSubType; |
|
404 | volatile unsigned char serviceSubType; | |
280 | volatile unsigned char destinationID; |
|
405 | volatile unsigned char destinationID; | |
281 | volatile unsigned char time[6]; |
|
406 | volatile unsigned char time[6]; | |
282 | // AUXILIARY HEADER |
|
407 | // AUXILIARY HEADER | |
283 | volatile unsigned char sid; |
|
408 | volatile unsigned char sid; | |
284 | volatile unsigned char hkBIA; |
|
409 | volatile unsigned char hkBIA; | |
285 | volatile unsigned char pktCnt; |
|
410 | volatile unsigned char pktCnt; | |
286 | volatile unsigned char pktNr; |
|
411 | volatile unsigned char pktNr; | |
287 | volatile unsigned char acquisitionTime[6]; |
|
412 | volatile unsigned char acquisitionTime[6]; | |
288 | volatile unsigned char blkNr[2]; |
|
413 | volatile unsigned char blkNr[2]; | |
289 | }; |
|
414 | }; | |
290 | typedef struct Header_TM_LFR_SCIENCE_SWF_str Header_TM_LFR_SCIENCE_SWF_t; |
|
415 | typedef struct Header_TM_LFR_SCIENCE_SWF_str Header_TM_LFR_SCIENCE_SWF_t; | |
291 |
|
416 | |||
292 | struct Header_TM_LFR_SCIENCE_CWF_str |
|
417 | struct Header_TM_LFR_SCIENCE_CWF_str | |
293 | { |
|
418 | { | |
294 | volatile unsigned char targetLogicalAddress; |
|
419 | volatile unsigned char targetLogicalAddress; | |
295 | volatile unsigned char protocolIdentifier; |
|
420 | volatile unsigned char protocolIdentifier; | |
296 | volatile unsigned char reserved; |
|
421 | volatile unsigned char reserved; | |
297 | volatile unsigned char userApplication; |
|
422 | volatile unsigned char userApplication; | |
298 | volatile unsigned char packetID[2]; |
|
423 | volatile unsigned char packetID[2]; | |
299 | volatile unsigned char packetSequenceControl[2]; |
|
424 | volatile unsigned char packetSequenceControl[2]; | |
300 | volatile unsigned char packetLength[2]; |
|
425 | volatile unsigned char packetLength[2]; | |
301 | // DATA FIELD HEADER |
|
426 | // DATA FIELD HEADER | |
302 | volatile unsigned char spare1_pusVersion_spare2; |
|
427 | volatile unsigned char spare1_pusVersion_spare2; | |
303 | volatile unsigned char serviceType; |
|
428 | volatile unsigned char serviceType; | |
304 | volatile unsigned char serviceSubType; |
|
429 | volatile unsigned char serviceSubType; | |
305 | volatile unsigned char destinationID; |
|
430 | volatile unsigned char destinationID; | |
306 | volatile unsigned char time[6]; |
|
431 | volatile unsigned char time[6]; | |
307 | // AUXILIARY DATA HEADER |
|
432 | // AUXILIARY DATA HEADER | |
308 | volatile unsigned char sid; |
|
433 | volatile unsigned char sid; | |
309 | volatile unsigned char hkBIA; |
|
434 | volatile unsigned char hkBIA; | |
310 | volatile unsigned char acquisitionTime[6]; |
|
435 | volatile unsigned char acquisitionTime[6]; | |
311 | volatile unsigned char blkNr[2]; |
|
436 | volatile unsigned char blkNr[2]; | |
312 | }; |
|
437 | }; | |
313 | typedef struct Header_TM_LFR_SCIENCE_CWF_str Header_TM_LFR_SCIENCE_CWF_t; |
|
438 | typedef struct Header_TM_LFR_SCIENCE_CWF_str Header_TM_LFR_SCIENCE_CWF_t; | |
314 |
|
439 | |||
315 | struct Header_TM_LFR_SCIENCE_ASM_str |
|
440 | struct Header_TM_LFR_SCIENCE_ASM_str | |
316 | { |
|
441 | { | |
317 | volatile unsigned char targetLogicalAddress; |
|
442 | volatile unsigned char targetLogicalAddress; | |
318 | volatile unsigned char protocolIdentifier; |
|
443 | volatile unsigned char protocolIdentifier; | |
319 | volatile unsigned char reserved; |
|
444 | volatile unsigned char reserved; | |
320 | volatile unsigned char userApplication; |
|
445 | volatile unsigned char userApplication; | |
321 | volatile unsigned char packetID[2]; |
|
446 | volatile unsigned char packetID[2]; | |
322 | volatile unsigned char packetSequenceControl[2]; |
|
447 | volatile unsigned char packetSequenceControl[2]; | |
323 | volatile unsigned char packetLength[2]; |
|
448 | volatile unsigned char packetLength[2]; | |
324 | // DATA FIELD HEADER |
|
449 | // DATA FIELD HEADER | |
325 | volatile unsigned char spare1_pusVersion_spare2; |
|
450 | volatile unsigned char spare1_pusVersion_spare2; | |
326 | volatile unsigned char serviceType; |
|
451 | volatile unsigned char serviceType; | |
327 | volatile unsigned char serviceSubType; |
|
452 | volatile unsigned char serviceSubType; | |
328 | volatile unsigned char destinationID; |
|
453 | volatile unsigned char destinationID; | |
329 | volatile unsigned char time[6]; |
|
454 | volatile unsigned char time[6]; | |
330 | // AUXILIARY HEADER |
|
455 | // AUXILIARY HEADER | |
331 | volatile unsigned char sid; |
|
456 | volatile unsigned char sid; | |
332 | volatile unsigned char biaStatusInfo; |
|
457 | volatile unsigned char biaStatusInfo; | |
333 | volatile unsigned char cntASM; |
|
458 | volatile unsigned char cntASM; | |
334 | volatile unsigned char nrASM; |
|
459 | volatile unsigned char nrASM; | |
335 | volatile unsigned char acquisitionTime[6]; |
|
460 | volatile unsigned char acquisitionTime[6]; | |
336 | volatile unsigned char blkNr[2]; |
|
461 | volatile unsigned char blkNr[2]; | |
337 | }; |
|
462 | }; | |
338 | typedef struct Header_TM_LFR_SCIENCE_ASM_str Header_TM_LFR_SCIENCE_ASM_t; |
|
463 | typedef struct Header_TM_LFR_SCIENCE_ASM_str Header_TM_LFR_SCIENCE_ASM_t; | |
339 |
|
464 | |||
340 | struct ccsdsTelecommandPacket_str |
|
465 | struct ccsdsTelecommandPacket_str | |
341 | { |
|
466 | { | |
342 | //unsigned char targetLogicalAddress; // removed by the grspw module |
|
467 | //unsigned char targetLogicalAddress; // removed by the grspw module | |
343 | volatile unsigned char protocolIdentifier; |
|
468 | volatile unsigned char protocolIdentifier; | |
344 | volatile unsigned char reserved; |
|
469 | volatile unsigned char reserved; | |
345 | volatile unsigned char userApplication; |
|
470 | volatile unsigned char userApplication; | |
346 | volatile unsigned char packetID[2]; |
|
471 | volatile unsigned char packetID[2]; | |
347 | volatile unsigned char packetSequenceControl[2]; |
|
472 | volatile unsigned char packetSequenceControl[2]; | |
348 | volatile unsigned char packetLength[2]; |
|
473 | volatile unsigned char packetLength[2]; | |
349 | // DATA FIELD HEADER |
|
474 | // DATA FIELD HEADER | |
350 | volatile unsigned char headerFlag_pusVersion_Ack; |
|
475 | volatile unsigned char headerFlag_pusVersion_Ack; | |
351 | volatile unsigned char serviceType; |
|
476 | volatile unsigned char serviceType; | |
352 | volatile unsigned char serviceSubType; |
|
477 | volatile unsigned char serviceSubType; | |
353 | volatile unsigned char sourceID; |
|
478 | volatile unsigned char sourceID; | |
354 | volatile unsigned char dataAndCRC[CCSDS_TC_PKT_MAX_SIZE-10]; |
|
479 | volatile unsigned char dataAndCRC[CCSDS_TC_PKT_MAX_SIZE-10]; | |
355 | }; |
|
480 | }; | |
356 | typedef struct ccsdsTelecommandPacket_str ccsdsTelecommandPacket_t; |
|
481 | typedef struct ccsdsTelecommandPacket_str ccsdsTelecommandPacket_t; | |
357 |
|
482 | |||
358 | struct Packet_TM_LFR_HK_str |
|
483 | struct Packet_TM_LFR_HK_str | |
359 | { |
|
484 | { | |
360 | volatile unsigned char targetLogicalAddress; |
|
485 | volatile unsigned char targetLogicalAddress; | |
361 | volatile unsigned char protocolIdentifier; |
|
486 | volatile unsigned char protocolIdentifier; | |
362 | volatile unsigned char reserved; |
|
487 | volatile unsigned char reserved; | |
363 | volatile unsigned char userApplication; |
|
488 | volatile unsigned char userApplication; | |
364 | volatile unsigned char packetID[2]; |
|
489 | volatile unsigned char packetID[2]; | |
365 | volatile unsigned char packetSequenceControl[2]; |
|
490 | volatile unsigned char packetSequenceControl[2]; | |
366 | volatile unsigned char packetLength[2]; |
|
491 | volatile unsigned char packetLength[2]; | |
367 | volatile unsigned char spare1_pusVersion_spare2; |
|
492 | volatile unsigned char spare1_pusVersion_spare2; | |
368 | volatile unsigned char serviceType; |
|
493 | volatile unsigned char serviceType; | |
369 | volatile unsigned char serviceSubType; |
|
494 | volatile unsigned char serviceSubType; | |
370 | volatile unsigned char destinationID; |
|
495 | volatile unsigned char destinationID; | |
371 | volatile unsigned char time[6]; |
|
496 | volatile unsigned char time[6]; | |
372 | volatile unsigned char sid; |
|
497 | volatile unsigned char sid; | |
373 |
|
498 | |||
374 | //************** |
|
499 | //************** | |
375 | // HK PARAMETERS |
|
500 | // HK PARAMETERS | |
376 | unsigned char lfr_status_word[2]; |
|
501 | unsigned char lfr_status_word[2]; | |
377 | unsigned char lfr_sw_version[4]; |
|
502 | unsigned char lfr_sw_version[4]; | |
378 | // tc statistics |
|
503 | // tc statistics | |
379 | unsigned char hk_lfr_update_info_tc_cnt[2]; |
|
504 | unsigned char hk_lfr_update_info_tc_cnt[2]; | |
380 | unsigned char hk_lfr_update_time_tc_cnt[2]; |
|
505 | unsigned char hk_lfr_update_time_tc_cnt[2]; | |
381 | unsigned char hk_dpu_exe_tc_lfr_cnt[2]; |
|
506 | unsigned char hk_dpu_exe_tc_lfr_cnt[2]; | |
382 | unsigned char hk_dpu_rej_tc_lfr_cnt[2]; |
|
507 | unsigned char hk_dpu_rej_tc_lfr_cnt[2]; | |
383 | unsigned char hk_lfr_last_exe_tc_id[2]; |
|
508 | unsigned char hk_lfr_last_exe_tc_id[2]; | |
384 | unsigned char hk_lfr_last_exe_tc_type[2]; |
|
509 | unsigned char hk_lfr_last_exe_tc_type[2]; | |
385 | unsigned char hk_lfr_last_exe_tc_subtype[2]; |
|
510 | unsigned char hk_lfr_last_exe_tc_subtype[2]; | |
386 | unsigned char hk_lfr_last_exe_tc_time[6]; |
|
511 | unsigned char hk_lfr_last_exe_tc_time[6]; | |
387 | unsigned char hk_lfr_last_rej_tc_id[2]; |
|
512 | unsigned char hk_lfr_last_rej_tc_id[2]; | |
388 | unsigned char hk_lfr_last_rej_tc_type[2]; |
|
513 | unsigned char hk_lfr_last_rej_tc_type[2]; | |
389 | unsigned char hk_lfr_last_rej_tc_subtype[2]; |
|
514 | unsigned char hk_lfr_last_rej_tc_subtype[2]; | |
390 | unsigned char hk_lfr_last_rej_tc_time[6]; |
|
515 | unsigned char hk_lfr_last_rej_tc_time[6]; | |
391 | // anomaly statistics |
|
516 | // anomaly statistics | |
392 | unsigned char hk_lfr_le_cnt[2]; |
|
517 | unsigned char hk_lfr_le_cnt[2]; | |
393 | unsigned char hk_lfr_me_cnt[2]; |
|
518 | unsigned char hk_lfr_me_cnt[2]; | |
394 | unsigned char hk_lfr_he_cnt[2]; |
|
519 | unsigned char hk_lfr_he_cnt[2]; | |
395 | unsigned char hk_lfr_last_er_rid[2]; |
|
520 | unsigned char hk_lfr_last_er_rid[2]; | |
396 | unsigned char hk_lfr_last_er_code; |
|
521 | unsigned char hk_lfr_last_er_code; | |
397 | unsigned char hk_lfr_last_er_time[6]; |
|
522 | unsigned char hk_lfr_last_er_time[6]; | |
398 | // vhdl_blk_status |
|
523 | // vhdl_blk_status | |
399 | unsigned char hk_lfr_vhdl_aa_sm; |
|
524 | unsigned char hk_lfr_vhdl_aa_sm; | |
400 | unsigned char hk_lfr_vhdl_fft_sr; |
|
525 | unsigned char hk_lfr_vhdl_fft_sr; | |
401 | unsigned char hk_lfr_vhdl_cic_hk; |
|
526 | unsigned char hk_lfr_vhdl_cic_hk; | |
402 | unsigned char hk_lfr_vhdl_iir_cal; |
|
527 | unsigned char hk_lfr_vhdl_iir_cal; | |
403 | // spacewire_if_statistics |
|
528 | // spacewire_if_statistics | |
404 | unsigned char hk_lfr_dpu_spw_pkt_rcv_cnt[2]; |
|
529 | unsigned char hk_lfr_dpu_spw_pkt_rcv_cnt[2]; | |
405 | unsigned char hk_lfr_dpu_spw_pkt_sent_cnt[2]; |
|
530 | unsigned char hk_lfr_dpu_spw_pkt_sent_cnt[2]; | |
406 | unsigned char hk_lfr_dpu_spw_tick_out_cnt; |
|
531 | unsigned char hk_lfr_dpu_spw_tick_out_cnt; | |
407 | unsigned char hk_lfr_dpu_spw_last_timc; |
|
532 | unsigned char hk_lfr_dpu_spw_last_timc; | |
408 | // ahb error statistics |
|
533 | // ahb error statistics | |
409 | unsigned int hk_lfr_last_fail_addr; |
|
534 | unsigned int hk_lfr_last_fail_addr; | |
410 | // temperatures |
|
535 | // temperatures | |
411 | unsigned char hk_lfr_temp_scm[2]; |
|
536 | unsigned char hk_lfr_temp_scm[2]; | |
412 | unsigned char hk_lfr_temp_pcb[2]; |
|
537 | unsigned char hk_lfr_temp_pcb[2]; | |
413 | unsigned char hk_lfr_temp_fpga[2]; |
|
538 | unsigned char hk_lfr_temp_fpga[2]; | |
414 | // error counters |
|
539 | // error counters | |
415 | unsigned char hk_lfr_dpu_spw_parity; |
|
540 | unsigned char hk_lfr_dpu_spw_parity; | |
416 | unsigned char hk_lfr_dpu_spw_disconnect; |
|
541 | unsigned char hk_lfr_dpu_spw_disconnect; | |
417 | unsigned char hk_lfr_dpu_spw_escape; |
|
542 | unsigned char hk_lfr_dpu_spw_escape; | |
418 | unsigned char hk_lfr_dpu_spw_credit; |
|
543 | unsigned char hk_lfr_dpu_spw_credit; | |
419 | unsigned char hk_lfr_dpu_spw_write_sync; |
|
544 | unsigned char hk_lfr_dpu_spw_write_sync; | |
420 | unsigned char hk_lfr_dpu_spw_rx_ahb; |
|
545 | unsigned char hk_lfr_dpu_spw_rx_ahb; | |
421 | unsigned char hk_lfr_dpu_spw_tx_ahb; |
|
546 | unsigned char hk_lfr_dpu_spw_tx_ahb; | |
422 | unsigned char hk_lfr_dpu_spw_header_crc; |
|
547 | unsigned char hk_lfr_dpu_spw_header_crc; | |
423 | unsigned char hk_lfr_dpu_spw_data_crc; |
|
548 | unsigned char hk_lfr_dpu_spw_data_crc; | |
424 | unsigned char hk_lfr_dpu_spw_early_eop; |
|
549 | unsigned char hk_lfr_dpu_spw_early_eop; | |
425 | unsigned char hk_lfr_dpu_spw_invalid_addr; |
|
550 | unsigned char hk_lfr_dpu_spw_invalid_addr; | |
426 | unsigned char hk_lfr_dpu_spw_eep; |
|
551 | unsigned char hk_lfr_dpu_spw_eep; | |
427 | unsigned char hk_lfr_dpu_spw_rx_too_big; |
|
552 | unsigned char hk_lfr_dpu_spw_rx_too_big; | |
428 | // timecode |
|
553 | // timecode | |
429 | unsigned char hk_lfr_timecode_erroneous; |
|
554 | unsigned char hk_lfr_timecode_erroneous; | |
430 | unsigned char hk_lfr_timecode_missing; |
|
555 | unsigned char hk_lfr_timecode_missing; | |
431 | unsigned char hk_lfr_timecode_invalid; |
|
556 | unsigned char hk_lfr_timecode_invalid; | |
432 | // time |
|
557 | // time | |
433 | unsigned char hk_lfr_time_timecode_it; |
|
558 | unsigned char hk_lfr_time_timecode_it; | |
434 | unsigned char hk_lfr_time_not_synchro; |
|
559 | unsigned char hk_lfr_time_not_synchro; | |
435 | unsigned char hk_lfr_time_timecode_ctr; |
|
560 | unsigned char hk_lfr_time_timecode_ctr; | |
436 | // hk_lfr_buffer_dpu_ |
|
561 | // hk_lfr_buffer_dpu_ | |
437 | unsigned char hk_lfr_buffer_dpu_tc_fifo; |
|
562 | unsigned char hk_lfr_buffer_dpu_tc_fifo; | |
438 | unsigned char hk_lfr_buffer_dpu_tm_fifo; |
|
563 | unsigned char hk_lfr_buffer_dpu_tm_fifo; | |
439 | // hk_lfr_ahb_ |
|
564 | // hk_lfr_ahb_ | |
440 | unsigned char hk_lfr_ahb_correctable; |
|
565 | unsigned char hk_lfr_ahb_correctable; | |
441 | unsigned char hk_lfr_ahb_uncorrectable; |
|
566 | unsigned char hk_lfr_ahb_uncorrectable; | |
442 | unsigned char hk_lfr_ahb_fails_trans; |
|
567 | unsigned char hk_lfr_ahb_fails_trans; | |
443 | // hk_lfr_adc_ |
|
568 | // hk_lfr_adc_ | |
444 | unsigned char hk_lfr_adc_failure; |
|
569 | unsigned char hk_lfr_adc_failure; | |
445 | unsigned char hk_lfr_adc_timeout; |
|
570 | unsigned char hk_lfr_adc_timeout; | |
446 | unsigned char hk_lfr_toomany_err; |
|
571 | unsigned char hk_lfr_toomany_err; | |
447 | // hk_lfr_cpu_ |
|
572 | // hk_lfr_cpu_ | |
448 | unsigned char hk_lfr_cpu_write_err; |
|
573 | unsigned char hk_lfr_cpu_write_err; | |
449 | unsigned char hk_lfr_cpu_ins_access_err; |
|
574 | unsigned char hk_lfr_cpu_ins_access_err; | |
450 | unsigned char hk_lfr_cpu_illegal_ins; |
|
575 | unsigned char hk_lfr_cpu_illegal_ins; | |
451 | unsigned char hk_lfr_cpu_privilegied_ins; |
|
576 | unsigned char hk_lfr_cpu_privilegied_ins; | |
452 | unsigned char hk_lfr_cpu_register_hw; |
|
577 | unsigned char hk_lfr_cpu_register_hw; | |
453 | unsigned char hk_lfr_cpu_not_aligned; |
|
578 | unsigned char hk_lfr_cpu_not_aligned; | |
454 | unsigned char hk_lfr_cpu_data_exception; |
|
579 | unsigned char hk_lfr_cpu_data_exception; | |
455 | unsigned char hk_lfr_cpu_div_exception; |
|
580 | unsigned char hk_lfr_cpu_div_exception; | |
456 | unsigned char hk_lfr_cpu_arith_overflow; |
|
581 | unsigned char hk_lfr_cpu_arith_overflow; | |
457 | }; |
|
582 | }; | |
458 | typedef struct Packet_TM_LFR_HK_str Packet_TM_LFR_HK_t; |
|
583 | typedef struct Packet_TM_LFR_HK_str Packet_TM_LFR_HK_t; | |
459 |
|
584 | |||
460 | struct Packet_TM_LFR_PARAMETER_DUMP_str |
|
585 | struct Packet_TM_LFR_PARAMETER_DUMP_str | |
461 | { |
|
586 | { | |
462 | volatile unsigned char targetLogicalAddress; |
|
587 | volatile unsigned char targetLogicalAddress; | |
463 | volatile unsigned char protocolIdentifier; |
|
588 | volatile unsigned char protocolIdentifier; | |
464 | volatile unsigned char reserved; |
|
589 | volatile unsigned char reserved; | |
465 | volatile unsigned char userApplication; |
|
590 | volatile unsigned char userApplication; | |
466 | volatile unsigned char packetID[2]; |
|
591 | volatile unsigned char packetID[2]; | |
467 | volatile unsigned char packetSequenceControl[2]; |
|
592 | volatile unsigned char packetSequenceControl[2]; | |
468 | volatile unsigned char packetLength[2]; |
|
593 | volatile unsigned char packetLength[2]; | |
469 | // DATA FIELD HEADER |
|
594 | // DATA FIELD HEADER | |
470 | volatile unsigned char spare1_pusVersion_spare2; |
|
595 | volatile unsigned char spare1_pusVersion_spare2; | |
471 | volatile unsigned char serviceType; |
|
596 | volatile unsigned char serviceType; | |
472 | volatile unsigned char serviceSubType; |
|
597 | volatile unsigned char serviceSubType; | |
473 | volatile unsigned char destinationID; |
|
598 | volatile unsigned char destinationID; | |
474 | volatile unsigned char time[6]; |
|
599 | volatile unsigned char time[6]; | |
475 | volatile unsigned char sid; |
|
600 | volatile unsigned char sid; | |
476 |
|
601 | |||
477 | //****************** |
|
602 | //****************** | |
478 | // COMMON PARAMETERS |
|
603 | // COMMON PARAMETERS | |
479 | volatile unsigned char unused0; |
|
604 | volatile unsigned char unused0; | |
480 | volatile unsigned char bw_sp0_sp1_r0_r1; |
|
605 | volatile unsigned char bw_sp0_sp1_r0_r1; | |
481 |
|
606 | |||
482 | //****************** |
|
607 | //****************** | |
483 | // NORMAL PARAMETERS |
|
608 | // NORMAL PARAMETERS | |
484 | volatile unsigned char sy_lfr_n_swf_l[2]; |
|
609 | volatile unsigned char sy_lfr_n_swf_l[2]; | |
485 | volatile unsigned char sy_lfr_n_swf_p[2]; |
|
610 | volatile unsigned char sy_lfr_n_swf_p[2]; | |
486 | volatile unsigned char sy_lfr_n_asm_p[2]; |
|
611 | volatile unsigned char sy_lfr_n_asm_p[2]; | |
487 | volatile unsigned char sy_lfr_n_bp_p0; |
|
612 | volatile unsigned char sy_lfr_n_bp_p0; | |
488 | volatile unsigned char sy_lfr_n_bp_p1; |
|
613 | volatile unsigned char sy_lfr_n_bp_p1; | |
489 |
|
614 | |||
490 | //***************** |
|
615 | //***************** | |
491 | // BURST PARAMETERS |
|
616 | // BURST PARAMETERS | |
492 | volatile unsigned char sy_lfr_b_bp_p0; |
|
617 | volatile unsigned char sy_lfr_b_bp_p0; | |
493 | volatile unsigned char sy_lfr_b_bp_p1; |
|
618 | volatile unsigned char sy_lfr_b_bp_p1; | |
494 |
|
619 | |||
495 | //**************** |
|
620 | //**************** | |
496 | // SBM1 PARAMETERS |
|
621 | // SBM1 PARAMETERS | |
497 | volatile unsigned char sy_lfr_s1_bp_p0; |
|
622 | volatile unsigned char sy_lfr_s1_bp_p0; | |
498 | volatile unsigned char sy_lfr_s1_bp_p1; |
|
623 | volatile unsigned char sy_lfr_s1_bp_p1; | |
499 |
|
624 | |||
500 | //**************** |
|
625 | //**************** | |
501 | // SBM2 PARAMETERS |
|
626 | // SBM2 PARAMETERS | |
502 | volatile unsigned char sy_lfr_s2_bp_p0; |
|
627 | volatile unsigned char sy_lfr_s2_bp_p0; | |
503 | volatile unsigned char sy_lfr_s2_bp_p1; |
|
628 | volatile unsigned char sy_lfr_s2_bp_p1; | |
504 | }; |
|
629 | }; | |
505 | typedef struct Packet_TM_LFR_PARAMETER_DUMP_str Packet_TM_LFR_PARAMETER_DUMP_t; |
|
630 | typedef struct Packet_TM_LFR_PARAMETER_DUMP_str Packet_TM_LFR_PARAMETER_DUMP_t; | |
506 |
|
631 | |||
507 |
|
632 | |||
508 | #endif // CCSDS_H_INCLUDED |
|
633 | #endif // CCSDS_H_INCLUDED |
@@ -1,59 +1,60 | |||||
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 "tm_byte_positions.h" | |||
14 | #include "fsw_processing.h" |
|
15 | #include "fsw_processing.h" | |
15 | #include "tc_handler.h" |
|
16 | #include "tc_handler.h" | |
16 | #include "wf_handler.h" |
|
17 | #include "wf_handler.h" | |
17 | #include "grlib_regs.h" |
|
18 | #include "grlib_regs.h" | |
18 | #include "ccsds_types.h" |
|
19 | #include "ccsds_types.h" | |
19 |
|
20 | |||
20 | #include "fsw_spacewire.h" |
|
21 | #include "fsw_spacewire.h" | |
21 |
|
22 | |||
22 | extern rtems_name misc_name[5]; |
|
23 | extern rtems_name misc_name[5]; | |
23 | extern rtems_id misc_id[5]; |
|
24 | extern rtems_id misc_id[5]; | |
24 | extern rtems_name Task_name[20]; /* array of task names */ |
|
25 | extern rtems_name Task_name[20]; /* array of task names */ | |
25 | extern rtems_id Task_id[20]; /* array of task ids */ |
|
26 | extern rtems_id Task_id[20]; /* array of task ids */ | |
26 | extern unsigned int maxCount; |
|
27 | extern unsigned int maxCount; | |
27 | extern int fdSPW; // grspw file descriptor |
|
28 | extern int fdSPW; // grspw file descriptor | |
28 | extern int fdUART; // uart file descriptor |
|
29 | extern int fdUART; // uart file descriptor | |
29 | extern unsigned char lfrCurrentMode; |
|
30 | extern unsigned char lfrCurrentMode; | |
30 |
|
31 | |||
31 | // MODE PARAMETERS |
|
32 | // MODE PARAMETERS | |
32 | extern struct param_local_str param_local; |
|
33 | extern struct param_local_str param_local; | |
33 | extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet; |
|
34 | 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]; |
|
35 | extern unsigned short sequenceCounters[SEQ_CNT_NB_PID][SEQ_CNT_NB_CAT][SEQ_CNT_NB_DEST_ID]; | |
35 |
|
36 | |||
36 | // RTEMS TASKS |
|
37 | // RTEMS TASKS | |
37 | rtems_task Init( rtems_task_argument argument); /* forward declaration needed */ |
|
38 | rtems_task Init( rtems_task_argument argument); /* forward declaration needed */ | |
38 | rtems_task recv_task(rtems_task_argument argument); |
|
39 | rtems_task recv_task(rtems_task_argument argument); | |
39 | rtems_task stat_task(rtems_task_argument argument); |
|
40 | rtems_task stat_task(rtems_task_argument argument); | |
40 | rtems_task wfrm_task(rtems_task_argument argument); |
|
41 | rtems_task wfrm_task(rtems_task_argument argument); | |
41 |
|
42 | |||
42 | // OTHER functions |
|
43 | // OTHER functions | |
43 | int create_names( void ); |
|
44 | int create_names( void ); | |
44 | int create_all_tasks( void ); |
|
45 | int create_all_tasks( void ); | |
45 | int start_all_tasks( void ); |
|
46 | int start_all_tasks( void ); | |
46 | rtems_status_code create_message_queues( void ); |
|
47 | rtems_status_code create_message_queues( void ); | |
47 | // |
|
48 | // | |
48 | void init_parameter_dump( void ); |
|
49 | void init_parameter_dump( void ); | |
49 | void init_local_mode_parameters( void ); |
|
50 | void init_local_mode_parameters( void ); | |
50 | void init_housekeeping_parameters( void ); |
|
51 | void init_housekeeping_parameters( void ); | |
51 |
|
52 | |||
52 | extern int rtems_cpu_usage_report( void ); |
|
53 | extern int rtems_cpu_usage_report( void ); | |
53 | extern int rtems_cpu_usage_reset( void ); |
|
54 | extern int rtems_cpu_usage_reset( void ); | |
54 | extern void rtems_stack_checker_report_usage( void ); |
|
55 | extern void rtems_stack_checker_report_usage( void ); | |
55 |
|
56 | |||
56 | extern int sched_yield( void ); |
|
57 | extern int sched_yield( void ); | |
57 | extern int errno; |
|
58 | extern int errno; | |
58 |
|
59 | |||
59 | #endif // FSW_RTEMS_CONFIG_H_INCLUDED |
|
60 | #endif // FSW_RTEMS_CONFIG_H_INCLUDED |
@@ -1,219 +1,221 | |||||
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 |
|
4 | #include "fsw_params_processing.h" | |
|
5 | #include "ccsds_types.h" | |||
5 |
|
6 | |||
6 | #define GRSPW_DEVICE_NAME "/dev/grspw0" |
|
7 | #define GRSPW_DEVICE_NAME "/dev/grspw0" | |
7 | #define UART_DEVICE_NAME "/dev/console" |
|
8 | #define UART_DEVICE_NAME "/dev/console" | |
8 |
|
9 | |||
9 | //************************ |
|
10 | //************************ | |
10 | // flight software version |
|
11 | // flight software version | |
11 | // this parameters is handled by the Qt project options |
|
12 | // this parameters is handled by the Qt project options | |
12 |
|
13 | |||
13 | //********** |
|
14 | //********** | |
14 | // LFR MODES |
|
15 | // LFR MODES | |
15 | #define LFR_MODE_STANDBY 0 |
|
16 | #define LFR_MODE_STANDBY 0 | |
16 | #define LFR_MODE_NORMAL 1 |
|
17 | #define LFR_MODE_NORMAL 1 | |
17 | #define LFR_MODE_BURST 2 |
|
18 | #define LFR_MODE_BURST 2 | |
18 | #define LFR_MODE_SBM1 3 |
|
19 | #define LFR_MODE_SBM1 3 | |
19 | #define LFR_MODE_SBM2 4 |
|
20 | #define LFR_MODE_SBM2 4 | |
20 | #define LFR_MODE_NORMAL_CWF_F3 5 |
|
21 | #define LFR_MODE_NORMAL_CWF_F3 5 | |
21 |
|
22 | |||
22 | #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0 |
|
23 | #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0 | |
23 | #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1 |
|
24 | #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1 | |
24 | #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2 |
|
25 | #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2 | |
25 | #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3 |
|
26 | #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3 | |
26 | #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4 |
|
27 | #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4 | |
27 | #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5 |
|
28 | #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5 | |
28 |
|
29 | |||
29 | //**************************** |
|
30 | //**************************** | |
30 | // LFR DEFAULT MODE PARAMETERS |
|
31 | // LFR DEFAULT MODE PARAMETERS | |
31 | // COMMON |
|
32 | // COMMON | |
32 | #define DEFAULT_SY_LFR_COMMON0 0x00 |
|
33 | #define DEFAULT_SY_LFR_COMMON0 0x00 | |
33 | #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0 |
|
34 | #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0 | |
34 | // NORM |
|
35 | // NORM | |
35 | #define DEFAULT_SY_LFR_N_SWF_L 2048 // nb sample |
|
36 | #define DEFAULT_SY_LFR_N_SWF_L 2048 // nb sample | |
36 | #define DEFAULT_SY_LFR_N_SWF_P 16 // sec |
|
37 | #define DEFAULT_SY_LFR_N_SWF_P 16 // sec | |
37 | #define DEFAULT_SY_LFR_N_ASM_P 16 // sec |
|
38 | #define DEFAULT_SY_LFR_N_ASM_P 16 // sec | |
38 | #define DEFAULT_SY_LFR_N_BP_P0 4 // sec |
|
39 | #define DEFAULT_SY_LFR_N_BP_P0 4 // sec | |
39 | #define DEFAULT_SY_LFR_N_BP_P1 20 // sec |
|
40 | #define DEFAULT_SY_LFR_N_BP_P1 20 // sec | |
40 | #define MIN_DELTA_SNAPSHOT 16 // sec |
|
41 | #define MIN_DELTA_SNAPSHOT 16 // sec | |
41 | // BURST |
|
42 | // BURST | |
42 | #define DEFAULT_SY_LFR_B_BP_P0 1 // sec |
|
43 | #define DEFAULT_SY_LFR_B_BP_P0 1 // sec | |
43 | #define DEFAULT_SY_LFR_B_BP_P1 5 // sec |
|
44 | #define DEFAULT_SY_LFR_B_BP_P1 5 // sec | |
44 | // SBM1 |
|
45 | // SBM1 | |
45 | #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec |
|
46 | #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec | |
46 | #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec |
|
47 | #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec | |
47 | // SBM2 |
|
48 | // SBM2 | |
48 | #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec |
|
49 | #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec | |
49 | #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec |
|
50 | #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec | |
50 | // ADDITIONAL PARAMETERS |
|
51 | // ADDITIONAL PARAMETERS | |
51 | #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms |
|
52 | #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms | |
52 | #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s |
|
53 | #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s | |
53 | // |
|
54 | // | |
54 | //**************************** |
|
55 | //**************************** | |
55 |
|
56 | |||
56 | //***************************** |
|
57 | //***************************** | |
57 | // APB REGISTERS BASE ADDRESSES |
|
58 | // APB REGISTERS BASE ADDRESSES | |
58 | #define REGS_ADDR_APBUART 0x80000100 |
|
59 | #define REGS_ADDR_APBUART 0x80000100 | |
59 | #define REGS_ADDR_GPTIMER 0x80000300 |
|
60 | #define REGS_ADDR_GPTIMER 0x80000300 | |
60 | #define REGS_ADDR_GRSPW 0x80000500 |
|
61 | #define REGS_ADDR_GRSPW 0x80000500 | |
61 | #define REGS_ADDR_TIME_MANAGEMENT 0x80000600 |
|
62 | #define REGS_ADDR_TIME_MANAGEMENT 0x80000600 | |
62 | #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00 |
|
63 | #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00 | |
63 |
|
64 | |||
64 | #ifdef GSA |
|
65 | #ifdef GSA | |
65 | #else |
|
66 | #else | |
66 | #define REGS_ADDR_WAVEFORM_PICKER 0x80000f20 |
|
67 | #define REGS_ADDR_WAVEFORM_PICKER 0x80000f20 | |
67 | #endif |
|
68 | #endif | |
68 |
|
69 | |||
69 | #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff |
|
70 | #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff | |
70 | #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50) |
|
71 | #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50) | |
71 |
|
72 | |||
72 | //********** |
|
73 | //********** | |
73 | // IRQ LINES |
|
74 | // IRQ LINES | |
74 | #define IRQ_SM 9 |
|
75 | #define IRQ_SM 9 | |
75 | #define IRQ_SPARC_SM 0x19 // see sparcv8.pdf p.76 for interrupt levels |
|
76 | #define IRQ_SPARC_SM 0x19 // see sparcv8.pdf p.76 for interrupt levels | |
76 | #define IRQ_WF 10 |
|
77 | #define IRQ_WF 10 | |
77 | #define IRQ_SPARC_WF 0x1a // see sparcv8.pdf p.76 for interrupt levels |
|
78 | #define IRQ_SPARC_WF 0x1a // see sparcv8.pdf p.76 for interrupt levels | |
78 | #define IRQ_TIME1 12 |
|
79 | #define IRQ_TIME1 12 | |
79 | #define IRQ_SPARC_TIME1 0x1c // see sparcv8.pdf p.76 for interrupt levels |
|
80 | #define IRQ_SPARC_TIME1 0x1c // see sparcv8.pdf p.76 for interrupt levels | |
80 | #define IRQ_TIME2 13 |
|
81 | #define IRQ_TIME2 13 | |
81 | #define IRQ_SPARC_TIME2 0x1d // see sparcv8.pdf p.76 for interrupt levels |
|
82 | #define IRQ_SPARC_TIME2 0x1d // see sparcv8.pdf p.76 for interrupt levels | |
82 | #define IRQ_WAVEFORM_PICKER 14 |
|
83 | #define IRQ_WAVEFORM_PICKER 14 | |
83 | #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels |
|
84 | #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels | |
84 | #define IRQ_SPECTRAL_MATRIX 6 |
|
85 | #define IRQ_SPECTRAL_MATRIX 6 | |
85 | #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels |
|
86 | #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels | |
86 |
|
87 | |||
87 | //***** |
|
88 | //***** | |
88 | // TIME |
|
89 | // TIME | |
89 | #define CLKDIV_SM_SIMULATOR (10000 - 1) // 10 ms |
|
90 | #define CLKDIV_SM_SIMULATOR (10000 - 1) // 10 ms | |
90 | #define CLKDIV_WF_SIMULATOR (10000000 - 1) // 10 000 000 * 1 us = 10 s |
|
91 | #define CLKDIV_WF_SIMULATOR (10000000 - 1) // 10 000 000 * 1 us = 10 s | |
91 | #define TIMER_SM_SIMULATOR 1 |
|
92 | #define TIMER_SM_SIMULATOR 1 | |
92 | #define TIMER_WF_SIMULATOR 2 |
|
93 | #define TIMER_WF_SIMULATOR 2 | |
93 | #define HK_PERIOD 100 // 100 * 10ms => 1sec |
|
94 | #define HK_PERIOD 100 // 100 * 10ms => 1sec | |
94 |
|
95 | |||
95 | //********** |
|
96 | //********** | |
96 | // LPP CODES |
|
97 | // LPP CODES | |
97 | #define LFR_SUCCESSFUL 0 |
|
98 | #define LFR_SUCCESSFUL 0 | |
98 | #define LFR_DEFAULT 1 |
|
99 | #define LFR_DEFAULT 1 | |
99 |
|
100 | |||
100 | //****** |
|
101 | //****** | |
101 | // RTEMS |
|
102 | // RTEMS | |
102 | #define TASKID_RECV 1 |
|
103 | #define TASKID_RECV 1 | |
103 | #define TASKID_ACTN 2 |
|
104 | #define TASKID_ACTN 2 | |
104 | #define TASKID_SPIQ 3 |
|
105 | #define TASKID_SPIQ 3 | |
105 | #define TASKID_SMIQ 4 |
|
106 | #define TASKID_SMIQ 4 | |
106 | #define TASKID_STAT 5 |
|
107 | #define TASKID_STAT 5 | |
107 | #define TASKID_AVF0 6 |
|
108 | #define TASKID_AVF0 6 | |
108 | #define TASKID_BPF0 7 |
|
109 | #define TASKID_BPF0 7 | |
109 | #define TASKID_WFRM 8 |
|
110 | #define TASKID_WFRM 8 | |
110 | #define TASKID_DUMB 9 |
|
111 | #define TASKID_DUMB 9 | |
111 | #define TASKID_HOUS 10 |
|
112 | #define TASKID_HOUS 10 | |
112 | #define TASKID_MATR 11 |
|
113 | #define TASKID_MATR 11 | |
113 | #define TASKID_CWF3 12 |
|
114 | #define TASKID_CWF3 12 | |
114 | #define TASKID_CWF2 13 |
|
115 | #define TASKID_CWF2 13 | |
115 | #define TASKID_CWF1 14 |
|
116 | #define TASKID_CWF1 14 | |
116 | #define TASKID_SEND 15 |
|
117 | #define TASKID_SEND 15 | |
117 |
|
118 | |||
118 | #define TASK_PRIORITY_SPIQ 5 |
|
119 | #define TASK_PRIORITY_SPIQ 5 | |
119 | #define TASK_PRIORITY_SMIQ 10 |
|
120 | #define TASK_PRIORITY_SMIQ 10 | |
120 | // |
|
121 | // | |
121 | #define TASK_PRIORITY_RECV 20 |
|
122 | #define TASK_PRIORITY_RECV 20 | |
122 | #define TASK_PRIORITY_ACTN 30 |
|
123 | #define TASK_PRIORITY_ACTN 30 | |
123 | // |
|
124 | // | |
124 | #define TASK_PRIORITY_HOUS 40 |
|
125 | #define TASK_PRIORITY_HOUS 40 | |
125 | #define TASK_PRIORITY_CWF1 40 |
|
126 | #define TASK_PRIORITY_CWF1 40 | |
126 | #define TASK_PRIORITY_CWF2 40 |
|
127 | #define TASK_PRIORITY_CWF2 40 | |
127 | #define TASK_PRIORITY_WFRM 40 |
|
128 | #define TASK_PRIORITY_WFRM 40 | |
128 | #define TASK_PRIORITY_CWF3 40 |
|
129 | #define TASK_PRIORITY_CWF3 40 | |
129 | // |
|
130 | // | |
130 | #define TASK_PRIORITY_SEND 40 |
|
131 | #define TASK_PRIORITY_SEND 40 | |
131 | // |
|
132 | // | |
132 | #define TASK_PRIORITY_AVF0 60 |
|
133 | #define TASK_PRIORITY_AVF0 60 | |
133 | #define TASK_PRIORITY_BPF0 60 |
|
134 | #define TASK_PRIORITY_BPF0 60 | |
134 | #define TASK_PRIORITY_MATR 100 |
|
135 | #define TASK_PRIORITY_MATR 100 | |
135 | #define TASK_PRIORITY_STAT 200 |
|
136 | #define TASK_PRIORITY_STAT 200 | |
136 | #define TASK_PRIORITY_DUMB 200 |
|
137 | #define TASK_PRIORITY_DUMB 200 | |
137 |
|
138 | |||
138 | #define ACTION_MSG_QUEUE_COUNT 10 |
|
139 | #define ACTION_MSG_QUEUE_COUNT 10 | |
139 | #define ACTION_MSG_PKTS_COUNT 50 |
|
140 | #define ACTION_MSG_PKTS_COUNT 50 | |
140 | #define ACTION_MSG_PKTS_SIZE 24 // hlen *hdr dlen *data sent options |
|
141 | #define ACTION_MSG_PKTS_MAX_SIZE (PACKET_LENGTH_TC_EXE_CORRUPTED + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES) | |
|
142 | #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options | |||
141 |
|
143 | |||
142 | #define QUEUE_QUEU 0 |
|
144 | #define QUEUE_QUEU 0 | |
143 | #define QUEUE_PKTS 1 |
|
145 | #define QUEUE_PKTS 1 | |
144 |
|
146 | |||
145 | //******* |
|
147 | //******* | |
146 | // MACROS |
|
148 | // MACROS | |
147 | #ifdef PRINT_MESSAGES_ON_CONSOLE |
|
149 | #ifdef PRINT_MESSAGES_ON_CONSOLE | |
148 | #define PRINTF(x) printf(x); |
|
150 | #define PRINTF(x) printf(x); | |
149 | #define PRINTF1(x,y) printf(x,y); |
|
151 | #define PRINTF1(x,y) printf(x,y); | |
150 | #define PRINTF2(x,y,z) printf(x,y,z); |
|
152 | #define PRINTF2(x,y,z) printf(x,y,z); | |
151 | #else |
|
153 | #else | |
152 | #define PRINTF(x) ; |
|
154 | #define PRINTF(x) ; | |
153 | #define PRINTF1(x,y) ; |
|
155 | #define PRINTF1(x,y) ; | |
154 | #define PRINTF2(x,y,z) ; |
|
156 | #define PRINTF2(x,y,z) ; | |
155 | #endif |
|
157 | #endif | |
156 |
|
158 | |||
157 | #ifdef BOOT_MESSAGES |
|
159 | #ifdef BOOT_MESSAGES | |
158 | #define BOOT_PRINTF(x) printf(x); |
|
160 | #define BOOT_PRINTF(x) printf(x); | |
159 | #define BOOT_PRINTF1(x,y) printf(x,y); |
|
161 | #define BOOT_PRINTF1(x,y) printf(x,y); | |
160 | #define BOOT_PRINTF2(x,y,z) printf(x,y,z); |
|
162 | #define BOOT_PRINTF2(x,y,z) printf(x,y,z); | |
161 | #else |
|
163 | #else | |
162 | #define BOOT_PRINTF(x) ; |
|
164 | #define BOOT_PRINTF(x) ; | |
163 | #define BOOT_PRINTF1(x,y) ; |
|
165 | #define BOOT_PRINTF1(x,y) ; | |
164 | #define BOOT_PRINTF2(x,y,z) ; |
|
166 | #define BOOT_PRINTF2(x,y,z) ; | |
165 | #endif |
|
167 | #endif | |
166 |
|
168 | |||
167 | #ifdef DEBUG_MESSAGES |
|
169 | #ifdef DEBUG_MESSAGES | |
168 | #define DEBUG_PRINTF(x) printf(x); |
|
170 | #define DEBUG_PRINTF(x) printf(x); | |
169 | #define DEBUG_PRINTF1(x,y) printf(x,y); |
|
171 | #define DEBUG_PRINTF1(x,y) printf(x,y); | |
170 | #define DEBUG_PRINTF2(x,y,z) printf(x,y,z); |
|
172 | #define DEBUG_PRINTF2(x,y,z) printf(x,y,z); | |
171 | #else |
|
173 | #else | |
172 | #define DEBUG_PRINTF(x) ; |
|
174 | #define DEBUG_PRINTF(x) ; | |
173 | #define DEBUG_PRINTF1(x,y) ; |
|
175 | #define DEBUG_PRINTF1(x,y) ; | |
174 | #define DEBUG_PRINTF2(x,y,z) ; |
|
176 | #define DEBUG_PRINTF2(x,y,z) ; | |
175 | #endif |
|
177 | #endif | |
176 |
|
178 | |||
177 | #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period |
|
179 | #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period | |
178 |
|
180 | |||
179 | #define NB_SAMPLES_PER_SNAPSHOT 2048 |
|
181 | #define NB_SAMPLES_PER_SNAPSHOT 2048 | |
180 | #define TIME_OFFSET 2 |
|
182 | #define TIME_OFFSET 2 | |
181 | #define WAVEFORM_EXTENDED_HEADER_OFFSET 22 |
|
183 | #define WAVEFORM_EXTENDED_HEADER_OFFSET 22 | |
182 | #define NB_BYTES_SWF_BLK (2 * 6) |
|
184 | #define NB_BYTES_SWF_BLK (2 * 6) | |
183 | #define NB_WORDS_SWF_BLK 3 |
|
185 | #define NB_WORDS_SWF_BLK 3 | |
184 |
|
186 | |||
185 | //****************** |
|
187 | //****************** | |
186 | // SEQUENCE COUNTERS |
|
188 | // SEQUENCE COUNTERS | |
187 | #define SEQ_CNT_NB_PID 2 |
|
189 | #define SEQ_CNT_NB_PID 2 | |
188 | #define SEQ_CNT_NB_CAT 4 |
|
190 | #define SEQ_CNT_NB_CAT 4 | |
189 | #define SEQ_CNT_NB_DEST_ID 11 |
|
191 | #define SEQ_CNT_NB_DEST_ID 11 | |
190 | // pid |
|
192 | // pid | |
191 | #define SEQ_CNT_PID_76 0 |
|
193 | #define SEQ_CNT_PID_76 0 | |
192 | #define SEQ_CNT_PID_79 1 |
|
194 | #define SEQ_CNT_PID_79 1 | |
193 | //cat |
|
195 | //cat | |
194 | #define SEQ_CNT_CAT_1 0 |
|
196 | #define SEQ_CNT_CAT_1 0 | |
195 | #define SEQ_CNT_CAT_4 1 |
|
197 | #define SEQ_CNT_CAT_4 1 | |
196 | #define SEQ_CNT_CAT_9 2 |
|
198 | #define SEQ_CNT_CAT_9 2 | |
197 | #define SEQ_CNT_CAT_12 3 |
|
199 | #define SEQ_CNT_CAT_12 3 | |
198 | // destination id |
|
200 | // destination id | |
199 | #define SEQ_CNT_DST_ID_GROUND 0 |
|
201 | #define SEQ_CNT_DST_ID_GROUND 0 | |
200 | #define SEQ_CNT_DST_ID_MISSION_TIMELINE 1 |
|
202 | #define SEQ_CNT_DST_ID_MISSION_TIMELINE 1 | |
201 | #define SEQ_CNT_DST_ID_TC_SEQUENCES 2 |
|
203 | #define SEQ_CNT_DST_ID_TC_SEQUENCES 2 | |
202 | #define SEQ_CNT_DST_ID_RECOVERY_ACTION_CMD 3 |
|
204 | #define SEQ_CNT_DST_ID_RECOVERY_ACTION_CMD 3 | |
203 | #define SEQ_CNT_DST_ID_BACKUP_MISSION_TIMELINE 4 |
|
205 | #define SEQ_CNT_DST_ID_BACKUP_MISSION_TIMELINE 4 | |
204 | #define SEQ_CNT_DST_ID_DIRECT_CMD 5 |
|
206 | #define SEQ_CNT_DST_ID_DIRECT_CMD 5 | |
205 | #define SEQ_CNT_DST_ID_SPARE_GRD_SRC1 6 |
|
207 | #define SEQ_CNT_DST_ID_SPARE_GRD_SRC1 6 | |
206 | #define SEQ_CNT_DST_ID_SPARE_GRD_SRC2 7 |
|
208 | #define SEQ_CNT_DST_ID_SPARE_GRD_SRC2 7 | |
207 | #define SEQ_CNT_DST_ID_OBCP 8 |
|
209 | #define SEQ_CNT_DST_ID_OBCP 8 | |
208 | #define SEQ_CNT_DST_ID_SYSTEM_CONTROL 9 |
|
210 | #define SEQ_CNT_DST_ID_SYSTEM_CONTROL 9 | |
209 | #define SEQ_CNT_DST_ID_AOCS 10 |
|
211 | #define SEQ_CNT_DST_ID_AOCS 10 | |
210 |
|
212 | |||
211 | struct param_local_str{ |
|
213 | struct param_local_str{ | |
212 | unsigned int local_sbm1_nb_cwf_sent; |
|
214 | unsigned int local_sbm1_nb_cwf_sent; | |
213 | unsigned int local_sbm1_nb_cwf_max; |
|
215 | unsigned int local_sbm1_nb_cwf_max; | |
214 | unsigned int local_sbm2_nb_cwf_sent; |
|
216 | unsigned int local_sbm2_nb_cwf_sent; | |
215 | unsigned int local_sbm2_nb_cwf_max; |
|
217 | unsigned int local_sbm2_nb_cwf_max; | |
216 | unsigned int local_nb_interrupt_f0_MAX; |
|
218 | unsigned int local_nb_interrupt_f0_MAX; | |
217 | }; |
|
219 | }; | |
218 |
|
220 | |||
219 | #endif // FSW_RTEMS_CONFIG_H_INCLUDED |
|
221 | #endif // FSW_RTEMS_CONFIG_H_INCLUDED |
@@ -1,87 +1,86 | |||||
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 | // MODE PARAMETERS |
|
15 | // MODE PARAMETERS | |
16 | extern struct param_sbm1_str param_sbm1; |
|
16 | extern struct param_sbm1_str param_sbm1; | |
17 | extern struct param_sbm2_str param_sbm2; |
|
17 | extern struct param_sbm2_str param_sbm2; | |
18 | extern time_management_regs_t *time_management_regs; |
|
18 | extern time_management_regs_t *time_management_regs; | |
19 | extern waveform_picker_regs_t *waveform_picker_regs; |
|
19 | extern waveform_picker_regs_t *waveform_picker_regs; | |
20 | extern gptimer_regs_t *gptimer_regs; |
|
20 | extern gptimer_regs_t *gptimer_regs; | |
21 |
|
21 | |||
22 | //**** |
|
22 | //**** | |
23 | // ISR |
|
23 | // ISR | |
24 | rtems_isr commutation_isr1( rtems_vector_number vector ); |
|
24 | rtems_isr commutation_isr1( rtems_vector_number vector ); | |
25 | rtems_isr commutation_isr2( rtems_vector_number vector ); |
|
25 | rtems_isr commutation_isr2( rtems_vector_number vector ); | |
26 |
|
26 | |||
27 | //********************** |
|
27 | //********************** | |
28 | // GENERAL USE FUNCTIONS |
|
28 | // GENERAL USE FUNCTIONS | |
29 | unsigned int Crc_opt( unsigned char D, unsigned int Chk); |
|
29 | unsigned int Crc_opt( unsigned char D, unsigned int Chk); | |
30 | void initLookUpTableForCRC( void ); |
|
30 | void initLookUpTableForCRC( void ); | |
31 | void GetCRCAsTwoBytes(unsigned char* data, unsigned char* crcAsTwoBytes, unsigned int sizeOfData); |
|
31 | void GetCRCAsTwoBytes(unsigned char* data, unsigned char* crcAsTwoBytes, unsigned int sizeOfData); | |
32 | void updateLFRCurrentMode(); |
|
32 | void updateLFRCurrentMode(); | |
33 |
|
33 | |||
34 | //********************* |
|
34 | //********************* | |
35 | // ACCEPTANCE FUNCTIONS |
|
35 | // ACCEPTANCE FUNCTIONS | |
36 | int TC_acceptance(ccsdsTelecommandPacket_t *TC, unsigned int TC_LEN_RCV, rtems_id queue_id); |
|
36 | int TC_acceptance(ccsdsTelecommandPacket_t *TC, unsigned int TC_LEN_RCV, rtems_id queue_id); | |
37 | 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); | |
38 |
|
38 | |||
39 | unsigned char TM_build_header( enum TM_TYPE tm_type, unsigned int packetLength, |
|
|||
40 | TMHeader_t *TMHeader, unsigned char tc_sid); |
|
|||
41 |
|
||||
42 | //*********** |
|
39 | //*********** | |
43 | // RTEMS TASK |
|
40 | // RTEMS TASK | |
44 | rtems_task recv_task( rtems_task_argument unused ); |
|
41 | rtems_task recv_task( rtems_task_argument unused ); | |
45 | rtems_task actn_task( rtems_task_argument unused ); |
|
42 | rtems_task actn_task( rtems_task_argument unused ); | |
46 | rtems_task dumb_task( rtems_task_argument unused ); |
|
43 | rtems_task dumb_task( rtems_task_argument unused ); | |
47 |
|
44 | |||
48 | //*********** |
|
45 | //*********** | |
49 | // TC ACTIONS |
|
46 | // TC ACTIONS | |
50 | int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); |
|
47 | int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); | |
51 | int action_load_common_par(ccsdsTelecommandPacket_t *TC); |
|
48 | int action_load_common_par(ccsdsTelecommandPacket_t *TC); | |
52 | int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); |
|
49 | int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); | |
53 | int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); |
|
50 | int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); | |
54 | int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); |
|
51 | int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); | |
55 | int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); |
|
52 | int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); | |
56 | int action_dump_par(ccsdsTelecommandPacket_t *TC); |
|
53 | int action_dump_par(ccsdsTelecommandPacket_t *TC); | |
57 | int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); |
|
54 | int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); | |
58 | int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); |
|
55 | int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); | |
59 | int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); |
|
56 | int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); | |
60 | int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); |
|
57 | int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); | |
61 | int action_update_time(ccsdsTelecommandPacket_t *TC); |
|
58 | int action_update_time(ccsdsTelecommandPacket_t *TC); | |
62 |
|
59 | |||
63 | // mode transition |
|
60 | // mode transition | |
64 | int transition_validation(unsigned char requestedMode); |
|
61 | int transition_validation(unsigned char requestedMode); | |
65 | int stop_current_mode(); |
|
62 | int stop_current_mode(); | |
66 | int enter_mode(unsigned char mode, ccsdsTelecommandPacket_t *TC); |
|
63 | int enter_mode(unsigned char mode, ccsdsTelecommandPacket_t *TC); | |
67 | int enter_standby_mode(); |
|
64 | int enter_standby_mode(); | |
68 | int enter_normal_mode(); |
|
65 | int enter_normal_mode(); | |
69 | int enter_burst_mode(); |
|
66 | int enter_burst_mode(); | |
70 | int enter_sbm1_mode(); |
|
67 | int enter_sbm1_mode(); | |
71 | int enter_sbm2_mode(); |
|
68 | int enter_sbm2_mode(); | |
72 | int restart_science_tasks(); |
|
69 | int restart_science_tasks(); | |
73 | int suspend_science_tasks(); |
|
70 | int suspend_science_tasks(); | |
74 |
|
71 | |||
75 | // other functions |
|
72 | // other functions | |
76 | void update_last_TC_exe(ccsdsTelecommandPacket_t *TC); |
|
73 | void update_last_TC_exe(ccsdsTelecommandPacket_t *TC); | |
77 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC); |
|
74 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC); | |
78 | void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id); |
|
75 | void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id); | |
|
76 | // | |||
79 | int send_tm_lfr_tc_exe_success(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); |
|
77 | int send_tm_lfr_tc_exe_success(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); | |
|
78 | int send_tm_lfr_tc_exe_inconsistent(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char byte_position, unsigned char rcv_value); | |||
80 | int send_tm_lfr_tc_exe_not_executable(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); |
|
79 | int send_tm_lfr_tc_exe_not_executable(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); | |
81 | int send_tm_lfr_tc_exe_not_implemented(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); |
|
80 | int send_tm_lfr_tc_exe_not_implemented(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); | |
82 | int send_tm_lfr_tc_exe_error(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); |
|
81 | int send_tm_lfr_tc_exe_error(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); | |
83 |
|
82 | |||
84 | #endif // TC_HANDLER_H_INCLUDED |
|
83 | #endif // TC_HANDLER_H_INCLUDED | |
85 |
|
84 | |||
86 |
|
85 | |||
87 |
|
86 |
@@ -1,455 +1,456 | |||||
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 1 // instead of 100 |
|
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_INIT_TASK_MODE (RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT) | |
24 | #define CONFIGURE_MAXIMUM_DRIVERS 16 |
|
24 | #define CONFIGURE_MAXIMUM_DRIVERS 16 | |
25 | #define CONFIGURE_MAXIMUM_PERIODS 5 |
|
25 | #define CONFIGURE_MAXIMUM_PERIODS 5 | |
26 | #define CONFIGURE_MAXIMUM_TIMERS 5 // STAT (1s), send SWF (0.3s), send CWF3 (1s) |
|
26 | #define CONFIGURE_MAXIMUM_TIMERS 5 // STAT (1s), send SWF (0.3s), send CWF3 (1s) | |
27 | #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 2 |
|
27 | #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 2 | |
28 | #ifdef PRINT_STACK_REPORT |
|
28 | #ifdef PRINT_STACK_REPORT | |
29 | #define CONFIGURE_STACK_CHECKER_ENABLED |
|
29 | #define CONFIGURE_STACK_CHECKER_ENABLED | |
30 | #endif |
|
30 | #endif | |
31 |
|
31 | |||
32 | #include <rtems/confdefs.h> |
|
32 | #include <rtems/confdefs.h> | |
33 |
|
33 | |||
34 | /* If --drvmgr was enabled during the configuration of the RTEMS kernel */ |
|
34 | /* If --drvmgr was enabled during the configuration of the RTEMS kernel */ | |
35 | #ifdef RTEMS_DRVMGR_STARTUP |
|
35 | #ifdef RTEMS_DRVMGR_STARTUP | |
36 | #ifdef LEON3 |
|
36 | #ifdef LEON3 | |
37 | /* Add Timer and UART Driver */ |
|
37 | /* Add Timer and UART Driver */ | |
38 | #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
|
38 | #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER | |
39 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER |
|
39 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER | |
40 | #endif |
|
40 | #endif | |
41 | #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
|
41 | #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER | |
42 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART |
|
42 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART | |
43 | #endif |
|
43 | #endif | |
44 | #endif |
|
44 | #endif | |
45 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */ |
|
45 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */ | |
46 | #include <drvmgr/drvmgr_confdefs.h> |
|
46 | #include <drvmgr/drvmgr_confdefs.h> | |
47 | #endif |
|
47 | #endif | |
48 |
|
48 | |||
49 | #include <fsw_init.h> |
|
49 | #include <fsw_init.h> | |
50 | #include <fsw_config.c> |
|
50 | #include <fsw_config.c> | |
51 |
|
51 | |||
52 | rtems_task Init( rtems_task_argument ignored ) |
|
52 | rtems_task Init( rtems_task_argument ignored ) | |
53 | { |
|
53 | { | |
54 | rtems_status_code status; |
|
54 | rtems_status_code status; | |
55 | rtems_isr_entry old_isr_handler; |
|
55 | rtems_isr_entry old_isr_handler; | |
56 |
|
56 | |||
57 | BOOT_PRINTF("\n\n\n\n\n") |
|
57 | BOOT_PRINTF("\n\n\n\n\n") | |
58 | BOOT_PRINTF("***************************\n") |
|
58 | BOOT_PRINTF("***************************\n") | |
59 | BOOT_PRINTF("** START Flight Software **\n") |
|
59 | BOOT_PRINTF("** START Flight Software **\n") | |
60 | BOOT_PRINTF("***************************\n") |
|
60 | BOOT_PRINTF("***************************\n") | |
61 | BOOT_PRINTF("\n\n") |
|
61 | BOOT_PRINTF("\n\n") | |
62 |
|
62 | |||
63 | //send_console_outputs_on_apbuart_port(); |
|
63 | //send_console_outputs_on_apbuart_port(); | |
64 | 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); | |
65 |
|
65 | |||
66 | initLookUpTableForCRC(); // in tc_handler.h |
|
66 | initLookUpTableForCRC(); // in tc_handler.h | |
67 | init_parameter_dump(); |
|
67 | init_parameter_dump(); | |
68 | init_local_mode_parameters(); |
|
68 | init_local_mode_parameters(); | |
69 | init_housekeeping_parameters(); |
|
69 | init_housekeeping_parameters(); | |
70 |
|
70 | |||
71 | create_names(); // create all names |
|
71 | create_names(); // create all names | |
72 |
|
72 | |||
73 | create_message_queues(); |
|
73 | create_message_queues(); | |
74 |
|
74 | |||
75 | create_all_tasks(); // create all tasks |
|
75 | create_all_tasks(); // create all tasks | |
76 |
|
76 | |||
77 | start_all_tasks(); // start all tasks |
|
77 | start_all_tasks(); // start all tasks | |
78 |
|
78 | |||
79 | stop_current_mode(); // go in STANDBY mode |
|
79 | stop_current_mode(); // go in STANDBY mode | |
80 |
|
80 | |||
81 | grspw_timecode_callback = &timecode_irq_handler; |
|
81 | grspw_timecode_callback = &timecode_irq_handler; | |
82 |
|
82 | |||
83 | spacewire_configure_link(); |
|
83 | spacewire_configure_link(); | |
84 |
|
84 | |||
85 | #ifdef GSA |
|
85 | #ifdef GSA | |
86 | // mask IRQ lines |
|
86 | // mask IRQ lines | |
87 | LEON_Mask_interrupt( IRQ_SM ); |
|
87 | LEON_Mask_interrupt( IRQ_SM ); | |
88 | LEON_Mask_interrupt( IRQ_WF ); |
|
88 | LEON_Mask_interrupt( IRQ_WF ); | |
89 | // Spectral Matrices simulator |
|
89 | // Spectral Matrices simulator | |
90 | 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, | |
91 | IRQ_SPARC_SM, spectral_matrices_isr ); |
|
91 | IRQ_SPARC_SM, spectral_matrices_isr ); | |
92 | // WaveForms |
|
92 | // WaveForms | |
93 | 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, | |
94 | IRQ_SPARC_WF, waveforms_simulator_isr ); |
|
94 | IRQ_SPARC_WF, waveforms_simulator_isr ); | |
95 | #else |
|
95 | #else | |
96 | // mask IRQ lines |
|
96 | // mask IRQ lines | |
97 | LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); |
|
97 | LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); | |
98 | LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); |
|
98 | LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); | |
99 | // reset configuration registers |
|
99 | // reset configuration registers | |
100 | reset_waveform_picker_regs(); |
|
100 | reset_waveform_picker_regs(); | |
101 | reset_spectral_matrix_regs(); |
|
101 | reset_spectral_matrix_regs(); | |
102 | // configure IRQ handling for the waveform picker unit |
|
102 | // configure IRQ handling for the waveform picker unit | |
103 | status = rtems_interrupt_catch( waveforms_isr, |
|
103 | status = rtems_interrupt_catch( waveforms_isr, | |
104 | IRQ_SPARC_WAVEFORM_PICKER, |
|
104 | IRQ_SPARC_WAVEFORM_PICKER, | |
105 | &old_isr_handler) ; |
|
105 | &old_isr_handler) ; | |
106 | // configure IRQ handling for the spectral matrix unit |
|
106 | // configure IRQ handling for the spectral matrix unit | |
107 | // status = rtems_interrupt_catch( spectral_matrices_isr, |
|
107 | // status = rtems_interrupt_catch( spectral_matrices_isr, | |
108 | // IRQ_SPARC_SPECTRAL_MATRIX, |
|
108 | // IRQ_SPARC_SPECTRAL_MATRIX, | |
109 | // &old_isr_handler) ; |
|
109 | // &old_isr_handler) ; | |
110 | // Spectral Matrices simulator |
|
110 | // Spectral Matrices simulator | |
111 | configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR, |
|
111 | configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR, | |
112 | IRQ_SPARC_SM, spectral_matrices_isr_simu ); |
|
112 | IRQ_SPARC_SM, spectral_matrices_isr_simu ); | |
113 | #endif |
|
113 | #endif | |
114 |
|
114 | |||
115 | BOOT_PRINTF("delete INIT\n") |
|
115 | BOOT_PRINTF("delete INIT\n") | |
116 |
|
116 | |||
117 | status = rtems_task_delete(RTEMS_SELF); |
|
117 | status = rtems_task_delete(RTEMS_SELF); | |
118 |
|
118 | |||
119 | } |
|
119 | } | |
120 |
|
120 | |||
121 | void init_parameter_dump( void ) |
|
121 | void init_parameter_dump( void ) | |
122 | { |
|
122 | { | |
123 | parameter_dump_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
123 | parameter_dump_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; | |
124 | parameter_dump_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
124 | parameter_dump_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
125 | parameter_dump_packet.reserved = CCSDS_RESERVED; |
|
125 | parameter_dump_packet.reserved = CCSDS_RESERVED; | |
126 | parameter_dump_packet.userApplication = CCSDS_USER_APP; |
|
126 | parameter_dump_packet.userApplication = CCSDS_USER_APP; | |
127 | 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); | |
128 | 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; | |
129 | parameter_dump_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
129 | parameter_dump_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
130 | parameter_dump_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
130 | parameter_dump_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
131 | 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); | |
132 | parameter_dump_packet.packetLength[1] = (unsigned char) PACKET_LENGTH_PARAMETER_DUMP; |
|
132 | parameter_dump_packet.packetLength[1] = (unsigned char) PACKET_LENGTH_PARAMETER_DUMP; | |
133 | // DATA FIELD HEADER |
|
133 | // DATA FIELD HEADER | |
134 | parameter_dump_packet.spare1_pusVersion_spare2 = SPARE1_PUSVERSION_SPARE2; |
|
134 | parameter_dump_packet.spare1_pusVersion_spare2 = SPARE1_PUSVERSION_SPARE2; | |
135 | parameter_dump_packet.serviceType = TM_TYPE_PARAMETER_DUMP; |
|
135 | parameter_dump_packet.serviceType = TM_TYPE_PARAMETER_DUMP; | |
136 | parameter_dump_packet.serviceSubType = TM_SUBTYPE_PARAMETER_DUMP; |
|
136 | parameter_dump_packet.serviceSubType = TM_SUBTYPE_PARAMETER_DUMP; | |
137 | parameter_dump_packet.destinationID = TM_DESTINATION_ID_GROUND; |
|
137 | parameter_dump_packet.destinationID = TM_DESTINATION_ID_GROUND; | |
138 | 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); | |
139 | 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); | |
140 | 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); | |
141 | 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); | |
142 | 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); | |
143 | 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); | |
144 | parameter_dump_packet.sid = SID_PARAMETER_DUMP; |
|
144 | parameter_dump_packet.sid = SID_PARAMETER_DUMP; | |
145 |
|
145 | |||
146 | //****************** |
|
146 | //****************** | |
147 | // COMMON PARAMETERS |
|
147 | // COMMON PARAMETERS | |
148 | parameter_dump_packet.unused0 = DEFAULT_SY_LFR_COMMON0; |
|
148 | parameter_dump_packet.unused0 = DEFAULT_SY_LFR_COMMON0; | |
149 | 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; | |
150 |
|
150 | |||
151 | //****************** |
|
151 | //****************** | |
152 | // NORMAL PARAMETERS |
|
152 | // NORMAL PARAMETERS | |
153 | 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); | |
154 | 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 ); | |
155 | 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); | |
156 | 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 ); | |
157 | 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); | |
158 | 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 ); | |
159 | 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; | |
160 | 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; | |
161 |
|
161 | |||
162 | //***************** |
|
162 | //***************** | |
163 | // BURST PARAMETERS |
|
163 | // BURST PARAMETERS | |
164 | 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; | |
165 | 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; | |
166 |
|
166 | |||
167 | //**************** |
|
167 | //**************** | |
168 | // SBM1 PARAMETERS |
|
168 | // SBM1 PARAMETERS | |
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 |
|
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 | |
170 | 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; | |
171 |
|
171 | |||
172 | //**************** |
|
172 | //**************** | |
173 | // SBM2 PARAMETERS |
|
173 | // SBM2 PARAMETERS | |
174 | 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; | |
175 | 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; | |
176 | } |
|
176 | } | |
177 |
|
177 | |||
178 | void init_local_mode_parameters( void ) |
|
178 | void init_local_mode_parameters( void ) | |
179 | { |
|
179 | { | |
180 | // LOCAL PARAMETERS |
|
180 | // LOCAL PARAMETERS | |
181 | set_local_sbm1_nb_cwf_max(); |
|
181 | set_local_sbm1_nb_cwf_max(); | |
182 | set_local_sbm2_nb_cwf_max(); |
|
182 | set_local_sbm2_nb_cwf_max(); | |
183 | set_local_nb_interrupt_f0_MAX(); |
|
183 | set_local_nb_interrupt_f0_MAX(); | |
184 |
|
184 | |||
185 | BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max) |
|
185 | BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max) | |
186 | BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max) |
|
186 | BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max) | |
187 | BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX) |
|
187 | BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX) | |
188 |
|
188 | |||
189 | reset_local_sbm1_nb_cwf_sent(); |
|
189 | reset_local_sbm1_nb_cwf_sent(); | |
190 | reset_local_sbm2_nb_cwf_sent(); |
|
190 | reset_local_sbm2_nb_cwf_sent(); | |
191 | } |
|
191 | } | |
192 |
|
192 | |||
193 | void init_housekeeping_parameters( void ) |
|
193 | void init_housekeeping_parameters( void ) | |
194 | { |
|
194 | { | |
195 | unsigned int i = 0; |
|
195 | unsigned int i = 0; | |
196 | unsigned int j = 0; |
|
196 | unsigned int j = 0; | |
197 | unsigned int k = 0; |
|
197 | unsigned int k = 0; | |
198 | char *parameters; |
|
198 | char *parameters; | |
199 |
|
199 | |||
200 | parameters = (char*) &housekeeping_packet.lfr_status_word; |
|
200 | parameters = (char*) &housekeeping_packet.lfr_status_word; | |
201 | for(i = 0; i< SIZE_HK_PARAMETERS; i++) |
|
201 | for(i = 0; i< SIZE_HK_PARAMETERS; i++) | |
202 | { |
|
202 | { | |
203 | parameters[i] = 0x00; |
|
203 | parameters[i] = 0x00; | |
204 | } |
|
204 | } | |
205 | // init status word |
|
205 | // init status word | |
206 | housekeeping_packet.lfr_status_word[0] = 0x00; |
|
206 | housekeeping_packet.lfr_status_word[0] = 0x00; | |
207 | housekeeping_packet.lfr_status_word[1] = 0x00; |
|
207 | housekeeping_packet.lfr_status_word[1] = 0x00; | |
208 | // init software version |
|
208 | // init software version | |
209 | housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1; |
|
209 | housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1; | |
210 | housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2; |
|
210 | housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2; | |
211 | housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3; |
|
211 | housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3; | |
212 | housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4; |
|
212 | housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4; | |
213 | // init sequence counters |
|
213 | // init sequence counters | |
214 | for (i = 0; i<SEQ_CNT_NB_PID; i++) |
|
214 | for (i = 0; i<SEQ_CNT_NB_PID; i++) | |
215 | { |
|
215 | { | |
216 | for(j = 0; j<SEQ_CNT_NB_CAT; j++) |
|
216 | for(j = 0; j<SEQ_CNT_NB_CAT; j++) | |
217 | { |
|
217 | { | |
218 | for(k = 0; k<SEQ_CNT_NB_DEST_ID; k++) |
|
218 | for(k = 0; k<SEQ_CNT_NB_DEST_ID; k++) | |
219 | { |
|
219 | { | |
220 | sequenceCounters[i][j][k] = 0x00; |
|
220 | sequenceCounters[i][j][k] = 0x00; | |
221 | } |
|
221 | } | |
222 | } |
|
222 | } | |
223 | } |
|
223 | } | |
224 | updateLFRCurrentMode(); |
|
224 | updateLFRCurrentMode(); | |
225 | } |
|
225 | } | |
226 |
|
226 | |||
227 | int create_names( void ) |
|
227 | int create_names( void ) | |
228 | { |
|
228 | { | |
229 | // task names |
|
229 | // task names | |
230 | Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' ); |
|
230 | Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' ); | |
231 | Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' ); |
|
231 | Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' ); | |
232 | Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' ); |
|
232 | Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' ); | |
233 | Task_name[TASKID_SMIQ] = rtems_build_name( 'S', 'M', 'I', 'Q' ); |
|
233 | Task_name[TASKID_SMIQ] = rtems_build_name( 'S', 'M', 'I', 'Q' ); | |
234 | Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' ); |
|
234 | Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' ); | |
235 | Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' ); |
|
235 | Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' ); | |
236 | Task_name[TASKID_BPF0] = rtems_build_name( 'B', 'P', 'F', '0' ); |
|
236 | Task_name[TASKID_BPF0] = rtems_build_name( 'B', 'P', 'F', '0' ); | |
237 | Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' ); |
|
237 | Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' ); | |
238 | Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' ); |
|
238 | Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' ); | |
239 | Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' ); |
|
239 | Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' ); | |
240 | Task_name[TASKID_MATR] = rtems_build_name( 'M', 'A', 'T', 'R' ); |
|
240 | Task_name[TASKID_MATR] = rtems_build_name( 'M', 'A', 'T', 'R' ); | |
241 | Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' ); |
|
241 | Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' ); | |
242 | Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' ); |
|
242 | Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' ); | |
243 | Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' ); |
|
243 | Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' ); | |
244 | Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' ); |
|
244 | Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' ); | |
245 |
|
245 | |||
246 | // rate monotonic period name |
|
246 | // rate monotonic period name | |
247 | HK_name = rtems_build_name( 'H', 'O', 'U', 'S' ); |
|
247 | HK_name = rtems_build_name( 'H', 'O', 'U', 'S' ); | |
248 |
|
248 | |||
249 | misc_name[QUEUE_QUEU] = rtems_build_name( 'Q', 'U', 'E', 'U' ); |
|
249 | misc_name[QUEUE_QUEU] = rtems_build_name( 'Q', 'U', 'E', 'U' ); | |
250 | misc_name[QUEUE_PKTS] = rtems_build_name( 'P', 'K', 'T', 'S' ); |
|
250 | misc_name[QUEUE_PKTS] = rtems_build_name( 'P', 'K', 'T', 'S' ); | |
251 |
|
251 | |||
252 | return 0; |
|
252 | return 0; | |
253 | } |
|
253 | } | |
254 |
|
254 | |||
255 | int create_all_tasks( void ) |
|
255 | int create_all_tasks( void ) | |
256 | { |
|
256 | { | |
257 | rtems_status_code status; |
|
257 | rtems_status_code status; | |
258 |
|
258 | |||
259 | // RECV |
|
259 | // RECV | |
260 | status = rtems_task_create( |
|
260 | status = rtems_task_create( | |
261 | Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE, |
|
261 | Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE, | |
262 | RTEMS_DEFAULT_MODES, |
|
262 | RTEMS_DEFAULT_MODES, | |
263 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV] |
|
263 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV] | |
264 | ); |
|
264 | ); | |
265 | // ACTN |
|
265 | // ACTN | |
266 | status = rtems_task_create( |
|
266 | status = rtems_task_create( | |
267 | Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE, |
|
267 | Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE, | |
268 | RTEMS_DEFAULT_MODES, |
|
268 | RTEMS_DEFAULT_MODES, | |
269 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN] |
|
269 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN] | |
270 | ); |
|
270 | ); | |
271 | // SPIQ |
|
271 | // SPIQ | |
272 | status = rtems_task_create( |
|
272 | status = rtems_task_create( | |
273 | Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE, |
|
273 | Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE, | |
274 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
274 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, | |
275 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ] |
|
275 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ] | |
276 | ); |
|
276 | ); | |
277 | // SMIQ |
|
277 | // SMIQ | |
278 | status = rtems_task_create( |
|
278 | status = rtems_task_create( | |
279 | Task_name[TASKID_SMIQ], TASK_PRIORITY_SMIQ, RTEMS_MINIMUM_STACK_SIZE, |
|
279 | Task_name[TASKID_SMIQ], TASK_PRIORITY_SMIQ, RTEMS_MINIMUM_STACK_SIZE, | |
280 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
280 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, | |
281 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SMIQ] |
|
281 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SMIQ] | |
282 | ); |
|
282 | ); | |
283 | // STAT |
|
283 | // STAT | |
284 | status = rtems_task_create( |
|
284 | status = rtems_task_create( | |
285 | Task_name[TASKID_STAT], TASK_PRIORITY_STAT, RTEMS_MINIMUM_STACK_SIZE, |
|
285 | Task_name[TASKID_STAT], TASK_PRIORITY_STAT, RTEMS_MINIMUM_STACK_SIZE, | |
286 | RTEMS_DEFAULT_MODES, |
|
286 | RTEMS_DEFAULT_MODES, | |
287 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT] |
|
287 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT] | |
288 | ); |
|
288 | ); | |
289 | // AVF0 |
|
289 | // AVF0 | |
290 | status = rtems_task_create( |
|
290 | status = rtems_task_create( | |
291 | Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE, |
|
291 | Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE, | |
292 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
292 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, | |
293 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0] |
|
293 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0] | |
294 | ); |
|
294 | ); | |
295 | // BPF0 |
|
295 | // BPF0 | |
296 | status = rtems_task_create( |
|
296 | status = rtems_task_create( | |
297 | Task_name[TASKID_BPF0], TASK_PRIORITY_BPF0, RTEMS_MINIMUM_STACK_SIZE, |
|
297 | Task_name[TASKID_BPF0], TASK_PRIORITY_BPF0, RTEMS_MINIMUM_STACK_SIZE, | |
298 | RTEMS_DEFAULT_MODES, |
|
298 | RTEMS_DEFAULT_MODES, | |
299 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_BPF0] |
|
299 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_BPF0] | |
300 | ); |
|
300 | ); | |
301 | // WFRM |
|
301 | // WFRM | |
302 | status = rtems_task_create( |
|
302 | status = rtems_task_create( | |
303 | Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE, |
|
303 | Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE, | |
304 | RTEMS_DEFAULT_MODES, |
|
304 | RTEMS_DEFAULT_MODES, | |
305 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM] |
|
305 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM] | |
306 | ); |
|
306 | ); | |
307 | // DUMB |
|
307 | // DUMB | |
308 | status = rtems_task_create( |
|
308 | status = rtems_task_create( | |
309 | Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE, |
|
309 | Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE, | |
310 | RTEMS_DEFAULT_MODES, |
|
310 | RTEMS_DEFAULT_MODES, | |
311 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB] |
|
311 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB] | |
312 | ); |
|
312 | ); | |
313 | // HOUS |
|
313 | // HOUS | |
314 | status = rtems_task_create( |
|
314 | status = rtems_task_create( | |
315 | Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE, |
|
315 | Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE, | |
316 | RTEMS_DEFAULT_MODES, |
|
316 | RTEMS_DEFAULT_MODES, | |
317 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS] |
|
317 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS] | |
318 | ); |
|
318 | ); | |
319 | // MATR |
|
319 | // MATR | |
320 | status = rtems_task_create( |
|
320 | status = rtems_task_create( | |
321 | Task_name[TASKID_MATR], TASK_PRIORITY_MATR, RTEMS_MINIMUM_STACK_SIZE, |
|
321 | Task_name[TASKID_MATR], TASK_PRIORITY_MATR, RTEMS_MINIMUM_STACK_SIZE, | |
322 | RTEMS_DEFAULT_MODES, |
|
322 | RTEMS_DEFAULT_MODES, | |
323 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_MATR] |
|
323 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_MATR] | |
324 | ); |
|
324 | ); | |
325 | // CWF3 |
|
325 | // CWF3 | |
326 | status = rtems_task_create( |
|
326 | status = rtems_task_create( | |
327 | Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE, |
|
327 | Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE, | |
328 | RTEMS_DEFAULT_MODES, |
|
328 | RTEMS_DEFAULT_MODES, | |
329 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF3] |
|
329 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF3] | |
330 | ); |
|
330 | ); | |
331 | // CWF2 |
|
331 | // CWF2 | |
332 | status = rtems_task_create( |
|
332 | status = rtems_task_create( | |
333 | Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE, |
|
333 | Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE, | |
334 | RTEMS_DEFAULT_MODES, |
|
334 | RTEMS_DEFAULT_MODES, | |
335 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF2] |
|
335 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF2] | |
336 | ); |
|
336 | ); | |
337 | // CWF1 |
|
337 | // CWF1 | |
338 | status = rtems_task_create( |
|
338 | status = rtems_task_create( | |
339 | Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE, |
|
339 | Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE, | |
340 | RTEMS_DEFAULT_MODES, |
|
340 | RTEMS_DEFAULT_MODES, | |
341 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF1] |
|
341 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF1] | |
342 | ); |
|
342 | ); | |
343 | // SEND |
|
343 | // SEND | |
344 | status = rtems_task_create( |
|
344 | status = rtems_task_create( | |
345 | Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE, |
|
345 | Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE, | |
346 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
346 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, | |
347 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SEND] |
|
347 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SEND] | |
348 | ); |
|
348 | ); | |
349 |
|
349 | |||
350 | return 0; |
|
350 | return 0; | |
351 | } |
|
351 | } | |
352 |
|
352 | |||
353 | int start_all_tasks( void ) |
|
353 | int start_all_tasks( void ) | |
354 | { |
|
354 | { | |
355 | rtems_status_code status; |
|
355 | rtems_status_code status; | |
356 |
|
356 | |||
357 | status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 ); |
|
357 | status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 ); | |
358 | if (status!=RTEMS_SUCCESSFUL) { |
|
358 | if (status!=RTEMS_SUCCESSFUL) { | |
359 | BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n") |
|
359 | BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n") | |
360 | } |
|
360 | } | |
361 |
|
361 | |||
362 | status = rtems_task_start( Task_id[TASKID_SMIQ], smiq_task, 1 ); |
|
362 | status = rtems_task_start( Task_id[TASKID_SMIQ], smiq_task, 1 ); | |
363 | if (status!=RTEMS_SUCCESSFUL) { |
|
363 | if (status!=RTEMS_SUCCESSFUL) { | |
364 | BOOT_PRINTF("in INIT *** Error starting TASK_BPPR\n") |
|
364 | BOOT_PRINTF("in INIT *** Error starting TASK_BPPR\n") | |
365 | } |
|
365 | } | |
366 |
|
366 | |||
367 | status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 ); |
|
367 | status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 ); | |
368 | if (status!=RTEMS_SUCCESSFUL) { |
|
368 | if (status!=RTEMS_SUCCESSFUL) { | |
369 | BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n") |
|
369 | BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n") | |
370 | } |
|
370 | } | |
371 |
|
371 | |||
372 | status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 ); |
|
372 | status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 ); | |
373 | if (status!=RTEMS_SUCCESSFUL) { |
|
373 | if (status!=RTEMS_SUCCESSFUL) { | |
374 | BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n") |
|
374 | BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n") | |
375 | } |
|
375 | } | |
376 |
|
376 | |||
377 | status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 ); |
|
377 | status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 ); | |
378 | if (status!=RTEMS_SUCCESSFUL) { |
|
378 | if (status!=RTEMS_SUCCESSFUL) { | |
379 | BOOT_PRINTF("in INIT *** Error starting TASK_ACTN\n") |
|
379 | BOOT_PRINTF("in INIT *** Error starting TASK_ACTN\n") | |
380 | } |
|
380 | } | |
381 |
|
381 | |||
382 | status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 ); |
|
382 | status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 ); | |
383 | if (status!=RTEMS_SUCCESSFUL) { |
|
383 | if (status!=RTEMS_SUCCESSFUL) { | |
384 | BOOT_PRINTF("in INIT *** Error starting TASK_STAT\n") |
|
384 | BOOT_PRINTF("in INIT *** Error starting TASK_STAT\n") | |
385 | } |
|
385 | } | |
386 |
|
386 | |||
387 | status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, 1 ); |
|
387 | status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, 1 ); | |
388 | if (status!=RTEMS_SUCCESSFUL) { |
|
388 | if (status!=RTEMS_SUCCESSFUL) { | |
389 | BOOT_PRINTF("in INIT *** Error starting TASK_AVF0\n") |
|
389 | BOOT_PRINTF("in INIT *** Error starting TASK_AVF0\n") | |
390 | } |
|
390 | } | |
391 |
|
391 | |||
392 | status = rtems_task_start( Task_id[TASKID_BPF0], bpf0_task, 1 ); |
|
392 | status = rtems_task_start( Task_id[TASKID_BPF0], bpf0_task, 1 ); | |
393 | if (status!=RTEMS_SUCCESSFUL) { |
|
393 | if (status!=RTEMS_SUCCESSFUL) { | |
394 | BOOT_PRINTF("in INIT *** Error starting TASK_BPF0\n") |
|
394 | BOOT_PRINTF("in INIT *** Error starting TASK_BPF0\n") | |
395 | } |
|
395 | } | |
396 |
|
396 | |||
397 | status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 ); |
|
397 | status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 ); | |
398 | if (status!=RTEMS_SUCCESSFUL) { |
|
398 | if (status!=RTEMS_SUCCESSFUL) { | |
399 | BOOT_PRINTF("in INIT *** Error starting TASK_WFRM\n") |
|
399 | BOOT_PRINTF("in INIT *** Error starting TASK_WFRM\n") | |
400 | } |
|
400 | } | |
401 |
|
401 | |||
402 | status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 ); |
|
402 | status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 ); | |
403 | if (status!=RTEMS_SUCCESSFUL) { |
|
403 | if (status!=RTEMS_SUCCESSFUL) { | |
404 | BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n") |
|
404 | BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n") | |
405 | } |
|
405 | } | |
406 |
|
406 | |||
407 | status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 ); |
|
407 | status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 ); | |
408 | if (status!=RTEMS_SUCCESSFUL) { |
|
408 | if (status!=RTEMS_SUCCESSFUL) { | |
409 | BOOT_PRINTF("in INIT *** Error starting TASK_HOUS\n") |
|
409 | BOOT_PRINTF("in INIT *** Error starting TASK_HOUS\n") | |
410 | } |
|
410 | } | |
411 |
|
411 | |||
412 | status = rtems_task_start( Task_id[TASKID_MATR], matr_task, 1 ); |
|
412 | status = rtems_task_start( Task_id[TASKID_MATR], matr_task, 1 ); | |
413 | if (status!=RTEMS_SUCCESSFUL) { |
|
413 | if (status!=RTEMS_SUCCESSFUL) { | |
414 | BOOT_PRINTF("in INIT *** Error starting TASK_MATR\n") |
|
414 | BOOT_PRINTF("in INIT *** Error starting TASK_MATR\n") | |
415 | } |
|
415 | } | |
416 |
|
416 | |||
417 | status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 ); |
|
417 | status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 ); | |
418 | if (status!=RTEMS_SUCCESSFUL) { |
|
418 | if (status!=RTEMS_SUCCESSFUL) { | |
419 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF3\n") |
|
419 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF3\n") | |
420 | } |
|
420 | } | |
421 |
|
421 | |||
422 | status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 ); |
|
422 | status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 ); | |
423 | if (status!=RTEMS_SUCCESSFUL) { |
|
423 | if (status!=RTEMS_SUCCESSFUL) { | |
424 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF2\n") |
|
424 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF2\n") | |
425 | } |
|
425 | } | |
426 |
|
426 | |||
427 | status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 ); |
|
427 | status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 ); | |
428 | if (status!=RTEMS_SUCCESSFUL) { |
|
428 | if (status!=RTEMS_SUCCESSFUL) { | |
429 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF1\n") |
|
429 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF1\n") | |
430 | } |
|
430 | } | |
431 |
|
431 | |||
432 | return 0; |
|
432 | return 0; | |
433 | } |
|
433 | } | |
434 |
|
434 | |||
435 | rtems_status_code create_message_queues( void ) |
|
435 | rtems_status_code create_message_queues( void ) | |
436 | { |
|
436 | { | |
437 | rtems_status_code status; |
|
437 | rtems_status_code status; | |
438 | rtems_status_code ret; |
|
438 | rtems_status_code ret; | |
439 | rtems_id queue_id; |
|
439 | rtems_id queue_id; | |
440 |
|
440 | |||
441 |
ret = rtems_message_queue_create( misc_name[QUEUE_PKTS], ACTION_MSG_PKTS_COUNT, |
|
441 | ret = rtems_message_queue_create( misc_name[QUEUE_PKTS], ACTION_MSG_PKTS_COUNT, | |
442 |
|
|
442 | ACTION_MSG_PKTS_MAX_SIZE, | |
|
443 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); | |||
443 | if (ret != RTEMS_SUCCESSFUL) { |
|
444 | if (ret != RTEMS_SUCCESSFUL) { | |
444 | BOOT_PRINTF1("in create_message_queues *** ERR creating PKTS queue, %d\n", ret) |
|
445 | BOOT_PRINTF1("in create_message_queues *** ERR creating PKTS queue, %d\n", ret) | |
445 | } |
|
446 | } | |
446 |
|
447 | |||
447 | status = rtems_message_queue_create( misc_name[QUEUE_QUEU], ACTION_MSG_QUEUE_COUNT, CCSDS_TC_PKT_MAX_SIZE, |
|
448 | status = rtems_message_queue_create( misc_name[QUEUE_QUEU], ACTION_MSG_QUEUE_COUNT, CCSDS_TC_PKT_MAX_SIZE, | |
448 |
|
|
449 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); | |
449 | if (status != RTEMS_SUCCESSFUL) { |
|
450 | if (status != RTEMS_SUCCESSFUL) { | |
450 | ret = status; |
|
451 | ret = status; | |
451 | BOOT_PRINTF1("in create_message_queues *** ERR creating QUEU queue, %d\n", ret) |
|
452 | BOOT_PRINTF1("in create_message_queues *** ERR creating QUEU queue, %d\n", ret) | |
452 | } |
|
453 | } | |
453 |
|
454 | |||
454 | return ret; |
|
455 | return ret; | |
455 | } |
|
456 | } |
@@ -1,313 +1,325 | |||||
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 *** ERR rtems_interrupt_catch\n") |
|
13 | PRINTF("in configure_timer *** ERR rtems_interrupt_catch\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 | BOOT_PRINTF1("OK *** apbuart port scaler reload register set to 0x%x\n", value) |
|
128 | BOOT_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 | BOOT_PRINTF("in STAT *** \n") |
|
142 | BOOT_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 | rtems_id queue_id; |
|
162 | rtems_id queue_id; | |
163 |
|
163 | |||
164 | spw_ioctl_send.hlen = 0; |
|
164 | spw_ioctl_send.hlen = 0; | |
165 | spw_ioctl_send.hdr = NULL; |
|
165 | spw_ioctl_send.hdr = NULL; | |
166 | spw_ioctl_send.dlen = PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
166 | spw_ioctl_send.dlen = PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; | |
167 | spw_ioctl_send.data = (char*) &housekeeping_packet; |
|
167 | spw_ioctl_send.data = (char*) &housekeeping_packet; | |
168 | spw_ioctl_send.options = 0; |
|
168 | spw_ioctl_send.options = 0; | |
169 |
|
169 | |||
170 | status = rtems_message_queue_ident( misc_name[QUEUE_PKTS], 0, &queue_id ); |
|
170 | status = rtems_message_queue_ident( misc_name[QUEUE_PKTS], 0, &queue_id ); | |
171 | if (status != RTEMS_SUCCESSFUL) |
|
171 | if (status != RTEMS_SUCCESSFUL) | |
172 | { |
|
172 | { | |
173 | PRINTF1("in HOUS *** ERR %d\n", status) |
|
173 | PRINTF1("in HOUS *** ERR %d\n", status) | |
174 | } |
|
174 | } | |
175 |
|
175 | |||
176 | BOOT_PRINTF("in HOUS ***\n") |
|
176 | BOOT_PRINTF("in HOUS ***\n") | |
177 |
|
177 | |||
178 | if (rtems_rate_monotonic_ident( HK_name, &HK_id) != RTEMS_SUCCESSFUL) { |
|
178 | if (rtems_rate_monotonic_ident( HK_name, &HK_id) != RTEMS_SUCCESSFUL) { | |
179 | status = rtems_rate_monotonic_create( HK_name, &HK_id ); |
|
179 | status = rtems_rate_monotonic_create( HK_name, &HK_id ); | |
180 | if( status != RTEMS_SUCCESSFUL ) { |
|
180 | if( status != RTEMS_SUCCESSFUL ) { | |
181 | PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status ) |
|
181 | PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status ) | |
182 | } |
|
182 | } | |
183 | } |
|
183 | } | |
184 |
|
184 | |||
185 | housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
185 | housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; | |
186 | housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
186 | housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
187 | housekeeping_packet.reserved = DEFAULT_RESERVED; |
|
187 | housekeeping_packet.reserved = DEFAULT_RESERVED; | |
188 | housekeeping_packet.userApplication = CCSDS_USER_APP; |
|
188 | housekeeping_packet.userApplication = CCSDS_USER_APP; | |
189 | housekeeping_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_HK >> 8); |
|
189 | housekeeping_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_HK >> 8); | |
190 | housekeeping_packet.packetID[1] = (unsigned char) (TM_PACKET_ID_HK); |
|
190 | housekeeping_packet.packetID[1] = (unsigned char) (TM_PACKET_ID_HK); | |
191 | housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
191 | housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
192 | housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
192 | housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
193 | housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8); |
|
193 | housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8); | |
194 | housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK ); |
|
194 | housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK ); | |
195 | housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
195 | housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
196 | housekeeping_packet.serviceType = TM_TYPE_HK; |
|
196 | housekeeping_packet.serviceType = TM_TYPE_HK; | |
197 | housekeeping_packet.serviceSubType = TM_SUBTYPE_HK; |
|
197 | housekeeping_packet.serviceSubType = TM_SUBTYPE_HK; | |
198 | housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND; |
|
198 | housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND; | |
199 |
|
199 | |||
200 | status = rtems_rate_monotonic_cancel(HK_id); |
|
200 | status = rtems_rate_monotonic_cancel(HK_id); | |
201 | if( status != RTEMS_SUCCESSFUL ) { |
|
201 | if( status != RTEMS_SUCCESSFUL ) { | |
202 | PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status ) |
|
202 | PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status ) | |
203 | } |
|
203 | } | |
204 | else { |
|
204 | else { | |
205 | DEBUG_PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n") |
|
205 | DEBUG_PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n") | |
206 | } |
|
206 | } | |
207 |
|
207 | |||
208 | while(1){ // launch the rate monotonic task |
|
208 | while(1){ // launch the rate monotonic task | |
209 | status = rtems_rate_monotonic_period( HK_id, HK_PERIOD ); |
|
209 | status = rtems_rate_monotonic_period( HK_id, HK_PERIOD ); | |
210 | if ( status != RTEMS_SUCCESSFUL ) { |
|
210 | if ( status != RTEMS_SUCCESSFUL ) { | |
211 | PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_period *** code %d\n", status); |
|
211 | PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_period *** code %d\n", status); | |
212 | } |
|
212 | } | |
213 | else { |
|
213 | else { | |
214 | housekeeping_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
214 | housekeeping_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
215 | housekeeping_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
215 | housekeeping_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
216 | housekeeping_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
216 | housekeeping_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
217 | housekeeping_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
217 | housekeeping_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); | |
218 | housekeeping_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
218 | housekeeping_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
219 | housekeeping_packet.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
219 | housekeeping_packet.time[5] = (unsigned char) (time_management_regs->fine_time); | |
220 | housekeeping_packet.sid = SID_HK; |
|
220 | housekeeping_packet.sid = SID_HK; | |
221 |
|
221 | |||
222 | update_spacewire_statistics(); |
|
222 | update_spacewire_statistics(); | |
223 |
|
223 | |||
224 | // SEND PACKET |
|
224 | // SEND PACKET | |
225 |
status = rtems_message_queue_send( queue_id, &spw_ioctl_send, ACTION_MSG_ |
|
225 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE); | |
226 | if (status != RTEMS_SUCCESSFUL) { |
|
226 | if (status != RTEMS_SUCCESSFUL) { | |
227 | PRINTF1("in HOUS *** ERR %d\n", status) |
|
227 | PRINTF1("in HOUS *** ERR %d\n", status) | |
228 | } |
|
228 | } | |
229 | } |
|
229 | } | |
230 | } |
|
230 | } | |
231 |
|
231 | |||
232 | PRINTF("in HOUS *** deleting task\n") |
|
232 | PRINTF("in HOUS *** deleting task\n") | |
233 |
|
233 | |||
234 | status = rtems_task_delete( RTEMS_SELF ); // should not return |
|
234 | status = rtems_task_delete( RTEMS_SELF ); // should not return | |
235 | printf( "rtems_task_delete returned with status of %d.\n", status ); |
|
235 | printf( "rtems_task_delete returned with status of %d.\n", status ); | |
236 | exit( 1 ); |
|
236 | exit( 1 ); | |
237 | } |
|
237 | } | |
238 |
|
238 | |||
239 | rtems_task send_task( rtems_task_argument argument) |
|
239 | rtems_task send_task( rtems_task_argument argument) | |
240 | { |
|
240 | { | |
241 | rtems_status_code status; // RTEMS status code |
|
241 | rtems_status_code status; // RTEMS status code | |
242 | spw_ioctl_pkt_send spw_ioctl_send; // incoming spw_ioctl_pkt_send structure |
|
242 | char incomingData[ACTION_MSG_PKTS_MAX_SIZE]; // incoming data buffer | |
|
243 | spw_ioctl_pkt_send *spw_ioctl_send; | |||
243 | size_t size; // size of the incoming TC packet |
|
244 | size_t size; // size of the incoming TC packet | |
244 | u_int32_t count; |
|
245 | u_int32_t count; | |
245 | rtems_id queue_id; |
|
246 | rtems_id queue_id; | |
246 |
|
247 | |||
247 | status = rtems_message_queue_ident( misc_name[QUEUE_PKTS], 0, &queue_id ); |
|
248 | status = rtems_message_queue_ident( misc_name[QUEUE_PKTS], 0, &queue_id ); | |
248 | if (status != RTEMS_SUCCESSFUL) |
|
249 | if (status != RTEMS_SUCCESSFUL) | |
249 | { |
|
250 | { | |
250 | PRINTF1("in SEND *** ERR getting queue id, %d\n", status) |
|
251 | PRINTF1("in SEND *** ERR getting queue id, %d\n", status) | |
251 | } |
|
252 | } | |
252 |
|
253 | |||
253 | BOOT_PRINTF("in SEND *** \n") |
|
254 | BOOT_PRINTF("in SEND *** \n") | |
254 |
|
255 | |||
255 | while(1) |
|
256 | while(1) | |
256 | { |
|
257 | { | |
257 |
status = rtems_message_queue_receive( queue_id, |
|
258 | status = rtems_message_queue_receive( queue_id, incomingData, &size, | |
258 | RTEMS_WAIT, RTEMS_NO_TIMEOUT ); |
|
259 | RTEMS_WAIT, RTEMS_NO_TIMEOUT ); | |
259 |
|
260 | |||
260 | if (status!=RTEMS_SUCCESSFUL) |
|
261 | if (status!=RTEMS_SUCCESSFUL) | |
261 | { |
|
262 | { | |
262 | PRINTF1("in SEND *** (1) ERR = %d\n", status) |
|
263 | PRINTF1("in SEND *** (1) ERR = %d\n", status) | |
263 | } |
|
264 | } | |
264 | else |
|
265 | else | |
265 | { |
|
266 | { | |
266 | if (spw_ioctl_send.hlen == 0) |
|
267 | if ( incomingData[0] == CCSDS_DESTINATION_ID) // the incoming message is a ccsds packet | |
267 | { |
|
268 | { | |
268 |
status = write( fdSPW, |
|
269 | status = write( fdSPW, incomingData, size ); | |
269 | if (status == -1){ |
|
270 | if (status == -1){ | |
270 |
PRINTF2("in SEND *** (2.a) ERR = %d, |
|
271 | PRINTF2("in SEND *** (2.a) ERR = %d, size = %d\n", status, size) | |
271 | } |
|
272 | } | |
272 | } |
|
273 | } | |
273 | else |
|
274 | else // the incoming message is a spw_ioctl_pkt_send structure | |
274 | { |
|
275 | { | |
275 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, spw_ioctl_send ); |
|
276 | spw_ioctl_send = (spw_ioctl_pkt_send*) incomingData; | |
276 |
if (s |
|
277 | if (spw_ioctl_send->hlen == 0) | |
277 | PRINTF2("in SEND *** (2.b) ERR = %d, dlen = %d\n", status, spw_ioctl_send.dlen) |
|
278 | { | |
278 | PRINTF1(" hlen = %d\n", spw_ioctl_send.hlen) |
|
279 | status = write( fdSPW, spw_ioctl_send->data, spw_ioctl_send->dlen ); | |
|
280 | if (status == -1){ | |||
|
281 | PRINTF2("in SEND *** (2.b) ERR = %d, dlen = %d\n", status, spw_ioctl_send->dlen) | |||
|
282 | } | |||
|
283 | } | |||
|
284 | else | |||
|
285 | { | |||
|
286 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, spw_ioctl_send ); | |||
|
287 | if (status == -1){ | |||
|
288 | PRINTF2("in SEND *** (2.c) ERR = %d, dlen = %d\n", status, spw_ioctl_send->dlen) | |||
|
289 | PRINTF1(" hlen = %d\n", spw_ioctl_send->hlen) | |||
|
290 | } | |||
279 | } |
|
291 | } | |
280 | } |
|
292 | } | |
281 | } |
|
293 | } | |
282 |
|
294 | |||
283 | status = rtems_message_queue_get_number_pending( queue_id, &count ); |
|
295 | status = rtems_message_queue_get_number_pending( queue_id, &count ); | |
284 | if (status != RTEMS_SUCCESSFUL) |
|
296 | if (status != RTEMS_SUCCESSFUL) | |
285 | { |
|
297 | { | |
286 | PRINTF1("in SEND *** (3) ERR = %d\n", status) |
|
298 | PRINTF1("in SEND *** (3) ERR = %d\n", status) | |
287 | } |
|
299 | } | |
288 | else |
|
300 | else | |
289 | { |
|
301 | { | |
290 | if (count > maxCount) |
|
302 | if (count > maxCount) | |
291 | { |
|
303 | { | |
292 | maxCount = count; |
|
304 | maxCount = count; | |
293 | } |
|
305 | } | |
294 | } |
|
306 | } | |
295 | } |
|
307 | } | |
296 | } |
|
308 | } | |
297 |
|
309 | |||
298 | rtems_id get_pkts_queue_id( void ) |
|
310 | rtems_id get_pkts_queue_id( void ) | |
299 | { |
|
311 | { | |
300 | rtems_id queue_id; |
|
312 | rtems_id queue_id; | |
301 | rtems_status_code status; |
|
313 | rtems_status_code status; | |
302 |
|
314 | |||
303 | status = rtems_message_queue_ident( misc_name[QUEUE_PKTS], 0, &queue_id ); |
|
315 | status = rtems_message_queue_ident( misc_name[QUEUE_PKTS], 0, &queue_id ); | |
304 | if (status != RTEMS_SUCCESSFUL) |
|
316 | if (status != RTEMS_SUCCESSFUL) | |
305 | { |
|
317 | { | |
306 | PRINTF1("in get_pkts_queue_id *** ERR %d\n", status) |
|
318 | PRINTF1("in get_pkts_queue_id *** ERR %d\n", status) | |
307 | } |
|
319 | } | |
308 | return queue_id; |
|
320 | return queue_id; | |
309 | } |
|
321 | } | |
310 |
|
322 | |||
311 |
|
323 | |||
312 |
|
324 | |||
313 |
|
325 |
@@ -1,688 +1,688 | |||||
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 ) |
|
84 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ) | |
85 | { |
|
85 | { | |
86 | if (rtems_event_send( Task_id[TASKID_SMIQ], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
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 ); |
|
87 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_4 ); | |
88 | } |
|
88 | } | |
89 | } |
|
89 | } | |
90 |
|
90 | |||
91 | //************ |
|
91 | //************ | |
92 | // RTEMS TASKS |
|
92 | // RTEMS TASKS | |
93 |
|
93 | |||
94 | 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 | |
95 | { |
|
95 | { | |
96 | rtems_event_set event_out; |
|
96 | rtems_event_set event_out; | |
97 | unsigned int nb_interrupt_f0 = 0; |
|
97 | unsigned int nb_interrupt_f0 = 0; | |
98 |
|
98 | |||
99 | BOOT_PRINTF("in SMIQ *** \n") |
|
99 | BOOT_PRINTF("in SMIQ *** \n") | |
100 |
|
100 | |||
101 | while(1){ |
|
101 | while(1){ | |
102 | 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 | |
103 | nb_interrupt_f0 = nb_interrupt_f0 + 1; |
|
103 | nb_interrupt_f0 = nb_interrupt_f0 + 1; | |
104 | if (nb_interrupt_f0 == NB_SM_TO_RECEIVE_BEFORE_AVF0 ){ |
|
104 | if (nb_interrupt_f0 == NB_SM_TO_RECEIVE_BEFORE_AVF0 ){ | |
105 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
105 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |
106 | { |
|
106 | { | |
107 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
107 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |
108 | } |
|
108 | } | |
109 | nb_interrupt_f0 = 0; |
|
109 | nb_interrupt_f0 = 0; | |
110 | } |
|
110 | } | |
111 | } |
|
111 | } | |
112 | } |
|
112 | } | |
113 |
|
113 | |||
114 | //rtems_task smiq_task(rtems_task_argument argument) // process the Spectral Matrices IRQ |
|
114 | //rtems_task smiq_task(rtems_task_argument argument) // process the Spectral Matrices IRQ | |
115 | //{ |
|
115 | //{ | |
116 | // rtems_event_set event_out; |
|
116 | // rtems_event_set event_out; | |
117 | // unsigned int nb_interrupt_f0 = 0; |
|
117 | // unsigned int nb_interrupt_f0 = 0; | |
118 |
|
118 | |||
119 | // PRINTF("in SMIQ *** \n") |
|
119 | // PRINTF("in SMIQ *** \n") | |
120 |
|
120 | |||
121 | // while(1){ |
|
121 | // while(1){ | |
122 | // rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
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; |
|
123 | // nb_interrupt_f0 = nb_interrupt_f0 + 1; | |
124 | // if (nb_interrupt_f0 == param_local.local_nb_interrupt_f0_MAX ){ |
|
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) |
|
125 | // if (rtems_event_send( Task_id[TASKID_MATR], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |
126 | // { |
|
126 | // { | |
127 | // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
127 | // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |
128 | // } |
|
128 | // } | |
129 | // nb_interrupt_f0 = 0; |
|
129 | // nb_interrupt_f0 = 0; | |
130 | // } |
|
130 | // } | |
131 | // } |
|
131 | // } | |
132 | //} |
|
132 | //} | |
133 |
|
133 | |||
134 | rtems_task spw_bppr_task(rtems_task_argument argument) |
|
134 | rtems_task spw_bppr_task(rtems_task_argument argument) | |
135 | { |
|
135 | { | |
136 | rtems_status_code status; |
|
136 | rtems_status_code status; | |
137 | rtems_event_set event_out; |
|
137 | rtems_event_set event_out; | |
138 | static int Nb_average_f0 = 0; |
|
138 | static int Nb_average_f0 = 0; | |
139 | //static int nb_average_f1 = 0; |
|
139 | //static int nb_average_f1 = 0; | |
140 | //static int nb_average_f2 = 0; |
|
140 | //static int nb_average_f2 = 0; | |
141 |
|
141 | |||
142 | BOOT_PRINTF("in BPPR ***\n"); |
|
142 | BOOT_PRINTF("in BPPR ***\n"); | |
143 |
|
143 | |||
144 | while(true){ // wait for an event to begin with the processing |
|
144 | while(true){ // wait for an event to begin with the processing | |
145 | 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); | |
146 | if (status == RTEMS_SUCCESSFUL) { |
|
146 | if (status == RTEMS_SUCCESSFUL) { | |
147 | if ((spectral_matrix_regs->status & 0x00000001)==1) { |
|
147 | if ((spectral_matrix_regs->status & 0x00000001)==1) { | |
148 | matrix_average(spec_mat_f0_0, averaged_spec_mat_f0); |
|
148 | matrix_average(spec_mat_f0_0, averaged_spec_mat_f0); | |
149 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe; |
|
149 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe; | |
150 | //printf("f0_a\n"); |
|
150 | //printf("f0_a\n"); | |
151 | Nb_average_f0++; |
|
151 | Nb_average_f0++; | |
152 | } |
|
152 | } | |
153 | if (((spectral_matrix_regs->status>>1) & 0x00000001)==1) { |
|
153 | if (((spectral_matrix_regs->status>>1) & 0x00000001)==1) { | |
154 | matrix_average(spec_mat_f0_1, compressed_spec_mat_f0); |
|
154 | matrix_average(spec_mat_f0_1, compressed_spec_mat_f0); | |
155 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd; |
|
155 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd; | |
156 | //printf("f0_b\n"); |
|
156 | //printf("f0_b\n"); | |
157 | Nb_average_f0++; |
|
157 | Nb_average_f0++; | |
158 | } |
|
158 | } | |
159 | if (Nb_average_f0 == NB_AVERAGE_NORMAL_f0) { |
|
159 | if (Nb_average_f0 == NB_AVERAGE_NORMAL_f0) { | |
160 | matrix_compression(averaged_spec_mat_f0, 0, compressed_spec_mat_f0); |
|
160 | matrix_compression(averaged_spec_mat_f0, 0, compressed_spec_mat_f0); | |
161 | //printf("f0 compressed\n"); |
|
161 | //printf("f0 compressed\n"); | |
162 | Nb_average_f0 = 0; |
|
162 | Nb_average_f0 = 0; | |
163 | matrix_reset(averaged_spec_mat_f0); |
|
163 | matrix_reset(averaged_spec_mat_f0); | |
164 | } |
|
164 | } | |
165 | } |
|
165 | } | |
166 | } |
|
166 | } | |
167 | } |
|
167 | } | |
168 |
|
168 | |||
169 | rtems_task avf0_task(rtems_task_argument argument) |
|
169 | rtems_task avf0_task(rtems_task_argument argument) | |
170 | { |
|
170 | { | |
171 | int i; |
|
171 | int i; | |
172 | static int nb_average; |
|
172 | static int nb_average; | |
173 | rtems_event_set event_out; |
|
173 | rtems_event_set event_out; | |
174 | rtems_status_code status; |
|
174 | rtems_status_code status; | |
175 |
|
175 | |||
176 | nb_average = 0; |
|
176 | nb_average = 0; | |
177 |
|
177 | |||
178 | BOOT_PRINTF("in AVFO *** \n") |
|
178 | BOOT_PRINTF("in AVFO *** \n") | |
179 |
|
179 | |||
180 | while(1){ |
|
180 | while(1){ | |
181 | 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 | |
182 | for(i=0; i<TOTAL_SIZE_SM; i++){ |
|
182 | for(i=0; i<TOTAL_SIZE_SM; i++){ | |
183 | 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] | |
184 | + spec_mat_f0_b[i] |
|
184 | + spec_mat_f0_b[i] | |
185 | + spec_mat_f0_c[i] |
|
185 | + spec_mat_f0_c[i] | |
186 | + spec_mat_f0_d[i] |
|
186 | + spec_mat_f0_d[i] | |
187 | + spec_mat_f0_e[i] |
|
187 | + spec_mat_f0_e[i] | |
188 | + spec_mat_f0_f[i] |
|
188 | + spec_mat_f0_f[i] | |
189 | + spec_mat_f0_g[i] |
|
189 | + spec_mat_f0_g[i] | |
190 | + spec_mat_f0_h[i]; |
|
190 | + spec_mat_f0_h[i]; | |
191 | } |
|
191 | } | |
192 | nb_average = nb_average + NB_SM_TO_RECEIVE_BEFORE_AVF0; |
|
192 | nb_average = nb_average + NB_SM_TO_RECEIVE_BEFORE_AVF0; | |
193 | if (nb_average == NB_AVERAGE_NORMAL_f0) { |
|
193 | if (nb_average == NB_AVERAGE_NORMAL_f0) { | |
194 | nb_average = 0; |
|
194 | nb_average = 0; | |
195 | 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 | |
196 | if (status != RTEMS_SUCCESSFUL) { |
|
196 | if (status != RTEMS_SUCCESSFUL) { | |
197 | 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); | |
198 | } |
|
198 | } | |
199 | } |
|
199 | } | |
200 | } |
|
200 | } | |
201 | } |
|
201 | } | |
202 |
|
202 | |||
203 | rtems_task bpf0_task(rtems_task_argument argument) |
|
203 | rtems_task bpf0_task(rtems_task_argument argument) | |
204 | { |
|
204 | { | |
205 | rtems_event_set event_out; |
|
205 | rtems_event_set event_out; | |
206 |
|
206 | |||
207 | BOOT_PRINTF("in BPFO *** \n") |
|
207 | BOOT_PRINTF("in BPFO *** \n") | |
208 |
|
208 | |||
209 | while(1){ |
|
209 | while(1){ | |
210 | 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 | |
211 | matrix_compression(averaged_spec_mat_f0, 0, compressed_spec_mat_f0); |
|
211 | matrix_compression(averaged_spec_mat_f0, 0, compressed_spec_mat_f0); | |
212 | 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); | |
213 | //PRINTF("IN TASK BPF0 *** Matrix compressed, parameters calculated\n") |
|
213 | //PRINTF("IN TASK BPF0 *** Matrix compressed, parameters calculated\n") | |
214 | } |
|
214 | } | |
215 | } |
|
215 | } | |
216 |
|
216 | |||
217 | rtems_task matr_task(rtems_task_argument argument) |
|
217 | rtems_task matr_task(rtems_task_argument argument) | |
218 | { |
|
218 | { | |
219 | spw_ioctl_pkt_send spw_ioctl_send_ASM; |
|
219 | spw_ioctl_pkt_send spw_ioctl_send_ASM; | |
220 | rtems_event_set event_out; |
|
220 | rtems_event_set event_out; | |
221 | rtems_status_code status; |
|
221 | rtems_status_code status; | |
222 | rtems_id queue_id; |
|
222 | rtems_id queue_id; | |
223 | Header_TM_LFR_SCIENCE_ASM_t headerASM; |
|
223 | Header_TM_LFR_SCIENCE_ASM_t headerASM; | |
224 |
|
224 | |||
225 | init_header_asm( &headerASM ); |
|
225 | init_header_asm( &headerASM ); | |
226 |
|
226 | |||
227 | status = rtems_message_queue_ident( misc_name[QUEUE_PKTS], 0, &queue_id ); |
|
227 | status = rtems_message_queue_ident( misc_name[QUEUE_PKTS], 0, &queue_id ); | |
228 | if (status != RTEMS_SUCCESSFUL) |
|
228 | if (status != RTEMS_SUCCESSFUL) | |
229 | { |
|
229 | { | |
230 | PRINTF1("in MATR *** ERR getting queue id, %d\n", status) |
|
230 | PRINTF1("in MATR *** ERR getting queue id, %d\n", status) | |
231 | } |
|
231 | } | |
232 |
|
232 | |||
233 | BOOT_PRINTF("in MATR *** \n") |
|
233 | BOOT_PRINTF("in MATR *** \n") | |
234 |
|
234 | |||
235 | fill_averaged_spectral_matrix( ); |
|
235 | fill_averaged_spectral_matrix( ); | |
236 |
|
236 | |||
237 | while(1){ |
|
237 | while(1){ | |
238 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
238 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 | |
239 |
|
239 | |||
240 | #ifdef GSA |
|
240 | #ifdef GSA | |
241 | #else |
|
241 | #else | |
242 | fill_averaged_spectral_matrix( ); |
|
242 | fill_averaged_spectral_matrix( ); | |
243 | #endif |
|
243 | #endif | |
244 | convert_averaged_spectral_matrix( averaged_spec_mat_f0, averaged_spec_mat_f0_char); |
|
244 | convert_averaged_spectral_matrix( averaged_spec_mat_f0, averaged_spec_mat_f0_char); | |
245 |
|
245 | |||
246 | send_spectral_matrix( &headerASM, averaged_spec_mat_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id); |
|
246 | send_spectral_matrix( &headerASM, averaged_spec_mat_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id); | |
247 | } |
|
247 | } | |
248 | } |
|
248 | } | |
249 |
|
249 | |||
250 | //***************************** |
|
250 | //***************************** | |
251 | // Spectral matrices processing |
|
251 | // Spectral matrices processing | |
252 | void matrix_average(volatile int *spec_mat, volatile float *averaged_spec_mat) |
|
252 | void matrix_average(volatile int *spec_mat, volatile float *averaged_spec_mat) | |
253 | { |
|
253 | { | |
254 | int i; |
|
254 | int i; | |
255 | for(i=0; i<TOTAL_SIZE_SM; i++){ |
|
255 | for(i=0; i<TOTAL_SIZE_SM; i++){ | |
256 | averaged_spec_mat[i] = averaged_spec_mat[i] + spec_mat_f0_0[i] |
|
256 | averaged_spec_mat[i] = averaged_spec_mat[i] + spec_mat_f0_0[i] | |
257 | + spec_mat_f0_1[i] |
|
257 | + spec_mat_f0_1[i] | |
258 | + spec_mat_f0_c[i] |
|
258 | + spec_mat_f0_c[i] | |
259 | + spec_mat_f0_d[i] |
|
259 | + spec_mat_f0_d[i] | |
260 | + spec_mat_f0_e[i] |
|
260 | + spec_mat_f0_e[i] | |
261 | + spec_mat_f0_f[i] |
|
261 | + spec_mat_f0_f[i] | |
262 | + spec_mat_f0_g[i] |
|
262 | + spec_mat_f0_g[i] | |
263 | + spec_mat_f0_h[i]; |
|
263 | + spec_mat_f0_h[i]; | |
264 | } |
|
264 | } | |
265 | } |
|
265 | } | |
266 |
|
266 | |||
267 | void matrix_reset(volatile float *averaged_spec_mat) |
|
267 | void matrix_reset(volatile float *averaged_spec_mat) | |
268 | { |
|
268 | { | |
269 | // int i; |
|
269 | // int i; | |
270 | // for(i=0; i<TOTAL_SIZE_SM; i++){ |
|
270 | // for(i=0; i<TOTAL_SIZE_SM; i++){ | |
271 | // averaged_spec_mat_f0[i] = 0; |
|
271 | // averaged_spec_mat_f0[i] = 0; | |
272 | // } |
|
272 | // } | |
273 | } |
|
273 | } | |
274 |
|
274 | |||
275 | void matrix_compression(volatile float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat) |
|
275 | void matrix_compression(volatile float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat) | |
276 | { |
|
276 | { | |
277 | int i; |
|
277 | int i; | |
278 | int j; |
|
278 | int j; | |
279 | switch (fChannel){ |
|
279 | switch (fChannel){ | |
280 | case 0: |
|
280 | case 0: | |
281 | for(i=0;i<NB_BINS_COMPRESSED_SM_F0;i++){ |
|
281 | for(i=0;i<NB_BINS_COMPRESSED_SM_F0;i++){ | |
282 | j = 17 + (i * 8); |
|
282 | j = 17 + (i * 8); | |
283 | compressed_spec_mat[i] = (averaged_spec_mat[j] |
|
283 | compressed_spec_mat[i] = (averaged_spec_mat[j] | |
284 | + averaged_spec_mat[j+1] |
|
284 | + averaged_spec_mat[j+1] | |
285 | + averaged_spec_mat[j+2] |
|
285 | + averaged_spec_mat[j+2] | |
286 | + averaged_spec_mat[j+3] |
|
286 | + averaged_spec_mat[j+3] | |
287 | + averaged_spec_mat[j+4] |
|
287 | + averaged_spec_mat[j+4] | |
288 | + averaged_spec_mat[j+5] |
|
288 | + averaged_spec_mat[j+5] | |
289 | + averaged_spec_mat[j+6] |
|
289 | + averaged_spec_mat[j+6] | |
290 | + averaged_spec_mat[j+7])/(8*NB_AVERAGE_NORMAL_f0); |
|
290 | + averaged_spec_mat[j+7])/(8*NB_AVERAGE_NORMAL_f0); | |
291 | } |
|
291 | } | |
292 | break; |
|
292 | break; | |
293 | case 1: |
|
293 | case 1: | |
294 | // case fChannel = f1 to be completed later |
|
294 | // case fChannel = f1 to be completed later | |
295 | break; |
|
295 | break; | |
296 | case 2: |
|
296 | case 2: | |
297 | // case fChannel = f1 to be completed later |
|
297 | // case fChannel = f1 to be completed later | |
298 | break; |
|
298 | break; | |
299 | default: |
|
299 | default: | |
300 | break; |
|
300 | break; | |
301 | } |
|
301 | } | |
302 | } |
|
302 | } | |
303 |
|
303 | |||
304 | void BP1_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1){ |
|
304 | void BP1_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1){ | |
305 | int i; |
|
305 | int i; | |
306 | int j; |
|
306 | int j; | |
307 | unsigned char tmp_u_char; |
|
307 | unsigned char tmp_u_char; | |
308 | unsigned char * pt_char = NULL; |
|
308 | unsigned char * pt_char = NULL; | |
309 | float PSDB, PSDE; |
|
309 | float PSDB, PSDE; | |
310 | float NVEC_V0; |
|
310 | float NVEC_V0; | |
311 | float NVEC_V1; |
|
311 | float NVEC_V1; | |
312 | float NVEC_V2; |
|
312 | float NVEC_V2; | |
313 | //float significand; |
|
313 | //float significand; | |
314 | //int exponent; |
|
314 | //int exponent; | |
315 | float aux; |
|
315 | float aux; | |
316 | float tr_SB_SB; |
|
316 | float tr_SB_SB; | |
317 | float tmp; |
|
317 | float tmp; | |
318 | float sx_re; |
|
318 | float sx_re; | |
319 | float sx_im; |
|
319 | float sx_im; | |
320 | float nebx_re = 0; |
|
320 | float nebx_re = 0; | |
321 | float nebx_im = 0; |
|
321 | float nebx_im = 0; | |
322 | float ny = 0; |
|
322 | float ny = 0; | |
323 | float nz = 0; |
|
323 | float nz = 0; | |
324 | float bx_bx_star = 0; |
|
324 | float bx_bx_star = 0; | |
325 | for(i=0; i<nb_bins_compressed_spec_mat; i++){ |
|
325 | for(i=0; i<nb_bins_compressed_spec_mat; i++){ | |
326 | //============================================== |
|
326 | //============================================== | |
327 | // BP1 PSD == B PAR_LFR_SC_BP1_PE_FL0 == 16 bits |
|
327 | // BP1 PSD == B PAR_LFR_SC_BP1_PE_FL0 == 16 bits | |
328 | PSDB = compressed_spec_mat[i*30] // S11 |
|
328 | PSDB = compressed_spec_mat[i*30] // S11 | |
329 | + compressed_spec_mat[(i*30) + 10] // S22 |
|
329 | + compressed_spec_mat[(i*30) + 10] // S22 | |
330 | + compressed_spec_mat[(i*30) + 18]; // S33 |
|
330 | + compressed_spec_mat[(i*30) + 18]; // S33 | |
331 | //significand = frexp(PSDB, &exponent); |
|
331 | //significand = frexp(PSDB, &exponent); | |
332 | pt_char = (unsigned char*) &PSDB; |
|
332 | pt_char = (unsigned char*) &PSDB; | |
333 | LFR_BP1[(i*9) + 2] = pt_char[0]; // bits 31 downto 24 of the float |
|
333 | LFR_BP1[(i*9) + 2] = pt_char[0]; // bits 31 downto 24 of the float | |
334 | LFR_BP1[(i*9) + 3] = pt_char[1]; // bits 23 downto 16 of the float |
|
334 | LFR_BP1[(i*9) + 3] = pt_char[1]; // bits 23 downto 16 of the float | |
335 | //============================================== |
|
335 | //============================================== | |
336 | // BP1 PSD == E PAR_LFR_SC_BP1_PB_FL0 == 16 bits |
|
336 | // BP1 PSD == E PAR_LFR_SC_BP1_PB_FL0 == 16 bits | |
337 | PSDE = compressed_spec_mat[(i*30) + 24] * K44_pe // S44 |
|
337 | PSDE = compressed_spec_mat[(i*30) + 24] * K44_pe // S44 | |
338 | + compressed_spec_mat[(i*30) + 28] * K55_pe // S55 |
|
338 | + compressed_spec_mat[(i*30) + 28] * K55_pe // S55 | |
339 | + compressed_spec_mat[(i*30) + 26] * K45_pe_re // S45 |
|
339 | + compressed_spec_mat[(i*30) + 26] * K45_pe_re // S45 | |
340 | - compressed_spec_mat[(i*30) + 27] * K45_pe_im; // S45 |
|
340 | - compressed_spec_mat[(i*30) + 27] * K45_pe_im; // S45 | |
341 | pt_char = (unsigned char*) &PSDE; |
|
341 | pt_char = (unsigned char*) &PSDE; | |
342 | LFR_BP1[(i*9) + 0] = pt_char[0]; // bits 31 downto 24 of the float |
|
342 | LFR_BP1[(i*9) + 0] = pt_char[0]; // bits 31 downto 24 of the float | |
343 | LFR_BP1[(i*9) + 1] = pt_char[1]; // bits 23 downto 16 of the float |
|
343 | LFR_BP1[(i*9) + 1] = pt_char[1]; // bits 23 downto 16 of the float | |
344 | //============================================================================== |
|
344 | //============================================================================== | |
345 | // BP1 normal wave vector == PAR_LFR_SC_BP1_NVEC_V0_F0 == 8 bits |
|
345 | // BP1 normal wave vector == PAR_LFR_SC_BP1_NVEC_V0_F0 == 8 bits | |
346 | // == PAR_LFR_SC_BP1_NVEC_V1_F0 == 8 bits |
|
346 | // == PAR_LFR_SC_BP1_NVEC_V1_F0 == 8 bits | |
347 | // == PAR_LFR_SC_BP1_NVEC_V2_F0 == 1 bits |
|
347 | // == PAR_LFR_SC_BP1_NVEC_V2_F0 == 1 bits | |
348 | tmp = sqrt( |
|
348 | tmp = sqrt( | |
349 | compressed_spec_mat[(i*30) + 3]*compressed_spec_mat[(i*30) + 3] //Im S12 |
|
349 | compressed_spec_mat[(i*30) + 3]*compressed_spec_mat[(i*30) + 3] //Im S12 | |
350 | +compressed_spec_mat[(i*30) + 5]*compressed_spec_mat[(i*30) + 5] //Im S13 |
|
350 | +compressed_spec_mat[(i*30) + 5]*compressed_spec_mat[(i*30) + 5] //Im S13 | |
351 | +compressed_spec_mat[(i*30) + 13]*compressed_spec_mat[(i*30) + 13] //Im S23 |
|
351 | +compressed_spec_mat[(i*30) + 13]*compressed_spec_mat[(i*30) + 13] //Im S23 | |
352 | ); |
|
352 | ); | |
353 | NVEC_V0 = compressed_spec_mat[(i*30) + 13] / tmp; // Im S23 |
|
353 | NVEC_V0 = compressed_spec_mat[(i*30) + 13] / tmp; // Im S23 | |
354 | NVEC_V1 = -compressed_spec_mat[(i*30) + 5] / tmp; // Im S13 |
|
354 | NVEC_V1 = -compressed_spec_mat[(i*30) + 5] / tmp; // Im S13 | |
355 | NVEC_V2 = compressed_spec_mat[(i*30) + 3] / tmp; // Im S12 |
|
355 | NVEC_V2 = compressed_spec_mat[(i*30) + 3] / tmp; // Im S12 | |
356 | LFR_BP1[(i*9) + 4] = (char) (NVEC_V0*127); |
|
356 | LFR_BP1[(i*9) + 4] = (char) (NVEC_V0*127); | |
357 | LFR_BP1[(i*9) + 5] = (char) (NVEC_V1*127); |
|
357 | LFR_BP1[(i*9) + 5] = (char) (NVEC_V1*127); | |
358 | pt_char = (unsigned char*) &NVEC_V2; |
|
358 | pt_char = (unsigned char*) &NVEC_V2; | |
359 | LFR_BP1[(i*9) + 6] = pt_char[0] & 0x80; // extract the sign of NVEC_V2 |
|
359 | LFR_BP1[(i*9) + 6] = pt_char[0] & 0x80; // extract the sign of NVEC_V2 | |
360 | //======================================================= |
|
360 | //======================================================= | |
361 | // BP1 ellipticity == PAR_LFR_SC_BP1_ELLIP_F0 == 4 bits |
|
361 | // BP1 ellipticity == PAR_LFR_SC_BP1_ELLIP_F0 == 4 bits | |
362 | aux = 2*tmp / PSDB; // compute the ellipticity |
|
362 | aux = 2*tmp / PSDB; // compute the ellipticity | |
363 | tmp_u_char = (unsigned char) (aux*(16-1)); // convert the ellipticity |
|
363 | tmp_u_char = (unsigned char) (aux*(16-1)); // convert the ellipticity | |
364 | LFR_BP1[i*9+6] = LFR_BP1[i*9+6] | ((tmp_u_char&0x0f)<<3); // keeps 4 bits of the resulting unsigned char |
|
364 | LFR_BP1[i*9+6] = LFR_BP1[i*9+6] | ((tmp_u_char&0x0f)<<3); // keeps 4 bits of the resulting unsigned char | |
365 | //============================================================== |
|
365 | //============================================================== | |
366 | // BP1 degree of polarization == PAR_LFR_SC_BP1_DOP_F0 == 3 bits |
|
366 | // BP1 degree of polarization == PAR_LFR_SC_BP1_DOP_F0 == 3 bits | |
367 | for(j = 0; j<NB_VALUES_PER_SM;j++){ |
|
367 | for(j = 0; j<NB_VALUES_PER_SM;j++){ | |
368 | tr_SB_SB = compressed_spec_mat[i*30] * compressed_spec_mat[i*30] |
|
368 | tr_SB_SB = compressed_spec_mat[i*30] * compressed_spec_mat[i*30] | |
369 | + compressed_spec_mat[(i*30) + 10] * compressed_spec_mat[(i*30) + 10] |
|
369 | + compressed_spec_mat[(i*30) + 10] * compressed_spec_mat[(i*30) + 10] | |
370 | + compressed_spec_mat[(i*30) + 18] * compressed_spec_mat[(i*30) + 18] |
|
370 | + compressed_spec_mat[(i*30) + 18] * compressed_spec_mat[(i*30) + 18] | |
371 | + 2 * compressed_spec_mat[(i*30) + 2] * compressed_spec_mat[(i*30) + 2] |
|
371 | + 2 * compressed_spec_mat[(i*30) + 2] * compressed_spec_mat[(i*30) + 2] | |
372 | + 2 * compressed_spec_mat[(i*30) + 3] * compressed_spec_mat[(i*30) + 3] |
|
372 | + 2 * compressed_spec_mat[(i*30) + 3] * compressed_spec_mat[(i*30) + 3] | |
373 | + 2 * compressed_spec_mat[(i*30) + 4] * compressed_spec_mat[(i*30) + 4] |
|
373 | + 2 * compressed_spec_mat[(i*30) + 4] * compressed_spec_mat[(i*30) + 4] | |
374 | + 2 * compressed_spec_mat[(i*30) + 5] * compressed_spec_mat[(i*30) + 5] |
|
374 | + 2 * compressed_spec_mat[(i*30) + 5] * compressed_spec_mat[(i*30) + 5] | |
375 | + 2 * compressed_spec_mat[(i*30) + 12] * compressed_spec_mat[(i*30) + 12] |
|
375 | + 2 * compressed_spec_mat[(i*30) + 12] * compressed_spec_mat[(i*30) + 12] | |
376 | + 2 * compressed_spec_mat[(i*30) + 13] * compressed_spec_mat[(i*30) + 13]; |
|
376 | + 2 * compressed_spec_mat[(i*30) + 13] * compressed_spec_mat[(i*30) + 13]; | |
377 | } |
|
377 | } | |
378 | aux = PSDB*PSDB; |
|
378 | aux = PSDB*PSDB; | |
379 | tmp = sqrt( abs( ( 3*tr_SB_SB - aux ) / ( 2 * aux ) ) ); |
|
379 | tmp = sqrt( abs( ( 3*tr_SB_SB - aux ) / ( 2 * aux ) ) ); | |
380 | tmp_u_char = (unsigned char) (NVEC_V0*(8-1)); |
|
380 | tmp_u_char = (unsigned char) (NVEC_V0*(8-1)); | |
381 | LFR_BP1[(i*9) + 6] = LFR_BP1[(i*9) + 6] | (tmp_u_char & 0x07); // keeps 3 bits of the resulting unsigned char |
|
381 | LFR_BP1[(i*9) + 6] = LFR_BP1[(i*9) + 6] | (tmp_u_char & 0x07); // keeps 3 bits of the resulting unsigned char | |
382 | //======================================================================================= |
|
382 | //======================================================================================= | |
383 | // BP1 x-component of the normalized Poynting flux == PAR_LFR_SC_BP1_SZ_F0 == 8 bits (7+1) |
|
383 | // BP1 x-component of the normalized Poynting flux == PAR_LFR_SC_BP1_SZ_F0 == 8 bits (7+1) | |
384 | sx_re = compressed_spec_mat[(i*30) + 20] * K34_sx_re |
|
384 | sx_re = compressed_spec_mat[(i*30) + 20] * K34_sx_re | |
385 | + compressed_spec_mat[(i*30) + 6] * K14_sx_re |
|
385 | + compressed_spec_mat[(i*30) + 6] * K14_sx_re | |
386 | + compressed_spec_mat[(i*30) + 8] * K15_sx_re |
|
386 | + compressed_spec_mat[(i*30) + 8] * K15_sx_re | |
387 | + compressed_spec_mat[(i*30) + 14] * K24_sx_re |
|
387 | + compressed_spec_mat[(i*30) + 14] * K24_sx_re | |
388 | + compressed_spec_mat[(i*30) + 16] * K25_sx_re |
|
388 | + compressed_spec_mat[(i*30) + 16] * K25_sx_re | |
389 | + compressed_spec_mat[(i*30) + 22] * K35_sx_re; |
|
389 | + compressed_spec_mat[(i*30) + 22] * K35_sx_re; | |
390 | sx_im = compressed_spec_mat[(i*30) + 21] * K34_sx_im |
|
390 | sx_im = compressed_spec_mat[(i*30) + 21] * K34_sx_im | |
391 | + compressed_spec_mat[(i*30) + 7] * K14_sx_im |
|
391 | + compressed_spec_mat[(i*30) + 7] * K14_sx_im | |
392 | + compressed_spec_mat[(i*30) + 9] * K15_sx_im |
|
392 | + compressed_spec_mat[(i*30) + 9] * K15_sx_im | |
393 | + compressed_spec_mat[(i*30) + 15] * K24_sx_im |
|
393 | + compressed_spec_mat[(i*30) + 15] * K24_sx_im | |
394 | + compressed_spec_mat[(i*30) + 17] * K25_sx_im |
|
394 | + compressed_spec_mat[(i*30) + 17] * K25_sx_im | |
395 | + compressed_spec_mat[(i*30) + 23] * K35_sx_im; |
|
395 | + compressed_spec_mat[(i*30) + 23] * K35_sx_im; | |
396 | LFR_BP1[(i*9) + 7] = ((unsigned char) (sx_re * 128)) & 0x7f; // cf DOC for the compression |
|
396 | LFR_BP1[(i*9) + 7] = ((unsigned char) (sx_re * 128)) & 0x7f; // cf DOC for the compression | |
397 | if ( abs(sx_re) > abs(sx_im) ) { |
|
397 | if ( abs(sx_re) > abs(sx_im) ) { | |
398 | LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] | (0x80); // extract the sector of sx |
|
398 | LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] | (0x80); // extract the sector of sx | |
399 | } |
|
399 | } | |
400 | else { |
|
400 | else { | |
401 | LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] & (0x7f); // extract the sector of sx |
|
401 | LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] & (0x7f); // extract the sector of sx | |
402 | } |
|
402 | } | |
403 | //====================================================================== |
|
403 | //====================================================================== | |
404 | // BP1 phase velocity estimator == PAR_LFR_SC_BP1_VPHI_F0 == 8 bits (7+1) |
|
404 | // BP1 phase velocity estimator == PAR_LFR_SC_BP1_VPHI_F0 == 8 bits (7+1) | |
405 | ny = sin(Alpha_M)*NVEC_V1 + cos(Alpha_M)*NVEC_V2; |
|
405 | ny = sin(Alpha_M)*NVEC_V1 + cos(Alpha_M)*NVEC_V2; | |
406 | nz = NVEC_V0; |
|
406 | nz = NVEC_V0; | |
407 | bx_bx_star = cos(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+10] // re S22 |
|
407 | bx_bx_star = cos(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+10] // re S22 | |
408 | + sin(Alpha_M) * sin(Alpha_M) * compressed_spec_mat[i*30+18] // re S33 |
|
408 | + sin(Alpha_M) * sin(Alpha_M) * compressed_spec_mat[i*30+18] // re S33 | |
409 | - 2 * sin(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+12]; // re S23 |
|
409 | - 2 * sin(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+12]; // re S23 | |
410 | nebx_re = ny * (compressed_spec_mat[(i*30) + 14] * K24_ny_re |
|
410 | nebx_re = ny * (compressed_spec_mat[(i*30) + 14] * K24_ny_re | |
411 | +compressed_spec_mat[(i*30) + 16] * K25_ny_re |
|
411 | +compressed_spec_mat[(i*30) + 16] * K25_ny_re | |
412 | +compressed_spec_mat[(i*30) + 20] * K34_ny_re |
|
412 | +compressed_spec_mat[(i*30) + 20] * K34_ny_re | |
413 | +compressed_spec_mat[(i*30) + 22] * K35_ny_re) |
|
413 | +compressed_spec_mat[(i*30) + 22] * K35_ny_re) | |
414 | + nz * (compressed_spec_mat[(i*30) + 14] * K24_nz_re |
|
414 | + nz * (compressed_spec_mat[(i*30) + 14] * K24_nz_re | |
415 | +compressed_spec_mat[(i*30) + 16] * K25_nz_re |
|
415 | +compressed_spec_mat[(i*30) + 16] * K25_nz_re | |
416 | +compressed_spec_mat[(i*30) + 20] * K34_nz_re |
|
416 | +compressed_spec_mat[(i*30) + 20] * K34_nz_re | |
417 | +compressed_spec_mat[(i*30) + 22] * K35_nz_re); |
|
417 | +compressed_spec_mat[(i*30) + 22] * K35_nz_re); | |
418 | nebx_im = ny * (compressed_spec_mat[(i*30) + 15]*K24_ny_re |
|
418 | nebx_im = ny * (compressed_spec_mat[(i*30) + 15]*K24_ny_re | |
419 | +compressed_spec_mat[(i*30) + 17] * K25_ny_re |
|
419 | +compressed_spec_mat[(i*30) + 17] * K25_ny_re | |
420 | +compressed_spec_mat[(i*30) + 21] * K34_ny_re |
|
420 | +compressed_spec_mat[(i*30) + 21] * K34_ny_re | |
421 | +compressed_spec_mat[(i*30) + 23] * K35_ny_re) |
|
421 | +compressed_spec_mat[(i*30) + 23] * K35_ny_re) | |
422 | + nz * (compressed_spec_mat[(i*30) + 15] * K24_nz_im |
|
422 | + nz * (compressed_spec_mat[(i*30) + 15] * K24_nz_im | |
423 | +compressed_spec_mat[(i*30) + 17] * K25_nz_im |
|
423 | +compressed_spec_mat[(i*30) + 17] * K25_nz_im | |
424 | +compressed_spec_mat[(i*30) + 21] * K34_nz_im |
|
424 | +compressed_spec_mat[(i*30) + 21] * K34_nz_im | |
425 | +compressed_spec_mat[(i*30) + 23] * K35_nz_im); |
|
425 | +compressed_spec_mat[(i*30) + 23] * K35_nz_im); | |
426 | tmp = nebx_re / bx_bx_star; |
|
426 | tmp = nebx_re / bx_bx_star; | |
427 | LFR_BP1[(i*9) + 8] = ((unsigned char) (tmp * 128)) & 0x7f; // cf DOC for the compression |
|
427 | LFR_BP1[(i*9) + 8] = ((unsigned char) (tmp * 128)) & 0x7f; // cf DOC for the compression | |
428 | if ( abs(nebx_re) > abs(nebx_im) ) { |
|
428 | if ( abs(nebx_re) > abs(nebx_im) ) { | |
429 | LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] | (0x80); // extract the sector of nebx |
|
429 | LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] | (0x80); // extract the sector of nebx | |
430 | } |
|
430 | } | |
431 | else { |
|
431 | else { | |
432 | LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] & (0x7f); // extract the sector of nebx |
|
432 | LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] & (0x7f); // extract the sector of nebx | |
433 | } |
|
433 | } | |
434 | } |
|
434 | } | |
435 |
|
435 | |||
436 | } |
|
436 | } | |
437 |
|
437 | |||
438 | void BP2_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat){ |
|
438 | void BP2_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat){ | |
439 | // BP2 autocorrelation |
|
439 | // BP2 autocorrelation | |
440 | int i; |
|
440 | int i; | |
441 | int aux = 0; |
|
441 | int aux = 0; | |
442 |
|
442 | |||
443 | for(i = 0; i<nb_bins_compressed_spec_mat; i++){ |
|
443 | for(i = 0; i<nb_bins_compressed_spec_mat; i++){ | |
444 | // S12 |
|
444 | // S12 | |
445 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 10]); |
|
445 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 10]); | |
446 | compressed_spec_mat[(i*30) + 2] = compressed_spec_mat[(i*30) + 2] / aux; |
|
446 | compressed_spec_mat[(i*30) + 2] = compressed_spec_mat[(i*30) + 2] / aux; | |
447 | compressed_spec_mat[(i*30) + 3] = compressed_spec_mat[(i*30) + 3] / aux; |
|
447 | compressed_spec_mat[(i*30) + 3] = compressed_spec_mat[(i*30) + 3] / aux; | |
448 | // S13 |
|
448 | // S13 | |
449 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 18]); |
|
449 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 18]); | |
450 | compressed_spec_mat[(i*30) + 4] = compressed_spec_mat[(i*30) + 4] / aux; |
|
450 | compressed_spec_mat[(i*30) + 4] = compressed_spec_mat[(i*30) + 4] / aux; | |
451 | compressed_spec_mat[(i*30) + 5] = compressed_spec_mat[(i*30) + 5] / aux; |
|
451 | compressed_spec_mat[(i*30) + 5] = compressed_spec_mat[(i*30) + 5] / aux; | |
452 | // S23 |
|
452 | // S23 | |
453 | aux = sqrt(compressed_spec_mat[i*30+12]*compressed_spec_mat[(i*30) + 18]); |
|
453 | aux = sqrt(compressed_spec_mat[i*30+12]*compressed_spec_mat[(i*30) + 18]); | |
454 | compressed_spec_mat[(i*30) + 12] = compressed_spec_mat[(i*30) + 12] / aux; |
|
454 | compressed_spec_mat[(i*30) + 12] = compressed_spec_mat[(i*30) + 12] / aux; | |
455 | compressed_spec_mat[(i*30) + 13] = compressed_spec_mat[(i*30) + 13] / aux; |
|
455 | compressed_spec_mat[(i*30) + 13] = compressed_spec_mat[(i*30) + 13] / aux; | |
456 | // S45 |
|
456 | // S45 | |
457 | aux = sqrt(compressed_spec_mat[i*30+24]*compressed_spec_mat[(i*30) + 28]); |
|
457 | aux = sqrt(compressed_spec_mat[i*30+24]*compressed_spec_mat[(i*30) + 28]); | |
458 | compressed_spec_mat[(i*30) + 26] = compressed_spec_mat[(i*30) + 26] / aux; |
|
458 | compressed_spec_mat[(i*30) + 26] = compressed_spec_mat[(i*30) + 26] / aux; | |
459 | compressed_spec_mat[(i*30) + 27] = compressed_spec_mat[(i*30) + 27] / aux; |
|
459 | compressed_spec_mat[(i*30) + 27] = compressed_spec_mat[(i*30) + 27] / aux; | |
460 | // S14 |
|
460 | // S14 | |
461 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) +24]); |
|
461 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) +24]); | |
462 | compressed_spec_mat[(i*30) + 6] = compressed_spec_mat[(i*30) + 6] / aux; |
|
462 | compressed_spec_mat[(i*30) + 6] = compressed_spec_mat[(i*30) + 6] / aux; | |
463 | compressed_spec_mat[(i*30) + 7] = compressed_spec_mat[(i*30) + 7] / aux; |
|
463 | compressed_spec_mat[(i*30) + 7] = compressed_spec_mat[(i*30) + 7] / aux; | |
464 | // S15 |
|
464 | // S15 | |
465 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 28]); |
|
465 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 28]); | |
466 | compressed_spec_mat[(i*30) + 8] = compressed_spec_mat[(i*30) + 8] / aux; |
|
466 | compressed_spec_mat[(i*30) + 8] = compressed_spec_mat[(i*30) + 8] / aux; | |
467 | compressed_spec_mat[(i*30) + 9] = compressed_spec_mat[(i*30) + 9] / aux; |
|
467 | compressed_spec_mat[(i*30) + 9] = compressed_spec_mat[(i*30) + 9] / aux; | |
468 | // S24 |
|
468 | // S24 | |
469 | aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 24]); |
|
469 | aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 24]); | |
470 | compressed_spec_mat[(i*30) + 14] = compressed_spec_mat[(i*30) + 14] / aux; |
|
470 | compressed_spec_mat[(i*30) + 14] = compressed_spec_mat[(i*30) + 14] / aux; | |
471 | compressed_spec_mat[(i*30) + 15] = compressed_spec_mat[(i*30) + 15] / aux; |
|
471 | compressed_spec_mat[(i*30) + 15] = compressed_spec_mat[(i*30) + 15] / aux; | |
472 | // S25 |
|
472 | // S25 | |
473 | aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 28]); |
|
473 | aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 28]); | |
474 | compressed_spec_mat[(i*30) + 16] = compressed_spec_mat[(i*30) + 16] / aux; |
|
474 | compressed_spec_mat[(i*30) + 16] = compressed_spec_mat[(i*30) + 16] / aux; | |
475 | compressed_spec_mat[(i*30) + 17] = compressed_spec_mat[(i*30) + 17] / aux; |
|
475 | compressed_spec_mat[(i*30) + 17] = compressed_spec_mat[(i*30) + 17] / aux; | |
476 | // S34 |
|
476 | // S34 | |
477 | aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 24]); |
|
477 | aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 24]); | |
478 | compressed_spec_mat[(i*30) + 20] = compressed_spec_mat[(i*30) + 20] / aux; |
|
478 | compressed_spec_mat[(i*30) + 20] = compressed_spec_mat[(i*30) + 20] / aux; | |
479 | compressed_spec_mat[(i*30) + 21] = compressed_spec_mat[(i*30) + 21] / aux; |
|
479 | compressed_spec_mat[(i*30) + 21] = compressed_spec_mat[(i*30) + 21] / aux; | |
480 | // S35 |
|
480 | // S35 | |
481 | aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 28]); |
|
481 | aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 28]); | |
482 | compressed_spec_mat[(i*30) + 22] = compressed_spec_mat[(i*30) + 22] / aux; |
|
482 | compressed_spec_mat[(i*30) + 22] = compressed_spec_mat[(i*30) + 22] / aux; | |
483 | compressed_spec_mat[(i*30) + 23] = compressed_spec_mat[(i*30) + 23] / aux; |
|
483 | compressed_spec_mat[(i*30) + 23] = compressed_spec_mat[(i*30) + 23] / aux; | |
484 | } |
|
484 | } | |
485 | } |
|
485 | } | |
486 |
|
486 | |||
487 | void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header) |
|
487 | void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header) | |
488 | { |
|
488 | { | |
489 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
489 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; | |
490 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
490 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
491 | header->reserved = 0x00; |
|
491 | header->reserved = 0x00; | |
492 | header->userApplication = CCSDS_USER_APP; |
|
492 | header->userApplication = CCSDS_USER_APP; | |
493 | header->packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); |
|
493 | header->packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); | |
494 | header->packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); |
|
494 | header->packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); | |
495 | header->packetSequenceControl[0] = 0xc0; |
|
495 | header->packetSequenceControl[0] = 0xc0; | |
496 | header->packetSequenceControl[1] = 0x00; |
|
496 | header->packetSequenceControl[1] = 0x00; | |
497 | header->packetLength[0] = 0x00; |
|
497 | header->packetLength[0] = 0x00; | |
498 | header->packetLength[1] = 0x00; |
|
498 | header->packetLength[1] = 0x00; | |
499 | // DATA FIELD HEADER |
|
499 | // DATA FIELD HEADER | |
500 | header->spare1_pusVersion_spare2 = 0x10; |
|
500 | header->spare1_pusVersion_spare2 = 0x10; | |
501 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
501 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
502 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
502 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
503 | header->destinationID = TM_DESTINATION_ID_GROUND; |
|
503 | header->destinationID = TM_DESTINATION_ID_GROUND; | |
504 | // AUXILIARY DATA HEADER |
|
504 | // AUXILIARY DATA HEADER | |
505 | header->sid = 0x00; |
|
505 | header->sid = 0x00; | |
506 | header->biaStatusInfo = 0x00; |
|
506 | header->biaStatusInfo = 0x00; | |
507 | header->cntASM = 0x00; |
|
507 | header->cntASM = 0x00; | |
508 | header->nrASM = 0x00; |
|
508 | header->nrASM = 0x00; | |
509 | header->time[0] = 0x00; |
|
509 | header->time[0] = 0x00; | |
510 | header->time[0] = 0x00; |
|
510 | header->time[0] = 0x00; | |
511 | header->time[0] = 0x00; |
|
511 | header->time[0] = 0x00; | |
512 | header->time[0] = 0x00; |
|
512 | header->time[0] = 0x00; | |
513 | header->time[0] = 0x00; |
|
513 | header->time[0] = 0x00; | |
514 | header->time[0] = 0x00; |
|
514 | header->time[0] = 0x00; | |
515 | header->blkNr[0] = 0x00; // BLK_NR MSB |
|
515 | header->blkNr[0] = 0x00; // BLK_NR MSB | |
516 | header->blkNr[1] = 0x00; // BLK_NR LSB |
|
516 | header->blkNr[1] = 0x00; // BLK_NR LSB | |
517 | } |
|
517 | } | |
518 |
|
518 | |||
519 | void send_spectral_matrix(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, |
|
519 | void send_spectral_matrix(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, | |
520 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id) |
|
520 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id) | |
521 | { |
|
521 | { | |
522 | unsigned int i; |
|
522 | unsigned int i; | |
523 | unsigned int length = 0; |
|
523 | unsigned int length = 0; | |
524 | rtems_status_code status; |
|
524 | rtems_status_code status; | |
525 |
|
525 | |||
526 | header->sid = (unsigned char) sid; |
|
526 | header->sid = (unsigned char) sid; | |
527 |
|
527 | |||
528 | for (i=0; i<2; i++) |
|
528 | for (i=0; i<2; i++) | |
529 | { |
|
529 | { | |
530 | // BUILD THE DATA |
|
530 | // BUILD THE DATA | |
531 | spw_ioctl_send->dlen = TOTAL_SIZE_SM; |
|
531 | spw_ioctl_send->dlen = TOTAL_SIZE_SM; | |
532 | spw_ioctl_send->data = &spectral_matrix[ i * TOTAL_SIZE_SM]; |
|
532 | spw_ioctl_send->data = &spectral_matrix[ i * TOTAL_SIZE_SM]; | |
533 | spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
533 | spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES; | |
534 | spw_ioctl_send->hdr = (char *) header; |
|
534 | spw_ioctl_send->hdr = (char *) header; | |
535 | spw_ioctl_send->options = 0; |
|
535 | spw_ioctl_send->options = 0; | |
536 |
|
536 | |||
537 | // BUILD THE HEADER |
|
537 | // BUILD THE HEADER | |
538 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM; |
|
538 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM; | |
539 | header->packetLength[0] = (unsigned char) (length>>8); |
|
539 | header->packetLength[0] = (unsigned char) (length>>8); | |
540 | header->packetLength[1] = (unsigned char) (length); |
|
540 | header->packetLength[1] = (unsigned char) (length); | |
541 | header->sid = (unsigned char) sid; // SID |
|
541 | header->sid = (unsigned char) sid; // SID | |
542 | header->cntASM = 2; |
|
542 | header->cntASM = 2; | |
543 | header->nrASM = (unsigned char) (i+1); |
|
543 | header->nrASM = (unsigned char) (i+1); | |
544 | header->blkNr[0] =(unsigned char) ( (NB_BINS_PER_SM/2) >> 8 ); // BLK_NR MSB |
|
544 | header->blkNr[0] =(unsigned char) ( (NB_BINS_PER_SM/2) >> 8 ); // BLK_NR MSB | |
545 | header->blkNr[1] = (unsigned char) (NB_BINS_PER_SM/2); // BLK_NR LSB |
|
545 | header->blkNr[1] = (unsigned char) (NB_BINS_PER_SM/2); // BLK_NR LSB | |
546 | // SET PACKET TIME |
|
546 | // SET PACKET TIME | |
547 | header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
547 | header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
548 | header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
548 | header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
549 | header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
549 | header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
550 | header->time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
550 | header->time[3] = (unsigned char) (time_management_regs->coarse_time); | |
551 | header->time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
551 | header->time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
552 | header->time[5] = (unsigned char) (time_management_regs->fine_time); |
|
552 | header->time[5] = (unsigned char) (time_management_regs->fine_time); | |
553 | header->acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
553 | header->acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
554 | header->acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
554 | header->acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
555 | header->acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
555 | header->acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
556 | header->acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time); |
|
556 | header->acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time); | |
557 | header->acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
557 | header->acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
558 | header->acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time); |
|
558 | header->acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time); | |
559 | // SEND PACKET |
|
559 | // SEND PACKET | |
560 |
status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_ |
|
560 | status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE); | |
561 | if (status != RTEMS_SUCCESSFUL) { |
|
561 | if (status != RTEMS_SUCCESSFUL) { | |
562 | printf("in send_spectral_matrix *** ERR %d\n", (int) status); |
|
562 | printf("in send_spectral_matrix *** ERR %d\n", (int) status); | |
563 | } |
|
563 | } | |
564 | } |
|
564 | } | |
565 | } |
|
565 | } | |
566 |
|
566 | |||
567 | void convert_averaged_spectral_matrix( volatile float *input_matrix, char *output_matrix) |
|
567 | void convert_averaged_spectral_matrix( volatile float *input_matrix, char *output_matrix) | |
568 | { |
|
568 | { | |
569 | unsigned int i; |
|
569 | unsigned int i; | |
570 | unsigned int j; |
|
570 | unsigned int j; | |
571 | char * pt_char_input; |
|
571 | char * pt_char_input; | |
572 | char * pt_char_output; |
|
572 | char * pt_char_output; | |
573 |
|
573 | |||
574 | pt_char_input = NULL; |
|
574 | pt_char_input = NULL; | |
575 | pt_char_output = NULL; |
|
575 | pt_char_output = NULL; | |
576 |
|
576 | |||
577 | for( i=0; i<NB_BINS_PER_SM; i++) |
|
577 | for( i=0; i<NB_BINS_PER_SM; i++) | |
578 | { |
|
578 | { | |
579 | for ( j=0; j<NB_VALUES_PER_SM; j++) |
|
579 | for ( j=0; j<NB_VALUES_PER_SM; j++) | |
580 | { |
|
580 | { | |
581 | pt_char_input = (char*) &input_matrix[ (i*NB_VALUES_PER_SM) + j ]; |
|
581 | pt_char_input = (char*) &input_matrix[ (i*NB_VALUES_PER_SM) + j ]; | |
582 | pt_char_output = (char*) &output_matrix[ 2 * ( (i*NB_VALUES_PER_SM) + j ) ]; |
|
582 | pt_char_output = (char*) &output_matrix[ 2 * ( (i*NB_VALUES_PER_SM) + j ) ]; | |
583 | pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float |
|
583 | pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float | |
584 | pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float |
|
584 | pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float | |
585 | } |
|
585 | } | |
586 | } |
|
586 | } | |
587 | } |
|
587 | } | |
588 |
|
588 | |||
589 | void fill_averaged_spectral_matrix( ) |
|
589 | void fill_averaged_spectral_matrix( ) | |
590 | { |
|
590 | { | |
591 |
|
591 | |||
592 | #ifdef GSA |
|
592 | #ifdef GSA | |
593 | float offset = 10.; |
|
593 | float offset = 10.; | |
594 | float coeff = 100000.; |
|
594 | float coeff = 100000.; | |
595 |
|
595 | |||
596 | averaged_spec_mat_f0[ 0 + 25 * 0 ] = 0. + offset; |
|
596 | averaged_spec_mat_f0[ 0 + 25 * 0 ] = 0. + offset; | |
597 | averaged_spec_mat_f0[ 0 + 25 * 1 ] = 1. + offset; |
|
597 | averaged_spec_mat_f0[ 0 + 25 * 1 ] = 1. + offset; | |
598 | averaged_spec_mat_f0[ 0 + 25 * 2 ] = 2. + offset; |
|
598 | averaged_spec_mat_f0[ 0 + 25 * 2 ] = 2. + offset; | |
599 | averaged_spec_mat_f0[ 0 + 25 * 3 ] = 3. + offset; |
|
599 | averaged_spec_mat_f0[ 0 + 25 * 3 ] = 3. + offset; | |
600 | averaged_spec_mat_f0[ 0 + 25 * 4 ] = 4. + offset; |
|
600 | averaged_spec_mat_f0[ 0 + 25 * 4 ] = 4. + offset; | |
601 | averaged_spec_mat_f0[ 0 + 25 * 5 ] = 5. + offset; |
|
601 | averaged_spec_mat_f0[ 0 + 25 * 5 ] = 5. + offset; | |
602 | averaged_spec_mat_f0[ 0 + 25 * 6 ] = 6. + offset; |
|
602 | averaged_spec_mat_f0[ 0 + 25 * 6 ] = 6. + offset; | |
603 | averaged_spec_mat_f0[ 0 + 25 * 7 ] = 7. + offset; |
|
603 | averaged_spec_mat_f0[ 0 + 25 * 7 ] = 7. + offset; | |
604 | averaged_spec_mat_f0[ 0 + 25 * 8 ] = 8. + offset; |
|
604 | averaged_spec_mat_f0[ 0 + 25 * 8 ] = 8. + offset; | |
605 | averaged_spec_mat_f0[ 0 + 25 * 9 ] = 9. + offset; |
|
605 | averaged_spec_mat_f0[ 0 + 25 * 9 ] = 9. + offset; | |
606 | averaged_spec_mat_f0[ 0 + 25 * 10 ] = 10. + offset; |
|
606 | averaged_spec_mat_f0[ 0 + 25 * 10 ] = 10. + offset; | |
607 | averaged_spec_mat_f0[ 0 + 25 * 11 ] = 11. + offset; |
|
607 | averaged_spec_mat_f0[ 0 + 25 * 11 ] = 11. + offset; | |
608 | averaged_spec_mat_f0[ 0 + 25 * 12 ] = 12. + offset; |
|
608 | averaged_spec_mat_f0[ 0 + 25 * 12 ] = 12. + offset; | |
609 | averaged_spec_mat_f0[ 0 + 25 * 13 ] = 13. + offset; |
|
609 | averaged_spec_mat_f0[ 0 + 25 * 13 ] = 13. + offset; | |
610 | averaged_spec_mat_f0[ 0 + 25 * 14 ] = 14. + offset; |
|
610 | averaged_spec_mat_f0[ 0 + 25 * 14 ] = 14. + offset; | |
611 | averaged_spec_mat_f0[ 9 + 25 * 0 ] = -(0. + offset)* coeff; |
|
611 | averaged_spec_mat_f0[ 9 + 25 * 0 ] = -(0. + offset)* coeff; | |
612 | averaged_spec_mat_f0[ 9 + 25 * 1 ] = -(1. + offset)* coeff; |
|
612 | averaged_spec_mat_f0[ 9 + 25 * 1 ] = -(1. + offset)* coeff; | |
613 | averaged_spec_mat_f0[ 9 + 25 * 2 ] = -(2. + offset)* coeff; |
|
613 | averaged_spec_mat_f0[ 9 + 25 * 2 ] = -(2. + offset)* coeff; | |
614 | averaged_spec_mat_f0[ 9 + 25 * 3 ] = -(3. + offset)* coeff; |
|
614 | averaged_spec_mat_f0[ 9 + 25 * 3 ] = -(3. + offset)* coeff; | |
615 | averaged_spec_mat_f0[ 9 + 25 * 4 ] = -(4. + offset)* coeff; |
|
615 | averaged_spec_mat_f0[ 9 + 25 * 4 ] = -(4. + offset)* coeff; | |
616 | averaged_spec_mat_f0[ 9 + 25 * 5 ] = -(5. + offset)* coeff; |
|
616 | averaged_spec_mat_f0[ 9 + 25 * 5 ] = -(5. + offset)* coeff; | |
617 | averaged_spec_mat_f0[ 9 + 25 * 6 ] = -(6. + offset)* coeff; |
|
617 | averaged_spec_mat_f0[ 9 + 25 * 6 ] = -(6. + offset)* coeff; | |
618 | averaged_spec_mat_f0[ 9 + 25 * 7 ] = -(7. + offset)* coeff; |
|
618 | averaged_spec_mat_f0[ 9 + 25 * 7 ] = -(7. + offset)* coeff; | |
619 | averaged_spec_mat_f0[ 9 + 25 * 8 ] = -(8. + offset)* coeff; |
|
619 | averaged_spec_mat_f0[ 9 + 25 * 8 ] = -(8. + offset)* coeff; | |
620 | averaged_spec_mat_f0[ 9 + 25 * 9 ] = -(9. + offset)* coeff; |
|
620 | averaged_spec_mat_f0[ 9 + 25 * 9 ] = -(9. + offset)* coeff; | |
621 | averaged_spec_mat_f0[ 9 + 25 * 10 ] = -(10. + offset)* coeff; |
|
621 | averaged_spec_mat_f0[ 9 + 25 * 10 ] = -(10. + offset)* coeff; | |
622 | averaged_spec_mat_f0[ 9 + 25 * 11 ] = -(11. + offset)* coeff; |
|
622 | averaged_spec_mat_f0[ 9 + 25 * 11 ] = -(11. + offset)* coeff; | |
623 | averaged_spec_mat_f0[ 9 + 25 * 12 ] = -(12. + offset)* coeff; |
|
623 | averaged_spec_mat_f0[ 9 + 25 * 12 ] = -(12. + offset)* coeff; | |
624 | averaged_spec_mat_f0[ 9 + 25 * 13 ] = -(13. + offset)* coeff; |
|
624 | averaged_spec_mat_f0[ 9 + 25 * 13 ] = -(13. + offset)* coeff; | |
625 | averaged_spec_mat_f0[ 9 + 25 * 14 ] = -(14. + offset)* coeff; |
|
625 | averaged_spec_mat_f0[ 9 + 25 * 14 ] = -(14. + offset)* coeff; | |
626 | offset = 10000000; |
|
626 | offset = 10000000; | |
627 | averaged_spec_mat_f0[ 16 + 25 * 0 ] = (0. + offset)* coeff; |
|
627 | averaged_spec_mat_f0[ 16 + 25 * 0 ] = (0. + offset)* coeff; | |
628 | averaged_spec_mat_f0[ 16 + 25 * 1 ] = (1. + offset)* coeff; |
|
628 | averaged_spec_mat_f0[ 16 + 25 * 1 ] = (1. + offset)* coeff; | |
629 | averaged_spec_mat_f0[ 16 + 25 * 2 ] = (2. + offset)* coeff; |
|
629 | averaged_spec_mat_f0[ 16 + 25 * 2 ] = (2. + offset)* coeff; | |
630 | averaged_spec_mat_f0[ 16 + 25 * 3 ] = (3. + offset)* coeff; |
|
630 | averaged_spec_mat_f0[ 16 + 25 * 3 ] = (3. + offset)* coeff; | |
631 | averaged_spec_mat_f0[ 16 + 25 * 4 ] = (4. + offset)* coeff; |
|
631 | averaged_spec_mat_f0[ 16 + 25 * 4 ] = (4. + offset)* coeff; | |
632 | averaged_spec_mat_f0[ 16 + 25 * 5 ] = (5. + offset)* coeff; |
|
632 | averaged_spec_mat_f0[ 16 + 25 * 5 ] = (5. + offset)* coeff; | |
633 | averaged_spec_mat_f0[ 16 + 25 * 6 ] = (6. + offset)* coeff; |
|
633 | averaged_spec_mat_f0[ 16 + 25 * 6 ] = (6. + offset)* coeff; | |
634 | averaged_spec_mat_f0[ 16 + 25 * 7 ] = (7. + offset)* coeff; |
|
634 | averaged_spec_mat_f0[ 16 + 25 * 7 ] = (7. + offset)* coeff; | |
635 | averaged_spec_mat_f0[ 16 + 25 * 8 ] = (8. + offset)* coeff; |
|
635 | averaged_spec_mat_f0[ 16 + 25 * 8 ] = (8. + offset)* coeff; | |
636 | averaged_spec_mat_f0[ 16 + 25 * 9 ] = (9. + offset)* coeff; |
|
636 | averaged_spec_mat_f0[ 16 + 25 * 9 ] = (9. + offset)* coeff; | |
637 | averaged_spec_mat_f0[ 16 + 25 * 10 ] = (10. + offset)* coeff; |
|
637 | averaged_spec_mat_f0[ 16 + 25 * 10 ] = (10. + offset)* coeff; | |
638 | averaged_spec_mat_f0[ 16 + 25 * 11 ] = (11. + offset)* coeff; |
|
638 | averaged_spec_mat_f0[ 16 + 25 * 11 ] = (11. + offset)* coeff; | |
639 | averaged_spec_mat_f0[ 16 + 25 * 12 ] = (12. + offset)* coeff; |
|
639 | averaged_spec_mat_f0[ 16 + 25 * 12 ] = (12. + offset)* coeff; | |
640 | averaged_spec_mat_f0[ 16 + 25 * 13 ] = (13. + offset)* coeff; |
|
640 | averaged_spec_mat_f0[ 16 + 25 * 13 ] = (13. + offset)* coeff; | |
641 | averaged_spec_mat_f0[ 16 + 25 * 14 ] = (14. + offset)* coeff; |
|
641 | averaged_spec_mat_f0[ 16 + 25 * 14 ] = (14. + offset)* coeff; | |
642 |
|
642 | |||
643 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 0 ] = averaged_spec_mat_f0[ 0 ]; |
|
643 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 0 ] = averaged_spec_mat_f0[ 0 ]; | |
644 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 1 ] = averaged_spec_mat_f0[ 1 ]; |
|
644 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 1 ] = averaged_spec_mat_f0[ 1 ]; | |
645 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 2 ] = averaged_spec_mat_f0[ 2 ]; |
|
645 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 2 ] = averaged_spec_mat_f0[ 2 ]; | |
646 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 3 ] = averaged_spec_mat_f0[ 3 ]; |
|
646 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 3 ] = averaged_spec_mat_f0[ 3 ]; | |
647 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 4 ] = averaged_spec_mat_f0[ 4 ]; |
|
647 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 4 ] = averaged_spec_mat_f0[ 4 ]; | |
648 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 5 ] = averaged_spec_mat_f0[ 5 ]; |
|
648 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 5 ] = averaged_spec_mat_f0[ 5 ]; | |
649 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 6 ] = averaged_spec_mat_f0[ 6 ]; |
|
649 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 6 ] = averaged_spec_mat_f0[ 6 ]; | |
650 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 7 ] = averaged_spec_mat_f0[ 7 ]; |
|
650 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 7 ] = averaged_spec_mat_f0[ 7 ]; | |
651 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 8 ] = averaged_spec_mat_f0[ 8 ]; |
|
651 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 8 ] = averaged_spec_mat_f0[ 8 ]; | |
652 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 9 ] = averaged_spec_mat_f0[ 9 ]; |
|
652 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 9 ] = averaged_spec_mat_f0[ 9 ]; | |
653 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 10 ] = averaged_spec_mat_f0[ 10 ]; |
|
653 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 10 ] = averaged_spec_mat_f0[ 10 ]; | |
654 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 11 ] = averaged_spec_mat_f0[ 11 ]; |
|
654 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 11 ] = averaged_spec_mat_f0[ 11 ]; | |
655 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 12 ] = averaged_spec_mat_f0[ 12 ]; |
|
655 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 12 ] = averaged_spec_mat_f0[ 12 ]; | |
656 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 13 ] = averaged_spec_mat_f0[ 13 ]; |
|
656 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 13 ] = averaged_spec_mat_f0[ 13 ]; | |
657 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 14 ] = averaged_spec_mat_f0[ 14 ]; |
|
657 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 14 ] = averaged_spec_mat_f0[ 14 ]; | |
658 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 15 ] = averaged_spec_mat_f0[ 15 ]; |
|
658 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 15 ] = averaged_spec_mat_f0[ 15 ]; | |
659 | #else |
|
659 | #else | |
660 | unsigned int i; |
|
660 | unsigned int i; | |
661 |
|
661 | |||
662 | for(i=0; i<TOTAL_SIZE_SM; i++) |
|
662 | for(i=0; i<TOTAL_SIZE_SM; i++) | |
663 | { |
|
663 | { | |
664 | if (spectral_matrix_regs->matrixF0_Address0 == (int) spec_mat_f0_0) |
|
664 | if (spectral_matrix_regs->matrixF0_Address0 == (int) spec_mat_f0_0) | |
665 | averaged_spec_mat_f0[i] = (float) spec_mat_f0_0_bis[ SM_HEADER + i ]; |
|
665 | averaged_spec_mat_f0[i] = (float) spec_mat_f0_0_bis[ SM_HEADER + i ]; | |
666 | else |
|
666 | else | |
667 | averaged_spec_mat_f0[i] = (float) spec_mat_f0_0[ SM_HEADER + i ]; |
|
667 | averaged_spec_mat_f0[i] = (float) spec_mat_f0_0[ SM_HEADER + i ]; | |
668 | } |
|
668 | } | |
669 | #endif |
|
669 | #endif | |
670 | } |
|
670 | } | |
671 |
|
671 | |||
672 | void reset_spectral_matrix_regs() |
|
672 | void reset_spectral_matrix_regs() | |
673 | { |
|
673 | { | |
674 | #ifdef GSA |
|
674 | #ifdef GSA | |
675 | #else |
|
675 | #else | |
676 | spectral_matrix_regs->matrixF0_Address0 = (int) spec_mat_f0_0; |
|
676 | spectral_matrix_regs->matrixF0_Address0 = (int) spec_mat_f0_0; | |
677 | spectral_matrix_regs->matrixFO_Address1 = (int) spec_mat_f0_1; |
|
677 | spectral_matrix_regs->matrixFO_Address1 = (int) spec_mat_f0_1; | |
678 | spectral_matrix_regs->matrixF1_Address = (int) spec_mat_f1; |
|
678 | spectral_matrix_regs->matrixF1_Address = (int) spec_mat_f1; | |
679 | spectral_matrix_regs->matrixF2_Address = (int) spec_mat_f2; |
|
679 | spectral_matrix_regs->matrixF2_Address = (int) spec_mat_f2; | |
680 | #endif |
|
680 | #endif | |
681 | } |
|
681 | } | |
682 |
|
682 | |||
683 | //****************** |
|
683 | //****************** | |
684 | // general functions |
|
684 | // general functions | |
685 |
|
685 | |||
686 |
|
686 | |||
687 |
|
687 | |||
688 |
|
688 |
@@ -1,1410 +1,1470 | |||||
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, rtems_id queue_id) |
|
82 | int TC_acceptance(ccsdsTelecommandPacket_t *TC, unsigned int tc_len_recv, rtems_id queue_id) | |
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( queue_id, TC, tc_len_recv + CCSDS_TC_TM_PACKET_OFFSET + 3); |
|
140 | status = rtems_message_queue_send( queue_id, 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, |
|
|||
306 | TMHeader_t *TMHeader, unsigned char tc_sid) |
|
|||
307 | { |
|
|||
308 | TMHeader->targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
|||
309 | TMHeader->protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
|||
310 | TMHeader->reserved = 0x00; |
|
|||
311 | TMHeader->userApplication = 0x00; |
|
|||
312 | TMHeader->packetID[0] = 0x0c; |
|
|||
313 | TMHeader->packetSequenceControl[0] = 0xc0; |
|
|||
314 | TMHeader->packetSequenceControl[1] = 0x00; |
|
|||
315 | TMHeader->packetLength[0] = (unsigned char) (packetLength>>8); |
|
|||
316 | TMHeader->packetLength[1] = (unsigned char) packetLength; |
|
|||
317 | TMHeader->spare1_pusVersion_spare2 = 0x10; |
|
|||
318 | TMHeader->destinationID = TM_DESTINATION_ID_GROUND; // default destination id |
|
|||
319 | switch (tm_type){ |
|
|||
320 | case(TM_LFR_TC_EXE_OK): |
|
|||
321 | TMHeader->packetID[1] = (unsigned char) TM_PACKET_ID_TC_EXE; |
|
|||
322 | TMHeader->serviceType = TM_TYPE_TC_EXE; // type |
|
|||
323 | TMHeader->serviceSubType = TM_SUBTYPE_EXE_OK; // subtype |
|
|||
324 | TMHeader->destinationID = tc_sid; // destination id |
|
|||
325 | break; |
|
|||
326 | case(TM_LFR_TC_EXE_ERR): |
|
|||
327 | TMHeader->packetID[1] = (unsigned char) TM_PACKET_ID_TC_EXE; |
|
|||
328 | TMHeader->serviceType = TM_TYPE_TC_EXE; // type |
|
|||
329 | TMHeader->serviceSubType = TM_SUBTYPE_EXE_NOK; // subtype |
|
|||
330 | TMHeader->destinationID = tc_sid; |
|
|||
331 | break; |
|
|||
332 | case(TM_LFR_HK): |
|
|||
333 | TMHeader->packetID[1] = (unsigned char) TM_PACKET_ID_HK; |
|
|||
334 | TMHeader->serviceType = TM_TYPE_HK; // type |
|
|||
335 | TMHeader->serviceSubType = TM_SUBTYPE_HK; // subtype |
|
|||
336 | break; |
|
|||
337 | case(TM_LFR_SCI): |
|
|||
338 | TMHeader->packetID[1] = (unsigned char) TM_PACKET_ID_SCIENCE_NORMAL_BURST; |
|
|||
339 | TMHeader->serviceType = TM_TYPE_LFR_SCIENCE; // type |
|
|||
340 | TMHeader->serviceSubType = TM_SUBTYPE_SCIENCE; // subtype |
|
|||
341 | break; |
|
|||
342 | case(TM_LFR_SCI_SBM): |
|
|||
343 | TMHeader->packetID[1] = (unsigned char) TM_PACKET_ID_SCIENCE_SBM1_SBM2; |
|
|||
344 | TMHeader->serviceType = TM_TYPE_LFR_SCIENCE; // type |
|
|||
345 | TMHeader->serviceSubType = TM_SUBTYPE_SCIENCE; // subtype |
|
|||
346 | break; |
|
|||
347 | case(TM_LFR_PAR_DUMP): |
|
|||
348 | TMHeader->packetID[1] = (unsigned char) TM_PACKET_ID_PARAMETER_DUMP; |
|
|||
349 | TMHeader->serviceType = TM_TYPE_HK; // type |
|
|||
350 | TMHeader->serviceSubType = TM_SUBTYPE_HK; // subtype |
|
|||
351 | break; |
|
|||
352 | default: |
|
|||
353 | return 0; |
|
|||
354 | } |
|
|||
355 | TMHeader->time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
|||
356 | TMHeader->time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
|||
357 | TMHeader->time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
|||
358 | TMHeader->time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
|||
359 | TMHeader->time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
|||
360 | TMHeader->time[5] = (unsigned char) (time_management_regs->fine_time); |
|
|||
361 |
|
||||
362 | return LFR_SUCCESSFUL; |
|
|||
363 | } |
|
|||
364 |
|
||||
365 | //*********** |
|
305 | //*********** | |
366 | // RTEMS TASK |
|
306 | // RTEMS TASK | |
367 | rtems_task recv_task( rtems_task_argument unused ) |
|
307 | rtems_task recv_task( rtems_task_argument unused ) | |
368 | { |
|
308 | { | |
369 | int len = 0; |
|
309 | int len = 0; | |
370 | unsigned int i = 0; |
|
310 | unsigned int i = 0; | |
371 | unsigned int data_length = 0; |
|
311 | unsigned int data_length = 0; | |
372 | ccsdsTelecommandPacket_t currentTC; |
|
312 | ccsdsTelecommandPacket_t currentTC; | |
373 | char data[100]; |
|
313 | char data[100]; | |
374 | rtems_status_code status; |
|
314 | rtems_status_code status; | |
375 | rtems_id queue_id; |
|
315 | rtems_id queue_id; | |
376 |
|
316 | |||
377 | for(i=0; i<100; i++) data[i] = 0; |
|
317 | for(i=0; i<100; i++) data[i] = 0; | |
378 |
|
318 | |||
379 | status = rtems_message_queue_ident( misc_name[QUEUE_QUEU], 0, &queue_id ); |
|
319 | status = rtems_message_queue_ident( misc_name[QUEUE_QUEU], 0, &queue_id ); | |
380 | if (status != RTEMS_SUCCESSFUL) |
|
320 | if (status != RTEMS_SUCCESSFUL) | |
381 | { |
|
321 | { | |
382 | PRINTF1("in RECV *** ERR getting queue id, %d\n", status) |
|
322 | PRINTF1("in RECV *** ERR getting queue id, %d\n", status) | |
383 | } |
|
323 | } | |
384 |
|
324 | |||
385 | BOOT_PRINTF("in RECV *** \n") |
|
325 | BOOT_PRINTF("in RECV *** \n") | |
386 |
|
326 | |||
387 | while(1) |
|
327 | while(1) | |
388 | { |
|
328 | { | |
389 | len = read(fdSPW, (char*) ¤tTC, CCSDS_TC_PKT_MAX_SIZE); // the call to read is blocking |
|
329 | len = read(fdSPW, (char*) ¤tTC, CCSDS_TC_PKT_MAX_SIZE); // the call to read is blocking | |
390 | if (len == -1){ // error during the read call |
|
330 | if (len == -1){ // error during the read call | |
391 | PRINTF("In RECV *** last read call returned -1\n") |
|
331 | PRINTF("In RECV *** last read call returned -1\n") | |
392 | //if (rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT ) != RTEMS_SUCCESSFUL) { |
|
332 | //if (rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT ) != RTEMS_SUCCESSFUL) { | |
393 | // PRINTF("IN RECV *** Error: rtems_event_send SPW_LINKERR_EVENT\n") |
|
333 | // PRINTF("IN RECV *** Error: rtems_event_send SPW_LINKERR_EVENT\n") | |
394 | //} |
|
334 | //} | |
395 | //if (rtems_task_suspend(RTEMS_SELF) != RTEMS_SUCCESSFUL) { |
|
335 | //if (rtems_task_suspend(RTEMS_SELF) != RTEMS_SUCCESSFUL) { | |
396 | // PRINTF("In RECV *** Error: rtems_task_suspend(RTEMS_SELF)\n") |
|
336 | // PRINTF("In RECV *** Error: rtems_task_suspend(RTEMS_SELF)\n") | |
397 | //} |
|
337 | //} | |
398 | } |
|
338 | } | |
399 | else { |
|
339 | else { | |
400 | if ( (len+1) < CCSDS_TC_PKT_MIN_SIZE ) { |
|
340 | if ( (len+1) < CCSDS_TC_PKT_MIN_SIZE ) { | |
401 | PRINTF("In RECV *** packet lenght too short\n") |
|
341 | PRINTF("In RECV *** packet lenght too short\n") | |
402 | } |
|
342 | } | |
403 | else { |
|
343 | else { | |
404 | currentTC_LEN_RCV[0] = 0x00; |
|
344 | currentTC_LEN_RCV[0] = 0x00; | |
405 | currentTC_LEN_RCV[1] = (unsigned char) (len - CCSDS_TC_TM_PACKET_OFFSET - 3); // build the corresponding packet size field |
|
345 | currentTC_LEN_RCV[1] = (unsigned char) (len - CCSDS_TC_TM_PACKET_OFFSET - 3); // build the corresponding packet size field | |
406 | currentTC_LEN_RCV_AsUnsignedInt = (unsigned int) (len - CCSDS_TC_TM_PACKET_OFFSET - 3); // => -3 is for Prot ID, Reserved and User App bytes |
|
346 | currentTC_LEN_RCV_AsUnsignedInt = (unsigned int) (len - CCSDS_TC_TM_PACKET_OFFSET - 3); // => -3 is for Prot ID, Reserved and User App bytes | |
407 | // CHECK THE TC AND BUILD THE APPROPRIATE TM |
|
347 | // CHECK THE TC AND BUILD THE APPROPRIATE TM | |
408 | data_length = TC_acceptance(¤tTC, currentTC_LEN_RCV_AsUnsignedInt, queue_id); |
|
348 | data_length = TC_acceptance(¤tTC, currentTC_LEN_RCV_AsUnsignedInt, queue_id); | |
409 | if (data_length!=-1) |
|
349 | if (data_length!=-1) | |
410 | { |
|
350 | { | |
411 | } |
|
351 | } | |
412 | } |
|
352 | } | |
413 | } |
|
353 | } | |
414 | } |
|
354 | } | |
415 | } |
|
355 | } | |
416 |
|
356 | |||
417 | rtems_task actn_task( rtems_task_argument unused ) |
|
357 | rtems_task actn_task( rtems_task_argument unused ) | |
418 | { |
|
358 | { | |
419 | int result; |
|
359 | int result; | |
420 | rtems_status_code status; // RTEMS status code |
|
360 | rtems_status_code status; // RTEMS status code | |
421 | ccsdsTelecommandPacket_t TC; // TC sent to the ACTN task |
|
361 | ccsdsTelecommandPacket_t TC; // TC sent to the ACTN task | |
422 | size_t size; // size of the incoming TC packet |
|
362 | size_t size; // size of the incoming TC packet | |
423 | unsigned char subtype; // subtype of the current TC packet |
|
363 | unsigned char subtype; // subtype of the current TC packet | |
424 | rtems_id queue_rcv_id; |
|
364 | rtems_id queue_rcv_id; | |
425 | rtems_id queue_snd_id; |
|
365 | rtems_id queue_snd_id; | |
426 |
|
366 | |||
427 | status = rtems_message_queue_ident( misc_name[QUEUE_QUEU], 0, &queue_rcv_id ); |
|
367 | status = rtems_message_queue_ident( misc_name[QUEUE_QUEU], 0, &queue_rcv_id ); | |
428 | if (status != RTEMS_SUCCESSFUL) |
|
368 | if (status != RTEMS_SUCCESSFUL) | |
429 | { |
|
369 | { | |
430 | PRINTF1("in ACTN *** ERR getting queue_rcv_id %d\n", status) |
|
370 | PRINTF1("in ACTN *** ERR getting queue_rcv_id %d\n", status) | |
431 | } |
|
371 | } | |
432 |
|
372 | |||
433 | status = rtems_message_queue_ident( misc_name[QUEUE_PKTS], 0, &queue_snd_id ); |
|
373 | status = rtems_message_queue_ident( misc_name[QUEUE_PKTS], 0, &queue_snd_id ); | |
434 | if (status != RTEMS_SUCCESSFUL) |
|
374 | if (status != RTEMS_SUCCESSFUL) | |
435 | { |
|
375 | { | |
436 | PRINTF1("in ACTN *** ERR getting queue_snd_id %d\n", status) |
|
376 | PRINTF1("in ACTN *** ERR getting queue_snd_id %d\n", status) | |
437 | } |
|
377 | } | |
438 |
|
378 | |||
439 | result = LFR_SUCCESSFUL; |
|
379 | result = LFR_SUCCESSFUL; | |
440 | subtype = 0; // subtype of the current TC packet |
|
380 | subtype = 0; // subtype of the current TC packet | |
441 |
|
381 | |||
442 | BOOT_PRINTF("in ACTN *** \n") |
|
382 | BOOT_PRINTF("in ACTN *** \n") | |
443 |
|
383 | |||
444 | while(1) |
|
384 | while(1) | |
445 | { |
|
385 | { | |
446 | status = rtems_message_queue_receive( queue_rcv_id, (char*) &TC, &size, |
|
386 | status = rtems_message_queue_receive( queue_rcv_id, (char*) &TC, &size, | |
447 | RTEMS_WAIT, RTEMS_NO_TIMEOUT); |
|
387 | RTEMS_WAIT, RTEMS_NO_TIMEOUT); | |
448 | if (status!=RTEMS_SUCCESSFUL) PRINTF1("ERR *** in task ACTN *** error receiving a message, code %d \n", status) |
|
388 | if (status!=RTEMS_SUCCESSFUL) PRINTF1("ERR *** in task ACTN *** error receiving a message, code %d \n", status) | |
449 | else |
|
389 | else | |
450 | { |
|
390 | { | |
451 | subtype = TC.serviceSubType; |
|
391 | subtype = TC.serviceSubType; | |
452 | switch(subtype) |
|
392 | switch(subtype) | |
453 | { |
|
393 | { | |
454 | case TC_SUBTYPE_RESET: |
|
394 | case TC_SUBTYPE_RESET: | |
455 | result = action_reset( &TC, queue_snd_id ); |
|
395 | result = action_reset( &TC, queue_snd_id ); | |
456 | close_action( &TC, result, queue_snd_id ); |
|
396 | close_action( &TC, result, queue_snd_id ); | |
457 | break; |
|
397 | break; | |
458 | // |
|
398 | // | |
459 | case TC_SUBTYPE_LOAD_COMM: |
|
399 | case TC_SUBTYPE_LOAD_COMM: | |
460 | result = action_load_common_par( &TC ); |
|
400 | result = action_load_common_par( &TC ); | |
461 | close_action( &TC, result, queue_snd_id ); |
|
401 | close_action( &TC, result, queue_snd_id ); | |
462 | break; |
|
402 | break; | |
463 | // |
|
403 | // | |
464 | case TC_SUBTYPE_LOAD_NORM: |
|
404 | case TC_SUBTYPE_LOAD_NORM: | |
465 | result = action_load_normal_par( &TC, queue_snd_id ); |
|
405 | result = action_load_normal_par( &TC, queue_snd_id ); | |
466 | close_action( &TC, result, queue_snd_id ); |
|
406 | close_action( &TC, result, queue_snd_id ); | |
467 | break; |
|
407 | break; | |
468 | // |
|
408 | // | |
469 | case TC_SUBTYPE_LOAD_BURST: |
|
409 | case TC_SUBTYPE_LOAD_BURST: | |
470 | result = action_load_burst_par( &TC, queue_snd_id ); |
|
410 | result = action_load_burst_par( &TC, queue_snd_id ); | |
471 | close_action( &TC, result, queue_snd_id ); |
|
411 | close_action( &TC, result, queue_snd_id ); | |
472 | break; |
|
412 | break; | |
473 | // |
|
413 | // | |
474 | case TC_SUBTYPE_LOAD_SBM1: |
|
414 | case TC_SUBTYPE_LOAD_SBM1: | |
475 | result = action_load_sbm1_par( &TC, queue_snd_id ); |
|
415 | result = action_load_sbm1_par( &TC, queue_snd_id ); | |
476 | close_action( &TC, result, queue_snd_id ); |
|
416 | close_action( &TC, result, queue_snd_id ); | |
477 | break; |
|
417 | break; | |
478 | // |
|
418 | // | |
479 | case TC_SUBTYPE_LOAD_SBM2: |
|
419 | case TC_SUBTYPE_LOAD_SBM2: | |
480 | result = action_load_sbm2_par( &TC, queue_snd_id ); |
|
420 | result = action_load_sbm2_par( &TC, queue_snd_id ); | |
481 | close_action( &TC, result, queue_snd_id ); |
|
421 | close_action( &TC, result, queue_snd_id ); | |
482 | break; |
|
422 | break; | |
483 | // |
|
423 | // | |
484 | case TC_SUBTYPE_DUMP: |
|
424 | case TC_SUBTYPE_DUMP: | |
485 | result = action_dump_par( &TC ); |
|
425 | result = action_dump_par( &TC ); | |
486 | close_action( &TC, result, queue_snd_id ); |
|
426 | close_action( &TC, result, queue_snd_id ); | |
487 | break; |
|
427 | break; | |
488 | // |
|
428 | // | |
489 | case TC_SUBTYPE_ENTER: |
|
429 | case TC_SUBTYPE_ENTER: | |
490 | result = action_enter_mode( &TC, queue_snd_id ); |
|
430 | result = action_enter_mode( &TC, queue_snd_id ); | |
491 | close_action( &TC, result, queue_snd_id ); |
|
431 | close_action( &TC, result, queue_snd_id ); | |
492 | break; |
|
432 | break; | |
493 | // |
|
433 | // | |
494 | case TC_SUBTYPE_UPDT_INFO: |
|
434 | case TC_SUBTYPE_UPDT_INFO: | |
495 | result = action_update_info( &TC, queue_snd_id ); |
|
435 | result = action_update_info( &TC, queue_snd_id ); | |
496 | close_action( &TC, result, queue_snd_id ); |
|
436 | close_action( &TC, result, queue_snd_id ); | |
497 | break; |
|
437 | break; | |
498 | // |
|
438 | // | |
499 | case TC_SUBTYPE_EN_CAL: |
|
439 | case TC_SUBTYPE_EN_CAL: | |
500 | result = action_enable_calibration( &TC, queue_snd_id ); |
|
440 | result = action_enable_calibration( &TC, queue_snd_id ); | |
501 | close_action( &TC, result, queue_snd_id ); |
|
441 | close_action( &TC, result, queue_snd_id ); | |
502 | break; |
|
442 | break; | |
503 | // |
|
443 | // | |
504 | case TC_SUBTYPE_DIS_CAL: |
|
444 | case TC_SUBTYPE_DIS_CAL: | |
505 | result = action_disable_calibration( &TC, queue_snd_id ); |
|
445 | result = action_disable_calibration( &TC, queue_snd_id ); | |
506 | close_action( &TC, result, queue_snd_id ); |
|
446 | close_action( &TC, result, queue_snd_id ); | |
507 | break; |
|
447 | break; | |
508 | // |
|
448 | // | |
509 | case TC_SUBTYPE_UPDT_TIME: |
|
449 | case TC_SUBTYPE_UPDT_TIME: | |
510 | result = action_update_time( &TC ); |
|
450 | result = action_update_time( &TC ); | |
511 | close_action( &TC, result, queue_snd_id ); |
|
451 | close_action( &TC, result, queue_snd_id ); | |
512 | break; |
|
452 | break; | |
513 | // |
|
453 | // | |
514 | default: |
|
454 | default: | |
515 | break; |
|
455 | break; | |
516 | } |
|
456 | } | |
517 | } |
|
457 | } | |
518 | } |
|
458 | } | |
519 | } |
|
459 | } | |
520 |
|
460 | |||
521 | rtems_task dumb_task( rtems_task_argument unused ) |
|
461 | rtems_task dumb_task( rtems_task_argument unused ) | |
522 | { |
|
462 | { | |
523 | unsigned int i; |
|
463 | unsigned int i; | |
524 | unsigned int intEventOut; |
|
464 | unsigned int intEventOut; | |
525 | unsigned int coarse_time = 0; |
|
465 | unsigned int coarse_time = 0; | |
526 | unsigned int fine_time = 0; |
|
466 | unsigned int fine_time = 0; | |
527 | rtems_event_set event_out; |
|
467 | rtems_event_set event_out; | |
528 |
|
468 | |||
529 | BOOT_PRINTF("in DUMB *** \n") |
|
469 | BOOT_PRINTF("in DUMB *** \n") | |
530 |
|
470 | |||
531 | while(1){ |
|
471 | while(1){ | |
532 | rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3 | RTEMS_EVENT_4 | RTEMS_EVENT_5, |
|
472 | rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3 | RTEMS_EVENT_4 | RTEMS_EVENT_5, | |
533 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT |
|
473 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT | |
534 | intEventOut = (unsigned int) event_out; |
|
474 | intEventOut = (unsigned int) event_out; | |
535 | for ( i=0; i<32; i++) |
|
475 | for ( i=0; i<32; i++) | |
536 | { |
|
476 | { | |
537 | if ( ((intEventOut >> i) & 0x0001) != 0) |
|
477 | if ( ((intEventOut >> i) & 0x0001) != 0) | |
538 | { |
|
478 | { | |
539 | coarse_time = time_management_regs->coarse_time; |
|
479 | coarse_time = time_management_regs->coarse_time; | |
540 | fine_time = time_management_regs->fine_time; |
|
480 | fine_time = time_management_regs->fine_time; | |
541 | printf("in DUMB *** time = coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]); |
|
481 | printf("in DUMB *** time = coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]); | |
542 | } |
|
482 | } | |
543 | } |
|
483 | } | |
544 | } |
|
484 | } | |
545 | } |
|
485 | } | |
546 |
|
486 | |||
547 | //*********** |
|
487 | //*********** | |
548 | // TC ACTIONS |
|
488 | // TC ACTIONS | |
549 |
|
489 | |||
550 | int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
490 | int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) | |
551 | { |
|
491 | { | |
552 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id ); |
|
492 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id ); | |
553 | return LFR_DEFAULT; |
|
493 | return LFR_DEFAULT; | |
554 | } |
|
494 | } | |
555 |
|
495 | |||
556 | int action_load_common_par(ccsdsTelecommandPacket_t *TC) |
|
496 | int action_load_common_par(ccsdsTelecommandPacket_t *TC) | |
557 | { |
|
497 | { | |
558 | parameter_dump_packet.unused0 = TC->dataAndCRC[0]; |
|
498 | parameter_dump_packet.unused0 = TC->dataAndCRC[0]; | |
559 | parameter_dump_packet.bw_sp0_sp1_r0_r1 = TC->dataAndCRC[1]; |
|
499 | parameter_dump_packet.bw_sp0_sp1_r0_r1 = TC->dataAndCRC[1]; | |
560 |
|
500 | |||
561 | set_wfp_data_shaping(parameter_dump_packet.bw_sp0_sp1_r0_r1); |
|
501 | set_wfp_data_shaping(parameter_dump_packet.bw_sp0_sp1_r0_r1); | |
562 |
|
502 | |||
563 | return LFR_SUCCESSFUL; |
|
503 | return LFR_SUCCESSFUL; | |
564 | } |
|
504 | } | |
565 |
|
505 | |||
566 | int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
506 | int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) | |
567 | { |
|
507 | { | |
568 | int result; |
|
508 | int result; | |
569 | unsigned int tmp; |
|
509 | unsigned int tmp; | |
570 |
|
510 | |||
571 | result = LFR_SUCCESSFUL; |
|
511 | result = LFR_SUCCESSFUL; | |
572 |
|
512 | |||
573 | if ( lfrCurrentMode == LFR_MODE_NORMAL ) { |
|
513 | if ( lfrCurrentMode == LFR_MODE_NORMAL ) { | |
574 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); |
|
514 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); | |
575 | result = LFR_DEFAULT; |
|
515 | result = LFR_DEFAULT; | |
576 | } |
|
516 | } | |
577 | else { |
|
517 | else { | |
578 | // sy_lfr_n_swf_l |
|
518 | // sy_lfr_n_swf_l | |
579 | parameter_dump_packet.sy_lfr_n_swf_l[0] = TC->dataAndCRC[0]; |
|
519 | parameter_dump_packet.sy_lfr_n_swf_l[0] = TC->dataAndCRC[0]; | |
580 | parameter_dump_packet.sy_lfr_n_swf_l[1] = TC->dataAndCRC[1]; |
|
520 | parameter_dump_packet.sy_lfr_n_swf_l[1] = TC->dataAndCRC[1]; | |
581 |
|
521 | |||
582 | // sy_lfr_n_swf_p |
|
522 | // sy_lfr_n_swf_p | |
583 | tmp = (unsigned int ) floor( |
|
523 | tmp = (unsigned int ) floor( | |
584 | (TC->dataAndCRC[2] * 256 |
|
524 | (TC->dataAndCRC[2] * 256 | |
585 | + TC->dataAndCRC[3])/8 |
|
525 | + TC->dataAndCRC[3])/8 | |
586 | ) * 8; |
|
526 | ) * 8; | |
587 | if ( (tmp < 16) || (tmp>65528) ) |
|
527 | if ( (tmp < 16) || (tmp>65528) ) | |
588 | { |
|
528 | { | |
589 | result = LFR_DEFAULT; |
|
529 | result = LFR_DEFAULT; | |
590 | } |
|
530 | } | |
591 | else |
|
531 | else | |
592 | { |
|
532 | { | |
593 | parameter_dump_packet.sy_lfr_n_swf_p[0] = (unsigned char) (tmp >> 8); |
|
533 | parameter_dump_packet.sy_lfr_n_swf_p[0] = (unsigned char) (tmp >> 8); | |
594 | parameter_dump_packet.sy_lfr_n_swf_p[1] = (unsigned char) (tmp ); |
|
534 | parameter_dump_packet.sy_lfr_n_swf_p[1] = (unsigned char) (tmp ); | |
595 | } |
|
535 | } | |
596 |
|
536 | |||
597 | // sy_lfr_n_asm_p |
|
537 | // sy_lfr_n_asm_p | |
598 | parameter_dump_packet.sy_lfr_n_asm_p[0] = TC->dataAndCRC[4]; |
|
538 | parameter_dump_packet.sy_lfr_n_asm_p[0] = TC->dataAndCRC[4]; | |
599 | parameter_dump_packet.sy_lfr_n_asm_p[1] = TC->dataAndCRC[5]; |
|
539 | parameter_dump_packet.sy_lfr_n_asm_p[1] = TC->dataAndCRC[5]; | |
600 |
|
540 | |||
601 | // sy_lfr_n_bp_p0 |
|
541 | // sy_lfr_n_bp_p0 | |
602 | parameter_dump_packet.sy_lfr_n_bp_p0 = TC->dataAndCRC[6]; |
|
542 | parameter_dump_packet.sy_lfr_n_bp_p0 = TC->dataAndCRC[6]; | |
603 |
|
543 | |||
604 | // sy_lfr_n_bp_p1 |
|
544 | // sy_lfr_n_bp_p1 | |
605 | parameter_dump_packet.sy_lfr_n_bp_p1 = TC->dataAndCRC[7]; |
|
545 | parameter_dump_packet.sy_lfr_n_bp_p1 = TC->dataAndCRC[7]; | |
606 | } |
|
546 | } | |
607 |
|
547 | |||
608 | return result; |
|
548 | return result; | |
609 | } |
|
549 | } | |
610 |
|
550 | |||
611 | int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
551 | int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) | |
612 | { |
|
552 | { | |
613 | int result; |
|
553 | int result; | |
614 | unsigned char lfrMode; |
|
554 | unsigned char lfrMode; | |
615 |
|
555 | |||
616 | result = LFR_DEFAULT; |
|
556 | result = LFR_DEFAULT; | |
617 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
557 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
618 |
|
558 | |||
619 | if ( lfrMode == LFR_MODE_BURST ) { |
|
559 | if ( lfrMode == LFR_MODE_BURST ) { | |
620 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); |
|
560 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); | |
621 | result = LFR_DEFAULT; |
|
561 | result = LFR_DEFAULT; | |
622 | } |
|
562 | } | |
623 | else { |
|
563 | else { | |
624 | parameter_dump_packet.sy_lfr_b_bp_p0 = TC->dataAndCRC[0]; |
|
564 | parameter_dump_packet.sy_lfr_b_bp_p0 = TC->dataAndCRC[0]; | |
625 | parameter_dump_packet.sy_lfr_b_bp_p1 = TC->dataAndCRC[1]; |
|
565 | parameter_dump_packet.sy_lfr_b_bp_p1 = TC->dataAndCRC[1]; | |
626 |
|
566 | |||
627 | result = LFR_SUCCESSFUL; |
|
567 | result = LFR_SUCCESSFUL; | |
628 | } |
|
568 | } | |
629 |
|
569 | |||
630 | return result; |
|
570 | return result; | |
631 | } |
|
571 | } | |
632 |
|
572 | |||
633 | int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
573 | int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) | |
634 | { |
|
574 | { | |
635 | int result; |
|
575 | int result; | |
636 | unsigned char lfrMode; |
|
576 | unsigned char lfrMode; | |
637 |
|
577 | |||
638 | result = LFR_DEFAULT; |
|
578 | result = LFR_DEFAULT; | |
639 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
579 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
640 |
|
580 | |||
641 | if ( lfrMode == LFR_MODE_SBM1 ) { |
|
581 | if ( lfrMode == LFR_MODE_SBM1 ) { | |
642 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); |
|
582 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); | |
643 | result = LFR_DEFAULT; |
|
583 | result = LFR_DEFAULT; | |
644 | } |
|
584 | } | |
645 | else { |
|
585 | else { | |
646 | parameter_dump_packet.sy_lfr_s1_bp_p0 = TC->dataAndCRC[0]; |
|
586 | parameter_dump_packet.sy_lfr_s1_bp_p0 = TC->dataAndCRC[0]; | |
647 | parameter_dump_packet.sy_lfr_s1_bp_p1 = TC->dataAndCRC[1]; |
|
587 | parameter_dump_packet.sy_lfr_s1_bp_p1 = TC->dataAndCRC[1]; | |
648 |
|
588 | |||
649 | result = LFR_SUCCESSFUL; |
|
589 | result = LFR_SUCCESSFUL; | |
650 | } |
|
590 | } | |
651 |
|
591 | |||
652 | return result; |
|
592 | return result; | |
653 | } |
|
593 | } | |
654 |
|
594 | |||
655 | int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
595 | int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) | |
656 | { |
|
596 | { | |
657 | int result; |
|
597 | int result; | |
658 | unsigned char lfrMode; |
|
598 | unsigned char lfrMode; | |
659 |
|
599 | |||
660 | result = LFR_DEFAULT; |
|
600 | result = LFR_DEFAULT; | |
661 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
601 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
662 |
|
602 | |||
663 | if ( lfrMode == LFR_MODE_SBM2 ) { |
|
603 | if ( lfrMode == LFR_MODE_SBM2 ) { | |
664 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); |
|
604 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); | |
665 | result = LFR_DEFAULT; |
|
605 | result = LFR_DEFAULT; | |
666 | } |
|
606 | } | |
667 | else { |
|
607 | else { | |
668 | parameter_dump_packet.sy_lfr_s2_bp_p0 = TC->dataAndCRC[0]; |
|
608 | parameter_dump_packet.sy_lfr_s2_bp_p0 = TC->dataAndCRC[0]; | |
669 | parameter_dump_packet.sy_lfr_s2_bp_p1 = TC->dataAndCRC[1]; |
|
609 | parameter_dump_packet.sy_lfr_s2_bp_p1 = TC->dataAndCRC[1]; | |
670 |
|
610 | |||
671 | result = LFR_SUCCESSFUL; |
|
611 | result = LFR_SUCCESSFUL; | |
672 | } |
|
612 | } | |
673 |
|
613 | |||
674 | return result; |
|
614 | return result; | |
675 | } |
|
615 | } | |
676 |
|
616 | |||
677 | int action_dump_par(ccsdsTelecommandPacket_t *TC) |
|
617 | int action_dump_par(ccsdsTelecommandPacket_t *TC) | |
678 | { |
|
618 | { | |
679 | int status; |
|
619 | int status; | |
680 | // send parameter dump packet |
|
620 | // send parameter dump packet | |
681 | status = write(fdSPW, (char *) ¶meter_dump_packet, |
|
621 | status = write(fdSPW, (char *) ¶meter_dump_packet, | |
682 | PACKET_LENGTH_PARAMETER_DUMP + CCSDS_TC_TM_PACKET_OFFSET + 4); |
|
622 | PACKET_LENGTH_PARAMETER_DUMP + CCSDS_TC_TM_PACKET_OFFSET + 4); | |
683 | if (status == -1) |
|
623 | if (status == -1) | |
684 | { |
|
624 | { | |
685 | PRINTF1("in action_dump *** ERR sending packet, code %d", status) |
|
625 | PRINTF1("in action_dump *** ERR sending packet, code %d", status) | |
686 | status = RTEMS_UNSATISFIED; |
|
626 | status = RTEMS_UNSATISFIED; | |
687 | } |
|
627 | } | |
688 | else |
|
628 | else | |
689 | { |
|
629 | { | |
690 | status = RTEMS_SUCCESSFUL; |
|
630 | status = RTEMS_SUCCESSFUL; | |
691 | } |
|
631 | } | |
692 |
|
632 | |||
693 | return status; |
|
633 | return status; | |
694 | } |
|
634 | } | |
695 |
|
635 | |||
696 | int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
636 | int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) | |
697 | { |
|
637 | { | |
698 | rtems_status_code status; |
|
638 | rtems_status_code status; | |
699 | unsigned char requestedMode; |
|
639 | unsigned char requestedMode; | |
700 |
|
640 | |||
701 | requestedMode = TC->dataAndCRC[1]; |
|
641 | requestedMode = TC->dataAndCRC[1]; | |
702 |
|
642 | |||
703 | printf("try to enter mode %d\n", requestedMode); |
|
643 | if ( (requestedMode != LFR_MODE_STANDBY) | |
704 |
|
644 | && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST) | ||
705 | #ifdef PRINT_TASK_STATISTICS |
|
645 | && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) ) | |
706 | if (requestedMode != LFR_MODE_STANDBY) |
|
|||
707 | { |
|
646 | { | |
708 | rtems_cpu_usage_reset(); |
|
647 | status = RTEMS_UNSATISFIED; | |
709 | maxCount = 0; |
|
648 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_LFR_MODE, requestedMode ); | |
710 | } |
|
|||
711 | #endif |
|
|||
712 |
|
||||
713 | status = transition_validation(requestedMode); |
|
|||
714 |
|
||||
715 | if ( status == LFR_SUCCESSFUL ) { |
|
|||
716 | if ( lfrCurrentMode != LFR_MODE_STANDBY) |
|
|||
717 | { |
|
|||
718 | status = stop_current_mode(); |
|
|||
719 | } |
|
|||
720 | if (status != RTEMS_SUCCESSFUL) |
|
|||
721 | { |
|
|||
722 | PRINTF("ERR *** in action_enter *** stop_current_mode\n") |
|
|||
723 | } |
|
|||
724 | status = enter_mode(requestedMode, TC); |
|
|||
725 | } |
|
649 | } | |
726 | else |
|
650 | else | |
727 | { |
|
651 | { | |
728 | PRINTF("ERR *** in action_enter *** transition rejected\n") |
|
652 | printf("try to enter mode %d\n", requestedMode); | |
729 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); |
|
653 | ||
|
654 | #ifdef PRINT_TASK_STATISTICS | |||
|
655 | if (requestedMode != LFR_MODE_STANDBY) | |||
|
656 | { | |||
|
657 | rtems_cpu_usage_reset(); | |||
|
658 | maxCount = 0; | |||
|
659 | } | |||
|
660 | #endif | |||
|
661 | ||||
|
662 | status = transition_validation(requestedMode); | |||
|
663 | ||||
|
664 | if ( status == LFR_SUCCESSFUL ) { | |||
|
665 | if ( lfrCurrentMode != LFR_MODE_STANDBY) | |||
|
666 | { | |||
|
667 | status = stop_current_mode(); | |||
|
668 | } | |||
|
669 | if (status != RTEMS_SUCCESSFUL) | |||
|
670 | { | |||
|
671 | PRINTF("ERR *** in action_enter *** stop_current_mode\n") | |||
|
672 | } | |||
|
673 | status = enter_mode(requestedMode, TC); | |||
|
674 | } | |||
|
675 | else | |||
|
676 | { | |||
|
677 | PRINTF("ERR *** in action_enter *** transition rejected\n") | |||
|
678 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); | |||
|
679 | } | |||
730 | } |
|
680 | } | |
731 |
|
681 | |||
732 | return status; |
|
682 | return status; | |
733 | } |
|
683 | } | |
734 |
|
684 | |||
735 | int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) { |
|
685 | int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) { | |
736 | unsigned int val; |
|
686 | unsigned int val; | |
737 | int result; |
|
687 | int result; | |
738 | unsigned char lfrMode; |
|
688 | unsigned char lfrMode; | |
739 |
|
689 | |||
740 | result = LFR_DEFAULT; |
|
690 | result = LFR_DEFAULT; | |
741 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
691 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
742 |
|
692 | |||
743 | if ( (lfrMode == LFR_MODE_STANDBY) ) { |
|
693 | if ( (lfrMode == LFR_MODE_STANDBY) ) { | |
744 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id ); |
|
694 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id ); | |
745 | result = LFR_DEFAULT; |
|
695 | result = LFR_DEFAULT; | |
746 | } |
|
696 | } | |
747 | else { |
|
697 | else { | |
748 | val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256 |
|
698 | val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256 | |
749 | + housekeeping_packet.hk_lfr_update_info_tc_cnt[1]; |
|
699 | + housekeeping_packet.hk_lfr_update_info_tc_cnt[1]; | |
750 | val++; |
|
700 | val++; | |
751 | housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8); |
|
701 | housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8); | |
752 | housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val); |
|
702 | housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val); | |
753 | result = LFR_SUCCESSFUL; |
|
703 | result = LFR_SUCCESSFUL; | |
754 | } |
|
704 | } | |
755 |
|
705 | |||
756 | return result; |
|
706 | return result; | |
757 | } |
|
707 | } | |
758 |
|
708 | |||
759 | int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
709 | int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) | |
760 | { |
|
710 | { | |
761 | int result; |
|
711 | int result; | |
762 | unsigned char lfrMode; |
|
712 | unsigned char lfrMode; | |
763 |
|
713 | |||
764 | result = LFR_DEFAULT; |
|
714 | result = LFR_DEFAULT; | |
765 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
715 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
766 |
|
716 | |||
767 | if ( (lfrMode == LFR_MODE_STANDBY) | (lfrMode == LFR_MODE_BURST) | (lfrMode == LFR_MODE_SBM2) ) { |
|
717 | if ( (lfrMode == LFR_MODE_STANDBY) | (lfrMode == LFR_MODE_BURST) | (lfrMode == LFR_MODE_SBM2) ) { | |
768 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); |
|
718 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); | |
769 | result = LFR_DEFAULT; |
|
719 | result = LFR_DEFAULT; | |
770 | } |
|
720 | } | |
771 | else { |
|
721 | else { | |
772 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id ); |
|
722 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id ); | |
773 | result = LFR_DEFAULT; |
|
723 | result = LFR_DEFAULT; | |
774 | } |
|
724 | } | |
775 | return result; |
|
725 | return result; | |
776 | } |
|
726 | } | |
777 |
|
727 | |||
778 | int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
728 | int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) | |
779 | { |
|
729 | { | |
780 | int result; |
|
730 | int result; | |
781 | unsigned char lfrMode; |
|
731 | unsigned char lfrMode; | |
782 |
|
732 | |||
783 | result = LFR_DEFAULT; |
|
733 | result = LFR_DEFAULT; | |
784 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
734 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
785 |
|
735 | |||
786 | if ( (lfrMode == LFR_MODE_STANDBY) | (lfrMode == LFR_MODE_BURST) | (lfrMode == LFR_MODE_SBM2) ) { |
|
736 | if ( (lfrMode == LFR_MODE_STANDBY) | (lfrMode == LFR_MODE_BURST) | (lfrMode == LFR_MODE_SBM2) ) { | |
787 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); |
|
737 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); | |
788 | result = LFR_DEFAULT; |
|
738 | result = LFR_DEFAULT; | |
789 | } |
|
739 | } | |
790 | else { |
|
740 | else { | |
791 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id ); |
|
741 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id ); | |
792 | result = LFR_DEFAULT; |
|
742 | result = LFR_DEFAULT; | |
793 | } |
|
743 | } | |
794 | return result; |
|
744 | return result; | |
795 | } |
|
745 | } | |
796 |
|
746 | |||
797 | int action_update_time(ccsdsTelecommandPacket_t *TC) |
|
747 | int action_update_time(ccsdsTelecommandPacket_t *TC) | |
798 | { |
|
748 | { | |
799 | unsigned int val; |
|
749 | unsigned int val; | |
800 |
|
750 | |||
801 | time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24) |
|
751 | time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24) | |
802 | + (TC->dataAndCRC[1] << 16) |
|
752 | + (TC->dataAndCRC[1] << 16) | |
803 | + (TC->dataAndCRC[2] << 8) |
|
753 | + (TC->dataAndCRC[2] << 8) | |
804 | + TC->dataAndCRC[3]; |
|
754 | + TC->dataAndCRC[3]; | |
805 | val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256 |
|
755 | val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256 | |
806 | + housekeeping_packet.hk_lfr_update_time_tc_cnt[1]; |
|
756 | + housekeeping_packet.hk_lfr_update_time_tc_cnt[1]; | |
807 | val++; |
|
757 | val++; | |
808 | housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8); |
|
758 | housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8); | |
809 | housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val); |
|
759 | housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val); | |
810 | time_management_regs->ctrl = time_management_regs->ctrl | 1; |
|
760 | time_management_regs->ctrl = time_management_regs->ctrl | 1; | |
811 |
|
761 | |||
812 | return LFR_SUCCESSFUL; |
|
762 | return LFR_SUCCESSFUL; | |
813 | } |
|
763 | } | |
814 |
|
764 | |||
815 | //******************* |
|
765 | //******************* | |
816 | // ENTERING THE MODES |
|
766 | // ENTERING THE MODES | |
817 |
|
767 | |||
818 | int transition_validation(unsigned char requestedMode) |
|
768 | int transition_validation(unsigned char requestedMode) | |
819 | { |
|
769 | { | |
820 | int status; |
|
770 | int status; | |
821 |
|
771 | |||
822 | switch (requestedMode) |
|
772 | switch (requestedMode) | |
823 | { |
|
773 | { | |
824 | case LFR_MODE_STANDBY: |
|
774 | case LFR_MODE_STANDBY: | |
825 | if ( lfrCurrentMode == LFR_MODE_STANDBY ) { |
|
775 | if ( lfrCurrentMode == LFR_MODE_STANDBY ) { | |
826 | status = LFR_DEFAULT; |
|
776 | status = LFR_DEFAULT; | |
827 | } |
|
777 | } | |
828 | else |
|
778 | else | |
829 | { |
|
779 | { | |
830 | status = LFR_SUCCESSFUL; |
|
780 | status = LFR_SUCCESSFUL; | |
831 | } |
|
781 | } | |
832 | break; |
|
782 | break; | |
833 | case LFR_MODE_NORMAL: |
|
783 | case LFR_MODE_NORMAL: | |
834 | if ( lfrCurrentMode == LFR_MODE_NORMAL ) { |
|
784 | if ( lfrCurrentMode == LFR_MODE_NORMAL ) { | |
835 | status = LFR_DEFAULT; |
|
785 | status = LFR_DEFAULT; | |
836 | } |
|
786 | } | |
837 | else { |
|
787 | else { | |
838 | status = LFR_SUCCESSFUL; |
|
788 | status = LFR_SUCCESSFUL; | |
839 | } |
|
789 | } | |
840 | break; |
|
790 | break; | |
841 | case LFR_MODE_BURST: |
|
791 | case LFR_MODE_BURST: | |
842 | if ( lfrCurrentMode == LFR_MODE_BURST ) { |
|
792 | if ( lfrCurrentMode == LFR_MODE_BURST ) { | |
843 | status = LFR_DEFAULT; |
|
793 | status = LFR_DEFAULT; | |
844 | } |
|
794 | } | |
845 | else { |
|
795 | else { | |
846 | status = LFR_SUCCESSFUL; |
|
796 | status = LFR_SUCCESSFUL; | |
847 | } |
|
797 | } | |
848 | break; |
|
798 | break; | |
849 | case LFR_MODE_SBM1: |
|
799 | case LFR_MODE_SBM1: | |
850 | if ( lfrCurrentMode == LFR_MODE_SBM1 ) { |
|
800 | if ( lfrCurrentMode == LFR_MODE_SBM1 ) { | |
851 | status = LFR_DEFAULT; |
|
801 | status = LFR_DEFAULT; | |
852 | } |
|
802 | } | |
853 | else { |
|
803 | else { | |
854 | status = LFR_SUCCESSFUL; |
|
804 | status = LFR_SUCCESSFUL; | |
855 | } |
|
805 | } | |
856 | break; |
|
806 | break; | |
857 | case LFR_MODE_SBM2: |
|
807 | case LFR_MODE_SBM2: | |
858 | if ( lfrCurrentMode == LFR_MODE_SBM2 ) { |
|
808 | if ( lfrCurrentMode == LFR_MODE_SBM2 ) { | |
859 | status = LFR_DEFAULT; |
|
809 | status = LFR_DEFAULT; | |
860 | } |
|
810 | } | |
861 | else { |
|
811 | else { | |
862 | status = LFR_SUCCESSFUL; |
|
812 | status = LFR_SUCCESSFUL; | |
863 | } |
|
813 | } | |
864 | break; |
|
814 | break; | |
865 | default: |
|
815 | default: | |
866 | status = LFR_DEFAULT; |
|
816 | status = LFR_DEFAULT; | |
867 | break; |
|
817 | break; | |
868 | } |
|
818 | } | |
869 |
|
819 | |||
870 | return status; |
|
820 | return status; | |
871 | } |
|
821 | } | |
872 |
|
822 | |||
873 | int stop_current_mode() |
|
823 | int stop_current_mode() | |
874 | { |
|
824 | { | |
875 | rtems_status_code status; |
|
825 | rtems_status_code status; | |
876 |
|
826 | |||
877 | status = RTEMS_SUCCESSFUL; |
|
827 | status = RTEMS_SUCCESSFUL; | |
878 |
|
828 | |||
879 | // mask all IRQ lines related to signal processing |
|
829 | // mask all IRQ lines related to signal processing | |
880 | LEON_Mask_interrupt( IRQ_SM ); // mask spectral matrices interrupt (coming from the timer VHDL IP) |
|
830 | LEON_Mask_interrupt( IRQ_SM ); // mask spectral matrices interrupt (coming from the timer VHDL IP) | |
881 | LEON_Clear_interrupt( IRQ_SM ); // clear spectral matrices interrupt (coming from the timer VHDL IP) |
|
831 | LEON_Clear_interrupt( IRQ_SM ); // clear spectral matrices interrupt (coming from the timer VHDL IP) | |
882 |
|
832 | |||
883 | #ifdef GSA |
|
833 | #ifdef GSA | |
884 | LEON_Mask_interrupt( IRQ_WF ); // mask waveform interrupt (coming from the timer VHDL IP) |
|
834 | LEON_Mask_interrupt( IRQ_WF ); // mask waveform interrupt (coming from the timer VHDL IP) | |
885 | LEON_Clear_interrupt( IRQ_WF ); // clear waveform interrupt (coming from the timer VHDL IP) |
|
835 | LEON_Clear_interrupt( IRQ_WF ); // clear waveform interrupt (coming from the timer VHDL IP) | |
886 | timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR ); |
|
836 | timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR ); | |
887 | #else |
|
837 | #else | |
888 | LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt |
|
838 | LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt | |
889 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt |
|
839 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt | |
890 | LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // mask spectral matrix interrupt |
|
840 | LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // mask spectral matrix interrupt | |
891 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt |
|
841 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt | |
892 | LEON_Mask_interrupt( IRQ_SM ); // for SM simulation |
|
842 | LEON_Mask_interrupt( IRQ_SM ); // for SM simulation | |
893 | LEON_Clear_interrupt( IRQ_SM ); // for SM simulation |
|
843 | LEON_Clear_interrupt( IRQ_SM ); // for SM simulation | |
894 | #endif |
|
844 | #endif | |
895 | //********************** |
|
845 | //********************** | |
896 | // suspend several tasks |
|
846 | // suspend several tasks | |
897 | if (lfrCurrentMode != LFR_MODE_STANDBY) { |
|
847 | if (lfrCurrentMode != LFR_MODE_STANDBY) { | |
898 | suspend_science_tasks(); |
|
848 | suspend_science_tasks(); | |
899 | } |
|
849 | } | |
900 |
|
850 | |||
901 | if (status != RTEMS_SUCCESSFUL) |
|
851 | if (status != RTEMS_SUCCESSFUL) | |
902 | { |
|
852 | { | |
903 | PRINTF("ERR *** in stop_current_mode *** suspending tasks\n") |
|
853 | PRINTF("ERR *** in stop_current_mode *** suspending tasks\n") | |
904 | } |
|
854 | } | |
905 |
|
855 | |||
906 | //************************* |
|
856 | //************************* | |
907 | // initialize the registers |
|
857 | // initialize the registers | |
908 | #ifdef GSA |
|
858 | #ifdef GSA | |
909 | #else |
|
859 | #else | |
910 | reset_wfp_burst_enable(); // reset burst and enable bits |
|
860 | reset_wfp_burst_enable(); // reset burst and enable bits | |
911 | reset_wfp_status(); // reset all the status bits |
|
861 | reset_wfp_status(); // reset all the status bits | |
912 | #endif |
|
862 | #endif | |
913 |
|
863 | |||
914 | return status; |
|
864 | return status; | |
915 | } |
|
865 | } | |
916 |
|
866 | |||
917 | int enter_mode(unsigned char mode, ccsdsTelecommandPacket_t *TC ) |
|
867 | int enter_mode(unsigned char mode, ccsdsTelecommandPacket_t *TC ) | |
918 | { |
|
868 | { | |
919 | rtems_status_code status; |
|
869 | rtems_status_code status; | |
920 |
|
870 | |||
921 | status = RTEMS_UNSATISFIED; |
|
871 | status = RTEMS_UNSATISFIED; | |
922 |
|
872 | |||
923 | housekeeping_packet.lfr_status_word[0] = (unsigned char) ((mode << 4) + 0x0d); |
|
873 | housekeeping_packet.lfr_status_word[0] = (unsigned char) ((mode << 4) + 0x0d); | |
924 | lfrCurrentMode = mode; |
|
874 | lfrCurrentMode = mode; | |
925 |
|
875 | |||
926 | switch(mode){ |
|
876 | switch(mode){ | |
927 | case LFR_MODE_STANDBY: |
|
877 | case LFR_MODE_STANDBY: | |
928 | status = enter_standby_mode( TC ); |
|
878 | status = enter_standby_mode( TC ); | |
929 | break; |
|
879 | break; | |
930 | case LFR_MODE_NORMAL: |
|
880 | case LFR_MODE_NORMAL: | |
931 | status = enter_normal_mode( TC ); |
|
881 | status = enter_normal_mode( TC ); | |
932 | break; |
|
882 | break; | |
933 | case LFR_MODE_BURST: |
|
883 | case LFR_MODE_BURST: | |
934 | status = enter_burst_mode( TC ); |
|
884 | status = enter_burst_mode( TC ); | |
935 | break; |
|
885 | break; | |
936 | case LFR_MODE_SBM1: |
|
886 | case LFR_MODE_SBM1: | |
937 | status = enter_sbm1_mode( TC ); |
|
887 | status = enter_sbm1_mode( TC ); | |
938 | break; |
|
888 | break; | |
939 | case LFR_MODE_SBM2: |
|
889 | case LFR_MODE_SBM2: | |
940 | status = enter_sbm2_mode( TC ); |
|
890 | status = enter_sbm2_mode( TC ); | |
941 | break; |
|
891 | break; | |
942 | default: |
|
892 | default: | |
943 | status = RTEMS_UNSATISFIED; |
|
893 | status = RTEMS_UNSATISFIED; | |
944 | } |
|
894 | } | |
945 |
|
895 | |||
946 | if (status != RTEMS_SUCCESSFUL) |
|
896 | if (status != RTEMS_SUCCESSFUL) | |
947 | { |
|
897 | { | |
948 | PRINTF("in enter_mode *** ERR\n") |
|
898 | PRINTF("in enter_mode *** ERR\n") | |
949 | status = RTEMS_UNSATISFIED; |
|
899 | status = RTEMS_UNSATISFIED; | |
950 | } |
|
900 | } | |
951 |
|
901 | |||
952 | return status; |
|
902 | return status; | |
953 | } |
|
903 | } | |
954 |
|
904 | |||
955 | int enter_standby_mode() |
|
905 | int enter_standby_mode() | |
956 | { |
|
906 | { | |
957 | reset_waveform_picker_regs(); |
|
907 | reset_waveform_picker_regs(); | |
958 |
|
908 | |||
959 | PRINTF1("maxCount = %d\n", maxCount) |
|
909 | PRINTF1("maxCount = %d\n", maxCount) | |
960 |
|
910 | |||
961 | #ifdef PRINT_TASK_STATISTICS |
|
911 | #ifdef PRINT_TASK_STATISTICS | |
962 | rtems_cpu_usage_report(); |
|
912 | rtems_cpu_usage_report(); | |
963 | #endif |
|
913 | #endif | |
964 |
|
914 | |||
965 | #ifdef PRINT_STACK_REPORT |
|
915 | #ifdef PRINT_STACK_REPORT | |
966 | rtems_stack_checker_report_usage(); |
|
916 | rtems_stack_checker_report_usage(); | |
967 | #endif |
|
917 | #endif | |
968 |
|
918 | |||
969 | return LFR_SUCCESSFUL; |
|
919 | return LFR_SUCCESSFUL; | |
970 | } |
|
920 | } | |
971 |
|
921 | |||
972 | int enter_normal_mode() |
|
922 | int enter_normal_mode() | |
973 | { |
|
923 | { | |
974 | rtems_status_code status; |
|
924 | rtems_status_code status; | |
975 |
|
925 | |||
976 | status = restart_science_tasks(); |
|
926 | status = restart_science_tasks(); | |
977 |
|
927 | |||
978 | #ifdef GSA |
|
928 | #ifdef GSA | |
979 | timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR ); |
|
929 | timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR ); | |
980 | timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); |
|
930 | timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); | |
981 | LEON_Clear_interrupt( IRQ_WF ); |
|
931 | LEON_Clear_interrupt( IRQ_WF ); | |
982 | LEON_Unmask_interrupt( IRQ_WF ); |
|
932 | LEON_Unmask_interrupt( IRQ_WF ); | |
983 | // |
|
933 | // | |
984 | set_local_nb_interrupt_f0_MAX(); |
|
934 | set_local_nb_interrupt_f0_MAX(); | |
985 | LEON_Clear_interrupt( IRQ_SM ); // the IRQ_SM seems to be incompatible with the IRQ_WF on the xilinx board |
|
935 | LEON_Clear_interrupt( IRQ_SM ); // the IRQ_SM seems to be incompatible with the IRQ_WF on the xilinx board | |
986 | LEON_Unmask_interrupt( IRQ_SM ); |
|
936 | LEON_Unmask_interrupt( IRQ_SM ); | |
987 | #else |
|
937 | #else | |
988 | //**************** |
|
938 | //**************** | |
989 | // waveform picker |
|
939 | // waveform picker | |
990 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); |
|
940 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); | |
991 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); |
|
941 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); | |
992 | reset_waveform_picker_regs(); |
|
942 | reset_waveform_picker_regs(); | |
993 | set_wfp_burst_enable_register(LFR_MODE_NORMAL); |
|
943 | set_wfp_burst_enable_register(LFR_MODE_NORMAL); | |
994 | //**************** |
|
944 | //**************** | |
995 | // spectral matrix |
|
945 | // spectral matrix | |
996 | // set_local_nb_interrupt_f0_MAX(); |
|
946 | // set_local_nb_interrupt_f0_MAX(); | |
997 | // LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // the IRQ_SM seems to be incompatible with the IRQ_WF on the xilinx board |
|
947 | // LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // the IRQ_SM seems to be incompatible with the IRQ_WF on the xilinx board | |
998 | // LEON_Unmask_interrupt( IRQ_SPECTRAL_MATRIX ); |
|
948 | // LEON_Unmask_interrupt( IRQ_SPECTRAL_MATRIX ); | |
999 | // spectral_matrix_regs->config = 0x01; |
|
949 | // spectral_matrix_regs->config = 0x01; | |
1000 | // spectral_matrix_regs->status = 0x00; |
|
950 | // spectral_matrix_regs->status = 0x00; | |
1001 | #endif |
|
951 | #endif | |
1002 |
|
952 | |||
1003 | return status; |
|
953 | return status; | |
1004 | } |
|
954 | } | |
1005 |
|
955 | |||
1006 | int enter_burst_mode() |
|
956 | int enter_burst_mode() | |
1007 | { |
|
957 | { | |
1008 | rtems_status_code status; |
|
958 | rtems_status_code status; | |
1009 |
|
959 | |||
1010 | status = restart_science_tasks(); |
|
960 | status = restart_science_tasks(); | |
1011 |
|
961 | |||
1012 | #ifdef GSA |
|
962 | #ifdef GSA | |
1013 | LEON_Unmask_interrupt( IRQ_SM ); |
|
963 | LEON_Unmask_interrupt( IRQ_SM ); | |
1014 | #else |
|
964 | #else | |
1015 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); |
|
965 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); | |
1016 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); |
|
966 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); | |
1017 | reset_waveform_picker_regs(); |
|
967 | reset_waveform_picker_regs(); | |
1018 | set_wfp_burst_enable_register(LFR_MODE_BURST); |
|
968 | set_wfp_burst_enable_register(LFR_MODE_BURST); | |
1019 | #endif |
|
969 | #endif | |
1020 |
|
970 | |||
1021 | return status; |
|
971 | return status; | |
1022 | } |
|
972 | } | |
1023 |
|
973 | |||
1024 | int enter_sbm1_mode() |
|
974 | int enter_sbm1_mode() | |
1025 | { |
|
975 | { | |
1026 | rtems_status_code status; |
|
976 | rtems_status_code status; | |
1027 |
|
977 | |||
1028 | status = restart_science_tasks(); |
|
978 | status = restart_science_tasks(); | |
1029 |
|
979 | |||
1030 | set_local_sbm1_nb_cwf_max(); |
|
980 | set_local_sbm1_nb_cwf_max(); | |
1031 |
|
981 | |||
1032 | reset_local_sbm1_nb_cwf_sent(); |
|
982 | reset_local_sbm1_nb_cwf_sent(); | |
1033 |
|
983 | |||
1034 | #ifdef GSA |
|
984 | #ifdef GSA | |
1035 | LEON_Unmask_interrupt( IRQ_SM ); |
|
985 | LEON_Unmask_interrupt( IRQ_SM ); | |
1036 | #else |
|
986 | #else | |
1037 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); |
|
987 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); | |
1038 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); |
|
988 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); | |
1039 | reset_waveform_picker_regs(); |
|
989 | reset_waveform_picker_regs(); | |
1040 | set_wfp_burst_enable_register(LFR_MODE_SBM1); |
|
990 | set_wfp_burst_enable_register(LFR_MODE_SBM1); | |
1041 | // SM simulation |
|
991 | // SM simulation | |
1042 | // timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); |
|
992 | // timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); | |
1043 | // LEON_Clear_interrupt( IRQ_SM ); // the IRQ_SM seems to be incompatible with the IRQ_WF on the xilinx board |
|
993 | // LEON_Clear_interrupt( IRQ_SM ); // the IRQ_SM seems to be incompatible with the IRQ_WF on the xilinx board | |
1044 | // LEON_Unmask_interrupt( IRQ_SM ); |
|
994 | // LEON_Unmask_interrupt( IRQ_SM ); | |
1045 | #endif |
|
995 | #endif | |
1046 |
|
996 | |||
1047 | return status; |
|
997 | return status; | |
1048 | } |
|
998 | } | |
1049 |
|
999 | |||
1050 | int enter_sbm2_mode() |
|
1000 | int enter_sbm2_mode() | |
1051 | { |
|
1001 | { | |
1052 | rtems_status_code status; |
|
1002 | rtems_status_code status; | |
1053 |
|
1003 | |||
1054 | status = restart_science_tasks(); |
|
1004 | status = restart_science_tasks(); | |
1055 |
|
1005 | |||
1056 | set_local_sbm2_nb_cwf_max(); |
|
1006 | set_local_sbm2_nb_cwf_max(); | |
1057 |
|
1007 | |||
1058 | reset_local_sbm2_nb_cwf_sent(); |
|
1008 | reset_local_sbm2_nb_cwf_sent(); | |
1059 |
|
1009 | |||
1060 | #ifdef GSA |
|
1010 | #ifdef GSA | |
1061 | LEON_Unmask_interrupt( IRQ_SM ); |
|
1011 | LEON_Unmask_interrupt( IRQ_SM ); | |
1062 | #else |
|
1012 | #else | |
1063 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); |
|
1013 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); | |
1064 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); |
|
1014 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); | |
1065 | reset_waveform_picker_regs(); |
|
1015 | reset_waveform_picker_regs(); | |
1066 | set_wfp_burst_enable_register(LFR_MODE_SBM2); |
|
1016 | set_wfp_burst_enable_register(LFR_MODE_SBM2); | |
1067 | #endif |
|
1017 | #endif | |
1068 |
|
1018 | |||
1069 | return status; |
|
1019 | return status; | |
1070 | } |
|
1020 | } | |
1071 |
|
1021 | |||
1072 | int restart_science_tasks() |
|
1022 | int restart_science_tasks() | |
1073 | { |
|
1023 | { | |
1074 | rtems_status_code status[6]; |
|
1024 | rtems_status_code status[6]; | |
1075 | rtems_status_code ret; |
|
1025 | rtems_status_code ret; | |
1076 |
|
1026 | |||
1077 | ret = RTEMS_SUCCESSFUL; |
|
1027 | ret = RTEMS_SUCCESSFUL; | |
1078 |
|
1028 | |||
1079 | status[0] = rtems_task_restart( Task_id[TASKID_AVF0], 1 ); |
|
1029 | status[0] = rtems_task_restart( Task_id[TASKID_AVF0], 1 ); | |
1080 | if (status[0] != RTEMS_SUCCESSFUL) |
|
1030 | if (status[0] != RTEMS_SUCCESSFUL) | |
1081 | { |
|
1031 | { | |
1082 | PRINTF1("in restart_science_task *** 0 ERR %d\n", status[0]) |
|
1032 | PRINTF1("in restart_science_task *** 0 ERR %d\n", status[0]) | |
1083 | } |
|
1033 | } | |
1084 |
|
1034 | |||
1085 | status[1] = rtems_task_restart( Task_id[TASKID_BPF0],1 ); |
|
1035 | status[1] = rtems_task_restart( Task_id[TASKID_BPF0],1 ); | |
1086 | if (status[1] != RTEMS_SUCCESSFUL) |
|
1036 | if (status[1] != RTEMS_SUCCESSFUL) | |
1087 | { |
|
1037 | { | |
1088 | PRINTF1("in restart_science_task *** 1 ERR %d\n", status[1]) |
|
1038 | PRINTF1("in restart_science_task *** 1 ERR %d\n", status[1]) | |
1089 | } |
|
1039 | } | |
1090 |
|
1040 | |||
1091 | status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 ); |
|
1041 | status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 ); | |
1092 | if (status[2] != RTEMS_SUCCESSFUL) |
|
1042 | if (status[2] != RTEMS_SUCCESSFUL) | |
1093 | { |
|
1043 | { | |
1094 | PRINTF1("in restart_science_task *** 2 ERR %d\n", status[2]) |
|
1044 | PRINTF1("in restart_science_task *** 2 ERR %d\n", status[2]) | |
1095 | } |
|
1045 | } | |
1096 |
|
1046 | |||
1097 | status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 ); |
|
1047 | status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 ); | |
1098 | if (status[3] != RTEMS_SUCCESSFUL) |
|
1048 | if (status[3] != RTEMS_SUCCESSFUL) | |
1099 | { |
|
1049 | { | |
1100 | PRINTF1("in restart_science_task *** 3 ERR %d\n", status[3]) |
|
1050 | PRINTF1("in restart_science_task *** 3 ERR %d\n", status[3]) | |
1101 | } |
|
1051 | } | |
1102 |
|
1052 | |||
1103 | status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 ); |
|
1053 | status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 ); | |
1104 | if (status[4] != RTEMS_SUCCESSFUL) |
|
1054 | if (status[4] != RTEMS_SUCCESSFUL) | |
1105 | { |
|
1055 | { | |
1106 | PRINTF1("in restart_science_task *** 4 ERR %d\n", status[4]) |
|
1056 | PRINTF1("in restart_science_task *** 4 ERR %d\n", status[4]) | |
1107 | } |
|
1057 | } | |
1108 |
|
1058 | |||
1109 | status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 ); |
|
1059 | status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 ); | |
1110 | if (status[5] != RTEMS_SUCCESSFUL) |
|
1060 | if (status[5] != RTEMS_SUCCESSFUL) | |
1111 | { |
|
1061 | { | |
1112 | PRINTF1("in restart_science_task *** 5 ERR %d\n", status[5]) |
|
1062 | PRINTF1("in restart_science_task *** 5 ERR %d\n", status[5]) | |
1113 | } |
|
1063 | } | |
1114 |
|
1064 | |||
1115 | if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) || |
|
1065 | if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) || | |
1116 | (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) ) |
|
1066 | (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) ) | |
1117 | { |
|
1067 | { | |
1118 | ret = RTEMS_UNSATISFIED; |
|
1068 | ret = RTEMS_UNSATISFIED; | |
1119 | } |
|
1069 | } | |
1120 |
|
1070 | |||
1121 | return ret; |
|
1071 | return ret; | |
1122 | } |
|
1072 | } | |
1123 |
|
1073 | |||
1124 | int suspend_science_tasks() |
|
1074 | int suspend_science_tasks() | |
1125 | { |
|
1075 | { | |
1126 | rtems_status_code status[6]; |
|
1076 | rtems_status_code status[6]; | |
1127 | rtems_status_code ret; |
|
1077 | rtems_status_code ret; | |
1128 |
|
1078 | |||
1129 | ret = RTEMS_SUCCESSFUL; |
|
1079 | ret = RTEMS_SUCCESSFUL; | |
1130 |
|
1080 | |||
1131 | status[0] = rtems_task_suspend( Task_id[TASKID_AVF0] ); |
|
1081 | status[0] = rtems_task_suspend( Task_id[TASKID_AVF0] ); | |
1132 | if (status[0] != RTEMS_SUCCESSFUL) |
|
1082 | if (status[0] != RTEMS_SUCCESSFUL) | |
1133 | { |
|
1083 | { | |
1134 | PRINTF1("in suspend_science_task *** 0 ERR %d\n", status[0]) |
|
1084 | PRINTF1("in suspend_science_task *** 0 ERR %d\n", status[0]) | |
1135 | } |
|
1085 | } | |
1136 |
|
1086 | |||
1137 | status[1] = rtems_task_suspend( Task_id[TASKID_BPF0] ); |
|
1087 | status[1] = rtems_task_suspend( Task_id[TASKID_BPF0] ); | |
1138 | if (status[1] != RTEMS_SUCCESSFUL) |
|
1088 | if (status[1] != RTEMS_SUCCESSFUL) | |
1139 | { |
|
1089 | { | |
1140 | PRINTF1("in suspend_science_task *** 1 ERR %d\n", status[1]) |
|
1090 | PRINTF1("in suspend_science_task *** 1 ERR %d\n", status[1]) | |
1141 | } |
|
1091 | } | |
1142 |
|
1092 | |||
1143 | status[2] = rtems_task_suspend( Task_id[TASKID_WFRM] ); |
|
1093 | status[2] = rtems_task_suspend( Task_id[TASKID_WFRM] ); | |
1144 | if (status[2] != RTEMS_SUCCESSFUL) |
|
1094 | if (status[2] != RTEMS_SUCCESSFUL) | |
1145 | { |
|
1095 | { | |
1146 | PRINTF1("in suspend_science_task *** 2 ERR %d\n", status[2]) |
|
1096 | PRINTF1("in suspend_science_task *** 2 ERR %d\n", status[2]) | |
1147 | } |
|
1097 | } | |
1148 |
|
1098 | |||
1149 | status[3] = rtems_task_suspend( Task_id[TASKID_CWF3] ); |
|
1099 | status[3] = rtems_task_suspend( Task_id[TASKID_CWF3] ); | |
1150 | if (status[3] != RTEMS_SUCCESSFUL) |
|
1100 | if (status[3] != RTEMS_SUCCESSFUL) | |
1151 | { |
|
1101 | { | |
1152 | PRINTF1("in suspend_science_task *** 3 ERR %d\n", status[3]) |
|
1102 | PRINTF1("in suspend_science_task *** 3 ERR %d\n", status[3]) | |
1153 | } |
|
1103 | } | |
1154 |
|
1104 | |||
1155 | status[4] = rtems_task_suspend( Task_id[TASKID_CWF2] ); |
|
1105 | status[4] = rtems_task_suspend( Task_id[TASKID_CWF2] ); | |
1156 | if (status[4] != RTEMS_SUCCESSFUL) |
|
1106 | if (status[4] != RTEMS_SUCCESSFUL) | |
1157 | { |
|
1107 | { | |
1158 | PRINTF1("in suspend_science_task *** 4 ERR %d\n", status[4]) |
|
1108 | PRINTF1("in suspend_science_task *** 4 ERR %d\n", status[4]) | |
1159 | } |
|
1109 | } | |
1160 |
|
1110 | |||
1161 | status[5] = rtems_task_suspend( Task_id[TASKID_CWF1] ); |
|
1111 | status[5] = rtems_task_suspend( Task_id[TASKID_CWF1] ); | |
1162 | if (status[5] != RTEMS_SUCCESSFUL) |
|
1112 | if (status[5] != RTEMS_SUCCESSFUL) | |
1163 | { |
|
1113 | { | |
1164 | PRINTF1("in suspend_science_task *** 5 ERR %d\n", status[5]) |
|
1114 | PRINTF1("in suspend_science_task *** 5 ERR %d\n", status[5]) | |
1165 | } |
|
1115 | } | |
1166 |
|
1116 | |||
1167 | if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) || |
|
1117 | if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) || | |
1168 | (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) ) |
|
1118 | (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) ) | |
1169 | { |
|
1119 | { | |
1170 | ret = RTEMS_UNSATISFIED; |
|
1120 | ret = RTEMS_UNSATISFIED; | |
1171 | } |
|
1121 | } | |
1172 |
|
1122 | |||
1173 | return ret; |
|
1123 | return ret; | |
1174 | } |
|
1124 | } | |
1175 |
|
1125 | |||
1176 | //**************** |
|
1126 | //**************** | |
1177 | // CLOSING ACTIONS |
|
1127 | // CLOSING ACTIONS | |
1178 |
|
1128 | |||
1179 | int send_tm_lfr_tc_exe_success(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
1129 | int send_tm_lfr_tc_exe_success(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) | |
1180 | { |
|
1130 | { | |
1181 | int ret; |
|
1131 | int ret; | |
1182 | rtems_status_code status; |
|
1132 | rtems_status_code status; | |
1183 | TMHeader_t TM_header; |
|
1133 | Packet_TM_LFR_TC_EXE_SUCCESS_t TM; | |
1184 | char data[4]; |
|
1134 | unsigned char messageSize; | |
1185 | spw_ioctl_pkt_send spw_ioctl_send; |
|
|||
1186 |
|
1135 | |||
1187 | ret = LFR_SUCCESSFUL; |
|
1136 | ret = LFR_SUCCESSFUL; | |
1188 |
|
1137 | |||
1189 | TM_build_header( TM_LFR_TC_EXE_OK, PACKET_LENGTH_TC_EXE_SUCCESS, |
|
1138 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; | |
1190 | &TM_header, |
|
1139 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
1191 | TC->sourceID); // TC source ID |
|
1140 | TM.reserved = DEFAULT_RESERVED; | |
|
1141 | TM.userApplication = CCSDS_USER_APP; | |||
|
1142 | // PACKET HEADER | |||
|
1143 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); | |||
|
1144 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); | |||
|
1145 | TM.packetSequenceControl[0] = (TM_PACKET_SEQ_CTRL_STANDALONE >> 8); | |||
|
1146 | TM.packetSequenceControl[1] = (TM_PACKET_SEQ_CTRL_STANDALONE ); | |||
|
1147 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_SUCCESS >> 8); | |||
|
1148 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_SUCCESS ); | |||
|
1149 | // DATA FIELD HEADER | |||
|
1150 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |||
|
1151 | TM.serviceType = TM_TYPE_TC_EXE; | |||
|
1152 | TM.serviceSubType = TM_SUBTYPE_EXE_OK; | |||
|
1153 | TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id | |||
|
1154 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |||
|
1155 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |||
|
1156 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |||
|
1157 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); | |||
|
1158 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |||
|
1159 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); | |||
|
1160 | // | |||
|
1161 | TM.telecommand_pkt_id[0] = TC->packetID[0]; | |||
|
1162 | TM.telecommand_pkt_id[1] = TC->packetID[1]; | |||
|
1163 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; | |||
|
1164 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; | |||
1192 |
|
1165 | |||
1193 | data[0] = TC->packetID[0]; |
|
1166 | messageSize = PACKET_LENGTH_TC_EXE_SUCCESS + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; | |
1194 | data[1] = TC->packetID[1]; |
|
|||
1195 | data[2] = TC->packetSequenceControl[0]; |
|
|||
1196 | data[3] = TC->packetSequenceControl[1]; |
|
|||
1197 |
|
||||
1198 | // filling the structure for the spacewire transmission |
|
|||
1199 | spw_ioctl_send.hlen = TM_HEADER_LEN + 4; // + 4 is for the protocole extra header |
|
|||
1200 | spw_ioctl_send.hdr = (char*) &TM_header; |
|
|||
1201 | spw_ioctl_send.dlen = 4; |
|
|||
1202 | spw_ioctl_send.data = data; |
|
|||
1203 | spw_ioctl_send.options = 0; |
|
|||
1204 |
|
1167 | |||
1205 | // SEND DATA |
|
1168 | // SEND DATA | |
1206 |
status = rtems_message_queue_urgent( queue_id, & |
|
1169 | status = rtems_message_queue_urgent( queue_id, &TM, messageSize); | |
1207 | if (status != RTEMS_SUCCESSFUL) { |
|
1170 | if (status != RTEMS_SUCCESSFUL) { | |
1208 | PRINTF("in send_tm_lfr_tc_exe_success *** ERR\n") |
|
1171 | PRINTF("in send_tm_lfr_tc_exe_success *** ERR\n") | |
1209 | ret = LFR_DEFAULT; |
|
1172 | ret = LFR_DEFAULT; | |
1210 | } |
|
1173 | } | |
1211 |
|
1174 | |||
1212 | return ret; |
|
1175 | return LFR_SUCCESSFUL; | |
|
1176 | } | |||
|
1177 | ||||
|
1178 | int send_tm_lfr_tc_exe_inconsistent(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, | |||
|
1179 | unsigned char byte_position, unsigned char rcv_value) | |||
|
1180 | { | |||
|
1181 | int ret; | |||
|
1182 | rtems_status_code status; | |||
|
1183 | Packet_TM_LFR_TC_EXE_INCONSISTENT_t TM; | |||
|
1184 | unsigned char messageSize; | |||
|
1185 | ||||
|
1186 | ret = LFR_SUCCESSFUL; | |||
|
1187 | ||||
|
1188 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; | |||
|
1189 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |||
|
1190 | TM.reserved = DEFAULT_RESERVED; | |||
|
1191 | TM.userApplication = CCSDS_USER_APP; | |||
|
1192 | // PACKET HEADER | |||
|
1193 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); | |||
|
1194 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); | |||
|
1195 | TM.packetSequenceControl[0] = (TM_PACKET_SEQ_CTRL_STANDALONE >> 8); | |||
|
1196 | TM.packetSequenceControl[1] = (TM_PACKET_SEQ_CTRL_STANDALONE ); | |||
|
1197 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_INCONSISTENT >> 8); | |||
|
1198 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_INCONSISTENT ); | |||
|
1199 | // DATA FIELD HEADER | |||
|
1200 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |||
|
1201 | TM.serviceType = TM_TYPE_TC_EXE; | |||
|
1202 | TM.serviceSubType = TM_SUBTYPE_EXE_NOK; | |||
|
1203 | TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id | |||
|
1204 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |||
|
1205 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |||
|
1206 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |||
|
1207 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); | |||
|
1208 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |||
|
1209 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); | |||
|
1210 | // | |||
|
1211 | TM.tc_failure_code[0] = (char) (FAILURE_CODE_INCONSISTENT >> 8); | |||
|
1212 | TM.tc_failure_code[1] = (char) (FAILURE_CODE_INCONSISTENT ); | |||
|
1213 | TM.telecommand_pkt_id[0] = TC->packetID[0]; | |||
|
1214 | TM.telecommand_pkt_id[1] = TC->packetID[1]; | |||
|
1215 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; | |||
|
1216 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; | |||
|
1217 | TM.tc_service = TC->serviceType; // type of the rejected TC | |||
|
1218 | TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC | |||
|
1219 | TM.byte_position = byte_position; | |||
|
1220 | TM.rcv_value = rcv_value; | |||
|
1221 | ||||
|
1222 | messageSize = PACKET_LENGTH_TC_EXE_INCONSISTENT + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; | |||
|
1223 | ||||
|
1224 | // SEND DATA | |||
|
1225 | status = rtems_message_queue_urgent( queue_id, &TM, messageSize); | |||
|
1226 | if (status != RTEMS_SUCCESSFUL) { | |||
|
1227 | PRINTF("in send_tm_lfr_tc_exe_inconsistent *** ERR\n") | |||
|
1228 | ret = LFR_DEFAULT; | |||
|
1229 | } | |||
|
1230 | ||||
|
1231 | return LFR_SUCCESSFUL; | |||
1213 | } |
|
1232 | } | |
1214 |
|
1233 | |||
1215 | int send_tm_lfr_tc_exe_not_executable(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
1234 | int send_tm_lfr_tc_exe_not_executable(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) | |
1216 | { |
|
1235 | { | |
1217 | int ret; |
|
1236 | int ret; | |
1218 | rtems_status_code status; |
|
1237 | rtems_status_code status; | |
1219 | TMHeader_t TM_header; |
|
1238 | Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t TM; | |
1220 | char data[10]; |
|
1239 | unsigned char messageSize; | |
1221 | spw_ioctl_pkt_send spw_ioctl_send; |
|
|||
1222 |
|
1240 | |||
1223 | ret = LFR_SUCCESSFUL; |
|
1241 | ret = LFR_SUCCESSFUL; | |
1224 |
|
1242 | |||
1225 | TM_build_header( TM_LFR_TC_EXE_ERR, PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE, |
|
1243 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; | |
1226 | &TM_header, |
|
1244 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
1227 | TC->sourceID); // TC source ID |
|
1245 | TM.reserved = DEFAULT_RESERVED; | |
|
1246 | TM.userApplication = CCSDS_USER_APP; | |||
|
1247 | // PACKET HEADER | |||
|
1248 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); | |||
|
1249 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); | |||
|
1250 | TM.packetSequenceControl[0] = (TM_PACKET_SEQ_CTRL_STANDALONE >> 8); | |||
|
1251 | TM.packetSequenceControl[1] = (TM_PACKET_SEQ_CTRL_STANDALONE ); | |||
|
1252 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE >> 8); | |||
|
1253 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE ); | |||
|
1254 | // DATA FIELD HEADER | |||
|
1255 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |||
|
1256 | TM.serviceType = TM_TYPE_TC_EXE; | |||
|
1257 | TM.serviceSubType = TM_SUBTYPE_EXE_NOK; | |||
|
1258 | TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id | |||
|
1259 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |||
|
1260 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |||
|
1261 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |||
|
1262 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); | |||
|
1263 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |||
|
1264 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); | |||
|
1265 | // | |||
|
1266 | TM.tc_failure_code[0] = (char) (FAILURE_CODE_NOT_EXECUTABLE >> 8); | |||
|
1267 | TM.tc_failure_code[1] = (char) (FAILURE_CODE_NOT_EXECUTABLE ); | |||
|
1268 | TM.telecommand_pkt_id[0] = TC->packetID[0]; | |||
|
1269 | TM.telecommand_pkt_id[1] = TC->packetID[1]; | |||
|
1270 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; | |||
|
1271 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; | |||
|
1272 | TM.tc_service = TC->serviceType; // type of the rejected TC | |||
|
1273 | TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC | |||
|
1274 | TM.lfr_status_word[0] = housekeeping_packet.lfr_status_word[0]; | |||
|
1275 | TM.lfr_status_word[1] = housekeeping_packet.lfr_status_word[1]; | |||
1228 |
|
1276 | |||
1229 | data[0] = (char) (FAILURE_CODE_NOT_EXECUTABLE >> 8); |
|
1277 | messageSize = PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; | |
1230 | data[1] = (char) FAILURE_CODE_NOT_EXECUTABLE; |
|
|||
1231 | data[2] = TC->packetID[0]; |
|
|||
1232 | data[3] = TC->packetID[1]; |
|
|||
1233 | data[4] = TC->packetSequenceControl[0]; |
|
|||
1234 | data[5] = TC->packetSequenceControl[1]; |
|
|||
1235 | data[6] = TC->serviceType; // type of the rejected TC |
|
|||
1236 | data[7] = TC->serviceSubType; // subtype of the rejected TC |
|
|||
1237 | data[8] = housekeeping_packet.lfr_status_word[0]; |
|
|||
1238 | data[6] = housekeeping_packet.lfr_status_word[1]; |
|
|||
1239 |
|
||||
1240 | // filling the structure for the spacewire transmission |
|
|||
1241 | spw_ioctl_send.hlen = TM_HEADER_LEN + 4; // + 4 is for the protocole extra header |
|
|||
1242 | spw_ioctl_send.hdr = (char*) &TM_header; |
|
|||
1243 | spw_ioctl_send.dlen = 10; |
|
|||
1244 | spw_ioctl_send.data = data; |
|
|||
1245 | spw_ioctl_send.options = 0; |
|
|||
1246 |
|
1278 | |||
1247 | // SEND DATA |
|
1279 | // SEND DATA | |
1248 |
status = rtems_message_queue_urgent( queue_id, & |
|
1280 | status = rtems_message_queue_urgent( queue_id, &TM, messageSize); | |
1249 | if (status != RTEMS_SUCCESSFUL) { |
|
1281 | if (status != RTEMS_SUCCESSFUL) { | |
1250 |
PRINTF("in send_tm_lfr_tc_exe_ |
|
1282 | PRINTF("in send_tm_lfr_tc_exe_not_executable *** ERR\n") | |
1251 | ret = LFR_DEFAULT; |
|
1283 | ret = LFR_DEFAULT; | |
1252 | } |
|
1284 | } | |
1253 |
|
1285 | |||
1254 | return LFR_SUCCESSFUL; |
|
1286 | return LFR_SUCCESSFUL; | |
1255 | } |
|
1287 | } | |
1256 |
|
1288 | |||
1257 | int send_tm_lfr_tc_exe_not_implemented(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
1289 | int send_tm_lfr_tc_exe_not_implemented(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) | |
1258 | { |
|
1290 | { | |
1259 | int ret; |
|
1291 | int ret; | |
1260 | rtems_status_code status; |
|
1292 | rtems_status_code status; | |
1261 | TMHeader_t TM_header; |
|
1293 | Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t TM; | |
1262 | char data[8]; |
|
1294 | unsigned char messageSize; | |
1263 | spw_ioctl_pkt_send spw_ioctl_send; |
|
|||
1264 |
|
1295 | |||
1265 | ret = LFR_SUCCESSFUL; |
|
1296 | ret = LFR_SUCCESSFUL; | |
1266 |
|
1297 | |||
1267 | TM_build_header( TM_LFR_TC_EXE_ERR, PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED, |
|
1298 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; | |
1268 | &TM_header, |
|
1299 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
1269 | TC->sourceID); // TC source ID |
|
1300 | TM.reserved = DEFAULT_RESERVED; | |
|
1301 | TM.userApplication = CCSDS_USER_APP; | |||
|
1302 | // PACKET HEADER | |||
|
1303 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); | |||
|
1304 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); | |||
|
1305 | TM.packetSequenceControl[0] = (TM_PACKET_SEQ_CTRL_STANDALONE >> 8); | |||
|
1306 | TM.packetSequenceControl[1] = (TM_PACKET_SEQ_CTRL_STANDALONE ); | |||
|
1307 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED >> 8); | |||
|
1308 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED ); | |||
|
1309 | // DATA FIELD HEADER | |||
|
1310 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |||
|
1311 | TM.serviceType = TM_TYPE_TC_EXE; | |||
|
1312 | TM.serviceSubType = TM_SUBTYPE_EXE_NOK; | |||
|
1313 | TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id | |||
|
1314 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |||
|
1315 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |||
|
1316 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |||
|
1317 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); | |||
|
1318 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |||
|
1319 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); | |||
|
1320 | // | |||
|
1321 | TM.tc_failure_code[0] = (char) (FAILURE_CODE_NOT_IMPLEMENTED >> 8); | |||
|
1322 | TM.tc_failure_code[1] = (char) (FAILURE_CODE_NOT_IMPLEMENTED ); | |||
|
1323 | TM.telecommand_pkt_id[0] = TC->packetID[0]; | |||
|
1324 | TM.telecommand_pkt_id[1] = TC->packetID[1]; | |||
|
1325 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; | |||
|
1326 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; | |||
|
1327 | TM.tc_service = TC->serviceType; // type of the rejected TC | |||
|
1328 | TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC | |||
1270 |
|
1329 | |||
1271 | data[0] = (char) (FAILURE_CODE_NOT_IMPLEMENTED >> 8); |
|
1330 | messageSize = PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; | |
1272 | data[1] = (char) FAILURE_CODE_NOT_IMPLEMENTED; |
|
|||
1273 | data[2] = TC->packetID[0]; |
|
|||
1274 | data[3] = TC->packetID[1]; |
|
|||
1275 | data[4] = TC->packetSequenceControl[0]; |
|
|||
1276 | data[5] = TC->packetSequenceControl[1]; |
|
|||
1277 | data[6] = TC->serviceType; // type of the rejected TC |
|
|||
1278 | data[7] = TC->serviceSubType; // subtype of the rejected TC |
|
|||
1279 |
|
||||
1280 | // filling the structure for the spacewire transmission |
|
|||
1281 | spw_ioctl_send.hlen = TM_HEADER_LEN + 4; // + 4 is for the protocole extra header |
|
|||
1282 | spw_ioctl_send.hdr = (char*) &TM_header; |
|
|||
1283 | spw_ioctl_send.dlen = 8; |
|
|||
1284 | spw_ioctl_send.data = data; |
|
|||
1285 | spw_ioctl_send.options = 0; |
|
|||
1286 |
|
1331 | |||
1287 | // SEND DATA |
|
1332 | // SEND DATA | |
1288 |
status = rtems_message_queue_urgent( queue_id, & |
|
1333 | status = rtems_message_queue_urgent( queue_id, &TM, messageSize); | |
1289 | if (status != RTEMS_SUCCESSFUL) { |
|
1334 | if (status != RTEMS_SUCCESSFUL) { | |
1290 | PRINTF("in send_tm_lfr_tc_exe_not_implemented *** ERR\n") |
|
1335 | PRINTF("in send_tm_lfr_tc_exe_not_implemented *** ERR\n") | |
1291 | ret = LFR_DEFAULT; |
|
1336 | ret = LFR_DEFAULT; | |
1292 | } |
|
1337 | } | |
1293 |
|
1338 | |||
1294 | return LFR_SUCCESSFUL; |
|
1339 | return LFR_SUCCESSFUL; | |
1295 | } |
|
1340 | } | |
1296 |
|
1341 | |||
1297 | int send_tm_lfr_tc_exe_error(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
1342 | int send_tm_lfr_tc_exe_error(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) | |
1298 | { |
|
1343 | { | |
1299 | int ret; |
|
1344 | int ret; | |
1300 | rtems_status_code status; |
|
1345 | rtems_status_code status; | |
1301 | TMHeader_t TM_header; |
|
1346 | Packet_TM_LFR_TC_EXE_ERROR_t TM; | |
1302 | char data[8]; |
|
1347 | unsigned char messageSize; | |
1303 | spw_ioctl_pkt_send spw_ioctl_send; |
|
|||
1304 |
|
1348 | |||
1305 | TM_build_header( TM_LFR_TC_EXE_ERR, PACKET_LENGTH_TC_EXE_ERROR, |
|
1349 | ret = LFR_SUCCESSFUL; | |
1306 | &TM_header, |
|
|||
1307 | TC->sourceID); // TC source ID |
|
|||
1308 |
|
1350 | |||
1309 | data[0] = (char) (FAILURE_CODE_ERROR >> 8); |
|
1351 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; | |
1310 | data[1] = (char) FAILURE_CODE_ERROR; |
|
1352 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
1311 | data[2] = TC->packetID[0]; |
|
1353 | TM.reserved = DEFAULT_RESERVED; | |
1312 | data[3] = TC->packetID[1]; |
|
1354 | TM.userApplication = CCSDS_USER_APP; | |
1313 | data[4] = TC->packetSequenceControl[0]; |
|
1355 | // PACKET HEADER | |
1314 | data[5] = TC->packetSequenceControl[1]; |
|
1356 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); | |
1315 | data[6] = TC->serviceType; // type of the rejected TC |
|
1357 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); | |
1316 | data[7] = TC->serviceSubType; // subtype of the rejected TC |
|
1358 | TM.packetSequenceControl[0] = (TM_PACKET_SEQ_CTRL_STANDALONE >> 8); | |
|
1359 | TM.packetSequenceControl[1] = (TM_PACKET_SEQ_CTRL_STANDALONE ); | |||
|
1360 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_ERROR >> 8); | |||
|
1361 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_ERROR ); | |||
|
1362 | // DATA FIELD HEADER | |||
|
1363 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |||
|
1364 | TM.serviceType = TM_TYPE_TC_EXE; | |||
|
1365 | TM.serviceSubType = TM_SUBTYPE_EXE_NOK; | |||
|
1366 | TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id | |||
|
1367 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |||
|
1368 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |||
|
1369 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |||
|
1370 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); | |||
|
1371 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |||
|
1372 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); | |||
|
1373 | // | |||
|
1374 | TM.tc_failure_code[0] = (char) (FAILURE_CODE_ERROR >> 8); | |||
|
1375 | TM.tc_failure_code[1] = (char) (FAILURE_CODE_ERROR ); | |||
|
1376 | TM.telecommand_pkt_id[0] = TC->packetID[0]; | |||
|
1377 | TM.telecommand_pkt_id[1] = TC->packetID[1]; | |||
|
1378 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; | |||
|
1379 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; | |||
|
1380 | TM.tc_service = TC->serviceType; // type of the rejected TC | |||
|
1381 | TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC | |||
1317 |
|
1382 | |||
1318 | // filling the structure for the spacewire transmission |
|
1383 | messageSize = PACKET_LENGTH_TC_EXE_ERROR + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; | |
1319 | spw_ioctl_send.hlen = TM_HEADER_LEN + 4; // + 4 is for the protocole extra header |
|
|||
1320 | spw_ioctl_send.hdr = (char*) &TM_header; |
|
|||
1321 | spw_ioctl_send.dlen = 8; |
|
|||
1322 | spw_ioctl_send.data = data; |
|
|||
1323 | spw_ioctl_send.options = 0; |
|
|||
1324 |
|
1384 | |||
1325 | // SEND DATA |
|
1385 | // SEND DATA | |
1326 |
status = rtems_message_queue_urgent( queue_id, & |
|
1386 | status = rtems_message_queue_urgent( queue_id, &TM, messageSize); | |
1327 | if (status != RTEMS_SUCCESSFUL) { |
|
1387 | if (status != RTEMS_SUCCESSFUL) { | |
1328 | PRINTF("in send_tm_lfr_tc_exe_error *** ERR\n") |
|
1388 | PRINTF("in send_tm_lfr_tc_exe_error *** ERR\n") | |
1329 | ret = LFR_DEFAULT; |
|
1389 | ret = LFR_DEFAULT; | |
1330 | } |
|
1390 | } | |
1331 |
|
1391 | |||
1332 | return LFR_SUCCESSFUL; |
|
1392 | return LFR_SUCCESSFUL; | |
1333 | } |
|
1393 | } | |
1334 |
|
1394 | |||
1335 | void update_last_TC_exe(ccsdsTelecommandPacket_t *TC) |
|
1395 | void update_last_TC_exe(ccsdsTelecommandPacket_t *TC) | |
1336 | { |
|
1396 | { | |
1337 | housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0]; |
|
1397 | housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0]; | |
1338 | housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1]; |
|
1398 | housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1]; | |
1339 | housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00; |
|
1399 | housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00; | |
1340 | housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType; |
|
1400 | housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType; | |
1341 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00; |
|
1401 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00; | |
1342 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType; |
|
1402 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType; | |
1343 | housekeeping_packet.hk_lfr_last_exe_tc_time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
1403 | housekeeping_packet.hk_lfr_last_exe_tc_time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
1344 | housekeeping_packet.hk_lfr_last_exe_tc_time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
1404 | housekeeping_packet.hk_lfr_last_exe_tc_time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
1345 | housekeeping_packet.hk_lfr_last_exe_tc_time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
1405 | housekeeping_packet.hk_lfr_last_exe_tc_time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
1346 | housekeeping_packet.hk_lfr_last_exe_tc_time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
1406 | housekeeping_packet.hk_lfr_last_exe_tc_time[3] = (unsigned char) (time_management_regs->coarse_time); | |
1347 | housekeeping_packet.hk_lfr_last_exe_tc_time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
1407 | housekeeping_packet.hk_lfr_last_exe_tc_time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
1348 | housekeeping_packet.hk_lfr_last_exe_tc_time[5] = (unsigned char) (time_management_regs->fine_time); |
|
1408 | housekeeping_packet.hk_lfr_last_exe_tc_time[5] = (unsigned char) (time_management_regs->fine_time); | |
1349 | } |
|
1409 | } | |
1350 |
|
1410 | |||
1351 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC) |
|
1411 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC) | |
1352 | { |
|
1412 | { | |
1353 | housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0]; |
|
1413 | housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0]; | |
1354 | housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1]; |
|
1414 | housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1]; | |
1355 | housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00; |
|
1415 | housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00; | |
1356 | housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType; |
|
1416 | housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType; | |
1357 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00; |
|
1417 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00; | |
1358 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType; |
|
1418 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType; | |
1359 | housekeeping_packet.hk_lfr_last_rej_tc_time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
1419 | housekeeping_packet.hk_lfr_last_rej_tc_time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
1360 | housekeeping_packet.hk_lfr_last_rej_tc_time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
1420 | housekeeping_packet.hk_lfr_last_rej_tc_time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
1361 | housekeeping_packet.hk_lfr_last_rej_tc_time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
1421 | housekeeping_packet.hk_lfr_last_rej_tc_time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
1362 | housekeeping_packet.hk_lfr_last_rej_tc_time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
1422 | housekeeping_packet.hk_lfr_last_rej_tc_time[3] = (unsigned char) (time_management_regs->coarse_time); | |
1363 | housekeeping_packet.hk_lfr_last_rej_tc_time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
1423 | housekeeping_packet.hk_lfr_last_rej_tc_time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
1364 | housekeeping_packet.hk_lfr_last_rej_tc_time[5] = (unsigned char) (time_management_regs->fine_time); |
|
1424 | housekeeping_packet.hk_lfr_last_rej_tc_time[5] = (unsigned char) (time_management_regs->fine_time); | |
1365 | } |
|
1425 | } | |
1366 |
|
1426 | |||
1367 | void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id) |
|
1427 | void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id) | |
1368 | { |
|
1428 | { | |
1369 | unsigned int val = 0; |
|
1429 | unsigned int val = 0; | |
1370 | if (result == LFR_SUCCESSFUL) |
|
1430 | if (result == LFR_SUCCESSFUL) | |
1371 | { |
|
1431 | { | |
1372 | if ( !( (TC->serviceType==TC_TYPE_TIME) && (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) ) ) |
|
1432 | if ( !( (TC->serviceType==TC_TYPE_TIME) && (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) ) ) | |
1373 | { |
|
1433 | { | |
1374 | send_tm_lfr_tc_exe_success( TC, queue_id ); |
|
1434 | send_tm_lfr_tc_exe_success( TC, queue_id ); | |
1375 | } |
|
1435 | } | |
1376 | update_last_TC_exe( TC ); |
|
1436 | update_last_TC_exe( TC ); | |
1377 | val = housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[0] * 256 + housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[1]; |
|
1437 | val = housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[0] * 256 + housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[1]; | |
1378 | val++; |
|
1438 | val++; | |
1379 | housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[0] = (unsigned char) (val >> 8); |
|
1439 | housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[0] = (unsigned char) (val >> 8); | |
1380 | housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[1] = (unsigned char) (val); |
|
1440 | housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[1] = (unsigned char) (val); | |
1381 | } |
|
1441 | } | |
1382 | else |
|
1442 | else | |
1383 | { |
|
1443 | { | |
1384 | update_last_TC_rej( TC ); |
|
1444 | update_last_TC_rej( TC ); | |
1385 | val = housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[0] * 256 + housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[1]; |
|
1445 | val = housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[0] * 256 + housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[1]; | |
1386 | val++; |
|
1446 | val++; | |
1387 | housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[0] = (unsigned char) (val >> 8); |
|
1447 | housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[0] = (unsigned char) (val >> 8); | |
1388 | housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[1] = (unsigned char) (val); |
|
1448 | housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[1] = (unsigned char) (val); | |
1389 | } |
|
1449 | } | |
1390 | } |
|
1450 | } | |
1391 |
|
1451 | |||
1392 | //*************************** |
|
1452 | //*************************** | |
1393 | // Interrupt Service Routines |
|
1453 | // Interrupt Service Routines | |
1394 | rtems_isr commutation_isr1( rtems_vector_number vector ) |
|
1454 | rtems_isr commutation_isr1( rtems_vector_number vector ) | |
1395 | { |
|
1455 | { | |
1396 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
1456 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { | |
1397 | printf("In commutation_isr1 *** Error sending event to DUMB\n"); |
|
1457 | printf("In commutation_isr1 *** Error sending event to DUMB\n"); | |
1398 | } |
|
1458 | } | |
1399 | } |
|
1459 | } | |
1400 |
|
1460 | |||
1401 | rtems_isr commutation_isr2( rtems_vector_number vector ) |
|
1461 | rtems_isr commutation_isr2( rtems_vector_number vector ) | |
1402 | { |
|
1462 | { | |
1403 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
1463 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { | |
1404 | printf("In commutation_isr2 *** Error sending event to DUMB\n"); |
|
1464 | printf("In commutation_isr2 *** Error sending event to DUMB\n"); | |
1405 | } |
|
1465 | } | |
1406 | } |
|
1466 | } | |
1407 |
|
1467 | |||
1408 |
|
1468 | |||
1409 |
|
1469 | |||
1410 |
|
1470 |
@@ -1,841 +1,843 | |||||
1 | #include <wf_handler.h> |
|
1 | #include <wf_handler.h> | |
2 |
|
2 | |||
3 | // SWF |
|
3 | // SWF | |
4 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F0[7]; |
|
4 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F0[7]; | |
5 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F1[7]; |
|
5 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F1[7]; | |
6 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F2[7]; |
|
6 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F2[7]; | |
7 | // CWF |
|
7 | // CWF | |
8 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F1[7]; |
|
8 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F1[7]; | |
9 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_BURST[7]; |
|
9 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_BURST[7]; | |
10 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_SBM2[7]; |
|
10 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_SBM2[7]; | |
11 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3[7]; |
|
11 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3[7]; | |
12 |
|
12 | |||
13 | unsigned char doubleSendCWF1 = 0; |
|
13 | unsigned char doubleSendCWF1 = 0; | |
14 | unsigned char doubleSendCWF2 = 0; |
|
14 | unsigned char doubleSendCWF2 = 0; | |
15 |
|
15 | |||
16 | rtems_isr waveforms_isr( rtems_vector_number vector ) |
|
16 | rtems_isr waveforms_isr( rtems_vector_number vector ) | |
17 | { |
|
17 | { | |
18 |
|
18 | |||
19 | #ifdef GSA |
|
19 | #ifdef GSA | |
20 | #else |
|
20 | #else | |
21 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) |
|
21 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) | |
22 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
22 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) | |
23 | { // 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 | |
24 | if ((waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full |
|
24 | if ((waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full | |
25 | // (1) change the receiving buffer for the waveform picker |
|
25 | // (1) change the receiving buffer for the waveform picker | |
26 | if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3) { |
|
26 | if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3) { | |
27 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_bis); |
|
27 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_bis); | |
28 | } |
|
28 | } | |
29 | else { |
|
29 | else { | |
30 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3); |
|
30 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3); | |
31 | } |
|
31 | } | |
32 | // (2) send an event for the waveforms transmission |
|
32 | // (2) send an event for the waveforms transmission | |
33 | 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) { | |
34 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
34 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
35 | } |
|
35 | } | |
36 | 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] | |
37 | } |
|
37 | } | |
38 | } |
|
38 | } | |
39 | #endif |
|
39 | #endif | |
40 |
|
40 | |||
41 | switch(lfrCurrentMode) |
|
41 | switch(lfrCurrentMode) | |
42 | { |
|
42 | { | |
43 | //******** |
|
43 | //******** | |
44 | // STANDBY |
|
44 | // STANDBY | |
45 | case(LFR_MODE_STANDBY): |
|
45 | case(LFR_MODE_STANDBY): | |
46 | break; |
|
46 | break; | |
47 |
|
47 | |||
48 | //****** |
|
48 | //****** | |
49 | // NORMAL |
|
49 | // NORMAL | |
50 | case(LFR_MODE_NORMAL): |
|
50 | case(LFR_MODE_NORMAL): | |
51 | #ifdef GSA |
|
51 | #ifdef GSA | |
52 | PRINTF("in waveform_isr *** unexpected waveform picker interruption\n") |
|
52 | PRINTF("in waveform_isr *** unexpected waveform picker interruption\n") | |
53 | #else |
|
53 | #else | |
54 | if ( (waveform_picker_regs->burst_enable & 0x7) == 0x0 ){ // if no channel is enable |
|
54 | if ( (waveform_picker_regs->burst_enable & 0x7) == 0x0 ){ // if no channel is enable | |
55 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
55 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
56 | } |
|
56 | } | |
57 | else { |
|
57 | else { | |
58 | if ( (waveform_picker_regs->status & 0x7) == 0x7 ){ // f2 f1 and f0 are full |
|
58 | if ( (waveform_picker_regs->status & 0x7) == 0x7 ){ // f2 f1 and f0 are full | |
59 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable & 0x08; |
|
59 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable & 0x08; | |
60 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) { |
|
60 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) { | |
61 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
61 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
62 | } |
|
62 | } | |
63 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00; |
|
63 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00; | |
64 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x07; // [0111] enable f2 f1 f0 |
|
64 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x07; // [0111] enable f2 f1 f0 | |
65 | } |
|
65 | } | |
66 | } |
|
66 | } | |
67 | #endif |
|
67 | #endif | |
68 | break; |
|
68 | break; | |
69 |
|
69 | |||
70 | //****** |
|
70 | //****** | |
71 | // BURST |
|
71 | // BURST | |
72 | case(LFR_MODE_BURST): |
|
72 | case(LFR_MODE_BURST): | |
73 | #ifdef GSA |
|
73 | #ifdef GSA | |
74 | PRINTF("in waveform_isr *** unexpected waveform picker interruption\n") |
|
74 | PRINTF("in waveform_isr *** unexpected waveform picker interruption\n") | |
75 | #else |
|
75 | #else | |
76 | if ((waveform_picker_regs->status & 0x04) == 0x04){ // [0100] check the f2 full bit |
|
76 | if ((waveform_picker_regs->status & 0x04) == 0x04){ // [0100] check the f2 full bit | |
77 | // (1) change the receiving buffer for the waveform picker |
|
77 | // (1) change the receiving buffer for the waveform picker | |
78 | if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) { |
|
78 | if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) { | |
79 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_bis); |
|
79 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_bis); | |
80 | } |
|
80 | } | |
81 | else { |
|
81 | else { | |
82 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); |
|
82 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); | |
83 | } |
|
83 | } | |
84 | // (2) send an event for the waveforms transmission |
|
84 | // (2) send an event for the waveforms transmission | |
85 | if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) { |
|
85 | if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) { | |
86 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
86 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
87 | } |
|
87 | } | |
88 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bits = 0 |
|
88 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bits = 0 | |
89 | } |
|
89 | } | |
90 | #endif |
|
90 | #endif | |
91 | break; |
|
91 | break; | |
92 |
|
92 | |||
93 | //***** |
|
93 | //***** | |
94 | // SBM1 |
|
94 | // SBM1 | |
95 | case(LFR_MODE_SBM1): |
|
95 | case(LFR_MODE_SBM1): | |
96 | #ifdef GSA |
|
96 | #ifdef GSA | |
97 | PRINTF("in waveform_isr *** unexpected waveform picker interruption\n") |
|
97 | PRINTF("in waveform_isr *** unexpected waveform picker interruption\n") | |
98 | #else |
|
98 | #else | |
99 | if ((waveform_picker_regs->status & 0x02) == 0x02){ // [0010] check the f1 full bit |
|
99 | if ((waveform_picker_regs->status & 0x02) == 0x02){ // [0010] check the f1 full bit | |
100 | // (1) change the receiving buffer for the waveform picker |
|
100 | // (1) change the receiving buffer for the waveform picker | |
101 | if ( param_local.local_sbm1_nb_cwf_sent == (param_local.local_sbm1_nb_cwf_max-1) ) |
|
101 | if ( param_local.local_sbm1_nb_cwf_sent == (param_local.local_sbm1_nb_cwf_max-1) ) | |
102 | { |
|
102 | { | |
103 | waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_norm); |
|
103 | waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_norm); | |
104 | } |
|
104 | } | |
105 | else if ( waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1_norm ) |
|
105 | else if ( waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1_norm ) | |
106 | { |
|
106 | { | |
107 | doubleSendCWF1 = 1; |
|
107 | doubleSendCWF1 = 1; | |
108 | waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1); |
|
108 | waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1); | |
109 | } |
|
109 | } | |
110 | else if ( waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1 ) { |
|
110 | else if ( waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1 ) { | |
111 | waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_bis); |
|
111 | waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_bis); | |
112 | } |
|
112 | } | |
113 | else { |
|
113 | else { | |
114 | waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1); |
|
114 | waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1); | |
115 | } |
|
115 | } | |
116 | // (2) send an event for the waveforms transmission |
|
116 | // (2) send an event for the waveforms transmission | |
117 | if (rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 ) != RTEMS_SUCCESSFUL) { |
|
117 | if (rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 ) != RTEMS_SUCCESSFUL) { | |
118 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
118 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
119 | } |
|
119 | } | |
120 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bit = 0 |
|
120 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bit = 0 | |
121 | } |
|
121 | } | |
122 | if ( ( (waveform_picker_regs->status & 0x05) == 0x05 ) ) { // [0101] check the f2 and f0 full bit |
|
122 | if ( ( (waveform_picker_regs->status & 0x05) == 0x05 ) ) { // [0101] check the f2 and f0 full bit | |
123 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) { |
|
123 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) { | |
124 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
124 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
125 | } |
|
125 | } | |
126 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2 and f0 bits = 0 |
|
126 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2 and f0 bits = 0 | |
127 | reset_local_sbm1_nb_cwf_sent(); |
|
127 | reset_local_sbm1_nb_cwf_sent(); | |
128 | } |
|
128 | } | |
129 |
|
129 | |||
130 | #endif |
|
130 | #endif | |
131 | break; |
|
131 | break; | |
132 |
|
132 | |||
133 | //***** |
|
133 | //***** | |
134 | // SBM2 |
|
134 | // SBM2 | |
135 | case(LFR_MODE_SBM2): |
|
135 | case(LFR_MODE_SBM2): | |
136 | #ifdef GSA |
|
136 | #ifdef GSA | |
137 | PRINTF("in waveform_isr *** unexpected waveform picker interruption\n") |
|
137 | PRINTF("in waveform_isr *** unexpected waveform picker interruption\n") | |
138 | #else |
|
138 | #else | |
139 | if ((waveform_picker_regs->status & 0x04) == 0x04){ // [0100] check the f2 full bit |
|
139 | if ((waveform_picker_regs->status & 0x04) == 0x04){ // [0100] check the f2 full bit | |
140 | // (1) change the receiving buffer for the waveform picker |
|
140 | // (1) change the receiving buffer for the waveform picker | |
141 | if ( param_local.local_sbm2_nb_cwf_sent == (param_local.local_sbm2_nb_cwf_max-1) ) |
|
141 | if ( param_local.local_sbm2_nb_cwf_sent == (param_local.local_sbm2_nb_cwf_max-1) ) | |
142 | { |
|
142 | { | |
143 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_norm); |
|
143 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_norm); | |
144 | } |
|
144 | } | |
145 | else if ( waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2_norm ) { |
|
145 | else if ( waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2_norm ) { | |
146 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); |
|
146 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); | |
147 | doubleSendCWF2 = 1; |
|
147 | doubleSendCWF2 = 1; | |
148 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2_WFRM ) != RTEMS_SUCCESSFUL) { |
|
148 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2_WFRM ) != RTEMS_SUCCESSFUL) { | |
149 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
149 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
150 | } |
|
150 | } | |
151 | reset_local_sbm2_nb_cwf_sent(); |
|
151 | reset_local_sbm2_nb_cwf_sent(); | |
152 | } |
|
152 | } | |
153 | else if ( waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2 ) { |
|
153 | else if ( waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2 ) { | |
154 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_bis); |
|
154 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_bis); | |
155 | } |
|
155 | } | |
156 | else { |
|
156 | else { | |
157 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); |
|
157 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); | |
158 | } |
|
158 | } | |
159 | // (2) send an event for the waveforms transmission |
|
159 | // (2) send an event for the waveforms transmission | |
160 | if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) { |
|
160 | if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) { | |
161 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
161 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
162 | } |
|
162 | } | |
163 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0 |
|
163 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0 | |
164 | } |
|
164 | } | |
165 | if ( ( (waveform_picker_regs->status & 0x03) == 0x03 ) ) { // [0011] f3 f2 f1 f0, f1 and f0 are full |
|
165 | if ( ( (waveform_picker_regs->status & 0x03) == 0x03 ) ) { // [0011] f3 f2 f1 f0, f1 and f0 are full | |
166 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) { |
|
166 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) { | |
167 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
167 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
168 | } |
|
168 | } | |
169 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0 |
|
169 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0 | |
170 | } |
|
170 | } | |
171 | #endif |
|
171 | #endif | |
172 | break; |
|
172 | break; | |
173 |
|
173 | |||
174 | //******** |
|
174 | //******** | |
175 | // DEFAULT |
|
175 | // DEFAULT | |
176 | default: |
|
176 | default: | |
177 | break; |
|
177 | break; | |
178 | } |
|
178 | } | |
179 | } |
|
179 | } | |
180 |
|
180 | |||
181 | rtems_isr waveforms_simulator_isr( rtems_vector_number vector ) |
|
181 | rtems_isr waveforms_simulator_isr( rtems_vector_number vector ) | |
182 | { |
|
182 | { | |
183 | unsigned char lfrMode; |
|
183 | unsigned char lfrMode; | |
184 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
184 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
185 |
|
185 | |||
186 | switch(lfrMode) { |
|
186 | switch(lfrMode) { | |
187 | case (LFR_MODE_STANDBY): |
|
187 | case (LFR_MODE_STANDBY): | |
188 | break; |
|
188 | break; | |
189 | case (LFR_MODE_NORMAL): |
|
189 | case (LFR_MODE_NORMAL): | |
190 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) { |
|
190 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) { | |
191 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_5 ); |
|
191 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_5 ); | |
192 | } |
|
192 | } | |
193 | break; |
|
193 | break; | |
194 | case (LFR_MODE_BURST): |
|
194 | case (LFR_MODE_BURST): | |
195 | break; |
|
195 | break; | |
196 | case (LFR_MODE_SBM1): |
|
196 | case (LFR_MODE_SBM1): | |
197 | break; |
|
197 | break; | |
198 | case (LFR_MODE_SBM2): |
|
198 | case (LFR_MODE_SBM2): | |
199 | break; |
|
199 | break; | |
200 | } |
|
200 | } | |
201 | } |
|
201 | } | |
202 |
|
202 | |||
203 | rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP |
|
203 | rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP | |
204 | { |
|
204 | { | |
205 | rtems_event_set event_out; |
|
205 | rtems_event_set event_out; | |
206 | rtems_id queue_id; |
|
206 | rtems_id queue_id; | |
207 | rtems_status_code status; |
|
207 | rtems_status_code status; | |
208 |
|
208 | |||
209 | init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 ); |
|
209 | init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 ); | |
210 | init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 ); |
|
210 | init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 ); | |
211 | init_header_snapshot_wf_table( SID_NORM_SWF_F2, headerSWF_F2 ); |
|
211 | init_header_snapshot_wf_table( SID_NORM_SWF_F2, headerSWF_F2 ); | |
212 |
|
212 | |||
213 | init_waveforms(); |
|
213 | init_waveforms(); | |
214 |
|
214 | |||
215 | status = rtems_message_queue_ident( misc_name[QUEUE_PKTS], 0, &queue_id ); |
|
215 | status = rtems_message_queue_ident( misc_name[QUEUE_PKTS], 0, &queue_id ); | |
216 | if (status != RTEMS_SUCCESSFUL) |
|
216 | if (status != RTEMS_SUCCESSFUL) | |
217 | { |
|
217 | { | |
218 | PRINTF1("in WFRM *** ERR getting queue id, %d\n", status) |
|
218 | PRINTF1("in WFRM *** ERR getting queue id, %d\n", status) | |
219 | } |
|
219 | } | |
220 |
|
220 | |||
221 | BOOT_PRINTF("in WFRM ***\n") |
|
221 | BOOT_PRINTF("in WFRM ***\n") | |
222 |
|
222 | |||
223 | while(1){ |
|
223 | while(1){ | |
224 | // wait for an RTEMS_EVENT |
|
224 | // wait for an RTEMS_EVENT | |
225 | rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1 |
|
225 | rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1 | |
226 | | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM, |
|
226 | | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM, | |
227 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
227 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
228 |
|
228 | |||
229 | if (event_out == RTEMS_EVENT_MODE_NORMAL) |
|
229 | if (event_out == RTEMS_EVENT_MODE_NORMAL) | |
230 | { |
|
230 | { | |
231 | send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id); |
|
231 | send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id); | |
232 | send_waveform_SWF(wf_snap_f1, SID_NORM_SWF_F1, headerSWF_F1, queue_id); |
|
232 | send_waveform_SWF(wf_snap_f1, SID_NORM_SWF_F1, headerSWF_F1, queue_id); | |
233 | send_waveform_SWF(wf_snap_f2, SID_NORM_SWF_F2, headerSWF_F2, queue_id); |
|
233 | send_waveform_SWF(wf_snap_f2, SID_NORM_SWF_F2, headerSWF_F2, queue_id); | |
234 | #ifdef GSA |
|
234 | #ifdef GSA | |
235 | waveform_picker_regs->status = waveform_picker_regs->status & 0xf888; // [1111 1000 1000 1000] f2, f1, f0 bits =0 |
|
235 | waveform_picker_regs->status = waveform_picker_regs->status & 0xf888; // [1111 1000 1000 1000] f2, f1, f0 bits =0 | |
236 | #endif |
|
236 | #endif | |
237 | } |
|
237 | } | |
238 | else if (event_out == RTEMS_EVENT_MODE_SBM1) |
|
238 | else if (event_out == RTEMS_EVENT_MODE_SBM1) | |
239 | { |
|
239 | { | |
240 | send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id); |
|
240 | send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id); | |
241 | send_waveform_SWF(wf_snap_f1_norm, SID_NORM_SWF_F1, headerSWF_F1, queue_id); |
|
241 | send_waveform_SWF(wf_snap_f1_norm, SID_NORM_SWF_F1, headerSWF_F1, queue_id); | |
242 | send_waveform_SWF(wf_snap_f2, SID_NORM_SWF_F2, headerSWF_F2, queue_id); |
|
242 | send_waveform_SWF(wf_snap_f2, SID_NORM_SWF_F2, headerSWF_F2, queue_id); | |
243 | #ifdef GSA |
|
243 | #ifdef GSA | |
244 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2, f0 bits = 0 |
|
244 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2, f0 bits = 0 | |
245 | #endif |
|
245 | #endif | |
246 | } |
|
246 | } | |
247 | else if (event_out == RTEMS_EVENT_MODE_SBM2) |
|
247 | else if (event_out == RTEMS_EVENT_MODE_SBM2) | |
248 | { |
|
248 | { | |
249 | send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id); |
|
249 | send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id); | |
250 | send_waveform_SWF(wf_snap_f1, SID_NORM_SWF_F1, headerSWF_F1, queue_id); |
|
250 | send_waveform_SWF(wf_snap_f1, SID_NORM_SWF_F1, headerSWF_F1, queue_id); | |
251 | #ifdef GSA |
|
251 | #ifdef GSA | |
252 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0 |
|
252 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0 | |
253 | #endif |
|
253 | #endif | |
254 | } |
|
254 | } | |
255 | else if (event_out == RTEMS_EVENT_MODE_SBM2_WFRM) |
|
255 | else if (event_out == RTEMS_EVENT_MODE_SBM2_WFRM) | |
256 | { |
|
256 | { | |
257 | send_waveform_SWF(wf_snap_f2_norm, SID_NORM_SWF_F2, headerSWF_F2, queue_id); |
|
257 | send_waveform_SWF(wf_snap_f2_norm, SID_NORM_SWF_F2, headerSWF_F2, queue_id); | |
258 | } |
|
258 | } | |
259 | else |
|
259 | else | |
260 | { |
|
260 | { | |
261 | PRINTF("in WFRM *** unexpected event") |
|
261 | PRINTF("in WFRM *** unexpected event") | |
262 | } |
|
262 | } | |
263 |
|
263 | |||
264 |
|
264 | |||
265 | #ifdef GSA |
|
265 | #ifdef GSA | |
266 | // irq processed, reset the related register of the timer unit |
|
266 | // irq processed, reset the related register of the timer unit | |
267 | gptimer_regs->timer[TIMER_WF_SIMULATOR].ctrl = gptimer_regs->timer[TIMER_WF_SIMULATOR].ctrl | 0x00000010; |
|
267 | gptimer_regs->timer[TIMER_WF_SIMULATOR].ctrl = gptimer_regs->timer[TIMER_WF_SIMULATOR].ctrl | 0x00000010; | |
268 | // clear the interruption |
|
268 | // clear the interruption | |
269 | LEON_Unmask_interrupt( IRQ_WF ); |
|
269 | LEON_Unmask_interrupt( IRQ_WF ); | |
270 | #endif |
|
270 | #endif | |
271 | } |
|
271 | } | |
272 | } |
|
272 | } | |
273 |
|
273 | |||
274 | rtems_task cwf3_task(rtems_task_argument argument) //used with the waveform picker VHDL IP |
|
274 | rtems_task cwf3_task(rtems_task_argument argument) //used with the waveform picker VHDL IP | |
275 | { |
|
275 | { | |
276 | rtems_event_set event_out; |
|
276 | rtems_event_set event_out; | |
277 | rtems_id queue_id; |
|
277 | rtems_id queue_id; | |
278 |
|
278 | |||
279 | init_header_continuous_wf_table( SID_NORM_CWF_F3, headerCWF_F3 ); |
|
279 | init_header_continuous_wf_table( SID_NORM_CWF_F3, headerCWF_F3 ); | |
280 |
|
280 | |||
281 | queue_id = get_pkts_queue_id(); |
|
281 | queue_id = get_pkts_queue_id(); | |
282 |
|
282 | |||
283 | BOOT_PRINTF("in CWF3 ***\n") |
|
283 | BOOT_PRINTF("in CWF3 ***\n") | |
284 |
|
284 | |||
285 | while(1){ |
|
285 | while(1){ | |
286 | // wait for an RTEMS_EVENT |
|
286 | // wait for an RTEMS_EVENT | |
287 | rtems_event_receive( RTEMS_EVENT_0, |
|
287 | rtems_event_receive( RTEMS_EVENT_0, | |
288 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
288 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
289 | PRINTF("send CWF F3 \n") |
|
289 | PRINTF("send CWF F3 \n") | |
290 | #ifdef GSA |
|
290 | #ifdef GSA | |
291 | #else |
|
291 | #else | |
292 | if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3) { |
|
292 | if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3) { | |
293 | send_waveform_CWF( wf_cont_f3_bis, SID_NORM_CWF_F3, headerCWF_F3, queue_id ); |
|
293 | send_waveform_CWF( wf_cont_f3_bis, SID_NORM_CWF_F3, headerCWF_F3, queue_id ); | |
294 | } |
|
294 | } | |
295 | else { |
|
295 | else { | |
296 | send_waveform_CWF( wf_cont_f3, SID_NORM_CWF_F3, headerCWF_F3, queue_id ); |
|
296 | send_waveform_CWF( wf_cont_f3, SID_NORM_CWF_F3, headerCWF_F3, queue_id ); | |
297 | } |
|
297 | } | |
298 | #endif |
|
298 | #endif | |
299 | } |
|
299 | } | |
300 | } |
|
300 | } | |
301 |
|
301 | |||
302 | rtems_task cwf2_task(rtems_task_argument argument) // ONLY USED IN BURST AND SBM2 |
|
302 | rtems_task cwf2_task(rtems_task_argument argument) // ONLY USED IN BURST AND SBM2 | |
303 | { |
|
303 | { | |
304 | rtems_event_set event_out; |
|
304 | rtems_event_set event_out; | |
305 | rtems_id queue_id; |
|
305 | rtems_id queue_id; | |
306 |
|
306 | |||
307 | init_header_continuous_wf_table( SID_BURST_CWF_F2, headerCWF_F2_BURST ); |
|
307 | init_header_continuous_wf_table( SID_BURST_CWF_F2, headerCWF_F2_BURST ); | |
308 | init_header_continuous_wf_table( SID_SBM2_CWF_F2, headerCWF_F2_SBM2 ); |
|
308 | init_header_continuous_wf_table( SID_SBM2_CWF_F2, headerCWF_F2_SBM2 ); | |
309 |
|
309 | |||
310 | queue_id = get_pkts_queue_id(); |
|
310 | queue_id = get_pkts_queue_id(); | |
311 |
|
311 | |||
312 | BOOT_PRINTF("in CWF2 ***\n") |
|
312 | BOOT_PRINTF("in CWF2 ***\n") | |
313 |
|
313 | |||
314 | while(1){ |
|
314 | while(1){ | |
315 | // wait for an RTEMS_EVENT |
|
315 | // wait for an RTEMS_EVENT | |
316 | rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2, |
|
316 | rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2, | |
317 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
317 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
|
318 | ||||
318 | if (event_out == RTEMS_EVENT_MODE_BURST) |
|
319 | if (event_out == RTEMS_EVENT_MODE_BURST) | |
319 | { |
|
320 | { | |
320 | // F2 |
|
321 | // F2 | |
321 | #ifdef GSA |
|
322 | #ifdef GSA | |
322 | #else |
|
323 | #else | |
323 | if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) { |
|
324 | if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) { | |
324 | send_waveform_CWF( wf_snap_f2_bis, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id ); |
|
325 | send_waveform_CWF( wf_snap_f2_bis, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id ); | |
325 | } |
|
326 | } | |
326 | else { |
|
327 | else { | |
327 | send_waveform_CWF( wf_snap_f2, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id ); |
|
328 | send_waveform_CWF( wf_snap_f2, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id ); | |
328 | } |
|
329 | } | |
329 | #endif |
|
330 | #endif | |
330 | } |
|
331 | } | |
|
332 | ||||
331 | else if (event_out == RTEMS_EVENT_MODE_SBM2) |
|
333 | else if (event_out == RTEMS_EVENT_MODE_SBM2) | |
332 | { |
|
334 | { | |
333 | #ifdef GSA |
|
335 | #ifdef GSA | |
334 | #else |
|
336 | #else | |
335 | if (doubleSendCWF2 == 1) |
|
337 | if (doubleSendCWF2 == 1) | |
336 | { |
|
338 | { | |
337 | doubleSendCWF2 = 0; |
|
339 | doubleSendCWF2 = 0; | |
338 | send_waveform_CWF( wf_snap_f2_norm, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id ); |
|
340 | send_waveform_CWF( wf_snap_f2_norm, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id ); | |
339 | } |
|
341 | } | |
340 | else if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) { |
|
342 | else if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) { | |
341 | send_waveform_CWF( wf_snap_f2_bis, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id ); |
|
343 | send_waveform_CWF( wf_snap_f2_bis, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id ); | |
342 | } |
|
344 | } | |
343 | else { |
|
345 | else { | |
344 | send_waveform_CWF( wf_snap_f2, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id ); |
|
346 | send_waveform_CWF( wf_snap_f2, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id ); | |
345 | } |
|
347 | } | |
346 | param_local.local_sbm2_nb_cwf_sent ++; |
|
348 | param_local.local_sbm2_nb_cwf_sent ++; | |
347 | #endif |
|
349 | #endif | |
348 | } |
|
350 | } | |
349 | else |
|
351 | else | |
350 | { |
|
352 | { | |
351 | PRINTF1("in CWF2 *** ERR mode = %d\n", lfrCurrentMode) |
|
353 | PRINTF1("in CWF2 *** ERR mode = %d\n", lfrCurrentMode) | |
352 | } |
|
354 | } | |
353 | } |
|
355 | } | |
354 | } |
|
356 | } | |
355 |
|
357 | |||
356 | rtems_task cwf1_task(rtems_task_argument argument) // ONLY USED IN SBM1 |
|
358 | rtems_task cwf1_task(rtems_task_argument argument) // ONLY USED IN SBM1 | |
357 | { |
|
359 | { | |
358 | rtems_event_set event_out; |
|
360 | rtems_event_set event_out; | |
359 | rtems_id queue_id; |
|
361 | rtems_id queue_id; | |
360 |
|
362 | |||
361 | init_header_continuous_wf_table( SID_SBM1_CWF_F1, headerCWF_F1 ); |
|
363 | init_header_continuous_wf_table( SID_SBM1_CWF_F1, headerCWF_F1 ); | |
362 |
|
364 | |||
363 | queue_id = get_pkts_queue_id(); |
|
365 | queue_id = get_pkts_queue_id(); | |
364 |
|
366 | |||
365 | BOOT_PRINTF("in CWF1 ***\n") |
|
367 | BOOT_PRINTF("in CWF1 ***\n") | |
366 |
|
368 | |||
367 | while(1){ |
|
369 | while(1){ | |
368 | // wait for an RTEMS_EVENT |
|
370 | // wait for an RTEMS_EVENT | |
369 | rtems_event_receive( RTEMS_EVENT_MODE_SBM1, |
|
371 | rtems_event_receive( RTEMS_EVENT_MODE_SBM1, | |
370 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
372 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
371 | if (event_out == RTEMS_EVENT_MODE_SBM1) |
|
373 | if (event_out == RTEMS_EVENT_MODE_SBM1) | |
372 | { |
|
374 | { | |
373 | #ifdef GSA |
|
375 | #ifdef GSA | |
374 | #else |
|
376 | #else | |
375 | if (doubleSendCWF1 == 1) |
|
377 | if (doubleSendCWF1 == 1) | |
376 | { |
|
378 | { | |
377 | doubleSendCWF1 = 0; |
|
379 | doubleSendCWF1 = 0; | |
378 | send_waveform_CWF( wf_snap_f1_norm, SID_SBM1_CWF_F1, headerCWF_F1, queue_id ); |
|
380 | send_waveform_CWF( wf_snap_f1_norm, SID_SBM1_CWF_F1, headerCWF_F1, queue_id ); | |
379 | } |
|
381 | } | |
380 | else if (waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1) { |
|
382 | else if (waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1) { | |
381 | send_waveform_CWF( wf_snap_f1_bis, SID_SBM1_CWF_F1, headerCWF_F1, queue_id ); |
|
383 | send_waveform_CWF( wf_snap_f1_bis, SID_SBM1_CWF_F1, headerCWF_F1, queue_id ); | |
382 | } |
|
384 | } | |
383 | else { |
|
385 | else { | |
384 | send_waveform_CWF( wf_snap_f1, SID_SBM1_CWF_F1, headerCWF_F1, queue_id ); |
|
386 | send_waveform_CWF( wf_snap_f1, SID_SBM1_CWF_F1, headerCWF_F1, queue_id ); | |
385 | } |
|
387 | } | |
386 | param_local.local_sbm1_nb_cwf_sent ++; |
|
388 | param_local.local_sbm1_nb_cwf_sent ++; | |
387 | #endif |
|
389 | #endif | |
388 | } |
|
390 | } | |
389 | else |
|
391 | else | |
390 | { |
|
392 | { | |
391 | PRINTF1("in CWF1 *** ERR mode = %d\n", lfrCurrentMode) |
|
393 | PRINTF1("in CWF1 *** ERR mode = %d\n", lfrCurrentMode) | |
392 | } |
|
394 | } | |
393 | } |
|
395 | } | |
394 | } |
|
396 | } | |
395 |
|
397 | |||
396 | //****************** |
|
398 | //****************** | |
397 | // general functions |
|
399 | // general functions | |
398 | void init_waveforms( void ) |
|
400 | void init_waveforms( void ) | |
399 | { |
|
401 | { | |
400 | int i = 0; |
|
402 | int i = 0; | |
401 |
|
403 | |||
402 | for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++) |
|
404 | for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++) | |
403 | { |
|
405 | { | |
404 | //*** |
|
406 | //*** | |
405 | // F0 |
|
407 | // F0 | |
406 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x88887777; // |
|
408 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x88887777; // | |
407 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; // |
|
409 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; // | |
408 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x44443333; // |
|
410 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x44443333; // | |
409 |
|
411 | |||
410 | //*** |
|
412 | //*** | |
411 | // F1 |
|
413 | // F1 | |
412 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x22221111; |
|
414 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x22221111; | |
413 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x44443333; |
|
415 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x44443333; | |
414 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000; |
|
416 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000; | |
415 |
|
417 | |||
416 | //*** |
|
418 | //*** | |
417 | // F2 |
|
419 | // F2 | |
418 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x44443333; |
|
420 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x44443333; | |
419 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; |
|
421 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; | |
420 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000; |
|
422 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000; | |
421 |
|
423 | |||
422 | //*** |
|
424 | //*** | |
423 | // F3 |
|
425 | // F3 | |
424 | //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 0 ] = val1; |
|
426 | //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 0 ] = val1; | |
425 | //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 1 ] = val2; |
|
427 | //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 1 ] = val2; | |
426 | //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 2 ] = 0xaaaa0000; |
|
428 | //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 2 ] = 0xaaaa0000; | |
427 | } |
|
429 | } | |
428 | } |
|
430 | } | |
429 |
|
431 | |||
430 | int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF) |
|
432 | int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF) | |
431 | { |
|
433 | { | |
432 | unsigned char i; |
|
434 | unsigned char i; | |
433 |
|
435 | |||
434 | for (i=0; i<7; i++) |
|
436 | for (i=0; i<7; i++) | |
435 | { |
|
437 | { | |
436 | headerSWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
438 | headerSWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; | |
437 | headerSWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
439 | headerSWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
438 | headerSWF[ i ].reserved = DEFAULT_RESERVED; |
|
440 | headerSWF[ i ].reserved = DEFAULT_RESERVED; | |
439 | headerSWF[ i ].userApplication = CCSDS_USER_APP; |
|
441 | headerSWF[ i ].userApplication = CCSDS_USER_APP; | |
440 | headerSWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); |
|
442 | headerSWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); | |
441 | headerSWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); |
|
443 | headerSWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); | |
442 | if (i == 0) |
|
444 | if (i == 0) | |
443 | { |
|
445 | { | |
444 | headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST; |
|
446 | headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST; | |
445 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_340 >> 8); |
|
447 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_340 >> 8); | |
446 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_340 ); |
|
448 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_340 ); | |
447 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8); |
|
449 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8); | |
448 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 ); |
|
450 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 ); | |
449 | } |
|
451 | } | |
450 | else if (i == 6) |
|
452 | else if (i == 6) | |
451 | { |
|
453 | { | |
452 | headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST; |
|
454 | headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST; | |
453 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_8 >> 8); |
|
455 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_8 >> 8); | |
454 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_8 ); |
|
456 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_8 ); | |
455 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8); |
|
457 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8); | |
456 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 ); |
|
458 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 ); | |
457 | } |
|
459 | } | |
458 | else |
|
460 | else | |
459 | { |
|
461 | { | |
460 | headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION; |
|
462 | headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION; | |
461 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_340 >> 8); |
|
463 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_340 >> 8); | |
462 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_340 ); |
|
464 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_340 ); | |
463 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8); |
|
465 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8); | |
464 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 ); |
|
466 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 ); | |
465 | } |
|
467 | } | |
466 | headerSWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
468 | headerSWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
467 | headerSWF[ i ].pktCnt = DEFAULT_PKTCNT; // PKT_CNT |
|
469 | headerSWF[ i ].pktCnt = DEFAULT_PKTCNT; // PKT_CNT | |
468 | headerSWF[ i ].pktNr = i+1; // PKT_NR |
|
470 | headerSWF[ i ].pktNr = i+1; // PKT_NR | |
469 | // DATA FIELD HEADER |
|
471 | // DATA FIELD HEADER | |
470 | headerSWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
472 | headerSWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
471 | headerSWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
473 | headerSWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
472 | headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
474 | headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
473 | headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; |
|
475 | headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; | |
474 | // AUXILIARY DATA HEADER |
|
476 | // AUXILIARY DATA HEADER | |
475 | headerSWF[ i ].sid = sid; |
|
477 | headerSWF[ i ].sid = sid; | |
476 | headerSWF[ i ].hkBIA = DEFAULT_HKBIA; |
|
478 | headerSWF[ i ].hkBIA = DEFAULT_HKBIA; | |
477 | headerSWF[ i ].time[0] = 0x00; |
|
479 | headerSWF[ i ].time[0] = 0x00; | |
478 | headerSWF[ i ].time[0] = 0x00; |
|
480 | headerSWF[ i ].time[0] = 0x00; | |
479 | headerSWF[ i ].time[0] = 0x00; |
|
481 | headerSWF[ i ].time[0] = 0x00; | |
480 | headerSWF[ i ].time[0] = 0x00; |
|
482 | headerSWF[ i ].time[0] = 0x00; | |
481 | headerSWF[ i ].time[0] = 0x00; |
|
483 | headerSWF[ i ].time[0] = 0x00; | |
482 | headerSWF[ i ].time[0] = 0x00; |
|
484 | headerSWF[ i ].time[0] = 0x00; | |
483 | } |
|
485 | } | |
484 | return LFR_SUCCESSFUL; |
|
486 | return LFR_SUCCESSFUL; | |
485 | } |
|
487 | } | |
486 |
|
488 | |||
487 | int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF ) |
|
489 | int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF ) | |
488 | { |
|
490 | { | |
489 | unsigned int i; |
|
491 | unsigned int i; | |
490 |
|
492 | |||
491 | for (i=0; i<7; i++) |
|
493 | for (i=0; i<7; i++) | |
492 | { |
|
494 | { | |
493 | headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
495 | headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; | |
494 | headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
496 | headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
495 | headerCWF[ i ].reserved = DEFAULT_RESERVED; |
|
497 | headerCWF[ i ].reserved = DEFAULT_RESERVED; | |
496 | headerCWF[ i ].userApplication = CCSDS_USER_APP; |
|
498 | headerCWF[ i ].userApplication = CCSDS_USER_APP; | |
497 | if (SID_SBM1_CWF_F1 || SID_SBM2_CWF_F2) |
|
499 | if ( (sid == SID_SBM1_CWF_F1) || (sid == SID_SBM2_CWF_F2) ) | |
498 | { |
|
500 | { | |
499 | headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2 >> 8); |
|
501 | headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2 >> 8); | |
500 | headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2); |
|
502 | headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2); | |
501 | } |
|
503 | } | |
502 | else |
|
504 | else | |
503 | { |
|
505 | { | |
504 | headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); |
|
506 | headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); | |
505 | headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); |
|
507 | headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); | |
506 | } |
|
508 | } | |
507 | if (i == 0) |
|
509 | if (i == 0) | |
508 | { |
|
510 | { | |
509 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST; |
|
511 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST; | |
510 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_340 >> 8); |
|
512 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_340 >> 8); | |
511 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_340 ); |
|
513 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_340 ); | |
512 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8); |
|
514 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8); | |
513 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 ); |
|
515 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 ); | |
514 | } |
|
516 | } | |
515 | else if (i == 6) |
|
517 | else if (i == 6) | |
516 | { |
|
518 | { | |
517 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST; |
|
519 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST; | |
518 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_8 >> 8); |
|
520 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_8 >> 8); | |
519 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_8 ); |
|
521 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_8 ); | |
520 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8); |
|
522 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8); | |
521 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 ); |
|
523 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 ); | |
522 | } |
|
524 | } | |
523 | else |
|
525 | else | |
524 | { |
|
526 | { | |
525 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION; |
|
527 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION; | |
526 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_340 >> 8); |
|
528 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_340 >> 8); | |
527 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_340 ); |
|
529 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_340 ); | |
528 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8); |
|
530 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8); | |
529 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 ); |
|
531 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 ); | |
530 | } |
|
532 | } | |
531 | headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
533 | headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
532 | // PKT_CNT |
|
534 | // PKT_CNT | |
533 | // PKT_NR |
|
535 | // PKT_NR | |
534 | // DATA FIELD HEADER |
|
536 | // DATA FIELD HEADER | |
535 | headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
537 | headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
536 | headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
538 | headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
537 | headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
539 | headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
538 | headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; |
|
540 | headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; | |
539 | // AUXILIARY DATA HEADER |
|
541 | // AUXILIARY DATA HEADER | |
540 | headerCWF[ i ].sid = sid; |
|
542 | headerCWF[ i ].sid = sid; | |
541 | headerCWF[ i ].hkBIA = DEFAULT_HKBIA; |
|
543 | headerCWF[ i ].hkBIA = DEFAULT_HKBIA; | |
542 | headerCWF[ i ].time[0] = 0x00; |
|
544 | headerCWF[ i ].time[0] = 0x00; | |
543 | headerCWF[ i ].time[0] = 0x00; |
|
545 | headerCWF[ i ].time[0] = 0x00; | |
544 | headerCWF[ i ].time[0] = 0x00; |
|
546 | headerCWF[ i ].time[0] = 0x00; | |
545 | headerCWF[ i ].time[0] = 0x00; |
|
547 | headerCWF[ i ].time[0] = 0x00; | |
546 | headerCWF[ i ].time[0] = 0x00; |
|
548 | headerCWF[ i ].time[0] = 0x00; | |
547 | headerCWF[ i ].time[0] = 0x00; |
|
549 | headerCWF[ i ].time[0] = 0x00; | |
548 | } |
|
550 | } | |
549 | return LFR_SUCCESSFUL; |
|
551 | return LFR_SUCCESSFUL; | |
550 | } |
|
552 | } | |
551 |
|
553 | |||
552 | void reset_waveforms( void ) |
|
554 | void reset_waveforms( void ) | |
553 | { |
|
555 | { | |
554 | int i = 0; |
|
556 | int i = 0; | |
555 |
|
557 | |||
556 | for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++) |
|
558 | for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++) | |
557 | { |
|
559 | { | |
558 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x10002000; |
|
560 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x10002000; | |
559 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0x20001000; |
|
561 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0x20001000; | |
560 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x40008000; |
|
562 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x40008000; | |
561 |
|
563 | |||
562 | //*** |
|
564 | //*** | |
563 | // F1 |
|
565 | // F1 | |
564 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x1000f000; |
|
566 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x1000f000; | |
565 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0xf0001000; |
|
567 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0xf0001000; | |
566 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x40008000; |
|
568 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x40008000; | |
567 |
|
569 | |||
568 | //*** |
|
570 | //*** | |
569 | // F2 |
|
571 | // F2 | |
570 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x40008000; |
|
572 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x40008000; | |
571 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0x20001000; |
|
573 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0x20001000; | |
572 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x10002000; |
|
574 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x10002000; | |
573 |
|
575 | |||
574 | //*** |
|
576 | //*** | |
575 | // F3 |
|
577 | // F3 | |
576 | /*wf_cont_f3[ i* NB_WORDS_SWF_BLK + 0 ] = build_value( i, i ); // v and 1 |
|
578 | /*wf_cont_f3[ i* NB_WORDS_SWF_BLK + 0 ] = build_value( i, i ); // v and 1 | |
577 | wf_cont_f3[ i* NB_WORDS_SWF_BLK + 1 ] = build_value( i, i ); // e2 and b1 |
|
579 | wf_cont_f3[ i* NB_WORDS_SWF_BLK + 1 ] = build_value( i, i ); // e2 and b1 | |
578 | wf_cont_f3[ i* NB_WORDS_SWF_BLK + 2 ] = build_value( i, i ); // b2 and b3*/ |
|
580 | wf_cont_f3[ i* NB_WORDS_SWF_BLK + 2 ] = build_value( i, i ); // b2 and b3*/ | |
579 | } |
|
581 | } | |
580 | } |
|
582 | } | |
581 |
|
583 | |||
582 | int send_waveform_SWF( volatile int *waveform, unsigned int sid, |
|
584 | int send_waveform_SWF( volatile int *waveform, unsigned int sid, | |
583 | Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id ) |
|
585 | Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id ) | |
584 | { |
|
586 | { | |
585 | unsigned int i; |
|
587 | unsigned int i; | |
586 | int ret; |
|
588 | int ret; | |
587 | rtems_status_code status; |
|
589 | rtems_status_code status; | |
588 | spw_ioctl_pkt_send spw_ioctl_send_SWF; |
|
590 | spw_ioctl_pkt_send spw_ioctl_send_SWF; | |
589 |
|
591 | |||
590 | spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header |
|
592 | spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header | |
591 | spw_ioctl_send_SWF.options = 0; |
|
593 | spw_ioctl_send_SWF.options = 0; | |
592 |
|
594 | |||
593 | ret = LFR_DEFAULT; |
|
595 | ret = LFR_DEFAULT; | |
594 |
|
596 | |||
595 | for (i=0; i<7; i++) // send waveform |
|
597 | for (i=0; i<7; i++) // send waveform | |
596 | { |
|
598 | { | |
597 | spw_ioctl_send_SWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ]; |
|
599 | spw_ioctl_send_SWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ]; | |
598 | spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ]; |
|
600 | spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ]; | |
599 | // BUILD THE DATA |
|
601 | // BUILD THE DATA | |
600 | if (i==6) { |
|
602 | if (i==6) { | |
601 | spw_ioctl_send_SWF.dlen = 8 * NB_BYTES_SWF_BLK; |
|
603 | spw_ioctl_send_SWF.dlen = 8 * NB_BYTES_SWF_BLK; | |
602 | } |
|
604 | } | |
603 | else { |
|
605 | else { | |
604 | spw_ioctl_send_SWF.dlen = 340 * NB_BYTES_SWF_BLK; |
|
606 | spw_ioctl_send_SWF.dlen = 340 * NB_BYTES_SWF_BLK; | |
605 | } |
|
607 | } | |
606 | // SET PACKET TIME |
|
608 | // SET PACKET TIME | |
607 | headerSWF[ i ].time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
609 | headerSWF[ i ].time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
608 | headerSWF[ i ].time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
610 | headerSWF[ i ].time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
609 | headerSWF[ i ].time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
611 | headerSWF[ i ].time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
610 | headerSWF[ i ].time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
612 | headerSWF[ i ].time[3] = (unsigned char) (time_management_regs->coarse_time); | |
611 | headerSWF[ i ].time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
613 | headerSWF[ i ].time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
612 | headerSWF[ i ].time[5] = (unsigned char) (time_management_regs->fine_time); |
|
614 | headerSWF[ i ].time[5] = (unsigned char) (time_management_regs->fine_time); | |
613 | headerSWF[ i ].acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
615 | headerSWF[ i ].acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
614 | headerSWF[ i ].acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
616 | headerSWF[ i ].acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
615 | headerSWF[ i ].acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
617 | headerSWF[ i ].acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
616 | headerSWF[ i ].acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time); |
|
618 | headerSWF[ i ].acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time); | |
617 | headerSWF[ i ].acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
619 | headerSWF[ i ].acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
618 | headerSWF[ i ].acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time); |
|
620 | headerSWF[ i ].acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time); | |
619 | // SEND PACKET |
|
621 | // SEND PACKET | |
620 |
status = rtems_message_queue_send( queue_id, &spw_ioctl_send_SWF, ACTION_MSG_ |
|
622 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_SWF, ACTION_MSG_SPW_IOCTL_SEND_SIZE); | |
621 | if (status != RTEMS_SUCCESSFUL) { |
|
623 | if (status != RTEMS_SUCCESSFUL) { | |
622 | printf("%d-%d, ERR %d\n", sid, i, (int) status); |
|
624 | printf("%d-%d, ERR %d\n", sid, i, (int) status); | |
623 | ret = LFR_DEFAULT; |
|
625 | ret = LFR_DEFAULT; | |
624 | } |
|
626 | } | |
625 | rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds |
|
627 | rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds | |
626 | } |
|
628 | } | |
627 |
|
629 | |||
628 | return ret; |
|
630 | return ret; | |
629 | } |
|
631 | } | |
630 |
|
632 | |||
631 | int send_waveform_CWF(volatile int *waveform, unsigned int sid, |
|
633 | int send_waveform_CWF(volatile int *waveform, unsigned int sid, | |
632 | Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id) |
|
634 | Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id) | |
633 | { |
|
635 | { | |
634 | unsigned int i; |
|
636 | unsigned int i; | |
635 | int ret; |
|
637 | int ret; | |
636 | rtems_status_code status; |
|
638 | rtems_status_code status; | |
637 | spw_ioctl_pkt_send spw_ioctl_send_CWF; |
|
639 | spw_ioctl_pkt_send spw_ioctl_send_CWF; | |
638 |
|
640 | |||
639 | spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header |
|
641 | spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header | |
640 | spw_ioctl_send_CWF.options = 0; |
|
642 | spw_ioctl_send_CWF.options = 0; | |
641 |
|
643 | |||
642 | ret = LFR_DEFAULT; |
|
644 | ret = LFR_DEFAULT; | |
643 |
|
645 | |||
644 | for (i=0; i<7; i++) // send waveform |
|
646 | for (i=0; i<7; i++) // send waveform | |
645 | { |
|
647 | { | |
646 | int coarseTime = 0x00; |
|
648 | int coarseTime = 0x00; | |
647 | int fineTime = 0x00; |
|
649 | int fineTime = 0x00; | |
648 | spw_ioctl_send_CWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ]; |
|
650 | spw_ioctl_send_CWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ]; | |
649 | spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ]; |
|
651 | spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ]; | |
650 | // BUILD THE DATA |
|
652 | // BUILD THE DATA | |
651 | if (i==6) { |
|
653 | if (i==6) { | |
652 | spw_ioctl_send_CWF.dlen = 8 * NB_BYTES_SWF_BLK; |
|
654 | spw_ioctl_send_CWF.dlen = 8 * NB_BYTES_SWF_BLK; | |
653 | } |
|
655 | } | |
654 | else { |
|
656 | else { | |
655 | spw_ioctl_send_CWF.dlen = 340 * NB_BYTES_SWF_BLK; |
|
657 | spw_ioctl_send_CWF.dlen = 340 * NB_BYTES_SWF_BLK; | |
656 | } |
|
658 | } | |
657 | // SET PACKET TIME |
|
659 | // SET PACKET TIME | |
658 | coarseTime = time_management_regs->coarse_time; |
|
660 | coarseTime = time_management_regs->coarse_time; | |
659 | fineTime = time_management_regs->fine_time; |
|
661 | fineTime = time_management_regs->fine_time; | |
660 | headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24); |
|
662 | headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24); | |
661 | headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16); |
|
663 | headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16); | |
662 | headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8); |
|
664 | headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8); | |
663 | headerCWF[ i ].time[3] = (unsigned char) (coarseTime); |
|
665 | headerCWF[ i ].time[3] = (unsigned char) (coarseTime); | |
664 | headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8); |
|
666 | headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8); | |
665 | headerCWF[ i ].time[5] = (unsigned char) (fineTime); |
|
667 | headerCWF[ i ].time[5] = (unsigned char) (fineTime); | |
666 | headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24); |
|
668 | headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24); | |
667 | headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16); |
|
669 | headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16); | |
668 | headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8); |
|
670 | headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8); | |
669 | headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime); |
|
671 | headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime); | |
670 | headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8); |
|
672 | headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8); | |
671 | headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime); |
|
673 | headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime); | |
672 | // SEND PACKET |
|
674 | // SEND PACKET | |
673 | if (sid == SID_NORM_CWF_F3) |
|
675 | if (sid == SID_NORM_CWF_F3) | |
674 | { |
|
676 | { | |
675 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); |
|
677 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); | |
676 | if (status != RTEMS_SUCCESSFUL) { |
|
678 | if (status != RTEMS_SUCCESSFUL) { | |
677 | printf("%d-%d, ERR %d\n", sid, i, (int) status); |
|
679 | printf("%d-%d, ERR %d\n", sid, i, (int) status); | |
678 | ret = LFR_DEFAULT; |
|
680 | ret = LFR_DEFAULT; | |
679 | } |
|
681 | } | |
680 | rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS); |
|
682 | rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS); | |
681 | } |
|
683 | } | |
682 | else |
|
684 | else | |
683 | { |
|
685 | { | |
684 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); |
|
686 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); | |
685 | if (status != RTEMS_SUCCESSFUL) { |
|
687 | if (status != RTEMS_SUCCESSFUL) { | |
686 | printf("%d-%d, ERR %d\n", sid, i, (int) status); |
|
688 | printf("%d-%d, ERR %d\n", sid, i, (int) status); | |
687 | ret = LFR_DEFAULT; |
|
689 | ret = LFR_DEFAULT; | |
688 | } |
|
690 | } | |
689 | } |
|
691 | } | |
690 | } |
|
692 | } | |
691 |
|
693 | |||
692 | return ret; |
|
694 | return ret; | |
693 | } |
|
695 | } | |
694 |
|
696 | |||
695 | //************** |
|
697 | //************** | |
696 | // wfp registers |
|
698 | // wfp registers | |
697 | void set_wfp_data_shaping() |
|
699 | void set_wfp_data_shaping() | |
698 | { |
|
700 | { | |
699 | unsigned char data_shaping; |
|
701 | unsigned char data_shaping; | |
700 |
|
702 | |||
701 | // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register |
|
703 | // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register | |
702 | // waveform picker : [R1 R0 SP1 SP0 BW] |
|
704 | // waveform picker : [R1 R0 SP1 SP0 BW] | |
703 |
|
705 | |||
704 | data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1; |
|
706 | data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1; | |
705 |
|
707 | |||
706 | #ifdef GSA |
|
708 | #ifdef GSA | |
707 | #else |
|
709 | #else | |
708 | waveform_picker_regs->data_shaping = |
|
710 | waveform_picker_regs->data_shaping = | |
709 | ( (data_shaping & 0x10) >> 4 ) // BW |
|
711 | ( (data_shaping & 0x10) >> 4 ) // BW | |
710 | + ( (data_shaping & 0x08) >> 2 ) // SP0 |
|
712 | + ( (data_shaping & 0x08) >> 2 ) // SP0 | |
711 | + ( (data_shaping & 0x04) ) // SP1 |
|
713 | + ( (data_shaping & 0x04) ) // SP1 | |
712 | + ( (data_shaping & 0x02) << 2 ) // R0 |
|
714 | + ( (data_shaping & 0x02) << 2 ) // R0 | |
713 | + ( (data_shaping & 0x01) << 4 ); // R1 |
|
715 | + ( (data_shaping & 0x01) << 4 ); // R1 | |
714 | #endif |
|
716 | #endif | |
715 | } |
|
717 | } | |
716 |
|
718 | |||
717 | char set_wfp_delta_snapshot() |
|
719 | char set_wfp_delta_snapshot() | |
718 | { |
|
720 | { | |
719 | char ret; |
|
721 | char ret; | |
720 | unsigned int delta_snapshot; |
|
722 | unsigned int delta_snapshot; | |
721 | ret = LFR_DEFAULT; |
|
723 | ret = LFR_DEFAULT; | |
722 |
|
724 | |||
723 | delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256 |
|
725 | delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256 | |
724 | + parameter_dump_packet.sy_lfr_n_swf_p[1]; |
|
726 | + parameter_dump_packet.sy_lfr_n_swf_p[1]; | |
725 |
|
727 | |||
726 | #ifdef GSA |
|
728 | #ifdef GSA | |
727 | #else |
|
729 | #else | |
728 | unsigned char aux = 0; |
|
730 | unsigned char aux = 0; | |
729 | if ( delta_snapshot < MIN_DELTA_SNAPSHOT ) |
|
731 | if ( delta_snapshot < MIN_DELTA_SNAPSHOT ) | |
730 | { |
|
732 | { | |
731 | aux = MIN_DELTA_SNAPSHOT; |
|
733 | aux = MIN_DELTA_SNAPSHOT; | |
732 | ret = LFR_DEFAULT; |
|
734 | ret = LFR_DEFAULT; | |
733 | } |
|
735 | } | |
734 | else |
|
736 | else | |
735 | { |
|
737 | { | |
736 | aux = delta_snapshot ; |
|
738 | aux = delta_snapshot ; | |
737 | ret = LFR_SUCCESSFUL; |
|
739 | ret = LFR_SUCCESSFUL; | |
738 | } |
|
740 | } | |
739 | waveform_picker_regs->delta_snapshot = aux; // max 2 bytes |
|
741 | waveform_picker_regs->delta_snapshot = aux; // max 2 bytes | |
740 | #endif |
|
742 | #endif | |
741 |
|
743 | |||
742 | return ret; |
|
744 | return ret; | |
743 | } |
|
745 | } | |
744 |
|
746 | |||
745 | void set_wfp_burst_enable_register( unsigned char mode) |
|
747 | void set_wfp_burst_enable_register( unsigned char mode) | |
746 | { |
|
748 | { | |
747 | #ifdef GSA |
|
749 | #ifdef GSA | |
748 | #else |
|
750 | #else | |
749 | // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0 |
|
751 | // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0 | |
750 | // the burst bits shall be set first, before the enable bits |
|
752 | // the burst bits shall be set first, before the enable bits | |
751 | switch(mode) { |
|
753 | switch(mode) { | |
752 | case(LFR_MODE_NORMAL): |
|
754 | case(LFR_MODE_NORMAL): | |
753 | waveform_picker_regs->burst_enable = 0x00; // [0000 0000] no burst enable |
|
755 | waveform_picker_regs->burst_enable = 0x00; // [0000 0000] no burst enable | |
754 | waveform_picker_regs->burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0 |
|
756 | waveform_picker_regs->burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0 | |
755 | break; |
|
757 | break; | |
756 | case(LFR_MODE_BURST): |
|
758 | case(LFR_MODE_BURST): | |
757 | waveform_picker_regs->burst_enable = 0x40; // [0100 0000] f2 burst enabled |
|
759 | waveform_picker_regs->burst_enable = 0x40; // [0100 0000] f2 burst enabled | |
758 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x04; // [0100] enable f2 |
|
760 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x04; // [0100] enable f2 | |
759 | break; |
|
761 | break; | |
760 | case(LFR_MODE_SBM1): |
|
762 | case(LFR_MODE_SBM1): | |
761 | waveform_picker_regs->burst_enable = 0x20; // [0010 0000] f1 burst enabled |
|
763 | waveform_picker_regs->burst_enable = 0x20; // [0010 0000] f1 burst enabled | |
762 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 |
|
764 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 | |
763 | break; |
|
765 | break; | |
764 | case(LFR_MODE_SBM2): |
|
766 | case(LFR_MODE_SBM2): | |
765 | waveform_picker_regs->burst_enable = 0x40; // [0100 0000] f2 burst enabled |
|
767 | waveform_picker_regs->burst_enable = 0x40; // [0100 0000] f2 burst enabled | |
766 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 |
|
768 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 | |
767 | break; |
|
769 | break; | |
768 | default: |
|
770 | default: | |
769 | waveform_picker_regs->burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled |
|
771 | waveform_picker_regs->burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled | |
770 | break; |
|
772 | break; | |
771 | } |
|
773 | } | |
772 | #endif |
|
774 | #endif | |
773 | } |
|
775 | } | |
774 |
|
776 | |||
775 | void reset_wfp_burst_enable() |
|
777 | void reset_wfp_burst_enable() | |
776 | { |
|
778 | { | |
777 | #ifdef GSA |
|
779 | #ifdef GSA | |
778 | #else |
|
780 | #else | |
779 | waveform_picker_regs->burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 |
|
781 | waveform_picker_regs->burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 | |
780 | #endif |
|
782 | #endif | |
781 | } |
|
783 | } | |
782 |
|
784 | |||
783 | void reset_wfp_status() |
|
785 | void reset_wfp_status() | |
784 | { |
|
786 | { | |
785 | #ifdef GSA |
|
787 | #ifdef GSA | |
786 | #else |
|
788 | #else | |
787 | waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 |
|
789 | waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 | |
788 | #endif |
|
790 | #endif | |
789 | } |
|
791 | } | |
790 |
|
792 | |||
791 | void reset_waveform_picker_regs() |
|
793 | void reset_waveform_picker_regs() | |
792 | { |
|
794 | { | |
793 | #ifdef GSA |
|
795 | #ifdef GSA | |
794 | #else |
|
796 | #else | |
795 | set_wfp_data_shaping(); |
|
797 | set_wfp_data_shaping(); | |
796 | reset_wfp_burst_enable(); |
|
798 | reset_wfp_burst_enable(); | |
797 | waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0); // |
|
799 | waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0); // | |
798 | waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1); // |
|
800 | waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1); // | |
799 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); // |
|
801 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); // | |
800 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3); // |
|
802 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3); // | |
801 | set_wfp_delta_snapshot(); // time in seconds between two snapshots |
|
803 | set_wfp_delta_snapshot(); // time in seconds between two snapshots | |
802 | waveform_picker_regs->delta_f2_f1 = 0xffff; // 0x16800 => 92160 (max 4 bytes) |
|
804 | waveform_picker_regs->delta_f2_f1 = 0xffff; // 0x16800 => 92160 (max 4 bytes) | |
803 | waveform_picker_regs->delta_f2_f0 = 0x17c00; // 97 280 (max 5 bytes) |
|
805 | waveform_picker_regs->delta_f2_f0 = 0x17c00; // 97 280 (max 5 bytes) | |
804 | waveform_picker_regs->nb_burst_available = 0x180; // max 3 bytes, size of the buffer in burst (1 burst = 16 x 4 octets) |
|
806 | waveform_picker_regs->nb_burst_available = 0x180; // max 3 bytes, size of the buffer in burst (1 burst = 16 x 4 octets) | |
805 | waveform_picker_regs->nb_snapshot_param = 0x7ff; // max 3 octets, 2048 - 1 |
|
807 | waveform_picker_regs->nb_snapshot_param = 0x7ff; // max 3 octets, 2048 - 1 | |
806 | waveform_picker_regs->status = 0x00; // |
|
808 | waveform_picker_regs->status = 0x00; // | |
807 | #endif |
|
809 | #endif | |
808 | } |
|
810 | } | |
809 |
|
811 | |||
810 | //***************** |
|
812 | //***************** | |
811 | // local parameters |
|
813 | // local parameters | |
812 | void set_local_sbm1_nb_cwf_max() |
|
814 | void set_local_sbm1_nb_cwf_max() | |
813 | { |
|
815 | { | |
814 | // (2 snapshots of 2048 points per seconds) * (period of the NORM snashots) - 8 s (duration of the f2 snapshot) |
|
816 | // (2 snapshots of 2048 points per seconds) * (period of the NORM snashots) - 8 s (duration of the f2 snapshot) | |
815 | param_local.local_sbm1_nb_cwf_max = 2 * |
|
817 | param_local.local_sbm1_nb_cwf_max = 2 * | |
816 | (parameter_dump_packet.sy_lfr_n_swf_p[0] * 256 |
|
818 | (parameter_dump_packet.sy_lfr_n_swf_p[0] * 256 | |
817 | + parameter_dump_packet.sy_lfr_n_swf_p[1]) - 8; // 16 CWF1 parts during 1 SWF2 |
|
819 | + parameter_dump_packet.sy_lfr_n_swf_p[1]) - 8; // 16 CWF1 parts during 1 SWF2 | |
818 | } |
|
820 | } | |
819 |
|
821 | |||
820 | void set_local_sbm2_nb_cwf_max() |
|
822 | void set_local_sbm2_nb_cwf_max() | |
821 | { |
|
823 | { | |
822 | // (period of the NORM snashots) / (8 seconds per snapshot at f2 = 256 Hz) |
|
824 | // (period of the NORM snashots) / (8 seconds per snapshot at f2 = 256 Hz) | |
823 | param_local.local_sbm2_nb_cwf_max = (parameter_dump_packet.sy_lfr_n_swf_p[0] * 256 |
|
825 | param_local.local_sbm2_nb_cwf_max = (parameter_dump_packet.sy_lfr_n_swf_p[0] * 256 | |
824 | + parameter_dump_packet.sy_lfr_n_swf_p[1]) / 8; |
|
826 | + parameter_dump_packet.sy_lfr_n_swf_p[1]) / 8; | |
825 | } |
|
827 | } | |
826 |
|
828 | |||
827 | void set_local_nb_interrupt_f0_MAX() |
|
829 | void set_local_nb_interrupt_f0_MAX() | |
828 | { |
|
830 | { | |
829 | param_local.local_nb_interrupt_f0_MAX = ( (parameter_dump_packet.sy_lfr_n_asm_p[0]) * 256 |
|
831 | param_local.local_nb_interrupt_f0_MAX = ( (parameter_dump_packet.sy_lfr_n_asm_p[0]) * 256 | |
830 | + parameter_dump_packet.sy_lfr_n_asm_p[1] ) * 100; |
|
832 | + parameter_dump_packet.sy_lfr_n_asm_p[1] ) * 100; | |
831 | } |
|
833 | } | |
832 |
|
834 | |||
833 | void reset_local_sbm1_nb_cwf_sent() |
|
835 | void reset_local_sbm1_nb_cwf_sent() | |
834 | { |
|
836 | { | |
835 | param_local.local_sbm1_nb_cwf_sent = 0; |
|
837 | param_local.local_sbm1_nb_cwf_sent = 0; | |
836 | } |
|
838 | } | |
837 |
|
839 | |||
838 | void reset_local_sbm2_nb_cwf_sent() |
|
840 | void reset_local_sbm2_nb_cwf_sent() | |
839 | { |
|
841 | { | |
840 | param_local.local_sbm2_nb_cwf_sent = 0; |
|
842 | param_local.local_sbm2_nb_cwf_sent = 0; | |
841 | } |
|
843 | } |
General Comments 0
You need to be logged in to leave comments.
Login now