@@ -1,273 +1,273 | |||||
1 | ############################################################################# |
|
1 | ############################################################################# | |
2 | # Makefile for building: bin/fsw |
|
2 | # Makefile for building: bin/fsw | |
3 |
# Generated by qmake (2.01a) (Qt 4.8.6) on: |
|
3 | # Generated by qmake (2.01a) (Qt 4.8.6) on: Wed Sep 24 11:10:53 2014 | |
4 | # Project: fsw-qt.pro |
|
4 | # Project: fsw-qt.pro | |
5 | # Template: app |
|
5 | # Template: app | |
6 | # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro |
|
6 | # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro | |
7 | ############################################################################# |
|
7 | ############################################################################# | |
8 |
|
8 | |||
9 | ####### Compiler, tools and options |
|
9 | ####### Compiler, tools and options | |
10 |
|
10 | |||
11 | CC = sparc-rtems-gcc |
|
11 | CC = sparc-rtems-gcc | |
12 | CXX = sparc-rtems-g++ |
|
12 | CXX = sparc-rtems-g++ | |
13 |
DEFINES = -DSW_VERSION_N1=2 -DSW_VERSION_N2=0 -DSW_VERSION_N3=1 -DSW_VERSION_N4= |
|
13 | DEFINES = -DSW_VERSION_N1=2 -DSW_VERSION_N2=0 -DSW_VERSION_N3=1 -DSW_VERSION_N4=1 -DPRINT_MESSAGES_ON_CONSOLE | |
14 | CFLAGS = -pipe -O3 -Wall $(DEFINES) |
|
14 | CFLAGS = -pipe -O3 -Wall $(DEFINES) | |
15 | CXXFLAGS = -pipe -O3 -Wall $(DEFINES) |
|
15 | CXXFLAGS = -pipe -O3 -Wall $(DEFINES) | |
16 | INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header -I../header/processing -I../src/LFR_basic-parameters |
|
16 | INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header -I../header/processing -I../src/LFR_basic-parameters | |
17 | LINK = sparc-rtems-g++ |
|
17 | LINK = sparc-rtems-g++ | |
18 | LFLAGS = |
|
18 | LFLAGS = | |
19 | LIBS = $(SUBLIBS) |
|
19 | LIBS = $(SUBLIBS) | |
20 | AR = sparc-rtems-ar rcs |
|
20 | AR = sparc-rtems-ar rcs | |
21 | RANLIB = |
|
21 | RANLIB = | |
22 | QMAKE = /usr/bin/qmake-qt4 |
|
22 | QMAKE = /usr/bin/qmake-qt4 | |
23 | TAR = tar -cf |
|
23 | TAR = tar -cf | |
24 | COMPRESS = gzip -9f |
|
24 | COMPRESS = gzip -9f | |
25 | COPY = cp -f |
|
25 | COPY = cp -f | |
26 | SED = sed |
|
26 | SED = sed | |
27 | COPY_FILE = $(COPY) |
|
27 | COPY_FILE = $(COPY) | |
28 | COPY_DIR = $(COPY) -r |
|
28 | COPY_DIR = $(COPY) -r | |
29 | STRIP = sparc-rtems-strip |
|
29 | STRIP = sparc-rtems-strip | |
30 | INSTALL_FILE = install -m 644 -p |
|
30 | INSTALL_FILE = install -m 644 -p | |
31 | INSTALL_DIR = $(COPY_DIR) |
|
31 | INSTALL_DIR = $(COPY_DIR) | |
32 | INSTALL_PROGRAM = install -m 755 -p |
|
32 | INSTALL_PROGRAM = install -m 755 -p | |
33 | DEL_FILE = rm -f |
|
33 | DEL_FILE = rm -f | |
34 | SYMLINK = ln -f -s |
|
34 | SYMLINK = ln -f -s | |
35 | DEL_DIR = rmdir |
|
35 | DEL_DIR = rmdir | |
36 | MOVE = mv -f |
|
36 | MOVE = mv -f | |
37 | CHK_DIR_EXISTS= test -d |
|
37 | CHK_DIR_EXISTS= test -d | |
38 | MKDIR = mkdir -p |
|
38 | MKDIR = mkdir -p | |
39 |
|
39 | |||
40 | ####### Output directory |
|
40 | ####### Output directory | |
41 |
|
41 | |||
42 | OBJECTS_DIR = obj/ |
|
42 | OBJECTS_DIR = obj/ | |
43 |
|
43 | |||
44 | ####### Files |
|
44 | ####### Files | |
45 |
|
45 | |||
46 | SOURCES = ../src/wf_handler.c \ |
|
46 | SOURCES = ../src/wf_handler.c \ | |
47 | ../src/tc_handler.c \ |
|
47 | ../src/tc_handler.c \ | |
48 | ../src/fsw_misc.c \ |
|
48 | ../src/fsw_misc.c \ | |
49 | ../src/fsw_init.c \ |
|
49 | ../src/fsw_init.c \ | |
50 | ../src/fsw_globals.c \ |
|
50 | ../src/fsw_globals.c \ | |
51 | ../src/fsw_spacewire.c \ |
|
51 | ../src/fsw_spacewire.c \ | |
52 | ../src/tc_load_dump_parameters.c \ |
|
52 | ../src/tc_load_dump_parameters.c \ | |
53 | ../src/tm_lfr_tc_exe.c \ |
|
53 | ../src/tm_lfr_tc_exe.c \ | |
54 | ../src/tc_acceptance.c \ |
|
54 | ../src/tc_acceptance.c \ | |
55 | ../src/processing/fsw_processing.c \ |
|
55 | ../src/processing/fsw_processing.c \ | |
56 | ../src/processing/avf0_prc0.c \ |
|
56 | ../src/processing/avf0_prc0.c \ | |
57 | ../src/processing/avf1_prc1.c \ |
|
57 | ../src/processing/avf1_prc1.c \ | |
58 | ../src/processing/avf2_prc2.c \ |
|
58 | ../src/processing/avf2_prc2.c \ | |
59 | ../src/lfr_cpu_usage_report.c \ |
|
59 | ../src/lfr_cpu_usage_report.c \ | |
60 | ../src/LFR_basic-parameters/basic_parameters.c |
|
60 | ../src/LFR_basic-parameters/basic_parameters.c | |
61 | OBJECTS = obj/wf_handler.o \ |
|
61 | OBJECTS = obj/wf_handler.o \ | |
62 | obj/tc_handler.o \ |
|
62 | obj/tc_handler.o \ | |
63 | obj/fsw_misc.o \ |
|
63 | obj/fsw_misc.o \ | |
64 | obj/fsw_init.o \ |
|
64 | obj/fsw_init.o \ | |
65 | obj/fsw_globals.o \ |
|
65 | obj/fsw_globals.o \ | |
66 | obj/fsw_spacewire.o \ |
|
66 | obj/fsw_spacewire.o \ | |
67 | obj/tc_load_dump_parameters.o \ |
|
67 | obj/tc_load_dump_parameters.o \ | |
68 | obj/tm_lfr_tc_exe.o \ |
|
68 | obj/tm_lfr_tc_exe.o \ | |
69 | obj/tc_acceptance.o \ |
|
69 | obj/tc_acceptance.o \ | |
70 | obj/fsw_processing.o \ |
|
70 | obj/fsw_processing.o \ | |
71 | obj/avf0_prc0.o \ |
|
71 | obj/avf0_prc0.o \ | |
72 | obj/avf1_prc1.o \ |
|
72 | obj/avf1_prc1.o \ | |
73 | obj/avf2_prc2.o \ |
|
73 | obj/avf2_prc2.o \ | |
74 | obj/lfr_cpu_usage_report.o \ |
|
74 | obj/lfr_cpu_usage_report.o \ | |
75 | obj/basic_parameters.o |
|
75 | obj/basic_parameters.o | |
76 | DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \ |
|
76 | DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \ | |
77 | /usr/lib64/qt4/mkspecs/common/linux.conf \ |
|
77 | /usr/lib64/qt4/mkspecs/common/linux.conf \ | |
78 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ |
|
78 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ | |
79 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ |
|
79 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ | |
80 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ |
|
80 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ | |
81 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ |
|
81 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ | |
82 | /usr/lib64/qt4/mkspecs/qconfig.pri \ |
|
82 | /usr/lib64/qt4/mkspecs/qconfig.pri \ | |
83 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ |
|
83 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ | |
84 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ |
|
84 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ | |
85 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ |
|
85 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ | |
86 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ |
|
86 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ | |
87 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ |
|
87 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ | |
88 | sparc.pri \ |
|
88 | sparc.pri \ | |
89 | /usr/lib64/qt4/mkspecs/features/release.prf \ |
|
89 | /usr/lib64/qt4/mkspecs/features/release.prf \ | |
90 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ |
|
90 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ | |
91 | /usr/lib64/qt4/mkspecs/features/shared.prf \ |
|
91 | /usr/lib64/qt4/mkspecs/features/shared.prf \ | |
92 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ |
|
92 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ | |
93 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ |
|
93 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ | |
94 | /usr/lib64/qt4/mkspecs/features/resources.prf \ |
|
94 | /usr/lib64/qt4/mkspecs/features/resources.prf \ | |
95 | /usr/lib64/qt4/mkspecs/features/uic.prf \ |
|
95 | /usr/lib64/qt4/mkspecs/features/uic.prf \ | |
96 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ |
|
96 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ | |
97 | /usr/lib64/qt4/mkspecs/features/lex.prf \ |
|
97 | /usr/lib64/qt4/mkspecs/features/lex.prf \ | |
98 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \ |
|
98 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \ | |
99 | fsw-qt.pro |
|
99 | fsw-qt.pro | |
100 | QMAKE_TARGET = fsw |
|
100 | QMAKE_TARGET = fsw | |
101 | DESTDIR = bin/ |
|
101 | DESTDIR = bin/ | |
102 | TARGET = bin/fsw |
|
102 | TARGET = bin/fsw | |
103 |
|
103 | |||
104 | first: all |
|
104 | first: all | |
105 | ####### Implicit rules |
|
105 | ####### Implicit rules | |
106 |
|
106 | |||
107 | .SUFFIXES: .o .c .cpp .cc .cxx .C |
|
107 | .SUFFIXES: .o .c .cpp .cc .cxx .C | |
108 |
|
108 | |||
109 | .cpp.o: |
|
109 | .cpp.o: | |
110 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
110 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" | |
111 |
|
111 | |||
112 | .cc.o: |
|
112 | .cc.o: | |
113 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
113 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" | |
114 |
|
114 | |||
115 | .cxx.o: |
|
115 | .cxx.o: | |
116 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
116 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" | |
117 |
|
117 | |||
118 | .C.o: |
|
118 | .C.o: | |
119 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
119 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" | |
120 |
|
120 | |||
121 | .c.o: |
|
121 | .c.o: | |
122 | $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<" |
|
122 | $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<" | |
123 |
|
123 | |||
124 | ####### Build rules |
|
124 | ####### Build rules | |
125 |
|
125 | |||
126 | all: Makefile $(TARGET) |
|
126 | all: Makefile $(TARGET) | |
127 |
|
127 | |||
128 | $(TARGET): $(OBJECTS) |
|
128 | $(TARGET): $(OBJECTS) | |
129 | @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/ |
|
129 | @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/ | |
130 | $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) |
|
130 | $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) | |
131 |
|
131 | |||
132 | Makefile: fsw-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \ |
|
132 | Makefile: fsw-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \ | |
133 | /usr/lib64/qt4/mkspecs/common/linux.conf \ |
|
133 | /usr/lib64/qt4/mkspecs/common/linux.conf \ | |
134 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ |
|
134 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ | |
135 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ |
|
135 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ | |
136 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ |
|
136 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ | |
137 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ |
|
137 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ | |
138 | /usr/lib64/qt4/mkspecs/qconfig.pri \ |
|
138 | /usr/lib64/qt4/mkspecs/qconfig.pri \ | |
139 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ |
|
139 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ | |
140 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ |
|
140 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ | |
141 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ |
|
141 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ | |
142 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ |
|
142 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ | |
143 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ |
|
143 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ | |
144 | sparc.pri \ |
|
144 | sparc.pri \ | |
145 | /usr/lib64/qt4/mkspecs/features/release.prf \ |
|
145 | /usr/lib64/qt4/mkspecs/features/release.prf \ | |
146 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ |
|
146 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ | |
147 | /usr/lib64/qt4/mkspecs/features/shared.prf \ |
|
147 | /usr/lib64/qt4/mkspecs/features/shared.prf \ | |
148 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ |
|
148 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ | |
149 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ |
|
149 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ | |
150 | /usr/lib64/qt4/mkspecs/features/resources.prf \ |
|
150 | /usr/lib64/qt4/mkspecs/features/resources.prf \ | |
151 | /usr/lib64/qt4/mkspecs/features/uic.prf \ |
|
151 | /usr/lib64/qt4/mkspecs/features/uic.prf \ | |
152 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ |
|
152 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ | |
153 | /usr/lib64/qt4/mkspecs/features/lex.prf \ |
|
153 | /usr/lib64/qt4/mkspecs/features/lex.prf \ | |
154 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf |
|
154 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf | |
155 | $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro |
|
155 | $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro | |
156 | /usr/lib64/qt4/mkspecs/common/unix.conf: |
|
156 | /usr/lib64/qt4/mkspecs/common/unix.conf: | |
157 | /usr/lib64/qt4/mkspecs/common/linux.conf: |
|
157 | /usr/lib64/qt4/mkspecs/common/linux.conf: | |
158 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf: |
|
158 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf: | |
159 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf: |
|
159 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf: | |
160 | /usr/lib64/qt4/mkspecs/common/g++-base.conf: |
|
160 | /usr/lib64/qt4/mkspecs/common/g++-base.conf: | |
161 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf: |
|
161 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf: | |
162 | /usr/lib64/qt4/mkspecs/qconfig.pri: |
|
162 | /usr/lib64/qt4/mkspecs/qconfig.pri: | |
163 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri: |
|
163 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri: | |
164 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf: |
|
164 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf: | |
165 | /usr/lib64/qt4/mkspecs/features/qt_config.prf: |
|
165 | /usr/lib64/qt4/mkspecs/features/qt_config.prf: | |
166 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf: |
|
166 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf: | |
167 | /usr/lib64/qt4/mkspecs/features/default_pre.prf: |
|
167 | /usr/lib64/qt4/mkspecs/features/default_pre.prf: | |
168 | sparc.pri: |
|
168 | sparc.pri: | |
169 | /usr/lib64/qt4/mkspecs/features/release.prf: |
|
169 | /usr/lib64/qt4/mkspecs/features/release.prf: | |
170 | /usr/lib64/qt4/mkspecs/features/default_post.prf: |
|
170 | /usr/lib64/qt4/mkspecs/features/default_post.prf: | |
171 | /usr/lib64/qt4/mkspecs/features/shared.prf: |
|
171 | /usr/lib64/qt4/mkspecs/features/shared.prf: | |
172 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf: |
|
172 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf: | |
173 | /usr/lib64/qt4/mkspecs/features/warn_on.prf: |
|
173 | /usr/lib64/qt4/mkspecs/features/warn_on.prf: | |
174 | /usr/lib64/qt4/mkspecs/features/resources.prf: |
|
174 | /usr/lib64/qt4/mkspecs/features/resources.prf: | |
175 | /usr/lib64/qt4/mkspecs/features/uic.prf: |
|
175 | /usr/lib64/qt4/mkspecs/features/uic.prf: | |
176 | /usr/lib64/qt4/mkspecs/features/yacc.prf: |
|
176 | /usr/lib64/qt4/mkspecs/features/yacc.prf: | |
177 | /usr/lib64/qt4/mkspecs/features/lex.prf: |
|
177 | /usr/lib64/qt4/mkspecs/features/lex.prf: | |
178 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf: |
|
178 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf: | |
179 | qmake: FORCE |
|
179 | qmake: FORCE | |
180 | @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro |
|
180 | @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro | |
181 |
|
181 | |||
182 | dist: |
|
182 | dist: | |
183 | @$(CHK_DIR_EXISTS) obj/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0 |
|
183 | @$(CHK_DIR_EXISTS) obj/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0 | |
184 | $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/fsw1.0.0/ && (cd `dirname obj/fsw1.0.0` && $(TAR) fsw1.0.0.tar fsw1.0.0 && $(COMPRESS) fsw1.0.0.tar) && $(MOVE) `dirname obj/fsw1.0.0`/fsw1.0.0.tar.gz . && $(DEL_FILE) -r obj/fsw1.0.0 |
|
184 | $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/fsw1.0.0/ && (cd `dirname obj/fsw1.0.0` && $(TAR) fsw1.0.0.tar fsw1.0.0 && $(COMPRESS) fsw1.0.0.tar) && $(MOVE) `dirname obj/fsw1.0.0`/fsw1.0.0.tar.gz . && $(DEL_FILE) -r obj/fsw1.0.0 | |
185 |
|
185 | |||
186 |
|
186 | |||
187 | clean:compiler_clean |
|
187 | clean:compiler_clean | |
188 | -$(DEL_FILE) $(OBJECTS) |
|
188 | -$(DEL_FILE) $(OBJECTS) | |
189 | -$(DEL_FILE) *~ core *.core |
|
189 | -$(DEL_FILE) *~ core *.core | |
190 |
|
190 | |||
191 |
|
191 | |||
192 | ####### Sub-libraries |
|
192 | ####### Sub-libraries | |
193 |
|
193 | |||
194 | distclean: clean |
|
194 | distclean: clean | |
195 | -$(DEL_FILE) $(TARGET) |
|
195 | -$(DEL_FILE) $(TARGET) | |
196 | -$(DEL_FILE) Makefile |
|
196 | -$(DEL_FILE) Makefile | |
197 |
|
197 | |||
198 |
|
198 | |||
199 | grmon: |
|
199 | grmon: | |
200 | cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u |
|
200 | cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u | |
201 |
|
201 | |||
202 | check: first |
|
202 | check: first | |
203 |
|
203 | |||
204 | compiler_rcc_make_all: |
|
204 | compiler_rcc_make_all: | |
205 | compiler_rcc_clean: |
|
205 | compiler_rcc_clean: | |
206 | compiler_uic_make_all: |
|
206 | compiler_uic_make_all: | |
207 | compiler_uic_clean: |
|
207 | compiler_uic_clean: | |
208 | compiler_image_collection_make_all: qmake_image_collection.cpp |
|
208 | compiler_image_collection_make_all: qmake_image_collection.cpp | |
209 | compiler_image_collection_clean: |
|
209 | compiler_image_collection_clean: | |
210 | -$(DEL_FILE) qmake_image_collection.cpp |
|
210 | -$(DEL_FILE) qmake_image_collection.cpp | |
211 | compiler_yacc_decl_make_all: |
|
211 | compiler_yacc_decl_make_all: | |
212 | compiler_yacc_decl_clean: |
|
212 | compiler_yacc_decl_clean: | |
213 | compiler_yacc_impl_make_all: |
|
213 | compiler_yacc_impl_make_all: | |
214 | compiler_yacc_impl_clean: |
|
214 | compiler_yacc_impl_clean: | |
215 | compiler_lex_make_all: |
|
215 | compiler_lex_make_all: | |
216 | compiler_lex_clean: |
|
216 | compiler_lex_clean: | |
217 | compiler_clean: |
|
217 | compiler_clean: | |
218 |
|
218 | |||
219 | ####### Compile |
|
219 | ####### Compile | |
220 |
|
220 | |||
221 | obj/wf_handler.o: ../src/wf_handler.c |
|
221 | obj/wf_handler.o: ../src/wf_handler.c | |
222 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/wf_handler.o ../src/wf_handler.c |
|
222 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/wf_handler.o ../src/wf_handler.c | |
223 |
|
223 | |||
224 | obj/tc_handler.o: ../src/tc_handler.c |
|
224 | obj/tc_handler.o: ../src/tc_handler.c | |
225 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o ../src/tc_handler.c |
|
225 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o ../src/tc_handler.c | |
226 |
|
226 | |||
227 | obj/fsw_misc.o: ../src/fsw_misc.c |
|
227 | obj/fsw_misc.o: ../src/fsw_misc.c | |
228 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c |
|
228 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c | |
229 |
|
229 | |||
230 | obj/fsw_init.o: ../src/fsw_init.c ../src/fsw_config.c |
|
230 | obj/fsw_init.o: ../src/fsw_init.c ../src/fsw_config.c | |
231 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o ../src/fsw_init.c |
|
231 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o ../src/fsw_init.c | |
232 |
|
232 | |||
233 | obj/fsw_globals.o: ../src/fsw_globals.c |
|
233 | obj/fsw_globals.o: ../src/fsw_globals.c | |
234 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c |
|
234 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c | |
235 |
|
235 | |||
236 | obj/fsw_spacewire.o: ../src/fsw_spacewire.c |
|
236 | obj/fsw_spacewire.o: ../src/fsw_spacewire.c | |
237 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spacewire.o ../src/fsw_spacewire.c |
|
237 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spacewire.o ../src/fsw_spacewire.c | |
238 |
|
238 | |||
239 | obj/tc_load_dump_parameters.o: ../src/tc_load_dump_parameters.c |
|
239 | obj/tc_load_dump_parameters.o: ../src/tc_load_dump_parameters.c | |
240 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_load_dump_parameters.o ../src/tc_load_dump_parameters.c |
|
240 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_load_dump_parameters.o ../src/tc_load_dump_parameters.c | |
241 |
|
241 | |||
242 | obj/tm_lfr_tc_exe.o: ../src/tm_lfr_tc_exe.c |
|
242 | obj/tm_lfr_tc_exe.o: ../src/tm_lfr_tc_exe.c | |
243 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tm_lfr_tc_exe.o ../src/tm_lfr_tc_exe.c |
|
243 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tm_lfr_tc_exe.o ../src/tm_lfr_tc_exe.c | |
244 |
|
244 | |||
245 | obj/tc_acceptance.o: ../src/tc_acceptance.c |
|
245 | obj/tc_acceptance.o: ../src/tc_acceptance.c | |
246 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_acceptance.o ../src/tc_acceptance.c |
|
246 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_acceptance.o ../src/tc_acceptance.c | |
247 |
|
247 | |||
248 | obj/fsw_processing.o: ../src/processing/fsw_processing.c |
|
248 | obj/fsw_processing.o: ../src/processing/fsw_processing.c | |
249 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/processing/fsw_processing.c |
|
249 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/processing/fsw_processing.c | |
250 |
|
250 | |||
251 | obj/avf0_prc0.o: ../src/processing/avf0_prc0.c |
|
251 | obj/avf0_prc0.o: ../src/processing/avf0_prc0.c | |
252 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf0_prc0.o ../src/processing/avf0_prc0.c |
|
252 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf0_prc0.o ../src/processing/avf0_prc0.c | |
253 |
|
253 | |||
254 | obj/avf1_prc1.o: ../src/processing/avf1_prc1.c |
|
254 | obj/avf1_prc1.o: ../src/processing/avf1_prc1.c | |
255 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf1_prc1.o ../src/processing/avf1_prc1.c |
|
255 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf1_prc1.o ../src/processing/avf1_prc1.c | |
256 |
|
256 | |||
257 | obj/avf2_prc2.o: ../src/processing/avf2_prc2.c |
|
257 | obj/avf2_prc2.o: ../src/processing/avf2_prc2.c | |
258 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf2_prc2.o ../src/processing/avf2_prc2.c |
|
258 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf2_prc2.o ../src/processing/avf2_prc2.c | |
259 |
|
259 | |||
260 | obj/lfr_cpu_usage_report.o: ../src/lfr_cpu_usage_report.c |
|
260 | obj/lfr_cpu_usage_report.o: ../src/lfr_cpu_usage_report.c | |
261 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/lfr_cpu_usage_report.o ../src/lfr_cpu_usage_report.c |
|
261 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/lfr_cpu_usage_report.o ../src/lfr_cpu_usage_report.c | |
262 |
|
262 | |||
263 | obj/basic_parameters.o: ../src/LFR_basic-parameters/basic_parameters.c |
|
263 | obj/basic_parameters.o: ../src/LFR_basic-parameters/basic_parameters.c | |
264 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/basic_parameters.o ../src/LFR_basic-parameters/basic_parameters.c |
|
264 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/basic_parameters.o ../src/LFR_basic-parameters/basic_parameters.c | |
265 |
|
265 | |||
266 | ####### Install |
|
266 | ####### Install | |
267 |
|
267 | |||
268 | install: FORCE |
|
268 | install: FORCE | |
269 |
|
269 | |||
270 | uninstall: FORCE |
|
270 | uninstall: FORCE | |
271 |
|
271 | |||
272 | FORCE: |
|
272 | FORCE: | |
273 |
|
273 |
@@ -1,95 +1,95 | |||||
1 | TEMPLATE = app |
|
1 | TEMPLATE = app | |
2 | # CONFIG += console v8 sim |
|
2 | # CONFIG += console v8 sim | |
3 | # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** vhdl_dev *** debug_tch |
|
3 | # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** vhdl_dev *** debug_tch | |
4 | CONFIG += console verbose |
|
4 | CONFIG += console verbose | |
5 | CONFIG -= qt |
|
5 | CONFIG -= qt | |
6 |
|
6 | |||
7 | include(./sparc.pri) |
|
7 | include(./sparc.pri) | |
8 |
|
8 | |||
9 | # flight software version |
|
9 | # flight software version | |
10 | SWVERSION=-1-0 |
|
10 | SWVERSION=-1-0 | |
11 | DEFINES += SW_VERSION_N1=2 # major |
|
11 | DEFINES += SW_VERSION_N1=2 # major | |
12 | DEFINES += SW_VERSION_N2=0 # minor |
|
12 | DEFINES += SW_VERSION_N2=0 # minor | |
13 | DEFINES += SW_VERSION_N3=1 # patch |
|
13 | DEFINES += SW_VERSION_N3=1 # patch | |
14 |
DEFINES += SW_VERSION_N4= |
|
14 | DEFINES += SW_VERSION_N4=1 # internal | |
15 |
|
15 | |||
16 | contains( CONFIG, debug_tch ) { |
|
16 | contains( CONFIG, debug_tch ) { | |
17 | DEFINES += DEBUG_TCH |
|
17 | DEFINES += DEBUG_TCH | |
18 | } |
|
18 | } | |
19 |
|
19 | |||
20 | contains( CONFIG, vhdl_dev ) { |
|
20 | contains( CONFIG, vhdl_dev ) { | |
21 | DEFINES += VHDL_DEV |
|
21 | DEFINES += VHDL_DEV | |
22 | } |
|
22 | } | |
23 |
|
23 | |||
24 | contains( CONFIG, verbose ) { |
|
24 | contains( CONFIG, verbose ) { | |
25 | DEFINES += PRINT_MESSAGES_ON_CONSOLE |
|
25 | DEFINES += PRINT_MESSAGES_ON_CONSOLE | |
26 | } |
|
26 | } | |
27 |
|
27 | |||
28 | contains( CONFIG, debug_messages ) { |
|
28 | contains( CONFIG, debug_messages ) { | |
29 | DEFINES += DEBUG_MESSAGES |
|
29 | DEFINES += DEBUG_MESSAGES | |
30 | } |
|
30 | } | |
31 |
|
31 | |||
32 | contains( CONFIG, cpu_usage_report ) { |
|
32 | contains( CONFIG, cpu_usage_report ) { | |
33 | DEFINES += PRINT_TASK_STATISTICS |
|
33 | DEFINES += PRINT_TASK_STATISTICS | |
34 | } |
|
34 | } | |
35 |
|
35 | |||
36 | contains( CONFIG, stack_report ) { |
|
36 | contains( CONFIG, stack_report ) { | |
37 | DEFINES += PRINT_STACK_REPORT |
|
37 | DEFINES += PRINT_STACK_REPORT | |
38 | } |
|
38 | } | |
39 |
|
39 | |||
40 | contains( CONFIG, boot_messages ) { |
|
40 | contains( CONFIG, boot_messages ) { | |
41 | DEFINES += BOOT_MESSAGES |
|
41 | DEFINES += BOOT_MESSAGES | |
42 | } |
|
42 | } | |
43 |
|
43 | |||
44 | #doxygen.target = doxygen |
|
44 | #doxygen.target = doxygen | |
45 | #doxygen.commands = doxygen ../doc/Doxyfile |
|
45 | #doxygen.commands = doxygen ../doc/Doxyfile | |
46 | #QMAKE_EXTRA_TARGETS += doxygen |
|
46 | #QMAKE_EXTRA_TARGETS += doxygen | |
47 |
|
47 | |||
48 | TARGET = fsw |
|
48 | TARGET = fsw | |
49 |
|
49 | |||
50 | INCLUDEPATH += \ |
|
50 | INCLUDEPATH += \ | |
51 | ../src \ |
|
51 | ../src \ | |
52 | ../header \ |
|
52 | ../header \ | |
53 | ../header/processing \ |
|
53 | ../header/processing \ | |
54 | ../src/LFR_basic-parameters |
|
54 | ../src/LFR_basic-parameters | |
55 |
|
55 | |||
56 | SOURCES += \ |
|
56 | SOURCES += \ | |
57 | ../src/wf_handler.c \ |
|
57 | ../src/wf_handler.c \ | |
58 | ../src/tc_handler.c \ |
|
58 | ../src/tc_handler.c \ | |
59 | ../src/fsw_misc.c \ |
|
59 | ../src/fsw_misc.c \ | |
60 | ../src/fsw_init.c \ |
|
60 | ../src/fsw_init.c \ | |
61 | ../src/fsw_globals.c \ |
|
61 | ../src/fsw_globals.c \ | |
62 | ../src/fsw_spacewire.c \ |
|
62 | ../src/fsw_spacewire.c \ | |
63 | ../src/tc_load_dump_parameters.c \ |
|
63 | ../src/tc_load_dump_parameters.c \ | |
64 | ../src/tm_lfr_tc_exe.c \ |
|
64 | ../src/tm_lfr_tc_exe.c \ | |
65 | ../src/tc_acceptance.c \ |
|
65 | ../src/tc_acceptance.c \ | |
66 | ../src/processing/fsw_processing.c \ |
|
66 | ../src/processing/fsw_processing.c \ | |
67 | ../src/processing/avf0_prc0.c \ |
|
67 | ../src/processing/avf0_prc0.c \ | |
68 | ../src/processing/avf1_prc1.c \ |
|
68 | ../src/processing/avf1_prc1.c \ | |
69 | ../src/processing/avf2_prc2.c \ |
|
69 | ../src/processing/avf2_prc2.c \ | |
70 | ../src/lfr_cpu_usage_report.c \ |
|
70 | ../src/lfr_cpu_usage_report.c \ | |
71 | ../src/LFR_basic-parameters/basic_parameters.c |
|
71 | ../src/LFR_basic-parameters/basic_parameters.c | |
72 |
|
72 | |||
73 | HEADERS += \ |
|
73 | HEADERS += \ | |
74 | ../header/wf_handler.h \ |
|
74 | ../header/wf_handler.h \ | |
75 | ../header/tc_handler.h \ |
|
75 | ../header/tc_handler.h \ | |
76 | ../header/grlib_regs.h \ |
|
76 | ../header/grlib_regs.h \ | |
77 | ../header/fsw_params.h \ |
|
77 | ../header/fsw_params.h \ | |
78 | ../header/fsw_misc.h \ |
|
78 | ../header/fsw_misc.h \ | |
79 | ../header/fsw_init.h \ |
|
79 | ../header/fsw_init.h \ | |
80 | ../header/ccsds_types.h \ |
|
80 | ../header/ccsds_types.h \ | |
81 | ../header/fsw_spacewire.h \ |
|
81 | ../header/fsw_spacewire.h \ | |
82 | ../header/tc_load_dump_parameters.h \ |
|
82 | ../header/tc_load_dump_parameters.h \ | |
83 | ../header/tm_lfr_tc_exe.h \ |
|
83 | ../header/tm_lfr_tc_exe.h \ | |
84 | ../header/tc_acceptance.h \ |
|
84 | ../header/tc_acceptance.h \ | |
85 | ../header/fsw_params_nb_bytes.h \ |
|
85 | ../header/fsw_params_nb_bytes.h \ | |
86 | ../header/fsw_params_processing.h \ |
|
86 | ../header/fsw_params_processing.h \ | |
87 | ../header/processing/fsw_processing.h \ |
|
87 | ../header/processing/fsw_processing.h \ | |
88 | ../header/processing/avf0_prc0.h \ |
|
88 | ../header/processing/avf0_prc0.h \ | |
89 | ../header/processing/avf1_prc1.h \ |
|
89 | ../header/processing/avf1_prc1.h \ | |
90 | ../header/processing/avf2_prc2.h \ |
|
90 | ../header/processing/avf2_prc2.h \ | |
91 | ../header/fsw_params_wf_handler.h \ |
|
91 | ../header/fsw_params_wf_handler.h \ | |
92 | ../header/lfr_cpu_usage_report.h \ |
|
92 | ../header/lfr_cpu_usage_report.h \ | |
93 | ../src/LFR_basic-parameters/basic_parameters.h \ |
|
93 | ../src/LFR_basic-parameters/basic_parameters.h \ | |
94 | ../src/LFR_basic-parameters/basic_parameters_params.h |
|
94 | ../src/LFR_basic-parameters/basic_parameters_params.h | |
95 |
|
95 |
@@ -1,201 +1,208 | |||||
1 | <?xml version="1.0" encoding="UTF-8"?> |
|
1 | <?xml version="1.0" encoding="UTF-8"?> | |
2 | <!DOCTYPE QtCreatorProject> |
|
2 | <!DOCTYPE QtCreatorProject> | |
3 |
<!-- Written by QtCreator 3. |
|
3 | <!-- Written by QtCreator 3.2.0, 2014-09-23T16:34:13. --> | |
4 | <qtcreator> |
|
4 | <qtcreator> | |
5 | <data> |
|
5 | <data> | |
|
6 | <variable>EnvironmentId</variable> | |||
|
7 | <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value> | |||
|
8 | </data> | |||
|
9 | <data> | |||
6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
|
10 | <variable>ProjectExplorer.Project.ActiveTarget</variable> | |
7 | <value type="int">0</value> |
|
11 | <value type="int">0</value> | |
8 | </data> |
|
12 | </data> | |
9 | <data> |
|
13 | <data> | |
10 | <variable>ProjectExplorer.Project.EditorSettings</variable> |
|
14 | <variable>ProjectExplorer.Project.EditorSettings</variable> | |
11 | <valuemap type="QVariantMap"> |
|
15 | <valuemap type="QVariantMap"> | |
12 | <value type="bool" key="EditorConfiguration.AutoIndent">true</value> |
|
16 | <value type="bool" key="EditorConfiguration.AutoIndent">true</value> | |
13 | <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value> |
|
17 | <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value> | |
14 | <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value> |
|
18 | <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value> | |
15 | <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0"> |
|
19 | <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0"> | |
16 | <value type="QString" key="language">Cpp</value> |
|
20 | <value type="QString" key="language">Cpp</value> | |
17 | <valuemap type="QVariantMap" key="value"> |
|
21 | <valuemap type="QVariantMap" key="value"> | |
18 | <value type="QByteArray" key="CurrentPreferences">CppGlobal</value> |
|
22 | <value type="QByteArray" key="CurrentPreferences">CppGlobal</value> | |
19 | </valuemap> |
|
23 | </valuemap> | |
20 | </valuemap> |
|
24 | </valuemap> | |
21 | <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1"> |
|
25 | <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1"> | |
22 | <value type="QString" key="language">QmlJS</value> |
|
26 | <value type="QString" key="language">QmlJS</value> | |
23 | <valuemap type="QVariantMap" key="value"> |
|
27 | <valuemap type="QVariantMap" key="value"> | |
24 | <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value> |
|
28 | <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value> | |
25 | </valuemap> |
|
29 | </valuemap> | |
26 | </valuemap> |
|
30 | </valuemap> | |
27 | <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value> |
|
31 | <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value> | |
28 | <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value> |
|
32 | <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value> | |
29 | <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value> |
|
33 | <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value> | |
30 | <value type="int" key="EditorConfiguration.IndentSize">4</value> |
|
34 | <value type="int" key="EditorConfiguration.IndentSize">4</value> | |
31 | <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value> |
|
35 | <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value> | |
|
36 | <value type="int" key="EditorConfiguration.MarginColumn">80</value> | |||
|
37 | <value type="bool" key="EditorConfiguration.MouseHiding">true</value> | |||
32 | <value type="bool" key="EditorConfiguration.MouseNavigation">true</value> |
|
38 | <value type="bool" key="EditorConfiguration.MouseNavigation">true</value> | |
33 | <value type="int" key="EditorConfiguration.PaddingMode">1</value> |
|
39 | <value type="int" key="EditorConfiguration.PaddingMode">1</value> | |
34 | <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value> |
|
40 | <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value> | |
|
41 | <value type="bool" key="EditorConfiguration.ShowMargin">false</value> | |||
35 | <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value> |
|
42 | <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value> | |
36 | <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value> |
|
43 | <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value> | |
37 | <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value> |
|
44 | <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value> | |
38 | <value type="int" key="EditorConfiguration.TabSize">8</value> |
|
45 | <value type="int" key="EditorConfiguration.TabSize">8</value> | |
39 | <value type="bool" key="EditorConfiguration.UseGlobal">true</value> |
|
46 | <value type="bool" key="EditorConfiguration.UseGlobal">true</value> | |
40 | <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value> |
|
47 | <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value> | |
41 | <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value> |
|
48 | <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value> | |
42 | <value type="bool" key="EditorConfiguration.cleanIndentation">true</value> |
|
49 | <value type="bool" key="EditorConfiguration.cleanIndentation">true</value> | |
43 | <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value> |
|
50 | <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value> | |
44 | <value type="bool" key="EditorConfiguration.inEntireDocument">false</value> |
|
51 | <value type="bool" key="EditorConfiguration.inEntireDocument">false</value> | |
45 | </valuemap> |
|
52 | </valuemap> | |
46 | </data> |
|
53 | </data> | |
47 | <data> |
|
54 | <data> | |
48 | <variable>ProjectExplorer.Project.PluginSettings</variable> |
|
55 | <variable>ProjectExplorer.Project.PluginSettings</variable> | |
49 | <valuemap type="QVariantMap"/> |
|
56 | <valuemap type="QVariantMap"/> | |
50 | </data> |
|
57 | </data> | |
51 | <data> |
|
58 | <data> | |
52 | <variable>ProjectExplorer.Project.Target.0</variable> |
|
59 | <variable>ProjectExplorer.Project.Target.0</variable> | |
53 | <valuemap type="QVariantMap"> |
|
60 | <valuemap type="QVariantMap"> | |
54 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.2 in PATH (System)</value> |
|
61 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.2 in PATH (System)</value> | |
55 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.2 in PATH (System)</value> |
|
62 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.2 in PATH (System)</value> | |
56 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{5289e843-9ef2-45ce-88c6-ad27d8e08def}</value> |
|
63 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{5289e843-9ef2-45ce-88c6-ad27d8e08def}</value> | |
57 | <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value> |
|
64 | <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value> | |
58 | <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> |
|
65 | <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> | |
59 | <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> |
|
66 | <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> | |
60 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> |
|
67 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> | |
61 | <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory"></value> |
|
68 | <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory"></value> | |
62 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|
69 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> | |
63 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
70 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> | |
64 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
71 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> | |
65 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> |
|
72 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> | |
66 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
73 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
67 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> |
|
74 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> | |
68 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> |
|
75 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> | |
69 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value> |
|
76 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value> | |
70 | <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> |
|
77 | <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> | |
71 | <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> |
|
78 | <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> | |
72 | </valuemap> |
|
79 | </valuemap> | |
73 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> |
|
80 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> | |
74 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
81 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> | |
75 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
82 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> | |
76 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
83 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
77 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
84 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> | |
78 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
85 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> | |
79 | <value type="QString">-w</value> |
|
86 | <value type="QString">-w</value> | |
80 | <value type="QString">-r</value> |
|
87 | <value type="QString">-r</value> | |
81 | </valuelist> |
|
88 | </valuelist> | |
82 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> |
|
89 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> | |
83 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> |
|
90 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> | |
84 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
91 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> | |
85 | </valuemap> |
|
92 | </valuemap> | |
86 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> |
|
93 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> | |
87 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> |
|
94 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> | |
88 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
95 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
89 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> |
|
96 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> | |
90 | </valuemap> |
|
97 | </valuemap> | |
91 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> |
|
98 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> | |
92 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
99 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> | |
93 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
100 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> | |
94 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
101 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> | |
95 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
102 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
96 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
103 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> | |
97 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
104 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> | |
98 | <value type="QString">-w</value> |
|
105 | <value type="QString">-w</value> | |
99 | <value type="QString">-r</value> |
|
106 | <value type="QString">-r</value> | |
100 | </valuelist> |
|
107 | </valuelist> | |
101 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> |
|
108 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> | |
102 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> |
|
109 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> | |
103 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
110 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> | |
104 | </valuemap> |
|
111 | </valuemap> | |
105 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> |
|
112 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> | |
106 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> |
|
113 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> | |
107 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
114 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
108 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> |
|
115 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> | |
109 | </valuemap> |
|
116 | </valuemap> | |
110 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> |
|
117 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> | |
111 | <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> |
|
118 | <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> | |
112 | <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> |
|
119 | <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> | |
113 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value> |
|
120 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value> | |
114 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
121 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
115 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> |
|
122 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> | |
116 | <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> |
|
123 | <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> | |
117 | <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> |
|
124 | <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> | |
118 | </valuemap> |
|
125 | </valuemap> | |
119 | <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value> |
|
126 | <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value> | |
120 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0"> |
|
127 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0"> | |
121 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|
128 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> | |
122 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value> |
|
129 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value> | |
123 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value> |
|
130 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value> | |
124 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
131 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
125 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value> |
|
132 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value> | |
126 | </valuemap> |
|
133 | </valuemap> | |
127 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value> |
|
134 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value> | |
128 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value> |
|
135 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value> | |
129 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
136 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
130 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value> |
|
137 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value> | |
131 | </valuemap> |
|
138 | </valuemap> | |
132 | <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> |
|
139 | <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> | |
133 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/> |
|
140 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/> | |
134 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> |
|
141 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> | |
135 | <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> |
|
142 | <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> | |
136 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> |
|
143 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> | |
137 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> |
|
144 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> | |
138 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> |
|
145 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> | |
139 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> |
|
146 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> | |
140 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> |
|
147 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> | |
141 | <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> |
|
148 | <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> | |
142 | <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> |
|
149 | <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> | |
143 | <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> |
|
150 | <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> | |
144 | <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value> |
|
151 | <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value> | |
145 | <value type="int" key="Analyzer.Valgrind.NumCallers">25</value> |
|
152 | <value type="int" key="Analyzer.Valgrind.NumCallers">25</value> | |
146 | <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> |
|
153 | <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> | |
147 | <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value> |
|
154 | <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value> | |
148 | <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value> |
|
155 | <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value> | |
149 | <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value> |
|
156 | <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value> | |
150 | <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> |
|
157 | <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> | |
151 | <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> |
|
158 | <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> | |
152 | <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> |
|
159 | <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> | |
153 | <value type="int">0</value> |
|
160 | <value type="int">0</value> | |
154 | <value type="int">1</value> |
|
161 | <value type="int">1</value> | |
155 | <value type="int">2</value> |
|
162 | <value type="int">2</value> | |
156 | <value type="int">3</value> |
|
163 | <value type="int">3</value> | |
157 | <value type="int">4</value> |
|
164 | <value type="int">4</value> | |
158 | <value type="int">5</value> |
|
165 | <value type="int">5</value> | |
159 | <value type="int">6</value> |
|
166 | <value type="int">6</value> | |
160 | <value type="int">7</value> |
|
167 | <value type="int">7</value> | |
161 | <value type="int">8</value> |
|
168 | <value type="int">8</value> | |
162 | <value type="int">9</value> |
|
169 | <value type="int">9</value> | |
163 | <value type="int">10</value> |
|
170 | <value type="int">10</value> | |
164 | <value type="int">11</value> |
|
171 | <value type="int">11</value> | |
165 | <value type="int">12</value> |
|
172 | <value type="int">12</value> | |
166 | <value type="int">13</value> |
|
173 | <value type="int">13</value> | |
167 | <value type="int">14</value> |
|
174 | <value type="int">14</value> | |
168 | </valuelist> |
|
175 | </valuelist> | |
169 | <value type="int" key="PE.EnvironmentAspect.Base">2</value> |
|
176 | <value type="int" key="PE.EnvironmentAspect.Base">2</value> | |
170 | <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> |
|
177 | <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> | |
171 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value> |
|
178 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value> | |
172 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
179 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
173 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value> |
|
180 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value> | |
174 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value> |
|
181 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value> | |
175 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value> |
|
182 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value> | |
176 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value> |
|
183 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value> | |
177 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value> |
|
184 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value> | |
178 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value> |
|
185 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value> | |
179 | <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> |
|
186 | <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> | |
180 | <value type="bool" key="RunConfiguration.UseCppDebugger">true</value> |
|
187 | <value type="bool" key="RunConfiguration.UseCppDebugger">true</value> | |
181 | <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value> |
|
188 | <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value> | |
182 | <value type="bool" key="RunConfiguration.UseMultiProcess">false</value> |
|
189 | <value type="bool" key="RunConfiguration.UseMultiProcess">false</value> | |
183 | <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> |
|
190 | <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> | |
184 | <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> |
|
191 | <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> | |
185 | </valuemap> |
|
192 | </valuemap> | |
186 | <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value> |
|
193 | <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value> | |
187 | </valuemap> |
|
194 | </valuemap> | |
188 | </data> |
|
195 | </data> | |
189 | <data> |
|
196 | <data> | |
190 | <variable>ProjectExplorer.Project.TargetCount</variable> |
|
197 | <variable>ProjectExplorer.Project.TargetCount</variable> | |
191 | <value type="int">1</value> |
|
198 | <value type="int">1</value> | |
192 | </data> |
|
199 | </data> | |
193 | <data> |
|
200 | <data> | |
194 |
<variable>ProjectExplorer.Project.Updater. |
|
201 | <variable>ProjectExplorer.Project.Updater.FileVersion</variable> | |
195 | <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value> |
|
202 | <value type="int">16</value> | |
196 | </data> |
|
203 | </data> | |
197 | <data> |
|
204 | <data> | |
198 |
<variable> |
|
205 | <variable>Version</variable> | |
199 |
<value type="int">1 |
|
206 | <value type="int">16</value> | |
200 | </data> |
|
207 | </data> | |
201 | </qtcreator> |
|
208 | </qtcreator> |
@@ -1,238 +1,238 | |||||
1 | ############################################################################# |
|
1 | ############################################################################# | |
2 | # Makefile for building: bin/timegen |
|
2 | # Makefile for building: bin/timegen | |
3 |
# Generated by qmake (2.01a) (Qt 4.8. |
|
3 | # Generated by qmake (2.01a) (Qt 4.8.6) on: Wed Sep 24 10:50:53 2014 | |
4 | # Project: timegen.pro |
|
4 | # Project: timegen.pro | |
5 | # Template: app |
|
5 | # Template: app | |
6 | # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile timegen.pro |
|
6 | # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile timegen.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=1 -DPRINT_MESSAGES_ON_CONSOLE -DDEBUG_MESSAGES -DBOOT_MESSAGES |
|
13 | DEFINES = -DSW_VERSION_N1=0 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=1 -DPRINT_MESSAGES_ON_CONSOLE -DDEBUG_MESSAGES -DBOOT_MESSAGES | |
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. -Isrc -Iheader -I../src -I../header |
|
16 | INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -Isrc -Iheader -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/timegen_init.c \ |
|
46 | SOURCES = src/timegen_init.c \ | |
47 | src/timegen_tc_handler.c \ |
|
47 | src/timegen_tc_handler.c \ | |
48 | src/timegen_misc.c \ |
|
48 | src/timegen_misc.c \ | |
49 | src/timegen_spacewire.c \ |
|
49 | src/timegen_spacewire.c \ | |
50 | ../src/fsw_misc.c \ |
|
50 | ../src/fsw_misc.c \ | |
51 | ../src/fsw_globals.c \ |
|
51 | ../src/fsw_globals.c \ | |
52 | ../src/tm_lfr_tc_exe.c \ |
|
52 | ../src/tm_lfr_tc_exe.c \ | |
53 | ../src/tc_acceptance.c |
|
53 | ../src/tc_acceptance.c | |
54 | OBJECTS = obj/timegen_init.o \ |
|
54 | OBJECTS = obj/timegen_init.o \ | |
55 | obj/timegen_tc_handler.o \ |
|
55 | obj/timegen_tc_handler.o \ | |
56 | obj/timegen_misc.o \ |
|
56 | obj/timegen_misc.o \ | |
57 | obj/timegen_spacewire.o \ |
|
57 | obj/timegen_spacewire.o \ | |
58 | obj/fsw_misc.o \ |
|
58 | obj/fsw_misc.o \ | |
59 | obj/fsw_globals.o \ |
|
59 | obj/fsw_globals.o \ | |
60 | obj/tm_lfr_tc_exe.o \ |
|
60 | obj/tm_lfr_tc_exe.o \ | |
61 | obj/tc_acceptance.o |
|
61 | obj/tc_acceptance.o | |
62 | DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \ |
|
62 | DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \ | |
63 | /usr/lib64/qt4/mkspecs/common/linux.conf \ |
|
63 | /usr/lib64/qt4/mkspecs/common/linux.conf \ | |
64 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ |
|
64 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ | |
65 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ |
|
65 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ | |
66 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ |
|
66 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ | |
67 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ |
|
67 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ | |
68 | /usr/lib64/qt4/mkspecs/qconfig.pri \ |
|
68 | /usr/lib64/qt4/mkspecs/qconfig.pri \ | |
69 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ |
|
69 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ | |
70 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ |
|
70 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ | |
71 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ |
|
71 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ | |
72 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ |
|
72 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ | |
73 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ |
|
73 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ | |
74 | sparc.pri \ |
|
74 | sparc.pri \ | |
75 | /usr/lib64/qt4/mkspecs/features/release.prf \ |
|
75 | /usr/lib64/qt4/mkspecs/features/release.prf \ | |
76 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ |
|
76 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ | |
77 | /usr/lib64/qt4/mkspecs/features/shared.prf \ |
|
77 | /usr/lib64/qt4/mkspecs/features/shared.prf \ | |
78 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ |
|
78 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ | |
79 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ |
|
79 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ | |
80 | /usr/lib64/qt4/mkspecs/features/resources.prf \ |
|
80 | /usr/lib64/qt4/mkspecs/features/resources.prf \ | |
81 | /usr/lib64/qt4/mkspecs/features/uic.prf \ |
|
81 | /usr/lib64/qt4/mkspecs/features/uic.prf \ | |
82 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ |
|
82 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ | |
83 | /usr/lib64/qt4/mkspecs/features/lex.prf \ |
|
83 | /usr/lib64/qt4/mkspecs/features/lex.prf \ | |
84 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \ |
|
84 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \ | |
85 | timegen.pro |
|
85 | timegen.pro | |
86 | QMAKE_TARGET = timegen |
|
86 | QMAKE_TARGET = timegen | |
87 | DESTDIR = bin/ |
|
87 | DESTDIR = bin/ | |
88 | TARGET = bin/timegen |
|
88 | TARGET = bin/timegen | |
89 |
|
89 | |||
90 | first: all |
|
90 | first: all | |
91 | ####### Implicit rules |
|
91 | ####### Implicit rules | |
92 |
|
92 | |||
93 | .SUFFIXES: .o .c .cpp .cc .cxx .C |
|
93 | .SUFFIXES: .o .c .cpp .cc .cxx .C | |
94 |
|
94 | |||
95 | .cpp.o: |
|
95 | .cpp.o: | |
96 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
96 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" | |
97 |
|
97 | |||
98 | .cc.o: |
|
98 | .cc.o: | |
99 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
99 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" | |
100 |
|
100 | |||
101 | .cxx.o: |
|
101 | .cxx.o: | |
102 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
102 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" | |
103 |
|
103 | |||
104 | .C.o: |
|
104 | .C.o: | |
105 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
105 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" | |
106 |
|
106 | |||
107 | .c.o: |
|
107 | .c.o: | |
108 | $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<" |
|
108 | $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<" | |
109 |
|
109 | |||
110 | ####### Build rules |
|
110 | ####### Build rules | |
111 |
|
111 | |||
112 | all: Makefile $(TARGET) |
|
112 | all: Makefile $(TARGET) | |
113 |
|
113 | |||
114 | $(TARGET): $(OBJECTS) |
|
114 | $(TARGET): $(OBJECTS) | |
115 | @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/ |
|
115 | @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/ | |
116 | $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) |
|
116 | $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) | |
117 |
|
117 | |||
118 | Makefile: timegen.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \ |
|
118 | Makefile: timegen.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \ | |
119 | /usr/lib64/qt4/mkspecs/common/linux.conf \ |
|
119 | /usr/lib64/qt4/mkspecs/common/linux.conf \ | |
120 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ |
|
120 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ | |
121 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ |
|
121 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ | |
122 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ |
|
122 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ | |
123 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ |
|
123 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ | |
124 | /usr/lib64/qt4/mkspecs/qconfig.pri \ |
|
124 | /usr/lib64/qt4/mkspecs/qconfig.pri \ | |
125 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ |
|
125 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ | |
126 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ |
|
126 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ | |
127 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ |
|
127 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ | |
128 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ |
|
128 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ | |
129 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ |
|
129 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ | |
130 | sparc.pri \ |
|
130 | sparc.pri \ | |
131 | /usr/lib64/qt4/mkspecs/features/release.prf \ |
|
131 | /usr/lib64/qt4/mkspecs/features/release.prf \ | |
132 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ |
|
132 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ | |
133 | /usr/lib64/qt4/mkspecs/features/shared.prf \ |
|
133 | /usr/lib64/qt4/mkspecs/features/shared.prf \ | |
134 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ |
|
134 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ | |
135 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ |
|
135 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ | |
136 | /usr/lib64/qt4/mkspecs/features/resources.prf \ |
|
136 | /usr/lib64/qt4/mkspecs/features/resources.prf \ | |
137 | /usr/lib64/qt4/mkspecs/features/uic.prf \ |
|
137 | /usr/lib64/qt4/mkspecs/features/uic.prf \ | |
138 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ |
|
138 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ | |
139 | /usr/lib64/qt4/mkspecs/features/lex.prf \ |
|
139 | /usr/lib64/qt4/mkspecs/features/lex.prf \ | |
140 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf |
|
140 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf | |
141 | $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile timegen.pro |
|
141 | $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile timegen.pro | |
142 | /usr/lib64/qt4/mkspecs/common/unix.conf: |
|
142 | /usr/lib64/qt4/mkspecs/common/unix.conf: | |
143 | /usr/lib64/qt4/mkspecs/common/linux.conf: |
|
143 | /usr/lib64/qt4/mkspecs/common/linux.conf: | |
144 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf: |
|
144 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf: | |
145 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf: |
|
145 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf: | |
146 | /usr/lib64/qt4/mkspecs/common/g++-base.conf: |
|
146 | /usr/lib64/qt4/mkspecs/common/g++-base.conf: | |
147 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf: |
|
147 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf: | |
148 | /usr/lib64/qt4/mkspecs/qconfig.pri: |
|
148 | /usr/lib64/qt4/mkspecs/qconfig.pri: | |
149 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri: |
|
149 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri: | |
150 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf: |
|
150 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf: | |
151 | /usr/lib64/qt4/mkspecs/features/qt_config.prf: |
|
151 | /usr/lib64/qt4/mkspecs/features/qt_config.prf: | |
152 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf: |
|
152 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf: | |
153 | /usr/lib64/qt4/mkspecs/features/default_pre.prf: |
|
153 | /usr/lib64/qt4/mkspecs/features/default_pre.prf: | |
154 | sparc.pri: |
|
154 | sparc.pri: | |
155 | /usr/lib64/qt4/mkspecs/features/release.prf: |
|
155 | /usr/lib64/qt4/mkspecs/features/release.prf: | |
156 | /usr/lib64/qt4/mkspecs/features/default_post.prf: |
|
156 | /usr/lib64/qt4/mkspecs/features/default_post.prf: | |
157 | /usr/lib64/qt4/mkspecs/features/shared.prf: |
|
157 | /usr/lib64/qt4/mkspecs/features/shared.prf: | |
158 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf: |
|
158 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf: | |
159 | /usr/lib64/qt4/mkspecs/features/warn_on.prf: |
|
159 | /usr/lib64/qt4/mkspecs/features/warn_on.prf: | |
160 | /usr/lib64/qt4/mkspecs/features/resources.prf: |
|
160 | /usr/lib64/qt4/mkspecs/features/resources.prf: | |
161 | /usr/lib64/qt4/mkspecs/features/uic.prf: |
|
161 | /usr/lib64/qt4/mkspecs/features/uic.prf: | |
162 | /usr/lib64/qt4/mkspecs/features/yacc.prf: |
|
162 | /usr/lib64/qt4/mkspecs/features/yacc.prf: | |
163 | /usr/lib64/qt4/mkspecs/features/lex.prf: |
|
163 | /usr/lib64/qt4/mkspecs/features/lex.prf: | |
164 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf: |
|
164 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf: | |
165 | qmake: FORCE |
|
165 | qmake: FORCE | |
166 | @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile timegen.pro |
|
166 | @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile timegen.pro | |
167 |
|
167 | |||
168 | dist: |
|
168 | dist: | |
169 | @$(CHK_DIR_EXISTS) obj/timegen1.0.0 || $(MKDIR) obj/timegen1.0.0 |
|
169 | @$(CHK_DIR_EXISTS) obj/timegen1.0.0 || $(MKDIR) obj/timegen1.0.0 | |
170 | $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/timegen1.0.0/ && (cd `dirname obj/timegen1.0.0` && $(TAR) timegen1.0.0.tar timegen1.0.0 && $(COMPRESS) timegen1.0.0.tar) && $(MOVE) `dirname obj/timegen1.0.0`/timegen1.0.0.tar.gz . && $(DEL_FILE) -r obj/timegen1.0.0 |
|
170 | $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/timegen1.0.0/ && (cd `dirname obj/timegen1.0.0` && $(TAR) timegen1.0.0.tar timegen1.0.0 && $(COMPRESS) timegen1.0.0.tar) && $(MOVE) `dirname obj/timegen1.0.0`/timegen1.0.0.tar.gz . && $(DEL_FILE) -r obj/timegen1.0.0 | |
171 |
|
171 | |||
172 |
|
172 | |||
173 | clean:compiler_clean |
|
173 | clean:compiler_clean | |
174 | -$(DEL_FILE) $(OBJECTS) |
|
174 | -$(DEL_FILE) $(OBJECTS) | |
175 | -$(DEL_FILE) *~ core *.core |
|
175 | -$(DEL_FILE) *~ core *.core | |
176 |
|
176 | |||
177 |
|
177 | |||
178 | ####### Sub-libraries |
|
178 | ####### Sub-libraries | |
179 |
|
179 | |||
180 | distclean: clean |
|
180 | distclean: clean | |
181 | -$(DEL_FILE) $(TARGET) |
|
181 | -$(DEL_FILE) $(TARGET) | |
182 | -$(DEL_FILE) Makefile |
|
182 | -$(DEL_FILE) Makefile | |
183 |
|
183 | |||
184 |
|
184 | |||
185 | grmon: |
|
185 | grmon: | |
186 | cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u |
|
186 | cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u | |
187 |
|
187 | |||
188 | check: first |
|
188 | check: first | |
189 |
|
189 | |||
190 | compiler_rcc_make_all: |
|
190 | compiler_rcc_make_all: | |
191 | compiler_rcc_clean: |
|
191 | compiler_rcc_clean: | |
192 | compiler_uic_make_all: |
|
192 | compiler_uic_make_all: | |
193 | compiler_uic_clean: |
|
193 | compiler_uic_clean: | |
194 | compiler_image_collection_make_all: qmake_image_collection.cpp |
|
194 | compiler_image_collection_make_all: qmake_image_collection.cpp | |
195 | compiler_image_collection_clean: |
|
195 | compiler_image_collection_clean: | |
196 | -$(DEL_FILE) qmake_image_collection.cpp |
|
196 | -$(DEL_FILE) qmake_image_collection.cpp | |
197 | compiler_yacc_decl_make_all: |
|
197 | compiler_yacc_decl_make_all: | |
198 | compiler_yacc_decl_clean: |
|
198 | compiler_yacc_decl_clean: | |
199 | compiler_yacc_impl_make_all: |
|
199 | compiler_yacc_impl_make_all: | |
200 | compiler_yacc_impl_clean: |
|
200 | compiler_yacc_impl_clean: | |
201 | compiler_lex_make_all: |
|
201 | compiler_lex_make_all: | |
202 | compiler_lex_clean: |
|
202 | compiler_lex_clean: | |
203 | compiler_clean: |
|
203 | compiler_clean: | |
204 |
|
204 | |||
205 | ####### Compile |
|
205 | ####### Compile | |
206 |
|
206 | |||
207 | obj/timegen_init.o: src/timegen_init.c |
|
207 | obj/timegen_init.o: src/timegen_init.c | |
208 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/timegen_init.o src/timegen_init.c |
|
208 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/timegen_init.o src/timegen_init.c | |
209 |
|
209 | |||
210 | obj/timegen_tc_handler.o: src/timegen_tc_handler.c |
|
210 | obj/timegen_tc_handler.o: src/timegen_tc_handler.c | |
211 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/timegen_tc_handler.o src/timegen_tc_handler.c |
|
211 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/timegen_tc_handler.o src/timegen_tc_handler.c | |
212 |
|
212 | |||
213 | obj/timegen_misc.o: src/timegen_misc.c |
|
213 | obj/timegen_misc.o: src/timegen_misc.c | |
214 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/timegen_misc.o src/timegen_misc.c |
|
214 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/timegen_misc.o src/timegen_misc.c | |
215 |
|
215 | |||
216 | obj/timegen_spacewire.o: src/timegen_spacewire.c |
|
216 | obj/timegen_spacewire.o: src/timegen_spacewire.c | |
217 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/timegen_spacewire.o src/timegen_spacewire.c |
|
217 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/timegen_spacewire.o src/timegen_spacewire.c | |
218 |
|
218 | |||
219 | obj/fsw_misc.o: ../src/fsw_misc.c |
|
219 | obj/fsw_misc.o: ../src/fsw_misc.c | |
220 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c |
|
220 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c | |
221 |
|
221 | |||
222 | obj/fsw_globals.o: ../src/fsw_globals.c |
|
222 | obj/fsw_globals.o: ../src/fsw_globals.c | |
223 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c |
|
223 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c | |
224 |
|
224 | |||
225 | obj/tm_lfr_tc_exe.o: ../src/tm_lfr_tc_exe.c |
|
225 | obj/tm_lfr_tc_exe.o: ../src/tm_lfr_tc_exe.c | |
226 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tm_lfr_tc_exe.o ../src/tm_lfr_tc_exe.c |
|
226 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tm_lfr_tc_exe.o ../src/tm_lfr_tc_exe.c | |
227 |
|
227 | |||
228 | obj/tc_acceptance.o: ../src/tc_acceptance.c |
|
228 | obj/tc_acceptance.o: ../src/tc_acceptance.c | |
229 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_acceptance.o ../src/tc_acceptance.c |
|
229 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_acceptance.o ../src/tc_acceptance.c | |
230 |
|
230 | |||
231 | ####### Install |
|
231 | ####### Install | |
232 |
|
232 | |||
233 | install: FORCE |
|
233 | install: FORCE | |
234 |
|
234 | |||
235 | uninstall: FORCE |
|
235 | uninstall: FORCE | |
236 |
|
236 | |||
237 | FORCE: |
|
237 | FORCE: | |
238 |
|
238 |
@@ -1,41 +1,39 | |||||
1 | #ifndef TIMEGEN_INIT_H_INCLUDED |
|
1 | #ifndef TIMEGEN_INIT_H_INCLUDED | |
2 | #define TIMEGEN_INIT_H_INCLUDED |
|
2 | #define TIMEGEN_INIT_H_INCLUDED | |
3 |
|
3 | |||
4 | #include <rtems.h> |
|
4 | #include <rtems.h> | |
5 | #include <leon.h> |
|
5 | #include <leon.h> | |
6 |
|
6 | |||
7 | #include "fsw_params.h" |
|
7 | #include "fsw_params.h" | |
8 | #include "fsw_misc.h" |
|
8 | #include "fsw_misc.h" | |
9 | #include "fsw_processing.h" |
|
|||
10 | #include "wf_handler.h" |
|
9 | #include "wf_handler.h" | |
11 |
|
10 | |||
12 | #include "timegen_spacewire.h" |
|
11 | #include "timegen_spacewire.h" | |
13 | #include "timegen_misc.h" |
|
12 | #include "timegen_misc.h" | |
14 |
|
13 | |||
15 | extern rtems_name Task_name[20]; /* array of task names */ |
|
14 | extern rtems_name Task_name[20]; /* array of task names */ | |
16 | extern rtems_id Task_id[20]; /* array of task ids */ |
|
15 | extern rtems_id Task_id[20]; /* array of task ids */ | |
|
16 | extern rtems_name misc_name[5]; | |||
17 |
|
17 | |||
18 | // RTEMS TASKS |
|
18 | // RTEMS TASKS | |
19 | rtems_task Init( rtems_task_argument argument); |
|
19 | rtems_task Init( rtems_task_argument argument); | |
20 |
|
20 | |||
21 | // OTHER functions |
|
21 | // OTHER functions | |
22 | void create_names( void ); |
|
22 | void create_names( void ); | |
23 | int create_all_tasks( void ); |
|
23 | int create_all_tasks( void ); | |
24 | int start_all_tasks( void ); |
|
24 | int start_all_tasks( void ); | |
25 | // |
|
25 | // | |
26 | rtems_status_code create_message_queues( void ); |
|
26 | rtems_status_code create_message_queues( void ); | |
27 | rtems_status_code get_message_queue_id_send( rtems_id *queue_id ); |
|
27 | rtems_status_code get_message_queue_id_send( rtems_id *queue_id ); | |
28 | rtems_status_code get_message_queue_id_recv( rtems_id *queue_id ); |
|
28 | rtems_status_code get_message_queue_id_recv( rtems_id *queue_id ); | |
29 | // |
|
29 | // | |
30 | int start_recv_send_tasks( void ); |
|
30 | int start_recv_send_tasks( void ); | |
31 | // |
|
31 | // | |
32 | void init_local_mode_parameters( void ); |
|
32 | void init_local_mode_parameters( void ); | |
33 | void reset_local_time( void ); |
|
33 | void reset_local_time( void ); | |
34 |
|
34 | |||
35 | extern int rtems_cpu_usage_report( void ); |
|
|||
36 | extern int rtems_cpu_usage_reset( void ); |
|
|||
37 | extern void rtems_stack_checker_report_usage( void ); |
|
35 | extern void rtems_stack_checker_report_usage( void ); | |
38 |
|
36 | |||
39 | extern int sched_yield( void ); |
|
37 | extern int sched_yield( void ); | |
40 |
|
38 | |||
41 | #endif // TIMEGEN_INIT_H_INCLUDED |
|
39 | #endif // TIMEGEN_INIT_H_INCLUDED |
@@ -1,39 +1,41 | |||||
1 | #ifndef TIMEGEN_MISC_H_INCLUDED |
|
1 | #ifndef TIMEGEN_MISC_H_INCLUDED | |
2 | #define TIMEGEN_MISC_H_INCLUDED |
|
2 | #define TIMEGEN_MISC_H_INCLUDED | |
3 |
|
3 | |||
4 | #include <rtems.h> |
|
4 | #include <rtems.h> | |
5 | #include <leon.h> |
|
5 | #include <leon.h> | |
6 |
|
6 | |||
7 | #include "fsw_params.h" |
|
7 | #include "fsw_params.h" | |
8 | #include "TC_types.h" |
|
8 | #include "TC_types.h" | |
9 | #include "tc_acceptance.h" |
|
9 | #include "tc_acceptance.h" | |
10 | #include "timegen_init.h" |
|
10 | #include "timegen_init.h" | |
11 |
|
11 | |||
12 | #define TASK_PRIORITY_UPDT 40 |
|
12 | #define TASK_PRIORITY_UPDT 40 | |
13 |
|
13 | |||
14 | typedef struct { |
|
14 | typedef struct { | |
15 | unsigned char targetLogicalAddress; |
|
15 | unsigned char targetLogicalAddress; | |
16 | unsigned char protocolIdentifier; |
|
16 | unsigned char protocolIdentifier; | |
17 | unsigned char reserved; |
|
17 | unsigned char reserved; | |
18 | unsigned char userApplication; |
|
18 | unsigned char userApplication; | |
19 | // PACKET HEADER |
|
19 | // PACKET HEADER | |
20 | Packet_TC_LFR_UPDATE_TIME_t update_time; |
|
20 | Packet_TC_LFR_UPDATE_TIME_t update_time; | |
21 | } Packet_TC_LFR_UPDATE_TIME_WITH_OVERHEAD_t; |
|
21 | } Packet_TC_LFR_UPDATE_TIME_WITH_OVERHEAD_t; | |
22 |
|
22 | |||
23 | unsigned int coarseTime; |
|
23 | unsigned int coarseTime; | |
24 |
|
24 | |||
25 | rtems_name rtems_name_updt; |
|
25 | rtems_name rtems_name_updt; | |
26 | rtems_id rtems_id_updt; |
|
26 | rtems_id rtems_id_updt; | |
|
27 | rtems_name rtems_name_act_; | |||
|
28 | rtems_id rtems_id_act_; | |||
27 |
|
29 | |||
28 | void timegen_timecode_irq_handler( void *pDev, void *regs, int minor, unsigned int tc ); |
|
30 | void timegen_timecode_irq_handler( void *pDev, void *regs, int minor, unsigned int tc ); | |
29 |
|
31 | |||
30 | void initCoarseTime( void ); |
|
32 | void initCoarseTime( void ); | |
31 |
|
33 | |||
32 | rtems_task updt_task( rtems_task_argument unused ); |
|
34 | rtems_task updt_task( rtems_task_argument unused ); | |
33 |
|
35 | |||
34 | int send_tc_lfr_update_time( rtems_id queue_id ); |
|
36 | int send_tc_lfr_update_time( rtems_id queue_id ); | |
35 |
|
37 | |||
36 | #endif // TIMEGEN_MISC_H_INCLUDED |
|
38 | #endif // TIMEGEN_MISC_H_INCLUDED | |
37 |
|
39 | |||
38 |
|
40 | |||
39 |
|
41 |
@@ -1,56 +1,34 | |||||
1 | #ifndef TIMEGEN_TC_HANDLER_H_INCLUDED |
|
1 | #ifndef TIMEGEN_TC_HANDLER_H_INCLUDED | |
2 | #define TIMEGEN_TC_HANDLER_H_INCLUDED |
|
2 | #define TIMEGEN_TC_HANDLER_H_INCLUDED | |
3 |
|
3 | |||
4 | #include <rtems.h> |
|
4 | #include <rtems.h> | |
5 | #include <leon.h> |
|
5 | #include <leon.h> | |
6 |
|
6 | |||
7 | #include "tc_load_dump_parameters.h" |
|
7 | #include "tc_load_dump_parameters.h" | |
8 | #include "tc_acceptance.h" |
|
8 | #include "tc_acceptance.h" | |
9 | #include "tm_lfr_tc_exe.h" |
|
9 | #include "tm_lfr_tc_exe.h" | |
10 |
|
10 | |||
11 | // MODE PARAMETERS |
|
11 | // MODE PARAMETERS | |
12 | extern unsigned int maxCount; |
|
12 | extern unsigned int maxCount; | |
13 |
|
13 | |||
14 | //**** |
|
14 | //**** | |
15 | // ISR |
|
15 | // ISR | |
16 | rtems_isr commutation_isr1( rtems_vector_number vector ); |
|
16 | rtems_isr commutation_isr1( rtems_vector_number vector ); | |
17 | rtems_isr commutation_isr2( rtems_vector_number vector ); |
|
17 | rtems_isr commutation_isr2( rtems_vector_number vector ); | |
18 |
|
18 | |||
19 | //*********** |
|
19 | //*********** | |
20 | // RTEMS TASK |
|
20 | // RTEMS TASK | |
21 |
rtems_task act |
|
21 | rtems_task act__task( rtems_task_argument unused ); | |
22 |
|
22 | |||
23 | //*********** |
|
23 | //*********** | |
24 | // TC ACTIONS |
|
24 | // TC ACTIONS | |
25 |
int action_ |
|
25 | int timegen_action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); | |
26 |
int action_ |
|
26 | int timegen_action_update_time(ccsdsTelecommandPacket_t *TC); | |
27 | int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); |
|
|||
28 | int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); |
|
|||
29 | int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); |
|
|||
30 | int action_update_time(ccsdsTelecommandPacket_t *TC); |
|
|||
31 |
|
||||
32 | // mode transition |
|
|||
33 | int transition_validation(unsigned char requestedMode); |
|
|||
34 | int stop_current_mode( void ); |
|
|||
35 | int enter_mode(unsigned char mode); |
|
|||
36 | int restart_science_tasks(); |
|
|||
37 | int suspend_science_tasks(); |
|
|||
38 | void launch_waveform_picker( unsigned char mode ); |
|
|||
39 | void launch_spectral_matrix( unsigned char mode ); |
|
|||
40 | void set_irq_on_new_ready_matrix(unsigned char value ); |
|
|||
41 | void set_run_matrix_spectral( unsigned char value ); |
|
|||
42 | void launch_spectral_matrix_simu( unsigned char mode ); |
|
|||
43 |
|
||||
44 | // other functions |
|
|||
45 | void updateLFRCurrentMode(); |
|
|||
46 | void update_last_TC_exe(ccsdsTelecommandPacket_t *TC ); |
|
|||
47 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC ); |
|
|||
48 | void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id ); |
|
|||
49 |
|
27 | |||
50 | extern rtems_status_code get_message_queue_id_send( rtems_id *queue_id ); |
|
28 | extern rtems_status_code get_message_queue_id_send( rtems_id *queue_id ); | |
51 | extern rtems_status_code get_message_queue_id_recv( rtems_id *queue_id ); |
|
29 | extern rtems_status_code get_message_queue_id_recv( rtems_id *queue_id ); | |
52 |
|
30 | |||
53 | #endif // TIMEGEN_TC_HANDLER_H_INCLUDED |
|
31 | #endif // TIMEGEN_TC_HANDLER_H_INCLUDED | |
54 |
|
32 | |||
55 |
|
33 | |||
56 |
|
34 |
@@ -1,476 +1,432 | |||||
1 | /** This is the RTEMS initialization module. |
|
1 | /** This is the RTEMS initialization module. | |
2 | * |
|
2 | * | |
3 | * @file |
|
3 | * @file | |
4 | * @author P. LEROY |
|
4 | * @author P. LEROY | |
5 | * |
|
5 | * | |
6 | * This module contains two very different information: |
|
6 | * This module contains two very different information: | |
7 | * - specific instructions to configure the compilation of the RTEMS executive |
|
7 | * - specific instructions to configure the compilation of the RTEMS executive | |
8 | * - functions related to the fligth softwre initialization, especially the INIT RTEMS task |
|
8 | * - functions related to the fligth softwre initialization, especially the INIT RTEMS task | |
9 | * |
|
9 | * | |
10 | */ |
|
10 | */ | |
11 |
|
11 | |||
12 | //************************* |
|
12 | //************************* | |
13 | // GPL reminder to be added |
|
13 | // GPL reminder to be added | |
14 | //************************* |
|
14 | //************************* | |
15 |
|
15 | |||
16 | #include <rtems.h> |
|
16 | #include <rtems.h> | |
17 |
|
17 | |||
18 | /* configuration information */ |
|
18 | /* configuration information */ | |
19 |
|
19 | |||
20 | #define CONFIGURE_INIT |
|
20 | #define CONFIGURE_INIT | |
21 |
|
21 | |||
22 | #include <bsp.h> /* for device driver prototypes */ |
|
22 | #include <bsp.h> /* for device driver prototypes */ | |
23 |
|
23 | |||
24 | /* configuration information */ |
|
24 | /* configuration information */ | |
25 |
|
25 | |||
26 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
|
26 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER | |
27 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
|
27 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER | |
28 |
|
28 | |||
29 | #define CONFIGURE_MAXIMUM_TASKS 20 |
|
29 | #define CONFIGURE_MAXIMUM_TASKS 20 | |
30 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
|
30 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE | |
31 | #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE) |
|
31 | #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE) | |
32 | #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32 |
|
32 | #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32 | |
33 | #define CONFIGURE_INIT_TASK_PRIORITY 1 // instead of 100 |
|
33 | #define CONFIGURE_INIT_TASK_PRIORITY 1 // instead of 100 | |
34 | #define CONFIGURE_INIT_TASK_MODE (RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT) |
|
34 | #define CONFIGURE_INIT_TASK_MODE (RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT) | |
35 | #define CONFIGURE_MAXIMUM_DRIVERS 16 |
|
35 | #define CONFIGURE_MAXIMUM_DRIVERS 16 | |
36 | #define CONFIGURE_MAXIMUM_PERIODS 5 |
|
36 | #define CONFIGURE_MAXIMUM_PERIODS 5 | |
37 | #define CONFIGURE_MAXIMUM_TIMERS 5 // STAT (1s), send SWF (0.3s), send CWF3 (1s) |
|
37 | #define CONFIGURE_MAXIMUM_TIMERS 5 // STAT (1s), send SWF (0.3s), send CWF3 (1s) | |
38 | #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 2 |
|
38 | #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 2 | |
39 | #ifdef PRINT_STACK_REPORT |
|
39 | #ifdef PRINT_STACK_REPORT | |
40 | #define CONFIGURE_STACK_CHECKER_ENABLED |
|
40 | #define CONFIGURE_STACK_CHECKER_ENABLED | |
41 | #endif |
|
41 | #endif | |
42 |
|
42 | |||
43 | #include <rtems/confdefs.h> |
|
43 | #include <rtems/confdefs.h> | |
44 |
|
44 | |||
45 | /* If --drvmgr was enabled during the configuration of the RTEMS kernel */ |
|
45 | /* If --drvmgr was enabled during the configuration of the RTEMS kernel */ | |
46 | #ifdef RTEMS_DRVMGR_STARTUP |
|
46 | #ifdef RTEMS_DRVMGR_STARTUP | |
47 | #ifdef LEON3 |
|
47 | #ifdef LEON3 | |
48 | /* Add Timer and UART Driver */ |
|
48 | /* Add Timer and UART Driver */ | |
49 | #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
|
49 | #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER | |
50 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER |
|
50 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER | |
51 | #endif |
|
51 | #endif | |
52 | #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
|
52 | #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER | |
53 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART |
|
53 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART | |
54 | #endif |
|
54 | #endif | |
55 | #endif |
|
55 | #endif | |
56 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */ |
|
56 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */ | |
57 | #include <drvmgr/drvmgr_confdefs.h> |
|
57 | #include <drvmgr/drvmgr_confdefs.h> | |
58 | #endif |
|
58 | #endif | |
59 |
|
59 | |||
60 | #include "timegen_init.h" |
|
60 | #include "timegen_init.h" | |
61 | #include "fsw_config.c" |
|
61 | #include "fsw_config.c" | |
62 |
|
62 | |||
63 | rtems_task Init( rtems_task_argument ignored ) |
|
63 | rtems_task Init( rtems_task_argument ignored ) | |
64 | { |
|
64 | { | |
65 | /** This is the RTEMS INIT taks, it the first task launched by the system. |
|
65 | /** This is the RTEMS INIT taks, it the first task launched by the system. | |
66 | * |
|
66 | * | |
67 | * @param unused is the starting argument of the RTEMS task |
|
67 | * @param unused is the starting argument of the RTEMS task | |
68 | * |
|
68 | * | |
69 | * The INIT task create and run all other RTEMS tasks. |
|
69 | * The INIT task create and run all other RTEMS tasks. | |
70 | * |
|
70 | * | |
71 | */ |
|
71 | */ | |
72 |
|
72 | |||
73 | rtems_status_code status; |
|
73 | rtems_status_code status; | |
74 | rtems_status_code status_spw; |
|
74 | rtems_status_code status_spw; | |
75 |
|
75 | |||
76 | // initCoarseTime(); |
|
76 | // initCoarseTime(); | |
77 |
|
77 | |||
78 | // UART settings |
|
78 | // UART settings | |
79 | send_console_outputs_on_apbuart_port(); |
|
79 | send_console_outputs_on_apbuart_port(); | |
80 | set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE); |
|
80 | set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE); | |
81 | enable_apbuart_transmitter(); |
|
81 | enable_apbuart_transmitter(); | |
82 | DEBUG_PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n") |
|
82 | DEBUG_PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n") | |
83 |
|
83 | |||
84 | PRINTF("\n\n\n\n\n") |
|
84 | PRINTF("\n\n\n\n\n") | |
85 | PRINTF("*************************\n") |
|
85 | PRINTF("*************************\n") | |
86 | PRINTF("** Time Generator **\n") |
|
86 | PRINTF("** Time Generator **\n") | |
87 | PRINTF1("** %d.", SW_VERSION_N1) |
|
87 | PRINTF1("** %d.", SW_VERSION_N1) | |
88 | PRINTF1("%d.", SW_VERSION_N2) |
|
88 | PRINTF1("%d.", SW_VERSION_N2) | |
89 | PRINTF1("%d.", SW_VERSION_N3) |
|
89 | PRINTF1("%d.", SW_VERSION_N3) | |
90 | PRINTF1("%d **\n", SW_VERSION_N4) |
|
90 | PRINTF1("%d **\n", SW_VERSION_N4) | |
91 | PRINTF("*************************\n") |
|
91 | PRINTF("*************************\n") | |
92 | PRINTF("\n\n") |
|
92 | PRINTF("\n\n") | |
93 |
|
93 | |||
94 | // init_local_mode_parameters(); |
|
94 | // init_local_mode_parameters(); | |
95 | // init_housekeeping_parameters(); |
|
95 | // init_housekeeping_parameters(); | |
96 |
|
96 | |||
97 | // updateLFRCurrentMode(); |
|
97 | // updateLFRCurrentMode(); | |
98 |
|
98 | |||
99 | // BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode) |
|
99 | // BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode) | |
100 |
|
100 | |||
101 | create_names(); // create all names |
|
101 | create_names(); // create all names | |
102 |
|
102 | |||
103 | status = create_message_queues(); // create message queues |
|
103 | status = create_message_queues(); // create message queues | |
104 | if (status != RTEMS_SUCCESSFUL) |
|
104 | if (status != RTEMS_SUCCESSFUL) | |
105 | { |
|
105 | { | |
106 | PRINTF1("in INIT *** ERR in create_message_queues, code %d", status) |
|
106 | PRINTF1("in INIT *** ERR in create_message_queues, code %d", status) | |
107 | } |
|
107 | } | |
108 |
|
108 | |||
109 | status = create_all_tasks(); // create all tasks |
|
109 | status = create_all_tasks(); // create all tasks | |
110 | if (status != RTEMS_SUCCESSFUL) |
|
110 | if (status != RTEMS_SUCCESSFUL) | |
111 | { |
|
111 | { | |
112 | PRINTF1("in INIT *** ERR in create_all_tasks, code %d", status) |
|
112 | PRINTF1("in INIT *** ERR in create_all_tasks, code %d", status) | |
113 | } |
|
113 | } | |
114 |
|
114 | |||
115 | // ************************** |
|
115 | // ************************** | |
116 | // <SPACEWIRE INITIALIZATION> |
|
116 | // <SPACEWIRE INITIALIZATION> | |
117 | grspw_timecode_callback = &timegen_timecode_irq_handler; |
|
117 | grspw_timecode_callback = &timegen_timecode_irq_handler; | |
118 |
|
118 | |||
119 | status_spw = spacewire_open_link(); // (1) open the link |
|
119 | status_spw = spacewire_open_link(); // (1) open the link | |
120 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
120 | if ( status_spw != RTEMS_SUCCESSFUL ) | |
121 | { |
|
121 | { | |
122 | PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw ) |
|
122 | PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw ) | |
123 | } |
|
123 | } | |
124 |
|
124 | |||
125 | if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link |
|
125 | if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link | |
126 | { |
|
126 | { | |
127 | status_spw = spacewire_configure_link( fdSPW ); |
|
127 | status_spw = spacewire_configure_link( fdSPW ); | |
128 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
128 | if ( status_spw != RTEMS_SUCCESSFUL ) | |
129 | { |
|
129 | { | |
130 | PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw ) |
|
130 | PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw ) | |
131 | } |
|
131 | } | |
132 | } |
|
132 | } | |
133 |
|
133 | |||
134 | if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link |
|
134 | if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link | |
135 | { |
|
135 | { | |
136 | status_spw = spacewire_start_link( fdSPW ); |
|
136 | status_spw = spacewire_start_link( fdSPW ); | |
137 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
137 | if ( status_spw != RTEMS_SUCCESSFUL ) | |
138 | { |
|
138 | { | |
139 | PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw ) |
|
139 | PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw ) | |
140 | } |
|
140 | } | |
141 | } |
|
141 | } | |
142 | // </SPACEWIRE INITIALIZATION> |
|
142 | // </SPACEWIRE INITIALIZATION> | |
143 | // *************************** |
|
143 | // *************************** | |
144 |
|
144 | |||
145 | status = start_all_tasks(); // start all tasks |
|
145 | status = start_all_tasks(); // start all tasks | |
146 | if (status != RTEMS_SUCCESSFUL) |
|
146 | if (status != RTEMS_SUCCESSFUL) | |
147 | { |
|
147 | { | |
148 | PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status) |
|
148 | PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status) | |
149 | } |
|
149 | } | |
150 |
|
150 | |||
151 | // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization |
|
151 | // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization | |
152 | status = start_recv_send_tasks(); |
|
152 | status = start_recv_send_tasks(); | |
153 | if ( status != RTEMS_SUCCESSFUL ) |
|
153 | if ( status != RTEMS_SUCCESSFUL ) | |
154 | { |
|
154 | { | |
155 | PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status ) |
|
155 | PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status ) | |
156 | } |
|
156 | } | |
157 |
|
157 | |||
158 | // suspend science tasks. they will be restarted later depending on the mode |
|
|||
159 | status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY) |
|
|||
160 | if (status != RTEMS_SUCCESSFUL) |
|
|||
161 | { |
|
|||
162 | PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status) |
|
|||
163 | } |
|
|||
164 |
|
||||
165 | // if the spacewire link is not up then send an event to the SPIQ task for link recovery |
|
158 | // if the spacewire link is not up then send an event to the SPIQ task for link recovery | |
166 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
159 | if ( status_spw != RTEMS_SUCCESSFUL ) | |
167 | { |
|
160 | { | |
168 | status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT ); |
|
161 | status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT ); | |
169 | if ( status != RTEMS_SUCCESSFUL ) { |
|
162 | if ( status != RTEMS_SUCCESSFUL ) { | |
170 | PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status ) |
|
163 | PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status ) | |
171 | } |
|
164 | } | |
172 | } |
|
165 | } | |
173 |
|
166 | |||
174 | BOOT_PRINTF("delete INIT\n") |
|
167 | BOOT_PRINTF("delete INIT\n") | |
175 |
|
168 | |||
176 | status = rtems_task_delete(RTEMS_SELF); |
|
169 | status = rtems_task_delete(RTEMS_SELF); | |
177 |
|
170 | |||
178 | } |
|
171 | } | |
179 |
|
172 | |||
180 | void init_local_mode_parameters( void ) |
|
|||
181 | { |
|
|||
182 | /** This function initialize the param_local global variable with default values. |
|
|||
183 | * |
|
|||
184 | */ |
|
|||
185 |
|
||||
186 | unsigned int i; |
|
|||
187 |
|
||||
188 | // LOCAL PARAMETERS |
|
|||
189 | // set_local_nb_interrupt_f0_MAX(); |
|
|||
190 |
|
||||
191 | BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max) |
|
|||
192 | BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max) |
|
|||
193 | BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX) |
|
|||
194 |
|
||||
195 | // init sequence counters |
|
|||
196 |
|
||||
197 | for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++) |
|
|||
198 | { |
|
|||
199 | sequenceCounters_TC_EXE[i] = 0x00; |
|
|||
200 | } |
|
|||
201 | sequenceCounters_SCIENCE_NORMAL_BURST = 0x00; |
|
|||
202 | sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00; |
|
|||
203 | } |
|
|||
204 |
|
||||
205 | void create_names( void ) // create all names for tasks and queues |
|
173 | void create_names( void ) // create all names for tasks and queues | |
206 | { |
|
174 | { | |
207 | /** This function creates all RTEMS names used in the software for tasks and queues. |
|
175 | /** This function creates all RTEMS names used in the software for tasks and queues. | |
208 | * |
|
176 | * | |
209 | * @return RTEMS directive status codes: |
|
177 | * @return RTEMS directive status codes: | |
210 | * - RTEMS_SUCCESSFUL - successful completion |
|
178 | * - RTEMS_SUCCESSFUL - successful completion | |
211 | * |
|
179 | * | |
212 | */ |
|
180 | */ | |
213 |
|
181 | |||
214 | // task names |
|
182 | // task names | |
215 | Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' ); |
|
183 | Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' ); | |
216 | Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' ); |
|
|||
217 | Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' ); |
|
184 | Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' ); | |
218 | Task_name[TASKID_SMIQ] = rtems_build_name( 'S', 'M', 'I', 'Q' ); |
|
|||
219 | Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' ); |
|
185 | Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' ); | |
220 | Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' ); |
|
|||
221 | Task_name[TASKID_SWBD] = rtems_build_name( 'S', 'W', 'B', 'D' ); |
|
|||
222 | Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' ); |
|
|||
223 | Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' ); |
|
186 | Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' ); | |
224 | Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' ); |
|
|||
225 | Task_name[TASKID_MATR] = rtems_build_name( 'M', 'A', 'T', 'R' ); |
|
|||
226 | Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' ); |
|
|||
227 | Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' ); |
|
|||
228 | Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' ); |
|
|||
229 | Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' ); |
|
187 | Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' ); | |
230 | Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' ); |
|
188 | Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' ); | |
231 |
|
189 | |||
232 | // TIMEGEN |
|
190 | // TIMEGEN | |
233 | rtems_name_updt = rtems_build_name( 'U', 'P', 'D', 'T' ); |
|
191 | rtems_name_updt = rtems_build_name( 'U', 'P', 'D', 'T' ); | |
234 |
|
192 | rtems_name_act_ = rtems_build_name( 'A', 'C', 'T', '_' ); | ||
235 | // rate monotonic period names |
|
|||
236 | name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' ); |
|
|||
237 |
|
193 | |||
238 | misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' ); |
|
194 | misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' ); | |
239 | misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' ); |
|
195 | misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' ); | |
240 | } |
|
196 | } | |
241 |
|
197 | |||
242 | int create_all_tasks( void ) // create all tasks which run in the software |
|
198 | int create_all_tasks( void ) // create all tasks which run in the software | |
243 | { |
|
199 | { | |
244 | /** This function creates all RTEMS tasks used in the software. |
|
200 | /** This function creates all RTEMS tasks used in the software. | |
245 | * |
|
201 | * | |
246 | * @return RTEMS directive status codes: |
|
202 | * @return RTEMS directive status codes: | |
247 | * - RTEMS_SUCCESSFUL - task created successfully |
|
203 | * - RTEMS_SUCCESSFUL - task created successfully | |
248 | * - RTEMS_INVALID_ADDRESS - id is NULL |
|
204 | * - RTEMS_INVALID_ADDRESS - id is NULL | |
249 | * - RTEMS_INVALID_NAME - invalid task name |
|
205 | * - RTEMS_INVALID_NAME - invalid task name | |
250 | * - RTEMS_INVALID_PRIORITY - invalid task priority |
|
206 | * - RTEMS_INVALID_PRIORITY - invalid task priority | |
251 | * - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured |
|
207 | * - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured | |
252 | * - RTEMS_TOO_MANY - too many tasks created |
|
208 | * - RTEMS_TOO_MANY - too many tasks created | |
253 | * - RTEMS_UNSATISFIED - not enough memory for stack/FP context |
|
209 | * - RTEMS_UNSATISFIED - not enough memory for stack/FP context | |
254 | * - RTEMS_TOO_MANY - too many global objects |
|
210 | * - RTEMS_TOO_MANY - too many global objects | |
255 | * |
|
211 | * | |
256 | */ |
|
212 | */ | |
257 |
|
213 | |||
258 | rtems_status_code status; |
|
214 | rtems_status_code status; | |
259 |
|
215 | |||
260 | //********** |
|
216 | //********** | |
261 | // SPACEWIRE |
|
217 | // SPACEWIRE | |
262 | // RECV |
|
218 | // RECV | |
263 | status = rtems_task_create( |
|
219 | status = rtems_task_create( | |
264 | Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE, |
|
220 | Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE, | |
265 | RTEMS_DEFAULT_MODES, |
|
221 | RTEMS_DEFAULT_MODES, | |
266 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV] |
|
222 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV] | |
267 | ); |
|
223 | ); | |
268 | if (status == RTEMS_SUCCESSFUL) // SEND |
|
224 | if (status == RTEMS_SUCCESSFUL) // SEND | |
269 | { |
|
225 | { | |
270 | status = rtems_task_create( |
|
226 | status = rtems_task_create( | |
271 | Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE, |
|
227 | Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE, | |
272 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
228 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, | |
273 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SEND] |
|
229 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SEND] | |
274 | ); |
|
230 | ); | |
275 | } |
|
231 | } | |
276 | if (status == RTEMS_SUCCESSFUL) // WTDG |
|
232 | if (status == RTEMS_SUCCESSFUL) // WTDG | |
277 | { |
|
233 | { | |
278 | status = rtems_task_create( |
|
234 | status = rtems_task_create( | |
279 | Task_name[TASKID_WTDG], TASK_PRIORITY_WTDG, RTEMS_MINIMUM_STACK_SIZE, |
|
235 | Task_name[TASKID_WTDG], TASK_PRIORITY_WTDG, RTEMS_MINIMUM_STACK_SIZE, | |
280 | RTEMS_DEFAULT_MODES, |
|
236 | RTEMS_DEFAULT_MODES, | |
281 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_WTDG] |
|
237 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_WTDG] | |
282 | ); |
|
238 | ); | |
283 | } |
|
239 | } | |
284 |
if (status == RTEMS_SUCCESSFUL) // ACT |
|
240 | if (status == RTEMS_SUCCESSFUL) // ACT_ | |
285 | { |
|
241 | { | |
286 | status = rtems_task_create( |
|
242 | status = rtems_task_create( | |
287 |
|
|
243 | rtems_id_act_, TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE, | |
288 | RTEMS_DEFAULT_MODES, |
|
244 | RTEMS_DEFAULT_MODES, | |
289 |
RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, & |
|
245 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &rtems_id_act_ | |
290 | ); |
|
246 | ); | |
291 | } |
|
247 | } | |
292 | if (status == RTEMS_SUCCESSFUL) // SPIQ |
|
248 | if (status == RTEMS_SUCCESSFUL) // SPIQ | |
293 | { |
|
249 | { | |
294 | status = rtems_task_create( |
|
250 | status = rtems_task_create( | |
295 | Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE, |
|
251 | Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE, | |
296 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
252 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, | |
297 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ] |
|
253 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ] | |
298 | ); |
|
254 | ); | |
299 | } |
|
255 | } | |
300 |
|
256 | |||
301 | //***** |
|
257 | //***** | |
302 | // MISC |
|
258 | // MISC | |
303 | if (status == RTEMS_SUCCESSFUL) // STAT |
|
259 | if (status == RTEMS_SUCCESSFUL) // STAT | |
304 | { |
|
260 | { | |
305 | status = rtems_task_create( |
|
261 | status = rtems_task_create( | |
306 | Task_name[TASKID_STAT], TASK_PRIORITY_STAT, RTEMS_MINIMUM_STACK_SIZE, |
|
262 | Task_name[TASKID_STAT], TASK_PRIORITY_STAT, RTEMS_MINIMUM_STACK_SIZE, | |
307 | RTEMS_DEFAULT_MODES, |
|
263 | RTEMS_DEFAULT_MODES, | |
308 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT] |
|
264 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT] | |
309 | ); |
|
265 | ); | |
310 | } |
|
266 | } | |
311 | if (status == RTEMS_SUCCESSFUL) // DUMB |
|
267 | if (status == RTEMS_SUCCESSFUL) // DUMB | |
312 | { |
|
268 | { | |
313 | status = rtems_task_create( |
|
269 | status = rtems_task_create( | |
314 | Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE, |
|
270 | Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE, | |
315 | RTEMS_DEFAULT_MODES, |
|
271 | RTEMS_DEFAULT_MODES, | |
316 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB] |
|
272 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB] | |
317 | ); |
|
273 | ); | |
318 | } |
|
274 | } | |
319 | if (status == RTEMS_SUCCESSFUL) // UPDT |
|
275 | if (status == RTEMS_SUCCESSFUL) // UPDT | |
320 | { |
|
276 | { | |
321 | status = rtems_task_create( |
|
277 | status = rtems_task_create( | |
322 | rtems_name_updt, TASK_PRIORITY_UPDT, RTEMS_MINIMUM_STACK_SIZE, |
|
278 | rtems_name_updt, TASK_PRIORITY_UPDT, RTEMS_MINIMUM_STACK_SIZE, | |
323 | RTEMS_DEFAULT_MODES, |
|
279 | RTEMS_DEFAULT_MODES, | |
324 | RTEMS_DEFAULT_ATTRIBUTES, &rtems_id_updt |
|
280 | RTEMS_DEFAULT_ATTRIBUTES, &rtems_id_updt | |
325 | ); |
|
281 | ); | |
326 | } |
|
282 | } | |
327 |
|
283 | |||
328 | return status; |
|
284 | return status; | |
329 | } |
|
285 | } | |
330 |
|
286 | |||
331 | int start_recv_send_tasks( void ) |
|
287 | int start_recv_send_tasks( void ) | |
332 | { |
|
288 | { | |
333 | rtems_status_code status; |
|
289 | rtems_status_code status; | |
334 |
|
290 | |||
335 | status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 ); |
|
291 | status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 ); | |
336 | if (status!=RTEMS_SUCCESSFUL) { |
|
292 | if (status!=RTEMS_SUCCESSFUL) { | |
337 | BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n") |
|
293 | BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n") | |
338 | } |
|
294 | } | |
339 |
|
295 | |||
340 | if (status == RTEMS_SUCCESSFUL) // SEND |
|
296 | if (status == RTEMS_SUCCESSFUL) // SEND | |
341 | { |
|
297 | { | |
342 | status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 ); |
|
298 | status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 ); | |
343 | if (status!=RTEMS_SUCCESSFUL) { |
|
299 | if (status!=RTEMS_SUCCESSFUL) { | |
344 | BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n") |
|
300 | BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n") | |
345 | } |
|
301 | } | |
346 | } |
|
302 | } | |
347 |
|
303 | |||
348 | return status; |
|
304 | return status; | |
349 | } |
|
305 | } | |
350 |
|
306 | |||
351 | int start_all_tasks( void ) // start all tasks except SEND RECV and HOUS |
|
307 | int start_all_tasks( void ) // start all tasks except SEND RECV and HOUS | |
352 | { |
|
308 | { | |
353 | /** This function starts all RTEMS tasks used in the software. |
|
309 | /** This function starts all RTEMS tasks used in the software. | |
354 | * |
|
310 | * | |
355 | * @return RTEMS directive status codes: |
|
311 | * @return RTEMS directive status codes: | |
356 | * - RTEMS_SUCCESSFUL - ask started successfully |
|
312 | * - RTEMS_SUCCESSFUL - ask started successfully | |
357 | * - RTEMS_INVALID_ADDRESS - invalid task entry point |
|
313 | * - RTEMS_INVALID_ADDRESS - invalid task entry point | |
358 | * - RTEMS_INVALID_ID - invalid task id |
|
314 | * - RTEMS_INVALID_ID - invalid task id | |
359 | * - RTEMS_INCORRECT_STATE - task not in the dormant state |
|
315 | * - RTEMS_INCORRECT_STATE - task not in the dormant state | |
360 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot start remote task |
|
316 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot start remote task | |
361 | * |
|
317 | * | |
362 | */ |
|
318 | */ | |
363 | // starts all the tasks fot eh flight software |
|
319 | // starts all the tasks fot eh flight software | |
364 |
|
320 | |||
365 | rtems_status_code status; |
|
321 | rtems_status_code status; | |
366 |
|
322 | |||
367 | //********** |
|
323 | //********** | |
368 | // SPACEWIRE |
|
324 | // SPACEWIRE | |
369 | status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 ); |
|
325 | status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 ); | |
370 | if (status!=RTEMS_SUCCESSFUL) { |
|
326 | if (status!=RTEMS_SUCCESSFUL) { | |
371 | BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n") |
|
327 | BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n") | |
372 | } |
|
328 | } | |
373 |
|
329 | |||
374 | if (status == RTEMS_SUCCESSFUL) // WTDG |
|
330 | if (status == RTEMS_SUCCESSFUL) // WTDG | |
375 | { |
|
331 | { | |
376 | status = rtems_task_start( Task_id[TASKID_WTDG], wtdg_task, 1 ); |
|
332 | status = rtems_task_start( Task_id[TASKID_WTDG], wtdg_task, 1 ); | |
377 | if (status!=RTEMS_SUCCESSFUL) { |
|
333 | if (status!=RTEMS_SUCCESSFUL) { | |
378 | BOOT_PRINTF("in INIT *** Error starting TASK_WTDG\n") |
|
334 | BOOT_PRINTF("in INIT *** Error starting TASK_WTDG\n") | |
379 | } |
|
335 | } | |
380 | } |
|
336 | } | |
381 |
|
337 | |||
382 |
if (status == RTEMS_SUCCESSFUL) // ACT |
|
338 | if (status == RTEMS_SUCCESSFUL) // ACT_ | |
383 | { |
|
339 | { | |
384 |
status = rtems_task_start( |
|
340 | status = rtems_task_start( rtems_id_act_, act__task, 1 ); | |
385 | if (status!=RTEMS_SUCCESSFUL) { |
|
341 | if (status!=RTEMS_SUCCESSFUL) { | |
386 |
BOOT_PRINTF("in INIT *** Error starting TASK_ACT |
|
342 | BOOT_PRINTF("in INIT *** Error starting TASK_ACT_\n") | |
387 | } |
|
343 | } | |
388 | } |
|
344 | } | |
389 |
|
345 | |||
390 | //***** |
|
346 | //***** | |
391 | // MISC |
|
347 | // MISC | |
392 | if (status == RTEMS_SUCCESSFUL) // DUMB |
|
348 | if (status == RTEMS_SUCCESSFUL) // DUMB | |
393 | { |
|
349 | { | |
394 | status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 ); |
|
350 | status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 ); | |
395 | if (status!=RTEMS_SUCCESSFUL) { |
|
351 | if (status!=RTEMS_SUCCESSFUL) { | |
396 | BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n") |
|
352 | BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n") | |
397 | } |
|
353 | } | |
398 | } |
|
354 | } | |
399 |
|
355 | |||
400 | if (status == RTEMS_SUCCESSFUL) // STAT |
|
356 | if (status == RTEMS_SUCCESSFUL) // STAT | |
401 | { |
|
357 | { | |
402 | status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 ); |
|
358 | status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 ); | |
403 | if (status!=RTEMS_SUCCESSFUL) { |
|
359 | if (status!=RTEMS_SUCCESSFUL) { | |
404 | BOOT_PRINTF("in INIT *** Error starting TASK_STAT\n") |
|
360 | BOOT_PRINTF("in INIT *** Error starting TASK_STAT\n") | |
405 | } |
|
361 | } | |
406 | } |
|
362 | } | |
407 |
|
363 | |||
408 | if (status == RTEMS_SUCCESSFUL) // UPDT |
|
364 | if (status == RTEMS_SUCCESSFUL) // UPDT | |
409 | { |
|
365 | { | |
410 | status = rtems_task_start( rtems_id_updt, updt_task, 1 ); |
|
366 | status = rtems_task_start( rtems_id_updt, updt_task, 1 ); | |
411 | if (status!=RTEMS_SUCCESSFUL) { |
|
367 | if (status!=RTEMS_SUCCESSFUL) { | |
412 | BOOT_PRINTF("in INIT *** Error starting TASK_UPDT\n") |
|
368 | BOOT_PRINTF("in INIT *** Error starting TASK_UPDT\n") | |
413 | } |
|
369 | } | |
414 | } |
|
370 | } | |
415 |
|
371 | |||
416 | return status; |
|
372 | return status; | |
417 | } |
|
373 | } | |
418 |
|
374 | |||
419 | rtems_status_code create_message_queues( void ) // create the two message queues used in the software |
|
375 | rtems_status_code create_message_queues( void ) // create the two message queues used in the software | |
420 | { |
|
376 | { | |
421 | rtems_status_code status_recv; |
|
377 | rtems_status_code status_recv; | |
422 | rtems_status_code status_send; |
|
378 | rtems_status_code status_send; | |
423 | rtems_status_code ret; |
|
379 | rtems_status_code ret; | |
424 | rtems_id queue_id; |
|
380 | rtems_id queue_id; | |
425 |
|
381 | |||
426 | // create the queue for handling valid TCs |
|
382 | // create the queue for handling valid TCs | |
427 | status_recv = rtems_message_queue_create( misc_name[QUEUE_RECV], |
|
383 | status_recv = rtems_message_queue_create( misc_name[QUEUE_RECV], | |
428 |
|
|
384 | MSG_QUEUE_COUNT_RECV, CCSDS_TC_PKT_MAX_SIZE, | |
429 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); |
|
385 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); | |
430 | if ( status_recv != RTEMS_SUCCESSFUL ) { |
|
386 | if ( status_recv != RTEMS_SUCCESSFUL ) { | |
431 | PRINTF1("in create_message_queues *** ERR creating QUEU queue, %d\n", status_recv) |
|
387 | PRINTF1("in create_message_queues *** ERR creating QUEU queue, %d\n", status_recv) | |
432 | } |
|
388 | } | |
433 |
|
389 | |||
434 | // create the queue for handling TM packet sending |
|
390 | // create the queue for handling TM packet sending | |
435 | status_send = rtems_message_queue_create( misc_name[QUEUE_SEND], |
|
391 | status_send = rtems_message_queue_create( misc_name[QUEUE_SEND], | |
436 |
|
|
392 | MSG_QUEUE_COUNT_SEND, MSG_QUEUE_SIZE_SEND, | |
437 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); |
|
393 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); | |
438 | if ( status_send != RTEMS_SUCCESSFUL ) { |
|
394 | if ( status_send != RTEMS_SUCCESSFUL ) { | |
439 | PRINTF1("in create_message_queues *** ERR creating PKTS queue, %d\n", status_send) |
|
395 | PRINTF1("in create_message_queues *** ERR creating PKTS queue, %d\n", status_send) | |
440 | } |
|
396 | } | |
441 |
|
397 | |||
442 | if ( status_recv != RTEMS_SUCCESSFUL ) |
|
398 | if ( status_recv != RTEMS_SUCCESSFUL ) | |
443 | { |
|
399 | { | |
444 | ret = status_recv; |
|
400 | ret = status_recv; | |
445 | } |
|
401 | } | |
446 | else |
|
402 | else | |
447 | { |
|
403 | { | |
448 | ret = status_send; |
|
404 | ret = status_send; | |
449 | } |
|
405 | } | |
450 |
|
406 | |||
451 | return ret; |
|
407 | return ret; | |
452 | } |
|
408 | } | |
453 |
|
409 | |||
454 | rtems_status_code get_message_queue_id_send( rtems_id *queue_id ) |
|
410 | rtems_status_code get_message_queue_id_send( rtems_id *queue_id ) | |
455 | { |
|
411 | { | |
456 | rtems_status_code status; |
|
412 | rtems_status_code status; | |
457 | rtems_name queue_name; |
|
413 | rtems_name queue_name; | |
458 |
|
414 | |||
459 | queue_name = rtems_build_name( 'Q', '_', 'S', 'D' ); |
|
415 | queue_name = rtems_build_name( 'Q', '_', 'S', 'D' ); | |
460 |
|
416 | |||
461 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); |
|
417 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); | |
462 |
|
418 | |||
463 | return status; |
|
419 | return status; | |
464 | } |
|
420 | } | |
465 |
|
421 | |||
466 | rtems_status_code get_message_queue_id_recv( rtems_id *queue_id ) |
|
422 | rtems_status_code get_message_queue_id_recv( rtems_id *queue_id ) | |
467 | { |
|
423 | { | |
468 | rtems_status_code status; |
|
424 | rtems_status_code status; | |
469 | rtems_name queue_name; |
|
425 | rtems_name queue_name; | |
470 |
|
426 | |||
471 | queue_name = rtems_build_name( 'Q', '_', 'R', 'V' ); |
|
427 | queue_name = rtems_build_name( 'Q', '_', 'R', 'V' ); | |
472 |
|
428 | |||
473 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); |
|
429 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); | |
474 |
|
430 | |||
475 | return status; |
|
431 | return status; | |
476 | } |
|
432 | } |
@@ -1,601 +1,123 | |||||
1 | /** Functions related to the SpaceWire interface. |
|
1 | /** Functions related to the SpaceWire interface. | |
2 | * |
|
2 | * | |
3 | * @file |
|
3 | * @file | |
4 | * @author P. LEROY |
|
4 | * @author P. LEROY | |
5 | * |
|
5 | * | |
6 | * A group of functions to handle SpaceWire transmissions: |
|
6 | * A group of functions to handle SpaceWire transmissions: | |
7 | * - configuration of the SpaceWire link |
|
7 | * - configuration of the SpaceWire link | |
8 | * - SpaceWire related interruption requests processing |
|
8 | * - SpaceWire related interruption requests processing | |
9 | * - transmission of TeleMetry packets by a dedicated RTEMS task |
|
9 | * - transmission of TeleMetry packets by a dedicated RTEMS task | |
10 | * - reception of TeleCommands by a dedicated RTEMS task |
|
10 | * - reception of TeleCommands by a dedicated RTEMS task | |
11 | * |
|
11 | * | |
12 | */ |
|
12 | */ | |
13 |
|
13 | |||
14 | #include "timegen_spacewire.h" |
|
14 | #include "timegen_spacewire.h" | |
15 |
|
15 | |||
16 | rtems_name semq_name; |
|
16 | rtems_name semq_name; | |
17 | rtems_id semq_id; |
|
17 | rtems_id semq_id; | |
18 |
|
18 | |||
19 | //*********** |
|
19 | //*********** | |
20 | // RTEMS TASK |
|
20 | // RTEMS TASK | |
21 | rtems_task spiq_task(rtems_task_argument unused) |
|
21 | rtems_task spiq_task(rtems_task_argument unused) | |
22 | { |
|
22 | { | |
23 | /** This RTEMS task is awaken by an rtems_event sent by the interruption subroutine of the SpaceWire driver. |
|
23 | /** This RTEMS task is awaken by an rtems_event sent by the interruption subroutine of the SpaceWire driver. | |
24 | * |
|
24 | * | |
25 | * @param unused is the starting argument of the RTEMS task |
|
25 | * @param unused is the starting argument of the RTEMS task | |
26 | * |
|
26 | * | |
27 | */ |
|
27 | */ | |
28 |
|
28 | |||
29 | rtems_event_set event_out; |
|
29 | rtems_event_set event_out; | |
30 | rtems_status_code status; |
|
30 | rtems_status_code status; | |
31 | int linkStatus; |
|
31 | int linkStatus; | |
32 |
|
32 | |||
33 | BOOT_PRINTF("in SPIQ *** \n") |
|
33 | BOOT_PRINTF("in SPIQ *** \n") | |
34 |
|
34 | |||
35 | while(true){ |
|
35 | while(true){ | |
36 | rtems_event_receive(SPW_LINKERR_EVENT, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an SPW_LINKERR_EVENT |
|
36 | rtems_event_receive(SPW_LINKERR_EVENT, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an SPW_LINKERR_EVENT | |
37 | PRINTF("in SPIQ *** got SPW_LINKERR_EVENT\n") |
|
37 | PRINTF("in SPIQ *** got SPW_LINKERR_EVENT\n") | |
38 |
|
38 | |||
39 | // [0] SUSPEND RECV AND SEND TASKS |
|
39 | // [0] SUSPEND RECV AND SEND TASKS | |
40 | status = rtems_task_suspend( Task_id[ TASKID_RECV ] ); |
|
40 | status = rtems_task_suspend( Task_id[ TASKID_RECV ] ); | |
41 | if ( status != RTEMS_SUCCESSFUL ) { |
|
41 | if ( status != RTEMS_SUCCESSFUL ) { | |
42 | PRINTF("in SPIQ *** ERR suspending RECV Task\n") |
|
42 | PRINTF("in SPIQ *** ERR suspending RECV Task\n") | |
43 | } |
|
43 | } | |
44 | status = rtems_task_suspend( Task_id[ TASKID_SEND ] ); |
|
44 | status = rtems_task_suspend( Task_id[ TASKID_SEND ] ); | |
45 | if ( status != RTEMS_SUCCESSFUL ) { |
|
45 | if ( status != RTEMS_SUCCESSFUL ) { | |
46 | PRINTF("in SPIQ *** ERR suspending SEND Task\n") |
|
46 | PRINTF("in SPIQ *** ERR suspending SEND Task\n") | |
47 | } |
|
47 | } | |
48 |
|
48 | |||
49 | // [1] CHECK THE LINK |
|
49 | // [1] CHECK THE LINK | |
50 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status (1) |
|
50 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status (1) | |
51 | if ( linkStatus != 5) { |
|
51 | if ( linkStatus != 5) { | |
52 | PRINTF1("in SPIQ *** linkStatus %d, wait...\n", linkStatus) |
|
52 | PRINTF1("in SPIQ *** linkStatus %d, wait...\n", linkStatus) | |
53 | status = rtems_task_wake_after( SY_LFR_DPU_CONNECT_TIMEOUT ); // wait SY_LFR_DPU_CONNECT_TIMEOUT 1000 ms |
|
53 | status = rtems_task_wake_after( SY_LFR_DPU_CONNECT_TIMEOUT ); // wait SY_LFR_DPU_CONNECT_TIMEOUT 1000 ms | |
54 | } |
|
54 | } | |
55 |
|
55 | |||
56 | // [2] RECHECK THE LINK AFTER SY_LFR_DPU_CONNECT_TIMEOUT |
|
56 | // [2] RECHECK THE LINK AFTER SY_LFR_DPU_CONNECT_TIMEOUT | |
57 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status (2) |
|
57 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status (2) | |
58 | if ( linkStatus != 5 ) // [2.a] not in run state, reset the link |
|
58 | if ( linkStatus != 5 ) // [2.a] not in run state, reset the link | |
59 | { |
|
59 | { | |
60 | spacewire_compute_stats_offsets(); |
|
60 | spacewire_compute_stats_offsets(); | |
61 | status = spacewire_reset_link( ); |
|
61 | status = spacewire_reset_link( ); | |
62 | } |
|
62 | } | |
63 | else // [2.b] in run state, start the link |
|
63 | else // [2.b] in run state, start the link | |
64 | { |
|
64 | { | |
65 | status = spacewire_stop_start_link( fdSPW ); // start the link |
|
65 | status = spacewire_stop_start_link( fdSPW ); // start the link | |
66 | if ( status != RTEMS_SUCCESSFUL) |
|
66 | if ( status != RTEMS_SUCCESSFUL) | |
67 | { |
|
67 | { | |
68 | PRINTF1("in SPIQ *** ERR spacewire_start_link %d\n", status) |
|
68 | PRINTF1("in SPIQ *** ERR spacewire_start_link %d\n", status) | |
69 | } |
|
69 | } | |
70 | } |
|
70 | } | |
71 |
|
71 | |||
72 | // [3] COMPLETE RECOVERY ACTION AFTER SY_LFR_DPU_CONNECT_ATTEMPTS |
|
72 | // [3] COMPLETE RECOVERY ACTION AFTER SY_LFR_DPU_CONNECT_ATTEMPTS | |
73 | if ( status == RTEMS_SUCCESSFUL ) // [3.a] the link is in run state and has been started successfully |
|
73 | if ( status == RTEMS_SUCCESSFUL ) // [3.a] the link is in run state and has been started successfully | |
74 | { |
|
74 | { | |
75 | status = rtems_task_restart( Task_id[ TASKID_SEND ], 1 ); |
|
75 | status = rtems_task_restart( Task_id[ TASKID_SEND ], 1 ); | |
76 | if ( status != RTEMS_SUCCESSFUL ) { |
|
76 | if ( status != RTEMS_SUCCESSFUL ) { | |
77 | PRINTF("in SPIQ *** ERR resuming SEND Task\n") |
|
77 | PRINTF("in SPIQ *** ERR resuming SEND Task\n") | |
78 | } |
|
78 | } | |
79 | status = rtems_task_restart( Task_id[ TASKID_RECV ], 1 ); |
|
79 | status = rtems_task_restart( Task_id[ TASKID_RECV ], 1 ); | |
80 | if ( status != RTEMS_SUCCESSFUL ) { |
|
80 | if ( status != RTEMS_SUCCESSFUL ) { | |
81 | PRINTF("in SPIQ *** ERR resuming RECV Task\n") |
|
81 | PRINTF("in SPIQ *** ERR resuming RECV Task\n") | |
82 | } |
|
82 | } | |
83 | } |
|
83 | } | |
84 | else // [3.b] the link is not in run state, go in STANDBY mode |
|
84 | else // [3.b] the link is not in run state, go in STANDBY mode | |
85 | { |
|
85 | { | |
86 | status = stop_current_mode(); |
|
|||
87 | if ( status != RTEMS_SUCCESSFUL ) { |
|
|||
88 | PRINTF1("in SPIQ *** ERR stop_current_mode *** code %d\n", status) |
|
|||
89 | } |
|
|||
90 | status = enter_mode( LFR_MODE_STANDBY ); |
|
|||
91 | if ( status != RTEMS_SUCCESSFUL ) { |
|
|||
92 | PRINTF1("in SPIQ *** ERR enter_standby_mode *** code %d\n", status) |
|
|||
93 | } |
|
|||
94 | // wake the WTDG task up to wait for the link recovery |
|
86 | // wake the WTDG task up to wait for the link recovery | |
95 | status = rtems_event_send ( Task_id[TASKID_WTDG], RTEMS_EVENT_0 ); |
|
87 | status = rtems_event_send ( Task_id[TASKID_WTDG], RTEMS_EVENT_0 ); | |
96 | status = rtems_task_suspend( RTEMS_SELF ); |
|
88 | status = rtems_task_suspend( RTEMS_SELF ); | |
97 | } |
|
89 | } | |
98 | } |
|
90 | } | |
99 | } |
|
91 | } | |
100 |
|
92 | |||
101 | rtems_task recv_task( rtems_task_argument unused ) |
|
|||
102 | { |
|
|||
103 | /** This RTEMS task is dedicated to the reception of incoming TeleCommands. |
|
|||
104 | * |
|
|||
105 | * @param unused is the starting argument of the RTEMS task |
|
|||
106 | * |
|
|||
107 | * The RECV task blocks on a call to the read system call, waiting for incoming SpaceWire data. When unblocked: |
|
|||
108 | * 1. It reads the incoming data. |
|
|||
109 | * 2. Launches the acceptance procedure. |
|
|||
110 | * 3. If the Telecommand is valid, sends it to a dedicated RTEMS message queue. |
|
|||
111 | * |
|
|||
112 | */ |
|
|||
113 |
|
||||
114 | int len; |
|
|||
115 | ccsdsTelecommandPacket_t currentTC; |
|
|||
116 | unsigned char computed_CRC[ 2 ]; |
|
|||
117 | unsigned char currentTC_LEN_RCV[ 2 ]; |
|
|||
118 | unsigned char destinationID; |
|
|||
119 | unsigned int currentTC_LEN_RCV_AsUnsignedInt; |
|
|||
120 | unsigned int parserCode; |
|
|||
121 | unsigned char time[6]; |
|
|||
122 | rtems_status_code status; |
|
|||
123 | rtems_id queue_recv_id; |
|
|||
124 | rtems_id queue_send_id; |
|
|||
125 |
|
||||
126 | initLookUpTableForCRC(); // the table is used to compute Cyclic Redundancy Codes |
|
|||
127 |
|
||||
128 | status = get_message_queue_id_recv( &queue_recv_id ); |
|
|||
129 | if (status != RTEMS_SUCCESSFUL) |
|
|||
130 | { |
|
|||
131 | PRINTF1("in RECV *** ERR get_message_queue_id_recv %d\n", status) |
|
|||
132 | } |
|
|||
133 |
|
||||
134 | status = get_message_queue_id_send( &queue_send_id ); |
|
|||
135 | if (status != RTEMS_SUCCESSFUL) |
|
|||
136 | { |
|
|||
137 | PRINTF1("in RECV *** ERR get_message_queue_id_send %d\n", status) |
|
|||
138 | } |
|
|||
139 |
|
||||
140 | BOOT_PRINTF("in RECV *** \n") |
|
|||
141 |
|
||||
142 | while(1) |
|
|||
143 | { |
|
|||
144 | len = read( fdSPW, (char*) ¤tTC, CCSDS_TC_PKT_MAX_SIZE ); // the call to read is blocking |
|
|||
145 | if (len == -1){ // error during the read call |
|
|||
146 | PRINTF1("in RECV *** last read call returned -1, ERRNO %d\n", errno) |
|
|||
147 | } |
|
|||
148 | else { |
|
|||
149 | if ( (len+1) < CCSDS_TC_PKT_MIN_SIZE ) { |
|
|||
150 | PRINTF("in RECV *** packet lenght too short\n") |
|
|||
151 | } |
|
|||
152 | else { |
|
|||
153 | currentTC_LEN_RCV_AsUnsignedInt = (unsigned int) (len - CCSDS_TC_TM_PACKET_OFFSET - 3); // => -3 is for Prot ID, Reserved and User App bytes |
|
|||
154 | currentTC_LEN_RCV[ 0 ] = (unsigned char) (currentTC_LEN_RCV_AsUnsignedInt >> 8); |
|
|||
155 | currentTC_LEN_RCV[ 1 ] = (unsigned char) (currentTC_LEN_RCV_AsUnsignedInt ); |
|
|||
156 | // CHECK THE TC |
|
|||
157 | parserCode = tc_parser( ¤tTC, currentTC_LEN_RCV_AsUnsignedInt, computed_CRC ) ; |
|
|||
158 | if ( (parserCode == ILLEGAL_APID) || (parserCode == WRONG_LEN_PKT) |
|
|||
159 | || (parserCode == INCOR_CHECKSUM) || (parserCode == ILL_TYPE) |
|
|||
160 | || (parserCode == ILL_SUBTYPE) || (parserCode == WRONG_APP_DATA) |
|
|||
161 | || (parserCode == WRONG_SRC_ID) ) |
|
|||
162 | { // send TM_LFR_TC_EXE_CORRUPTED |
|
|||
163 | if ( !( (currentTC.serviceType==TC_TYPE_TIME) && (currentTC.serviceSubType==TC_SUBTYPE_UPDT_TIME) ) |
|
|||
164 | && |
|
|||
165 | !( (currentTC.serviceType==TC_TYPE_GEN) && (currentTC.serviceSubType==TC_SUBTYPE_UPDT_INFO)) |
|
|||
166 | ) |
|
|||
167 | { |
|
|||
168 | if ( parserCode == WRONG_SRC_ID ) |
|
|||
169 | { |
|
|||
170 | destinationID = SID_TC_GROUND; |
|
|||
171 | } |
|
|||
172 | else |
|
|||
173 | { |
|
|||
174 | destinationID = currentTC.sourceID; |
|
|||
175 | } |
|
|||
176 | getTime( time ); |
|
|||
177 | close_action( ¤tTC, LFR_DEFAULT, queue_send_id ); |
|
|||
178 | send_tm_lfr_tc_exe_corrupted( ¤tTC, queue_send_id, |
|
|||
179 | computed_CRC, currentTC_LEN_RCV, |
|
|||
180 | destinationID ); |
|
|||
181 | } |
|
|||
182 | } |
|
|||
183 | else |
|
|||
184 | { // send valid TC to the action launcher |
|
|||
185 | status = rtems_message_queue_send( queue_recv_id, ¤tTC, |
|
|||
186 | currentTC_LEN_RCV_AsUnsignedInt + CCSDS_TC_TM_PACKET_OFFSET + 3); |
|
|||
187 | } |
|
|||
188 | } |
|
|||
189 | } |
|
|||
190 | } |
|
|||
191 | } |
|
|||
192 |
|
||||
193 | rtems_task send_task( rtems_task_argument argument) |
|
|||
194 | { |
|
|||
195 | /** This RTEMS task is dedicated to the transmission of TeleMetry packets. |
|
|||
196 | * |
|
|||
197 | * @param unused is the starting argument of the RTEMS task |
|
|||
198 | * |
|
|||
199 | * The SEND task waits for a message to become available in the dedicated RTEMS queue. When a message arrives: |
|
|||
200 | * - if the first byte is equal to CCSDS_DESTINATION_ID, the message is sent as is using the write system call. |
|
|||
201 | * - if the first byte is not equal to CCSDS_DESTINATION_ID, the message is handled as a spw_ioctl_pkt_send. After |
|
|||
202 | * analyzis, the packet is sent either using the write system call or using the ioctl call SPACEWIRE_IOCTRL_SEND, depending on the |
|
|||
203 | * data it contains. |
|
|||
204 | * |
|
|||
205 | */ |
|
|||
206 |
|
||||
207 | rtems_status_code status; // RTEMS status code |
|
|||
208 | char incomingData[ACTION_MSG_PKTS_MAX_SIZE]; // incoming data buffer |
|
|||
209 | size_t size; // size of the incoming TC packet |
|
|||
210 | u_int32_t count; |
|
|||
211 | rtems_id queue_id; |
|
|||
212 |
|
||||
213 | status = get_message_queue_id_send( &queue_id ); |
|
|||
214 | if (status != RTEMS_SUCCESSFUL) |
|
|||
215 | { |
|
|||
216 | PRINTF1("in HOUS *** ERR get_message_queue_id_send %d\n", status) |
|
|||
217 | } |
|
|||
218 |
|
||||
219 | BOOT_PRINTF("in SEND *** \n") |
|
|||
220 |
|
||||
221 | while(1) |
|
|||
222 | { |
|
|||
223 | status = rtems_message_queue_receive( queue_id, incomingData, &size, |
|
|||
224 | RTEMS_WAIT, RTEMS_NO_TIMEOUT ); |
|
|||
225 |
|
||||
226 | if (status!=RTEMS_SUCCESSFUL) |
|
|||
227 | { |
|
|||
228 | PRINTF1("in SEND *** (1) ERR = %d\n", status) |
|
|||
229 | } |
|
|||
230 | else |
|
|||
231 | { |
|
|||
232 | status = write( fdSPW, incomingData, size ); |
|
|||
233 | if (status == -1){ |
|
|||
234 | PRINTF2("in SEND *** (2.a) ERRNO = %d, size = %d\n", errno, size) |
|
|||
235 | } |
|
|||
236 | } |
|
|||
237 |
|
||||
238 | status = rtems_message_queue_get_number_pending( queue_id, &count ); |
|
|||
239 | if (status != RTEMS_SUCCESSFUL) |
|
|||
240 | { |
|
|||
241 | PRINTF1("in SEND *** (3) ERR = %d\n", status) |
|
|||
242 | } |
|
|||
243 | else |
|
|||
244 | { |
|
|||
245 | if (count > maxCount) |
|
|||
246 | { |
|
|||
247 | maxCount = count; |
|
|||
248 | } |
|
|||
249 | } |
|
|||
250 | } |
|
|||
251 | } |
|
|||
252 |
|
||||
253 | rtems_task wtdg_task( rtems_task_argument argument ) |
|
|||
254 | { |
|
|||
255 | rtems_event_set event_out; |
|
|||
256 | rtems_status_code status; |
|
|||
257 | int linkStatus; |
|
|||
258 |
|
||||
259 | BOOT_PRINTF("in WTDG ***\n") |
|
|||
260 |
|
||||
261 | while(1) |
|
|||
262 | { |
|
|||
263 | // wait for an RTEMS_EVENT |
|
|||
264 | rtems_event_receive( RTEMS_EVENT_0, |
|
|||
265 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
|||
266 | PRINTF("in WTDG *** wait for the link\n") |
|
|||
267 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status |
|
|||
268 | while( linkStatus != 5) // wait for the link |
|
|||
269 | { |
|
|||
270 | rtems_task_wake_after( 10 ); |
|
|||
271 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status |
|
|||
272 | } |
|
|||
273 |
|
||||
274 | status = spacewire_stop_start_link( fdSPW ); |
|
|||
275 |
|
||||
276 | if (status != RTEMS_SUCCESSFUL) |
|
|||
277 | { |
|
|||
278 | PRINTF1("in WTDG *** ERR link not started %d\n", status) |
|
|||
279 | } |
|
|||
280 | else |
|
|||
281 | { |
|
|||
282 | PRINTF("in WTDG *** OK link started\n") |
|
|||
283 | } |
|
|||
284 |
|
||||
285 | // restart the SPIQ task |
|
|||
286 | status = rtems_task_restart( Task_id[TASKID_SPIQ], 1 ); |
|
|||
287 | if ( status != RTEMS_SUCCESSFUL ) { |
|
|||
288 | PRINTF("in SPIQ *** ERR restarting SPIQ Task\n") |
|
|||
289 | } |
|
|||
290 |
|
||||
291 | // restart RECV and SEND |
|
|||
292 | status = rtems_task_restart( Task_id[ TASKID_SEND ], 1 ); |
|
|||
293 | if ( status != RTEMS_SUCCESSFUL ) { |
|
|||
294 | PRINTF("in SPIQ *** ERR restarting SEND Task\n") |
|
|||
295 | } |
|
|||
296 | status = rtems_task_restart( Task_id[ TASKID_RECV ], 1 ); |
|
|||
297 | if ( status != RTEMS_SUCCESSFUL ) { |
|
|||
298 | PRINTF("in SPIQ *** ERR restarting RECV Task\n") |
|
|||
299 | } |
|
|||
300 | } |
|
|||
301 | } |
|
|||
302 |
|
||||
303 | //**************** |
|
|||
304 | // OTHER FUNCTIONS |
|
|||
305 | int spacewire_open_link( void ) |
|
|||
306 | { |
|
|||
307 | /** This function opens the SpaceWire link. |
|
|||
308 | * |
|
|||
309 | * @return a valid file descriptor in case of success, -1 in case of a failure |
|
|||
310 | * |
|
|||
311 | */ |
|
|||
312 | rtems_status_code status; |
|
|||
313 |
|
||||
314 | fdSPW = open(GRSPW_DEVICE_NAME, O_RDWR); // open the device. the open call resets the hardware |
|
|||
315 | if ( fdSPW < 0 ) { |
|
|||
316 | PRINTF1("ERR *** in configure_spw_link *** error opening "GRSPW_DEVICE_NAME" with ERR %d\n", errno) |
|
|||
317 | } |
|
|||
318 | else |
|
|||
319 | { |
|
|||
320 | status = RTEMS_SUCCESSFUL; |
|
|||
321 | } |
|
|||
322 |
|
||||
323 | return status; |
|
|||
324 | } |
|
|||
325 |
|
||||
326 | int spacewire_start_link( int fd ) |
|
|||
327 | { |
|
|||
328 | rtems_status_code status; |
|
|||
329 |
|
||||
330 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is started |
|
|||
331 | // -1 default hardcoded driver timeout |
|
|||
332 |
|
||||
333 | return status; |
|
|||
334 | } |
|
|||
335 |
|
||||
336 | int spacewire_stop_start_link( int fd ) |
|
|||
337 | { |
|
|||
338 | rtems_status_code status; |
|
|||
339 |
|
||||
340 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_STOP); // start fails if link pDev->running != 0 |
|
|||
341 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is started |
|
|||
342 | // -1 default hardcoded driver timeout |
|
|||
343 |
|
||||
344 | return status; |
|
|||
345 | } |
|
|||
346 |
|
||||
347 | int spacewire_configure_link( int fd ) |
|
|||
348 | { |
|
|||
349 | /** This function configures the SpaceWire link. |
|
|||
350 | * |
|
|||
351 | * @return GR-RTEMS-DRIVER directive status codes: |
|
|||
352 | * - 22 EINVAL - Null pointer or an out of range value was given as the argument. |
|
|||
353 | * - 16 EBUSY - Only used for SEND. Returned when no descriptors are avialble in non-blocking mode. |
|
|||
354 | * - 88 ENOSYS - Returned for SET_DESTKEY if RMAP command handler is not available or if a non-implemented call is used. |
|
|||
355 | * - 116 ETIMEDOUT - REturned for SET_PACKET_SIZE and START if the link could not be brought up. |
|
|||
356 | * - 12 ENOMEM - Returned for SET_PACKETSIZE if it was unable to allocate the new buffers. |
|
|||
357 | * - 5 EIO - Error when writing to grswp hardware registers. |
|
|||
358 | * - 2 ENOENT - No such file or directory |
|
|||
359 | */ |
|
|||
360 |
|
||||
361 | rtems_status_code status; |
|
|||
362 |
|
||||
363 | spacewire_set_NP(1, REGS_ADDR_GRSPW); // [N]o [P]ort force |
|
|||
364 | spacewire_set_RE(1, REGS_ADDR_GRSPW); // [R]MAP [E]nable, the dedicated call seems to break the no port force configuration |
|
|||
365 |
|
||||
366 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_RXBLOCK, 1); // sets the blocking mode for reception |
|
|||
367 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_RXBLOCK\n") |
|
|||
368 | // |
|
|||
369 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_EVENT_ID, Task_id[TASKID_SPIQ]); // sets the task ID to which an event is sent when a |
|
|||
370 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_EVENT_ID\n") // link-error interrupt occurs |
|
|||
371 | // |
|
|||
372 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_DISABLE_ERR, 0); // automatic link-disabling due to link-error interrupts |
|
|||
373 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_DISABLE_ERR\n") |
|
|||
374 | // |
|
|||
375 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ, 1); // sets the link-error interrupt bit |
|
|||
376 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ\n") |
|
|||
377 | // |
|
|||
378 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TXBLOCK, 0); // transmission blocks |
|
|||
379 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK\n") |
|
|||
380 | // |
|
|||
381 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL, 1); // transmission blocks when no transmission descriptor is available |
|
|||
382 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL\n") |
|
|||
383 | // |
|
|||
384 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TCODE_CTRL, 0x0909); // [Time Rx : Time Tx : Link error : Tick-out IRQ] |
|
|||
385 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TCODE_CTRL\n") |
|
|||
386 |
|
||||
387 | return status; |
|
|||
388 | } |
|
|||
389 |
|
||||
390 | int spacewire_reset_link( void ) |
|
|||
391 | { |
|
|||
392 | /** This function is executed by the SPIQ rtems_task wehn it has been awaken by an interruption raised by the SpaceWire driver. |
|
|||
393 | * |
|
|||
394 | * @return RTEMS directive status code: |
|
|||
395 | * - RTEMS_UNSATISFIED is returned is the link is not in the running state after 10 s. |
|
|||
396 | * - RTEMS_SUCCESSFUL is returned if the link is up before the timeout. |
|
|||
397 | * |
|
|||
398 | */ |
|
|||
399 |
|
||||
400 | rtems_status_code status_spw; |
|
|||
401 | int i; |
|
|||
402 |
|
||||
403 | for ( i=0; i<SY_LFR_DPU_CONNECT_ATTEMPT; i++ ) |
|
|||
404 | { |
|
|||
405 | PRINTF1("in spacewire_reset_link *** link recovery, try %d\n", i); |
|
|||
406 |
|
||||
407 | // CLOSING THE DRIVER AT THIS POINT WILL MAKE THE SEND TASK BLOCK THE SYSTEM |
|
|||
408 |
|
||||
409 | status_spw = spacewire_stop_start_link( fdSPW ); |
|
|||
410 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
|||
411 | { |
|
|||
412 | PRINTF1("in spacewire_reset_link *** ERR spacewire_start_link code %d\n", status_spw) |
|
|||
413 | } |
|
|||
414 |
|
||||
415 | if ( status_spw == RTEMS_SUCCESSFUL) |
|
|||
416 | { |
|
|||
417 | break; |
|
|||
418 | } |
|
|||
419 | } |
|
|||
420 |
|
||||
421 | return status_spw; |
|
|||
422 | } |
|
|||
423 |
|
||||
424 | void spacewire_set_NP( unsigned char val, unsigned int regAddr ) // [N]o [P]ort force |
|
|||
425 | { |
|
|||
426 | /** This function sets the [N]o [P]ort force bit of the GRSPW control register. |
|
|||
427 | * |
|
|||
428 | * @param val is the value, 0 or 1, used to set the value of the NP bit. |
|
|||
429 | * @param regAddr is the address of the GRSPW control register. |
|
|||
430 | * |
|
|||
431 | * NP is the bit 20 of the GRSPW control register. |
|
|||
432 | * |
|
|||
433 | */ |
|
|||
434 |
|
||||
435 | unsigned int *spwptr = (unsigned int*) regAddr; |
|
|||
436 |
|
||||
437 | if (val == 1) { |
|
|||
438 | *spwptr = *spwptr | 0x00100000; // [NP] set the No port force bit |
|
|||
439 | } |
|
|||
440 | if (val== 0) { |
|
|||
441 | *spwptr = *spwptr & 0xffdfffff; |
|
|||
442 | } |
|
|||
443 | } |
|
|||
444 |
|
||||
445 | void spacewire_set_RE( unsigned char val, unsigned int regAddr ) // [R]MAP [E]nable |
|
|||
446 | { |
|
|||
447 | /** This function sets the [R]MAP [E]nable bit of the GRSPW control register. |
|
|||
448 | * |
|
|||
449 | * @param val is the value, 0 or 1, used to set the value of the RE bit. |
|
|||
450 | * @param regAddr is the address of the GRSPW control register. |
|
|||
451 | * |
|
|||
452 | * RE is the bit 16 of the GRSPW control register. |
|
|||
453 | * |
|
|||
454 | */ |
|
|||
455 |
|
||||
456 | unsigned int *spwptr = (unsigned int*) regAddr; |
|
|||
457 |
|
||||
458 | if (val == 1) |
|
|||
459 | { |
|
|||
460 | *spwptr = *spwptr | 0x00010000; // [RE] set the RMAP Enable bit |
|
|||
461 | } |
|
|||
462 | if (val== 0) |
|
|||
463 | { |
|
|||
464 | *spwptr = *spwptr & 0xfffdffff; |
|
|||
465 | } |
|
|||
466 | } |
|
|||
467 |
|
||||
468 | void spacewire_compute_stats_offsets( void ) |
|
|||
469 | { |
|
|||
470 | /** This function computes the SpaceWire statistics offsets in case of a SpaceWire related interruption raising. |
|
|||
471 | * |
|
|||
472 | * The offsets keep a record of the statistics in case of a reset of the statistics. They are added to the current statistics |
|
|||
473 | * to keep the counters consistent even after a reset of the SpaceWire driver (the counter are set to zero by the driver when it |
|
|||
474 | * during the open systel call). |
|
|||
475 | * |
|
|||
476 | */ |
|
|||
477 |
|
||||
478 | spw_stats spacewire_stats_grspw; |
|
|||
479 | rtems_status_code status; |
|
|||
480 |
|
||||
481 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw ); |
|
|||
482 |
|
||||
483 | spacewire_stats_backup.packets_received = spacewire_stats_grspw.packets_received |
|
|||
484 | + spacewire_stats.packets_received; |
|
|||
485 | spacewire_stats_backup.packets_sent = spacewire_stats_grspw.packets_sent |
|
|||
486 | + spacewire_stats.packets_sent; |
|
|||
487 | spacewire_stats_backup.parity_err = spacewire_stats_grspw.parity_err |
|
|||
488 | + spacewire_stats.parity_err; |
|
|||
489 | spacewire_stats_backup.disconnect_err = spacewire_stats_grspw.disconnect_err |
|
|||
490 | + spacewire_stats.disconnect_err; |
|
|||
491 | spacewire_stats_backup.escape_err = spacewire_stats_grspw.escape_err |
|
|||
492 | + spacewire_stats.escape_err; |
|
|||
493 | spacewire_stats_backup.credit_err = spacewire_stats_grspw.credit_err |
|
|||
494 | + spacewire_stats.credit_err; |
|
|||
495 | spacewire_stats_backup.write_sync_err = spacewire_stats_grspw.write_sync_err |
|
|||
496 | + spacewire_stats.write_sync_err; |
|
|||
497 | spacewire_stats_backup.rx_rmap_header_crc_err = spacewire_stats_grspw.rx_rmap_header_crc_err |
|
|||
498 | + spacewire_stats.rx_rmap_header_crc_err; |
|
|||
499 | spacewire_stats_backup.rx_rmap_data_crc_err = spacewire_stats_grspw.rx_rmap_data_crc_err |
|
|||
500 | + spacewire_stats.rx_rmap_data_crc_err; |
|
|||
501 | spacewire_stats_backup.early_ep = spacewire_stats_grspw.early_ep |
|
|||
502 | + spacewire_stats.early_ep; |
|
|||
503 | spacewire_stats_backup.invalid_address = spacewire_stats_grspw.invalid_address |
|
|||
504 | + spacewire_stats.invalid_address; |
|
|||
505 | spacewire_stats_backup.rx_eep_err = spacewire_stats_grspw.rx_eep_err |
|
|||
506 | + spacewire_stats.rx_eep_err; |
|
|||
507 | spacewire_stats_backup.rx_truncated = spacewire_stats_grspw.rx_truncated |
|
|||
508 | + spacewire_stats.rx_truncated; |
|
|||
509 | } |
|
|||
510 |
|
||||
511 | void spacewire_update_statistics( void ) |
|
|||
512 | { |
|
|||
513 | rtems_status_code status; |
|
|||
514 | spw_stats spacewire_stats_grspw; |
|
|||
515 |
|
||||
516 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw ); |
|
|||
517 |
|
||||
518 | spacewire_stats.packets_received = spacewire_stats_backup.packets_received |
|
|||
519 | + spacewire_stats_grspw.packets_received; |
|
|||
520 | spacewire_stats.packets_sent = spacewire_stats_backup.packets_sent |
|
|||
521 | + spacewire_stats_grspw.packets_sent; |
|
|||
522 | spacewire_stats.parity_err = spacewire_stats_backup.parity_err |
|
|||
523 | + spacewire_stats_grspw.parity_err; |
|
|||
524 | spacewire_stats.disconnect_err = spacewire_stats_backup.disconnect_err |
|
|||
525 | + spacewire_stats_grspw.disconnect_err; |
|
|||
526 | spacewire_stats.escape_err = spacewire_stats_backup.escape_err |
|
|||
527 | + spacewire_stats_grspw.escape_err; |
|
|||
528 | spacewire_stats.credit_err = spacewire_stats_backup.credit_err |
|
|||
529 | + spacewire_stats_grspw.credit_err; |
|
|||
530 | spacewire_stats.write_sync_err = spacewire_stats_backup.write_sync_err |
|
|||
531 | + spacewire_stats_grspw.write_sync_err; |
|
|||
532 | spacewire_stats.rx_rmap_header_crc_err = spacewire_stats_backup.rx_rmap_header_crc_err |
|
|||
533 | + spacewire_stats_grspw.rx_rmap_header_crc_err; |
|
|||
534 | spacewire_stats.rx_rmap_data_crc_err = spacewire_stats_backup.rx_rmap_data_crc_err |
|
|||
535 | + spacewire_stats_grspw.rx_rmap_data_crc_err; |
|
|||
536 | spacewire_stats.early_ep = spacewire_stats_backup.early_ep |
|
|||
537 | + spacewire_stats_grspw.early_ep; |
|
|||
538 | spacewire_stats.invalid_address = spacewire_stats_backup.invalid_address |
|
|||
539 | + spacewire_stats_grspw.invalid_address; |
|
|||
540 | spacewire_stats.rx_eep_err = spacewire_stats_backup.rx_eep_err |
|
|||
541 | + spacewire_stats_grspw.rx_eep_err; |
|
|||
542 | spacewire_stats.rx_truncated = spacewire_stats_backup.rx_truncated |
|
|||
543 | + spacewire_stats_grspw.rx_truncated; |
|
|||
544 | //spacewire_stats.tx_link_err; |
|
|||
545 |
|
||||
546 | //**************************** |
|
|||
547 | // DPU_SPACEWIRE_IF_STATISTICS |
|
|||
548 | housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[0] = (unsigned char) (spacewire_stats.packets_received >> 8); |
|
|||
549 | housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[1] = (unsigned char) (spacewire_stats.packets_received); |
|
|||
550 | housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[0] = (unsigned char) (spacewire_stats.packets_sent >> 8); |
|
|||
551 | housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[1] = (unsigned char) (spacewire_stats.packets_sent); |
|
|||
552 | //housekeeping_packet.hk_lfr_dpu_spw_tick_out_cnt; |
|
|||
553 | //housekeeping_packet.hk_lfr_dpu_spw_last_timc; |
|
|||
554 |
|
||||
555 | //****************************************** |
|
|||
556 | // ERROR COUNTERS / SPACEWIRE / LOW SEVERITY |
|
|||
557 | housekeeping_packet.hk_lfr_dpu_spw_parity = (unsigned char) spacewire_stats.parity_err; |
|
|||
558 | housekeeping_packet.hk_lfr_dpu_spw_disconnect = (unsigned char) spacewire_stats.disconnect_err; |
|
|||
559 | housekeeping_packet.hk_lfr_dpu_spw_escape = (unsigned char) spacewire_stats.escape_err; |
|
|||
560 | housekeeping_packet.hk_lfr_dpu_spw_credit = (unsigned char) spacewire_stats.credit_err; |
|
|||
561 | housekeeping_packet.hk_lfr_dpu_spw_write_sync = (unsigned char) spacewire_stats.write_sync_err; |
|
|||
562 |
|
||||
563 | //********************************************* |
|
|||
564 | // ERROR COUNTERS / SPACEWIRE / MEDIUM SEVERITY |
|
|||
565 | housekeeping_packet.hk_lfr_dpu_spw_early_eop = (unsigned char) spacewire_stats.early_ep; |
|
|||
566 | housekeeping_packet.hk_lfr_dpu_spw_invalid_addr = (unsigned char) spacewire_stats.invalid_address; |
|
|||
567 | housekeeping_packet.hk_lfr_dpu_spw_eep = (unsigned char) spacewire_stats.rx_eep_err; |
|
|||
568 | housekeeping_packet.hk_lfr_dpu_spw_rx_too_big = (unsigned char) spacewire_stats.rx_truncated; |
|
|||
569 | } |
|
|||
570 |
|
||||
571 | void timecode_irq_handler( void *pDev, void *regs, int minor, unsigned int tc ) |
|
93 | void timecode_irq_handler( void *pDev, void *regs, int minor, unsigned int tc ) | |
572 | { |
|
94 | { | |
573 | // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_1 ); |
|
95 | // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_1 ); | |
574 | struct grgpio_regs_str *grgpio_regs = (struct grgpio_regs_str *) REGS_ADDR_GRGPIO; |
|
96 | struct grgpio_regs_str *grgpio_regs = (struct grgpio_regs_str *) REGS_ADDR_GRGPIO; | |
575 |
|
97 | |||
576 | grgpio_regs->io_port_direction_register = |
|
98 | grgpio_regs->io_port_direction_register = | |
577 | grgpio_regs->io_port_direction_register | 0x08; // [0001 1000], 0 = output disabled, 1 = output enabled |
|
99 | grgpio_regs->io_port_direction_register | 0x08; // [0001 1000], 0 = output disabled, 1 = output enabled | |
578 |
|
100 | |||
579 | if ( (grgpio_regs->io_port_output_register & 0x08) == 0x08 ) |
|
101 | if ( (grgpio_regs->io_port_output_register & 0x08) == 0x08 ) | |
580 | { |
|
102 | { | |
581 | grgpio_regs->io_port_output_register = grgpio_regs->io_port_output_register & 0xf7; |
|
103 | grgpio_regs->io_port_output_register = grgpio_regs->io_port_output_register & 0xf7; | |
582 | } |
|
104 | } | |
583 | else |
|
105 | else | |
584 | { |
|
106 | { | |
585 | grgpio_regs->io_port_output_register = grgpio_regs->io_port_output_register | 0x08; |
|
107 | grgpio_regs->io_port_output_register = grgpio_regs->io_port_output_register | 0x08; | |
586 | } |
|
108 | } | |
587 |
|
109 | |||
588 | } |
|
110 | } | |
589 |
|
111 | |||
590 | rtems_timer_service_routine user_routine( rtems_id timer_id, void *user_data ) |
|
112 | rtems_timer_service_routine user_routine( rtems_id timer_id, void *user_data ) | |
591 | { |
|
113 | { | |
592 | int linkStatus; |
|
114 | int linkStatus; | |
593 | rtems_status_code status; |
|
115 | rtems_status_code status; | |
594 |
|
116 | |||
595 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status |
|
117 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status | |
596 |
|
118 | |||
597 | if ( linkStatus == 5) { |
|
119 | if ( linkStatus == 5) { | |
598 | PRINTF("in spacewire_reset_link *** link is running\n") |
|
120 | PRINTF("in spacewire_reset_link *** link is running\n") | |
599 | status = RTEMS_SUCCESSFUL; |
|
121 | status = RTEMS_SUCCESSFUL; | |
600 | } |
|
122 | } | |
601 | } |
|
123 | } |
This diff has been collapsed as it changes many lines, (710 lines changed) Show them Hide them | |||||
@@ -1,793 +1,107 | |||||
1 | /** Functions and tasks related to TeleCommand handling. |
|
1 | /** Functions and tasks related to TeleCommand handling. | |
2 | * |
|
2 | * | |
3 | * @file |
|
3 | * @file | |
4 | * @author P. LEROY |
|
4 | * @author P. LEROY | |
5 | * |
|
5 | * | |
6 | * A group of functions to handle TeleCommands:\n |
|
6 | * A group of functions to handle TeleCommands:\n | |
7 | * action launching\n |
|
7 | * action launching\n | |
8 | * TC parsing\n |
|
8 | * TC parsing\n | |
9 | * ... |
|
9 | * ... | |
10 | * |
|
10 | * | |
11 | */ |
|
11 | */ | |
12 |
|
12 | |||
13 | #include "timegen_tc_handler.h" |
|
13 | #include "timegen_tc_handler.h" | |
14 |
|
14 | |||
15 | //*********** |
|
15 | //*********** | |
16 | // RTEMS TASK |
|
16 | // RTEMS TASK | |
17 |
|
17 | |||
18 |
rtems_task act |
|
18 | rtems_task act__task( rtems_task_argument unused ) | |
19 | { |
|
19 | { | |
20 | /** This RTEMS task is responsible for launching actions upton the reception of valid TeleCommands. |
|
20 | /** This RTEMS task is responsible for launching actions upton the reception of valid TeleCommands. | |
21 | * |
|
21 | * | |
22 | * @param unused is the starting argument of the RTEMS task |
|
22 | * @param unused is the starting argument of the RTEMS task | |
23 | * |
|
23 | * | |
24 | * The ACTN task waits for data coming from an RTEMS msesage queue. When data arrives, it launches specific actions depending |
|
24 | * The ACTN task waits for data coming from an RTEMS msesage queue. When data arrives, it launches specific actions depending | |
25 | * on the incoming TeleCommand. |
|
25 | * on the incoming TeleCommand. | |
26 | * |
|
26 | * | |
27 | */ |
|
27 | */ | |
28 |
|
28 | |||
29 | int result; |
|
29 | int result; | |
30 | rtems_status_code status; // RTEMS status code |
|
30 | rtems_status_code status; // RTEMS status code | |
31 | ccsdsTelecommandPacket_t TC; // TC sent to the ACTN task |
|
31 | ccsdsTelecommandPacket_t TC; // TC sent to the ACTN task | |
32 | size_t size; // size of the incoming TC packet |
|
32 | size_t size; // size of the incoming TC packet | |
33 | unsigned char subtype; // subtype of the current TC packet |
|
33 | unsigned char subtype; // subtype of the current TC packet | |
34 | unsigned char time[6]; |
|
34 | unsigned char time[6]; | |
35 | rtems_id queue_rcv_id; |
|
35 | rtems_id queue_rcv_id; | |
36 | rtems_id queue_snd_id; |
|
36 | rtems_id queue_snd_id; | |
37 |
|
37 | |||
38 | status = get_message_queue_id_recv( &queue_rcv_id ); |
|
38 | status = get_message_queue_id_recv( &queue_rcv_id ); | |
39 | if (status != RTEMS_SUCCESSFUL) |
|
39 | if (status != RTEMS_SUCCESSFUL) | |
40 | { |
|
40 | { | |
41 | PRINTF1("in ACTN *** ERR get_message_queue_id_recv %d\n", status) |
|
41 | PRINTF1("in ACTN *** ERR get_message_queue_id_recv %d\n", status) | |
42 | } |
|
42 | } | |
43 |
|
43 | |||
44 | status = get_message_queue_id_send( &queue_snd_id ); |
|
44 | status = get_message_queue_id_send( &queue_snd_id ); | |
45 | if (status != RTEMS_SUCCESSFUL) |
|
45 | if (status != RTEMS_SUCCESSFUL) | |
46 | { |
|
46 | { | |
47 | PRINTF1("in ACTN *** ERR get_message_queue_id_send %d\n", status) |
|
47 | PRINTF1("in ACTN *** ERR get_message_queue_id_send %d\n", status) | |
48 | } |
|
48 | } | |
49 |
|
49 | |||
50 | result = LFR_SUCCESSFUL; |
|
50 | result = LFR_SUCCESSFUL; | |
51 | subtype = 0; // subtype of the current TC packet |
|
51 | subtype = 0; // subtype of the current TC packet | |
52 |
|
52 | |||
53 | BOOT_PRINTF("in ACTN *** \n") |
|
53 | BOOT_PRINTF("in ACTN *** \n") | |
54 |
|
54 | |||
55 | while(1) |
|
55 | while(1) | |
56 | { |
|
56 | { | |
57 | status = rtems_message_queue_receive( queue_rcv_id, (char*) &TC, &size, |
|
57 | status = rtems_message_queue_receive( queue_rcv_id, (char*) &TC, &size, | |
58 | RTEMS_WAIT, RTEMS_NO_TIMEOUT); |
|
58 | RTEMS_WAIT, RTEMS_NO_TIMEOUT); | |
59 | getTime( time ); // set time to the current time |
|
59 | getTime( time ); // set time to the current time | |
60 | if (status!=RTEMS_SUCCESSFUL) |
|
60 | if (status!=RTEMS_SUCCESSFUL) | |
61 | { |
|
61 | { | |
62 | PRINTF1("ERR *** in task ACTN *** error receiving a message, code %d \n", status) |
|
62 | PRINTF1("ERR *** in task ACTN *** error receiving a message, code %d \n", status) | |
63 | } |
|
63 | } | |
64 | else |
|
64 | else | |
65 | { |
|
65 | { | |
66 | subtype = TC.serviceSubType; |
|
66 | subtype = TC.serviceSubType; | |
67 | switch(subtype) |
|
67 | switch(subtype) | |
68 | { |
|
68 | { | |
69 |
case TC_SUBTYPE_ |
|
69 | case TC_SUBTYPE_ENTER: | |
70 |
|
|
70 | result = timegen_action_enter_mode( &TC, queue_snd_id, time ); | |
71 | close_action( &TC, result, queue_snd_id ); |
|
|||
72 | break; |
|
|||
73 | // |
|
|||
74 | case TC_SUBTYPE_LOAD_COMM: |
|
|||
75 | // result = action_load_common_par( &TC ); |
|
|||
76 | close_action( &TC, result, queue_snd_id ); |
|
|||
77 | break; |
|
|||
78 | // |
|
|||
79 | case TC_SUBTYPE_LOAD_NORM: |
|
|||
80 | // result = action_load_normal_par( &TC, queue_snd_id, time ); |
|
|||
81 | close_action( &TC, result, queue_snd_id ); |
|
|||
82 | break; |
|
|||
83 | // |
|
|||
84 | case TC_SUBTYPE_LOAD_BURST: |
|
|||
85 | // result = action_load_burst_par( &TC, queue_snd_id, time ); |
|
|||
86 | close_action( &TC, result, queue_snd_id ); |
|
|||
87 | break; |
|
|||
88 | // |
|
|||
89 | case TC_SUBTYPE_LOAD_SBM1: |
|
|||
90 | // result = action_load_sbm1_par( &TC, queue_snd_id, time ); |
|
|||
91 | close_action( &TC, result, queue_snd_id ); |
|
|||
92 | break; |
|
|||
93 | // |
|
|||
94 | case TC_SUBTYPE_LOAD_SBM2: |
|
|||
95 | // result = action_load_sbm2_par( &TC, queue_snd_id, time ); |
|
|||
96 | close_action( &TC, result, queue_snd_id ); |
|
71 | close_action( &TC, result, queue_snd_id ); | |
97 | break; |
|
72 | break; | |
98 | // |
|
|||
99 | case TC_SUBTYPE_DUMP: |
|
|||
100 | // result = action_dump_par( queue_snd_id ); |
|
|||
101 | close_action( &TC, result, queue_snd_id ); |
|
|||
102 | break; |
|
|||
103 | // |
|
|||
104 | case TC_SUBTYPE_ENTER: |
|
|||
105 | result = action_enter_mode( &TC, queue_snd_id, time ); |
|
|||
106 | close_action( &TC, result, queue_snd_id ); |
|
|||
107 | break; |
|
|||
108 | // |
|
|||
109 | case TC_SUBTYPE_UPDT_INFO: |
|
|||
110 | // result = action_update_info( &TC, queue_snd_id ); |
|
|||
111 | close_action( &TC, result, queue_snd_id ); |
|
|||
112 | break; |
|
|||
113 | // |
|
|||
114 | case TC_SUBTYPE_EN_CAL: |
|
|||
115 | // result = action_enable_calibration( &TC, queue_snd_id, time ); |
|
|||
116 | close_action( &TC, result, queue_snd_id ); |
|
|||
117 | break; |
|
|||
118 | // |
|
|||
119 | case TC_SUBTYPE_DIS_CAL: |
|
|||
120 | // result = action_disable_calibration( &TC, queue_snd_id, time ); |
|
|||
121 | close_action( &TC, result, queue_snd_id ); |
|
|||
122 | break; |
|
|||
123 | // |
|
|||
124 | case TC_SUBTYPE_UPDT_TIME: |
|
73 | case TC_SUBTYPE_UPDT_TIME: | |
125 | result = action_update_time( &TC ); |
|
74 | result = timegen_action_update_time( &TC ); | |
126 | close_action( &TC, result, queue_snd_id ); |
|
75 | close_action( &TC, result, queue_snd_id ); | |
127 | break; |
|
76 | break; | |
128 | // |
|
77 | // | |
129 | default: |
|
78 | default: | |
130 | break; |
|
79 | break; | |
131 | } |
|
80 | } | |
132 | } |
|
81 | } | |
133 | } |
|
82 | } | |
134 | } |
|
83 | } | |
135 |
|
84 | |||
136 | //*********** |
|
85 | //*********** | |
137 | // TC ACTIONS |
|
86 | // TC ACTIONS | |
138 |
|
87 | |||
139 |
int action_ |
|
88 | int timegen_action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) | |
140 | { |
|
89 | { | |
141 | /** This function executes specific actions when a TC_LFR_RESET TeleCommand has been received. |
|
90 | int ret; | |
142 | * |
|
|||
143 | * @param TC points to the TeleCommand packet that is being processed |
|
|||
144 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
|||
145 | * |
|
|||
146 | */ |
|
|||
147 |
|
||||
148 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); |
|
|||
149 | return LFR_DEFAULT; |
|
|||
150 | } |
|
|||
151 |
|
||||
152 | int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
|||
153 | { |
|
|||
154 | /** This function executes specific actions when a TC_LFR_ENTER_MODE TeleCommand has been received. |
|
|||
155 | * |
|
|||
156 | * @param TC points to the TeleCommand packet that is being processed |
|
|||
157 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
|||
158 | * |
|
|||
159 | */ |
|
|||
160 |
|
||||
161 | rtems_status_code status; |
|
|||
162 | unsigned char requestedMode; |
|
|||
163 |
|
||||
164 | requestedMode = TC->dataAndCRC[1]; |
|
|||
165 |
|
91 | |||
166 | if ( (requestedMode != LFR_MODE_STANDBY) |
|
92 | ret = LFR_SUCCESSFUL; | |
167 | && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST) |
|
|||
168 | && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) ) |
|
|||
169 | { |
|
|||
170 | status = RTEMS_UNSATISFIED; |
|
|||
171 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_LFR_MODE, requestedMode ); |
|
|||
172 | } |
|
|||
173 | else |
|
|||
174 | { |
|
|||
175 | printf("in action_enter_mode *** enter mode %d\n", requestedMode); |
|
|||
176 |
|
||||
177 | status = transition_validation(requestedMode); |
|
|||
178 |
|
93 | |||
179 | if ( status == LFR_SUCCESSFUL ) { |
|
94 | return ret; | |
180 | if ( lfrCurrentMode != LFR_MODE_STANDBY) |
|
|||
181 | { |
|
|||
182 | status = stop_current_mode(); |
|
|||
183 | } |
|
|||
184 | if (status != RTEMS_SUCCESSFUL) |
|
|||
185 | { |
|
|||
186 | PRINTF("ERR *** in action_enter *** stop_current_mode\n") |
|
|||
187 | } |
|
|||
188 | status = enter_mode( requestedMode ); |
|
|||
189 | } |
|
|||
190 | else |
|
|||
191 | { |
|
|||
192 | PRINTF("ERR *** in action_enter *** transition rejected\n") |
|
|||
193 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); |
|
|||
194 | } |
|
|||
195 | } |
|
|||
196 |
|
||||
197 | return status; |
|
|||
198 | } |
|
95 | } | |
199 |
|
96 | |||
200 |
int action_update_ |
|
97 | int timegen_action_update_time(ccsdsTelecommandPacket_t *TC) | |
201 | { |
|
98 | { | |
202 | // /** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received. |
|
99 | int ret; | |
203 | // * |
|
|||
204 | // * @param TC points to the TeleCommand packet that is being processed |
|
|||
205 | // * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
|||
206 | // * |
|
|||
207 | // * @return LFR directive status code: |
|
|||
208 | // * - LFR_DEFAULT |
|
|||
209 | // * - LFR_SUCCESSFUL |
|
|||
210 | // * |
|
|||
211 | // */ |
|
|||
212 |
|
||||
213 | // unsigned int val; |
|
|||
214 | int result; |
|
|||
215 |
|
||||
216 | result = LFR_DEFAULT; |
|
|||
217 | // unsigned int status; |
|
|||
218 | // unsigned char mode; |
|
|||
219 |
|
||||
220 | // // check LFR MODE |
|
|||
221 | // mode = (TC->dataAndCRC[ BYTE_POS_HK_UPDATE_INFO_PAR_SET5 ] & 0x1e) >> 1; |
|
|||
222 | // status = check_update_info_hk_lfr_mode( mode ); |
|
|||
223 | // if (status != LFR_DEFAULT) // check TDS mode |
|
|||
224 | // { |
|
|||
225 | // mode = (TC->dataAndCRC[ BYTE_POS_HK_UPDATE_INFO_PAR_SET6 ] & 0xf0) >> 4; |
|
|||
226 | // status = check_update_info_hk_tds_mode( mode ); |
|
|||
227 | // } |
|
|||
228 | // if (status != LFR_DEFAULT) // check THR mode |
|
|||
229 | // { |
|
|||
230 | // mode = (TC->dataAndCRC[ BYTE_POS_HK_UPDATE_INFO_PAR_SET6 ] & 0x0f); |
|
|||
231 | // status = check_update_info_hk_thr_mode( mode ); |
|
|||
232 | // } |
|
|||
233 | // if (status != LFR_DEFAULT) // if the parameter check is successful |
|
|||
234 | // { |
|
|||
235 | // val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256 |
|
|||
236 | // + housekeeping_packet.hk_lfr_update_info_tc_cnt[1]; |
|
|||
237 | // val++; |
|
|||
238 | // housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8); |
|
|||
239 | // housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val); |
|
|||
240 | // } |
|
|||
241 |
|
||||
242 | // result = status; |
|
|||
243 |
|
||||
244 | return result; |
|
|||
245 | } |
|
|||
246 |
|
||||
247 | int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
|||
248 | { |
|
|||
249 | /** This function executes specific actions when a TC_LFR_ENABLE_CALIBRATION TeleCommand has been received. |
|
|||
250 | * |
|
|||
251 | * @param TC points to the TeleCommand packet that is being processed |
|
|||
252 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
|||
253 | * |
|
|||
254 | */ |
|
|||
255 |
|
100 | |||
256 | int result; |
|
101 | ret = LFR_SUCCESSFUL; | |
257 | unsigned char lfrMode; |
|
|||
258 |
|
||||
259 | result = LFR_DEFAULT; |
|
|||
260 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
|||
261 |
|
||||
262 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); |
|
|||
263 | result = LFR_DEFAULT; |
|
|||
264 |
|
||||
265 | return result; |
|
|||
266 | } |
|
|||
267 |
|
||||
268 | int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
|||
269 | { |
|
|||
270 | /** This function executes specific actions when a TC_LFR_DISABLE_CALIBRATION TeleCommand has been received. |
|
|||
271 | * |
|
|||
272 | * @param TC points to the TeleCommand packet that is being processed |
|
|||
273 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
|||
274 | * |
|
|||
275 | */ |
|
|||
276 |
|
||||
277 | int result; |
|
|||
278 | unsigned char lfrMode; |
|
|||
279 |
|
||||
280 | result = LFR_DEFAULT; |
|
|||
281 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
|||
282 |
|
102 | |||
283 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); |
|
103 | return ret; | |
284 | result = LFR_DEFAULT; |
|
|||
285 |
|
||||
286 | return result; |
|
|||
287 | } |
|
|||
288 |
|
||||
289 | int action_update_time(ccsdsTelecommandPacket_t *TC) |
|
|||
290 | { |
|
|||
291 | /** This function executes specific actions when a TC_LFR_UPDATE_TIME TeleCommand has been received. |
|
|||
292 | * |
|
|||
293 | * @param TC points to the TeleCommand packet that is being processed |
|
|||
294 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
|||
295 | * |
|
|||
296 | * @return LFR_SUCCESSFUL |
|
|||
297 | * |
|
|||
298 | */ |
|
|||
299 |
|
||||
300 | unsigned int val; |
|
|||
301 |
|
||||
302 | time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24) |
|
|||
303 | + (TC->dataAndCRC[1] << 16) |
|
|||
304 | + (TC->dataAndCRC[2] << 8) |
|
|||
305 | + TC->dataAndCRC[3]; |
|
|||
306 | val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256 |
|
|||
307 | + housekeeping_packet.hk_lfr_update_time_tc_cnt[1]; |
|
|||
308 | val++; |
|
|||
309 | housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8); |
|
|||
310 | housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val); |
|
|||
311 | // time_management_regs->ctrl = time_management_regs->ctrl | 1; // force tick |
|
|||
312 |
|
||||
313 | return LFR_SUCCESSFUL; |
|
|||
314 | } |
|
104 | } | |
315 |
|
105 | |||
316 | //******************* |
|
106 | //******************* | |
317 | // ENTERING THE MODES |
|
107 | // ENTERING THE MODES | |
318 |
|
||||
319 | int transition_validation(unsigned char requestedMode) |
|
|||
320 | { |
|
|||
321 | /** This function checks the validity of the transition requested by the TC_LFR_ENTER_MODE. |
|
|||
322 | * |
|
|||
323 | * @param requestedMode is the mode requested by the TC_LFR_ENTER_MODE |
|
|||
324 | * |
|
|||
325 | * @return LFR directive status codes: |
|
|||
326 | * - LFR_SUCCESSFUL - the transition is authorized |
|
|||
327 | * - LFR_DEFAULT - the transition is not authorized |
|
|||
328 | * |
|
|||
329 | */ |
|
|||
330 |
|
||||
331 | int status; |
|
|||
332 |
|
||||
333 | switch (requestedMode) |
|
|||
334 | { |
|
|||
335 | case LFR_MODE_STANDBY: |
|
|||
336 | if ( lfrCurrentMode == LFR_MODE_STANDBY ) { |
|
|||
337 | status = LFR_DEFAULT; |
|
|||
338 | } |
|
|||
339 | else |
|
|||
340 | { |
|
|||
341 | status = LFR_SUCCESSFUL; |
|
|||
342 | } |
|
|||
343 | break; |
|
|||
344 | case LFR_MODE_NORMAL: |
|
|||
345 | if ( lfrCurrentMode == LFR_MODE_NORMAL ) { |
|
|||
346 | status = LFR_DEFAULT; |
|
|||
347 | } |
|
|||
348 | else { |
|
|||
349 | status = LFR_SUCCESSFUL; |
|
|||
350 | } |
|
|||
351 | break; |
|
|||
352 | case LFR_MODE_BURST: |
|
|||
353 | if ( lfrCurrentMode == LFR_MODE_BURST ) { |
|
|||
354 | status = LFR_DEFAULT; |
|
|||
355 | } |
|
|||
356 | else { |
|
|||
357 | status = LFR_SUCCESSFUL; |
|
|||
358 | } |
|
|||
359 | break; |
|
|||
360 | case LFR_MODE_SBM1: |
|
|||
361 | if ( lfrCurrentMode == LFR_MODE_SBM1 ) { |
|
|||
362 | status = LFR_DEFAULT; |
|
|||
363 | } |
|
|||
364 | else { |
|
|||
365 | status = LFR_SUCCESSFUL; |
|
|||
366 | } |
|
|||
367 | break; |
|
|||
368 | case LFR_MODE_SBM2: |
|
|||
369 | if ( lfrCurrentMode == LFR_MODE_SBM2 ) { |
|
|||
370 | status = LFR_DEFAULT; |
|
|||
371 | } |
|
|||
372 | else { |
|
|||
373 | status = LFR_SUCCESSFUL; |
|
|||
374 | } |
|
|||
375 | break; |
|
|||
376 | default: |
|
|||
377 | status = LFR_DEFAULT; |
|
|||
378 | break; |
|
|||
379 | } |
|
|||
380 |
|
||||
381 | return status; |
|
|||
382 | } |
|
|||
383 |
|
||||
384 | int stop_current_mode(void) |
|
|||
385 | { |
|
|||
386 | /** This function stops the current mode by masking interrupt lines and suspending science tasks. |
|
|||
387 | * |
|
|||
388 | * @return RTEMS directive status codes: |
|
|||
389 | * - RTEMS_SUCCESSFUL - task restarted successfully |
|
|||
390 | * - RTEMS_INVALID_ID - task id invalid |
|
|||
391 | * - RTEMS_ALREADY_SUSPENDED - task already suspended |
|
|||
392 | * |
|
|||
393 | */ |
|
|||
394 |
|
||||
395 | rtems_status_code status; |
|
|||
396 |
|
||||
397 | status = RTEMS_SUCCESSFUL; |
|
|||
398 |
|
||||
399 | // (1) mask interruptions |
|
|||
400 | LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt |
|
|||
401 | LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt |
|
|||
402 |
|
||||
403 | // (2) clear interruptions |
|
|||
404 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt |
|
|||
405 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt |
|
|||
406 |
|
||||
407 | // (3) reset registers |
|
|||
408 | // waveform picker |
|
|||
409 | // reset_wfp_burst_enable(); // reset burst and enable bits |
|
|||
410 | // reset_wfp_status(); // reset all the status bits |
|
|||
411 | // spectral matrices |
|
|||
412 | set_irq_on_new_ready_matrix( 0 ); // stop the spectral matrices |
|
|||
413 | set_run_matrix_spectral( 0 ); // run_matrix_spectral is set to 0 |
|
|||
414 | // reset_extractSWF(); // reset the extractSWF flag to false |
|
|||
415 |
|
||||
416 | // <Spectral Matrices simulator> |
|
|||
417 | LEON_Mask_interrupt( IRQ_SM_SIMULATOR ); // mask spectral matrix interrupt simulator |
|
|||
418 | timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); |
|
|||
419 | LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); // clear spectral matrix interrupt simulator |
|
|||
420 | // </Spectral Matrices simulator> |
|
|||
421 |
|
||||
422 | // suspend several tasks |
|
|||
423 | if (lfrCurrentMode != LFR_MODE_STANDBY) { |
|
|||
424 | status = suspend_science_tasks(); |
|
|||
425 | } |
|
|||
426 |
|
||||
427 | if (status != RTEMS_SUCCESSFUL) |
|
|||
428 | { |
|
|||
429 | PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status) |
|
|||
430 | } |
|
|||
431 |
|
||||
432 | return status; |
|
|||
433 | } |
|
|||
434 |
|
||||
435 | int enter_mode(unsigned char mode ) |
|
|||
436 | { |
|
|||
437 | /** This function is launched after a mode transition validation. |
|
|||
438 | * |
|
|||
439 | * @param mode is the mode in which LFR will be put. |
|
|||
440 | * |
|
|||
441 | * @return RTEMS directive status codes: |
|
|||
442 | * - RTEMS_SUCCESSFUL - the mode has been entered successfully |
|
|||
443 | * - RTEMS_NOT_SATISFIED - the mode has not been entered successfully |
|
|||
444 | * |
|
|||
445 | */ |
|
|||
446 |
|
||||
447 | rtems_status_code status; |
|
|||
448 |
|
||||
449 | status = RTEMS_UNSATISFIED; |
|
|||
450 |
|
||||
451 | housekeeping_packet.lfr_status_word[0] = (unsigned char) ((mode << 4) + 0x0d); |
|
|||
452 | updateLFRCurrentMode(); |
|
|||
453 |
|
||||
454 | if ( (mode == LFR_MODE_NORMAL) || (mode == LFR_MODE_BURST) |
|
|||
455 | || (mode == LFR_MODE_SBM1) || (mode == LFR_MODE_SBM2) ) |
|
|||
456 | { |
|
|||
457 | #ifdef PRINT_TASK_STATISTICS |
|
|||
458 | rtems_cpu_usage_reset(); |
|
|||
459 | maxCount = 0; |
|
|||
460 | #endif |
|
|||
461 | status = restart_science_tasks(); |
|
|||
462 | // launch_waveform_picker( mode ); |
|
|||
463 | // launch_spectral_matrix( mode ); |
|
|||
464 | } |
|
|||
465 | else if ( mode == LFR_MODE_STANDBY ) |
|
|||
466 | { |
|
|||
467 | #ifdef PRINT_TASK_STATISTICS |
|
|||
468 | rtems_cpu_usage_report(); |
|
|||
469 | #endif |
|
|||
470 |
|
||||
471 | #ifdef PRINT_STACK_REPORT |
|
|||
472 | rtems_stack_checker_report_usage(); |
|
|||
473 | #endif |
|
|||
474 | status = stop_current_mode(); |
|
|||
475 | PRINTF1("maxCount = %d\n", maxCount) |
|
|||
476 | } |
|
|||
477 | else |
|
|||
478 | { |
|
|||
479 | status = RTEMS_UNSATISFIED; |
|
|||
480 | } |
|
|||
481 |
|
||||
482 | if (status != RTEMS_SUCCESSFUL) |
|
|||
483 | { |
|
|||
484 | PRINTF1("in enter_mode *** ERR = %d\n", status) |
|
|||
485 | status = RTEMS_UNSATISFIED; |
|
|||
486 | } |
|
|||
487 |
|
||||
488 | return status; |
|
|||
489 | } |
|
|||
490 |
|
||||
491 | int restart_science_tasks() |
|
|||
492 | { |
|
|||
493 | /** This function is used to restart all science tasks. |
|
|||
494 | * |
|
|||
495 | * @return RTEMS directive status codes: |
|
|||
496 | * - RTEMS_SUCCESSFUL - task restarted successfully |
|
|||
497 | * - RTEMS_INVALID_ID - task id invalid |
|
|||
498 | * - RTEMS_INCORRECT_STATE - task never started |
|
|||
499 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task |
|
|||
500 | * |
|
|||
501 | * Science tasks are AVF0, BPF0, WFRM, CWF3, CW2, CWF1 |
|
|||
502 | * |
|
|||
503 | */ |
|
|||
504 |
|
||||
505 | rtems_status_code status[6]; |
|
|||
506 | rtems_status_code ret; |
|
|||
507 |
|
||||
508 | ret = RTEMS_SUCCESSFUL; |
|
|||
509 |
|
||||
510 | status[0] = rtems_task_restart( Task_id[TASKID_AVF0], 1 ); |
|
|||
511 | if (status[0] != RTEMS_SUCCESSFUL) |
|
|||
512 | { |
|
|||
513 | PRINTF1("in restart_science_task *** 0 ERR %d\n", status[0]) |
|
|||
514 | } |
|
|||
515 |
|
||||
516 | status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 ); |
|
|||
517 | if (status[2] != RTEMS_SUCCESSFUL) |
|
|||
518 | { |
|
|||
519 | PRINTF1("in restart_science_task *** 2 ERR %d\n", status[2]) |
|
|||
520 | } |
|
|||
521 |
|
||||
522 | status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 ); |
|
|||
523 | if (status[3] != RTEMS_SUCCESSFUL) |
|
|||
524 | { |
|
|||
525 | PRINTF1("in restart_science_task *** 3 ERR %d\n", status[3]) |
|
|||
526 | } |
|
|||
527 |
|
||||
528 | status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 ); |
|
|||
529 | if (status[4] != RTEMS_SUCCESSFUL) |
|
|||
530 | { |
|
|||
531 | PRINTF1("in restart_science_task *** 4 ERR %d\n", status[4]) |
|
|||
532 | } |
|
|||
533 |
|
||||
534 | status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 ); |
|
|||
535 | if (status[5] != RTEMS_SUCCESSFUL) |
|
|||
536 | { |
|
|||
537 | PRINTF1("in restart_science_task *** 5 ERR %d\n", status[5]) |
|
|||
538 | } |
|
|||
539 |
|
||||
540 | if ( (status[0] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) || |
|
|||
541 | (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) ) |
|
|||
542 | { |
|
|||
543 | ret = RTEMS_UNSATISFIED; |
|
|||
544 | } |
|
|||
545 |
|
||||
546 | return ret; |
|
|||
547 | } |
|
|||
548 |
|
||||
549 | int suspend_science_tasks() |
|
|||
550 | { |
|
|||
551 | /** This function suspends the science tasks. |
|
|||
552 | * |
|
|||
553 | * @return RTEMS directive status codes: |
|
|||
554 | * - RTEMS_SUCCESSFUL - task restarted successfully |
|
|||
555 | * - RTEMS_INVALID_ID - task id invalid |
|
|||
556 | * - RTEMS_ALREADY_SUSPENDED - task already suspended |
|
|||
557 | * |
|
|||
558 | */ |
|
|||
559 |
|
||||
560 | rtems_status_code status; |
|
|||
561 |
|
||||
562 | status = rtems_task_suspend( Task_id[TASKID_AVF0] ); |
|
|||
563 | if (status != RTEMS_SUCCESSFUL) |
|
|||
564 | { |
|
|||
565 | PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status) |
|
|||
566 | } |
|
|||
567 |
|
||||
568 | if (status == RTEMS_SUCCESSFUL) // suspend WFRM |
|
|||
569 | { |
|
|||
570 | status = rtems_task_suspend( Task_id[TASKID_WFRM] ); |
|
|||
571 | if (status != RTEMS_SUCCESSFUL) |
|
|||
572 | { |
|
|||
573 | PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status) |
|
|||
574 | } |
|
|||
575 | } |
|
|||
576 |
|
||||
577 | if (status == RTEMS_SUCCESSFUL) // suspend CWF3 |
|
|||
578 | { |
|
|||
579 | status = rtems_task_suspend( Task_id[TASKID_CWF3] ); |
|
|||
580 | if (status != RTEMS_SUCCESSFUL) |
|
|||
581 | { |
|
|||
582 | PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status) |
|
|||
583 | } |
|
|||
584 | } |
|
|||
585 |
|
||||
586 | if (status == RTEMS_SUCCESSFUL) // suspend CWF2 |
|
|||
587 | { |
|
|||
588 | status = rtems_task_suspend( Task_id[TASKID_CWF2] ); |
|
|||
589 | if (status != RTEMS_SUCCESSFUL) |
|
|||
590 | { |
|
|||
591 | PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status) |
|
|||
592 | } |
|
|||
593 | } |
|
|||
594 |
|
||||
595 | if (status == RTEMS_SUCCESSFUL) // suspend CWF1 |
|
|||
596 | { |
|
|||
597 | status = rtems_task_suspend( Task_id[TASKID_CWF1] ); |
|
|||
598 | if (status != RTEMS_SUCCESSFUL) |
|
|||
599 | { |
|
|||
600 | PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status) |
|
|||
601 | } |
|
|||
602 | } |
|
|||
603 |
|
||||
604 | return status; |
|
|||
605 | } |
|
|||
606 |
|
||||
607 | void launch_waveform_picker( unsigned char mode ) |
|
|||
608 | { |
|
|||
609 | // int startDate; |
|
|||
610 |
|
||||
611 | // reset_current_ring_nodes(); |
|
|||
612 | // reset_waveform_picker_regs(); |
|
|||
613 | // set_wfp_burst_enable_register( mode ); |
|
|||
614 |
|
||||
615 | // LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); |
|
|||
616 | // LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); |
|
|||
617 |
|
||||
618 | // startDate = time_management_regs->coarse_time + 2; |
|
|||
619 | // waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x80; // [1000 0000] |
|
|||
620 | // waveform_picker_regs->start_date = startDate; |
|
|||
621 | } |
|
|||
622 |
|
||||
623 | void launch_spectral_matrix( unsigned char mode ) |
|
|||
624 | { |
|
|||
625 | // reset_nb_sm_f0(); |
|
|||
626 | // reset_current_sm_ring_nodes(); |
|
|||
627 | // reset_spectral_matrix_regs(); |
|
|||
628 |
|
||||
629 | //#ifdef VHDL_DEV |
|
|||
630 | // set_irq_on_new_ready_matrix( 1 ); |
|
|||
631 | // LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); |
|
|||
632 | // LEON_Unmask_interrupt( IRQ_SPECTRAL_MATRIX ); |
|
|||
633 | // set_run_matrix_spectral( 1 ); |
|
|||
634 | //#else |
|
|||
635 | // // Spectral Matrices simulator |
|
|||
636 | // timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); |
|
|||
637 | // LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); |
|
|||
638 | // LEON_Unmask_interrupt( IRQ_SM_SIMULATOR ); |
|
|||
639 | //#endif |
|
|||
640 | } |
|
|||
641 |
|
||||
642 | void set_irq_on_new_ready_matrix( unsigned char value ) |
|
|||
643 | { |
|
|||
644 | if (value == 1) |
|
|||
645 | { |
|
|||
646 | spectral_matrix_regs->config = spectral_matrix_regs->config | 0x01; |
|
|||
647 | } |
|
|||
648 | else |
|
|||
649 | { |
|
|||
650 | spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffe; // 1110 |
|
|||
651 | } |
|
|||
652 | } |
|
|||
653 |
|
||||
654 | void set_run_matrix_spectral( unsigned char value ) |
|
|||
655 | { |
|
|||
656 | if (value == 1) |
|
|||
657 | { |
|
|||
658 | spectral_matrix_regs->config = spectral_matrix_regs->config | 0x4; // 0100 set run_matrix spectral to 1 |
|
|||
659 | } |
|
|||
660 | else |
|
|||
661 | { |
|
|||
662 | spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffb; // 1011 set run_matrix spectral to 0 |
|
|||
663 | } |
|
|||
664 | } |
|
|||
665 |
|
||||
666 | void launch_spectral_matrix_simu( unsigned char mode ) |
|
|||
667 | { |
|
|||
668 | // reset_nb_sm_f0(); |
|
|||
669 | // reset_current_sm_ring_nodes(); |
|
|||
670 | // reset_spectral_matrix_regs(); |
|
|||
671 |
|
||||
672 | // // Spectral Matrices simulator |
|
|||
673 | // timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); |
|
|||
674 | // LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); |
|
|||
675 | // LEON_Unmask_interrupt( IRQ_SM_SIMULATOR ); |
|
|||
676 | // set_local_nb_interrupt_f0_MAX(); |
|
|||
677 | } |
|
|||
678 |
|
||||
679 | //**************** |
|
|||
680 | // CLOSING ACTIONS |
|
|||
681 | void update_last_TC_exe(ccsdsTelecommandPacket_t *TC) |
|
|||
682 | { |
|
|||
683 | /** This function is used to update the HK packets statistics after a successful TC execution. |
|
|||
684 | * |
|
|||
685 | * @param TC points to the TC being processed |
|
|||
686 | * @param time is the time used to date the TC execution |
|
|||
687 | * |
|
|||
688 | */ |
|
|||
689 |
|
||||
690 | housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0]; |
|
|||
691 | housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1]; |
|
|||
692 | housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00; |
|
|||
693 | housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType; |
|
|||
694 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00; |
|
|||
695 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType; |
|
|||
696 | housekeeping_packet.hk_lfr_last_exe_tc_time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
|||
697 | housekeeping_packet.hk_lfr_last_exe_tc_time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
|||
698 | housekeeping_packet.hk_lfr_last_exe_tc_time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
|||
699 | housekeeping_packet.hk_lfr_last_exe_tc_time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
|||
700 | housekeeping_packet.hk_lfr_last_exe_tc_time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
|||
701 | housekeeping_packet.hk_lfr_last_exe_tc_time[5] = (unsigned char) (time_management_regs->fine_time); |
|
|||
702 | } |
|
|||
703 |
|
||||
704 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC ) |
|
|||
705 | { |
|
|||
706 | /** This function is used to update the HK packets statistics after a TC rejection. |
|
|||
707 | * |
|
|||
708 | * @param TC points to the TC being processed |
|
|||
709 | * @param time is the time used to date the TC rejection |
|
|||
710 | * |
|
|||
711 | */ |
|
|||
712 |
|
||||
713 | housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0]; |
|
|||
714 | housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1]; |
|
|||
715 | housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00; |
|
|||
716 | housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType; |
|
|||
717 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00; |
|
|||
718 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType; |
|
|||
719 | housekeeping_packet.hk_lfr_last_rej_tc_time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
|||
720 | housekeeping_packet.hk_lfr_last_rej_tc_time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
|||
721 | housekeeping_packet.hk_lfr_last_rej_tc_time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
|||
722 | housekeeping_packet.hk_lfr_last_rej_tc_time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
|||
723 | housekeeping_packet.hk_lfr_last_rej_tc_time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
|||
724 | housekeeping_packet.hk_lfr_last_rej_tc_time[5] = (unsigned char) (time_management_regs->fine_time); |
|
|||
725 | } |
|
|||
726 |
|
||||
727 | void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id ) |
|
|||
728 | { |
|
|||
729 | /** This function is the last step of the TC execution workflow. |
|
|||
730 | * |
|
|||
731 | * @param TC points to the TC being processed |
|
|||
732 | * @param result is the result of the TC execution (LFR_SUCCESSFUL / LFR_DEFAULT) |
|
|||
733 | * @param queue_id is the id of the RTEMS message queue used to send TM packets |
|
|||
734 | * @param time is the time used to date the TC execution |
|
|||
735 | * |
|
|||
736 | */ |
|
|||
737 |
|
||||
738 | unsigned int val = 0; |
|
|||
739 |
|
||||
740 | if (result == LFR_SUCCESSFUL) |
|
|||
741 | { |
|
|||
742 | if ( !( (TC->serviceType==TC_TYPE_TIME) && (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) ) |
|
|||
743 | && |
|
|||
744 | !( (TC->serviceType==TC_TYPE_GEN) && (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO)) |
|
|||
745 | ) |
|
|||
746 | { |
|
|||
747 | send_tm_lfr_tc_exe_success( TC, queue_id ); |
|
|||
748 | } |
|
|||
749 | update_last_TC_exe( TC ); |
|
|||
750 | val = housekeeping_packet.hk_lfr_exe_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_exe_tc_cnt[1]; |
|
|||
751 | val++; |
|
|||
752 | housekeeping_packet.hk_lfr_exe_tc_cnt[0] = (unsigned char) (val >> 8); |
|
|||
753 | housekeeping_packet.hk_lfr_exe_tc_cnt[1] = (unsigned char) (val); |
|
|||
754 | } |
|
|||
755 | else |
|
|||
756 | { |
|
|||
757 | update_last_TC_rej( TC ); |
|
|||
758 | val = housekeeping_packet.hk_lfr_rej_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_rej_tc_cnt[1]; |
|
|||
759 | val++; |
|
|||
760 | housekeeping_packet.hk_lfr_rej_tc_cnt[0] = (unsigned char) (val >> 8); |
|
|||
761 | housekeeping_packet.hk_lfr_rej_tc_cnt[1] = (unsigned char) (val); |
|
|||
762 | } |
|
|||
763 | } |
|
|||
764 |
|
||||
765 | //*************************** |
|
|||
766 | // Interrupt Service Routines |
|
|||
767 | rtems_isr commutation_isr1( rtems_vector_number vector ) |
|
|||
768 | { |
|
|||
769 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
|||
770 | printf("In commutation_isr1 *** Error sending event to DUMB\n"); |
|
|||
771 | } |
|
|||
772 | } |
|
|||
773 |
|
||||
774 | rtems_isr commutation_isr2( rtems_vector_number vector ) |
|
|||
775 | { |
|
|||
776 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
|||
777 | printf("In commutation_isr2 *** Error sending event to DUMB\n"); |
|
|||
778 | } |
|
|||
779 | } |
|
|||
780 |
|
||||
781 | //**************** |
|
|||
782 | // OTHER FUNCTIONS |
|
|||
783 | void updateLFRCurrentMode() |
|
|||
784 | { |
|
|||
785 | /** This function updates the value of the global variable lfrCurrentMode. |
|
|||
786 | * |
|
|||
787 | * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running. |
|
|||
788 | * |
|
|||
789 | */ |
|
|||
790 | // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure |
|
|||
791 | lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
|||
792 | } |
|
|||
793 |
|
@@ -1,398 +1,405 | |||||
1 | <?xml version="1.0" encoding="UTF-8"?> |
|
1 | <?xml version="1.0" encoding="UTF-8"?> | |
2 | <!DOCTYPE QtCreatorProject> |
|
2 | <!DOCTYPE QtCreatorProject> | |
3 |
<!-- Written by QtCreator 3. |
|
3 | <!-- Written by QtCreator 3.2.0, 2014-09-24T11:08:34. --> | |
4 | <qtcreator> |
|
4 | <qtcreator> | |
5 | <data> |
|
5 | <data> | |
|
6 | <variable>EnvironmentId</variable> | |||
|
7 | <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value> | |||
|
8 | </data> | |||
|
9 | <data> | |||
6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
|
10 | <variable>ProjectExplorer.Project.ActiveTarget</variable> | |
7 | <value type="int">0</value> |
|
11 | <value type="int">0</value> | |
8 | </data> |
|
12 | </data> | |
9 | <data> |
|
13 | <data> | |
10 | <variable>ProjectExplorer.Project.EditorSettings</variable> |
|
14 | <variable>ProjectExplorer.Project.EditorSettings</variable> | |
11 | <valuemap type="QVariantMap"> |
|
15 | <valuemap type="QVariantMap"> | |
12 | <value type="bool" key="EditorConfiguration.AutoIndent">true</value> |
|
16 | <value type="bool" key="EditorConfiguration.AutoIndent">true</value> | |
13 | <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value> |
|
17 | <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value> | |
14 | <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value> |
|
18 | <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value> | |
15 | <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0"> |
|
19 | <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0"> | |
16 | <value type="QString" key="language">Cpp</value> |
|
20 | <value type="QString" key="language">Cpp</value> | |
17 | <valuemap type="QVariantMap" key="value"> |
|
21 | <valuemap type="QVariantMap" key="value"> | |
18 | <value type="QByteArray" key="CurrentPreferences">CppGlobal</value> |
|
22 | <value type="QByteArray" key="CurrentPreferences">CppGlobal</value> | |
19 | </valuemap> |
|
23 | </valuemap> | |
20 | </valuemap> |
|
24 | </valuemap> | |
21 | <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1"> |
|
25 | <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1"> | |
22 | <value type="QString" key="language">QmlJS</value> |
|
26 | <value type="QString" key="language">QmlJS</value> | |
23 | <valuemap type="QVariantMap" key="value"> |
|
27 | <valuemap type="QVariantMap" key="value"> | |
24 | <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value> |
|
28 | <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value> | |
25 | </valuemap> |
|
29 | </valuemap> | |
26 | </valuemap> |
|
30 | </valuemap> | |
27 | <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value> |
|
31 | <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value> | |
28 | <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value> |
|
32 | <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value> | |
29 | <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value> |
|
33 | <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value> | |
30 | <value type="int" key="EditorConfiguration.IndentSize">4</value> |
|
34 | <value type="int" key="EditorConfiguration.IndentSize">4</value> | |
31 | <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value> |
|
35 | <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value> | |
|
36 | <value type="int" key="EditorConfiguration.MarginColumn">80</value> | |||
|
37 | <value type="bool" key="EditorConfiguration.MouseHiding">true</value> | |||
32 | <value type="bool" key="EditorConfiguration.MouseNavigation">true</value> |
|
38 | <value type="bool" key="EditorConfiguration.MouseNavigation">true</value> | |
33 | <value type="int" key="EditorConfiguration.PaddingMode">1</value> |
|
39 | <value type="int" key="EditorConfiguration.PaddingMode">1</value> | |
34 | <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value> |
|
40 | <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value> | |
|
41 | <value type="bool" key="EditorConfiguration.ShowMargin">false</value> | |||
35 | <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value> |
|
42 | <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value> | |
36 | <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value> |
|
43 | <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value> | |
37 | <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value> |
|
44 | <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value> | |
38 | <value type="int" key="EditorConfiguration.TabSize">8</value> |
|
45 | <value type="int" key="EditorConfiguration.TabSize">8</value> | |
39 | <value type="bool" key="EditorConfiguration.UseGlobal">true</value> |
|
46 | <value type="bool" key="EditorConfiguration.UseGlobal">true</value> | |
40 | <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value> |
|
47 | <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value> | |
41 | <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value> |
|
48 | <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value> | |
42 | <value type="bool" key="EditorConfiguration.cleanIndentation">true</value> |
|
49 | <value type="bool" key="EditorConfiguration.cleanIndentation">true</value> | |
43 | <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value> |
|
50 | <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value> | |
44 | <value type="bool" key="EditorConfiguration.inEntireDocument">false</value> |
|
51 | <value type="bool" key="EditorConfiguration.inEntireDocument">false</value> | |
45 | </valuemap> |
|
52 | </valuemap> | |
46 | </data> |
|
53 | </data> | |
47 | <data> |
|
54 | <data> | |
48 | <variable>ProjectExplorer.Project.PluginSettings</variable> |
|
55 | <variable>ProjectExplorer.Project.PluginSettings</variable> | |
49 | <valuemap type="QVariantMap"/> |
|
56 | <valuemap type="QVariantMap"/> | |
50 | </data> |
|
57 | </data> | |
51 | <data> |
|
58 | <data> | |
52 | <variable>ProjectExplorer.Project.Target.0</variable> |
|
59 | <variable>ProjectExplorer.Project.Target.0</variable> | |
53 | <valuemap type="QVariantMap"> |
|
60 | <valuemap type="QVariantMap"> | |
54 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.2 in PATH (System)</value> |
|
61 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.2 in PATH (System)</value> | |
55 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.2 in PATH (System)</value> |
|
62 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.2 in PATH (System)</value> | |
56 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{5289e843-9ef2-45ce-88c6-ad27d8e08def}</value> |
|
63 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{5289e843-9ef2-45ce-88c6-ad27d8e08def}</value> | |
57 | <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value> |
|
64 | <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value> | |
58 | <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> |
|
65 | <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> | |
59 | <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> |
|
66 | <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> | |
60 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> |
|
67 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> | |
61 | <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/opt/DEV_PLE/TimeGenerator-qt</value> |
|
68 | <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/opt/DEV_PLE/TimeGenerator-qt</value> | |
62 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|
69 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> | |
63 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
70 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> | |
64 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
71 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> | |
65 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> |
|
72 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> | |
66 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
73 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
67 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> |
|
74 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> | |
68 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> |
|
75 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> | |
69 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value> |
|
76 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value> | |
70 | <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> |
|
77 | <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> | |
71 | <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> |
|
78 | <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> | |
72 | </valuemap> |
|
79 | </valuemap> | |
73 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> |
|
80 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> | |
74 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
81 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> | |
75 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
82 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> | |
76 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
83 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
77 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
84 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> | |
78 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
85 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> | |
79 | <value type="QString">-w</value> |
|
86 | <value type="QString">-w</value> | |
80 | <value type="QString">-r</value> |
|
87 | <value type="QString">-r</value> | |
81 | </valuelist> |
|
88 | </valuelist> | |
82 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> |
|
89 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> | |
83 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> |
|
90 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> | |
84 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
91 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> | |
85 | </valuemap> |
|
92 | </valuemap> | |
86 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> |
|
93 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> | |
87 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> |
|
94 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> | |
88 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
95 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
89 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> |
|
96 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> | |
90 | </valuemap> |
|
97 | </valuemap> | |
91 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> |
|
98 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> | |
92 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
99 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> | |
93 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
100 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> | |
94 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
101 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> | |
95 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
102 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
96 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
103 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> | |
97 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
104 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> | |
98 | <value type="QString">-w</value> |
|
105 | <value type="QString">-w</value> | |
99 | <value type="QString">-r</value> |
|
106 | <value type="QString">-r</value> | |
100 | </valuelist> |
|
107 | </valuelist> | |
101 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> |
|
108 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> | |
102 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> |
|
109 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> | |
103 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
110 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> | |
104 | </valuemap> |
|
111 | </valuemap> | |
105 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> |
|
112 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> | |
106 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> |
|
113 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> | |
107 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
114 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
108 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> |
|
115 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> | |
109 | </valuemap> |
|
116 | </valuemap> | |
110 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> |
|
117 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> | |
111 | <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> |
|
118 | <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> | |
112 | <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> |
|
119 | <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> | |
113 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value> |
|
120 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value> | |
114 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
121 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
115 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> |
|
122 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> | |
116 | <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> |
|
123 | <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> | |
117 | <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> |
|
124 | <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> | |
118 | </valuemap> |
|
125 | </valuemap> | |
119 | <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value> |
|
126 | <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value> | |
120 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0"> |
|
127 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0"> | |
121 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|
128 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> | |
122 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value> |
|
129 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value> | |
123 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value> |
|
130 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value> | |
124 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
131 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
125 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value> |
|
132 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value> | |
126 | </valuemap> |
|
133 | </valuemap> | |
127 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value> |
|
134 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value> | |
128 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value> |
|
135 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value> | |
129 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
136 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
130 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value> |
|
137 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value> | |
131 | </valuemap> |
|
138 | </valuemap> | |
132 | <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> |
|
139 | <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> | |
133 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/> |
|
140 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/> | |
134 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> |
|
141 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> | |
135 | <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> |
|
142 | <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> | |
136 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> |
|
143 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> | |
137 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> |
|
144 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> | |
138 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> |
|
145 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> | |
139 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> |
|
146 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> | |
140 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> |
|
147 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> | |
141 | <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> |
|
148 | <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> | |
142 | <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> |
|
149 | <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> | |
143 | <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> |
|
150 | <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> | |
144 | <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value> |
|
151 | <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value> | |
145 | <value type="int" key="Analyzer.Valgrind.NumCallers">25</value> |
|
152 | <value type="int" key="Analyzer.Valgrind.NumCallers">25</value> | |
146 | <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> |
|
153 | <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> | |
147 | <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value> |
|
154 | <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value> | |
148 | <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value> |
|
155 | <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value> | |
149 | <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value> |
|
156 | <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value> | |
150 | <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> |
|
157 | <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> | |
151 | <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> |
|
158 | <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> | |
152 | <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> |
|
159 | <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> | |
153 | <value type="int">0</value> |
|
160 | <value type="int">0</value> | |
154 | <value type="int">1</value> |
|
161 | <value type="int">1</value> | |
155 | <value type="int">2</value> |
|
162 | <value type="int">2</value> | |
156 | <value type="int">3</value> |
|
163 | <value type="int">3</value> | |
157 | <value type="int">4</value> |
|
164 | <value type="int">4</value> | |
158 | <value type="int">5</value> |
|
165 | <value type="int">5</value> | |
159 | <value type="int">6</value> |
|
166 | <value type="int">6</value> | |
160 | <value type="int">7</value> |
|
167 | <value type="int">7</value> | |
161 | <value type="int">8</value> |
|
168 | <value type="int">8</value> | |
162 | <value type="int">9</value> |
|
169 | <value type="int">9</value> | |
163 | <value type="int">10</value> |
|
170 | <value type="int">10</value> | |
164 | <value type="int">11</value> |
|
171 | <value type="int">11</value> | |
165 | <value type="int">12</value> |
|
172 | <value type="int">12</value> | |
166 | <value type="int">13</value> |
|
173 | <value type="int">13</value> | |
167 | <value type="int">14</value> |
|
174 | <value type="int">14</value> | |
168 | </valuelist> |
|
175 | </valuelist> | |
169 | <value type="int" key="PE.EnvironmentAspect.Base">2</value> |
|
176 | <value type="int" key="PE.EnvironmentAspect.Base">2</value> | |
170 | <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> |
|
177 | <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> | |
171 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">timegen</value> |
|
178 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">timegen</value> | |
172 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
179 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
173 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/TimeGenerator-qt/timegen.pro</value> |
|
180 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/TimeGenerator-qt/timegen.pro</value> | |
174 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value> |
|
181 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value> | |
175 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">timegen.pro</value> |
|
182 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">timegen.pro</value> | |
176 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value> |
|
183 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value> | |
177 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value> |
|
184 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value> | |
178 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value> |
|
185 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value> | |
179 | <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> |
|
186 | <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> | |
180 | <value type="bool" key="RunConfiguration.UseCppDebugger">true</value> |
|
187 | <value type="bool" key="RunConfiguration.UseCppDebugger">true</value> | |
181 | <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value> |
|
188 | <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value> | |
182 | <value type="bool" key="RunConfiguration.UseMultiProcess">false</value> |
|
189 | <value type="bool" key="RunConfiguration.UseMultiProcess">false</value> | |
183 | <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> |
|
190 | <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> | |
184 | <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> |
|
191 | <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> | |
185 | </valuemap> |
|
192 | </valuemap> | |
186 | <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value> |
|
193 | <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value> | |
187 | </valuemap> |
|
194 | </valuemap> | |
188 | </data> |
|
195 | </data> | |
189 | <data> |
|
196 | <data> | |
190 | <variable>ProjectExplorer.Project.Target.1</variable> |
|
197 | <variable>ProjectExplorer.Project.Target.1</variable> | |
191 | <valuemap type="QVariantMap"> |
|
198 | <valuemap type="QVariantMap"> | |
192 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value> |
|
199 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value> | |
193 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value> |
|
200 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value> | |
194 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{e04e3924-0bd8-4708-be18-f1474e45608e}</value> |
|
201 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{e04e3924-0bd8-4708-be18-f1474e45608e}</value> | |
195 | <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value> |
|
202 | <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value> | |
196 | <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> |
|
203 | <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> | |
197 | <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> |
|
204 | <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> | |
198 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> |
|
205 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> | |
199 | <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/opt/DEV_PLE/build-timegen-Desktop-Debug</value> |
|
206 | <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/opt/DEV_PLE/build-timegen-Desktop-Debug</value> | |
200 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|
207 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> | |
201 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
208 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> | |
202 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
209 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> | |
203 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> |
|
210 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> | |
204 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
211 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
205 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> |
|
212 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> | |
206 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> |
|
213 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> | |
207 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value> |
|
214 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value> | |
208 | <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> |
|
215 | <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> | |
209 | <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> |
|
216 | <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> | |
210 | </valuemap> |
|
217 | </valuemap> | |
211 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> |
|
218 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> | |
212 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
219 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> | |
213 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
220 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> | |
214 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
221 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
215 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
222 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> | |
216 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
223 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> | |
217 | <value type="QString">-w</value> |
|
224 | <value type="QString">-w</value> | |
218 | <value type="QString">-r</value> |
|
225 | <value type="QString">-r</value> | |
219 | </valuelist> |
|
226 | </valuelist> | |
220 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> |
|
227 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> | |
221 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> |
|
228 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> | |
222 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
229 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> | |
223 | </valuemap> |
|
230 | </valuemap> | |
224 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> |
|
231 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> | |
225 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> |
|
232 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> | |
226 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
233 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
227 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> |
|
234 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> | |
228 | </valuemap> |
|
235 | </valuemap> | |
229 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> |
|
236 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> | |
230 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
237 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> | |
231 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
238 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> | |
232 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
239 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> | |
233 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
240 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
234 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
241 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> | |
235 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
242 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> | |
236 | <value type="QString">-w</value> |
|
243 | <value type="QString">-w</value> | |
237 | <value type="QString">-r</value> |
|
244 | <value type="QString">-r</value> | |
238 | </valuelist> |
|
245 | </valuelist> | |
239 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> |
|
246 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> | |
240 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> |
|
247 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> | |
241 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
248 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> | |
242 | </valuemap> |
|
249 | </valuemap> | |
243 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> |
|
250 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> | |
244 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> |
|
251 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> | |
245 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
252 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
246 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> |
|
253 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> | |
247 | </valuemap> |
|
254 | </valuemap> | |
248 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> |
|
255 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> | |
249 | <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> |
|
256 | <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> | |
250 | <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> |
|
257 | <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> | |
251 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value> |
|
258 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value> | |
252 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
259 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
253 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> |
|
260 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> | |
254 | <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value> |
|
261 | <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value> | |
255 | <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> |
|
262 | <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> | |
256 | </valuemap> |
|
263 | </valuemap> | |
257 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1"> |
|
264 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1"> | |
258 | <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/opt/DEV_PLE/build-timegen-Desktop-Release</value> |
|
265 | <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/opt/DEV_PLE/build-timegen-Desktop-Release</value> | |
259 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|
266 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> | |
260 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
267 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> | |
261 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
268 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> | |
262 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> |
|
269 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> | |
263 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
270 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
264 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> |
|
271 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> | |
265 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> |
|
272 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> | |
266 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value> |
|
273 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value> | |
267 | <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> |
|
274 | <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> | |
268 | <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> |
|
275 | <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> | |
269 | </valuemap> |
|
276 | </valuemap> | |
270 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> |
|
277 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> | |
271 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
278 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> | |
272 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
279 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> | |
273 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
280 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
274 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
281 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> | |
275 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
282 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> | |
276 | <value type="QString">-w</value> |
|
283 | <value type="QString">-w</value> | |
277 | <value type="QString">-r</value> |
|
284 | <value type="QString">-r</value> | |
278 | </valuelist> |
|
285 | </valuelist> | |
279 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> |
|
286 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> | |
280 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> |
|
287 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> | |
281 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
288 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> | |
282 | </valuemap> |
|
289 | </valuemap> | |
283 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> |
|
290 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> | |
284 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> |
|
291 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> | |
285 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
292 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
286 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> |
|
293 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> | |
287 | </valuemap> |
|
294 | </valuemap> | |
288 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> |
|
295 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> | |
289 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
296 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> | |
290 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
297 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> | |
291 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
298 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> | |
292 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
299 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
293 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
300 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> | |
294 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
301 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> | |
295 | <value type="QString">-w</value> |
|
302 | <value type="QString">-w</value> | |
296 | <value type="QString">-r</value> |
|
303 | <value type="QString">-r</value> | |
297 | </valuelist> |
|
304 | </valuelist> | |
298 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> |
|
305 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> | |
299 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> |
|
306 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> | |
300 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
307 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> | |
301 | </valuemap> |
|
308 | </valuemap> | |
302 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> |
|
309 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> | |
303 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> |
|
310 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> | |
304 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
311 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
305 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> |
|
312 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> | |
306 | </valuemap> |
|
313 | </valuemap> | |
307 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> |
|
314 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> | |
308 | <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> |
|
315 | <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> | |
309 | <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> |
|
316 | <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> | |
310 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value> |
|
317 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value> | |
311 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
318 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
312 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> |
|
319 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> | |
313 | <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> |
|
320 | <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> | |
314 | <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> |
|
321 | <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> | |
315 | </valuemap> |
|
322 | </valuemap> | |
316 | <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value> |
|
323 | <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value> | |
317 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0"> |
|
324 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0"> | |
318 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|
325 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> | |
319 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value> |
|
326 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value> | |
320 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value> |
|
327 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value> | |
321 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
328 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
322 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value> |
|
329 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value> | |
323 | </valuemap> |
|
330 | </valuemap> | |
324 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value> |
|
331 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value> | |
325 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value> |
|
332 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value> | |
326 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
333 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
327 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value> |
|
334 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value> | |
328 | </valuemap> |
|
335 | </valuemap> | |
329 | <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> |
|
336 | <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> | |
330 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/> |
|
337 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/> | |
331 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> |
|
338 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> | |
332 | <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> |
|
339 | <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> | |
333 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> |
|
340 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> | |
334 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> |
|
341 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> | |
335 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> |
|
342 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> | |
336 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> |
|
343 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> | |
337 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> |
|
344 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> | |
338 | <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> |
|
345 | <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> | |
339 | <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> |
|
346 | <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> | |
340 | <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> |
|
347 | <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> | |
341 | <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value> |
|
348 | <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value> | |
342 | <value type="int" key="Analyzer.Valgrind.NumCallers">25</value> |
|
349 | <value type="int" key="Analyzer.Valgrind.NumCallers">25</value> | |
343 | <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> |
|
350 | <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> | |
344 | <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value> |
|
351 | <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value> | |
345 | <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value> |
|
352 | <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value> | |
346 | <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value> |
|
353 | <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value> | |
347 | <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> |
|
354 | <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> | |
348 | <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> |
|
355 | <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> | |
349 | <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> |
|
356 | <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> | |
350 | <value type="int">0</value> |
|
357 | <value type="int">0</value> | |
351 | <value type="int">1</value> |
|
358 | <value type="int">1</value> | |
352 | <value type="int">2</value> |
|
359 | <value type="int">2</value> | |
353 | <value type="int">3</value> |
|
360 | <value type="int">3</value> | |
354 | <value type="int">4</value> |
|
361 | <value type="int">4</value> | |
355 | <value type="int">5</value> |
|
362 | <value type="int">5</value> | |
356 | <value type="int">6</value> |
|
363 | <value type="int">6</value> | |
357 | <value type="int">7</value> |
|
364 | <value type="int">7</value> | |
358 | <value type="int">8</value> |
|
365 | <value type="int">8</value> | |
359 | <value type="int">9</value> |
|
366 | <value type="int">9</value> | |
360 | <value type="int">10</value> |
|
367 | <value type="int">10</value> | |
361 | <value type="int">11</value> |
|
368 | <value type="int">11</value> | |
362 | <value type="int">12</value> |
|
369 | <value type="int">12</value> | |
363 | <value type="int">13</value> |
|
370 | <value type="int">13</value> | |
364 | <value type="int">14</value> |
|
371 | <value type="int">14</value> | |
365 | </valuelist> |
|
372 | </valuelist> | |
366 | <value type="int" key="PE.EnvironmentAspect.Base">2</value> |
|
373 | <value type="int" key="PE.EnvironmentAspect.Base">2</value> | |
367 | <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> |
|
374 | <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> | |
368 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">timegen</value> |
|
375 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">timegen</value> | |
369 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
376 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
370 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/TimeGenerator-qt/timegen.pro</value> |
|
377 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/TimeGenerator-qt/timegen.pro</value> | |
371 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value> |
|
378 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value> | |
372 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">timegen.pro</value> |
|
379 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">timegen.pro</value> | |
373 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value> |
|
380 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value> | |
374 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value> |
|
381 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value> | |
375 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value> |
|
382 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value> | |
376 | <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> |
|
383 | <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> | |
377 | <value type="bool" key="RunConfiguration.UseCppDebugger">false</value> |
|
384 | <value type="bool" key="RunConfiguration.UseCppDebugger">false</value> | |
378 | <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value> |
|
385 | <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value> | |
379 | <value type="bool" key="RunConfiguration.UseMultiProcess">false</value> |
|
386 | <value type="bool" key="RunConfiguration.UseMultiProcess">false</value> | |
380 | <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> |
|
387 | <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> | |
381 | <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> |
|
388 | <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> | |
382 | </valuemap> |
|
389 | </valuemap> | |
383 | <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value> |
|
390 | <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value> | |
384 | </valuemap> |
|
391 | </valuemap> | |
385 | </data> |
|
392 | </data> | |
386 | <data> |
|
393 | <data> | |
387 | <variable>ProjectExplorer.Project.TargetCount</variable> |
|
394 | <variable>ProjectExplorer.Project.TargetCount</variable> | |
388 | <value type="int">2</value> |
|
395 | <value type="int">2</value> | |
389 | </data> |
|
396 | </data> | |
390 | <data> |
|
397 | <data> | |
391 |
<variable>ProjectExplorer.Project.Updater. |
|
398 | <variable>ProjectExplorer.Project.Updater.FileVersion</variable> | |
392 | <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value> |
|
399 | <value type="int">16</value> | |
393 | </data> |
|
400 | </data> | |
394 | <data> |
|
401 | <data> | |
395 |
<variable> |
|
402 | <variable>Version</variable> | |
396 |
<value type="int">1 |
|
403 | <value type="int">16</value> | |
397 | </data> |
|
404 | </data> | |
398 | </qtcreator> |
|
405 | </qtcreator> |
@@ -1,48 +1,48 | |||||
1 | #ifndef FSW_INIT_H_INCLUDED |
|
1 | #ifndef FSW_INIT_H_INCLUDED | |
2 | #define FSW_INIT_H_INCLUDED |
|
2 | #define FSW_INIT_H_INCLUDED | |
3 |
|
3 | |||
4 | #include <rtems.h> |
|
4 | #include <rtems.h> | |
5 | #include <leon.h> |
|
5 | #include <leon.h> | |
6 |
|
6 | |||
7 | #include "fsw_params.h" |
|
7 | #include "fsw_params.h" | |
8 | #include "fsw_misc.h" |
|
8 | #include "fsw_misc.h" | |
9 | #include "fsw_processing.h" |
|
9 | #include "fsw_processing.h" | |
10 |
|
10 | |||
11 | #include "tc_handler.h" |
|
11 | #include "tc_handler.h" | |
12 | #include "wf_handler.h" |
|
12 | #include "wf_handler.h" | |
13 | #include "fsw_spacewire.h" |
|
13 | #include "fsw_spacewire.h" | |
14 |
|
14 | |||
15 | #include "avf0_prc0.h" |
|
15 | #include "avf0_prc0.h" | |
16 | #include "avf1_prc1.h" |
|
16 | #include "avf1_prc1.h" | |
17 | #include "avf2_prc2.h" |
|
17 | #include "avf2_prc2.h" | |
18 |
|
18 | |||
19 | extern rtems_name Task_name[20]; /* array of task names */ |
|
19 | extern rtems_name Task_name[20]; /* array of task names */ | |
20 | extern rtems_id Task_id[20]; /* array of task ids */ |
|
20 | extern rtems_id Task_id[20]; /* array of task ids */ | |
21 |
|
21 | |||
22 | // RTEMS TASKS |
|
22 | // RTEMS TASKS | |
23 | rtems_task Init( rtems_task_argument argument); |
|
23 | rtems_task Init( rtems_task_argument argument); | |
24 |
|
24 | |||
25 | // OTHER functions |
|
25 | // OTHER functions | |
26 | void create_names( void ); |
|
26 | void create_names( void ); | |
27 | int create_all_tasks( void ); |
|
27 | int create_all_tasks( void ); | |
28 | int start_all_tasks( void ); |
|
28 | int start_all_tasks( void ); | |
29 | // |
|
29 | // | |
30 | rtems_status_code create_message_queues( void ); |
|
30 | rtems_status_code create_message_queues( void ); | |
31 | rtems_status_code get_message_queue_id_send( rtems_id *queue_id ); |
|
31 | rtems_status_code get_message_queue_id_send( rtems_id *queue_id ); | |
32 | rtems_status_code get_message_queue_id_recv( rtems_id *queue_id ); |
|
32 | rtems_status_code get_message_queue_id_recv( rtems_id *queue_id ); | |
33 | rtems_status_code get_message_queue_id_prc0( rtems_id *queue_id ); |
|
33 | rtems_status_code get_message_queue_id_prc0( rtems_id *queue_id ); | |
34 | rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id ); |
|
34 | rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id ); | |
35 | rtems_status_code get_message_queue_id_prc2( rtems_id *queue_id ); |
|
35 | rtems_status_code get_message_queue_id_prc2( rtems_id *queue_id ); | |
36 | // |
|
36 | // | |
37 | int start_recv_send_tasks( void ); |
|
37 | int start_recv_send_tasks( void ); | |
38 | // |
|
38 | // | |
39 | void init_local_mode_parameters( void ); |
|
39 | void init_local_mode_parameters( void ); | |
40 | void reset_local_time( void ); |
|
40 | void reset_local_time( void ); | |
41 |
|
41 | |||
42 |
extern |
|
42 | extern void rtems_cpu_usage_report( void ); | |
43 |
extern |
|
43 | extern void rtems_cpu_usage_reset( void ); | |
44 | extern void rtems_stack_checker_report_usage( void ); |
|
44 | extern void rtems_stack_checker_report_usage( void ); | |
45 |
|
45 | |||
46 | extern int sched_yield( void ); |
|
46 | extern int sched_yield( void ); | |
47 |
|
47 | |||
48 | #endif // FSW_INIT_H_INCLUDED |
|
48 | #endif // FSW_INIT_H_INCLUDED |
@@ -1,49 +1,45 | |||||
1 | #ifndef FSW_MISC_H_INCLUDED |
|
1 | #ifndef FSW_MISC_H_INCLUDED | |
2 | #define FSW_MISC_H_INCLUDED |
|
2 | #define FSW_MISC_H_INCLUDED | |
3 |
|
3 | |||
4 | #include <rtems.h> |
|
4 | #include <rtems.h> | |
5 | #include <stdio.h> |
|
5 | #include <stdio.h> | |
6 | #include <grspw.h> |
|
6 | #include <grspw.h> | |
7 |
|
7 | |||
8 | #include "fsw_params.h" |
|
8 | #include "fsw_params.h" | |
9 | #include "fsw_spacewire.h" |
|
9 | #include "fsw_spacewire.h" | |
10 | #include "lfr_cpu_usage_report.h" |
|
10 | #include "lfr_cpu_usage_report.h" | |
11 |
|
11 | |||
12 | rtems_name name_hk_rate_monotonic; // name of the HK rate monotonic |
|
12 | rtems_name name_hk_rate_monotonic; // name of the HK rate monotonic | |
13 | rtems_id HK_id; // id of the HK rate monotonic period |
|
13 | rtems_id HK_id; // id of the HK rate monotonic period | |
14 |
|
14 | |||
15 | //extern rtems_name misc_name[5]; |
|
|||
16 | //time_management_regs_t *time_management_regs; |
|
|||
17 | //extern Packet_TM_LFR_HK_t housekeeping_packet; |
|
|||
18 |
|
||||
19 | void configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider, |
|
15 | void configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider, | |
20 | unsigned char interrupt_level, rtems_isr (*timer_isr)() ); |
|
16 | unsigned char interrupt_level, rtems_isr (*timer_isr)() ); | |
21 | void timer_start( gptimer_regs_t *gptimer_regs, unsigned char timer ); |
|
17 | void timer_start( gptimer_regs_t *gptimer_regs, unsigned char timer ); | |
22 | void timer_stop( gptimer_regs_t *gptimer_regs, unsigned char timer ); |
|
18 | void timer_stop( gptimer_regs_t *gptimer_regs, unsigned char timer ); | |
23 | void timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider); |
|
19 | void timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider); | |
24 |
|
20 | |||
25 | // SERIAL LINK |
|
21 | // SERIAL LINK | |
26 | int send_console_outputs_on_apbuart_port( void ); |
|
22 | int send_console_outputs_on_apbuart_port( void ); | |
27 | int enable_apbuart_transmitter( void ); |
|
23 | int enable_apbuart_transmitter( void ); | |
28 | void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value); |
|
24 | void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value); | |
29 |
|
25 | |||
30 | // RTEMS TASKS |
|
26 | // RTEMS TASKS | |
31 | rtems_task stat_task( rtems_task_argument argument ); |
|
27 | rtems_task stat_task( rtems_task_argument argument ); | |
32 | rtems_task hous_task( rtems_task_argument argument ); |
|
28 | rtems_task hous_task( rtems_task_argument argument ); | |
33 | rtems_task dumb_task( rtems_task_argument unused ); |
|
29 | rtems_task dumb_task( rtems_task_argument unused ); | |
34 |
|
30 | |||
35 | void init_housekeeping_parameters( void ); |
|
31 | void init_housekeeping_parameters( void ); | |
36 | void increment_seq_counter(unsigned short *packetSequenceControl); |
|
32 | void increment_seq_counter(unsigned short *packetSequenceControl); | |
37 | void getTime( unsigned char *time); |
|
33 | void getTime( unsigned char *time); | |
38 | unsigned long long int getTimeAsUnsignedLongLongInt( ); |
|
34 | unsigned long long int getTimeAsUnsignedLongLongInt( ); | |
39 | void send_dumb_hk( void ); |
|
35 | void send_dumb_hk( void ); | |
40 | void get_v_e1_e2_f3 (unsigned char *spacecraft_potential); |
|
36 | void get_v_e1_e2_f3 (unsigned char *spacecraft_potential); | |
41 | void get_cpu_load( unsigned char *resource_statistics ); |
|
37 | void get_cpu_load( unsigned char *resource_statistics ); | |
42 |
|
38 | |||
43 | extern int sched_yield( void ); |
|
39 | extern int sched_yield( void ); | |
44 |
extern |
|
40 | extern void rtems_cpu_usage_reset(); | |
45 | extern ring_node *current_ring_node_f3; |
|
41 | extern ring_node *current_ring_node_f3; | |
46 | extern ring_node *ring_node_to_send_cwf_f3; |
|
42 | extern ring_node *ring_node_to_send_cwf_f3; | |
47 | extern unsigned short sequenceCounterHK; |
|
43 | extern unsigned short sequenceCounterHK; | |
48 |
|
44 | |||
49 | #endif // FSW_MISC_H_INCLUDED |
|
45 | #endif // FSW_MISC_H_INCLUDED |
@@ -1,255 +1,255 | |||||
1 | #ifndef FSW_PARAMS_H_INCLUDED |
|
1 | #ifndef FSW_PARAMS_H_INCLUDED | |
2 | #define FSW_PARAMS_H_INCLUDED |
|
2 | #define FSW_PARAMS_H_INCLUDED | |
3 |
|
3 | |||
4 | #include "grlib_regs.h" |
|
4 | #include "grlib_regs.h" | |
5 | #include "fsw_params_processing.h" |
|
5 | #include "fsw_params_processing.h" | |
6 | #include "fsw_params_nb_bytes.h" |
|
6 | #include "fsw_params_nb_bytes.h" | |
7 | #include "tm_byte_positions.h" |
|
7 | #include "tm_byte_positions.h" | |
8 | #include "ccsds_types.h" |
|
8 | #include "ccsds_types.h" | |
9 |
|
9 | |||
10 | #define GRSPW_DEVICE_NAME "/dev/grspw0" |
|
10 | #define GRSPW_DEVICE_NAME "/dev/grspw0" | |
11 | #define UART_DEVICE_NAME "/dev/console" |
|
11 | #define UART_DEVICE_NAME "/dev/console" | |
12 |
|
12 | |||
13 | typedef struct ring_node |
|
13 | typedef struct ring_node | |
14 | { |
|
14 | { | |
15 | struct ring_node *previous; |
|
15 | struct ring_node *previous; | |
16 | int buffer_address; |
|
16 | int buffer_address; | |
17 | struct ring_node *next; |
|
17 | struct ring_node *next; | |
18 | unsigned int status; |
|
18 | unsigned int status; | |
19 | } ring_node; |
|
19 | } ring_node; | |
20 |
|
20 | |||
21 | //************************ |
|
21 | //************************ | |
22 | // flight software version |
|
22 | // flight software version | |
23 | // this parameters is handled by the Qt project options |
|
23 | // this parameters is handled by the Qt project options | |
24 |
|
24 | |||
25 | #define NB_PACKETS_PER_GROUP_OF_CWF 8 // 8 packets containing 336 blk |
|
25 | #define NB_PACKETS_PER_GROUP_OF_CWF 8 // 8 packets containing 336 blk | |
26 | #define NB_PACKETS_PER_GROUP_OF_CWF_LIGHT 4 // 4 packets containing 672 blk |
|
26 | #define NB_PACKETS_PER_GROUP_OF_CWF_LIGHT 4 // 4 packets containing 672 blk | |
27 | #define NB_SAMPLES_PER_SNAPSHOT 2688 // 336 * 8 = 672 * 4 = 2688 |
|
27 | #define NB_SAMPLES_PER_SNAPSHOT 2688 // 336 * 8 = 672 * 4 = 2688 | |
28 | #define TIME_OFFSET 2 |
|
28 | #define TIME_OFFSET 2 | |
29 | #define TIME_OFFSET_IN_BYTES 8 |
|
29 | #define TIME_OFFSET_IN_BYTES 8 | |
30 | #define WAVEFORM_EXTENDED_HEADER_OFFSET 22 |
|
30 | #define WAVEFORM_EXTENDED_HEADER_OFFSET 22 | |
31 | #define NB_BYTES_SWF_BLK (2 * 6) |
|
31 | #define NB_BYTES_SWF_BLK (2 * 6) | |
32 | #define NB_WORDS_SWF_BLK 3 |
|
32 | #define NB_WORDS_SWF_BLK 3 | |
33 | #define NB_BYTES_CWF3_LIGHT_BLK 6 |
|
33 | #define NB_BYTES_CWF3_LIGHT_BLK 6 | |
34 | #define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8 |
|
34 | #define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8 | |
35 | #define NB_RING_NODES_F0 3 // AT LEAST 3 |
|
35 | #define NB_RING_NODES_F0 3 // AT LEAST 3 | |
36 | #define NB_RING_NODES_F1 5 // AT LEAST 3 |
|
36 | #define NB_RING_NODES_F1 5 // AT LEAST 3 | |
37 | #define NB_RING_NODES_F2 5 // AT LEAST 3 |
|
37 | #define NB_RING_NODES_F2 5 // AT LEAST 3 | |
38 | #define NB_RING_NODES_F3 3 // AT LEAST 3 |
|
38 | #define NB_RING_NODES_F3 3 // AT LEAST 3 | |
39 |
|
39 | |||
40 | //********** |
|
40 | //********** | |
41 | // LFR MODES |
|
41 | // LFR MODES | |
42 | #define LFR_MODE_STANDBY 0 |
|
42 | #define LFR_MODE_STANDBY 0 | |
43 | #define LFR_MODE_NORMAL 1 |
|
43 | #define LFR_MODE_NORMAL 1 | |
44 | #define LFR_MODE_BURST 2 |
|
44 | #define LFR_MODE_BURST 2 | |
45 | #define LFR_MODE_SBM1 3 |
|
45 | #define LFR_MODE_SBM1 3 | |
46 | #define LFR_MODE_SBM2 4 |
|
46 | #define LFR_MODE_SBM2 4 | |
47 |
|
47 | |||
48 | #define TDS_MODE_LFM 5 |
|
48 | #define TDS_MODE_LFM 5 | |
49 | #define TDS_MODE_STANDBY 0 |
|
49 | #define TDS_MODE_STANDBY 0 | |
50 | #define TDS_MODE_NORMAL 1 |
|
50 | #define TDS_MODE_NORMAL 1 | |
51 | #define TDS_MODE_BURST 2 |
|
51 | #define TDS_MODE_BURST 2 | |
52 | #define TDS_MODE_SBM1 3 |
|
52 | #define TDS_MODE_SBM1 3 | |
53 | #define TDS_MODE_SBM2 4 |
|
53 | #define TDS_MODE_SBM2 4 | |
54 |
|
54 | |||
55 | #define THR_MODE_STANDBY 0 |
|
55 | #define THR_MODE_STANDBY 0 | |
56 | #define THR_MODE_NORMAL 1 |
|
56 | #define THR_MODE_NORMAL 1 | |
57 | #define THR_MODE_BURST 2 |
|
57 | #define THR_MODE_BURST 2 | |
58 |
|
58 | |||
59 | #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0 |
|
59 | #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0 | |
60 | #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1 |
|
60 | #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1 | |
61 | #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2 |
|
61 | #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2 | |
62 | #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3 |
|
62 | #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3 | |
63 | #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4 |
|
63 | #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4 | |
64 | #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5 |
|
64 | #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5 | |
65 | #define RTEMS_EVENT_NORM_BP1_F0 RTEMS_EVENT_6 |
|
65 | #define RTEMS_EVENT_NORM_BP1_F0 RTEMS_EVENT_6 | |
66 | #define RTEMS_EVENT_NORM_BP2_F0 RTEMS_EVENT_7 |
|
66 | #define RTEMS_EVENT_NORM_BP2_F0 RTEMS_EVENT_7 | |
67 | #define RTEMS_EVENT_NORM_ASM_F0 RTEMS_EVENT_8 // ASM only in NORM mode |
|
67 | #define RTEMS_EVENT_NORM_ASM_F0 RTEMS_EVENT_8 // ASM only in NORM mode | |
68 | #define RTEMS_EVENT_NORM_BP1_F1 RTEMS_EVENT_9 |
|
68 | #define RTEMS_EVENT_NORM_BP1_F1 RTEMS_EVENT_9 | |
69 | #define RTEMS_EVENT_NORM_BP2_F1 RTEMS_EVENT_10 |
|
69 | #define RTEMS_EVENT_NORM_BP2_F1 RTEMS_EVENT_10 | |
70 | #define RTEMS_EVENT_NORM_ASM_F1 RTEMS_EVENT_11 // ASM only in NORM mode |
|
70 | #define RTEMS_EVENT_NORM_ASM_F1 RTEMS_EVENT_11 // ASM only in NORM mode | |
71 | #define RTEMS_EVENT_NORM_BP1_F2 RTEMS_EVENT_12 |
|
71 | #define RTEMS_EVENT_NORM_BP1_F2 RTEMS_EVENT_12 | |
72 | #define RTEMS_EVENT_NORM_BP2_F2 RTEMS_EVENT_13 |
|
72 | #define RTEMS_EVENT_NORM_BP2_F2 RTEMS_EVENT_13 | |
73 | #define RTEMS_EVENT_NORM_ASM_F2 RTEMS_EVENT_14 // ASM only in NORM mode |
|
73 | #define RTEMS_EVENT_NORM_ASM_F2 RTEMS_EVENT_14 // ASM only in NORM mode | |
74 | #define RTEMS_EVENT_SBM_BP1_F0 RTEMS_EVENT_15 |
|
74 | #define RTEMS_EVENT_SBM_BP1_F0 RTEMS_EVENT_15 | |
75 | #define RTEMS_EVENT_SBM_BP2_F0 RTEMS_EVENT_16 |
|
75 | #define RTEMS_EVENT_SBM_BP2_F0 RTEMS_EVENT_16 | |
76 | #define RTEMS_EVENT_SBM_BP1_F1 RTEMS_EVENT_17 |
|
76 | #define RTEMS_EVENT_SBM_BP1_F1 RTEMS_EVENT_17 | |
77 | #define RTEMS_EVENT_SBM_BP2_F1 RTEMS_EVENT_18 |
|
77 | #define RTEMS_EVENT_SBM_BP2_F1 RTEMS_EVENT_18 | |
78 | #define RTEMS_EVENT_BURST_BP1_F0 RTEMS_EVENT_19 |
|
78 | #define RTEMS_EVENT_BURST_BP1_F0 RTEMS_EVENT_19 | |
79 | #define RTEMS_EVENT_BURST_BP2_F0 RTEMS_EVENT_20 |
|
79 | #define RTEMS_EVENT_BURST_BP2_F0 RTEMS_EVENT_20 | |
80 | #define RTEMS_EVENT_BURST_BP1_F1 RTEMS_EVENT_21 |
|
80 | #define RTEMS_EVENT_BURST_BP1_F1 RTEMS_EVENT_21 | |
81 | #define RTEMS_EVENT_BURST_BP2_F1 RTEMS_EVENT_22 |
|
81 | #define RTEMS_EVENT_BURST_BP2_F1 RTEMS_EVENT_22 | |
82 |
|
82 | |||
83 | //**************************** |
|
83 | //**************************** | |
84 | // LFR DEFAULT MODE PARAMETERS |
|
84 | // LFR DEFAULT MODE PARAMETERS | |
85 | // COMMON |
|
85 | // COMMON | |
86 | #define DEFAULT_SY_LFR_COMMON0 0x00 |
|
86 | #define DEFAULT_SY_LFR_COMMON0 0x00 | |
87 | #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0 |
|
87 | #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0 | |
88 | // NORM |
|
88 | // NORM | |
89 | #define SY_LFR_N_SWF_L 2048 // nb sample |
|
89 | #define DFLT_SY_LFR_N_SWF_L 2048 // nb sample | |
90 | #define SY_LFR_N_SWF_P 300 // sec |
|
90 | #define DFLT_SY_LFR_N_SWF_P 300 // sec | |
91 | #define SY_LFR_N_ASM_P 3600 // sec |
|
91 | #define DFLT_SY_LFR_N_ASM_P 3600 // sec | |
92 | #define SY_LFR_N_BP_P0 4 // sec |
|
92 | #define DFLT_SY_LFR_N_BP_P0 4 // sec | |
93 | #define SY_LFR_N_BP_P1 20 // sec |
|
93 | #define DFLT_SY_LFR_N_BP_P1 20 // sec | |
94 | #define SY_LFR_N_CWF_LONG_F3 0 // 0 => production of light continuous waveforms at f3 |
|
94 | #define DFLT_SY_LFR_N_CWF_LONG_F3 0 // 0 => production of light continuous waveforms at f3 | |
95 | #define MIN_DELTA_SNAPSHOT 16 // sec |
|
95 | #define MIN_DELTA_SNAPSHOT 16 // sec | |
96 | // BURST |
|
96 | // BURST | |
97 | #define DEFAULT_SY_LFR_B_BP_P0 1 // sec |
|
97 | #define DEFAULT_SY_LFR_B_BP_P0 1 // sec | |
98 | #define DEFAULT_SY_LFR_B_BP_P1 5 // sec |
|
98 | #define DEFAULT_SY_LFR_B_BP_P1 5 // sec | |
99 | // SBM1 |
|
99 | // SBM1 | |
100 | #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec |
|
100 | #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec | |
101 | #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec |
|
101 | #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec | |
102 | // SBM2 |
|
102 | // SBM2 | |
103 | #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec |
|
103 | #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec | |
104 | #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec |
|
104 | #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec | |
105 | // ADDITIONAL PARAMETERS |
|
105 | // ADDITIONAL PARAMETERS | |
106 | #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms |
|
106 | #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms | |
107 | #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s |
|
107 | #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s | |
108 | // STATUS WORD |
|
108 | // STATUS WORD | |
109 | #define DEFAULT_STATUS_WORD_BYTE0 0x0d // [0000] [1] [101] mode 4 bits / SPW enabled 1 bit / state is run 3 bits |
|
109 | #define DEFAULT_STATUS_WORD_BYTE0 0x0d // [0000] [1] [101] mode 4 bits / SPW enabled 1 bit / state is run 3 bits | |
110 | #define DEFAULT_STATUS_WORD_BYTE1 0x00 |
|
110 | #define DEFAULT_STATUS_WORD_BYTE1 0x00 | |
111 | // |
|
111 | // | |
112 | #define SY_LFR_DPU_CONNECT_TIMEOUT 100 // 100 * 10 ms = 1 s |
|
112 | #define SY_LFR_DPU_CONNECT_TIMEOUT 100 // 100 * 10 ms = 1 s | |
113 | #define SY_LFR_DPU_CONNECT_ATTEMPT 3 |
|
113 | #define SY_LFR_DPU_CONNECT_ATTEMPT 3 | |
114 | //**************************** |
|
114 | //**************************** | |
115 |
|
115 | |||
116 | //***************************** |
|
116 | //***************************** | |
117 | // APB REGISTERS BASE ADDRESSES |
|
117 | // APB REGISTERS BASE ADDRESSES | |
118 | #define REGS_ADDR_APBUART 0x80000100 |
|
118 | #define REGS_ADDR_APBUART 0x80000100 | |
119 | #define REGS_ADDR_GPTIMER 0x80000300 |
|
119 | #define REGS_ADDR_GPTIMER 0x80000300 | |
120 | #define REGS_ADDR_GRSPW 0x80000500 |
|
120 | #define REGS_ADDR_GRSPW 0x80000500 | |
121 | #define REGS_ADDR_TIME_MANAGEMENT 0x80000600 |
|
121 | #define REGS_ADDR_TIME_MANAGEMENT 0x80000600 | |
122 | #define REGS_ADDR_GRGPIO 0x80000b00 |
|
122 | #define REGS_ADDR_GRGPIO 0x80000b00 | |
123 |
|
123 | |||
124 | #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00 |
|
124 | #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00 | |
125 | #define REGS_ADDR_WAVEFORM_PICKER 0x80000f50 |
|
125 | #define REGS_ADDR_WAVEFORM_PICKER 0x80000f50 | |
126 | #define REGS_ADDR_VHDL_VERSION 0x80000ff0 |
|
126 | #define REGS_ADDR_VHDL_VERSION 0x80000ff0 | |
127 |
|
127 | |||
128 | #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff |
|
128 | #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff | |
129 | #define APBUART_CTRL_REG_MASK_TE 0x00000002 |
|
129 | #define APBUART_CTRL_REG_MASK_TE 0x00000002 | |
130 | #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50) |
|
130 | #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50) | |
131 |
|
131 | |||
132 | //********** |
|
132 | //********** | |
133 | // IRQ LINES |
|
133 | // IRQ LINES | |
134 | #define IRQ_SM_SIMULATOR 9 |
|
134 | #define IRQ_SM_SIMULATOR 9 | |
135 | #define IRQ_SPARC_SM_SIMULATOR 0x19 // see sparcv8.pdf p.76 for interrupt levels |
|
135 | #define IRQ_SPARC_SM_SIMULATOR 0x19 // see sparcv8.pdf p.76 for interrupt levels | |
136 | #define IRQ_WAVEFORM_PICKER 14 |
|
136 | #define IRQ_WAVEFORM_PICKER 14 | |
137 | #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels |
|
137 | #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels | |
138 | #define IRQ_SPECTRAL_MATRIX 6 |
|
138 | #define IRQ_SPECTRAL_MATRIX 6 | |
139 | #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels |
|
139 | #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels | |
140 |
|
140 | |||
141 | //***** |
|
141 | //***** | |
142 | // TIME |
|
142 | // TIME | |
143 | #define CLKDIV_SM_SIMULATOR (10416 - 1) // 10 ms => nominal is 1/96 = 0.010416667, 10417 - 1 = 10416 |
|
143 | #define CLKDIV_SM_SIMULATOR (10416 - 1) // 10 ms => nominal is 1/96 = 0.010416667, 10417 - 1 = 10416 | |
144 | #define TIMER_SM_SIMULATOR 1 |
|
144 | #define TIMER_SM_SIMULATOR 1 | |
145 | #define HK_PERIOD 100 // 100 * 10ms => 1s |
|
145 | #define HK_PERIOD 100 // 100 * 10ms => 1s | |
146 | #define SY_LFR_TIME_SYN_TIMEOUT_in_ms 2000 |
|
146 | #define SY_LFR_TIME_SYN_TIMEOUT_in_ms 2000 | |
147 | #define SY_LFR_TIME_SYN_TIMEOUT_in_ticks 200 // 200 * 10 ms = 2 s |
|
147 | #define SY_LFR_TIME_SYN_TIMEOUT_in_ticks 200 // 200 * 10 ms = 2 s | |
148 |
|
148 | |||
149 | //********** |
|
149 | //********** | |
150 | // LPP CODES |
|
150 | // LPP CODES | |
151 | #define LFR_SUCCESSFUL 0 |
|
151 | #define LFR_SUCCESSFUL 0 | |
152 | #define LFR_DEFAULT 1 |
|
152 | #define LFR_DEFAULT 1 | |
153 | #define LFR_EXE_ERROR 2 |
|
153 | #define LFR_EXE_ERROR 2 | |
154 |
|
154 | |||
155 | //****** |
|
155 | //****** | |
156 | // RTEMS |
|
156 | // RTEMS | |
157 | #define TASKID_RECV 1 |
|
157 | #define TASKID_RECV 1 | |
158 | #define TASKID_ACTN 2 |
|
158 | #define TASKID_ACTN 2 | |
159 | #define TASKID_SPIQ 3 |
|
159 | #define TASKID_SPIQ 3 | |
160 | #define TASKID_STAT 4 |
|
160 | #define TASKID_STAT 4 | |
161 | #define TASKID_AVF0 5 |
|
161 | #define TASKID_AVF0 5 | |
162 | #define TASKID_SWBD 6 |
|
162 | #define TASKID_SWBD 6 | |
163 | #define TASKID_WFRM 7 |
|
163 | #define TASKID_WFRM 7 | |
164 | #define TASKID_DUMB 8 |
|
164 | #define TASKID_DUMB 8 | |
165 | #define TASKID_HOUS 9 |
|
165 | #define TASKID_HOUS 9 | |
166 | #define TASKID_PRC0 10 |
|
166 | #define TASKID_PRC0 10 | |
167 | #define TASKID_CWF3 11 |
|
167 | #define TASKID_CWF3 11 | |
168 | #define TASKID_CWF2 12 |
|
168 | #define TASKID_CWF2 12 | |
169 | #define TASKID_CWF1 13 |
|
169 | #define TASKID_CWF1 13 | |
170 | #define TASKID_SEND 14 |
|
170 | #define TASKID_SEND 14 | |
171 | #define TASKID_WTDG 15 |
|
171 | #define TASKID_WTDG 15 | |
172 | #define TASKID_AVF1 16 |
|
172 | #define TASKID_AVF1 16 | |
173 | #define TASKID_PRC1 17 |
|
173 | #define TASKID_PRC1 17 | |
174 | #define TASKID_AVF2 18 |
|
174 | #define TASKID_AVF2 18 | |
175 | #define TASKID_PRC2 19 |
|
175 | #define TASKID_PRC2 19 | |
176 |
|
176 | |||
177 | #define TASK_PRIORITY_SPIQ 5 |
|
177 | #define TASK_PRIORITY_SPIQ 5 | |
178 | #define TASK_PRIORITY_WTDG 20 |
|
178 | #define TASK_PRIORITY_WTDG 20 | |
179 | #define TASK_PRIORITY_HOUS 30 |
|
179 | #define TASK_PRIORITY_HOUS 30 | |
180 | #define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together |
|
180 | #define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together | |
181 | #define TASK_PRIORITY_CWF2 35 // |
|
181 | #define TASK_PRIORITY_CWF2 35 // | |
182 | #define TASK_PRIORITY_SWBD 37 // SWBD has a lower priority than WFRM, this is to extract the snapshot before sending it |
|
182 | #define TASK_PRIORITY_SWBD 37 // SWBD has a lower priority than WFRM, this is to extract the snapshot before sending it | |
183 | #define TASK_PRIORITY_WFRM 40 |
|
183 | #define TASK_PRIORITY_WFRM 40 | |
184 | #define TASK_PRIORITY_CWF3 40 // there is a printf in this function, be careful with its priority wrt CWF1 |
|
184 | #define TASK_PRIORITY_CWF3 40 // there is a printf in this function, be careful with its priority wrt CWF1 | |
185 | #define TASK_PRIORITY_SEND 45 |
|
185 | #define TASK_PRIORITY_SEND 45 | |
186 | #define TASK_PRIORITY_RECV 50 |
|
186 | #define TASK_PRIORITY_RECV 50 | |
187 | #define TASK_PRIORITY_ACTN 50 |
|
187 | #define TASK_PRIORITY_ACTN 50 | |
188 | #define TASK_PRIORITY_AVF0 60 |
|
188 | #define TASK_PRIORITY_AVF0 60 | |
189 | #define TASK_PRIORITY_AVF1 70 |
|
189 | #define TASK_PRIORITY_AVF1 70 | |
190 | #define TASK_PRIORITY_PRC0 100 |
|
190 | #define TASK_PRIORITY_PRC0 100 | |
191 | #define TASK_PRIORITY_PRC1 100 |
|
191 | #define TASK_PRIORITY_PRC1 100 | |
192 | #define TASK_PRIORITY_AVF2 110 |
|
192 | #define TASK_PRIORITY_AVF2 110 | |
193 | #define TASK_PRIORITY_PRC2 110 |
|
193 | #define TASK_PRIORITY_PRC2 110 | |
194 | #define TASK_PRIORITY_STAT 200 |
|
194 | #define TASK_PRIORITY_STAT 200 | |
195 | #define TASK_PRIORITY_DUMB 200 |
|
195 | #define TASK_PRIORITY_DUMB 200 | |
196 |
|
196 | |||
197 | #define MSG_QUEUE_COUNT_RECV 10 |
|
197 | #define MSG_QUEUE_COUNT_RECV 10 | |
198 | #define MSG_QUEUE_COUNT_SEND 50 |
|
198 | #define MSG_QUEUE_COUNT_SEND 50 | |
199 | #define MSG_QUEUE_COUNT_PRC0 10 |
|
199 | #define MSG_QUEUE_COUNT_PRC0 10 | |
200 | #define MSG_QUEUE_COUNT_PRC1 10 |
|
200 | #define MSG_QUEUE_COUNT_PRC1 10 | |
201 | #define MSG_QUEUE_COUNT_PRC2 5 |
|
201 | #define MSG_QUEUE_COUNT_PRC2 5 | |
202 | #define MSG_QUEUE_SIZE_SEND 810 // 806 + 4 => TM_LFR_SCIENCE_BURST_BP2_F1 |
|
202 | #define MSG_QUEUE_SIZE_SEND 810 // 806 + 4 => TM_LFR_SCIENCE_BURST_BP2_F1 | |
203 | #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options |
|
203 | #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options | |
204 | #define MSG_QUEUE_SIZE_PRC0 20 // two pointers and one rtems_event + 2 integers |
|
204 | #define MSG_QUEUE_SIZE_PRC0 20 // two pointers and one rtems_event + 2 integers | |
205 | #define MSG_QUEUE_SIZE_PRC1 20 // two pointers and one rtems_event + 2 integers |
|
205 | #define MSG_QUEUE_SIZE_PRC1 20 // two pointers and one rtems_event + 2 integers | |
206 | #define MSG_QUEUE_SIZE_PRC2 20 // two pointers and one rtems_event + 2 integers |
|
206 | #define MSG_QUEUE_SIZE_PRC2 20 // two pointers and one rtems_event + 2 integers | |
207 |
|
207 | |||
208 | #define QUEUE_RECV 0 |
|
208 | #define QUEUE_RECV 0 | |
209 | #define QUEUE_SEND 1 |
|
209 | #define QUEUE_SEND 1 | |
210 | #define QUEUE_PRC0 2 |
|
210 | #define QUEUE_PRC0 2 | |
211 | #define QUEUE_PRC1 3 |
|
211 | #define QUEUE_PRC1 3 | |
212 | #define QUEUE_PRC2 4 |
|
212 | #define QUEUE_PRC2 4 | |
213 |
|
213 | |||
214 | //******* |
|
214 | //******* | |
215 | // MACROS |
|
215 | // MACROS | |
216 | #ifdef PRINT_MESSAGES_ON_CONSOLE |
|
216 | #ifdef PRINT_MESSAGES_ON_CONSOLE | |
217 | #define PRINTF(x) printf(x); |
|
217 | #define PRINTF(x) printf(x); | |
218 | #define PRINTF1(x,y) printf(x,y); |
|
218 | #define PRINTF1(x,y) printf(x,y); | |
219 | #define PRINTF2(x,y,z) printf(x,y,z); |
|
219 | #define PRINTF2(x,y,z) printf(x,y,z); | |
220 | #else |
|
220 | #else | |
221 | #define PRINTF(x) ; |
|
221 | #define PRINTF(x) ; | |
222 | #define PRINTF1(x,y) ; |
|
222 | #define PRINTF1(x,y) ; | |
223 | #define PRINTF2(x,y,z) ; |
|
223 | #define PRINTF2(x,y,z) ; | |
224 | #endif |
|
224 | #endif | |
225 |
|
225 | |||
226 | #ifdef BOOT_MESSAGES |
|
226 | #ifdef BOOT_MESSAGES | |
227 | #define BOOT_PRINTF(x) printf(x); |
|
227 | #define BOOT_PRINTF(x) printf(x); | |
228 | #define BOOT_PRINTF1(x,y) printf(x,y); |
|
228 | #define BOOT_PRINTF1(x,y) printf(x,y); | |
229 | #define BOOT_PRINTF2(x,y,z) printf(x,y,z); |
|
229 | #define BOOT_PRINTF2(x,y,z) printf(x,y,z); | |
230 | #else |
|
230 | #else | |
231 | #define BOOT_PRINTF(x) ; |
|
231 | #define BOOT_PRINTF(x) ; | |
232 | #define BOOT_PRINTF1(x,y) ; |
|
232 | #define BOOT_PRINTF1(x,y) ; | |
233 | #define BOOT_PRINTF2(x,y,z) ; |
|
233 | #define BOOT_PRINTF2(x,y,z) ; | |
234 | #endif |
|
234 | #endif | |
235 |
|
235 | |||
236 | #ifdef DEBUG_MESSAGES |
|
236 | #ifdef DEBUG_MESSAGES | |
237 | #define DEBUG_PRINTF(x) printf(x); |
|
237 | #define DEBUG_PRINTF(x) printf(x); | |
238 | #define DEBUG_PRINTF1(x,y) printf(x,y); |
|
238 | #define DEBUG_PRINTF1(x,y) printf(x,y); | |
239 | #define DEBUG_PRINTF2(x,y,z) printf(x,y,z); |
|
239 | #define DEBUG_PRINTF2(x,y,z) printf(x,y,z); | |
240 | #else |
|
240 | #else | |
241 | #define DEBUG_PRINTF(x) ; |
|
241 | #define DEBUG_PRINTF(x) ; | |
242 | #define DEBUG_PRINTF1(x,y) ; |
|
242 | #define DEBUG_PRINTF1(x,y) ; | |
243 | #define DEBUG_PRINTF2(x,y,z) ; |
|
243 | #define DEBUG_PRINTF2(x,y,z) ; | |
244 | #endif |
|
244 | #endif | |
245 |
|
245 | |||
246 | #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period |
|
246 | #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period | |
247 |
|
247 | |||
248 | struct param_local_str{ |
|
248 | struct param_local_str{ | |
249 | unsigned int local_sbm1_nb_cwf_sent; |
|
249 | unsigned int local_sbm1_nb_cwf_sent; | |
250 | unsigned int local_sbm1_nb_cwf_max; |
|
250 | unsigned int local_sbm1_nb_cwf_max; | |
251 | unsigned int local_sbm2_nb_cwf_sent; |
|
251 | unsigned int local_sbm2_nb_cwf_sent; | |
252 | unsigned int local_sbm2_nb_cwf_max; |
|
252 | unsigned int local_sbm2_nb_cwf_max; | |
253 | }; |
|
253 | }; | |
254 |
|
254 | |||
255 | #endif // FSW_PARAMS_H_INCLUDED |
|
255 | #endif // FSW_PARAMS_H_INCLUDED |
@@ -1,6 +1,32 | |||||
1 | #ifndef LFR_CPU_USAGE_REPORT_H |
|
1 | #ifndef LFR_CPU_USAGE_REPORT_H | |
2 | #define LFR_CPU_USAGE_REPORT_H |
|
2 | #define LFR_CPU_USAGE_REPORT_H | |
3 |
|
3 | |||
|
4 | #ifdef HAVE_CONFIG_H | |||
|
5 | #include "config.h" | |||
|
6 | #endif | |||
|
7 | ||||
|
8 | #include <rtems.h> | |||
|
9 | ||||
|
10 | #include <assert.h> | |||
|
11 | #include <string.h> | |||
|
12 | #include <stdlib.h> | |||
|
13 | #include <stdio.h> | |||
|
14 | #include <ctype.h> | |||
|
15 | #include <inttypes.h> | |||
|
16 | ||||
|
17 | #include <rtems/cpuuse.h> | |||
|
18 | #include <rtems/bspIo.h> | |||
|
19 | ||||
|
20 | #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ | |||
|
21 | #include <rtems/score/timestamp.h> | |||
|
22 | #endif | |||
|
23 | ||||
|
24 | #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ | |||
|
25 | extern Timestamp_Control CPU_usage_Uptime_at_last_reset; | |||
|
26 | #else | |||
|
27 | extern uint32_t CPU_usage_Ticks_at_last_reset; | |||
|
28 | #endif | |||
|
29 | ||||
4 | unsigned char lfr_rtems_cpu_usage_report( void ); |
|
30 | unsigned char lfr_rtems_cpu_usage_report( void ); | |
5 |
|
31 | |||
6 | #endif // LFR_CPU_USAGE_REPORT_H |
|
32 | #endif // LFR_CPU_USAGE_REPORT_H |
@@ -1,243 +1,243 | |||||
1 | #ifndef FSW_PROCESSING_H_INCLUDED |
|
1 | #ifndef FSW_PROCESSING_H_INCLUDED | |
2 | #define FSW_PROCESSING_H_INCLUDED |
|
2 | #define FSW_PROCESSING_H_INCLUDED | |
3 |
|
3 | |||
4 | #include <rtems.h> |
|
4 | #include <rtems.h> | |
5 | #include <grspw.h> |
|
5 | #include <grspw.h> | |
6 | #include <math.h> |
|
6 | #include <math.h> | |
7 | #include <stdlib.h> // abs() is in the stdlib |
|
7 | #include <stdlib.h> // abs() is in the stdlib | |
8 | #include <stdio.h> // printf() |
|
8 | #include <stdio.h> // printf() | |
9 | #include <math.h> |
|
9 | #include <math.h> | |
10 |
|
10 | |||
11 | #include "fsw_params.h" |
|
11 | #include "fsw_params.h" | |
12 | #include "fsw_spacewire.h" |
|
12 | #include "fsw_spacewire.h" | |
13 |
|
13 | |||
14 | typedef struct ring_node_sm |
|
14 | typedef struct ring_node_sm | |
15 | { |
|
15 | { | |
16 | struct ring_node_sm *previous; |
|
16 | struct ring_node_sm *previous; | |
17 | struct ring_node_sm *next; |
|
17 | struct ring_node_sm *next; | |
18 | int buffer_address; |
|
18 | int buffer_address; | |
19 | unsigned int status; |
|
19 | unsigned int status; | |
20 | unsigned int coarseTime; |
|
20 | unsigned int coarseTime; | |
21 | unsigned int fineTime; |
|
21 | unsigned int fineTime; | |
22 | } ring_node_sm; |
|
22 | } ring_node_sm; | |
23 |
|
23 | |||
24 | typedef struct ring_node_asm |
|
24 | typedef struct ring_node_asm | |
25 | { |
|
25 | { | |
26 | struct ring_node_asm *next; |
|
26 | struct ring_node_asm *next; | |
27 | float matrix[ TOTAL_SIZE_SM ]; |
|
27 | float matrix[ TOTAL_SIZE_SM ]; | |
28 | unsigned int status; |
|
28 | unsigned int status; | |
29 | } ring_node_asm; |
|
29 | } ring_node_asm; | |
30 |
|
30 | |||
31 | typedef struct |
|
31 | typedef struct | |
32 | { |
|
32 | { | |
33 | Header_TM_LFR_SCIENCE_BP_t header; |
|
33 | Header_TM_LFR_SCIENCE_BP_t header; | |
34 | unsigned char data[ 30 * 22 ]; // MAX size is 22 * 30 [TM_LFR_SCIENCE_BURST_BP2_F1] |
|
34 | unsigned char data[ 30 * 22 ]; // MAX size is 22 * 30 [TM_LFR_SCIENCE_BURST_BP2_F1] | |
35 | } bp_packet; |
|
35 | } bp_packet; | |
36 |
|
36 | |||
37 | typedef struct |
|
37 | typedef struct | |
38 | { |
|
38 | { | |
39 | Header_TM_LFR_SCIENCE_BP_with_spare_t header; |
|
39 | Header_TM_LFR_SCIENCE_BP_with_spare_t header; | |
40 | unsigned char data[ 9 * 13 ]; // only for TM_LFR_SCIENCE_NORMAL_BP1_F0 and F1 |
|
40 | unsigned char data[ 9 * 13 ]; // only for TM_LFR_SCIENCE_NORMAL_BP1_F0 and F1 | |
41 | } bp_packet_with_spare; |
|
41 | } bp_packet_with_spare; | |
42 |
|
42 | |||
43 | typedef struct |
|
43 | typedef struct | |
44 | { |
|
44 | { | |
45 | ring_node_asm *norm; |
|
45 | ring_node_asm *norm; | |
46 | ring_node_asm *burst_sbm; |
|
46 | ring_node_asm *burst_sbm; | |
47 | rtems_event_set event; |
|
47 | rtems_event_set event; | |
48 | unsigned int coarseTime; |
|
48 | unsigned int coarseTime; | |
49 | unsigned int fineTime; |
|
49 | unsigned int fineTime; | |
50 | } asm_msg; |
|
50 | } asm_msg; | |
51 |
|
51 | |||
52 | extern volatile int sm_f0[ ]; |
|
52 | extern volatile int sm_f0[ ]; | |
53 | extern volatile int sm_f1[ ]; |
|
53 | extern volatile int sm_f1[ ]; | |
54 | extern volatile int sm_f2[ ]; |
|
54 | extern volatile int sm_f2[ ]; | |
55 |
|
55 | |||
56 | // parameters |
|
56 | // parameters | |
57 | extern struct param_local_str param_local; |
|
57 | extern struct param_local_str param_local; | |
58 |
|
58 | |||
59 | // registers |
|
59 | // registers | |
60 | extern time_management_regs_t *time_management_regs; |
|
60 | extern time_management_regs_t *time_management_regs; | |
61 | extern spectral_matrix_regs_t *spectral_matrix_regs; |
|
61 | extern spectral_matrix_regs_t *spectral_matrix_regs; | |
62 |
|
62 | |||
63 | extern rtems_name misc_name[5]; |
|
63 | extern rtems_name misc_name[5]; | |
64 | extern rtems_id Task_id[20]; /* array of task ids */ |
|
64 | extern rtems_id Task_id[20]; /* array of task ids */ | |
65 |
|
65 | |||
66 | // ISR |
|
66 | // ISR | |
67 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ); |
|
67 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ); | |
68 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ); |
|
68 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ); | |
69 |
|
69 | |||
70 | //****************** |
|
70 | //****************** | |
71 | // Spectral Matrices |
|
71 | // Spectral Matrices | |
72 | void reset_nb_sm( void ); |
|
72 | void reset_nb_sm( void ); | |
73 | // SM |
|
73 | // SM | |
74 | void SM_init_rings( void ); |
|
74 | void SM_init_rings( void ); | |
75 | void SM_reset_current_ring_nodes( void ); |
|
75 | void SM_reset_current_ring_nodes( void ); | |
76 | void SM_generic_init_ring(ring_node_sm *ring, unsigned char nbNodes, volatile int sm_f[] ); |
|
76 | void SM_generic_init_ring(ring_node_sm *ring, unsigned char nbNodes, volatile int sm_f[] ); | |
77 | // ASM |
|
77 | // ASM | |
78 | void ASM_generic_init_ring(ring_node_asm *ring, unsigned char nbNodes ); |
|
78 | void ASM_generic_init_ring(ring_node_asm *ring, unsigned char nbNodes ); | |
79 | void ASM_init_header( Header_TM_LFR_SCIENCE_ASM_t *header); |
|
79 | void ASM_init_header( Header_TM_LFR_SCIENCE_ASM_t *header); | |
80 | void ASM_send(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, |
|
80 | void ASM_send(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, | |
81 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id); |
|
81 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id); | |
82 |
|
82 | |||
83 | //***************** |
|
83 | //***************** | |
84 | // Basic Parameters |
|
84 | // Basic Parameters | |
85 |
|
85 | |||
86 | void BP_reset_current_ring_nodes( void ); |
|
86 | void BP_reset_current_ring_nodes( void ); | |
87 | void BP_init_header( Header_TM_LFR_SCIENCE_BP_t *header, |
|
87 | void BP_init_header( Header_TM_LFR_SCIENCE_BP_t *header, | |
88 | unsigned int apid, unsigned char sid, |
|
88 | unsigned int apid, unsigned char sid, | |
89 | unsigned int packetLength , unsigned char blkNr); |
|
89 | unsigned int packetLength , unsigned char blkNr); | |
90 | void BP_init_header_with_spare( Header_TM_LFR_SCIENCE_BP_with_spare_t *header, |
|
90 | void BP_init_header_with_spare( Header_TM_LFR_SCIENCE_BP_with_spare_t *header, | |
91 | unsigned int apid, unsigned char sid, |
|
91 | unsigned int apid, unsigned char sid, | |
92 | unsigned int packetLength, unsigned char blkNr ); |
|
92 | unsigned int packetLength, unsigned char blkNr ); | |
93 | void BP_send( char *data, |
|
93 | void BP_send( char *data, | |
94 | rtems_id queue_id , |
|
94 | rtems_id queue_id , | |
95 | unsigned int nbBytesToSend , unsigned int sid ); |
|
95 | unsigned int nbBytesToSend , unsigned int sid ); | |
96 |
|
96 | |||
97 | //****************** |
|
97 | //****************** | |
98 | // general functions |
|
98 | // general functions | |
99 | void reset_spectral_matrix_regs( void ); |
|
99 | void reset_spectral_matrix_regs( void ); | |
100 | void set_time(unsigned char *time, unsigned char *timeInBuffer ); |
|
100 | void set_time(unsigned char *time, unsigned char *timeInBuffer ); | |
101 | unsigned long long int get_acquisition_time( unsigned char *timePtr ); |
|
101 | unsigned long long int get_acquisition_time( unsigned char *timePtr ); | |
102 | void close_matrix_actions(unsigned int *nb_sm, unsigned int nb_sm_before_avf, rtems_id task_id, |
|
102 | void close_matrix_actions(unsigned int *nb_sm, unsigned int nb_sm_before_avf, rtems_id avf_task_id, | |
103 | ring_node_sm *node_for_averaging, ring_node_sm *ringNode, unsigned long long int time); |
|
103 | ring_node_sm *node_for_averaging, ring_node_sm *ringNode, unsigned long long int time); | |
104 | unsigned char getSID( rtems_event_set event ); |
|
104 | unsigned char getSID( rtems_event_set event ); | |
105 |
|
105 | |||
106 | extern rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id ); |
|
106 | extern rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id ); | |
107 | extern rtems_status_code get_message_queue_id_prc2( rtems_id *queue_id ); |
|
107 | extern rtems_status_code get_message_queue_id_prc2( rtems_id *queue_id ); | |
108 |
|
108 | |||
109 | //*************************************** |
|
109 | //*************************************** | |
110 | // DEFINITIONS OF STATIC INLINE FUNCTIONS |
|
110 | // DEFINITIONS OF STATIC INLINE FUNCTIONS | |
111 | static inline void SM_average( float *averaged_spec_mat_NORM, float *averaged_spec_mat_SBM, |
|
111 | static inline void SM_average( float *averaged_spec_mat_NORM, float *averaged_spec_mat_SBM, | |
112 | ring_node_sm *ring_node_tab[], |
|
112 | ring_node_sm *ring_node_tab[], | |
113 | unsigned int nbAverageNORM, unsigned int nbAverageSBM ); |
|
113 | unsigned int nbAverageNORM, unsigned int nbAverageSBM ); | |
114 | static inline void ASM_reorganize_and_divide(float *averaged_spec_mat, float *averaged_spec_mat_reorganized, |
|
114 | static inline void ASM_reorganize_and_divide(float *averaged_spec_mat, float *averaged_spec_mat_reorganized, | |
115 | float divider ); |
|
115 | float divider ); | |
116 | static inline void ASM_compress_reorganize_and_divide(float *averaged_spec_mat, float *compressed_spec_mat, |
|
116 | static inline void ASM_compress_reorganize_and_divide(float *averaged_spec_mat, float *compressed_spec_mat, | |
117 | float divider, |
|
117 | float divider, | |
118 | unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage , unsigned char ASMIndexStart); |
|
118 | unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage , unsigned char ASMIndexStart); | |
119 | static inline void ASM_convert(volatile float *input_matrix, char *output_matrix); |
|
119 | static inline void ASM_convert(volatile float *input_matrix, char *output_matrix); | |
120 |
|
120 | |||
121 | void SM_average( float *averaged_spec_mat_NORM, float *averaged_spec_mat_SBM, |
|
121 | void SM_average( float *averaged_spec_mat_NORM, float *averaged_spec_mat_SBM, | |
122 | ring_node_sm *ring_node_tab[], |
|
122 | ring_node_sm *ring_node_tab[], | |
123 | unsigned int nbAverageNORM, unsigned int nbAverageSBM ) |
|
123 | unsigned int nbAverageNORM, unsigned int nbAverageSBM ) | |
124 | { |
|
124 | { | |
125 | float sum; |
|
125 | float sum; | |
126 | unsigned int i; |
|
126 | unsigned int i; | |
127 |
|
127 | |||
128 | for(i=0; i<TOTAL_SIZE_SM; i++) |
|
128 | for(i=0; i<TOTAL_SIZE_SM; i++) | |
129 | { |
|
129 | { | |
130 | sum = ( (int *) (ring_node_tab[0]->buffer_address) ) [ i ] |
|
130 | sum = ( (int *) (ring_node_tab[0]->buffer_address) ) [ i ] | |
131 | + ( (int *) (ring_node_tab[1]->buffer_address) ) [ i ] |
|
131 | + ( (int *) (ring_node_tab[1]->buffer_address) ) [ i ] | |
132 | + ( (int *) (ring_node_tab[2]->buffer_address) ) [ i ] |
|
132 | + ( (int *) (ring_node_tab[2]->buffer_address) ) [ i ] | |
133 | + ( (int *) (ring_node_tab[3]->buffer_address) ) [ i ] |
|
133 | + ( (int *) (ring_node_tab[3]->buffer_address) ) [ i ] | |
134 | + ( (int *) (ring_node_tab[4]->buffer_address) ) [ i ] |
|
134 | + ( (int *) (ring_node_tab[4]->buffer_address) ) [ i ] | |
135 | + ( (int *) (ring_node_tab[5]->buffer_address) ) [ i ] |
|
135 | + ( (int *) (ring_node_tab[5]->buffer_address) ) [ i ] | |
136 | + ( (int *) (ring_node_tab[6]->buffer_address) ) [ i ] |
|
136 | + ( (int *) (ring_node_tab[6]->buffer_address) ) [ i ] | |
137 | + ( (int *) (ring_node_tab[7]->buffer_address) ) [ i ]; |
|
137 | + ( (int *) (ring_node_tab[7]->buffer_address) ) [ i ]; | |
138 |
|
138 | |||
139 | if ( (nbAverageNORM == 0) && (nbAverageSBM == 0) ) |
|
139 | if ( (nbAverageNORM == 0) && (nbAverageSBM == 0) ) | |
140 | { |
|
140 | { | |
141 | averaged_spec_mat_NORM[ i ] = sum; |
|
141 | averaged_spec_mat_NORM[ i ] = sum; | |
142 | averaged_spec_mat_SBM[ i ] = sum; |
|
142 | averaged_spec_mat_SBM[ i ] = sum; | |
143 | } |
|
143 | } | |
144 | else if ( (nbAverageNORM != 0) && (nbAverageSBM != 0) ) |
|
144 | else if ( (nbAverageNORM != 0) && (nbAverageSBM != 0) ) | |
145 | { |
|
145 | { | |
146 | averaged_spec_mat_NORM[ i ] = ( averaged_spec_mat_NORM[ i ] + sum ); |
|
146 | averaged_spec_mat_NORM[ i ] = ( averaged_spec_mat_NORM[ i ] + sum ); | |
147 | averaged_spec_mat_SBM[ i ] = ( averaged_spec_mat_SBM[ i ] + sum ); |
|
147 | averaged_spec_mat_SBM[ i ] = ( averaged_spec_mat_SBM[ i ] + sum ); | |
148 | } |
|
148 | } | |
149 | else if ( (nbAverageNORM != 0) && (nbAverageSBM == 0) ) |
|
149 | else if ( (nbAverageNORM != 0) && (nbAverageSBM == 0) ) | |
150 | { |
|
150 | { | |
151 | averaged_spec_mat_NORM[ i ] = ( averaged_spec_mat_NORM[ i ] + sum ); |
|
151 | averaged_spec_mat_NORM[ i ] = ( averaged_spec_mat_NORM[ i ] + sum ); | |
152 | averaged_spec_mat_SBM[ i ] = sum; |
|
152 | averaged_spec_mat_SBM[ i ] = sum; | |
153 | } |
|
153 | } | |
154 | else |
|
154 | else | |
155 | { |
|
155 | { | |
156 | PRINTF2("ERR *** in SM_average *** unexpected parameters %d %d\n", nbAverageNORM, nbAverageSBM) |
|
156 | PRINTF2("ERR *** in SM_average *** unexpected parameters %d %d\n", nbAverageNORM, nbAverageSBM) | |
157 | } |
|
157 | } | |
158 | } |
|
158 | } | |
159 | } |
|
159 | } | |
160 |
|
160 | |||
161 | void ASM_reorganize_and_divide( float *averaged_spec_mat, float *averaged_spec_mat_reorganized, float divider ) |
|
161 | void ASM_reorganize_and_divide( float *averaged_spec_mat, float *averaged_spec_mat_reorganized, float divider ) | |
162 | { |
|
162 | { | |
163 | int frequencyBin; |
|
163 | int frequencyBin; | |
164 | int asmComponent; |
|
164 | int asmComponent; | |
165 | unsigned int offsetAveragedSpecMatReorganized; |
|
165 | unsigned int offsetAveragedSpecMatReorganized; | |
166 | unsigned int offsetAveragedSpecMat; |
|
166 | unsigned int offsetAveragedSpecMat; | |
167 |
|
167 | |||
168 | for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++) |
|
168 | for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++) | |
169 | { |
|
169 | { | |
170 | for( frequencyBin = 0; frequencyBin < NB_BINS_PER_SM; frequencyBin++ ) |
|
170 | for( frequencyBin = 0; frequencyBin < NB_BINS_PER_SM; frequencyBin++ ) | |
171 | { |
|
171 | { | |
172 | offsetAveragedSpecMatReorganized = |
|
172 | offsetAveragedSpecMatReorganized = | |
173 | frequencyBin * NB_VALUES_PER_SM |
|
173 | frequencyBin * NB_VALUES_PER_SM | |
174 | + asmComponent; |
|
174 | + asmComponent; | |
175 | offsetAveragedSpecMat = |
|
175 | offsetAveragedSpecMat = | |
176 | asmComponent * NB_BINS_PER_SM |
|
176 | asmComponent * NB_BINS_PER_SM | |
177 | + frequencyBin; |
|
177 | + frequencyBin; | |
178 | averaged_spec_mat_reorganized[offsetAveragedSpecMatReorganized ] = |
|
178 | averaged_spec_mat_reorganized[offsetAveragedSpecMatReorganized ] = | |
179 | averaged_spec_mat[ offsetAveragedSpecMat ] / divider; |
|
179 | averaged_spec_mat[ offsetAveragedSpecMat ] / divider; | |
180 | } |
|
180 | } | |
181 | } |
|
181 | } | |
182 | } |
|
182 | } | |
183 |
|
183 | |||
184 | void ASM_compress_reorganize_and_divide(float *averaged_spec_mat, float *compressed_spec_mat , float divider, |
|
184 | void ASM_compress_reorganize_and_divide(float *averaged_spec_mat, float *compressed_spec_mat , float divider, | |
185 | unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage, unsigned char ASMIndexStart ) |
|
185 | unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage, unsigned char ASMIndexStart ) | |
186 | { |
|
186 | { | |
187 | int frequencyBin; |
|
187 | int frequencyBin; | |
188 | int asmComponent; |
|
188 | int asmComponent; | |
189 | int offsetASM; |
|
189 | int offsetASM; | |
190 | int offsetCompressed; |
|
190 | int offsetCompressed; | |
191 | int k; |
|
191 | int k; | |
192 |
|
192 | |||
193 | // build data |
|
193 | // build data | |
194 | for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++) |
|
194 | for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++) | |
195 | { |
|
195 | { | |
196 | for( frequencyBin = 0; frequencyBin < nbBinsCompressedMatrix; frequencyBin++ ) |
|
196 | for( frequencyBin = 0; frequencyBin < nbBinsCompressedMatrix; frequencyBin++ ) | |
197 | { |
|
197 | { | |
198 | offsetCompressed = // NO TIME OFFSET |
|
198 | offsetCompressed = // NO TIME OFFSET | |
199 | frequencyBin * NB_VALUES_PER_SM |
|
199 | frequencyBin * NB_VALUES_PER_SM | |
200 | + asmComponent; |
|
200 | + asmComponent; | |
201 | offsetASM = // NO TIME OFFSET |
|
201 | offsetASM = // NO TIME OFFSET | |
202 | asmComponent * NB_BINS_PER_SM |
|
202 | asmComponent * NB_BINS_PER_SM | |
203 | + ASMIndexStart |
|
203 | + ASMIndexStart | |
204 | + frequencyBin * nbBinsToAverage; |
|
204 | + frequencyBin * nbBinsToAverage; | |
205 | compressed_spec_mat[ offsetCompressed ] = 0; |
|
205 | compressed_spec_mat[ offsetCompressed ] = 0; | |
206 | for ( k = 0; k < nbBinsToAverage; k++ ) |
|
206 | for ( k = 0; k < nbBinsToAverage; k++ ) | |
207 | { |
|
207 | { | |
208 | compressed_spec_mat[offsetCompressed ] = |
|
208 | compressed_spec_mat[offsetCompressed ] = | |
209 | ( compressed_spec_mat[ offsetCompressed ] |
|
209 | ( compressed_spec_mat[ offsetCompressed ] | |
210 | + averaged_spec_mat[ offsetASM + k ] ) / (divider * nbBinsToAverage); |
|
210 | + averaged_spec_mat[ offsetASM + k ] ) / (divider * nbBinsToAverage); | |
211 | } |
|
211 | } | |
212 | } |
|
212 | } | |
213 | } |
|
213 | } | |
214 | } |
|
214 | } | |
215 |
|
215 | |||
216 | void ASM_convert( volatile float *input_matrix, char *output_matrix) |
|
216 | void ASM_convert( volatile float *input_matrix, char *output_matrix) | |
217 | { |
|
217 | { | |
218 | unsigned int frequencyBin; |
|
218 | unsigned int frequencyBin; | |
219 | unsigned int asmComponent; |
|
219 | unsigned int asmComponent; | |
220 | char * pt_char_input; |
|
220 | char * pt_char_input; | |
221 | char * pt_char_output; |
|
221 | char * pt_char_output; | |
222 | unsigned int offsetInput; |
|
222 | unsigned int offsetInput; | |
223 | unsigned int offsetOutput; |
|
223 | unsigned int offsetOutput; | |
224 |
|
224 | |||
225 | pt_char_input = (char*) &input_matrix; |
|
225 | pt_char_input = (char*) &input_matrix; | |
226 | pt_char_output = (char*) &output_matrix; |
|
226 | pt_char_output = (char*) &output_matrix; | |
227 |
|
227 | |||
228 | // convert all other data |
|
228 | // convert all other data | |
229 | for( frequencyBin=0; frequencyBin<NB_BINS_PER_SM; frequencyBin++) |
|
229 | for( frequencyBin=0; frequencyBin<NB_BINS_PER_SM; frequencyBin++) | |
230 | { |
|
230 | { | |
231 | for ( asmComponent=0; asmComponent<NB_VALUES_PER_SM; asmComponent++) |
|
231 | for ( asmComponent=0; asmComponent<NB_VALUES_PER_SM; asmComponent++) | |
232 | { |
|
232 | { | |
233 | offsetInput = (frequencyBin*NB_VALUES_PER_SM) + asmComponent ; |
|
233 | offsetInput = (frequencyBin*NB_VALUES_PER_SM) + asmComponent ; | |
234 | offsetOutput = 2 * ( (frequencyBin*NB_VALUES_PER_SM) + asmComponent ) ; |
|
234 | offsetOutput = 2 * ( (frequencyBin*NB_VALUES_PER_SM) + asmComponent ) ; | |
235 | pt_char_input = (char*) &input_matrix [ offsetInput ]; |
|
235 | pt_char_input = (char*) &input_matrix [ offsetInput ]; | |
236 | pt_char_output = (char*) &output_matrix[ offsetOutput ]; |
|
236 | pt_char_output = (char*) &output_matrix[ offsetOutput ]; | |
237 | pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float |
|
237 | pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float | |
238 | pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float |
|
238 | pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float | |
239 | } |
|
239 | } | |
240 | } |
|
240 | } | |
241 | } |
|
241 | } | |
242 |
|
242 | |||
243 | #endif // FSW_PROCESSING_H_INCLUDED |
|
243 | #endif // FSW_PROCESSING_H_INCLUDED |
@@ -1,49 +1,51 | |||||
1 | #ifndef TC_LOAD_DUMP_PARAMETERS_H |
|
1 | #ifndef TC_LOAD_DUMP_PARAMETERS_H | |
2 | #define TC_LOAD_DUMP_PARAMETERS_H |
|
2 | #define TC_LOAD_DUMP_PARAMETERS_H | |
3 |
|
3 | |||
4 | #include <rtems.h> |
|
4 | #include <rtems.h> | |
5 | #include <stdio.h> |
|
5 | #include <stdio.h> | |
6 |
|
6 | |||
7 | #include "fsw_params.h" |
|
7 | #include "fsw_params.h" | |
8 | #include "wf_handler.h" |
|
8 | #include "wf_handler.h" | |
9 | #include "tm_lfr_tc_exe.h" |
|
9 | #include "tm_lfr_tc_exe.h" | |
10 | #include "fsw_misc.h" |
|
10 | #include "fsw_misc.h" | |
11 |
|
11 | |||
|
12 | #define FLOAT_EQUAL_ZERO 0.001 | |||
|
13 | ||||
12 | extern unsigned short sequenceCounterParameterDump; |
|
14 | extern unsigned short sequenceCounterParameterDump; | |
13 |
|
15 | |||
14 | int action_load_common_par( ccsdsTelecommandPacket_t *TC ); |
|
16 | int action_load_common_par( ccsdsTelecommandPacket_t *TC ); | |
15 | int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time); |
|
17 | int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time); | |
16 | int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time); |
|
18 | int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time); | |
17 | int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time); |
|
19 | int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time); | |
18 | int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time); |
|
20 | int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time); | |
19 | int action_dump_par(rtems_id queue_id ); |
|
21 | int action_dump_par(rtems_id queue_id ); | |
20 |
|
22 | |||
21 | // NORMAL |
|
23 | // NORMAL | |
22 | int check_common_par_consistency( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); |
|
24 | int check_common_par_consistency( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); | |
23 | int set_sy_lfr_n_swf_l( ccsdsTelecommandPacket_t *TC ); |
|
25 | int set_sy_lfr_n_swf_l( ccsdsTelecommandPacket_t *TC ); | |
24 | int set_sy_lfr_n_swf_p( ccsdsTelecommandPacket_t *TC ); |
|
26 | int set_sy_lfr_n_swf_p( ccsdsTelecommandPacket_t *TC ); | |
25 | int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC ); |
|
27 | int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC ); | |
26 | int set_sy_lfr_n_bp_p0( ccsdsTelecommandPacket_t *TC ); |
|
28 | int set_sy_lfr_n_bp_p0( ccsdsTelecommandPacket_t *TC ); | |
27 | int set_sy_lfr_n_bp_p1( ccsdsTelecommandPacket_t *TC ); |
|
29 | int set_sy_lfr_n_bp_p1( ccsdsTelecommandPacket_t *TC ); | |
28 | int set_sy_lfr_n_cwf_long_f3( ccsdsTelecommandPacket_t *TC ); |
|
30 | int set_sy_lfr_n_cwf_long_f3( ccsdsTelecommandPacket_t *TC ); | |
29 |
|
31 | |||
30 | // BURST |
|
32 | // BURST | |
31 | int set_sy_lfr_b_bp_p0( ccsdsTelecommandPacket_t *TC ); |
|
33 | int set_sy_lfr_b_bp_p0( ccsdsTelecommandPacket_t *TC ); | |
32 | int set_sy_lfr_b_bp_p1( ccsdsTelecommandPacket_t *TC ); |
|
34 | int set_sy_lfr_b_bp_p1( ccsdsTelecommandPacket_t *TC ); | |
33 |
|
35 | |||
34 | // SBM1 |
|
36 | // SBM1 | |
35 | int set_sy_lfr_s1_bp_p0( ccsdsTelecommandPacket_t *TC ); |
|
37 | int set_sy_lfr_s1_bp_p0( ccsdsTelecommandPacket_t *TC ); | |
36 | int set_sy_lfr_s1_bp_p1( ccsdsTelecommandPacket_t *TC ); |
|
38 | int set_sy_lfr_s1_bp_p1( ccsdsTelecommandPacket_t *TC ); | |
37 |
|
39 | |||
38 | // SBM2 |
|
40 | // SBM2 | |
39 | int set_sy_lfr_s2_bp_p0( ccsdsTelecommandPacket_t *TC ); |
|
41 | int set_sy_lfr_s2_bp_p0( ccsdsTelecommandPacket_t *TC ); | |
40 | int set_sy_lfr_s2_bp_p1( ccsdsTelecommandPacket_t *TC ); |
|
42 | int set_sy_lfr_s2_bp_p1( ccsdsTelecommandPacket_t *TC ); | |
41 |
|
43 | |||
42 | // TC_LFR_UPDATE_INFO |
|
44 | // TC_LFR_UPDATE_INFO | |
43 | unsigned int check_update_info_hk_lfr_mode( unsigned char mode ); |
|
45 | unsigned int check_update_info_hk_lfr_mode( unsigned char mode ); | |
44 | unsigned int check_update_info_hk_tds_mode( unsigned char mode ); |
|
46 | unsigned int check_update_info_hk_tds_mode( unsigned char mode ); | |
45 | unsigned int check_update_info_hk_thr_mode( unsigned char mode ); |
|
47 | unsigned int check_update_info_hk_thr_mode( unsigned char mode ); | |
46 |
|
48 | |||
47 | void init_parameter_dump( void ); |
|
49 | void init_parameter_dump( void ); | |
48 |
|
50 | |||
49 | #endif // TC_LOAD_DUMP_PARAMETERS_H |
|
51 | #endif // TC_LOAD_DUMP_PARAMETERS_H |
@@ -1,55 +1,25 | |||||
1 | #include <drvmgr/ambapp_bus.h> |
|
1 | #include <drvmgr/ambapp_bus.h> | |
2 |
|
2 | |||
3 | // GRSPW0 resources |
|
3 | // GRSPW0 resources | |
4 | struct drvmgr_key grlib_grspw_0n1_res[] = { |
|
4 | struct drvmgr_key grlib_grspw_0n1_res[] = { | |
5 | {"txBdCnt", KEY_TYPE_INT, {(unsigned int)50}}, // 7 SWF_F0, 7 SWF_F1, 7 SWF_F2, 7 CWF_F3, 7 CWF_F1 ou 7 CWF_F2 |
|
5 | {"txBdCnt", KEY_TYPE_INT, {(unsigned int)50}}, // 7 SWF_F0, 7 SWF_F1, 7 SWF_F2, 7 CWF_F3, 7 CWF_F1 ou 7 CWF_F2 | |
6 | {"rxBdCnt", KEY_TYPE_INT, {(unsigned int)10}}, |
|
6 | {"rxBdCnt", KEY_TYPE_INT, {(unsigned int)10}}, | |
7 | {"txDataSize", KEY_TYPE_INT, {(unsigned int)4096}}, |
|
7 | {"txDataSize", KEY_TYPE_INT, {(unsigned int)4096}}, | |
8 | {"txHdrSize", KEY_TYPE_INT, {(unsigned int)20+12}}, // 12 is for the auxiliary header, when needed |
|
8 | {"txHdrSize", KEY_TYPE_INT, {(unsigned int)20+12}}, // 12 is for the auxiliary header, when needed | |
9 | {"rxPktSize", KEY_TYPE_INT, {(unsigned int)248+4}}, |
|
9 | {"rxPktSize", KEY_TYPE_INT, {(unsigned int)248+4}}, | |
10 | KEY_EMPTY |
|
10 | KEY_EMPTY | |
11 | }; |
|
11 | }; | |
12 |
|
12 | |||
13 | #if 0 |
|
|||
14 | /* APBUART0 */ |
|
|||
15 | struct drvmgr_key grlib_drv_res_apbuart0[] = |
|
|||
16 | { |
|
|||
17 | {"mode", KEY_TYPE_INT, {(unsigned int)1}}, |
|
|||
18 | {"syscon", KEY_TYPE_INT, {(unsigned int)1}}, |
|
|||
19 | KEY_EMPTY |
|
|||
20 | }; |
|
|||
21 | /* APBUART1 */ |
|
|||
22 | struct drvmgr_key grlib_drv_res_apbuart1[] = |
|
|||
23 | { |
|
|||
24 | {"mode", KEY_TYPE_INT, {(unsigned int)1}}, |
|
|||
25 | {"syscon", KEY_TYPE_INT, {(unsigned int)0}}, |
|
|||
26 | KEY_EMPTY |
|
|||
27 | }; |
|
|||
28 | /* LEON3 System with driver configuration for 2 APBUARTs, the |
|
|||
29 | * the rest of the AMBA device drivers use their defaults. |
|
|||
30 | */ |
|
|||
31 |
|
||||
32 | /* Override default debug UART assignment. |
|
|||
33 | * 0 = Default APBUART. APBUART[0], but on MP system CPU0=APBUART0, |
|
|||
34 | * CPU1=APBUART1... |
|
|||
35 | * 1 = APBUART[0] |
|
|||
36 | * 2 = APBUART[1] |
|
|||
37 | * 3 = APBUART[2] |
|
|||
38 | * ... |
|
|||
39 | */ |
|
|||
40 | //int debug_uart_index = 2; /* second UART -- APBUART[1] */ |
|
|||
41 | #endif |
|
|||
42 |
|
||||
43 | // If RTEMS_DRVMGR_STARTUP is defined we override the "weak defaults" that is defined by the LEON3 BSP. |
|
13 | // If RTEMS_DRVMGR_STARTUP is defined we override the "weak defaults" that is defined by the LEON3 BSP. | |
44 |
|
14 | |||
45 | struct drvmgr_bus_res grlib_drv_resources = { |
|
15 | struct drvmgr_bus_res grlib_drv_resources = { | |
46 | .next = NULL, |
|
16 | .next = NULL, | |
47 | .resource = { |
|
17 | .resource = { | |
48 | {DRIVER_AMBAPP_GAISLER_GRSPW_ID, 0, &grlib_grspw_0n1_res[0]}, |
|
18 | {DRIVER_AMBAPP_GAISLER_GRSPW_ID, 0, &grlib_grspw_0n1_res[0]}, | |
49 | // {DRIVER_AMBAPP_GAISLER_APBUART_ID, 0, &grlib_drv_res_apbuart0[0]}, |
|
19 | // {DRIVER_AMBAPP_GAISLER_APBUART_ID, 0, &grlib_drv_res_apbuart0[0]}, | |
50 | // {DRIVER_AMBAPP_GAISLER_APBUART_ID, 1, &grlib_drv_res_apbuart1[0]}, |
|
20 | // {DRIVER_AMBAPP_GAISLER_APBUART_ID, 1, &grlib_drv_res_apbuart1[0]}, | |
51 | RES_EMPTY /* Mark end of device resource array */ |
|
21 | RES_EMPTY /* Mark end of device resource array */ | |
52 | } |
|
22 | } | |
53 | }; |
|
23 | }; | |
54 |
|
24 | |||
55 |
|
25 |
@@ -1,529 +1,530 | |||||
1 | /** General usage functions and RTEMS tasks. |
|
1 | /** General usage functions and RTEMS tasks. | |
2 | * |
|
2 | * | |
3 | * @file |
|
3 | * @file | |
4 | * @author P. LEROY |
|
4 | * @author P. LEROY | |
5 | * |
|
5 | * | |
6 | */ |
|
6 | */ | |
7 |
|
7 | |||
8 | #include "fsw_misc.h" |
|
8 | #include "fsw_misc.h" | |
9 |
|
9 | |||
10 | void configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider, |
|
10 | void configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider, | |
11 | unsigned char interrupt_level, rtems_isr (*timer_isr)() ) |
|
11 | unsigned char interrupt_level, rtems_isr (*timer_isr)() ) | |
12 | { |
|
12 | { | |
13 | /** This function configures a GPTIMER timer instantiated in the VHDL design. |
|
13 | /** This function configures a GPTIMER timer instantiated in the VHDL design. | |
14 | * |
|
14 | * | |
15 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. |
|
15 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. | |
16 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). |
|
16 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). | |
17 | * @param clock_divider is the divider of the 1 MHz clock that will be configured. |
|
17 | * @param clock_divider is the divider of the 1 MHz clock that will be configured. | |
18 | * @param interrupt_level is the interrupt level that the timer drives. |
|
18 | * @param interrupt_level is the interrupt level that the timer drives. | |
19 | * @param timer_isr is the interrupt subroutine that will be attached to the IRQ driven by the timer. |
|
19 | * @param timer_isr is the interrupt subroutine that will be attached to the IRQ driven by the timer. | |
20 | * |
|
20 | * | |
21 | * Interrupt levels are described in the SPARC documentation sparcv8.pdf p.76 |
|
21 | * Interrupt levels are described in the SPARC documentation sparcv8.pdf p.76 | |
22 | * |
|
22 | * | |
23 | */ |
|
23 | */ | |
24 |
|
24 | |||
25 | rtems_status_code status; |
|
25 | rtems_status_code status; | |
26 | rtems_isr_entry old_isr_handler; |
|
26 | rtems_isr_entry old_isr_handler; | |
27 |
|
27 | |||
28 | gptimer_regs->timer[timer].ctrl = 0x00; // reset the control register |
|
28 | gptimer_regs->timer[timer].ctrl = 0x00; // reset the control register | |
29 |
|
29 | |||
30 | status = rtems_interrupt_catch( timer_isr, interrupt_level, &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels |
|
30 | status = rtems_interrupt_catch( timer_isr, interrupt_level, &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels | |
31 | if (status!=RTEMS_SUCCESSFUL) |
|
31 | if (status!=RTEMS_SUCCESSFUL) | |
32 | { |
|
32 | { | |
33 | PRINTF("in configure_timer *** ERR rtems_interrupt_catch\n") |
|
33 | PRINTF("in configure_timer *** ERR rtems_interrupt_catch\n") | |
34 | } |
|
34 | } | |
35 |
|
35 | |||
36 | timer_set_clock_divider( gptimer_regs, timer, clock_divider); |
|
36 | timer_set_clock_divider( gptimer_regs, timer, clock_divider); | |
37 | } |
|
37 | } | |
38 |
|
38 | |||
39 | void timer_start(gptimer_regs_t *gptimer_regs, unsigned char timer) |
|
39 | void timer_start(gptimer_regs_t *gptimer_regs, unsigned char timer) | |
40 | { |
|
40 | { | |
41 | /** This function starts a GPTIMER timer. |
|
41 | /** This function starts a GPTIMER timer. | |
42 | * |
|
42 | * | |
43 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. |
|
43 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. | |
44 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). |
|
44 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). | |
45 | * |
|
45 | * | |
46 | */ |
|
46 | */ | |
47 |
|
47 | |||
48 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any |
|
48 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any | |
49 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000004; // LD load value from the reload register |
|
49 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000004; // LD load value from the reload register | |
50 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000001; // EN enable the timer |
|
50 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000001; // EN enable the timer | |
51 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000002; // RS restart |
|
51 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000002; // RS restart | |
52 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000008; // IE interrupt enable |
|
52 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000008; // IE interrupt enable | |
53 | } |
|
53 | } | |
54 |
|
54 | |||
55 | void timer_stop(gptimer_regs_t *gptimer_regs, unsigned char timer) |
|
55 | void timer_stop(gptimer_regs_t *gptimer_regs, unsigned char timer) | |
56 | { |
|
56 | { | |
57 | /** This function stops a GPTIMER timer. |
|
57 | /** This function stops a GPTIMER timer. | |
58 | * |
|
58 | * | |
59 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. |
|
59 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. | |
60 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). |
|
60 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). | |
61 | * |
|
61 | * | |
62 | */ |
|
62 | */ | |
63 |
|
63 | |||
64 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xfffffffe; // EN enable the timer |
|
64 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xfffffffe; // EN enable the timer | |
65 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xffffffef; // IE interrupt enable |
|
65 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xffffffef; // IE interrupt enable | |
66 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any |
|
66 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any | |
67 | } |
|
67 | } | |
68 |
|
68 | |||
69 | void timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider) |
|
69 | void timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider) | |
70 | { |
|
70 | { | |
71 | /** This function sets the clock divider of a GPTIMER timer. |
|
71 | /** This function sets the clock divider of a GPTIMER timer. | |
72 | * |
|
72 | * | |
73 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. |
|
73 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. | |
74 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). |
|
74 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). | |
75 | * @param clock_divider is the divider of the 1 MHz clock that will be configured. |
|
75 | * @param clock_divider is the divider of the 1 MHz clock that will be configured. | |
76 | * |
|
76 | * | |
77 | */ |
|
77 | */ | |
78 |
|
78 | |||
79 | gptimer_regs->timer[timer].reload = clock_divider; // base clock frequency is 1 MHz |
|
79 | gptimer_regs->timer[timer].reload = clock_divider; // base clock frequency is 1 MHz | |
80 | } |
|
80 | } | |
81 |
|
81 | |||
82 | int send_console_outputs_on_apbuart_port( void ) // Send the console outputs on the apbuart port |
|
82 | int send_console_outputs_on_apbuart_port( void ) // Send the console outputs on the apbuart port | |
83 | { |
|
83 | { | |
84 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART; |
|
84 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART; | |
85 |
|
85 | |||
86 | apbuart_regs->ctrl = APBUART_CTRL_REG_MASK_TE; |
|
86 | apbuart_regs->ctrl = APBUART_CTRL_REG_MASK_TE; | |
87 |
|
87 | |||
88 | return 0; |
|
88 | return 0; | |
89 | } |
|
89 | } | |
90 |
|
90 | |||
91 | int enable_apbuart_transmitter( void ) // set the bit 1, TE Transmitter Enable to 1 in the APBUART control register |
|
91 | int enable_apbuart_transmitter( void ) // set the bit 1, TE Transmitter Enable to 1 in the APBUART control register | |
92 | { |
|
92 | { | |
93 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART; |
|
93 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART; | |
94 |
|
94 | |||
95 | apbuart_regs->ctrl = apbuart_regs->ctrl | APBUART_CTRL_REG_MASK_TE; |
|
95 | apbuart_regs->ctrl = apbuart_regs->ctrl | APBUART_CTRL_REG_MASK_TE; | |
96 |
|
96 | |||
97 | return 0; |
|
97 | return 0; | |
98 | } |
|
98 | } | |
99 |
|
99 | |||
100 | void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value) |
|
100 | void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value) | |
101 | { |
|
101 | { | |
102 | /** This function sets the scaler reload register of the apbuart module |
|
102 | /** This function sets the scaler reload register of the apbuart module | |
103 | * |
|
103 | * | |
104 | * @param regs is the address of the apbuart registers in memory |
|
104 | * @param regs is the address of the apbuart registers in memory | |
105 | * @param value is the value that will be stored in the scaler register |
|
105 | * @param value is the value that will be stored in the scaler register | |
106 | * |
|
106 | * | |
107 | * The value shall be set by the software to get data on the serial interface. |
|
107 | * The value shall be set by the software to get data on the serial interface. | |
108 | * |
|
108 | * | |
109 | */ |
|
109 | */ | |
110 |
|
110 | |||
111 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) regs; |
|
111 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) regs; | |
112 |
|
112 | |||
113 | apbuart_regs->scaler = value; |
|
113 | apbuart_regs->scaler = value; | |
114 | BOOT_PRINTF1("OK *** apbuart port scaler reload register set to 0x%x\n", value) |
|
114 | BOOT_PRINTF1("OK *** apbuart port scaler reload register set to 0x%x\n", value) | |
115 | } |
|
115 | } | |
116 |
|
116 | |||
117 | //************ |
|
117 | //************ | |
118 | // RTEMS TASKS |
|
118 | // RTEMS TASKS | |
119 |
|
119 | |||
120 | rtems_task stat_task(rtems_task_argument argument) |
|
120 | rtems_task stat_task(rtems_task_argument argument) | |
121 | { |
|
121 | { | |
122 | int i; |
|
122 | int i; | |
123 | int j; |
|
123 | int j; | |
124 | i = 0; |
|
124 | i = 0; | |
125 | j = 0; |
|
125 | j = 0; | |
126 | BOOT_PRINTF("in STAT *** \n") |
|
126 | BOOT_PRINTF("in STAT *** \n") | |
127 | while(1){ |
|
127 | while(1){ | |
128 | rtems_task_wake_after(1000); |
|
128 | rtems_task_wake_after(1000); | |
129 | PRINTF1("%d\n", j) |
|
129 | PRINTF1("%d\n", j) | |
130 | if (i == CPU_USAGE_REPORT_PERIOD) { |
|
130 | if (i == CPU_USAGE_REPORT_PERIOD) { | |
131 | // #ifdef PRINT_TASK_STATISTICS |
|
131 | // #ifdef PRINT_TASK_STATISTICS | |
132 | // rtems_cpu_usage_report(); |
|
132 | // rtems_cpu_usage_report(); | |
133 | // rtems_cpu_usage_reset(); |
|
133 | // rtems_cpu_usage_reset(); | |
134 | // #endif |
|
134 | // #endif | |
135 | i = 0; |
|
135 | i = 0; | |
136 | } |
|
136 | } | |
137 | else i++; |
|
137 | else i++; | |
138 | j++; |
|
138 | j++; | |
139 | } |
|
139 | } | |
140 | } |
|
140 | } | |
141 |
|
141 | |||
142 | rtems_task hous_task(rtems_task_argument argument) |
|
142 | rtems_task hous_task(rtems_task_argument argument) | |
143 | { |
|
143 | { | |
144 | rtems_status_code status; |
|
144 | rtems_status_code status; | |
|
145 | rtems_status_code spare_status; | |||
145 | rtems_id queue_id; |
|
146 | rtems_id queue_id; | |
146 | rtems_rate_monotonic_period_status period_status; |
|
147 | rtems_rate_monotonic_period_status period_status; | |
147 |
|
148 | |||
148 | status = get_message_queue_id_send( &queue_id ); |
|
149 | status = get_message_queue_id_send( &queue_id ); | |
149 | if (status != RTEMS_SUCCESSFUL) |
|
150 | if (status != RTEMS_SUCCESSFUL) | |
150 | { |
|
151 | { | |
151 | PRINTF1("in HOUS *** ERR get_message_queue_id_send %d\n", status) |
|
152 | PRINTF1("in HOUS *** ERR get_message_queue_id_send %d\n", status) | |
152 | } |
|
153 | } | |
153 |
|
154 | |||
154 | BOOT_PRINTF("in HOUS ***\n") |
|
155 | BOOT_PRINTF("in HOUS ***\n") | |
155 |
|
156 | |||
156 | if (rtems_rate_monotonic_ident( name_hk_rate_monotonic, &HK_id) != RTEMS_SUCCESSFUL) { |
|
157 | if (rtems_rate_monotonic_ident( name_hk_rate_monotonic, &HK_id) != RTEMS_SUCCESSFUL) { | |
157 | status = rtems_rate_monotonic_create( name_hk_rate_monotonic, &HK_id ); |
|
158 | status = rtems_rate_monotonic_create( name_hk_rate_monotonic, &HK_id ); | |
158 | if( status != RTEMS_SUCCESSFUL ) { |
|
159 | if( status != RTEMS_SUCCESSFUL ) { | |
159 | PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status ) |
|
160 | PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status ) | |
160 | } |
|
161 | } | |
161 | } |
|
162 | } | |
162 |
|
163 | |||
163 | housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
164 | housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; | |
164 | housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
165 | housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
165 | housekeeping_packet.reserved = DEFAULT_RESERVED; |
|
166 | housekeeping_packet.reserved = DEFAULT_RESERVED; | |
166 | housekeeping_packet.userApplication = CCSDS_USER_APP; |
|
167 | housekeeping_packet.userApplication = CCSDS_USER_APP; | |
167 | housekeeping_packet.packetID[0] = (unsigned char) (APID_TM_HK >> 8); |
|
168 | housekeeping_packet.packetID[0] = (unsigned char) (APID_TM_HK >> 8); | |
168 | housekeeping_packet.packetID[1] = (unsigned char) (APID_TM_HK); |
|
169 | housekeeping_packet.packetID[1] = (unsigned char) (APID_TM_HK); | |
169 | housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
170 | housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
170 | housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
171 | housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
171 | housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8); |
|
172 | housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8); | |
172 | housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK ); |
|
173 | housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK ); | |
173 | housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
174 | housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
174 | housekeeping_packet.serviceType = TM_TYPE_HK; |
|
175 | housekeeping_packet.serviceType = TM_TYPE_HK; | |
175 | housekeeping_packet.serviceSubType = TM_SUBTYPE_HK; |
|
176 | housekeeping_packet.serviceSubType = TM_SUBTYPE_HK; | |
176 | housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND; |
|
177 | housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND; | |
177 | housekeeping_packet.sid = SID_HK; |
|
178 | housekeeping_packet.sid = SID_HK; | |
178 |
|
179 | |||
179 | status = rtems_rate_monotonic_cancel(HK_id); |
|
180 | status = rtems_rate_monotonic_cancel(HK_id); | |
180 | if( status != RTEMS_SUCCESSFUL ) { |
|
181 | if( status != RTEMS_SUCCESSFUL ) { | |
181 | PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status ) |
|
182 | PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status ) | |
182 | } |
|
183 | } | |
183 | else { |
|
184 | else { | |
184 | DEBUG_PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n") |
|
185 | DEBUG_PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n") | |
185 | } |
|
186 | } | |
186 |
|
187 | |||
187 | // startup phase |
|
188 | // startup phase | |
188 | status = rtems_rate_monotonic_period( HK_id, SY_LFR_TIME_SYN_TIMEOUT_in_ticks ); |
|
189 | status = rtems_rate_monotonic_period( HK_id, SY_LFR_TIME_SYN_TIMEOUT_in_ticks ); | |
189 | status = rtems_rate_monotonic_get_status( HK_id, &period_status ); |
|
190 | status = rtems_rate_monotonic_get_status( HK_id, &period_status ); | |
190 | DEBUG_PRINTF1("startup HK, HK_id status = %d\n", period_status.state) |
|
191 | DEBUG_PRINTF1("startup HK, HK_id status = %d\n", period_status.state) | |
191 | while(period_status.state != RATE_MONOTONIC_EXPIRED ) // after SY_LFR_TIME_SYN_TIMEOUT ms, starts HK anyway |
|
192 | while(period_status.state != RATE_MONOTONIC_EXPIRED ) // after SY_LFR_TIME_SYN_TIMEOUT ms, starts HK anyway | |
192 | { |
|
193 | { | |
193 | if ((time_management_regs->coarse_time & 0x80000000) == 0x00000000) // check time synchronization |
|
194 | if ((time_management_regs->coarse_time & 0x80000000) == 0x00000000) // check time synchronization | |
194 | { |
|
195 | { | |
195 | break; // break if LFR is synchronized |
|
196 | break; // break if LFR is synchronized | |
196 | } |
|
197 | } | |
197 | else |
|
198 | else | |
198 | { |
|
199 | { | |
199 | status = rtems_rate_monotonic_get_status( HK_id, &period_status ); |
|
200 | status = rtems_rate_monotonic_get_status( HK_id, &period_status ); | |
200 | // sched_yield(); |
|
201 | // sched_yield(); | |
201 | status = rtems_task_wake_after( 10 ); // wait SY_LFR_DPU_CONNECT_TIMEOUT 100 ms = 10 * 10 ms |
|
202 | status = rtems_task_wake_after( 10 ); // wait SY_LFR_DPU_CONNECT_TIMEOUT 100 ms = 10 * 10 ms | |
202 | } |
|
203 | } | |
203 | } |
|
204 | } | |
204 | status = rtems_rate_monotonic_cancel(HK_id); |
|
205 | status = rtems_rate_monotonic_cancel(HK_id); | |
205 | DEBUG_PRINTF1("startup HK, HK_id status = %d\n", period_status.state) |
|
206 | DEBUG_PRINTF1("startup HK, HK_id status = %d\n", period_status.state) | |
206 |
|
207 | |||
207 | while(1){ // launch the rate monotonic task |
|
208 | while(1){ // launch the rate monotonic task | |
208 | status = rtems_rate_monotonic_period( HK_id, HK_PERIOD ); |
|
209 | status = rtems_rate_monotonic_period( HK_id, HK_PERIOD ); | |
209 | if ( status != RTEMS_SUCCESSFUL ) { |
|
210 | if ( status != RTEMS_SUCCESSFUL ) { | |
210 | PRINTF1( "in HOUS *** ERR period: %d\n", status); |
|
211 | PRINTF1( "in HOUS *** ERR period: %d\n", status); | |
211 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_6 ); |
|
212 | spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_6 ); | |
212 | } |
|
213 | } | |
213 | else { |
|
214 | else { | |
214 | housekeeping_packet.packetSequenceControl[0] = (unsigned char) (sequenceCounterHK >> 8); |
|
215 | housekeeping_packet.packetSequenceControl[0] = (unsigned char) (sequenceCounterHK >> 8); | |
215 | housekeeping_packet.packetSequenceControl[1] = (unsigned char) (sequenceCounterHK ); |
|
216 | housekeeping_packet.packetSequenceControl[1] = (unsigned char) (sequenceCounterHK ); | |
216 | increment_seq_counter( &sequenceCounterHK ); |
|
217 | increment_seq_counter( &sequenceCounterHK ); | |
217 |
|
218 | |||
218 | housekeeping_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
219 | housekeeping_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
219 | housekeeping_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
220 | housekeeping_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
220 | housekeeping_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
221 | housekeeping_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
221 | housekeeping_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
222 | housekeeping_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); | |
222 | housekeeping_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
223 | housekeeping_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
223 | housekeeping_packet.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
224 | housekeeping_packet.time[5] = (unsigned char) (time_management_regs->fine_time); | |
224 |
|
225 | |||
225 | spacewire_update_statistics(); |
|
226 | spacewire_update_statistics(); | |
226 |
|
227 | |||
227 | get_v_e1_e2_f3( housekeeping_packet.hk_lfr_sc_v_f3 ); |
|
228 | get_v_e1_e2_f3( housekeeping_packet.hk_lfr_sc_v_f3 ); | |
228 | get_cpu_load( (unsigned char *) &housekeeping_packet.hk_lfr_cpu_load ); |
|
229 | get_cpu_load( (unsigned char *) &housekeeping_packet.hk_lfr_cpu_load ); | |
229 |
|
230 | |||
230 | // SEND PACKET |
|
231 | // SEND PACKET | |
231 | status = rtems_message_queue_urgent( queue_id, &housekeeping_packet, |
|
232 | status = rtems_message_queue_urgent( queue_id, &housekeeping_packet, | |
232 | PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES); |
|
233 | PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES); | |
233 | if (status != RTEMS_SUCCESSFUL) { |
|
234 | if (status != RTEMS_SUCCESSFUL) { | |
234 | PRINTF1("in HOUS *** ERR send: %d\n", status) |
|
235 | PRINTF1("in HOUS *** ERR send: %d\n", status) | |
235 | } |
|
236 | } | |
236 | } |
|
237 | } | |
237 | } |
|
238 | } | |
238 |
|
239 | |||
239 | PRINTF("in HOUS *** deleting task\n") |
|
240 | PRINTF("in HOUS *** deleting task\n") | |
240 |
|
241 | |||
241 | status = rtems_task_delete( RTEMS_SELF ); // should not return |
|
242 | status = rtems_task_delete( RTEMS_SELF ); // should not return | |
242 | printf( "rtems_task_delete returned with status of %d.\n", status ); |
|
243 | printf( "rtems_task_delete returned with status of %d.\n", status ); | |
243 | return; |
|
244 | return; | |
244 | } |
|
245 | } | |
245 |
|
246 | |||
246 | rtems_task dumb_task( rtems_task_argument unused ) |
|
247 | rtems_task dumb_task( rtems_task_argument unused ) | |
247 | { |
|
248 | { | |
248 | /** This RTEMS taks is used to print messages without affecting the general behaviour of the software. |
|
249 | /** This RTEMS taks is used to print messages without affecting the general behaviour of the software. | |
249 | * |
|
250 | * | |
250 | * @param unused is the starting argument of the RTEMS task |
|
251 | * @param unused is the starting argument of the RTEMS task | |
251 | * |
|
252 | * | |
252 | * The DUMB taks waits for RTEMS events and print messages depending on the incoming events. |
|
253 | * The DUMB taks waits for RTEMS events and print messages depending on the incoming events. | |
253 | * |
|
254 | * | |
254 | */ |
|
255 | */ | |
255 |
|
256 | |||
256 | unsigned int i; |
|
257 | unsigned int i; | |
257 | unsigned int intEventOut; |
|
258 | unsigned int intEventOut; | |
258 | unsigned int coarse_time = 0; |
|
259 | unsigned int coarse_time = 0; | |
259 | unsigned int fine_time = 0; |
|
260 | unsigned int fine_time = 0; | |
260 | rtems_event_set event_out; |
|
261 | rtems_event_set event_out; | |
261 |
|
262 | |||
262 | char *DumbMessages[12] = {"in DUMB *** default", // RTEMS_EVENT_0 |
|
263 | char *DumbMessages[12] = {"in DUMB *** default", // RTEMS_EVENT_0 | |
263 | "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1 |
|
264 | "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1 | |
264 | "in DUMB *** f3 buffer changed", // RTEMS_EVENT_2 |
|
265 | "in DUMB *** f3 buffer changed", // RTEMS_EVENT_2 | |
265 | "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3 |
|
266 | "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3 | |
266 | "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4 |
|
267 | "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4 | |
267 | "in DUMB *** waveforms_simulator_isr", // RTEMS_EVENT_5 |
|
268 | "in DUMB *** waveforms_simulator_isr", // RTEMS_EVENT_5 | |
268 | "ERR HK", // RTEMS_EVENT_6 |
|
269 | "ERR HK", // RTEMS_EVENT_6 | |
269 | "ready for dump", // RTEMS_EVENT_7 |
|
270 | "ready for dump", // RTEMS_EVENT_7 | |
270 | "VHDL ERR *** spectral matrix", // RTEMS_EVENT_8 |
|
271 | "VHDL ERR *** spectral matrix", // RTEMS_EVENT_8 | |
271 | "tick", // RTEMS_EVENT_9 |
|
272 | "tick", // RTEMS_EVENT_9 | |
272 | "VHDL ERR *** waveform picker", // RTEMS_EVENT_10 |
|
273 | "VHDL ERR *** waveform picker", // RTEMS_EVENT_10 | |
273 | "VHDL ERR *** unexpected ready matrix values" // RTEMS_EVENT_11 |
|
274 | "VHDL ERR *** unexpected ready matrix values" // RTEMS_EVENT_11 | |
274 | }; |
|
275 | }; | |
275 |
|
276 | |||
276 | BOOT_PRINTF("in DUMB *** \n") |
|
277 | BOOT_PRINTF("in DUMB *** \n") | |
277 |
|
278 | |||
278 | while(1){ |
|
279 | while(1){ | |
279 | rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3 |
|
280 | rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3 | |
280 | | RTEMS_EVENT_4 | RTEMS_EVENT_5 | RTEMS_EVENT_6 | RTEMS_EVENT_7 |
|
281 | | RTEMS_EVENT_4 | RTEMS_EVENT_5 | RTEMS_EVENT_6 | RTEMS_EVENT_7 | |
281 | | RTEMS_EVENT_8 | RTEMS_EVENT_9, |
|
282 | | RTEMS_EVENT_8 | RTEMS_EVENT_9, | |
282 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT |
|
283 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT | |
283 | intEventOut = (unsigned int) event_out; |
|
284 | intEventOut = (unsigned int) event_out; | |
284 | for ( i=0; i<32; i++) |
|
285 | for ( i=0; i<32; i++) | |
285 | { |
|
286 | { | |
286 | if ( ((intEventOut >> i) & 0x0001) != 0) |
|
287 | if ( ((intEventOut >> i) & 0x0001) != 0) | |
287 | { |
|
288 | { | |
288 | coarse_time = time_management_regs->coarse_time; |
|
289 | coarse_time = time_management_regs->coarse_time; | |
289 | fine_time = time_management_regs->fine_time; |
|
290 | fine_time = time_management_regs->fine_time; | |
290 | printf("in DUMB *** coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]); |
|
291 | printf("in DUMB *** coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]); | |
291 | if (i==8) |
|
292 | if (i==8) | |
292 | { |
|
293 | { | |
293 | PRINTF1("spectral_matrix_regs->status = %x\n", spectral_matrix_regs->status) |
|
|||
294 | } |
|
294 | } | |
295 | if (i==10) |
|
295 | if (i==10) | |
296 | { |
|
296 | { | |
297 | PRINTF1("waveform_picker_regs->status = %x\n", waveform_picker_regs->status) |
|
|||
298 | } |
|
297 | } | |
299 | } |
|
298 | } | |
300 | } |
|
299 | } | |
301 | } |
|
300 | } | |
302 | } |
|
301 | } | |
303 |
|
302 | |||
304 | //***************************** |
|
303 | //***************************** | |
305 | // init housekeeping parameters |
|
304 | // init housekeeping parameters | |
306 |
|
305 | |||
307 | void init_housekeeping_parameters( void ) |
|
306 | void init_housekeeping_parameters( void ) | |
308 | { |
|
307 | { | |
309 | /** This function initialize the housekeeping_packet global variable with default values. |
|
308 | /** This function initialize the housekeeping_packet global variable with default values. | |
310 | * |
|
309 | * | |
311 | */ |
|
310 | */ | |
312 |
|
311 | |||
313 | unsigned int i = 0; |
|
312 | unsigned int i = 0; | |
314 | unsigned char *parameters; |
|
313 | unsigned char *parameters; | |
315 |
|
314 | |||
316 | parameters = (unsigned char*) &housekeeping_packet.lfr_status_word; |
|
315 | parameters = (unsigned char*) &housekeeping_packet.lfr_status_word; | |
317 | for(i = 0; i< SIZE_HK_PARAMETERS; i++) |
|
316 | for(i = 0; i< SIZE_HK_PARAMETERS; i++) | |
318 | { |
|
317 | { | |
319 | parameters[i] = 0x00; |
|
318 | parameters[i] = 0x00; | |
320 | } |
|
319 | } | |
321 | // init status word |
|
320 | // init status word | |
322 | housekeeping_packet.lfr_status_word[0] = DEFAULT_STATUS_WORD_BYTE0; |
|
321 | housekeeping_packet.lfr_status_word[0] = DEFAULT_STATUS_WORD_BYTE0; | |
323 | housekeeping_packet.lfr_status_word[1] = DEFAULT_STATUS_WORD_BYTE1; |
|
322 | housekeeping_packet.lfr_status_word[1] = DEFAULT_STATUS_WORD_BYTE1; | |
324 | // init software version |
|
323 | // init software version | |
325 | housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1; |
|
324 | housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1; | |
326 | housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2; |
|
325 | housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2; | |
327 | housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3; |
|
326 | housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3; | |
328 | housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4; |
|
327 | housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4; | |
329 | // init fpga version |
|
328 | // init fpga version | |
330 | parameters = (unsigned char *) (REGS_ADDR_VHDL_VERSION); |
|
329 | parameters = (unsigned char *) (REGS_ADDR_VHDL_VERSION); | |
331 | housekeeping_packet.lfr_fpga_version[0] = parameters[1]; // n1 |
|
330 | housekeeping_packet.lfr_fpga_version[0] = parameters[1]; // n1 | |
332 | housekeeping_packet.lfr_fpga_version[1] = parameters[2]; // n2 |
|
331 | housekeeping_packet.lfr_fpga_version[1] = parameters[2]; // n2 | |
333 | housekeeping_packet.lfr_fpga_version[2] = parameters[3]; // n3 |
|
332 | housekeeping_packet.lfr_fpga_version[2] = parameters[3]; // n3 | |
334 | } |
|
333 | } | |
335 |
|
334 | |||
336 | void increment_seq_counter( unsigned short *packetSequenceControl ) |
|
335 | void increment_seq_counter( unsigned short *packetSequenceControl ) | |
337 | { |
|
336 | { | |
338 | /** This function increment the sequence counter psased in argument. |
|
337 | /** This function increment the sequence counter psased in argument. | |
339 | * |
|
338 | * | |
340 | * The increment does not affect the grouping flag. In case of an overflow, the counter is reset to 0. |
|
339 | * The increment does not affect the grouping flag. In case of an overflow, the counter is reset to 0. | |
341 | * |
|
340 | * | |
342 | */ |
|
341 | */ | |
343 |
|
342 | |||
344 | unsigned short segmentation_grouping_flag; |
|
343 | unsigned short segmentation_grouping_flag; | |
345 | unsigned short sequence_cnt; |
|
344 | unsigned short sequence_cnt; | |
346 |
|
345 | |||
347 | segmentation_grouping_flag = TM_PACKET_SEQ_CTRL_STANDALONE << 8; // keep bits 7 downto 6 |
|
346 | segmentation_grouping_flag = TM_PACKET_SEQ_CTRL_STANDALONE << 8; // keep bits 7 downto 6 | |
348 | sequence_cnt = (*packetSequenceControl) & 0x3fff; // [0011 1111 1111 1111] |
|
347 | sequence_cnt = (*packetSequenceControl) & 0x3fff; // [0011 1111 1111 1111] | |
349 |
|
348 | |||
350 | if ( sequence_cnt < SEQ_CNT_MAX) |
|
349 | if ( sequence_cnt < SEQ_CNT_MAX) | |
351 | { |
|
350 | { | |
352 | sequence_cnt = sequence_cnt + 1; |
|
351 | sequence_cnt = sequence_cnt + 1; | |
353 | } |
|
352 | } | |
354 | else |
|
353 | else | |
355 | { |
|
354 | { | |
356 | sequence_cnt = 0; |
|
355 | sequence_cnt = 0; | |
357 | } |
|
356 | } | |
358 |
|
357 | |||
359 | *packetSequenceControl = segmentation_grouping_flag | sequence_cnt ; |
|
358 | *packetSequenceControl = segmentation_grouping_flag | sequence_cnt ; | |
360 | } |
|
359 | } | |
361 |
|
360 | |||
362 | void getTime( unsigned char *time) |
|
361 | void getTime( unsigned char *time) | |
363 | { |
|
362 | { | |
364 | /** This function write the current local time in the time buffer passed in argument. |
|
363 | /** This function write the current local time in the time buffer passed in argument. | |
365 | * |
|
364 | * | |
366 | */ |
|
365 | */ | |
367 |
|
366 | |||
368 | time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
367 | time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
369 | time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
368 | time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
370 | time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
369 | time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
371 | time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
370 | time[3] = (unsigned char) (time_management_regs->coarse_time); | |
372 | time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
371 | time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
373 | time[5] = (unsigned char) (time_management_regs->fine_time); |
|
372 | time[5] = (unsigned char) (time_management_regs->fine_time); | |
374 | } |
|
373 | } | |
375 |
|
374 | |||
376 | unsigned long long int getTimeAsUnsignedLongLongInt( ) |
|
375 | unsigned long long int getTimeAsUnsignedLongLongInt( ) | |
377 | { |
|
376 | { | |
378 | /** This function write the current local time in the time buffer passed in argument. |
|
377 | /** This function write the current local time in the time buffer passed in argument. | |
379 | * |
|
378 | * | |
380 | */ |
|
379 | */ | |
381 | unsigned long long int time; |
|
380 | unsigned long long int time; | |
382 |
|
381 | |||
383 | time = ( (unsigned long long int) (time_management_regs->coarse_time & 0x7fffffff) << 16 ) |
|
382 | time = ( (unsigned long long int) (time_management_regs->coarse_time & 0x7fffffff) << 16 ) | |
384 | + time_management_regs->fine_time; |
|
383 | + time_management_regs->fine_time; | |
385 |
|
384 | |||
386 | return time; |
|
385 | return time; | |
387 | } |
|
386 | } | |
388 |
|
387 | |||
389 | void send_dumb_hk( void ) |
|
388 | void send_dumb_hk( void ) | |
390 | { |
|
389 | { | |
391 | Packet_TM_LFR_HK_t dummy_hk_packet; |
|
390 | Packet_TM_LFR_HK_t dummy_hk_packet; | |
392 | unsigned char *parameters; |
|
391 | unsigned char *parameters; | |
393 | unsigned int i; |
|
392 | unsigned int i; | |
394 | rtems_id queue_id; |
|
393 | rtems_id queue_id; | |
395 |
|
394 | |||
396 | dummy_hk_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
395 | dummy_hk_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; | |
397 | dummy_hk_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
396 | dummy_hk_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
398 | dummy_hk_packet.reserved = DEFAULT_RESERVED; |
|
397 | dummy_hk_packet.reserved = DEFAULT_RESERVED; | |
399 | dummy_hk_packet.userApplication = CCSDS_USER_APP; |
|
398 | dummy_hk_packet.userApplication = CCSDS_USER_APP; | |
400 | dummy_hk_packet.packetID[0] = (unsigned char) (APID_TM_HK >> 8); |
|
399 | dummy_hk_packet.packetID[0] = (unsigned char) (APID_TM_HK >> 8); | |
401 | dummy_hk_packet.packetID[1] = (unsigned char) (APID_TM_HK); |
|
400 | dummy_hk_packet.packetID[1] = (unsigned char) (APID_TM_HK); | |
402 | dummy_hk_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
401 | dummy_hk_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
403 | dummy_hk_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
402 | dummy_hk_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
404 | dummy_hk_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8); |
|
403 | dummy_hk_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8); | |
405 | dummy_hk_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK ); |
|
404 | dummy_hk_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK ); | |
406 | dummy_hk_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
405 | dummy_hk_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
407 | dummy_hk_packet.serviceType = TM_TYPE_HK; |
|
406 | dummy_hk_packet.serviceType = TM_TYPE_HK; | |
408 | dummy_hk_packet.serviceSubType = TM_SUBTYPE_HK; |
|
407 | dummy_hk_packet.serviceSubType = TM_SUBTYPE_HK; | |
409 | dummy_hk_packet.destinationID = TM_DESTINATION_ID_GROUND; |
|
408 | dummy_hk_packet.destinationID = TM_DESTINATION_ID_GROUND; | |
410 | dummy_hk_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
409 | dummy_hk_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
411 | dummy_hk_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
410 | dummy_hk_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
412 | dummy_hk_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
411 | dummy_hk_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
413 | dummy_hk_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
412 | dummy_hk_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); | |
414 | dummy_hk_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
413 | dummy_hk_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
415 | dummy_hk_packet.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
414 | dummy_hk_packet.time[5] = (unsigned char) (time_management_regs->fine_time); | |
416 | dummy_hk_packet.sid = SID_HK; |
|
415 | dummy_hk_packet.sid = SID_HK; | |
417 |
|
416 | |||
418 | // init status word |
|
417 | // init status word | |
419 | dummy_hk_packet.lfr_status_word[0] = 0xff; |
|
418 | dummy_hk_packet.lfr_status_word[0] = 0xff; | |
420 | dummy_hk_packet.lfr_status_word[1] = 0xff; |
|
419 | dummy_hk_packet.lfr_status_word[1] = 0xff; | |
421 | // init software version |
|
420 | // init software version | |
422 | dummy_hk_packet.lfr_sw_version[0] = SW_VERSION_N1; |
|
421 | dummy_hk_packet.lfr_sw_version[0] = SW_VERSION_N1; | |
423 | dummy_hk_packet.lfr_sw_version[1] = SW_VERSION_N2; |
|
422 | dummy_hk_packet.lfr_sw_version[1] = SW_VERSION_N2; | |
424 | dummy_hk_packet.lfr_sw_version[2] = SW_VERSION_N3; |
|
423 | dummy_hk_packet.lfr_sw_version[2] = SW_VERSION_N3; | |
425 | dummy_hk_packet.lfr_sw_version[3] = SW_VERSION_N4; |
|
424 | dummy_hk_packet.lfr_sw_version[3] = SW_VERSION_N4; | |
426 | // init fpga version |
|
425 | // init fpga version | |
427 | parameters = (unsigned char *) (REGS_ADDR_WAVEFORM_PICKER + 0xb0); |
|
426 | parameters = (unsigned char *) (REGS_ADDR_WAVEFORM_PICKER + 0xb0); | |
428 | dummy_hk_packet.lfr_fpga_version[0] = parameters[1]; // n1 |
|
427 | dummy_hk_packet.lfr_fpga_version[0] = parameters[1]; // n1 | |
429 | dummy_hk_packet.lfr_fpga_version[1] = parameters[2]; // n2 |
|
428 | dummy_hk_packet.lfr_fpga_version[1] = parameters[2]; // n2 | |
430 | dummy_hk_packet.lfr_fpga_version[2] = parameters[3]; // n3 |
|
429 | dummy_hk_packet.lfr_fpga_version[2] = parameters[3]; // n3 | |
431 |
|
430 | |||
432 | parameters = (unsigned char *) &dummy_hk_packet.hk_lfr_cpu_load; |
|
431 | parameters = (unsigned char *) &dummy_hk_packet.hk_lfr_cpu_load; | |
433 |
|
432 | |||
434 | for (i=0; i<100; i++) |
|
433 | for (i=0; i<100; i++) | |
435 | { |
|
434 | { | |
436 | parameters[i] = 0xff; |
|
435 | parameters[i] = 0xff; | |
437 | } |
|
436 | } | |
438 |
|
437 | |||
439 | get_message_queue_id_send( &queue_id ); |
|
438 | get_message_queue_id_send( &queue_id ); | |
440 |
|
439 | |||
441 | rtems_message_queue_urgent( queue_id, &dummy_hk_packet, |
|
440 | rtems_message_queue_urgent( queue_id, &dummy_hk_packet, | |
442 | PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES); |
|
441 | PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES); | |
443 | } |
|
442 | } | |
444 |
|
443 | |||
445 | void get_v_e1_e2_f3( unsigned char *spacecraft_potential ) |
|
444 | void get_v_e1_e2_f3( unsigned char *spacecraft_potential ) | |
446 | { |
|
445 | { | |
447 | unsigned int coarseTime; |
|
446 | unsigned int coarseTime; | |
448 | unsigned int acquisitionTime; |
|
447 | unsigned int acquisitionTime; | |
449 | unsigned int deltaT = 0; |
|
448 | unsigned int deltaT = 0; | |
450 | unsigned char *bufferPtr; |
|
449 | unsigned char *bufferPtr; | |
451 |
|
450 | |||
452 | unsigned int offset_in_samples; |
|
451 | unsigned int offset_in_samples; | |
453 | unsigned int offset_in_bytes; |
|
452 | unsigned int offset_in_bytes; | |
454 | unsigned char f3 = 16; // v, e1 and e2 will be picked up each second, f3 = 16 Hz |
|
453 | unsigned char f3 = 16; // v, e1 and e2 will be picked up each second, f3 = 16 Hz | |
455 |
|
454 | |||
|
455 | bufferPtr = NULL; | |||
|
456 | ||||
456 | if (lfrCurrentMode == LFR_MODE_STANDBY) |
|
457 | if (lfrCurrentMode == LFR_MODE_STANDBY) | |
457 | { |
|
458 | { | |
458 | spacecraft_potential[0] = 0x00; |
|
459 | spacecraft_potential[0] = 0x00; | |
459 | spacecraft_potential[1] = 0x00; |
|
460 | spacecraft_potential[1] = 0x00; | |
460 | spacecraft_potential[2] = 0x00; |
|
461 | spacecraft_potential[2] = 0x00; | |
461 | spacecraft_potential[3] = 0x00; |
|
462 | spacecraft_potential[3] = 0x00; | |
462 | spacecraft_potential[4] = 0x00; |
|
463 | spacecraft_potential[4] = 0x00; | |
463 | spacecraft_potential[5] = 0x00; |
|
464 | spacecraft_potential[5] = 0x00; | |
464 | } |
|
465 | } | |
465 | else |
|
466 | else | |
466 | { |
|
467 | { | |
467 | coarseTime = time_management_regs->coarse_time & 0x7fffffff; |
|
468 | coarseTime = time_management_regs->coarse_time & 0x7fffffff; | |
468 | bufferPtr = (unsigned char*) current_ring_node_f3->buffer_address; |
|
469 | bufferPtr = (unsigned char*) current_ring_node_f3->buffer_address; | |
469 | acquisitionTime = (unsigned int) ( ( bufferPtr[0] & 0x7f ) << 24 ) |
|
470 | acquisitionTime = (unsigned int) ( ( bufferPtr[0] & 0x7f ) << 24 ) | |
470 | + (unsigned int) ( bufferPtr[1] << 16 ) |
|
471 | + (unsigned int) ( bufferPtr[1] << 16 ) | |
471 | + (unsigned int) ( bufferPtr[2] << 8 ) |
|
472 | + (unsigned int) ( bufferPtr[2] << 8 ) | |
472 | + (unsigned int) ( bufferPtr[3] ); |
|
473 | + (unsigned int) ( bufferPtr[3] ); | |
473 | if ( coarseTime > acquisitionTime ) |
|
474 | if ( coarseTime > acquisitionTime ) | |
474 | { |
|
475 | { | |
475 | deltaT = coarseTime - acquisitionTime; |
|
476 | deltaT = coarseTime - acquisitionTime; | |
476 | offset_in_samples = (deltaT-1) * f3 ; |
|
477 | offset_in_samples = (deltaT-1) * f3 ; | |
477 | } |
|
478 | } | |
478 | else if( coarseTime == acquisitionTime ) |
|
479 | else if( coarseTime == acquisitionTime ) | |
479 | { |
|
480 | { | |
480 | bufferPtr = (unsigned char*) current_ring_node_f3->previous->buffer_address; // pick up v e1 and e2 in the previous f3 buffer |
|
481 | bufferPtr = (unsigned char*) current_ring_node_f3->previous->buffer_address; // pick up v e1 and e2 in the previous f3 buffer | |
481 | offset_in_samples = NB_SAMPLES_PER_SNAPSHOT-1; |
|
482 | offset_in_samples = NB_SAMPLES_PER_SNAPSHOT-1; | |
482 | } |
|
483 | } | |
483 | else |
|
484 | else | |
484 | { |
|
485 | { | |
485 | offset_in_samples = 0; |
|
486 | offset_in_samples = 0; | |
486 | PRINTF2("ERR *** in get_v_e1_e2_f3 *** coarseTime = %x, acquisitionTime = %x\n", coarseTime, acquisitionTime) |
|
487 | PRINTF2("ERR *** in get_v_e1_e2_f3 *** coarseTime = %x, acquisitionTime = %x\n", coarseTime, acquisitionTime) | |
487 | } |
|
488 | } | |
488 |
|
489 | |||
489 | if ( offset_in_samples > (NB_SAMPLES_PER_SNAPSHOT - 1) ) |
|
490 | if ( offset_in_samples > (NB_SAMPLES_PER_SNAPSHOT - 1) ) | |
490 | { |
|
491 | { | |
491 | PRINTF1("ERR *** in get_v_e1_e2_f3 *** trying to read out of the buffer, counter = %d\n", offset_in_samples) |
|
492 | PRINTF1("ERR *** in get_v_e1_e2_f3 *** trying to read out of the buffer, counter = %d\n", offset_in_samples) | |
492 | offset_in_samples = NB_SAMPLES_PER_SNAPSHOT -1; |
|
493 | offset_in_samples = NB_SAMPLES_PER_SNAPSHOT -1; | |
493 | } |
|
494 | } | |
494 | offset_in_bytes = TIME_OFFSET_IN_BYTES + offset_in_samples * NB_WORDS_SWF_BLK * 4; |
|
495 | offset_in_bytes = TIME_OFFSET_IN_BYTES + offset_in_samples * NB_WORDS_SWF_BLK * 4; | |
495 | spacecraft_potential[0] = bufferPtr[ offset_in_bytes + 0]; |
|
496 | spacecraft_potential[0] = bufferPtr[ offset_in_bytes + 0]; | |
496 | spacecraft_potential[1] = bufferPtr[ offset_in_bytes + 1]; |
|
497 | spacecraft_potential[1] = bufferPtr[ offset_in_bytes + 1]; | |
497 | spacecraft_potential[2] = bufferPtr[ offset_in_bytes + 2]; |
|
498 | spacecraft_potential[2] = bufferPtr[ offset_in_bytes + 2]; | |
498 | spacecraft_potential[3] = bufferPtr[ offset_in_bytes + 3]; |
|
499 | spacecraft_potential[3] = bufferPtr[ offset_in_bytes + 3]; | |
499 | spacecraft_potential[4] = bufferPtr[ offset_in_bytes + 4]; |
|
500 | spacecraft_potential[4] = bufferPtr[ offset_in_bytes + 4]; | |
500 | spacecraft_potential[5] = bufferPtr[ offset_in_bytes + 5]; |
|
501 | spacecraft_potential[5] = bufferPtr[ offset_in_bytes + 5]; | |
501 | } |
|
502 | } | |
502 | } |
|
503 | } | |
503 |
|
504 | |||
504 | void get_cpu_load( unsigned char *resource_statistics ) |
|
505 | void get_cpu_load( unsigned char *resource_statistics ) | |
505 | { |
|
506 | { | |
506 | unsigned char cpu_load; |
|
507 | unsigned char cpu_load; | |
507 |
|
508 | |||
508 | cpu_load = lfr_rtems_cpu_usage_report(); |
|
509 | cpu_load = lfr_rtems_cpu_usage_report(); | |
509 |
|
510 | |||
510 | // HK_LFR_CPU_LOAD |
|
511 | // HK_LFR_CPU_LOAD | |
511 | resource_statistics[0] = cpu_load; |
|
512 | resource_statistics[0] = cpu_load; | |
512 |
|
513 | |||
513 | // HK_LFR_CPU_LOAD_MAX |
|
514 | // HK_LFR_CPU_LOAD_MAX | |
514 | if (cpu_load > resource_statistics[1]) |
|
515 | if (cpu_load > resource_statistics[1]) | |
515 | { |
|
516 | { | |
516 | resource_statistics[1] = cpu_load; |
|
517 | resource_statistics[1] = cpu_load; | |
517 | } |
|
518 | } | |
518 |
|
519 | |||
519 | // CPU_LOAD_AVE |
|
520 | // CPU_LOAD_AVE | |
520 | resource_statistics[2] = 0; |
|
521 | resource_statistics[2] = 0; | |
521 |
|
522 | |||
522 | #ifndef PRINT_TASK_STATISTICS |
|
523 | #ifndef PRINT_TASK_STATISTICS | |
523 | rtems_cpu_usage_reset(); |
|
524 | rtems_cpu_usage_reset(); | |
524 | #endif |
|
525 | #endif | |
525 |
|
526 | |||
526 | } |
|
527 | } | |
527 |
|
528 | |||
528 |
|
529 | |||
529 |
|
530 |
@@ -1,610 +1,624 | |||||
1 | /** Functions related to the SpaceWire interface. |
|
1 | /** Functions related to the SpaceWire interface. | |
2 | * |
|
2 | * | |
3 | * @file |
|
3 | * @file | |
4 | * @author P. LEROY |
|
4 | * @author P. LEROY | |
5 | * |
|
5 | * | |
6 | * A group of functions to handle SpaceWire transmissions: |
|
6 | * A group of functions to handle SpaceWire transmissions: | |
7 | * - configuration of the SpaceWire link |
|
7 | * - configuration of the SpaceWire link | |
8 | * - SpaceWire related interruption requests processing |
|
8 | * - SpaceWire related interruption requests processing | |
9 | * - transmission of TeleMetry packets by a dedicated RTEMS task |
|
9 | * - transmission of TeleMetry packets by a dedicated RTEMS task | |
10 | * - reception of TeleCommands by a dedicated RTEMS task |
|
10 | * - reception of TeleCommands by a dedicated RTEMS task | |
11 | * |
|
11 | * | |
12 | */ |
|
12 | */ | |
13 |
|
13 | |||
14 | #include "fsw_spacewire.h" |
|
14 | #include "fsw_spacewire.h" | |
15 |
|
15 | |||
16 | rtems_name semq_name; |
|
16 | rtems_name semq_name; | |
17 | rtems_id semq_id; |
|
17 | rtems_id semq_id; | |
18 |
|
18 | |||
19 | //*********** |
|
19 | //*********** | |
20 | // RTEMS TASK |
|
20 | // RTEMS TASK | |
21 | rtems_task spiq_task(rtems_task_argument unused) |
|
21 | rtems_task spiq_task(rtems_task_argument unused) | |
22 | { |
|
22 | { | |
23 | /** This RTEMS task is awaken by an rtems_event sent by the interruption subroutine of the SpaceWire driver. |
|
23 | /** This RTEMS task is awaken by an rtems_event sent by the interruption subroutine of the SpaceWire driver. | |
24 | * |
|
24 | * | |
25 | * @param unused is the starting argument of the RTEMS task |
|
25 | * @param unused is the starting argument of the RTEMS task | |
26 | * |
|
26 | * | |
27 | */ |
|
27 | */ | |
28 |
|
28 | |||
29 | rtems_event_set event_out; |
|
29 | rtems_event_set event_out; | |
30 | rtems_status_code status; |
|
30 | rtems_status_code status; | |
31 | int linkStatus; |
|
31 | int linkStatus; | |
32 |
|
32 | |||
33 | BOOT_PRINTF("in SPIQ *** \n") |
|
33 | BOOT_PRINTF("in SPIQ *** \n") | |
34 |
|
34 | |||
35 | while(true){ |
|
35 | while(true){ | |
36 | rtems_event_receive(SPW_LINKERR_EVENT, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an SPW_LINKERR_EVENT |
|
36 | rtems_event_receive(SPW_LINKERR_EVENT, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an SPW_LINKERR_EVENT | |
37 | PRINTF("in SPIQ *** got SPW_LINKERR_EVENT\n") |
|
37 | PRINTF("in SPIQ *** got SPW_LINKERR_EVENT\n") | |
38 |
|
38 | |||
39 | // [0] SUSPEND RECV AND SEND TASKS |
|
39 | // [0] SUSPEND RECV AND SEND TASKS | |
40 | status = rtems_task_suspend( Task_id[ TASKID_RECV ] ); |
|
40 | status = rtems_task_suspend( Task_id[ TASKID_RECV ] ); | |
41 | if ( status != RTEMS_SUCCESSFUL ) { |
|
41 | if ( status != RTEMS_SUCCESSFUL ) { | |
42 | PRINTF("in SPIQ *** ERR suspending RECV Task\n") |
|
42 | PRINTF("in SPIQ *** ERR suspending RECV Task\n") | |
43 | } |
|
43 | } | |
44 | status = rtems_task_suspend( Task_id[ TASKID_SEND ] ); |
|
44 | status = rtems_task_suspend( Task_id[ TASKID_SEND ] ); | |
45 | if ( status != RTEMS_SUCCESSFUL ) { |
|
45 | if ( status != RTEMS_SUCCESSFUL ) { | |
46 | PRINTF("in SPIQ *** ERR suspending SEND Task\n") |
|
46 | PRINTF("in SPIQ *** ERR suspending SEND Task\n") | |
47 | } |
|
47 | } | |
48 |
|
48 | |||
49 | // [1] CHECK THE LINK |
|
49 | // [1] CHECK THE LINK | |
50 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status (1) |
|
50 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status (1) | |
51 | if ( linkStatus != 5) { |
|
51 | if ( linkStatus != 5) { | |
52 | PRINTF1("in SPIQ *** linkStatus %d, wait...\n", linkStatus) |
|
52 | PRINTF1("in SPIQ *** linkStatus %d, wait...\n", linkStatus) | |
53 | status = rtems_task_wake_after( SY_LFR_DPU_CONNECT_TIMEOUT ); // wait SY_LFR_DPU_CONNECT_TIMEOUT 1000 ms |
|
53 | status = rtems_task_wake_after( SY_LFR_DPU_CONNECT_TIMEOUT ); // wait SY_LFR_DPU_CONNECT_TIMEOUT 1000 ms | |
54 | } |
|
54 | } | |
55 |
|
55 | |||
56 | // [2] RECHECK THE LINK AFTER SY_LFR_DPU_CONNECT_TIMEOUT |
|
56 | // [2] RECHECK THE LINK AFTER SY_LFR_DPU_CONNECT_TIMEOUT | |
57 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status (2) |
|
57 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status (2) | |
58 | if ( linkStatus != 5 ) // [2.a] not in run state, reset the link |
|
58 | if ( linkStatus != 5 ) // [2.a] not in run state, reset the link | |
59 | { |
|
59 | { | |
60 | spacewire_compute_stats_offsets(); |
|
60 | spacewire_compute_stats_offsets(); | |
61 | status = spacewire_reset_link( ); |
|
61 | status = spacewire_reset_link( ); | |
62 | } |
|
62 | } | |
63 | else // [2.b] in run state, start the link |
|
63 | else // [2.b] in run state, start the link | |
64 | { |
|
64 | { | |
65 | status = spacewire_stop_and_start_link( fdSPW ); // start the link |
|
65 | status = spacewire_stop_and_start_link( fdSPW ); // start the link | |
66 | if ( status != RTEMS_SUCCESSFUL) |
|
66 | if ( status != RTEMS_SUCCESSFUL) | |
67 | { |
|
67 | { | |
68 | PRINTF1("in SPIQ *** ERR spacewire_start_link %d\n", status) |
|
68 | PRINTF1("in SPIQ *** ERR spacewire_start_link %d\n", status) | |
69 | } |
|
69 | } | |
70 | } |
|
70 | } | |
71 |
|
71 | |||
72 | // [3] COMPLETE RECOVERY ACTION AFTER SY_LFR_DPU_CONNECT_ATTEMPTS |
|
72 | // [3] COMPLETE RECOVERY ACTION AFTER SY_LFR_DPU_CONNECT_ATTEMPTS | |
73 | if ( status == RTEMS_SUCCESSFUL ) // [3.a] the link is in run state and has been started successfully |
|
73 | if ( status == RTEMS_SUCCESSFUL ) // [3.a] the link is in run state and has been started successfully | |
74 | { |
|
74 | { | |
75 | status = rtems_task_restart( Task_id[ TASKID_SEND ], 1 ); |
|
75 | status = rtems_task_restart( Task_id[ TASKID_SEND ], 1 ); | |
76 | if ( status != RTEMS_SUCCESSFUL ) { |
|
76 | if ( status != RTEMS_SUCCESSFUL ) { | |
77 | PRINTF("in SPIQ *** ERR resuming SEND Task\n") |
|
77 | PRINTF("in SPIQ *** ERR resuming SEND Task\n") | |
78 | } |
|
78 | } | |
79 | status = rtems_task_restart( Task_id[ TASKID_RECV ], 1 ); |
|
79 | status = rtems_task_restart( Task_id[ TASKID_RECV ], 1 ); | |
80 | if ( status != RTEMS_SUCCESSFUL ) { |
|
80 | if ( status != RTEMS_SUCCESSFUL ) { | |
81 | PRINTF("in SPIQ *** ERR resuming RECV Task\n") |
|
81 | PRINTF("in SPIQ *** ERR resuming RECV Task\n") | |
82 | } |
|
82 | } | |
83 | } |
|
83 | } | |
84 | else // [3.b] the link is not in run state, go in STANDBY mode |
|
84 | else // [3.b] the link is not in run state, go in STANDBY mode | |
85 | { |
|
85 | { | |
86 | status = stop_current_mode(); |
|
86 | status = stop_current_mode(); | |
87 | if ( status != RTEMS_SUCCESSFUL ) { |
|
87 | if ( status != RTEMS_SUCCESSFUL ) { | |
88 | PRINTF1("in SPIQ *** ERR stop_current_mode *** code %d\n", status) |
|
88 | PRINTF1("in SPIQ *** ERR stop_current_mode *** code %d\n", status) | |
89 | } |
|
89 | } | |
90 | status = enter_mode( LFR_MODE_STANDBY, 0 ); |
|
90 | status = enter_mode( LFR_MODE_STANDBY, 0 ); | |
91 | if ( status != RTEMS_SUCCESSFUL ) { |
|
91 | if ( status != RTEMS_SUCCESSFUL ) { | |
92 | PRINTF1("in SPIQ *** ERR enter_standby_mode *** code %d\n", status) |
|
92 | PRINTF1("in SPIQ *** ERR enter_standby_mode *** code %d\n", status) | |
93 | } |
|
93 | } | |
94 | // wake the WTDG task up to wait for the link recovery |
|
94 | // wake the WTDG task up to wait for the link recovery | |
95 | status = rtems_event_send ( Task_id[TASKID_WTDG], RTEMS_EVENT_0 ); |
|
95 | status = rtems_event_send ( Task_id[TASKID_WTDG], RTEMS_EVENT_0 ); | |
96 | status = rtems_task_suspend( RTEMS_SELF ); |
|
96 | status = rtems_task_suspend( RTEMS_SELF ); | |
97 | } |
|
97 | } | |
98 | } |
|
98 | } | |
99 | } |
|
99 | } | |
100 |
|
100 | |||
101 | rtems_task recv_task( rtems_task_argument unused ) |
|
101 | rtems_task recv_task( rtems_task_argument unused ) | |
102 | { |
|
102 | { | |
103 | /** This RTEMS task is dedicated to the reception of incoming TeleCommands. |
|
103 | /** This RTEMS task is dedicated to the reception of incoming TeleCommands. | |
104 | * |
|
104 | * | |
105 | * @param unused is the starting argument of the RTEMS task |
|
105 | * @param unused is the starting argument of the RTEMS task | |
106 | * |
|
106 | * | |
107 | * The RECV task blocks on a call to the read system call, waiting for incoming SpaceWire data. When unblocked: |
|
107 | * The RECV task blocks on a call to the read system call, waiting for incoming SpaceWire data. When unblocked: | |
108 | * 1. It reads the incoming data. |
|
108 | * 1. It reads the incoming data. | |
109 | * 2. Launches the acceptance procedure. |
|
109 | * 2. Launches the acceptance procedure. | |
110 | * 3. If the Telecommand is valid, sends it to a dedicated RTEMS message queue. |
|
110 | * 3. If the Telecommand is valid, sends it to a dedicated RTEMS message queue. | |
111 | * |
|
111 | * | |
112 | */ |
|
112 | */ | |
113 |
|
113 | |||
114 | int len; |
|
114 | int len; | |
115 | ccsdsTelecommandPacket_t currentTC; |
|
115 | ccsdsTelecommandPacket_t currentTC; | |
116 | unsigned char computed_CRC[ 2 ]; |
|
116 | unsigned char computed_CRC[ 2 ]; | |
117 | unsigned char currentTC_LEN_RCV[ 2 ]; |
|
117 | unsigned char currentTC_LEN_RCV[ 2 ]; | |
118 | unsigned char destinationID; |
|
118 | unsigned char destinationID; | |
119 | unsigned int estimatedPacketLength; |
|
119 | unsigned int estimatedPacketLength; | |
120 | unsigned int parserCode; |
|
120 | unsigned int parserCode; | |
121 | rtems_status_code status; |
|
121 | rtems_status_code status; | |
122 | rtems_id queue_recv_id; |
|
122 | rtems_id queue_recv_id; | |
123 | rtems_id queue_send_id; |
|
123 | rtems_id queue_send_id; | |
124 |
|
124 | |||
125 | initLookUpTableForCRC(); // the table is used to compute Cyclic Redundancy Codes |
|
125 | initLookUpTableForCRC(); // the table is used to compute Cyclic Redundancy Codes | |
126 |
|
126 | |||
127 | status = get_message_queue_id_recv( &queue_recv_id ); |
|
127 | status = get_message_queue_id_recv( &queue_recv_id ); | |
128 | if (status != RTEMS_SUCCESSFUL) |
|
128 | if (status != RTEMS_SUCCESSFUL) | |
129 | { |
|
129 | { | |
130 | PRINTF1("in RECV *** ERR get_message_queue_id_recv %d\n", status) |
|
130 | PRINTF1("in RECV *** ERR get_message_queue_id_recv %d\n", status) | |
131 | } |
|
131 | } | |
132 |
|
132 | |||
133 | status = get_message_queue_id_send( &queue_send_id ); |
|
133 | status = get_message_queue_id_send( &queue_send_id ); | |
134 | if (status != RTEMS_SUCCESSFUL) |
|
134 | if (status != RTEMS_SUCCESSFUL) | |
135 | { |
|
135 | { | |
136 | PRINTF1("in RECV *** ERR get_message_queue_id_send %d\n", status) |
|
136 | PRINTF1("in RECV *** ERR get_message_queue_id_send %d\n", status) | |
137 | } |
|
137 | } | |
138 |
|
138 | |||
139 | BOOT_PRINTF("in RECV *** \n") |
|
139 | BOOT_PRINTF("in RECV *** \n") | |
140 |
|
140 | |||
141 | while(1) |
|
141 | while(1) | |
142 | { |
|
142 | { | |
143 | len = read( fdSPW, (char*) ¤tTC, CCSDS_TC_PKT_MAX_SIZE ); // the call to read is blocking |
|
143 | len = read( fdSPW, (char*) ¤tTC, CCSDS_TC_PKT_MAX_SIZE ); // the call to read is blocking | |
144 | if (len == -1){ // error during the read call |
|
144 | if (len == -1){ // error during the read call | |
145 | PRINTF1("in RECV *** last read call returned -1, ERRNO %d\n", errno) |
|
145 | PRINTF1("in RECV *** last read call returned -1, ERRNO %d\n", errno) | |
146 | } |
|
146 | } | |
147 | else { |
|
147 | else { | |
148 | if ( (len+1) < CCSDS_TC_PKT_MIN_SIZE ) { |
|
148 | if ( (len+1) < CCSDS_TC_PKT_MIN_SIZE ) { | |
149 | PRINTF("in RECV *** packet lenght too short\n") |
|
149 | PRINTF("in RECV *** packet lenght too short\n") | |
150 | } |
|
150 | } | |
151 | else { |
|
151 | else { | |
152 | estimatedPacketLength = (unsigned int) (len - CCSDS_TC_TM_PACKET_OFFSET - 3); // => -3 is for Prot ID, Reserved and User App bytes |
|
152 | estimatedPacketLength = (unsigned int) (len - CCSDS_TC_TM_PACKET_OFFSET - 3); // => -3 is for Prot ID, Reserved and User App bytes | |
153 | currentTC_LEN_RCV[ 0 ] = (unsigned char) (estimatedPacketLength >> 8); |
|
153 | currentTC_LEN_RCV[ 0 ] = (unsigned char) (estimatedPacketLength >> 8); | |
154 | currentTC_LEN_RCV[ 1 ] = (unsigned char) (estimatedPacketLength ); |
|
154 | currentTC_LEN_RCV[ 1 ] = (unsigned char) (estimatedPacketLength ); | |
155 | // CHECK THE TC |
|
155 | // CHECK THE TC | |
156 | parserCode = tc_parser( ¤tTC, estimatedPacketLength, computed_CRC ) ; |
|
156 | parserCode = tc_parser( ¤tTC, estimatedPacketLength, computed_CRC ) ; | |
157 | if ( (parserCode == ILLEGAL_APID) || (parserCode == WRONG_LEN_PKT) |
|
157 | if ( (parserCode == ILLEGAL_APID) || (parserCode == WRONG_LEN_PKT) | |
158 | || (parserCode == INCOR_CHECKSUM) || (parserCode == ILL_TYPE) |
|
158 | || (parserCode == INCOR_CHECKSUM) || (parserCode == ILL_TYPE) | |
159 | || (parserCode == ILL_SUBTYPE) || (parserCode == WRONG_APP_DATA) |
|
159 | || (parserCode == ILL_SUBTYPE) || (parserCode == WRONG_APP_DATA) | |
160 | || (parserCode == WRONG_SRC_ID) ) |
|
160 | || (parserCode == WRONG_SRC_ID) ) | |
161 | { // send TM_LFR_TC_EXE_CORRUPTED |
|
161 | { // send TM_LFR_TC_EXE_CORRUPTED | |
162 | PRINTF1("TC corrupted received, with code: %d\n", parserCode) |
|
162 | PRINTF1("TC corrupted received, with code: %d\n", parserCode) | |
163 | if ( !( (currentTC.serviceType==TC_TYPE_TIME) && (currentTC.serviceSubType==TC_SUBTYPE_UPDT_TIME) ) |
|
163 | if ( !( (currentTC.serviceType==TC_TYPE_TIME) && (currentTC.serviceSubType==TC_SUBTYPE_UPDT_TIME) ) | |
164 | && |
|
164 | && | |
165 | !( (currentTC.serviceType==TC_TYPE_GEN) && (currentTC.serviceSubType==TC_SUBTYPE_UPDT_INFO)) |
|
165 | !( (currentTC.serviceType==TC_TYPE_GEN) && (currentTC.serviceSubType==TC_SUBTYPE_UPDT_INFO)) | |
166 | ) |
|
166 | ) | |
167 | { |
|
167 | { | |
168 | if ( parserCode == WRONG_SRC_ID ) |
|
168 | if ( parserCode == WRONG_SRC_ID ) | |
169 | { |
|
169 | { | |
170 | destinationID = SID_TC_GROUND; |
|
170 | destinationID = SID_TC_GROUND; | |
171 | } |
|
171 | } | |
172 | else |
|
172 | else | |
173 | { |
|
173 | { | |
174 | destinationID = currentTC.sourceID; |
|
174 | destinationID = currentTC.sourceID; | |
175 | } |
|
175 | } | |
176 | send_tm_lfr_tc_exe_corrupted( ¤tTC, queue_send_id, |
|
176 | send_tm_lfr_tc_exe_corrupted( ¤tTC, queue_send_id, | |
177 | computed_CRC, currentTC_LEN_RCV, |
|
177 | computed_CRC, currentTC_LEN_RCV, | |
178 | destinationID ); |
|
178 | destinationID ); | |
179 | } |
|
179 | } | |
180 | } |
|
180 | } | |
181 | else |
|
181 | else | |
182 | { // send valid TC to the action launcher |
|
182 | { // send valid TC to the action launcher | |
183 | status = rtems_message_queue_send( queue_recv_id, ¤tTC, |
|
183 | status = rtems_message_queue_send( queue_recv_id, ¤tTC, | |
184 | estimatedPacketLength + CCSDS_TC_TM_PACKET_OFFSET + 3); |
|
184 | estimatedPacketLength + CCSDS_TC_TM_PACKET_OFFSET + 3); | |
185 | } |
|
185 | } | |
186 | } |
|
186 | } | |
187 | } |
|
187 | } | |
188 | } |
|
188 | } | |
189 | } |
|
189 | } | |
190 |
|
190 | |||
191 | rtems_task send_task( rtems_task_argument argument) |
|
191 | rtems_task send_task( rtems_task_argument argument) | |
192 | { |
|
192 | { | |
193 | /** This RTEMS task is dedicated to the transmission of TeleMetry packets. |
|
193 | /** This RTEMS task is dedicated to the transmission of TeleMetry packets. | |
194 | * |
|
194 | * | |
195 | * @param unused is the starting argument of the RTEMS task |
|
195 | * @param unused is the starting argument of the RTEMS task | |
196 | * |
|
196 | * | |
197 | * The SEND task waits for a message to become available in the dedicated RTEMS queue. When a message arrives: |
|
197 | * The SEND task waits for a message to become available in the dedicated RTEMS queue. When a message arrives: | |
198 | * - if the first byte is equal to CCSDS_DESTINATION_ID, the message is sent as is using the write system call. |
|
198 | * - if the first byte is equal to CCSDS_DESTINATION_ID, the message is sent as is using the write system call. | |
199 | * - if the first byte is not equal to CCSDS_DESTINATION_ID, the message is handled as a spw_ioctl_pkt_send. After |
|
199 | * - if the first byte is not equal to CCSDS_DESTINATION_ID, the message is handled as a spw_ioctl_pkt_send. After | |
200 | * analyzis, the packet is sent either using the write system call or using the ioctl call SPACEWIRE_IOCTRL_SEND, depending on the |
|
200 | * analyzis, the packet is sent either using the write system call or using the ioctl call SPACEWIRE_IOCTRL_SEND, depending on the | |
201 | * data it contains. |
|
201 | * data it contains. | |
202 | * |
|
202 | * | |
203 | */ |
|
203 | */ | |
204 |
|
204 | |||
205 | rtems_status_code status; // RTEMS status code |
|
205 | rtems_status_code status; // RTEMS status code | |
206 | char incomingData[MSG_QUEUE_SIZE_SEND]; // incoming data buffer |
|
206 | char incomingData[MSG_QUEUE_SIZE_SEND]; // incoming data buffer | |
207 | spw_ioctl_pkt_send *spw_ioctl_send; |
|
207 | spw_ioctl_pkt_send *spw_ioctl_send; | |
208 | size_t size; // size of the incoming TC packet |
|
208 | size_t size; // size of the incoming TC packet | |
209 | u_int32_t count; |
|
209 | u_int32_t count; | |
210 | rtems_id queue_id; |
|
210 | rtems_id queue_id; | |
211 |
|
211 | |||
212 | status = get_message_queue_id_send( &queue_id ); |
|
212 | status = get_message_queue_id_send( &queue_id ); | |
213 | if (status != RTEMS_SUCCESSFUL) |
|
213 | if (status != RTEMS_SUCCESSFUL) | |
214 | { |
|
214 | { | |
215 | PRINTF1("in HOUS *** ERR get_message_queue_id_send %d\n", status) |
|
215 | PRINTF1("in HOUS *** ERR get_message_queue_id_send %d\n", status) | |
216 | } |
|
216 | } | |
217 |
|
217 | |||
218 | BOOT_PRINTF("in SEND *** \n") |
|
218 | BOOT_PRINTF("in SEND *** \n") | |
219 |
|
219 | |||
220 | while(1) |
|
220 | while(1) | |
221 | { |
|
221 | { | |
222 | status = rtems_message_queue_receive( queue_id, incomingData, &size, |
|
222 | status = rtems_message_queue_receive( queue_id, incomingData, &size, | |
223 | RTEMS_WAIT, RTEMS_NO_TIMEOUT ); |
|
223 | RTEMS_WAIT, RTEMS_NO_TIMEOUT ); | |
224 |
|
224 | |||
225 | if (status!=RTEMS_SUCCESSFUL) |
|
225 | if (status!=RTEMS_SUCCESSFUL) | |
226 | { |
|
226 | { | |
227 | PRINTF1("in SEND *** (1) ERR = %d\n", status) |
|
227 | PRINTF1("in SEND *** (1) ERR = %d\n", status) | |
228 | } |
|
228 | } | |
229 | else |
|
229 | else | |
230 | { |
|
230 | { | |
231 | if ( incomingData[0] == CCSDS_DESTINATION_ID) // the incoming message is a ccsds packet |
|
231 | if ( incomingData[0] == CCSDS_DESTINATION_ID) // the incoming message is a ccsds packet | |
232 | { |
|
232 | { | |
233 | status = write( fdSPW, incomingData, size ); |
|
233 | status = write( fdSPW, incomingData, size ); | |
234 | if (status == -1){ |
|
234 | if (status == -1){ | |
235 | PRINTF2("in SEND *** (2.a) ERRNO = %d, size = %d\n", errno, size) |
|
235 | PRINTF2("in SEND *** (2.a) ERRNO = %d, size = %d\n", errno, size) | |
236 | } |
|
236 | } | |
237 | } |
|
237 | } | |
238 | else // the incoming message is a spw_ioctl_pkt_send structure |
|
238 | else // the incoming message is a spw_ioctl_pkt_send structure | |
239 | { |
|
239 | { | |
240 | spw_ioctl_send = (spw_ioctl_pkt_send*) incomingData; |
|
240 | spw_ioctl_send = (spw_ioctl_pkt_send*) incomingData; | |
241 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, spw_ioctl_send ); |
|
241 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, spw_ioctl_send ); | |
242 | if (status == -1){ |
|
242 | if (status == -1){ | |
243 | PRINTF2("in SEND *** (2.b) ERRNO = %d, RTEMS = %d\n", errno, status) |
|
243 | PRINTF2("in SEND *** (2.b) ERRNO = %d, RTEMS = %d\n", errno, status) | |
244 | } |
|
244 | } | |
245 | } |
|
245 | } | |
246 | } |
|
246 | } | |
247 |
|
247 | |||
248 | status = rtems_message_queue_get_number_pending( queue_id, &count ); |
|
248 | status = rtems_message_queue_get_number_pending( queue_id, &count ); | |
249 | if (status != RTEMS_SUCCESSFUL) |
|
249 | if (status != RTEMS_SUCCESSFUL) | |
250 | { |
|
250 | { | |
251 | PRINTF1("in SEND *** (3) ERR = %d\n", status) |
|
251 | PRINTF1("in SEND *** (3) ERR = %d\n", status) | |
252 | } |
|
252 | } | |
253 | else |
|
253 | else | |
254 | { |
|
254 | { | |
255 | if (count > maxCount) |
|
255 | if (count > maxCount) | |
256 | { |
|
256 | { | |
257 | maxCount = count; |
|
257 | maxCount = count; | |
258 | } |
|
258 | } | |
259 | } |
|
259 | } | |
260 | } |
|
260 | } | |
261 | } |
|
261 | } | |
262 |
|
262 | |||
263 | rtems_task wtdg_task( rtems_task_argument argument ) |
|
263 | rtems_task wtdg_task( rtems_task_argument argument ) | |
264 | { |
|
264 | { | |
265 | rtems_event_set event_out; |
|
265 | rtems_event_set event_out; | |
266 | rtems_status_code status; |
|
266 | rtems_status_code status; | |
267 | int linkStatus; |
|
267 | int linkStatus; | |
268 |
|
268 | |||
269 | BOOT_PRINTF("in WTDG ***\n") |
|
269 | BOOT_PRINTF("in WTDG ***\n") | |
270 |
|
270 | |||
271 | while(1) |
|
271 | while(1) | |
272 | { |
|
272 | { | |
273 | // wait for an RTEMS_EVENT |
|
273 | // wait for an RTEMS_EVENT | |
274 | rtems_event_receive( RTEMS_EVENT_0, |
|
274 | rtems_event_receive( RTEMS_EVENT_0, | |
275 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
275 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
276 | PRINTF("in WTDG *** wait for the link\n") |
|
276 | PRINTF("in WTDG *** wait for the link\n") | |
277 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status |
|
277 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status | |
278 | while( linkStatus != 5) // wait for the link |
|
278 | while( linkStatus != 5) // wait for the link | |
279 | { |
|
279 | { | |
280 | rtems_task_wake_after( 10 ); |
|
280 | rtems_task_wake_after( 10 ); | |
281 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status |
|
281 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status | |
282 | } |
|
282 | } | |
283 |
|
283 | |||
284 | status = spacewire_stop_and_start_link( fdSPW ); |
|
284 | status = spacewire_stop_and_start_link( fdSPW ); | |
285 |
|
285 | |||
286 | if (status != RTEMS_SUCCESSFUL) |
|
286 | if (status != RTEMS_SUCCESSFUL) | |
287 | { |
|
287 | { | |
288 | PRINTF1("in WTDG *** ERR link not started %d\n", status) |
|
288 | PRINTF1("in WTDG *** ERR link not started %d\n", status) | |
289 | } |
|
289 | } | |
290 | else |
|
290 | else | |
291 | { |
|
291 | { | |
292 | PRINTF("in WTDG *** OK link started\n") |
|
292 | PRINTF("in WTDG *** OK link started\n") | |
293 | } |
|
293 | } | |
294 |
|
294 | |||
295 | // restart the SPIQ task |
|
295 | // restart the SPIQ task | |
296 | status = rtems_task_restart( Task_id[TASKID_SPIQ], 1 ); |
|
296 | status = rtems_task_restart( Task_id[TASKID_SPIQ], 1 ); | |
297 | if ( status != RTEMS_SUCCESSFUL ) { |
|
297 | if ( status != RTEMS_SUCCESSFUL ) { | |
298 | PRINTF("in SPIQ *** ERR restarting SPIQ Task\n") |
|
298 | PRINTF("in SPIQ *** ERR restarting SPIQ Task\n") | |
299 | } |
|
299 | } | |
300 |
|
300 | |||
301 | // restart RECV and SEND |
|
301 | // restart RECV and SEND | |
302 | status = rtems_task_restart( Task_id[ TASKID_SEND ], 1 ); |
|
302 | status = rtems_task_restart( Task_id[ TASKID_SEND ], 1 ); | |
303 | if ( status != RTEMS_SUCCESSFUL ) { |
|
303 | if ( status != RTEMS_SUCCESSFUL ) { | |
304 | PRINTF("in SPIQ *** ERR restarting SEND Task\n") |
|
304 | PRINTF("in SPIQ *** ERR restarting SEND Task\n") | |
305 | } |
|
305 | } | |
306 | status = rtems_task_restart( Task_id[ TASKID_RECV ], 1 ); |
|
306 | status = rtems_task_restart( Task_id[ TASKID_RECV ], 1 ); | |
307 | if ( status != RTEMS_SUCCESSFUL ) { |
|
307 | if ( status != RTEMS_SUCCESSFUL ) { | |
308 | PRINTF("in SPIQ *** ERR restarting RECV Task\n") |
|
308 | PRINTF("in SPIQ *** ERR restarting RECV Task\n") | |
309 | } |
|
309 | } | |
310 | } |
|
310 | } | |
311 | } |
|
311 | } | |
312 |
|
312 | |||
313 | //**************** |
|
313 | //**************** | |
314 | // OTHER FUNCTIONS |
|
314 | // OTHER FUNCTIONS | |
315 | int spacewire_open_link( void ) // by default, the driver resets the core: [SPW_CTRL_WRITE(pDev, SPW_CTRL_RESET);] |
|
315 | int spacewire_open_link( void ) // by default, the driver resets the core: [SPW_CTRL_WRITE(pDev, SPW_CTRL_RESET);] | |
316 | { |
|
316 | { | |
317 | /** This function opens the SpaceWire link. |
|
317 | /** This function opens the SpaceWire link. | |
318 | * |
|
318 | * | |
319 | * @return a valid file descriptor in case of success, -1 in case of a failure |
|
319 | * @return a valid file descriptor in case of success, -1 in case of a failure | |
320 | * |
|
320 | * | |
321 | */ |
|
321 | */ | |
322 | rtems_status_code status; |
|
322 | rtems_status_code status; | |
323 |
|
323 | |||
324 | fdSPW = open(GRSPW_DEVICE_NAME, O_RDWR); // open the device. the open call resets the hardware |
|
324 | fdSPW = open(GRSPW_DEVICE_NAME, O_RDWR); // open the device. the open call resets the hardware | |
325 | if ( fdSPW < 0 ) { |
|
325 | if ( fdSPW < 0 ) { | |
326 | PRINTF1("ERR *** in configure_spw_link *** error opening "GRSPW_DEVICE_NAME" with ERR %d\n", errno) |
|
326 | PRINTF1("ERR *** in configure_spw_link *** error opening "GRSPW_DEVICE_NAME" with ERR %d\n", errno) | |
327 | } |
|
327 | } | |
328 | else |
|
328 | else | |
329 | { |
|
329 | { | |
330 | status = RTEMS_SUCCESSFUL; |
|
330 | status = RTEMS_SUCCESSFUL; | |
331 | } |
|
331 | } | |
332 |
|
332 | |||
333 | return status; |
|
333 | return status; | |
334 | } |
|
334 | } | |
335 |
|
335 | |||
336 | int spacewire_start_link( int fd ) |
|
336 | int spacewire_start_link( int fd ) | |
337 | { |
|
337 | { | |
338 | rtems_status_code status; |
|
338 | rtems_status_code status; | |
339 |
|
339 | |||
340 | status = ioctl( fd, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is started |
|
340 | status = ioctl( fd, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is started | |
341 | // -1 default hardcoded driver timeout |
|
341 | // -1 default hardcoded driver timeout | |
342 |
|
342 | |||
343 | return status; |
|
343 | return status; | |
344 | } |
|
344 | } | |
345 |
|
345 | |||
346 | int spacewire_stop_and_start_link( int fd ) |
|
346 | int spacewire_stop_and_start_link( int fd ) | |
347 | { |
|
347 | { | |
348 | rtems_status_code status; |
|
348 | rtems_status_code status; | |
349 |
|
349 | |||
350 | status = ioctl( fd, SPACEWIRE_IOCTRL_STOP); // start fails if link pDev->running != 0 |
|
350 | status = ioctl( fd, SPACEWIRE_IOCTRL_STOP); // start fails if link pDev->running != 0 | |
351 | status = ioctl( fd, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is started |
|
351 | status = ioctl( fd, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is started | |
352 | // -1 default hardcoded driver timeout |
|
352 | // -1 default hardcoded driver timeout | |
353 |
|
353 | |||
354 | return status; |
|
354 | return status; | |
355 | } |
|
355 | } | |
356 |
|
356 | |||
357 | int spacewire_configure_link( int fd ) |
|
357 | int spacewire_configure_link( int fd ) | |
358 | { |
|
358 | { | |
359 | /** This function configures the SpaceWire link. |
|
359 | /** This function configures the SpaceWire link. | |
360 | * |
|
360 | * | |
361 | * @return GR-RTEMS-DRIVER directive status codes: |
|
361 | * @return GR-RTEMS-DRIVER directive status codes: | |
362 | * - 22 EINVAL - Null pointer or an out of range value was given as the argument. |
|
362 | * - 22 EINVAL - Null pointer or an out of range value was given as the argument. | |
363 | * - 16 EBUSY - Only used for SEND. Returned when no descriptors are avialble in non-blocking mode. |
|
363 | * - 16 EBUSY - Only used for SEND. Returned when no descriptors are avialble in non-blocking mode. | |
364 | * - 88 ENOSYS - Returned for SET_DESTKEY if RMAP command handler is not available or if a non-implemented call is used. |
|
364 | * - 88 ENOSYS - Returned for SET_DESTKEY if RMAP command handler is not available or if a non-implemented call is used. | |
365 | * - 116 ETIMEDOUT - REturned for SET_PACKET_SIZE and START if the link could not be brought up. |
|
365 | * - 116 ETIMEDOUT - REturned for SET_PACKET_SIZE and START if the link could not be brought up. | |
366 | * - 12 ENOMEM - Returned for SET_PACKETSIZE if it was unable to allocate the new buffers. |
|
366 | * - 12 ENOMEM - Returned for SET_PACKETSIZE if it was unable to allocate the new buffers. | |
367 | * - 5 EIO - Error when writing to grswp hardware registers. |
|
367 | * - 5 EIO - Error when writing to grswp hardware registers. | |
368 | * - 2 ENOENT - No such file or directory |
|
368 | * - 2 ENOENT - No such file or directory | |
369 | */ |
|
369 | */ | |
370 |
|
370 | |||
371 | rtems_status_code status; |
|
371 | rtems_status_code status; | |
372 |
|
372 | |||
373 | spacewire_set_NP(1, REGS_ADDR_GRSPW); // [N]o [P]ort force |
|
373 | spacewire_set_NP(1, REGS_ADDR_GRSPW); // [N]o [P]ort force | |
374 | spacewire_set_RE(1, REGS_ADDR_GRSPW); // [R]MAP [E]nable, the dedicated call seems to break the no port force configuration |
|
374 | spacewire_set_RE(1, REGS_ADDR_GRSPW); // [R]MAP [E]nable, the dedicated call seems to break the no port force configuration | |
375 |
|
375 | |||
376 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_RXBLOCK, 1); // sets the blocking mode for reception |
|
376 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_RXBLOCK, 1); // sets the blocking mode for reception | |
377 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_RXBLOCK\n") |
|
377 | if (status!=RTEMS_SUCCESSFUL) { | |
|
378 | PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_RXBLOCK\n") | |||
|
379 | } | |||
378 | // |
|
380 | // | |
379 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_EVENT_ID, Task_id[TASKID_SPIQ]); // sets the task ID to which an event is sent when a |
|
381 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_EVENT_ID, Task_id[TASKID_SPIQ]); // sets the task ID to which an event is sent when a | |
380 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_EVENT_ID\n") // link-error interrupt occurs |
|
382 | if (status!=RTEMS_SUCCESSFUL) { | |
|
383 | PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_EVENT_ID\n") // link-error interrupt occurs | |||
|
384 | } | |||
381 | // |
|
385 | // | |
382 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_DISABLE_ERR, 0); // automatic link-disabling due to link-error interrupts |
|
386 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_DISABLE_ERR, 0); // automatic link-disabling due to link-error interrupts | |
383 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_DISABLE_ERR\n") |
|
387 | if (status!=RTEMS_SUCCESSFUL) { | |
|
388 | PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_DISABLE_ERR\n") | |||
|
389 | } | |||
384 | // |
|
390 | // | |
385 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ, 1); // sets the link-error interrupt bit |
|
391 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ, 1); // sets the link-error interrupt bit | |
386 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ\n") |
|
392 | if (status!=RTEMS_SUCCESSFUL) { | |
|
393 | PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ\n") | |||
|
394 | } | |||
387 | // |
|
395 | // | |
388 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TXBLOCK, 0); // transmission blocks |
|
396 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TXBLOCK, 0); // transmission blocks | |
389 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK\n") |
|
397 | if (status!=RTEMS_SUCCESSFUL) { | |
|
398 | PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK\n") | |||
|
399 | } | |||
390 | // |
|
400 | // | |
391 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL, 1); // transmission blocks when no transmission descriptor is available |
|
401 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL, 1); // transmission blocks when no transmission descriptor is available | |
392 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL\n") |
|
402 | if (status!=RTEMS_SUCCESSFUL) { | |
|
403 | PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL\n") | |||
|
404 | } | |||
393 | // |
|
405 | // | |
394 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TCODE_CTRL, 0x0909); // [Time Rx : Time Tx : Link error : Tick-out IRQ] |
|
406 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TCODE_CTRL, 0x0909); // [Time Rx : Time Tx : Link error : Tick-out IRQ] | |
395 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TCODE_CTRL,\n") |
|
407 | if (status!=RTEMS_SUCCESSFUL) { | |
|
408 | PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TCODE_CTRL,\n") | |||
|
409 | } | |||
396 |
|
410 | |||
397 | return status; |
|
411 | return status; | |
398 | } |
|
412 | } | |
399 |
|
413 | |||
400 | int spacewire_reset_link( void ) |
|
414 | int spacewire_reset_link( void ) | |
401 | { |
|
415 | { | |
402 | /** This function is executed by the SPIQ rtems_task wehn it has been awaken by an interruption raised by the SpaceWire driver. |
|
416 | /** This function is executed by the SPIQ rtems_task wehn it has been awaken by an interruption raised by the SpaceWire driver. | |
403 | * |
|
417 | * | |
404 | * @return RTEMS directive status code: |
|
418 | * @return RTEMS directive status code: | |
405 | * - RTEMS_UNSATISFIED is returned is the link is not in the running state after 10 s. |
|
419 | * - RTEMS_UNSATISFIED is returned is the link is not in the running state after 10 s. | |
406 | * - RTEMS_SUCCESSFUL is returned if the link is up before the timeout. |
|
420 | * - RTEMS_SUCCESSFUL is returned if the link is up before the timeout. | |
407 | * |
|
421 | * | |
408 | */ |
|
422 | */ | |
409 |
|
423 | |||
410 | rtems_status_code status_spw; |
|
424 | rtems_status_code status_spw; | |
411 | int i; |
|
425 | int i; | |
412 |
|
426 | |||
413 | for ( i=0; i<SY_LFR_DPU_CONNECT_ATTEMPT; i++ ) |
|
427 | for ( i=0; i<SY_LFR_DPU_CONNECT_ATTEMPT; i++ ) | |
414 | { |
|
428 | { | |
415 | PRINTF1("in spacewire_reset_link *** link recovery, try %d\n", i); |
|
429 | PRINTF1("in spacewire_reset_link *** link recovery, try %d\n", i); | |
416 |
|
430 | |||
417 | // CLOSING THE DRIVER AT THIS POINT WILL MAKE THE SEND TASK BLOCK THE SYSTEM |
|
431 | // CLOSING THE DRIVER AT THIS POINT WILL MAKE THE SEND TASK BLOCK THE SYSTEM | |
418 |
|
432 | |||
419 | status_spw = spacewire_stop_and_start_link( fdSPW ); |
|
433 | status_spw = spacewire_stop_and_start_link( fdSPW ); | |
420 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
434 | if ( status_spw != RTEMS_SUCCESSFUL ) | |
421 | { |
|
435 | { | |
422 | PRINTF1("in spacewire_reset_link *** ERR spacewire_start_link code %d\n", status_spw) |
|
436 | PRINTF1("in spacewire_reset_link *** ERR spacewire_start_link code %d\n", status_spw) | |
423 | } |
|
437 | } | |
424 |
|
438 | |||
425 | if ( status_spw == RTEMS_SUCCESSFUL) |
|
439 | if ( status_spw == RTEMS_SUCCESSFUL) | |
426 | { |
|
440 | { | |
427 | break; |
|
441 | break; | |
428 | } |
|
442 | } | |
429 | } |
|
443 | } | |
430 |
|
444 | |||
431 | return status_spw; |
|
445 | return status_spw; | |
432 | } |
|
446 | } | |
433 |
|
447 | |||
434 | void spacewire_set_NP( unsigned char val, unsigned int regAddr ) // [N]o [P]ort force |
|
448 | void spacewire_set_NP( unsigned char val, unsigned int regAddr ) // [N]o [P]ort force | |
435 | { |
|
449 | { | |
436 | /** This function sets the [N]o [P]ort force bit of the GRSPW control register. |
|
450 | /** This function sets the [N]o [P]ort force bit of the GRSPW control register. | |
437 | * |
|
451 | * | |
438 | * @param val is the value, 0 or 1, used to set the value of the NP bit. |
|
452 | * @param val is the value, 0 or 1, used to set the value of the NP bit. | |
439 | * @param regAddr is the address of the GRSPW control register. |
|
453 | * @param regAddr is the address of the GRSPW control register. | |
440 | * |
|
454 | * | |
441 | * NP is the bit 20 of the GRSPW control register. |
|
455 | * NP is the bit 20 of the GRSPW control register. | |
442 | * |
|
456 | * | |
443 | */ |
|
457 | */ | |
444 |
|
458 | |||
445 | unsigned int *spwptr = (unsigned int*) regAddr; |
|
459 | unsigned int *spwptr = (unsigned int*) regAddr; | |
446 |
|
460 | |||
447 | if (val == 1) { |
|
461 | if (val == 1) { | |
448 | *spwptr = *spwptr | 0x00100000; // [NP] set the No port force bit |
|
462 | *spwptr = *spwptr | 0x00100000; // [NP] set the No port force bit | |
449 | } |
|
463 | } | |
450 | if (val== 0) { |
|
464 | if (val== 0) { | |
451 | *spwptr = *spwptr & 0xffdfffff; |
|
465 | *spwptr = *spwptr & 0xffdfffff; | |
452 | } |
|
466 | } | |
453 | } |
|
467 | } | |
454 |
|
468 | |||
455 | void spacewire_set_RE( unsigned char val, unsigned int regAddr ) // [R]MAP [E]nable |
|
469 | void spacewire_set_RE( unsigned char val, unsigned int regAddr ) // [R]MAP [E]nable | |
456 | { |
|
470 | { | |
457 | /** This function sets the [R]MAP [E]nable bit of the GRSPW control register. |
|
471 | /** This function sets the [R]MAP [E]nable bit of the GRSPW control register. | |
458 | * |
|
472 | * | |
459 | * @param val is the value, 0 or 1, used to set the value of the RE bit. |
|
473 | * @param val is the value, 0 or 1, used to set the value of the RE bit. | |
460 | * @param regAddr is the address of the GRSPW control register. |
|
474 | * @param regAddr is the address of the GRSPW control register. | |
461 | * |
|
475 | * | |
462 | * RE is the bit 16 of the GRSPW control register. |
|
476 | * RE is the bit 16 of the GRSPW control register. | |
463 | * |
|
477 | * | |
464 | */ |
|
478 | */ | |
465 |
|
479 | |||
466 | unsigned int *spwptr = (unsigned int*) regAddr; |
|
480 | unsigned int *spwptr = (unsigned int*) regAddr; | |
467 |
|
481 | |||
468 | if (val == 1) |
|
482 | if (val == 1) | |
469 | { |
|
483 | { | |
470 | *spwptr = *spwptr | 0x00010000; // [RE] set the RMAP Enable bit |
|
484 | *spwptr = *spwptr | 0x00010000; // [RE] set the RMAP Enable bit | |
471 | } |
|
485 | } | |
472 | if (val== 0) |
|
486 | if (val== 0) | |
473 | { |
|
487 | { | |
474 | *spwptr = *spwptr & 0xfffdffff; |
|
488 | *spwptr = *spwptr & 0xfffdffff; | |
475 | } |
|
489 | } | |
476 | } |
|
490 | } | |
477 |
|
491 | |||
478 | void spacewire_compute_stats_offsets( void ) |
|
492 | void spacewire_compute_stats_offsets( void ) | |
479 | { |
|
493 | { | |
480 | /** This function computes the SpaceWire statistics offsets in case of a SpaceWire related interruption raising. |
|
494 | /** This function computes the SpaceWire statistics offsets in case of a SpaceWire related interruption raising. | |
481 | * |
|
495 | * | |
482 | * The offsets keep a record of the statistics in case of a reset of the statistics. They are added to the current statistics |
|
496 | * The offsets keep a record of the statistics in case of a reset of the statistics. They are added to the current statistics | |
483 | * to keep the counters consistent even after a reset of the SpaceWire driver (the counter are set to zero by the driver when it |
|
497 | * to keep the counters consistent even after a reset of the SpaceWire driver (the counter are set to zero by the driver when it | |
484 | * during the open systel call). |
|
498 | * during the open systel call). | |
485 | * |
|
499 | * | |
486 | */ |
|
500 | */ | |
487 |
|
501 | |||
488 | spw_stats spacewire_stats_grspw; |
|
502 | spw_stats spacewire_stats_grspw; | |
489 | rtems_status_code status; |
|
503 | rtems_status_code status; | |
490 |
|
504 | |||
491 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw ); |
|
505 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw ); | |
492 |
|
506 | |||
493 | spacewire_stats_backup.packets_received = spacewire_stats_grspw.packets_received |
|
507 | spacewire_stats_backup.packets_received = spacewire_stats_grspw.packets_received | |
494 | + spacewire_stats.packets_received; |
|
508 | + spacewire_stats.packets_received; | |
495 | spacewire_stats_backup.packets_sent = spacewire_stats_grspw.packets_sent |
|
509 | spacewire_stats_backup.packets_sent = spacewire_stats_grspw.packets_sent | |
496 | + spacewire_stats.packets_sent; |
|
510 | + spacewire_stats.packets_sent; | |
497 | spacewire_stats_backup.parity_err = spacewire_stats_grspw.parity_err |
|
511 | spacewire_stats_backup.parity_err = spacewire_stats_grspw.parity_err | |
498 | + spacewire_stats.parity_err; |
|
512 | + spacewire_stats.parity_err; | |
499 | spacewire_stats_backup.disconnect_err = spacewire_stats_grspw.disconnect_err |
|
513 | spacewire_stats_backup.disconnect_err = spacewire_stats_grspw.disconnect_err | |
500 | + spacewire_stats.disconnect_err; |
|
514 | + spacewire_stats.disconnect_err; | |
501 | spacewire_stats_backup.escape_err = spacewire_stats_grspw.escape_err |
|
515 | spacewire_stats_backup.escape_err = spacewire_stats_grspw.escape_err | |
502 | + spacewire_stats.escape_err; |
|
516 | + spacewire_stats.escape_err; | |
503 | spacewire_stats_backup.credit_err = spacewire_stats_grspw.credit_err |
|
517 | spacewire_stats_backup.credit_err = spacewire_stats_grspw.credit_err | |
504 | + spacewire_stats.credit_err; |
|
518 | + spacewire_stats.credit_err; | |
505 | spacewire_stats_backup.write_sync_err = spacewire_stats_grspw.write_sync_err |
|
519 | spacewire_stats_backup.write_sync_err = spacewire_stats_grspw.write_sync_err | |
506 | + spacewire_stats.write_sync_err; |
|
520 | + spacewire_stats.write_sync_err; | |
507 | spacewire_stats_backup.rx_rmap_header_crc_err = spacewire_stats_grspw.rx_rmap_header_crc_err |
|
521 | spacewire_stats_backup.rx_rmap_header_crc_err = spacewire_stats_grspw.rx_rmap_header_crc_err | |
508 | + spacewire_stats.rx_rmap_header_crc_err; |
|
522 | + spacewire_stats.rx_rmap_header_crc_err; | |
509 | spacewire_stats_backup.rx_rmap_data_crc_err = spacewire_stats_grspw.rx_rmap_data_crc_err |
|
523 | spacewire_stats_backup.rx_rmap_data_crc_err = spacewire_stats_grspw.rx_rmap_data_crc_err | |
510 | + spacewire_stats.rx_rmap_data_crc_err; |
|
524 | + spacewire_stats.rx_rmap_data_crc_err; | |
511 | spacewire_stats_backup.early_ep = spacewire_stats_grspw.early_ep |
|
525 | spacewire_stats_backup.early_ep = spacewire_stats_grspw.early_ep | |
512 | + spacewire_stats.early_ep; |
|
526 | + spacewire_stats.early_ep; | |
513 | spacewire_stats_backup.invalid_address = spacewire_stats_grspw.invalid_address |
|
527 | spacewire_stats_backup.invalid_address = spacewire_stats_grspw.invalid_address | |
514 | + spacewire_stats.invalid_address; |
|
528 | + spacewire_stats.invalid_address; | |
515 | spacewire_stats_backup.rx_eep_err = spacewire_stats_grspw.rx_eep_err |
|
529 | spacewire_stats_backup.rx_eep_err = spacewire_stats_grspw.rx_eep_err | |
516 | + spacewire_stats.rx_eep_err; |
|
530 | + spacewire_stats.rx_eep_err; | |
517 | spacewire_stats_backup.rx_truncated = spacewire_stats_grspw.rx_truncated |
|
531 | spacewire_stats_backup.rx_truncated = spacewire_stats_grspw.rx_truncated | |
518 | + spacewire_stats.rx_truncated; |
|
532 | + spacewire_stats.rx_truncated; | |
519 | } |
|
533 | } | |
520 |
|
534 | |||
521 | void spacewire_update_statistics( void ) |
|
535 | void spacewire_update_statistics( void ) | |
522 | { |
|
536 | { | |
523 | rtems_status_code status; |
|
537 | rtems_status_code status; | |
524 | spw_stats spacewire_stats_grspw; |
|
538 | spw_stats spacewire_stats_grspw; | |
525 |
|
539 | |||
526 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw ); |
|
540 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw ); | |
527 |
|
541 | |||
528 | spacewire_stats.packets_received = spacewire_stats_backup.packets_received |
|
542 | spacewire_stats.packets_received = spacewire_stats_backup.packets_received | |
529 | + spacewire_stats_grspw.packets_received; |
|
543 | + spacewire_stats_grspw.packets_received; | |
530 | spacewire_stats.packets_sent = spacewire_stats_backup.packets_sent |
|
544 | spacewire_stats.packets_sent = spacewire_stats_backup.packets_sent | |
531 | + spacewire_stats_grspw.packets_sent; |
|
545 | + spacewire_stats_grspw.packets_sent; | |
532 | spacewire_stats.parity_err = spacewire_stats_backup.parity_err |
|
546 | spacewire_stats.parity_err = spacewire_stats_backup.parity_err | |
533 | + spacewire_stats_grspw.parity_err; |
|
547 | + spacewire_stats_grspw.parity_err; | |
534 | spacewire_stats.disconnect_err = spacewire_stats_backup.disconnect_err |
|
548 | spacewire_stats.disconnect_err = spacewire_stats_backup.disconnect_err | |
535 | + spacewire_stats_grspw.disconnect_err; |
|
549 | + spacewire_stats_grspw.disconnect_err; | |
536 | spacewire_stats.escape_err = spacewire_stats_backup.escape_err |
|
550 | spacewire_stats.escape_err = spacewire_stats_backup.escape_err | |
537 | + spacewire_stats_grspw.escape_err; |
|
551 | + spacewire_stats_grspw.escape_err; | |
538 | spacewire_stats.credit_err = spacewire_stats_backup.credit_err |
|
552 | spacewire_stats.credit_err = spacewire_stats_backup.credit_err | |
539 | + spacewire_stats_grspw.credit_err; |
|
553 | + spacewire_stats_grspw.credit_err; | |
540 | spacewire_stats.write_sync_err = spacewire_stats_backup.write_sync_err |
|
554 | spacewire_stats.write_sync_err = spacewire_stats_backup.write_sync_err | |
541 | + spacewire_stats_grspw.write_sync_err; |
|
555 | + spacewire_stats_grspw.write_sync_err; | |
542 | spacewire_stats.rx_rmap_header_crc_err = spacewire_stats_backup.rx_rmap_header_crc_err |
|
556 | spacewire_stats.rx_rmap_header_crc_err = spacewire_stats_backup.rx_rmap_header_crc_err | |
543 | + spacewire_stats_grspw.rx_rmap_header_crc_err; |
|
557 | + spacewire_stats_grspw.rx_rmap_header_crc_err; | |
544 | spacewire_stats.rx_rmap_data_crc_err = spacewire_stats_backup.rx_rmap_data_crc_err |
|
558 | spacewire_stats.rx_rmap_data_crc_err = spacewire_stats_backup.rx_rmap_data_crc_err | |
545 | + spacewire_stats_grspw.rx_rmap_data_crc_err; |
|
559 | + spacewire_stats_grspw.rx_rmap_data_crc_err; | |
546 | spacewire_stats.early_ep = spacewire_stats_backup.early_ep |
|
560 | spacewire_stats.early_ep = spacewire_stats_backup.early_ep | |
547 | + spacewire_stats_grspw.early_ep; |
|
561 | + spacewire_stats_grspw.early_ep; | |
548 | spacewire_stats.invalid_address = spacewire_stats_backup.invalid_address |
|
562 | spacewire_stats.invalid_address = spacewire_stats_backup.invalid_address | |
549 | + spacewire_stats_grspw.invalid_address; |
|
563 | + spacewire_stats_grspw.invalid_address; | |
550 | spacewire_stats.rx_eep_err = spacewire_stats_backup.rx_eep_err |
|
564 | spacewire_stats.rx_eep_err = spacewire_stats_backup.rx_eep_err | |
551 | + spacewire_stats_grspw.rx_eep_err; |
|
565 | + spacewire_stats_grspw.rx_eep_err; | |
552 | spacewire_stats.rx_truncated = spacewire_stats_backup.rx_truncated |
|
566 | spacewire_stats.rx_truncated = spacewire_stats_backup.rx_truncated | |
553 | + spacewire_stats_grspw.rx_truncated; |
|
567 | + spacewire_stats_grspw.rx_truncated; | |
554 | //spacewire_stats.tx_link_err; |
|
568 | //spacewire_stats.tx_link_err; | |
555 |
|
569 | |||
556 | //**************************** |
|
570 | //**************************** | |
557 | // DPU_SPACEWIRE_IF_STATISTICS |
|
571 | // DPU_SPACEWIRE_IF_STATISTICS | |
558 | housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[0] = (unsigned char) (spacewire_stats.packets_received >> 8); |
|
572 | housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[0] = (unsigned char) (spacewire_stats.packets_received >> 8); | |
559 | housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[1] = (unsigned char) (spacewire_stats.packets_received); |
|
573 | housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[1] = (unsigned char) (spacewire_stats.packets_received); | |
560 | housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[0] = (unsigned char) (spacewire_stats.packets_sent >> 8); |
|
574 | housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[0] = (unsigned char) (spacewire_stats.packets_sent >> 8); | |
561 | housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[1] = (unsigned char) (spacewire_stats.packets_sent); |
|
575 | housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[1] = (unsigned char) (spacewire_stats.packets_sent); | |
562 | //housekeeping_packet.hk_lfr_dpu_spw_tick_out_cnt; |
|
576 | //housekeeping_packet.hk_lfr_dpu_spw_tick_out_cnt; | |
563 | //housekeeping_packet.hk_lfr_dpu_spw_last_timc; |
|
577 | //housekeeping_packet.hk_lfr_dpu_spw_last_timc; | |
564 |
|
578 | |||
565 | //****************************************** |
|
579 | //****************************************** | |
566 | // ERROR COUNTERS / SPACEWIRE / LOW SEVERITY |
|
580 | // ERROR COUNTERS / SPACEWIRE / LOW SEVERITY | |
567 | housekeeping_packet.hk_lfr_dpu_spw_parity = (unsigned char) spacewire_stats.parity_err; |
|
581 | housekeeping_packet.hk_lfr_dpu_spw_parity = (unsigned char) spacewire_stats.parity_err; | |
568 | housekeeping_packet.hk_lfr_dpu_spw_disconnect = (unsigned char) spacewire_stats.disconnect_err; |
|
582 | housekeeping_packet.hk_lfr_dpu_spw_disconnect = (unsigned char) spacewire_stats.disconnect_err; | |
569 | housekeeping_packet.hk_lfr_dpu_spw_escape = (unsigned char) spacewire_stats.escape_err; |
|
583 | housekeeping_packet.hk_lfr_dpu_spw_escape = (unsigned char) spacewire_stats.escape_err; | |
570 | housekeeping_packet.hk_lfr_dpu_spw_credit = (unsigned char) spacewire_stats.credit_err; |
|
584 | housekeeping_packet.hk_lfr_dpu_spw_credit = (unsigned char) spacewire_stats.credit_err; | |
571 | housekeeping_packet.hk_lfr_dpu_spw_write_sync = (unsigned char) spacewire_stats.write_sync_err; |
|
585 | housekeeping_packet.hk_lfr_dpu_spw_write_sync = (unsigned char) spacewire_stats.write_sync_err; | |
572 |
|
586 | |||
573 | //********************************************* |
|
587 | //********************************************* | |
574 | // ERROR COUNTERS / SPACEWIRE / MEDIUM SEVERITY |
|
588 | // ERROR COUNTERS / SPACEWIRE / MEDIUM SEVERITY | |
575 | housekeeping_packet.hk_lfr_dpu_spw_early_eop = (unsigned char) spacewire_stats.early_ep; |
|
589 | housekeeping_packet.hk_lfr_dpu_spw_early_eop = (unsigned char) spacewire_stats.early_ep; | |
576 | housekeeping_packet.hk_lfr_dpu_spw_invalid_addr = (unsigned char) spacewire_stats.invalid_address; |
|
590 | housekeeping_packet.hk_lfr_dpu_spw_invalid_addr = (unsigned char) spacewire_stats.invalid_address; | |
577 | housekeeping_packet.hk_lfr_dpu_spw_eep = (unsigned char) spacewire_stats.rx_eep_err; |
|
591 | housekeeping_packet.hk_lfr_dpu_spw_eep = (unsigned char) spacewire_stats.rx_eep_err; | |
578 | housekeeping_packet.hk_lfr_dpu_spw_rx_too_big = (unsigned char) spacewire_stats.rx_truncated; |
|
592 | housekeeping_packet.hk_lfr_dpu_spw_rx_too_big = (unsigned char) spacewire_stats.rx_truncated; | |
579 | } |
|
593 | } | |
580 |
|
594 | |||
581 | void timecode_irq_handler( void *pDev, void *regs, int minor, unsigned int tc ) |
|
595 | void timecode_irq_handler( void *pDev, void *regs, int minor, unsigned int tc ) | |
582 | { |
|
596 | { | |
583 | // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_9 ); |
|
597 | // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_9 ); | |
584 | struct grgpio_regs_str *grgpio_regs = (struct grgpio_regs_str *) REGS_ADDR_GRGPIO; |
|
598 | struct grgpio_regs_str *grgpio_regs = (struct grgpio_regs_str *) REGS_ADDR_GRGPIO; | |
585 |
|
599 | |||
586 | grgpio_regs->io_port_direction_register = |
|
600 | grgpio_regs->io_port_direction_register = | |
587 | grgpio_regs->io_port_direction_register | 0x08; // [0001 1000], 0 = output disabled, 1 = output enabled |
|
601 | grgpio_regs->io_port_direction_register | 0x08; // [0001 1000], 0 = output disabled, 1 = output enabled | |
588 |
|
602 | |||
589 | if ( (grgpio_regs->io_port_output_register & 0x08) == 0x08 ) |
|
603 | if ( (grgpio_regs->io_port_output_register & 0x08) == 0x08 ) | |
590 | { |
|
604 | { | |
591 | grgpio_regs->io_port_output_register = grgpio_regs->io_port_output_register & 0xf7; |
|
605 | grgpio_regs->io_port_output_register = grgpio_regs->io_port_output_register & 0xf7; | |
592 | } |
|
606 | } | |
593 | else |
|
607 | else | |
594 | { |
|
608 | { | |
595 | grgpio_regs->io_port_output_register = grgpio_regs->io_port_output_register | 0x08; |
|
609 | grgpio_regs->io_port_output_register = grgpio_regs->io_port_output_register | 0x08; | |
596 | } |
|
610 | } | |
597 | } |
|
611 | } | |
598 |
|
612 | |||
599 | rtems_timer_service_routine user_routine( rtems_id timer_id, void *user_data ) |
|
613 | rtems_timer_service_routine user_routine( rtems_id timer_id, void *user_data ) | |
600 | { |
|
614 | { | |
601 | int linkStatus; |
|
615 | int linkStatus; | |
602 | rtems_status_code status; |
|
616 | rtems_status_code status; | |
603 |
|
617 | |||
604 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status |
|
618 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status | |
605 |
|
619 | |||
606 | if ( linkStatus == 5) { |
|
620 | if ( linkStatus == 5) { | |
607 | PRINTF("in spacewire_reset_link *** link is running\n") |
|
621 | PRINTF("in spacewire_reset_link *** link is running\n") | |
608 | status = RTEMS_SUCCESSFUL; |
|
622 | status = RTEMS_SUCCESSFUL; | |
609 | } |
|
623 | } | |
610 | } |
|
624 | } |
@@ -1,145 +1,115 | |||||
1 | /* |
|
1 | /* | |
2 | * CPU Usage Reporter |
|
2 | * CPU Usage Reporter | |
3 | * |
|
3 | * | |
4 | * COPYRIGHT (c) 1989-2009 |
|
4 | * COPYRIGHT (c) 1989-2009 | |
5 | * On-Line Applications Research Corporation (OAR). |
|
5 | * On-Line Applications Research Corporation (OAR). | |
6 | * |
|
6 | * | |
7 | * The license and distribution terms for this file may be |
|
7 | * The license and distribution terms for this file may be | |
8 | * found in the file LICENSE in this distribution or at |
|
8 | * found in the file LICENSE in this distribution or at | |
9 | * http://www.rtems.com/license/LICENSE. |
|
9 | * http://www.rtems.com/license/LICENSE. | |
10 | * |
|
10 | * | |
11 | * $Id$ |
|
11 | * $Id$ | |
12 | */ |
|
12 | */ | |
13 |
|
13 | |||
14 | #ifdef HAVE_CONFIG_H |
|
|||
15 | #include "config.h" |
|
|||
16 | #endif |
|
|||
17 |
|
||||
18 | #include <rtems.h> |
|
|||
19 |
|
||||
20 | #include <assert.h> |
|
|||
21 | #include <string.h> |
|
|||
22 | #include <stdlib.h> |
|
|||
23 | #include <stdio.h> |
|
|||
24 | #include <ctype.h> |
|
|||
25 | #include <inttypes.h> |
|
|||
26 |
|
||||
27 | #include <rtems/cpuuse.h> |
|
|||
28 | #include <rtems/bspIo.h> |
|
|||
29 |
|
||||
30 | #include "lfr_cpu_usage_report.h" |
|
14 | #include "lfr_cpu_usage_report.h" | |
31 |
|
15 | |||
32 | #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ |
|
|||
33 | #include <rtems/score/timestamp.h> |
|
|||
34 | #endif |
|
|||
35 |
|
||||
36 | #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ |
|
|||
37 | extern Timestamp_Control CPU_usage_Uptime_at_last_reset; |
|
|||
38 | #else |
|
|||
39 | extern uint32_t CPU_usage_Ticks_at_last_reset; |
|
|||
40 | #endif |
|
|||
41 |
|
||||
42 | /*PAGE |
|
|||
43 | * |
|
|||
44 | * rtems_cpu_usage_report |
|
|||
45 | */ |
|
|||
46 |
|
||||
47 | unsigned char lfr_rtems_cpu_usage_report( void ) |
|
16 | unsigned char lfr_rtems_cpu_usage_report( void ) | |
48 | { |
|
17 | { | |
49 | uint32_t api_index; |
|
18 | uint32_t api_index; | |
50 | Thread_Control *the_thread; |
|
19 | Thread_Control *the_thread; | |
51 | Objects_Information *information; |
|
20 | Objects_Information *information; | |
52 | uint32_t ival, fval; |
|
21 | uint32_t ival, fval; | |
53 | #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ |
|
22 | #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ | |
54 |
Timestamp_Control uptime |
|
23 | Timestamp_Control uptime; | |
|
24 | Timestamp_Control total; | |||
|
25 | Timestamp_Control ran; | |||
55 | #else |
|
26 | #else | |
56 | uint32_t total_units = 0; |
|
27 | uint32_t total_units = 0; | |
57 | #endif |
|
28 | #endif | |
58 |
|
29 | |||
59 | unsigned char cpu_load; |
|
30 | unsigned char cpu_load; | |
60 | cpu_load = 0; |
|
31 | cpu_load = 0; | |
61 |
|
32 | |||
62 | /* |
|
33 | /* | |
63 | * When not using nanosecond CPU usage resolution, we have to count |
|
34 | * When not using nanosecond CPU usage resolution, we have to count | |
64 | * the number of "ticks" we gave credit for to give the user a rough |
|
35 | * the number of "ticks" we gave credit for to give the user a rough | |
65 | * guideline as to what each number means proportionally. |
|
36 | * guideline as to what each number means proportionally. | |
66 | */ |
|
37 | */ | |
67 | #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ |
|
38 | #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ | |
68 | _TOD_Get_uptime( &uptime ); |
|
39 | _TOD_Get_uptime( &uptime ); | |
69 | _Timestamp_Subtract( &CPU_usage_Uptime_at_last_reset, &uptime, &total ); |
|
40 | _Timestamp_Subtract( &CPU_usage_Uptime_at_last_reset, &uptime, &total ); | |
70 | #else |
|
41 | #else | |
71 | for ( api_index = 1 ; api_index <= OBJECTS_APIS_LAST ; api_index++ ) { |
|
42 | for ( api_index = 1 ; api_index <= OBJECTS_APIS_LAST ; api_index++ ) { | |
72 | if ( !_Objects_Information_table[ api_index ] ) |
|
43 | if ( !_Objects_Information_table[ api_index ] ) { } | |
|
44 | else | |||
73 | { |
|
45 | { | |
74 | continue; |
|
46 | information = _Objects_Information_table[ api_index ][ 1 ]; | |
75 | } |
|
47 | if ( information != NULL ) | |
76 | information = _Objects_Information_table[ api_index ][ 1 ]; |
|
48 | { | |
77 | if ( information ) |
|
49 | for ( i=1 ; i <= information->maximum ; i++ ) { | |
78 | { |
|
50 | the_thread = (Thread_Control *)information->local_table[ i ]; | |
79 | for ( i=1 ; i <= information->maximum ; i++ ) { |
|
|||
80 | the_thread = (Thread_Control *)information->local_table[ i ]; |
|
|||
81 |
|
51 | |||
82 | if ( the_thread ) |
|
52 | if ( the_thread != NULL ) | |
83 | total_units += the_thread->cpu_time_used; |
|
53 | total_units += the_thread->cpu_time_used; | |
|
54 | } | |||
84 | } |
|
55 | } | |
85 | } |
|
56 | } | |
86 | } |
|
57 | } | |
87 | #endif |
|
58 | #endif | |
88 |
|
59 | |||
89 | for ( api_index = 1 ; api_index <= OBJECTS_APIS_LAST ; api_index++ ) |
|
60 | for ( api_index = 1 ; api_index <= OBJECTS_APIS_LAST ; api_index++ ) | |
90 | { |
|
61 | { | |
91 | if ( !_Objects_Information_table[ api_index ] ) |
|
62 | if ( !_Objects_Information_table[ api_index ] ) { } | |
92 |
|
|
63 | else | |
93 | continue; |
|
|||
94 | } |
|
|||
95 | information = _Objects_Information_table[ api_index ][ 1 ]; |
|
|||
96 | if ( information ) |
|
|||
97 | { |
|
64 | { | |
98 | the_thread = (Thread_Control *)information->local_table[ 1 ]; |
|
65 | information = _Objects_Information_table[ api_index ][ 1 ]; | |
99 |
|
66 | if ( information != NULL ) | ||
100 | if ( !the_thread ) |
|
|||
101 | { |
|
|||
102 | continue; |
|
|||
103 | } |
|
|||
104 |
|
||||
105 | #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ |
|
|||
106 | /* |
|
|||
107 | * If this is the currently executing thread, account for time |
|
|||
108 | * since the last context switch. |
|
|||
109 | */ |
|
|||
110 | ran = the_thread->cpu_time_used; |
|
|||
111 | if ( _Thread_Executing->Object.id == the_thread->Object.id ) |
|
|||
112 | { |
|
67 | { | |
113 | Timestamp_Control used; |
|
68 | the_thread = (Thread_Control *)information->local_table[ 1 ]; | |
114 | _Timestamp_Subtract( |
|
|||
115 | &_Thread_Time_of_last_context_switch, &uptime, &used |
|
|||
116 | ); |
|
|||
117 | _Timestamp_Add_to( &ran, &used ); |
|
|||
118 | } |
|
|||
119 | _Timestamp_Divide( &ran, &total, &ival, &fval ); |
|
|||
120 |
|
||||
121 | #else |
|
|||
122 | if (total_units) |
|
|||
123 | { |
|
|||
124 | uint64_t ival_64; |
|
|||
125 |
|
69 | |||
126 | ival_64 = the_thread->cpu_time_used; |
|
70 | if ( the_thread == NULL ) { } | |
127 |
|
|
71 | else | |
128 | ival = ival_64 / total_units; |
|
72 | { | |
|
73 | #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ | |||
|
74 | /* | |||
|
75 | * If this is the currently executing thread, account for time | |||
|
76 | * since the last context switch. | |||
|
77 | */ | |||
|
78 | ran = the_thread->cpu_time_used; | |||
|
79 | if ( _Thread_Executing->Object.id == the_thread->Object.id ) | |||
|
80 | { | |||
|
81 | Timestamp_Control used; | |||
|
82 | _Timestamp_Subtract( | |||
|
83 | &_Thread_Time_of_last_context_switch, &uptime, &used | |||
|
84 | ); | |||
|
85 | _Timestamp_Add_to( &ran, &used ); | |||
|
86 | } | |||
|
87 | _Timestamp_Divide( &ran, &total, &ival, &fval ); | |||
|
88 | ||||
|
89 | #else | |||
|
90 | if (total_units != 0) | |||
|
91 | { | |||
|
92 | uint64_t ival_64; | |||
|
93 | ||||
|
94 | ival_64 = the_thread->cpu_time_used; | |||
|
95 | ival_64 *= 100000; | |||
|
96 | ival = ival_64 / total_units; | |||
|
97 | } | |||
|
98 | else | |||
|
99 | { | |||
|
100 | ival = 0; | |||
|
101 | } | |||
|
102 | ||||
|
103 | fval = ival % 1000; | |||
|
104 | ival /= 1000; | |||
|
105 | #endif | |||
|
106 | } | |||
129 | } |
|
107 | } | |
130 | else |
|
|||
131 | { |
|
|||
132 | ival = 0; |
|
|||
133 | } |
|
|||
134 |
|
||||
135 | fval = ival % 1000; |
|
|||
136 | ival /= 1000; |
|
|||
137 | #endif |
|
|||
138 | } |
|
108 | } | |
139 | } |
|
109 | } | |
140 | cpu_load = (unsigned char) (100 - ival); |
|
110 | cpu_load = (unsigned char) (100 - ival); | |
141 |
|
111 | |||
142 | return cpu_load; |
|
112 | return cpu_load; | |
143 | } |
|
113 | } | |
144 |
|
114 | |||
145 |
|
115 |
@@ -1,253 +1,255 | |||||
1 | /** Functions related to data processing. |
|
1 | /** Functions related to data processing. | |
2 | * |
|
2 | * | |
3 | * @file |
|
3 | * @file | |
4 | * @author P. LEROY |
|
4 | * @author P. LEROY | |
5 | * |
|
5 | * | |
6 | * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation. |
|
6 | * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation. | |
7 | * |
|
7 | * | |
8 | */ |
|
8 | */ | |
9 |
|
9 | |||
10 | #include "avf2_prc2.h" |
|
10 | #include "avf2_prc2.h" | |
11 |
|
11 | |||
12 | nb_sm_before_bp_asm_f2 nb_sm_before_f2; |
|
12 | nb_sm_before_bp_asm_f2 nb_sm_before_f2; | |
13 |
|
13 | |||
14 | //*** |
|
14 | //*** | |
15 | // F2 |
|
15 | // F2 | |
16 | ring_node_asm asm_ring_norm_f2 [ NB_RING_NODES_ASM_NORM_F2 ]; |
|
16 | ring_node_asm asm_ring_norm_f2 [ NB_RING_NODES_ASM_NORM_F2 ]; | |
17 | ring_node_asm asm_ring_burst_sbm_f2[ NB_RING_NODES_ASM_BURST_SBM_F2 ]; |
|
17 | ring_node_asm asm_ring_burst_sbm_f2[ NB_RING_NODES_ASM_BURST_SBM_F2 ]; | |
18 |
|
18 | |||
19 | float asm_f2_reorganized [ TOTAL_SIZE_SM ]; |
|
19 | float asm_f2_reorganized [ TOTAL_SIZE_SM ]; | |
20 | char asm_f2_char [ TIME_OFFSET_IN_BYTES + (TOTAL_SIZE_SM * 2) ]; |
|
20 | char asm_f2_char [ TIME_OFFSET_IN_BYTES + (TOTAL_SIZE_SM * 2) ]; | |
21 | float compressed_sm_norm_f2[ TOTAL_SIZE_COMPRESSED_ASM_NORM_F2]; |
|
21 | float compressed_sm_norm_f2[ TOTAL_SIZE_COMPRESSED_ASM_NORM_F2]; | |
22 | float compressed_sm_sbm_f2 [ TOTAL_SIZE_COMPRESSED_ASM_SBM_F2 ]; |
|
22 | float compressed_sm_sbm_f2 [ TOTAL_SIZE_COMPRESSED_ASM_SBM_F2 ]; | |
23 |
|
23 | |||
24 | //************ |
|
24 | //************ | |
25 | // RTEMS TASKS |
|
25 | // RTEMS TASKS | |
26 |
|
26 | |||
27 | //*** |
|
27 | //*** | |
28 | // F2 |
|
28 | // F2 | |
29 | rtems_task avf2_task( rtems_task_argument argument ) |
|
29 | rtems_task avf2_task( rtems_task_argument argument ) | |
30 | { |
|
30 | { | |
31 | rtems_event_set event_out; |
|
31 | rtems_event_set event_out; | |
32 | rtems_status_code status; |
|
32 | rtems_status_code status; | |
33 | rtems_id queue_id_prc2; |
|
33 | rtems_id queue_id_prc2; | |
34 | asm_msg msgForMATR; |
|
34 | asm_msg msgForMATR; | |
35 | ring_node_asm *current_ring_node_asm_norm_f2; |
|
35 | ring_node_asm *current_ring_node_asm_norm_f2; | |
36 |
|
36 | |||
37 | unsigned int nb_norm_bp1; |
|
37 | unsigned int nb_norm_bp1; | |
38 | unsigned int nb_norm_bp2; |
|
38 | unsigned int nb_norm_bp2; | |
39 | unsigned int nb_norm_asm; |
|
39 | unsigned int nb_norm_asm; | |
40 |
|
40 | |||
41 | nb_norm_bp1 = 0; |
|
41 | nb_norm_bp1 = 0; | |
42 | nb_norm_bp2 = 0; |
|
42 | nb_norm_bp2 = 0; | |
43 | nb_norm_asm = 0; |
|
43 | nb_norm_asm = 0; | |
44 |
|
44 | |||
45 | reset_nb_sm_f2( ); // reset the sm counters that drive the BP and ASM computations / transmissions |
|
45 | reset_nb_sm_f2( ); // reset the sm counters that drive the BP and ASM computations / transmissions | |
46 | ASM_generic_init_ring( asm_ring_norm_f2, NB_RING_NODES_ASM_NORM_F2 ); |
|
46 | ASM_generic_init_ring( asm_ring_norm_f2, NB_RING_NODES_ASM_NORM_F2 ); | |
47 | current_ring_node_asm_norm_f2 = asm_ring_norm_f2; |
|
47 | current_ring_node_asm_norm_f2 = asm_ring_norm_f2; | |
48 |
|
48 | |||
49 | BOOT_PRINTF("in AVF2 ***\n") |
|
49 | BOOT_PRINTF("in AVF2 ***\n") | |
50 |
|
50 | |||
51 | status = get_message_queue_id_prc2( &queue_id_prc2 ); |
|
51 | status = get_message_queue_id_prc2( &queue_id_prc2 ); | |
52 | if (status != RTEMS_SUCCESSFUL) |
|
52 | if (status != RTEMS_SUCCESSFUL) | |
53 | { |
|
53 | { | |
54 | PRINTF1("in AVF2 *** ERR get_message_queue_id_prc2 %d\n", status) |
|
54 | PRINTF1("in AVF2 *** ERR get_message_queue_id_prc2 %d\n", status) | |
55 | } |
|
55 | } | |
56 |
|
56 | |||
57 | while(1){ |
|
57 | while(1){ | |
58 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
58 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 | |
59 |
|
59 | |||
60 | //**************************************** |
|
60 | //**************************************** | |
61 | // initialize the mesage for the MATR task |
|
61 | // initialize the mesage for the MATR task | |
62 | msgForMATR.event = 0x00; // this composite event will be sent to the MATR task |
|
62 | msgForMATR.event = 0x00; // this composite event will be sent to the MATR task | |
63 | msgForMATR.burst_sbm = NULL; |
|
63 | msgForMATR.burst_sbm = NULL; | |
64 | msgForMATR.norm = current_ring_node_asm_norm_f2; |
|
64 | msgForMATR.norm = current_ring_node_asm_norm_f2; | |
65 | msgForMATR.coarseTime = ring_node_for_averaging_sm_f2->coarseTime; |
|
65 | msgForMATR.coarseTime = ring_node_for_averaging_sm_f2->coarseTime; | |
66 | msgForMATR.fineTime = ring_node_for_averaging_sm_f2->fineTime; |
|
66 | msgForMATR.fineTime = ring_node_for_averaging_sm_f2->fineTime; | |
67 | // |
|
67 | // | |
68 | //**************************************** |
|
68 | //**************************************** | |
69 |
|
69 | |||
70 | // compute the average and store it in the averaged_sm_f2 buffer |
|
70 | // compute the average and store it in the averaged_sm_f2 buffer | |
71 | SM_average_f2( current_ring_node_asm_norm_f2->matrix, |
|
71 | SM_average_f2( current_ring_node_asm_norm_f2->matrix, | |
72 | ring_node_for_averaging_sm_f2, |
|
72 | ring_node_for_averaging_sm_f2, | |
73 | nb_norm_bp1 ); |
|
73 | nb_norm_bp1 ); | |
74 |
|
74 | |||
75 | // update nb_average |
|
75 | // update nb_average | |
76 | nb_norm_bp1 = nb_norm_bp1 + NB_SM_BEFORE_AVF2; |
|
76 | nb_norm_bp1 = nb_norm_bp1 + NB_SM_BEFORE_AVF2; | |
77 | nb_norm_bp2 = nb_norm_bp2 + NB_SM_BEFORE_AVF2; |
|
77 | nb_norm_bp2 = nb_norm_bp2 + NB_SM_BEFORE_AVF2; | |
78 | nb_norm_asm = nb_norm_asm + NB_SM_BEFORE_AVF2; |
|
78 | nb_norm_asm = nb_norm_asm + NB_SM_BEFORE_AVF2; | |
79 |
|
79 | |||
80 | if (nb_norm_bp1 == nb_sm_before_f2.norm_bp1) |
|
80 | if (nb_norm_bp1 == nb_sm_before_f2.norm_bp1) | |
81 | { |
|
81 | { | |
82 | nb_norm_bp1 = 0; |
|
82 | nb_norm_bp1 = 0; | |
83 | // set another ring for the ASM storage |
|
83 | // set another ring for the ASM storage | |
84 | current_ring_node_asm_norm_f2 = current_ring_node_asm_norm_f2->next; |
|
84 | current_ring_node_asm_norm_f2 = current_ring_node_asm_norm_f2->next; | |
85 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) || (lfrCurrentMode == LFR_MODE_SBM1) |
|
85 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) || (lfrCurrentMode == LFR_MODE_SBM1) | |
86 | || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
86 | || (lfrCurrentMode == LFR_MODE_SBM2) ) | |
87 | { |
|
87 | { | |
88 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP1_F2; |
|
88 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP1_F2; | |
89 | } |
|
89 | } | |
90 | } |
|
90 | } | |
91 |
|
91 | |||
92 | if (nb_norm_bp2 == nb_sm_before_f2.norm_bp2) |
|
92 | if (nb_norm_bp2 == nb_sm_before_f2.norm_bp2) | |
93 | { |
|
93 | { | |
94 | nb_norm_bp2 = 0; |
|
94 | nb_norm_bp2 = 0; | |
95 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) || (lfrCurrentMode == LFR_MODE_SBM1) |
|
95 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) || (lfrCurrentMode == LFR_MODE_SBM1) | |
96 | || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
96 | || (lfrCurrentMode == LFR_MODE_SBM2) ) | |
97 | { |
|
97 | { | |
98 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP2_F2; |
|
98 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP2_F2; | |
99 | } |
|
99 | } | |
100 | } |
|
100 | } | |
101 |
|
101 | |||
102 | if (nb_norm_asm == nb_sm_before_f2.norm_asm) |
|
102 | if (nb_norm_asm == nb_sm_before_f2.norm_asm) | |
103 | { |
|
103 | { | |
104 | nb_norm_asm = 0; |
|
104 | nb_norm_asm = 0; | |
105 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) || (lfrCurrentMode == LFR_MODE_SBM1) |
|
105 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) || (lfrCurrentMode == LFR_MODE_SBM1) | |
106 | || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
106 | || (lfrCurrentMode == LFR_MODE_SBM2) ) | |
107 | { |
|
107 | { | |
108 | // PRINTF1("%lld\n", localTime) |
|
108 | // PRINTF1("%lld\n", localTime) | |
109 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_ASM_F2; |
|
109 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_ASM_F2; | |
110 | } |
|
110 | } | |
111 | } |
|
111 | } | |
112 |
|
112 | |||
113 | //************************* |
|
113 | //************************* | |
114 | // send the message to MATR |
|
114 | // send the message to MATR | |
115 | if (msgForMATR.event != 0x00) |
|
115 | if (msgForMATR.event != 0x00) | |
116 | { |
|
116 | { | |
117 | status = rtems_message_queue_send( queue_id_prc2, (char *) &msgForMATR, MSG_QUEUE_SIZE_PRC0); |
|
117 | status = rtems_message_queue_send( queue_id_prc2, (char *) &msgForMATR, MSG_QUEUE_SIZE_PRC0); | |
118 | } |
|
118 | } | |
119 |
|
119 | |||
120 | if (status != RTEMS_SUCCESSFUL) { |
|
120 | if (status != RTEMS_SUCCESSFUL) { | |
121 | printf("in AVF2 *** Error sending message to MATR, code %d\n", status); |
|
121 | printf("in AVF2 *** Error sending message to MATR, code %d\n", status); | |
122 | } |
|
122 | } | |
123 | } |
|
123 | } | |
124 | } |
|
124 | } | |
125 |
|
125 | |||
126 | rtems_task prc2_task( rtems_task_argument argument ) |
|
126 | rtems_task prc2_task( rtems_task_argument argument ) | |
127 | { |
|
127 | { | |
128 | char incomingData[MSG_QUEUE_SIZE_SEND]; // incoming data buffer |
|
128 | char incomingData[MSG_QUEUE_SIZE_SEND]; // incoming data buffer | |
129 | size_t size; // size of the incoming TC packet |
|
129 | size_t size; // size of the incoming TC packet | |
130 | asm_msg *incomingMsg; |
|
130 | asm_msg *incomingMsg; | |
131 | // |
|
131 | // | |
132 | spw_ioctl_pkt_send spw_ioctl_send_ASM; |
|
132 | spw_ioctl_pkt_send spw_ioctl_send_ASM; | |
133 | rtems_status_code status; |
|
133 | rtems_status_code status; | |
134 | rtems_id queue_id; |
|
134 | rtems_id queue_id; | |
135 | rtems_id queue_id_q_p2; |
|
135 | rtems_id queue_id_q_p2; | |
136 | Header_TM_LFR_SCIENCE_ASM_t headerASM; |
|
136 | Header_TM_LFR_SCIENCE_ASM_t headerASM; | |
137 | bp_packet packet_norm_bp1_f2; |
|
137 | bp_packet packet_norm_bp1_f2; | |
138 | bp_packet packet_norm_bp2_f2; |
|
138 | bp_packet packet_norm_bp2_f2; | |
139 |
|
139 | |||
140 | unsigned long long int localTime; |
|
140 | unsigned long long int localTime; | |
141 |
|
141 | |||
|
142 | incomingMsg = NULL; | |||
|
143 | ||||
142 | ASM_init_header( &headerASM ); |
|
144 | ASM_init_header( &headerASM ); | |
143 |
|
145 | |||
144 | //************* |
|
146 | //************* | |
145 | // NORM headers |
|
147 | // NORM headers | |
146 | BP_init_header( &packet_norm_bp1_f2.header, |
|
148 | BP_init_header( &packet_norm_bp1_f2.header, | |
147 | APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F2, |
|
149 | APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F2, | |
148 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F2, NB_BINS_COMPRESSED_SM_F2 ); |
|
150 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F2, NB_BINS_COMPRESSED_SM_F2 ); | |
149 | BP_init_header( &packet_norm_bp2_f2.header, |
|
151 | BP_init_header( &packet_norm_bp2_f2.header, | |
150 | APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP2_F2, |
|
152 | APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP2_F2, | |
151 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F2, NB_BINS_COMPRESSED_SM_F2 ); |
|
153 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F2, NB_BINS_COMPRESSED_SM_F2 ); | |
152 |
|
154 | |||
153 | status = get_message_queue_id_send( &queue_id ); |
|
155 | status = get_message_queue_id_send( &queue_id ); | |
154 | if (status != RTEMS_SUCCESSFUL) |
|
156 | if (status != RTEMS_SUCCESSFUL) | |
155 | { |
|
157 | { | |
156 | PRINTF1("in PRC2 *** ERR get_message_queue_id_send %d\n", status) |
|
158 | PRINTF1("in PRC2 *** ERR get_message_queue_id_send %d\n", status) | |
157 | } |
|
159 | } | |
158 | status = get_message_queue_id_prc2( &queue_id_q_p2); |
|
160 | status = get_message_queue_id_prc2( &queue_id_q_p2); | |
159 | if (status != RTEMS_SUCCESSFUL) |
|
161 | if (status != RTEMS_SUCCESSFUL) | |
160 | { |
|
162 | { | |
161 | PRINTF1("in PRC2 *** ERR get_message_queue_id_prc2 %d\n", status) |
|
163 | PRINTF1("in PRC2 *** ERR get_message_queue_id_prc2 %d\n", status) | |
162 | } |
|
164 | } | |
163 |
|
165 | |||
164 | BOOT_PRINTF("in PRC2 ***\n") |
|
166 | BOOT_PRINTF("in PRC2 ***\n") | |
165 |
|
167 | |||
166 | while(1){ |
|
168 | while(1){ | |
167 | status = rtems_message_queue_receive( queue_id_q_p2, incomingData, &size, //************************************ |
|
169 | status = rtems_message_queue_receive( queue_id_q_p2, incomingData, &size, //************************************ | |
168 | RTEMS_WAIT, RTEMS_NO_TIMEOUT ); // wait for a message coming from AVF0 |
|
170 | RTEMS_WAIT, RTEMS_NO_TIMEOUT ); // wait for a message coming from AVF0 | |
169 |
|
171 | |||
170 | incomingMsg = (asm_msg*) incomingData; |
|
172 | incomingMsg = (asm_msg*) incomingData; | |
171 |
|
173 | |||
172 | localTime = getTimeAsUnsignedLongLongInt( ); |
|
174 | localTime = getTimeAsUnsignedLongLongInt( ); | |
173 |
|
175 | |||
174 | //***** |
|
176 | //***** | |
175 | //***** |
|
177 | //***** | |
176 | // NORM |
|
178 | // NORM | |
177 | //***** |
|
179 | //***** | |
178 | //***** |
|
180 | //***** | |
179 | if (incomingMsg->event & RTEMS_EVENT_NORM_BP1_F2) |
|
181 | if (incomingMsg->event & RTEMS_EVENT_NORM_BP1_F2) | |
180 | { |
|
182 | { | |
181 | // 1) compress the matrix for Basic Parameters calculation |
|
183 | // 1) compress the matrix for Basic Parameters calculation | |
182 | ASM_compress_reorganize_and_divide( incomingMsg->norm->matrix, compressed_sm_norm_f2, |
|
184 | ASM_compress_reorganize_and_divide( incomingMsg->norm->matrix, compressed_sm_norm_f2, | |
183 | nb_sm_before_f2.norm_bp1, |
|
185 | nb_sm_before_f2.norm_bp1, | |
184 | NB_BINS_COMPRESSED_SM_F2, NB_BINS_TO_AVERAGE_ASM_F2, |
|
186 | NB_BINS_COMPRESSED_SM_F2, NB_BINS_TO_AVERAGE_ASM_F2, | |
185 | ASM_F2_INDICE_START ); |
|
187 | ASM_F2_INDICE_START ); | |
186 | // 2) compute the BP1 set |
|
188 | // 2) compute the BP1 set | |
187 |
|
189 | |||
188 | // 3) send the BP1 set |
|
190 | // 3) send the BP1 set | |
189 | set_time( packet_norm_bp1_f2.header.time, (unsigned char *) &incomingMsg->coarseTime ); |
|
191 | set_time( packet_norm_bp1_f2.header.time, (unsigned char *) &incomingMsg->coarseTime ); | |
190 | set_time( packet_norm_bp1_f2.header.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime ); |
|
192 | set_time( packet_norm_bp1_f2.header.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime ); | |
191 | BP_send( (char *) &packet_norm_bp1_f2, queue_id, |
|
193 | BP_send( (char *) &packet_norm_bp1_f2, queue_id, | |
192 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F2 + PACKET_LENGTH_DELTA, |
|
194 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F2 + PACKET_LENGTH_DELTA, | |
193 | SID_NORM_BP1_F2 ); |
|
195 | SID_NORM_BP1_F2 ); | |
194 | if (incomingMsg->event & RTEMS_EVENT_NORM_BP2_F2) |
|
196 | if (incomingMsg->event & RTEMS_EVENT_NORM_BP2_F2) | |
195 | { |
|
197 | { | |
196 | // 1) compute the BP2 set using the same ASM as the one used for BP1 |
|
198 | // 1) compute the BP2 set using the same ASM as the one used for BP1 | |
197 |
|
199 | |||
198 | // 2) send the BP2 set |
|
200 | // 2) send the BP2 set | |
199 | set_time( packet_norm_bp2_f2.header.time, (unsigned char *) &incomingMsg->coarseTime ); |
|
201 | set_time( packet_norm_bp2_f2.header.time, (unsigned char *) &incomingMsg->coarseTime ); | |
200 | set_time( packet_norm_bp2_f2.header.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime ); |
|
202 | set_time( packet_norm_bp2_f2.header.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime ); | |
201 | BP_send( (char *) &packet_norm_bp2_f2, queue_id, |
|
203 | BP_send( (char *) &packet_norm_bp2_f2, queue_id, | |
202 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F2 + PACKET_LENGTH_DELTA, |
|
204 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F2 + PACKET_LENGTH_DELTA, | |
203 | SID_NORM_BP2_F2 ); |
|
205 | SID_NORM_BP2_F2 ); | |
204 | } |
|
206 | } | |
205 | } |
|
207 | } | |
206 |
|
208 | |||
207 | if (incomingMsg->event & RTEMS_EVENT_NORM_ASM_F2) |
|
209 | if (incomingMsg->event & RTEMS_EVENT_NORM_ASM_F2) | |
208 | { |
|
210 | { | |
209 | // 1) reorganize the ASM and divide |
|
211 | // 1) reorganize the ASM and divide | |
210 | ASM_reorganize_and_divide( incomingMsg->norm->matrix, |
|
212 | ASM_reorganize_and_divide( incomingMsg->norm->matrix, | |
211 | asm_f2_reorganized, |
|
213 | asm_f2_reorganized, | |
212 | nb_sm_before_f2.norm_bp1 ); |
|
214 | nb_sm_before_f2.norm_bp1 ); | |
213 | // 2) convert the float array in a char array |
|
215 | // 2) convert the float array in a char array | |
214 | ASM_convert( asm_f2_reorganized, asm_f2_char); |
|
216 | ASM_convert( asm_f2_reorganized, asm_f2_char); | |
215 | // 3) send the spectral matrix packets |
|
217 | // 3) send the spectral matrix packets | |
216 | set_time( headerASM.time , (unsigned char *) &incomingMsg->coarseTime ); |
|
218 | set_time( headerASM.time , (unsigned char *) &incomingMsg->coarseTime ); | |
217 | set_time( headerASM.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime ); |
|
219 | set_time( headerASM.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime ); | |
218 | ASM_send( &headerASM, asm_f2_char, SID_NORM_ASM_F2, &spw_ioctl_send_ASM, queue_id); |
|
220 | ASM_send( &headerASM, asm_f2_char, SID_NORM_ASM_F2, &spw_ioctl_send_ASM, queue_id); | |
219 | } |
|
221 | } | |
220 |
|
222 | |||
221 | } |
|
223 | } | |
222 | } |
|
224 | } | |
223 |
|
225 | |||
224 | //********** |
|
226 | //********** | |
225 | // FUNCTIONS |
|
227 | // FUNCTIONS | |
226 |
|
228 | |||
227 | void reset_nb_sm_f2( void ) |
|
229 | void reset_nb_sm_f2( void ) | |
228 | { |
|
230 | { | |
229 | nb_sm_before_f2.norm_bp1 = parameter_dump_packet.sy_lfr_n_bp_p0; |
|
231 | nb_sm_before_f2.norm_bp1 = parameter_dump_packet.sy_lfr_n_bp_p0; | |
230 | nb_sm_before_f2.norm_bp2 = parameter_dump_packet.sy_lfr_n_bp_p1; |
|
232 | nb_sm_before_f2.norm_bp2 = parameter_dump_packet.sy_lfr_n_bp_p1; | |
231 | nb_sm_before_f2.norm_asm = parameter_dump_packet.sy_lfr_n_asm_p[0] * 256 + parameter_dump_packet.sy_lfr_n_asm_p[1]; |
|
233 | nb_sm_before_f2.norm_asm = parameter_dump_packet.sy_lfr_n_asm_p[0] * 256 + parameter_dump_packet.sy_lfr_n_asm_p[1]; | |
232 | } |
|
234 | } | |
233 |
|
235 | |||
234 | void SM_average_f2( float *averaged_spec_mat_f2, |
|
236 | void SM_average_f2( float *averaged_spec_mat_f2, | |
235 | ring_node_sm *ring_node, |
|
237 | ring_node_sm *ring_node, | |
236 | unsigned int nbAverageNormF2 ) |
|
238 | unsigned int nbAverageNormF2 ) | |
237 | { |
|
239 | { | |
238 | float sum; |
|
240 | float sum; | |
239 | unsigned int i; |
|
241 | unsigned int i; | |
240 |
|
242 | |||
241 | for(i=0; i<TOTAL_SIZE_SM; i++) |
|
243 | for(i=0; i<TOTAL_SIZE_SM; i++) | |
242 | { |
|
244 | { | |
243 | sum = ( (int *) (ring_node->buffer_address) ) [ i ]; |
|
245 | sum = ( (int *) (ring_node->buffer_address) ) [ i ]; | |
244 | if ( (nbAverageNormF2 == 0) ) |
|
246 | if ( (nbAverageNormF2 == 0) ) | |
245 | { |
|
247 | { | |
246 | averaged_spec_mat_f2[ i ] = sum; |
|
248 | averaged_spec_mat_f2[ i ] = sum; | |
247 | } |
|
249 | } | |
248 | else |
|
250 | else | |
249 | { |
|
251 | { | |
250 | averaged_spec_mat_f2[ i ] = ( averaged_spec_mat_f2[ i ] + sum ); |
|
252 | averaged_spec_mat_f2[ i ] = ( averaged_spec_mat_f2[ i ] + sum ); | |
251 | } |
|
253 | } | |
252 | } |
|
254 | } | |
253 | } |
|
255 | } |
@@ -1,689 +1,696 | |||||
1 | /** Functions related to data processing. |
|
1 | /** Functions related to data processing. | |
2 | * |
|
2 | * | |
3 | * @file |
|
3 | * @file | |
4 | * @author P. LEROY |
|
4 | * @author P. LEROY | |
5 | * |
|
5 | * | |
6 | * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation. |
|
6 | * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation. | |
7 | * |
|
7 | * | |
8 | */ |
|
8 | */ | |
9 |
|
9 | |||
10 | #include "fsw_processing.h" |
|
10 | #include "fsw_processing.h" | |
11 | #include "fsw_processing_globals.c" |
|
11 | #include "fsw_processing_globals.c" | |
12 |
|
12 | |||
13 | unsigned int nb_sm_f0; |
|
13 | unsigned int nb_sm_f0; | |
14 | unsigned int nb_sm_f0_aux_f1; |
|
14 | unsigned int nb_sm_f0_aux_f1; | |
15 | unsigned int nb_sm_f1; |
|
15 | unsigned int nb_sm_f1; | |
16 | unsigned int nb_sm_f0_aux_f2; |
|
16 | unsigned int nb_sm_f0_aux_f2; | |
17 |
|
17 | |||
18 | //************************ |
|
18 | //************************ | |
19 | // spectral matrices rings |
|
19 | // spectral matrices rings | |
20 | ring_node_sm sm_ring_f0[ NB_RING_NODES_SM_F0 ]; |
|
20 | ring_node_sm sm_ring_f0[ NB_RING_NODES_SM_F0 ]; | |
21 | ring_node_sm sm_ring_f1[ NB_RING_NODES_SM_F1 ]; |
|
21 | ring_node_sm sm_ring_f1[ NB_RING_NODES_SM_F1 ]; | |
22 | ring_node_sm sm_ring_f2[ NB_RING_NODES_SM_F2 ]; |
|
22 | ring_node_sm sm_ring_f2[ NB_RING_NODES_SM_F2 ]; | |
23 | ring_node_sm *current_ring_node_sm_f0; |
|
23 | ring_node_sm *current_ring_node_sm_f0; | |
24 | ring_node_sm *current_ring_node_sm_f1; |
|
24 | ring_node_sm *current_ring_node_sm_f1; | |
25 | ring_node_sm *current_ring_node_sm_f2; |
|
25 | ring_node_sm *current_ring_node_sm_f2; | |
26 | ring_node_sm *ring_node_for_averaging_sm_f0; |
|
26 | ring_node_sm *ring_node_for_averaging_sm_f0; | |
27 | ring_node_sm *ring_node_for_averaging_sm_f1; |
|
27 | ring_node_sm *ring_node_for_averaging_sm_f1; | |
28 | ring_node_sm *ring_node_for_averaging_sm_f2; |
|
28 | ring_node_sm *ring_node_for_averaging_sm_f2; | |
29 |
|
29 | |||
30 | //*********************************************************** |
|
30 | //*********************************************************** | |
31 | // Interrupt Service Routine for spectral matrices processing |
|
31 | // Interrupt Service Routine for spectral matrices processing | |
32 |
|
32 | |||
33 | void spectral_matrices_isr_f0( void ) |
|
33 | void spectral_matrices_isr_f0( void ) | |
34 | { |
|
34 | { | |
35 | unsigned char status; |
|
35 | unsigned char status; | |
36 | unsigned long long int time_0; |
|
36 | unsigned long long int time_0; | |
37 | unsigned long long int time_1; |
|
37 | unsigned long long int time_1; | |
38 | unsigned long long int syncBit0; |
|
38 | unsigned long long int syncBit0; | |
39 | unsigned long long int syncBit1; |
|
39 | unsigned long long int syncBit1; | |
40 |
|
40 | |||
41 | status = spectral_matrix_regs->status & 0x03; // [0011] get the status_ready_matrix_f0_x bits |
|
41 | status = spectral_matrix_regs->status & 0x03; // [0011] get the status_ready_matrix_f0_x bits | |
42 |
|
42 | |||
43 | time_0 = get_acquisition_time( (unsigned char *) &spectral_matrix_regs->f0_0_coarse_time ); |
|
43 | time_0 = get_acquisition_time( (unsigned char *) &spectral_matrix_regs->f0_0_coarse_time ); | |
44 | time_1 = get_acquisition_time( (unsigned char *) &spectral_matrix_regs->f0_1_coarse_time ); |
|
44 | time_1 = get_acquisition_time( (unsigned char *) &spectral_matrix_regs->f0_1_coarse_time ); | |
45 | syncBit0 = ( (unsigned long long int) (spectral_matrix_regs->f0_0_coarse_time & 0x80000000) ) << 16; |
|
45 | syncBit0 = ( (unsigned long long int) (spectral_matrix_regs->f0_0_coarse_time & 0x80000000) ) << 16; | |
46 | syncBit1 = ( (unsigned long long int) (spectral_matrix_regs->f0_1_coarse_time & 0x80000000) ) << 16; |
|
46 | syncBit1 = ( (unsigned long long int) (spectral_matrix_regs->f0_1_coarse_time & 0x80000000) ) << 16; | |
47 |
|
47 | |||
48 | switch(status) |
|
48 | switch(status) | |
49 | { |
|
49 | { | |
50 | case 0: |
|
50 | case 0: | |
51 | break; |
|
51 | break; | |
52 | case 3: |
|
52 | case 3: | |
53 | if ( time_0 < time_1 ) |
|
53 | if ( time_0 < time_1 ) | |
54 | { |
|
54 | { | |
55 | close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], |
|
55 | close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], | |
56 | ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_0 | syncBit0); |
|
56 | ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_0 | syncBit0); | |
57 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; |
|
57 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; | |
58 | spectral_matrix_regs->f0_0_address = current_ring_node_sm_f0->buffer_address; |
|
58 | spectral_matrix_regs->f0_0_address = current_ring_node_sm_f0->buffer_address; | |
59 | close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], |
|
59 | close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], | |
60 | ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_1 | syncBit1); |
|
60 | ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_1 | syncBit1); | |
61 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; |
|
61 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; | |
62 | spectral_matrix_regs->f0_1_address = current_ring_node_sm_f0->buffer_address; |
|
62 | spectral_matrix_regs->f0_1_address = current_ring_node_sm_f0->buffer_address; | |
63 | } |
|
63 | } | |
64 | else |
|
64 | else | |
65 | { |
|
65 | { | |
66 | close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], |
|
66 | close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], | |
67 | ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_1 | syncBit1); |
|
67 | ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_1 | syncBit1); | |
68 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; |
|
68 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; | |
69 | spectral_matrix_regs->f0_1_address = current_ring_node_sm_f0->buffer_address; |
|
69 | spectral_matrix_regs->f0_1_address = current_ring_node_sm_f0->buffer_address; | |
70 | close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], |
|
70 | close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], | |
71 | ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_0 | syncBit0); |
|
71 | ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_0 | syncBit0); | |
72 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; |
|
72 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; | |
73 | spectral_matrix_regs->f0_0_address = current_ring_node_sm_f0->buffer_address; |
|
73 | spectral_matrix_regs->f0_0_address = current_ring_node_sm_f0->buffer_address; | |
74 | } |
|
74 | } | |
75 | spectral_matrix_regs->status = 0x03; // [0011] |
|
75 | spectral_matrix_regs->status = 0x03; // [0011] | |
76 | break; |
|
76 | break; | |
77 | case 1: |
|
77 | case 1: | |
78 | close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], |
|
78 | close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], | |
79 | ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_0 | syncBit0); |
|
79 | ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_0 | syncBit0); | |
80 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; |
|
80 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; | |
81 | spectral_matrix_regs->f0_0_address = current_ring_node_sm_f0->buffer_address; |
|
81 | spectral_matrix_regs->f0_0_address = current_ring_node_sm_f0->buffer_address; | |
82 | spectral_matrix_regs->status = 0x01; // [0001] |
|
82 | spectral_matrix_regs->status = 0x01; // [0001] | |
83 | break; |
|
83 | break; | |
84 | case 2: |
|
84 | case 2: | |
85 | close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], |
|
85 | close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], | |
86 | ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_1 | syncBit1); |
|
86 | ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_1 | syncBit1); | |
87 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; |
|
87 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; | |
88 | spectral_matrix_regs->f0_1_address = current_ring_node_sm_f0->buffer_address; |
|
88 | spectral_matrix_regs->f0_1_address = current_ring_node_sm_f0->buffer_address; | |
89 | spectral_matrix_regs->status = 0x02; // [0010] |
|
89 | spectral_matrix_regs->status = 0x02; // [0010] | |
90 | break; |
|
90 | break; | |
91 | } |
|
91 | } | |
92 | } |
|
92 | } | |
93 |
|
93 | |||
94 | void spectral_matrices_isr_f1( void ) |
|
94 | void spectral_matrices_isr_f1( void ) | |
95 | { |
|
95 | { | |
96 | unsigned char status; |
|
96 | unsigned char status; | |
97 | unsigned long long int time; |
|
97 | unsigned long long int time; | |
98 | unsigned long long int syncBit; |
|
98 | unsigned long long int syncBit; | |
|
99 | rtems_status_code status_code; | |||
99 |
|
100 | |||
100 | status = (spectral_matrix_regs->status & 0x0c) >> 2; // [1100] get the status_ready_matrix_f0_x bits |
|
101 | status = (spectral_matrix_regs->status & 0x0c) >> 2; // [1100] get the status_ready_matrix_f0_x bits | |
101 |
|
102 | |||
102 | switch(status) |
|
103 | switch(status) | |
103 | { |
|
104 | { | |
104 | case 0: |
|
105 | case 0: | |
105 | break; |
|
106 | break; | |
106 | case 3: |
|
107 | case 3: | |
107 | // UNEXPECTED VALUE |
|
108 | // UNEXPECTED VALUE | |
108 | spectral_matrix_regs->status = 0xc0; // [1100] |
|
109 | spectral_matrix_regs->status = 0xc0; // [1100] | |
109 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_11 ); |
|
110 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_11 ); | |
110 | break; |
|
111 | break; | |
111 | case 1: |
|
112 | case 1: | |
112 | time = get_acquisition_time( (unsigned char *) &spectral_matrix_regs->f1_0_coarse_time ); |
|
113 | time = get_acquisition_time( (unsigned char *) &spectral_matrix_regs->f1_0_coarse_time ); | |
113 | syncBit = ( (unsigned long long int) (spectral_matrix_regs->f1_0_coarse_time & 0x80000000) ) << 16; |
|
114 | syncBit = ( (unsigned long long int) (spectral_matrix_regs->f1_0_coarse_time & 0x80000000) ) << 16; | |
114 | close_matrix_actions( &nb_sm_f1, NB_SM_BEFORE_AVF1, Task_id[TASKID_AVF1], |
|
115 | close_matrix_actions( &nb_sm_f1, NB_SM_BEFORE_AVF1, Task_id[TASKID_AVF1], | |
115 | ring_node_for_averaging_sm_f1, current_ring_node_sm_f1, time | syncBit); |
|
116 | ring_node_for_averaging_sm_f1, current_ring_node_sm_f1, time | syncBit); | |
116 | current_ring_node_sm_f1 = current_ring_node_sm_f1->next; |
|
117 | current_ring_node_sm_f1 = current_ring_node_sm_f1->next; | |
117 | spectral_matrix_regs->f1_0_address = current_ring_node_sm_f1->buffer_address; |
|
118 | spectral_matrix_regs->f1_0_address = current_ring_node_sm_f1->buffer_address; | |
118 | spectral_matrix_regs->status = 0x04; // [0100] |
|
119 | spectral_matrix_regs->status = 0x04; // [0100] | |
119 | break; |
|
120 | break; | |
120 | case 2: |
|
121 | case 2: | |
121 | time = get_acquisition_time( (unsigned char *) &spectral_matrix_regs->f1_1_coarse_time ); |
|
122 | time = get_acquisition_time( (unsigned char *) &spectral_matrix_regs->f1_1_coarse_time ); | |
122 | syncBit = ( (unsigned long long int) (spectral_matrix_regs->f1_1_coarse_time & 0x80000000) ) << 16; |
|
123 | syncBit = ( (unsigned long long int) (spectral_matrix_regs->f1_1_coarse_time & 0x80000000) ) << 16; | |
123 | close_matrix_actions( &nb_sm_f1, NB_SM_BEFORE_AVF1, Task_id[TASKID_AVF1], |
|
124 | close_matrix_actions( &nb_sm_f1, NB_SM_BEFORE_AVF1, Task_id[TASKID_AVF1], | |
124 | ring_node_for_averaging_sm_f1, current_ring_node_sm_f1, time | syncBit); |
|
125 | ring_node_for_averaging_sm_f1, current_ring_node_sm_f1, time | syncBit); | |
125 | current_ring_node_sm_f1 = current_ring_node_sm_f1->next; |
|
126 | current_ring_node_sm_f1 = current_ring_node_sm_f1->next; | |
126 | spectral_matrix_regs->f1_1_address = current_ring_node_sm_f1->buffer_address; |
|
127 | spectral_matrix_regs->f1_1_address = current_ring_node_sm_f1->buffer_address; | |
127 | spectral_matrix_regs->status = 0x08; // [1000] |
|
128 | spectral_matrix_regs->status = 0x08; // [1000] | |
128 | break; |
|
129 | break; | |
129 | } |
|
130 | } | |
130 | } |
|
131 | } | |
131 |
|
132 | |||
132 | void spectral_matrices_isr_f2( void ) |
|
133 | void spectral_matrices_isr_f2( void ) | |
133 | { |
|
134 | { | |
134 | unsigned char status; |
|
135 | unsigned char status; | |
|
136 | rtems_status_code status_code; | |||
135 |
|
137 | |||
136 | status = (spectral_matrix_regs->status & 0x30) >> 4; // [0011 0000] get the status_ready_matrix_f0_x bits |
|
138 | status = (spectral_matrix_regs->status & 0x30) >> 4; // [0011 0000] get the status_ready_matrix_f0_x bits | |
137 |
|
139 | |||
138 | ring_node_for_averaging_sm_f2 = current_ring_node_sm_f2; |
|
140 | ring_node_for_averaging_sm_f2 = current_ring_node_sm_f2; | |
139 |
|
141 | |||
140 | current_ring_node_sm_f2 = current_ring_node_sm_f2->next; |
|
142 | current_ring_node_sm_f2 = current_ring_node_sm_f2->next; | |
141 |
|
143 | |||
142 | switch(status) |
|
144 | switch(status) | |
143 | { |
|
145 | { | |
144 | case 0: |
|
146 | case 0: | |
145 | break; |
|
147 | break; | |
146 | case 3: |
|
148 | case 3: | |
147 | // UNEXPECTED VALUE |
|
149 | // UNEXPECTED VALUE | |
148 | spectral_matrix_regs->status = 0x30; // [0011 0000] |
|
150 | spectral_matrix_regs->status = 0x30; // [0011 0000] | |
149 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_11 ); |
|
151 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_11 ); | |
150 | break; |
|
152 | break; | |
151 | case 1: |
|
153 | case 1: | |
152 | ring_node_for_averaging_sm_f2->coarseTime = spectral_matrix_regs->f2_0_coarse_time; |
|
154 | ring_node_for_averaging_sm_f2->coarseTime = spectral_matrix_regs->f2_0_coarse_time; | |
153 | ring_node_for_averaging_sm_f2->fineTime = spectral_matrix_regs->f2_0_fine_time; |
|
155 | ring_node_for_averaging_sm_f2->fineTime = spectral_matrix_regs->f2_0_fine_time; | |
154 | spectral_matrix_regs->f2_0_address = current_ring_node_sm_f2->buffer_address; |
|
156 | spectral_matrix_regs->f2_0_address = current_ring_node_sm_f2->buffer_address; | |
155 | spectral_matrix_regs->status = 0x10; // [0001 0000] |
|
157 | spectral_matrix_regs->status = 0x10; // [0001 0000] | |
156 | if (rtems_event_send( Task_id[TASKID_AVF2], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
158 | if (rtems_event_send( Task_id[TASKID_AVF2], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |
157 | { |
|
159 | { | |
158 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
160 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |
159 | } |
|
161 | } | |
160 | break; |
|
162 | break; | |
161 | case 2: |
|
163 | case 2: | |
162 | ring_node_for_averaging_sm_f2->coarseTime = spectral_matrix_regs->f2_1_coarse_time; |
|
164 | ring_node_for_averaging_sm_f2->coarseTime = spectral_matrix_regs->f2_1_coarse_time; | |
163 | ring_node_for_averaging_sm_f2->fineTime = spectral_matrix_regs->f2_1_fine_time; |
|
165 | ring_node_for_averaging_sm_f2->fineTime = spectral_matrix_regs->f2_1_fine_time; | |
164 | spectral_matrix_regs->f2_1_address = current_ring_node_sm_f2->buffer_address; |
|
166 | spectral_matrix_regs->f2_1_address = current_ring_node_sm_f2->buffer_address; | |
165 | spectral_matrix_regs->status = 0x20; // [0010 0000] |
|
167 | spectral_matrix_regs->status = 0x20; // [0010 0000] | |
166 | if (rtems_event_send( Task_id[TASKID_AVF2], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
168 | if (rtems_event_send( Task_id[TASKID_AVF2], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |
167 | { |
|
169 | { | |
168 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
170 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |
169 | } |
|
171 | } | |
170 | break; |
|
172 | break; | |
171 | } |
|
173 | } | |
172 | } |
|
174 | } | |
173 |
|
175 | |||
174 | void spectral_matrix_isr_error_handler( void ) |
|
176 | void spectral_matrix_isr_error_handler( void ) | |
175 | { |
|
177 | { | |
|
178 | rtems_status_code status_code; | |||
|
179 | ||||
176 | if (spectral_matrix_regs->status & 0x7c0) // [0111 1100 0000] |
|
180 | if (spectral_matrix_regs->status & 0x7c0) // [0111 1100 0000] | |
177 | { |
|
181 | { | |
178 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); |
|
182 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); | |
179 | } |
|
183 | } | |
180 | } |
|
184 | } | |
181 |
|
185 | |||
182 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ) |
|
186 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ) | |
183 | { |
|
187 | { | |
184 | // STATUS REGISTER |
|
188 | // STATUS REGISTER | |
185 | // input_fifo_write(2) *** input_fifo_write(1) *** input_fifo_write(0) |
|
189 | // input_fifo_write(2) *** input_fifo_write(1) *** input_fifo_write(0) | |
186 | // 10 9 8 |
|
190 | // 10 9 8 | |
187 | // buffer_full ** bad_component_err ** f2_1 ** f2_0 ** f1_1 ** f1_0 ** f0_1 ** f0_0 |
|
191 | // buffer_full ** bad_component_err ** f2_1 ** f2_0 ** f1_1 ** f1_0 ** f0_1 ** f0_0 | |
188 | // 7 6 5 4 3 2 1 0 |
|
192 | // 7 6 5 4 3 2 1 0 | |
189 |
|
193 | |||
190 | spectral_matrices_isr_f0(); |
|
194 | spectral_matrices_isr_f0(); | |
191 |
|
195 | |||
192 | spectral_matrices_isr_f1(); |
|
196 | spectral_matrices_isr_f1(); | |
193 |
|
197 | |||
194 | spectral_matrices_isr_f2(); |
|
198 | spectral_matrices_isr_f2(); | |
195 |
|
199 | |||
196 | // spectral_matrix_isr_error_handler(); |
|
200 | // spectral_matrix_isr_error_handler(); | |
197 | } |
|
201 | } | |
198 |
|
202 | |||
199 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ) |
|
203 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ) | |
200 | { |
|
204 | { | |
|
205 | rtems_status_code status_code; | |||
|
206 | ||||
201 | //*** |
|
207 | //*** | |
202 | // F0 |
|
208 | // F0 | |
203 | nb_sm_f0 = nb_sm_f0 + 1; |
|
209 | nb_sm_f0 = nb_sm_f0 + 1; | |
204 | if (nb_sm_f0 == NB_SM_BEFORE_AVF0 ) |
|
210 | if (nb_sm_f0 == NB_SM_BEFORE_AVF0 ) | |
205 | { |
|
211 | { | |
206 | ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0; |
|
212 | ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0; | |
207 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
213 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |
208 | { |
|
214 | { | |
209 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
215 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |
210 | } |
|
216 | } | |
211 | nb_sm_f0 = 0; |
|
217 | nb_sm_f0 = 0; | |
212 | } |
|
218 | } | |
213 |
|
219 | |||
214 | //*** |
|
220 | //*** | |
215 | // F1 |
|
221 | // F1 | |
216 | nb_sm_f0_aux_f1 = nb_sm_f0_aux_f1 + 1; |
|
222 | nb_sm_f0_aux_f1 = nb_sm_f0_aux_f1 + 1; | |
217 | if (nb_sm_f0_aux_f1 == 6) |
|
223 | if (nb_sm_f0_aux_f1 == 6) | |
218 | { |
|
224 | { | |
219 | nb_sm_f0_aux_f1 = 0; |
|
225 | nb_sm_f0_aux_f1 = 0; | |
220 | nb_sm_f1 = nb_sm_f1 + 1; |
|
226 | nb_sm_f1 = nb_sm_f1 + 1; | |
221 | } |
|
227 | } | |
222 | if (nb_sm_f1 == NB_SM_BEFORE_AVF1 ) |
|
228 | if (nb_sm_f1 == NB_SM_BEFORE_AVF1 ) | |
223 | { |
|
229 | { | |
224 | ring_node_for_averaging_sm_f1 = current_ring_node_sm_f1; |
|
230 | ring_node_for_averaging_sm_f1 = current_ring_node_sm_f1; | |
225 | if (rtems_event_send( Task_id[TASKID_AVF1], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
231 | if (rtems_event_send( Task_id[TASKID_AVF1], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |
226 | { |
|
232 | { | |
227 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
233 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |
228 | } |
|
234 | } | |
229 | nb_sm_f1 = 0; |
|
235 | nb_sm_f1 = 0; | |
230 | } |
|
236 | } | |
231 |
|
237 | |||
232 | //*** |
|
238 | //*** | |
233 | // F2 |
|
239 | // F2 | |
234 | nb_sm_f0_aux_f2 = nb_sm_f0_aux_f2 + 1; |
|
240 | nb_sm_f0_aux_f2 = nb_sm_f0_aux_f2 + 1; | |
235 | if (nb_sm_f0_aux_f2 == 96) |
|
241 | if (nb_sm_f0_aux_f2 == 96) | |
236 | { |
|
242 | { | |
237 | nb_sm_f0_aux_f2 = 0; |
|
243 | nb_sm_f0_aux_f2 = 0; | |
238 | ring_node_for_averaging_sm_f2 = current_ring_node_sm_f2; |
|
244 | ring_node_for_averaging_sm_f2 = current_ring_node_sm_f2; | |
239 | if (rtems_event_send( Task_id[TASKID_AVF2], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
245 | if (rtems_event_send( Task_id[TASKID_AVF2], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |
240 | { |
|
246 | { | |
241 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
247 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |
242 | } |
|
248 | } | |
243 | } |
|
249 | } | |
244 | } |
|
250 | } | |
245 |
|
251 | |||
246 | //****************** |
|
252 | //****************** | |
247 | // Spectral Matrices |
|
253 | // Spectral Matrices | |
248 |
|
254 | |||
249 | void reset_nb_sm( void ) |
|
255 | void reset_nb_sm( void ) | |
250 | { |
|
256 | { | |
251 | nb_sm_f0 = 0; |
|
257 | nb_sm_f0 = 0; | |
252 | nb_sm_f0_aux_f1 = 0; |
|
258 | nb_sm_f0_aux_f1 = 0; | |
253 | nb_sm_f0_aux_f2 = 0; |
|
259 | nb_sm_f0_aux_f2 = 0; | |
254 |
|
260 | |||
255 | nb_sm_f1 = 0; |
|
261 | nb_sm_f1 = 0; | |
256 | } |
|
262 | } | |
257 |
|
263 | |||
258 | void SM_init_rings( void ) |
|
264 | void SM_init_rings( void ) | |
259 | { |
|
265 | { | |
260 | unsigned char i; |
|
266 | unsigned char i; | |
261 |
|
267 | |||
262 | // F0 RING |
|
268 | // F0 RING | |
263 | sm_ring_f0[0].next = (ring_node_sm*) &sm_ring_f0[1]; |
|
269 | sm_ring_f0[0].next = (ring_node_sm*) &sm_ring_f0[1]; | |
264 | sm_ring_f0[0].previous = (ring_node_sm*) &sm_ring_f0[NB_RING_NODES_SM_F0-1]; |
|
270 | sm_ring_f0[0].previous = (ring_node_sm*) &sm_ring_f0[NB_RING_NODES_SM_F0-1]; | |
265 | sm_ring_f0[0].buffer_address = |
|
271 | sm_ring_f0[0].buffer_address = | |
266 | (int) &sm_f0[ 0 ]; |
|
272 | (int) &sm_f0[ 0 ]; | |
267 |
|
273 | |||
268 | sm_ring_f0[NB_RING_NODES_SM_F0-1].next = (ring_node_sm*) &sm_ring_f0[0]; |
|
274 | sm_ring_f0[NB_RING_NODES_SM_F0-1].next = (ring_node_sm*) &sm_ring_f0[0]; | |
269 | sm_ring_f0[NB_RING_NODES_SM_F0-1].previous = (ring_node_sm*) &sm_ring_f0[NB_RING_NODES_SM_F0-2]; |
|
275 | sm_ring_f0[NB_RING_NODES_SM_F0-1].previous = (ring_node_sm*) &sm_ring_f0[NB_RING_NODES_SM_F0-2]; | |
270 | sm_ring_f0[NB_RING_NODES_SM_F0-1].buffer_address = |
|
276 | sm_ring_f0[NB_RING_NODES_SM_F0-1].buffer_address = | |
271 | (int) &sm_f0[ (NB_RING_NODES_SM_F0-1) * TOTAL_SIZE_SM ]; |
|
277 | (int) &sm_f0[ (NB_RING_NODES_SM_F0-1) * TOTAL_SIZE_SM ]; | |
272 |
|
278 | |||
273 | for(i=1; i<NB_RING_NODES_SM_F0-1; i++) |
|
279 | for(i=1; i<NB_RING_NODES_SM_F0-1; i++) | |
274 | { |
|
280 | { | |
275 | sm_ring_f0[i].next = (ring_node_sm*) &sm_ring_f0[i+1]; |
|
281 | sm_ring_f0[i].next = (ring_node_sm*) &sm_ring_f0[i+1]; | |
276 | sm_ring_f0[i].previous = (ring_node_sm*) &sm_ring_f0[i-1]; |
|
282 | sm_ring_f0[i].previous = (ring_node_sm*) &sm_ring_f0[i-1]; | |
277 | sm_ring_f0[i].buffer_address = |
|
283 | sm_ring_f0[i].buffer_address = | |
278 | (int) &sm_f0[ i * TOTAL_SIZE_SM ]; |
|
284 | (int) &sm_f0[ i * TOTAL_SIZE_SM ]; | |
279 | } |
|
285 | } | |
280 |
|
286 | |||
281 | // F1 RING |
|
287 | // F1 RING | |
282 | sm_ring_f1[0].next = (ring_node_sm*) &sm_ring_f1[1]; |
|
288 | sm_ring_f1[0].next = (ring_node_sm*) &sm_ring_f1[1]; | |
283 | sm_ring_f1[0].previous = (ring_node_sm*) &sm_ring_f1[NB_RING_NODES_SM_F1-1]; |
|
289 | sm_ring_f1[0].previous = (ring_node_sm*) &sm_ring_f1[NB_RING_NODES_SM_F1-1]; | |
284 | sm_ring_f1[0].buffer_address = |
|
290 | sm_ring_f1[0].buffer_address = | |
285 | (int) &sm_f1[ 0 ]; |
|
291 | (int) &sm_f1[ 0 ]; | |
286 |
|
292 | |||
287 | sm_ring_f1[NB_RING_NODES_SM_F1-1].next = (ring_node_sm*) &sm_ring_f1[0]; |
|
293 | sm_ring_f1[NB_RING_NODES_SM_F1-1].next = (ring_node_sm*) &sm_ring_f1[0]; | |
288 | sm_ring_f1[NB_RING_NODES_SM_F1-1].previous = (ring_node_sm*) &sm_ring_f1[NB_RING_NODES_SM_F1-2]; |
|
294 | sm_ring_f1[NB_RING_NODES_SM_F1-1].previous = (ring_node_sm*) &sm_ring_f1[NB_RING_NODES_SM_F1-2]; | |
289 | sm_ring_f1[NB_RING_NODES_SM_F1-1].buffer_address = |
|
295 | sm_ring_f1[NB_RING_NODES_SM_F1-1].buffer_address = | |
290 | (int) &sm_f1[ (NB_RING_NODES_SM_F1-1) * TOTAL_SIZE_SM ]; |
|
296 | (int) &sm_f1[ (NB_RING_NODES_SM_F1-1) * TOTAL_SIZE_SM ]; | |
291 |
|
297 | |||
292 | for(i=1; i<NB_RING_NODES_SM_F1-1; i++) |
|
298 | for(i=1; i<NB_RING_NODES_SM_F1-1; i++) | |
293 | { |
|
299 | { | |
294 | sm_ring_f1[i].next = (ring_node_sm*) &sm_ring_f1[i+1]; |
|
300 | sm_ring_f1[i].next = (ring_node_sm*) &sm_ring_f1[i+1]; | |
295 | sm_ring_f1[i].previous = (ring_node_sm*) &sm_ring_f1[i-1]; |
|
301 | sm_ring_f1[i].previous = (ring_node_sm*) &sm_ring_f1[i-1]; | |
296 | sm_ring_f1[i].buffer_address = |
|
302 | sm_ring_f1[i].buffer_address = | |
297 | (int) &sm_f1[ i * TOTAL_SIZE_SM ]; |
|
303 | (int) &sm_f1[ i * TOTAL_SIZE_SM ]; | |
298 | } |
|
304 | } | |
299 |
|
305 | |||
300 | // F2 RING |
|
306 | // F2 RING | |
301 | sm_ring_f2[0].next = (ring_node_sm*) &sm_ring_f2[1]; |
|
307 | sm_ring_f2[0].next = (ring_node_sm*) &sm_ring_f2[1]; | |
302 | sm_ring_f2[0].previous = (ring_node_sm*) &sm_ring_f2[NB_RING_NODES_SM_F2-1]; |
|
308 | sm_ring_f2[0].previous = (ring_node_sm*) &sm_ring_f2[NB_RING_NODES_SM_F2-1]; | |
303 | sm_ring_f2[0].buffer_address = |
|
309 | sm_ring_f2[0].buffer_address = | |
304 | (int) &sm_f2[ 0 ]; |
|
310 | (int) &sm_f2[ 0 ]; | |
305 |
|
311 | |||
306 | sm_ring_f2[NB_RING_NODES_SM_F2-1].next = (ring_node_sm*) &sm_ring_f2[0]; |
|
312 | sm_ring_f2[NB_RING_NODES_SM_F2-1].next = (ring_node_sm*) &sm_ring_f2[0]; | |
307 | sm_ring_f2[NB_RING_NODES_SM_F2-1].previous = (ring_node_sm*) &sm_ring_f2[NB_RING_NODES_SM_F2-2]; |
|
313 | sm_ring_f2[NB_RING_NODES_SM_F2-1].previous = (ring_node_sm*) &sm_ring_f2[NB_RING_NODES_SM_F2-2]; | |
308 | sm_ring_f2[NB_RING_NODES_SM_F2-1].buffer_address = |
|
314 | sm_ring_f2[NB_RING_NODES_SM_F2-1].buffer_address = | |
309 | (int) &sm_f2[ (NB_RING_NODES_SM_F2-1) * TOTAL_SIZE_SM ]; |
|
315 | (int) &sm_f2[ (NB_RING_NODES_SM_F2-1) * TOTAL_SIZE_SM ]; | |
310 |
|
316 | |||
311 | for(i=1; i<NB_RING_NODES_SM_F2-1; i++) |
|
317 | for(i=1; i<NB_RING_NODES_SM_F2-1; i++) | |
312 | { |
|
318 | { | |
313 | sm_ring_f2[i].next = (ring_node_sm*) &sm_ring_f2[i+1]; |
|
319 | sm_ring_f2[i].next = (ring_node_sm*) &sm_ring_f2[i+1]; | |
314 | sm_ring_f2[i].previous = (ring_node_sm*) &sm_ring_f2[i-1]; |
|
320 | sm_ring_f2[i].previous = (ring_node_sm*) &sm_ring_f2[i-1]; | |
315 | sm_ring_f2[i].buffer_address = |
|
321 | sm_ring_f2[i].buffer_address = | |
316 | (int) &sm_f2[ i * TOTAL_SIZE_SM ]; |
|
322 | (int) &sm_f2[ i * TOTAL_SIZE_SM ]; | |
317 | } |
|
323 | } | |
318 |
|
324 | |||
319 | DEBUG_PRINTF1("asm_ring_f0 @%x\n", (unsigned int) sm_ring_f0) |
|
325 | DEBUG_PRINTF1("asm_ring_f0 @%x\n", (unsigned int) sm_ring_f0) | |
320 | DEBUG_PRINTF1("asm_ring_f1 @%x\n", (unsigned int) sm_ring_f1) |
|
326 | DEBUG_PRINTF1("asm_ring_f1 @%x\n", (unsigned int) sm_ring_f1) | |
321 | DEBUG_PRINTF1("asm_ring_f2 @%x\n", (unsigned int) sm_ring_f2) |
|
327 | DEBUG_PRINTF1("asm_ring_f2 @%x\n", (unsigned int) sm_ring_f2) | |
322 |
|
328 | |||
323 | spectral_matrix_regs->f0_0_address = sm_ring_f0[0].buffer_address; |
|
329 | spectral_matrix_regs->f0_0_address = sm_ring_f0[0].buffer_address; | |
324 | DEBUG_PRINTF1("spectral_matrix_regs->matrixF0_Address0 @%x\n", spectral_matrix_regs->f0_0_address) |
|
330 | DEBUG_PRINTF1("spectral_matrix_regs->matrixF0_Address0 @%x\n", spectral_matrix_regs->f0_0_address) | |
325 | } |
|
331 | } | |
326 |
|
332 | |||
327 | void SM_generic_init_ring( ring_node_sm *ring, unsigned char nbNodes, volatile int sm_f[] ) |
|
333 | void SM_generic_init_ring( ring_node_sm *ring, unsigned char nbNodes, volatile int sm_f[] ) | |
328 | { |
|
334 | { | |
329 | unsigned char i; |
|
335 | unsigned char i; | |
330 |
|
336 | |||
331 | //*************** |
|
337 | //*************** | |
332 | // BUFFER ADDRESS |
|
338 | // BUFFER ADDRESS | |
333 | for(i=0; i<nbNodes; i++) |
|
339 | for(i=0; i<nbNodes; i++) | |
334 | { |
|
340 | { | |
335 | ring[ i ].buffer_address = (int) &sm_f[ i * TOTAL_SIZE_SM ]; |
|
341 | ring[ i ].buffer_address = (int) &sm_f[ i * TOTAL_SIZE_SM ]; | |
336 | } |
|
342 | } | |
337 |
|
343 | |||
338 | //***** |
|
344 | //***** | |
339 | // NEXT |
|
345 | // NEXT | |
340 | ring[ nbNodes - 1 ].next = (ring_node_sm*) &ring[ 0 ]; |
|
346 | ring[ nbNodes - 1 ].next = (ring_node_sm*) &ring[ 0 ]; | |
341 | for(i=0; i<nbNodes-1; i++) |
|
347 | for(i=0; i<nbNodes-1; i++) | |
342 | { |
|
348 | { | |
343 | ring[ i ].next = (ring_node_sm*) &ring[ i + 1 ]; |
|
349 | ring[ i ].next = (ring_node_sm*) &ring[ i + 1 ]; | |
344 | } |
|
350 | } | |
345 |
|
351 | |||
346 | //********* |
|
352 | //********* | |
347 | // PREVIOUS |
|
353 | // PREVIOUS | |
348 | ring[ 0 ].previous = (ring_node_sm*) &ring[ nbNodes -1 ]; |
|
354 | ring[ 0 ].previous = (ring_node_sm*) &ring[ nbNodes -1 ]; | |
349 | for(i=1; i<nbNodes; i++) |
|
355 | for(i=1; i<nbNodes; i++) | |
350 | { |
|
356 | { | |
351 | ring[ i ].previous = (ring_node_sm*) &ring[ i - 1 ]; |
|
357 | ring[ i ].previous = (ring_node_sm*) &ring[ i - 1 ]; | |
352 | } |
|
358 | } | |
353 | } |
|
359 | } | |
354 |
|
360 | |||
355 | void ASM_generic_init_ring( ring_node_asm *ring, unsigned char nbNodes ) |
|
361 | void ASM_generic_init_ring( ring_node_asm *ring, unsigned char nbNodes ) | |
356 | { |
|
362 | { | |
357 | unsigned char i; |
|
363 | unsigned char i; | |
358 |
|
364 | |||
359 | ring[ nbNodes - 1 ].next |
|
365 | ring[ nbNodes - 1 ].next | |
360 | = (ring_node_asm*) &ring[ 0 ]; |
|
366 | = (ring_node_asm*) &ring[ 0 ]; | |
361 |
|
367 | |||
362 | for(i=0; i<nbNodes-1; i++) |
|
368 | for(i=0; i<nbNodes-1; i++) | |
363 | { |
|
369 | { | |
364 | ring[ i ].next = (ring_node_asm*) &ring[ i + 1 ]; |
|
370 | ring[ i ].next = (ring_node_asm*) &ring[ i + 1 ]; | |
365 | } |
|
371 | } | |
366 | } |
|
372 | } | |
367 |
|
373 | |||
368 | void SM_reset_current_ring_nodes( void ) |
|
374 | void SM_reset_current_ring_nodes( void ) | |
369 | { |
|
375 | { | |
370 | current_ring_node_sm_f0 = sm_ring_f0[0].next; |
|
376 | current_ring_node_sm_f0 = sm_ring_f0[0].next; | |
371 | current_ring_node_sm_f1 = sm_ring_f1[0].next; |
|
377 | current_ring_node_sm_f1 = sm_ring_f1[0].next; | |
372 | current_ring_node_sm_f2 = sm_ring_f2[0].next; |
|
378 | current_ring_node_sm_f2 = sm_ring_f2[0].next; | |
373 |
|
379 | |||
374 | ring_node_for_averaging_sm_f0 = sm_ring_f0; |
|
380 | ring_node_for_averaging_sm_f0 = sm_ring_f0; | |
375 | ring_node_for_averaging_sm_f1 = sm_ring_f1; |
|
381 | ring_node_for_averaging_sm_f1 = sm_ring_f1; | |
376 | ring_node_for_averaging_sm_f2 = sm_ring_f2; |
|
382 | ring_node_for_averaging_sm_f2 = sm_ring_f2; | |
377 | } |
|
383 | } | |
378 |
|
384 | |||
379 | void ASM_init_header( Header_TM_LFR_SCIENCE_ASM_t *header) |
|
385 | void ASM_init_header( Header_TM_LFR_SCIENCE_ASM_t *header) | |
380 | { |
|
386 | { | |
381 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
387 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; | |
382 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
388 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
383 | header->reserved = 0x00; |
|
389 | header->reserved = 0x00; | |
384 | header->userApplication = CCSDS_USER_APP; |
|
390 | header->userApplication = CCSDS_USER_APP; | |
385 | header->packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8); |
|
391 | header->packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8); | |
386 | header->packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST); |
|
392 | header->packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST); | |
387 | header->packetSequenceControl[0] = 0xc0; |
|
393 | header->packetSequenceControl[0] = 0xc0; | |
388 | header->packetSequenceControl[1] = 0x00; |
|
394 | header->packetSequenceControl[1] = 0x00; | |
389 | header->packetLength[0] = 0x00; |
|
395 | header->packetLength[0] = 0x00; | |
390 | header->packetLength[1] = 0x00; |
|
396 | header->packetLength[1] = 0x00; | |
391 | // DATA FIELD HEADER |
|
397 | // DATA FIELD HEADER | |
392 | header->spare1_pusVersion_spare2 = 0x10; |
|
398 | header->spare1_pusVersion_spare2 = 0x10; | |
393 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
399 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
394 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
400 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
395 | header->destinationID = TM_DESTINATION_ID_GROUND; |
|
401 | header->destinationID = TM_DESTINATION_ID_GROUND; | |
396 | // AUXILIARY DATA HEADER |
|
402 | // AUXILIARY DATA HEADER | |
397 | header->sid = 0x00; |
|
403 | header->sid = 0x00; | |
398 | header->biaStatusInfo = 0x00; |
|
404 | header->biaStatusInfo = 0x00; | |
399 | header->pa_lfr_pkt_cnt_asm = 0x00; |
|
405 | header->pa_lfr_pkt_cnt_asm = 0x00; | |
400 | header->pa_lfr_pkt_nr_asm = 0x00; |
|
406 | header->pa_lfr_pkt_nr_asm = 0x00; | |
401 | header->time[0] = 0x00; |
|
407 | header->time[0] = 0x00; | |
402 | header->time[0] = 0x00; |
|
408 | header->time[0] = 0x00; | |
403 | header->time[0] = 0x00; |
|
409 | header->time[0] = 0x00; | |
404 | header->time[0] = 0x00; |
|
410 | header->time[0] = 0x00; | |
405 | header->time[0] = 0x00; |
|
411 | header->time[0] = 0x00; | |
406 | header->time[0] = 0x00; |
|
412 | header->time[0] = 0x00; | |
407 | header->pa_lfr_asm_blk_nr[0] = 0x00; // BLK_NR MSB |
|
413 | header->pa_lfr_asm_blk_nr[0] = 0x00; // BLK_NR MSB | |
408 | header->pa_lfr_asm_blk_nr[1] = 0x00; // BLK_NR LSB |
|
414 | header->pa_lfr_asm_blk_nr[1] = 0x00; // BLK_NR LSB | |
409 | } |
|
415 | } | |
410 |
|
416 | |||
411 | void ASM_send(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, |
|
417 | void ASM_send(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, | |
412 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id) |
|
418 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id) | |
413 | { |
|
419 | { | |
414 | unsigned int i; |
|
420 | unsigned int i; | |
415 | unsigned int length = 0; |
|
421 | unsigned int length = 0; | |
416 | rtems_status_code status; |
|
422 | rtems_status_code status; | |
417 |
|
423 | |||
418 | for (i=0; i<2; i++) |
|
424 | for (i=0; i<2; i++) | |
419 | { |
|
425 | { | |
420 | // (1) BUILD THE DATA |
|
426 | // (1) BUILD THE DATA | |
421 | switch(sid) |
|
427 | switch(sid) | |
422 | { |
|
428 | { | |
423 | case SID_NORM_ASM_F0: |
|
429 | case SID_NORM_ASM_F0: | |
424 | spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F0_IN_BYTES / 2; // 2 packets will be sent |
|
430 | spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F0_IN_BYTES / 2; // 2 packets will be sent | |
425 | spw_ioctl_send->data = &spectral_matrix[ |
|
431 | spw_ioctl_send->data = &spectral_matrix[ | |
426 | ( (ASM_F0_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F0) ) * NB_VALUES_PER_SM ) * 2 |
|
432 | ( (ASM_F0_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F0) ) * NB_VALUES_PER_SM ) * 2 | |
427 | ]; |
|
433 | ]; | |
428 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0; |
|
434 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0; | |
429 | header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F0) >> 8 ); // BLK_NR MSB |
|
435 | header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F0) >> 8 ); // BLK_NR MSB | |
430 | header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F0); // BLK_NR LSB |
|
436 | header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F0); // BLK_NR LSB | |
431 | break; |
|
437 | break; | |
432 | case SID_NORM_ASM_F1: |
|
438 | case SID_NORM_ASM_F1: | |
433 | spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F1_IN_BYTES / 2; // 2 packets will be sent |
|
439 | spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F1_IN_BYTES / 2; // 2 packets will be sent | |
434 | spw_ioctl_send->data = &spectral_matrix[ |
|
440 | spw_ioctl_send->data = &spectral_matrix[ | |
435 | ( (ASM_F1_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F1) ) * NB_VALUES_PER_SM ) * 2 |
|
441 | ( (ASM_F1_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F1) ) * NB_VALUES_PER_SM ) * 2 | |
436 | ]; |
|
442 | ]; | |
437 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F1; |
|
443 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F1; | |
438 | header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F1) >> 8 ); // BLK_NR MSB |
|
444 | header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F1) >> 8 ); // BLK_NR MSB | |
439 | header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F1); // BLK_NR LSB |
|
445 | header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F1); // BLK_NR LSB | |
440 | break; |
|
446 | break; | |
441 | case SID_NORM_ASM_F2: |
|
447 | case SID_NORM_ASM_F2: | |
442 | spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F2_IN_BYTES / 2; // 2 packets will be sent |
|
448 | spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F2_IN_BYTES / 2; // 2 packets will be sent | |
443 | spw_ioctl_send->data = &spectral_matrix[ |
|
449 | spw_ioctl_send->data = &spectral_matrix[ | |
444 | ( (ASM_F2_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F2) ) * NB_VALUES_PER_SM ) * 2 |
|
450 | ( (ASM_F2_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F2) ) * NB_VALUES_PER_SM ) * 2 | |
445 | ]; |
|
451 | ]; | |
446 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F2; |
|
452 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F2; | |
447 | header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F2) >> 8 ); // BLK_NR MSB |
|
453 | header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F2) >> 8 ); // BLK_NR MSB | |
448 | header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F2); // BLK_NR LSB |
|
454 | header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F2); // BLK_NR LSB | |
449 | break; |
|
455 | break; | |
450 | default: |
|
456 | default: | |
451 | PRINTF1("ERR *** in ASM_send *** unexpected sid %d\n", sid) |
|
457 | PRINTF1("ERR *** in ASM_send *** unexpected sid %d\n", sid) | |
452 | break; |
|
458 | break; | |
453 | } |
|
459 | } | |
454 | spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
460 | spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES; | |
455 | spw_ioctl_send->hdr = (char *) header; |
|
461 | spw_ioctl_send->hdr = (char *) header; | |
456 | spw_ioctl_send->options = 0; |
|
462 | spw_ioctl_send->options = 0; | |
457 |
|
463 | |||
458 | // (2) BUILD THE HEADER |
|
464 | // (2) BUILD THE HEADER | |
459 | increment_seq_counter_source_id( header->packetSequenceControl, sid ); |
|
465 | increment_seq_counter_source_id( header->packetSequenceControl, sid ); | |
460 | header->packetLength[0] = (unsigned char) (length>>8); |
|
466 | header->packetLength[0] = (unsigned char) (length>>8); | |
461 | header->packetLength[1] = (unsigned char) (length); |
|
467 | header->packetLength[1] = (unsigned char) (length); | |
462 | header->sid = (unsigned char) sid; // SID |
|
468 | header->sid = (unsigned char) sid; // SID | |
463 | header->pa_lfr_pkt_cnt_asm = 2; |
|
469 | header->pa_lfr_pkt_cnt_asm = 2; | |
464 | header->pa_lfr_pkt_nr_asm = (unsigned char) (i+1); |
|
470 | header->pa_lfr_pkt_nr_asm = (unsigned char) (i+1); | |
465 |
|
471 | |||
466 | // (3) SET PACKET TIME |
|
472 | // (3) SET PACKET TIME | |
467 | header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
473 | header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
468 | header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
474 | header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
469 | header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
475 | header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
470 | header->time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
476 | header->time[3] = (unsigned char) (time_management_regs->coarse_time); | |
471 | header->time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
477 | header->time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
472 | header->time[5] = (unsigned char) (time_management_regs->fine_time); |
|
478 | header->time[5] = (unsigned char) (time_management_regs->fine_time); | |
473 | // |
|
479 | // | |
474 | header->acquisitionTime[0] = header->time[0]; |
|
480 | header->acquisitionTime[0] = header->time[0]; | |
475 | header->acquisitionTime[1] = header->time[1]; |
|
481 | header->acquisitionTime[1] = header->time[1]; | |
476 | header->acquisitionTime[2] = header->time[2]; |
|
482 | header->acquisitionTime[2] = header->time[2]; | |
477 | header->acquisitionTime[3] = header->time[3]; |
|
483 | header->acquisitionTime[3] = header->time[3]; | |
478 | header->acquisitionTime[4] = header->time[4]; |
|
484 | header->acquisitionTime[4] = header->time[4]; | |
479 | header->acquisitionTime[5] = header->time[5]; |
|
485 | header->acquisitionTime[5] = header->time[5]; | |
480 |
|
486 | |||
481 | // (4) SEND PACKET |
|
487 | // (4) SEND PACKET | |
482 | status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE); |
|
488 | status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE); | |
483 | if (status != RTEMS_SUCCESSFUL) { |
|
489 | if (status != RTEMS_SUCCESSFUL) { | |
484 | printf("in ASM_send *** ERR %d\n", (int) status); |
|
490 | printf("in ASM_send *** ERR %d\n", (int) status); | |
485 | } |
|
491 | } | |
486 | } |
|
492 | } | |
487 | } |
|
493 | } | |
488 |
|
494 | |||
489 | //***************** |
|
495 | //***************** | |
490 | // Basic Parameters |
|
496 | // Basic Parameters | |
491 |
|
497 | |||
492 | void BP_init_header( Header_TM_LFR_SCIENCE_BP_t *header, |
|
498 | void BP_init_header( Header_TM_LFR_SCIENCE_BP_t *header, | |
493 | unsigned int apid, unsigned char sid, |
|
499 | unsigned int apid, unsigned char sid, | |
494 | unsigned int packetLength, unsigned char blkNr ) |
|
500 | unsigned int packetLength, unsigned char blkNr ) | |
495 | { |
|
501 | { | |
496 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
502 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; | |
497 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
503 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
498 | header->reserved = 0x00; |
|
504 | header->reserved = 0x00; | |
499 | header->userApplication = CCSDS_USER_APP; |
|
505 | header->userApplication = CCSDS_USER_APP; | |
500 | header->packetID[0] = (unsigned char) (apid >> 8); |
|
506 | header->packetID[0] = (unsigned char) (apid >> 8); | |
501 | header->packetID[1] = (unsigned char) (apid); |
|
507 | header->packetID[1] = (unsigned char) (apid); | |
502 | header->packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
508 | header->packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
503 | header->packetSequenceControl[1] = 0x00; |
|
509 | header->packetSequenceControl[1] = 0x00; | |
504 | header->packetLength[0] = (unsigned char) (packetLength >> 8); |
|
510 | header->packetLength[0] = (unsigned char) (packetLength >> 8); | |
505 | header->packetLength[1] = (unsigned char) (packetLength); |
|
511 | header->packetLength[1] = (unsigned char) (packetLength); | |
506 | // DATA FIELD HEADER |
|
512 | // DATA FIELD HEADER | |
507 | header->spare1_pusVersion_spare2 = 0x10; |
|
513 | header->spare1_pusVersion_spare2 = 0x10; | |
508 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
514 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
509 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
515 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
510 | header->destinationID = TM_DESTINATION_ID_GROUND; |
|
516 | header->destinationID = TM_DESTINATION_ID_GROUND; | |
511 | // AUXILIARY DATA HEADER |
|
517 | // AUXILIARY DATA HEADER | |
512 | header->sid = sid; |
|
518 | header->sid = sid; | |
513 | header->biaStatusInfo = 0x00; |
|
519 | header->biaStatusInfo = 0x00; | |
514 | header->time[0] = 0x00; |
|
520 | header->time[0] = 0x00; | |
515 | header->time[0] = 0x00; |
|
521 | header->time[0] = 0x00; | |
516 | header->time[0] = 0x00; |
|
522 | header->time[0] = 0x00; | |
517 | header->time[0] = 0x00; |
|
523 | header->time[0] = 0x00; | |
518 | header->time[0] = 0x00; |
|
524 | header->time[0] = 0x00; | |
519 | header->time[0] = 0x00; |
|
525 | header->time[0] = 0x00; | |
520 | header->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB |
|
526 | header->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB | |
521 | header->pa_lfr_bp_blk_nr[1] = blkNr; // BLK_NR LSB |
|
527 | header->pa_lfr_bp_blk_nr[1] = blkNr; // BLK_NR LSB | |
522 | } |
|
528 | } | |
523 |
|
529 | |||
524 | void BP_init_header_with_spare(Header_TM_LFR_SCIENCE_BP_with_spare_t *header, |
|
530 | void BP_init_header_with_spare(Header_TM_LFR_SCIENCE_BP_with_spare_t *header, | |
525 | unsigned int apid, unsigned char sid, |
|
531 | unsigned int apid, unsigned char sid, | |
526 | unsigned int packetLength , unsigned char blkNr) |
|
532 | unsigned int packetLength , unsigned char blkNr) | |
527 | { |
|
533 | { | |
528 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
534 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; | |
529 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
535 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
530 | header->reserved = 0x00; |
|
536 | header->reserved = 0x00; | |
531 | header->userApplication = CCSDS_USER_APP; |
|
537 | header->userApplication = CCSDS_USER_APP; | |
532 | header->packetID[0] = (unsigned char) (apid >> 8); |
|
538 | header->packetID[0] = (unsigned char) (apid >> 8); | |
533 | header->packetID[1] = (unsigned char) (apid); |
|
539 | header->packetID[1] = (unsigned char) (apid); | |
534 | header->packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
540 | header->packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
535 | header->packetSequenceControl[1] = 0x00; |
|
541 | header->packetSequenceControl[1] = 0x00; | |
536 | header->packetLength[0] = (unsigned char) (packetLength >> 8); |
|
542 | header->packetLength[0] = (unsigned char) (packetLength >> 8); | |
537 | header->packetLength[1] = (unsigned char) (packetLength); |
|
543 | header->packetLength[1] = (unsigned char) (packetLength); | |
538 | // DATA FIELD HEADER |
|
544 | // DATA FIELD HEADER | |
539 | header->spare1_pusVersion_spare2 = 0x10; |
|
545 | header->spare1_pusVersion_spare2 = 0x10; | |
540 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
546 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
541 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
547 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
542 | header->destinationID = TM_DESTINATION_ID_GROUND; |
|
548 | header->destinationID = TM_DESTINATION_ID_GROUND; | |
543 | // AUXILIARY DATA HEADER |
|
549 | // AUXILIARY DATA HEADER | |
544 | header->sid = sid; |
|
550 | header->sid = sid; | |
545 | header->biaStatusInfo = 0x00; |
|
551 | header->biaStatusInfo = 0x00; | |
546 | header->time[0] = 0x00; |
|
552 | header->time[0] = 0x00; | |
547 | header->time[0] = 0x00; |
|
553 | header->time[0] = 0x00; | |
548 | header->time[0] = 0x00; |
|
554 | header->time[0] = 0x00; | |
549 | header->time[0] = 0x00; |
|
555 | header->time[0] = 0x00; | |
550 | header->time[0] = 0x00; |
|
556 | header->time[0] = 0x00; | |
551 | header->time[0] = 0x00; |
|
557 | header->time[0] = 0x00; | |
552 | header->source_data_spare = 0x00; |
|
558 | header->source_data_spare = 0x00; | |
553 | header->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB |
|
559 | header->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB | |
554 | header->pa_lfr_bp_blk_nr[1] = blkNr; // BLK_NR LSB |
|
560 | header->pa_lfr_bp_blk_nr[1] = blkNr; // BLK_NR LSB | |
555 | } |
|
561 | } | |
556 |
|
562 | |||
557 | void BP_send(char *data, rtems_id queue_id, unsigned int nbBytesToSend, unsigned int sid ) |
|
563 | void BP_send(char *data, rtems_id queue_id, unsigned int nbBytesToSend, unsigned int sid ) | |
558 | { |
|
564 | { | |
559 | rtems_status_code status; |
|
565 | rtems_status_code status; | |
560 |
|
566 | |||
561 | // SET THE SEQUENCE_CNT PARAMETER |
|
567 | // SET THE SEQUENCE_CNT PARAMETER | |
562 | increment_seq_counter_source_id( (unsigned char*) &data[ PACKET_POS_SEQUENCE_CNT ], sid ); |
|
568 | increment_seq_counter_source_id( (unsigned char*) &data[ PACKET_POS_SEQUENCE_CNT ], sid ); | |
563 | // SEND PACKET |
|
569 | // SEND PACKET | |
564 | status = rtems_message_queue_send( queue_id, data, nbBytesToSend); |
|
570 | status = rtems_message_queue_send( queue_id, data, nbBytesToSend); | |
565 | if (status != RTEMS_SUCCESSFUL) |
|
571 | if (status != RTEMS_SUCCESSFUL) | |
566 | { |
|
572 | { | |
567 | printf("ERR *** in BP_send *** ERR %d\n", (int) status); |
|
573 | printf("ERR *** in BP_send *** ERR %d\n", (int) status); | |
568 | } |
|
574 | } | |
569 | } |
|
575 | } | |
570 |
|
576 | |||
571 | //****************** |
|
577 | //****************** | |
572 | // general functions |
|
578 | // general functions | |
573 |
|
579 | |||
574 | void reset_spectral_matrix_regs( void ) |
|
580 | void reset_spectral_matrix_regs( void ) | |
575 | { |
|
581 | { | |
576 | /** This function resets the spectral matrices module registers. |
|
582 | /** This function resets the spectral matrices module registers. | |
577 | * |
|
583 | * | |
578 | * The registers affected by this function are located at the following offset addresses: |
|
584 | * The registers affected by this function are located at the following offset addresses: | |
579 | * |
|
585 | * | |
580 | * - 0x00 config |
|
586 | * - 0x00 config | |
581 | * - 0x04 status |
|
587 | * - 0x04 status | |
582 | * - 0x08 matrixF0_Address0 |
|
588 | * - 0x08 matrixF0_Address0 | |
583 | * - 0x10 matrixFO_Address1 |
|
589 | * - 0x10 matrixFO_Address1 | |
584 | * - 0x14 matrixF1_Address |
|
590 | * - 0x14 matrixF1_Address | |
585 | * - 0x18 matrixF2_Address |
|
591 | * - 0x18 matrixF2_Address | |
586 | * |
|
592 | * | |
587 | */ |
|
593 | */ | |
588 |
|
594 | |||
589 | spectral_matrix_regs->config = 0x00; |
|
595 | spectral_matrix_regs->config = 0x00; | |
590 | spectral_matrix_regs->status = 0x00; |
|
596 | spectral_matrix_regs->status = 0x00; | |
591 |
|
597 | |||
592 | spectral_matrix_regs->f0_0_address = current_ring_node_sm_f0->previous->buffer_address; |
|
598 | spectral_matrix_regs->f0_0_address = current_ring_node_sm_f0->previous->buffer_address; | |
593 | spectral_matrix_regs->f0_1_address = current_ring_node_sm_f0->buffer_address; |
|
599 | spectral_matrix_regs->f0_1_address = current_ring_node_sm_f0->buffer_address; | |
594 | spectral_matrix_regs->f1_0_address = current_ring_node_sm_f1->previous->buffer_address; |
|
600 | spectral_matrix_regs->f1_0_address = current_ring_node_sm_f1->previous->buffer_address; | |
595 | spectral_matrix_regs->f1_1_address = current_ring_node_sm_f1->buffer_address; |
|
601 | spectral_matrix_regs->f1_1_address = current_ring_node_sm_f1->buffer_address; | |
596 | spectral_matrix_regs->f2_0_address = current_ring_node_sm_f2->previous->buffer_address; |
|
602 | spectral_matrix_regs->f2_0_address = current_ring_node_sm_f2->previous->buffer_address; | |
597 | spectral_matrix_regs->f2_1_address = current_ring_node_sm_f2->buffer_address; |
|
603 | spectral_matrix_regs->f2_1_address = current_ring_node_sm_f2->buffer_address; | |
598 | } |
|
604 | } | |
599 |
|
605 | |||
600 | void set_time( unsigned char *time, unsigned char * timeInBuffer ) |
|
606 | void set_time( unsigned char *time, unsigned char * timeInBuffer ) | |
601 | { |
|
607 | { | |
602 | time[0] = timeInBuffer[0]; |
|
608 | time[0] = timeInBuffer[0]; | |
603 | time[1] = timeInBuffer[1]; |
|
609 | time[1] = timeInBuffer[1]; | |
604 | time[2] = timeInBuffer[2]; |
|
610 | time[2] = timeInBuffer[2]; | |
605 | time[3] = timeInBuffer[3]; |
|
611 | time[3] = timeInBuffer[3]; | |
606 | time[4] = timeInBuffer[6]; |
|
612 | time[4] = timeInBuffer[6]; | |
607 | time[5] = timeInBuffer[7]; |
|
613 | time[5] = timeInBuffer[7]; | |
608 | } |
|
614 | } | |
609 |
|
615 | |||
610 | unsigned long long int get_acquisition_time( unsigned char *timePtr ) |
|
616 | unsigned long long int get_acquisition_time( unsigned char *timePtr ) | |
611 | { |
|
617 | { | |
612 | unsigned long long int acquisitionTimeAslong; |
|
618 | unsigned long long int acquisitionTimeAslong; | |
613 | acquisitionTimeAslong = 0x00; |
|
619 | acquisitionTimeAslong = 0x00; | |
614 | acquisitionTimeAslong = ( (unsigned long long int) (timePtr[0] & 0x7f) << 40 ) // [0111 1111] mask the synchronization bit |
|
620 | acquisitionTimeAslong = ( (unsigned long long int) (timePtr[0] & 0x7f) << 40 ) // [0111 1111] mask the synchronization bit | |
615 | + ( (unsigned long long int) timePtr[1] << 32 ) |
|
621 | + ( (unsigned long long int) timePtr[1] << 32 ) | |
616 | + ( (unsigned long long int) timePtr[2] << 24 ) |
|
622 | + ( (unsigned long long int) timePtr[2] << 24 ) | |
617 | + ( (unsigned long long int) timePtr[3] << 16 ) |
|
623 | + ( (unsigned long long int) timePtr[3] << 16 ) | |
618 | + ( (unsigned long long int) timePtr[6] << 8 ) |
|
624 | + ( (unsigned long long int) timePtr[6] << 8 ) | |
619 | + ( (unsigned long long int) timePtr[7] ); |
|
625 | + ( (unsigned long long int) timePtr[7] ); | |
620 | return acquisitionTimeAslong; |
|
626 | return acquisitionTimeAslong; | |
621 | } |
|
627 | } | |
622 |
|
628 | |||
623 | void close_matrix_actions(unsigned int *nb_sm, unsigned int nb_sm_before_avf, rtems_id task_id, |
|
629 | void close_matrix_actions(unsigned int *nb_sm, unsigned int nb_sm_before_avf, rtems_id avf_task_id, | |
624 | ring_node_sm *node_for_averaging, ring_node_sm *ringNode, |
|
630 | ring_node_sm *node_for_averaging, ring_node_sm *ringNode, | |
625 | unsigned long long int time ) |
|
631 | unsigned long long int time ) | |
626 | { |
|
632 | { | |
627 | unsigned char *timePtr; |
|
633 | unsigned char *timePtr; | |
628 | unsigned char *coarseTimePtr; |
|
634 | unsigned char *coarseTimePtr; | |
629 | unsigned char *fineTimePtr; |
|
635 | unsigned char *fineTimePtr; | |
|
636 | rtems_status_code status_code; | |||
630 |
|
637 | |||
631 | timePtr = (unsigned char *) &time; |
|
638 | timePtr = (unsigned char *) &time; | |
632 | coarseTimePtr = (unsigned char *) &node_for_averaging->coarseTime; |
|
639 | coarseTimePtr = (unsigned char *) &node_for_averaging->coarseTime; | |
633 | fineTimePtr = (unsigned char *) &node_for_averaging->fineTime; |
|
640 | fineTimePtr = (unsigned char *) &node_for_averaging->fineTime; | |
634 |
|
641 | |||
635 | *nb_sm = *nb_sm + 1; |
|
642 | *nb_sm = *nb_sm + 1; | |
636 | if (*nb_sm == nb_sm_before_avf) |
|
643 | if (*nb_sm == nb_sm_before_avf) | |
637 | { |
|
644 | { | |
638 | node_for_averaging = ringNode; |
|
645 | node_for_averaging = ringNode; | |
639 | coarseTimePtr[0] = timePtr[2]; |
|
646 | coarseTimePtr[0] = timePtr[2]; | |
640 | coarseTimePtr[1] = timePtr[3]; |
|
647 | coarseTimePtr[1] = timePtr[3]; | |
641 | coarseTimePtr[2] = timePtr[4]; |
|
648 | coarseTimePtr[2] = timePtr[4]; | |
642 | coarseTimePtr[3] = timePtr[5]; |
|
649 | coarseTimePtr[3] = timePtr[5]; | |
643 | fineTimePtr[2] = timePtr[6]; |
|
650 | fineTimePtr[2] = timePtr[6]; | |
644 | fineTimePtr[3] = timePtr[7]; |
|
651 | fineTimePtr[3] = timePtr[7]; | |
645 | if (rtems_event_send( task_id, RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
652 | if (rtems_event_send( avf_task_id, RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |
646 | { |
|
653 | { | |
647 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
654 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |
648 | } |
|
655 | } | |
649 | *nb_sm = 0; |
|
656 | *nb_sm = 0; | |
650 | } |
|
657 | } | |
651 | } |
|
658 | } | |
652 |
|
659 | |||
653 | unsigned char getSID( rtems_event_set event ) |
|
660 | unsigned char getSID( rtems_event_set event ) | |
654 | { |
|
661 | { | |
655 | unsigned char sid; |
|
662 | unsigned char sid; | |
656 |
|
663 | |||
657 | rtems_event_set eventSetBURST; |
|
664 | rtems_event_set eventSetBURST; | |
658 | rtems_event_set eventSetSBM; |
|
665 | rtems_event_set eventSetSBM; | |
659 |
|
666 | |||
660 | //****** |
|
667 | //****** | |
661 | // BURST |
|
668 | // BURST | |
662 | eventSetBURST = RTEMS_EVENT_BURST_BP1_F0 |
|
669 | eventSetBURST = RTEMS_EVENT_BURST_BP1_F0 | |
663 | | RTEMS_EVENT_BURST_BP1_F1 |
|
670 | | RTEMS_EVENT_BURST_BP1_F1 | |
664 | | RTEMS_EVENT_BURST_BP2_F0 |
|
671 | | RTEMS_EVENT_BURST_BP2_F0 | |
665 | | RTEMS_EVENT_BURST_BP2_F1; |
|
672 | | RTEMS_EVENT_BURST_BP2_F1; | |
666 |
|
673 | |||
667 | //**** |
|
674 | //**** | |
668 | // SBM |
|
675 | // SBM | |
669 | eventSetSBM = RTEMS_EVENT_SBM_BP1_F0 |
|
676 | eventSetSBM = RTEMS_EVENT_SBM_BP1_F0 | |
670 | | RTEMS_EVENT_SBM_BP1_F1 |
|
677 | | RTEMS_EVENT_SBM_BP1_F1 | |
671 | | RTEMS_EVENT_SBM_BP2_F0 |
|
678 | | RTEMS_EVENT_SBM_BP2_F0 | |
672 | | RTEMS_EVENT_SBM_BP2_F1; |
|
679 | | RTEMS_EVENT_SBM_BP2_F1; | |
673 |
|
680 | |||
674 | if (event & eventSetBURST) |
|
681 | if (event & eventSetBURST) | |
675 | { |
|
682 | { | |
676 | sid = SID_BURST_BP1_F0; |
|
683 | sid = SID_BURST_BP1_F0; | |
677 | } |
|
684 | } | |
678 | else if (event & eventSetSBM) |
|
685 | else if (event & eventSetSBM) | |
679 | { |
|
686 | { | |
680 | sid = SID_SBM1_BP1_F0; |
|
687 | sid = SID_SBM1_BP1_F0; | |
681 | } |
|
688 | } | |
682 | else |
|
689 | else | |
683 | { |
|
690 | { | |
684 | sid = 0; |
|
691 | sid = 0; | |
685 | } |
|
692 | } | |
686 |
|
693 | |||
687 | return sid; |
|
694 | return sid; | |
688 | } |
|
695 | } | |
689 |
|
696 |
@@ -1,948 +1,949 | |||||
1 | /** Functions and tasks related to TeleCommand handling. |
|
1 | /** Functions and tasks related to TeleCommand handling. | |
2 | * |
|
2 | * | |
3 | * @file |
|
3 | * @file | |
4 | * @author P. LEROY |
|
4 | * @author P. LEROY | |
5 | * |
|
5 | * | |
6 | * A group of functions to handle TeleCommands:\n |
|
6 | * A group of functions to handle TeleCommands:\n | |
7 | * action launching\n |
|
7 | * action launching\n | |
8 | * TC parsing\n |
|
8 | * TC parsing\n | |
9 | * ... |
|
9 | * ... | |
10 | * |
|
10 | * | |
11 | */ |
|
11 | */ | |
12 |
|
12 | |||
13 | #include "tc_handler.h" |
|
13 | #include "tc_handler.h" | |
14 |
|
14 | |||
15 | //*********** |
|
15 | //*********** | |
16 | // RTEMS TASK |
|
16 | // RTEMS TASK | |
17 |
|
17 | |||
18 | rtems_task actn_task( rtems_task_argument unused ) |
|
18 | rtems_task actn_task( rtems_task_argument unused ) | |
19 | { |
|
19 | { | |
20 | /** This RTEMS task is responsible for launching actions upton the reception of valid TeleCommands. |
|
20 | /** This RTEMS task is responsible for launching actions upton the reception of valid TeleCommands. | |
21 | * |
|
21 | * | |
22 | * @param unused is the starting argument of the RTEMS task |
|
22 | * @param unused is the starting argument of the RTEMS task | |
23 | * |
|
23 | * | |
24 | * The ACTN task waits for data coming from an RTEMS msesage queue. When data arrives, it launches specific actions depending |
|
24 | * The ACTN task waits for data coming from an RTEMS msesage queue. When data arrives, it launches specific actions depending | |
25 | * on the incoming TeleCommand. |
|
25 | * on the incoming TeleCommand. | |
26 | * |
|
26 | * | |
27 | */ |
|
27 | */ | |
28 |
|
28 | |||
29 | int result; |
|
29 | int result; | |
30 | rtems_status_code status; // RTEMS status code |
|
30 | rtems_status_code status; // RTEMS status code | |
31 | ccsdsTelecommandPacket_t TC; // TC sent to the ACTN task |
|
31 | ccsdsTelecommandPacket_t TC; // TC sent to the ACTN task | |
32 | size_t size; // size of the incoming TC packet |
|
32 | size_t size; // size of the incoming TC packet | |
33 | unsigned char subtype; // subtype of the current TC packet |
|
33 | unsigned char subtype; // subtype of the current TC packet | |
34 | unsigned char time[6]; |
|
34 | unsigned char time[6]; | |
35 | rtems_id queue_rcv_id; |
|
35 | rtems_id queue_rcv_id; | |
36 | rtems_id queue_snd_id; |
|
36 | rtems_id queue_snd_id; | |
37 |
|
37 | |||
38 | status = get_message_queue_id_recv( &queue_rcv_id ); |
|
38 | status = get_message_queue_id_recv( &queue_rcv_id ); | |
39 | if (status != RTEMS_SUCCESSFUL) |
|
39 | if (status != RTEMS_SUCCESSFUL) | |
40 | { |
|
40 | { | |
41 | PRINTF1("in ACTN *** ERR get_message_queue_id_recv %d\n", status) |
|
41 | PRINTF1("in ACTN *** ERR get_message_queue_id_recv %d\n", status) | |
42 | } |
|
42 | } | |
43 |
|
43 | |||
44 | status = get_message_queue_id_send( &queue_snd_id ); |
|
44 | status = get_message_queue_id_send( &queue_snd_id ); | |
45 | if (status != RTEMS_SUCCESSFUL) |
|
45 | if (status != RTEMS_SUCCESSFUL) | |
46 | { |
|
46 | { | |
47 | PRINTF1("in ACTN *** ERR get_message_queue_id_send %d\n", status) |
|
47 | PRINTF1("in ACTN *** ERR get_message_queue_id_send %d\n", status) | |
48 | } |
|
48 | } | |
49 |
|
49 | |||
50 | result = LFR_SUCCESSFUL; |
|
50 | result = LFR_SUCCESSFUL; | |
51 | subtype = 0; // subtype of the current TC packet |
|
51 | subtype = 0; // subtype of the current TC packet | |
52 |
|
52 | |||
53 | BOOT_PRINTF("in ACTN *** \n") |
|
53 | BOOT_PRINTF("in ACTN *** \n") | |
54 |
|
54 | |||
55 | while(1) |
|
55 | while(1) | |
56 | { |
|
56 | { | |
57 | status = rtems_message_queue_receive( queue_rcv_id, (char*) &TC, &size, |
|
57 | status = rtems_message_queue_receive( queue_rcv_id, (char*) &TC, &size, | |
58 | RTEMS_WAIT, RTEMS_NO_TIMEOUT); |
|
58 | RTEMS_WAIT, RTEMS_NO_TIMEOUT); | |
59 | getTime( time ); // set time to the current time |
|
59 | getTime( time ); // set time to the current time | |
60 | if (status!=RTEMS_SUCCESSFUL) |
|
60 | if (status!=RTEMS_SUCCESSFUL) | |
61 | { |
|
61 | { | |
62 | PRINTF1("ERR *** in task ACTN *** error receiving a message, code %d \n", status) |
|
62 | PRINTF1("ERR *** in task ACTN *** error receiving a message, code %d \n", status) | |
63 | } |
|
63 | } | |
64 | else |
|
64 | else | |
65 | { |
|
65 | { | |
66 | subtype = TC.serviceSubType; |
|
66 | subtype = TC.serviceSubType; | |
67 | switch(subtype) |
|
67 | switch(subtype) | |
68 | { |
|
68 | { | |
69 | case TC_SUBTYPE_RESET: |
|
69 | case TC_SUBTYPE_RESET: | |
70 | result = action_reset( &TC, queue_snd_id, time ); |
|
70 | result = action_reset( &TC, queue_snd_id, time ); | |
71 | close_action( &TC, result, queue_snd_id ); |
|
71 | close_action( &TC, result, queue_snd_id ); | |
72 | break; |
|
72 | break; | |
73 | // |
|
73 | // | |
74 | case TC_SUBTYPE_LOAD_COMM: |
|
74 | case TC_SUBTYPE_LOAD_COMM: | |
75 | result = action_load_common_par( &TC ); |
|
75 | result = action_load_common_par( &TC ); | |
76 | close_action( &TC, result, queue_snd_id ); |
|
76 | close_action( &TC, result, queue_snd_id ); | |
77 | break; |
|
77 | break; | |
78 | // |
|
78 | // | |
79 | case TC_SUBTYPE_LOAD_NORM: |
|
79 | case TC_SUBTYPE_LOAD_NORM: | |
80 | result = action_load_normal_par( &TC, queue_snd_id, time ); |
|
80 | result = action_load_normal_par( &TC, queue_snd_id, time ); | |
81 | close_action( &TC, result, queue_snd_id ); |
|
81 | close_action( &TC, result, queue_snd_id ); | |
82 | break; |
|
82 | break; | |
83 | // |
|
83 | // | |
84 | case TC_SUBTYPE_LOAD_BURST: |
|
84 | case TC_SUBTYPE_LOAD_BURST: | |
85 | result = action_load_burst_par( &TC, queue_snd_id, time ); |
|
85 | result = action_load_burst_par( &TC, queue_snd_id, time ); | |
86 | close_action( &TC, result, queue_snd_id ); |
|
86 | close_action( &TC, result, queue_snd_id ); | |
87 | break; |
|
87 | break; | |
88 | // |
|
88 | // | |
89 | case TC_SUBTYPE_LOAD_SBM1: |
|
89 | case TC_SUBTYPE_LOAD_SBM1: | |
90 | result = action_load_sbm1_par( &TC, queue_snd_id, time ); |
|
90 | result = action_load_sbm1_par( &TC, queue_snd_id, time ); | |
91 | close_action( &TC, result, queue_snd_id ); |
|
91 | close_action( &TC, result, queue_snd_id ); | |
92 | break; |
|
92 | break; | |
93 | // |
|
93 | // | |
94 | case TC_SUBTYPE_LOAD_SBM2: |
|
94 | case TC_SUBTYPE_LOAD_SBM2: | |
95 | result = action_load_sbm2_par( &TC, queue_snd_id, time ); |
|
95 | result = action_load_sbm2_par( &TC, queue_snd_id, time ); | |
96 | close_action( &TC, result, queue_snd_id ); |
|
96 | close_action( &TC, result, queue_snd_id ); | |
97 | break; |
|
97 | break; | |
98 | // |
|
98 | // | |
99 | case TC_SUBTYPE_DUMP: |
|
99 | case TC_SUBTYPE_DUMP: | |
100 | result = action_dump_par( queue_snd_id ); |
|
100 | result = action_dump_par( queue_snd_id ); | |
101 | close_action( &TC, result, queue_snd_id ); |
|
101 | close_action( &TC, result, queue_snd_id ); | |
102 | break; |
|
102 | break; | |
103 | // |
|
103 | // | |
104 | case TC_SUBTYPE_ENTER: |
|
104 | case TC_SUBTYPE_ENTER: | |
105 | result = action_enter_mode( &TC, queue_snd_id ); |
|
105 | result = action_enter_mode( &TC, queue_snd_id ); | |
106 | close_action( &TC, result, queue_snd_id ); |
|
106 | close_action( &TC, result, queue_snd_id ); | |
107 | break; |
|
107 | break; | |
108 | // |
|
108 | // | |
109 | case TC_SUBTYPE_UPDT_INFO: |
|
109 | case TC_SUBTYPE_UPDT_INFO: | |
110 | result = action_update_info( &TC, queue_snd_id ); |
|
110 | result = action_update_info( &TC, queue_snd_id ); | |
111 | close_action( &TC, result, queue_snd_id ); |
|
111 | close_action( &TC, result, queue_snd_id ); | |
112 | break; |
|
112 | break; | |
113 | // |
|
113 | // | |
114 | case TC_SUBTYPE_EN_CAL: |
|
114 | case TC_SUBTYPE_EN_CAL: | |
115 | result = action_enable_calibration( &TC, queue_snd_id, time ); |
|
115 | result = action_enable_calibration( &TC, queue_snd_id, time ); | |
116 | close_action( &TC, result, queue_snd_id ); |
|
116 | close_action( &TC, result, queue_snd_id ); | |
117 | break; |
|
117 | break; | |
118 | // |
|
118 | // | |
119 | case TC_SUBTYPE_DIS_CAL: |
|
119 | case TC_SUBTYPE_DIS_CAL: | |
120 | result = action_disable_calibration( &TC, queue_snd_id, time ); |
|
120 | result = action_disable_calibration( &TC, queue_snd_id, time ); | |
121 | close_action( &TC, result, queue_snd_id ); |
|
121 | close_action( &TC, result, queue_snd_id ); | |
122 | break; |
|
122 | break; | |
123 | // |
|
123 | // | |
124 | case TC_SUBTYPE_UPDT_TIME: |
|
124 | case TC_SUBTYPE_UPDT_TIME: | |
125 | result = action_update_time( &TC ); |
|
125 | result = action_update_time( &TC ); | |
126 | close_action( &TC, result, queue_snd_id ); |
|
126 | close_action( &TC, result, queue_snd_id ); | |
127 | break; |
|
127 | break; | |
128 | // |
|
128 | // | |
129 | default: |
|
129 | default: | |
130 | break; |
|
130 | break; | |
131 | } |
|
131 | } | |
132 | } |
|
132 | } | |
133 | } |
|
133 | } | |
134 | } |
|
134 | } | |
135 |
|
135 | |||
136 | //*********** |
|
136 | //*********** | |
137 | // TC ACTIONS |
|
137 | // TC ACTIONS | |
138 |
|
138 | |||
139 | int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
139 | int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) | |
140 | { |
|
140 | { | |
141 | /** This function executes specific actions when a TC_LFR_RESET TeleCommand has been received. |
|
141 | /** This function executes specific actions when a TC_LFR_RESET TeleCommand has been received. | |
142 | * |
|
142 | * | |
143 | * @param TC points to the TeleCommand packet that is being processed |
|
143 | * @param TC points to the TeleCommand packet that is being processed | |
144 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
144 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver | |
145 | * |
|
145 | * | |
146 | */ |
|
146 | */ | |
147 |
|
147 | |||
148 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); |
|
148 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); | |
149 | return LFR_DEFAULT; |
|
149 | return LFR_DEFAULT; | |
150 | } |
|
150 | } | |
151 |
|
151 | |||
152 | int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) |
|
152 | int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) | |
153 | { |
|
153 | { | |
154 | /** This function executes specific actions when a TC_LFR_ENTER_MODE TeleCommand has been received. |
|
154 | /** This function executes specific actions when a TC_LFR_ENTER_MODE TeleCommand has been received. | |
155 | * |
|
155 | * | |
156 | * @param TC points to the TeleCommand packet that is being processed |
|
156 | * @param TC points to the TeleCommand packet that is being processed | |
157 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
157 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver | |
158 | * |
|
158 | * | |
159 | */ |
|
159 | */ | |
160 |
|
160 | |||
161 | rtems_status_code status; |
|
161 | rtems_status_code status; | |
162 | unsigned char requestedMode; |
|
162 | unsigned char requestedMode; | |
163 | unsigned int *transitionCoarseTime_ptr; |
|
163 | unsigned int *transitionCoarseTime_ptr; | |
164 | unsigned int transitionCoarseTime; |
|
164 | unsigned int transitionCoarseTime; | |
165 | unsigned char * bytePosPtr; |
|
165 | unsigned char * bytePosPtr; | |
166 |
|
166 | |||
167 | bytePosPtr = (unsigned char *) &TC->packetID; |
|
167 | bytePosPtr = (unsigned char *) &TC->packetID; | |
168 |
|
168 | |||
169 | requestedMode = bytePosPtr[ BYTE_POS_CP_MODE_LFR_SET ]; |
|
169 | requestedMode = bytePosPtr[ BYTE_POS_CP_MODE_LFR_SET ]; | |
170 | transitionCoarseTime_ptr = (unsigned int *) ( &bytePosPtr[ BYTE_POS_CP_LFR_ENTER_MODE_TIME ] ); |
|
170 | transitionCoarseTime_ptr = (unsigned int *) ( &bytePosPtr[ BYTE_POS_CP_LFR_ENTER_MODE_TIME ] ); | |
171 | transitionCoarseTime = (*transitionCoarseTime_ptr) & 0x7fffffff; |
|
171 | transitionCoarseTime = (*transitionCoarseTime_ptr) & 0x7fffffff; | |
172 |
|
172 | |||
173 | status = check_mode_value( requestedMode ); |
|
173 | status = check_mode_value( requestedMode ); | |
174 |
|
174 | |||
175 | if ( status != LFR_SUCCESSFUL ) // the mode value is inconsistent |
|
175 | if ( status != LFR_SUCCESSFUL ) // the mode value is inconsistent | |
176 | { |
|
176 | { | |
177 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_MODE_LFR_SET, requestedMode ); |
|
177 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_MODE_LFR_SET, requestedMode ); | |
178 | } |
|
178 | } | |
179 | else // the mode value is consistent, check the transition |
|
179 | else // the mode value is consistent, check the transition | |
180 | { |
|
180 | { | |
181 | status = check_mode_transition(requestedMode); |
|
181 | status = check_mode_transition(requestedMode); | |
182 | if (status != LFR_SUCCESSFUL) |
|
182 | if (status != LFR_SUCCESSFUL) | |
183 | { |
|
183 | { | |
184 | PRINTF("ERR *** in action_enter_mode *** check_mode_transition\n") |
|
184 | PRINTF("ERR *** in action_enter_mode *** check_mode_transition\n") | |
185 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); |
|
185 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); | |
186 | } |
|
186 | } | |
187 | } |
|
187 | } | |
188 |
|
188 | |||
189 | if ( status == LFR_SUCCESSFUL ) // the transition is valid, enter the mode |
|
189 | if ( status == LFR_SUCCESSFUL ) // the transition is valid, enter the mode | |
190 | { |
|
190 | { | |
191 | status = check_transition_date( transitionCoarseTime ); |
|
191 | status = check_transition_date( transitionCoarseTime ); | |
192 | if (status != LFR_SUCCESSFUL) |
|
192 | if (status != LFR_SUCCESSFUL) | |
193 | { |
|
193 | { | |
194 | PRINTF("ERR *** in action_enter_mode *** check_transition_date\n") |
|
194 | PRINTF("ERR *** in action_enter_mode *** check_transition_date\n") | |
195 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, |
|
195 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, | |
196 | BYTE_POS_CP_LFR_ENTER_MODE_TIME, |
|
196 | BYTE_POS_CP_LFR_ENTER_MODE_TIME, | |
197 | bytePosPtr[ BYTE_POS_CP_LFR_ENTER_MODE_TIME + 3 ] ); |
|
197 | bytePosPtr[ BYTE_POS_CP_LFR_ENTER_MODE_TIME + 3 ] ); | |
198 | } |
|
198 | } | |
199 | } |
|
199 | } | |
200 |
|
200 | |||
201 | if ( status == LFR_SUCCESSFUL ) // the date is valid, enter the mode |
|
201 | if ( status == LFR_SUCCESSFUL ) // the date is valid, enter the mode | |
202 | { |
|
202 | { | |
203 | PRINTF1("OK *** in action_enter_mode *** enter mode %d\n", requestedMode); |
|
203 | PRINTF1("OK *** in action_enter_mode *** enter mode %d\n", requestedMode); | |
204 | status = enter_mode( requestedMode, transitionCoarseTime ); |
|
204 | status = enter_mode( requestedMode, transitionCoarseTime ); | |
205 | } |
|
205 | } | |
206 |
|
206 | |||
207 | return status; |
|
207 | return status; | |
208 | } |
|
208 | } | |
209 |
|
209 | |||
210 | int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
210 | int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) | |
211 | { |
|
211 | { | |
212 | /** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received. |
|
212 | /** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received. | |
213 | * |
|
213 | * | |
214 | * @param TC points to the TeleCommand packet that is being processed |
|
214 | * @param TC points to the TeleCommand packet that is being processed | |
215 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
215 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver | |
216 | * |
|
216 | * | |
217 | * @return LFR directive status code: |
|
217 | * @return LFR directive status code: | |
218 | * - LFR_DEFAULT |
|
218 | * - LFR_DEFAULT | |
219 | * - LFR_SUCCESSFUL |
|
219 | * - LFR_SUCCESSFUL | |
220 | * |
|
220 | * | |
221 | */ |
|
221 | */ | |
222 |
|
222 | |||
223 | unsigned int val; |
|
223 | unsigned int val; | |
224 | int result; |
|
224 | int result; | |
225 | unsigned int status; |
|
225 | unsigned int status; | |
226 | unsigned char mode; |
|
226 | unsigned char mode; | |
227 | unsigned char * bytePosPtr; |
|
227 | unsigned char * bytePosPtr; | |
228 |
|
228 | |||
229 | bytePosPtr = (unsigned char *) &TC->packetID; |
|
229 | bytePosPtr = (unsigned char *) &TC->packetID; | |
230 |
|
230 | |||
231 | // check LFR mode |
|
231 | // check LFR mode | |
232 | mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET5 ] & 0x1e) >> 1; |
|
232 | mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET5 ] & 0x1e) >> 1; | |
233 | status = check_update_info_hk_lfr_mode( mode ); |
|
233 | status = check_update_info_hk_lfr_mode( mode ); | |
234 | if (status == LFR_SUCCESSFUL) // check TDS mode |
|
234 | if (status == LFR_SUCCESSFUL) // check TDS mode | |
235 | { |
|
235 | { | |
236 | mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 ] & 0xf0) >> 4; |
|
236 | mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 ] & 0xf0) >> 4; | |
237 | status = check_update_info_hk_tds_mode( mode ); |
|
237 | status = check_update_info_hk_tds_mode( mode ); | |
238 | } |
|
238 | } | |
239 | if (status == LFR_SUCCESSFUL) // check THR mode |
|
239 | if (status == LFR_SUCCESSFUL) // check THR mode | |
240 | { |
|
240 | { | |
241 | mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 ] & 0x0f); |
|
241 | mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 ] & 0x0f); | |
242 | status = check_update_info_hk_thr_mode( mode ); |
|
242 | status = check_update_info_hk_thr_mode( mode ); | |
243 | } |
|
243 | } | |
244 | if (status == LFR_SUCCESSFUL) // if the parameter check is successful |
|
244 | if (status == LFR_SUCCESSFUL) // if the parameter check is successful | |
245 | { |
|
245 | { | |
246 | val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256 |
|
246 | val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256 | |
247 | + housekeeping_packet.hk_lfr_update_info_tc_cnt[1]; |
|
247 | + housekeeping_packet.hk_lfr_update_info_tc_cnt[1]; | |
248 | val++; |
|
248 | val++; | |
249 | housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8); |
|
249 | housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8); | |
250 | housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val); |
|
250 | housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val); | |
251 | } |
|
251 | } | |
252 |
|
252 | |||
253 | result = status; |
|
253 | result = status; | |
254 |
|
254 | |||
255 | return result; |
|
255 | return result; | |
256 | } |
|
256 | } | |
257 |
|
257 | |||
258 | int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
258 | int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) | |
259 | { |
|
259 | { | |
260 | /** This function executes specific actions when a TC_LFR_ENABLE_CALIBRATION TeleCommand has been received. |
|
260 | /** This function executes specific actions when a TC_LFR_ENABLE_CALIBRATION TeleCommand has been received. | |
261 | * |
|
261 | * | |
262 | * @param TC points to the TeleCommand packet that is being processed |
|
262 | * @param TC points to the TeleCommand packet that is being processed | |
263 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
263 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver | |
264 | * |
|
264 | * | |
265 | */ |
|
265 | */ | |
266 |
|
266 | |||
267 | int result; |
|
267 | int result; | |
268 | unsigned char lfrMode; |
|
268 | unsigned char lfrMode; | |
269 |
|
269 | |||
270 | result = LFR_DEFAULT; |
|
270 | result = LFR_DEFAULT; | |
271 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
271 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
272 |
|
272 | |||
273 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); |
|
273 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); | |
274 | result = LFR_DEFAULT; |
|
274 | result = LFR_DEFAULT; | |
275 |
|
275 | |||
276 | return result; |
|
276 | return result; | |
277 | } |
|
277 | } | |
278 |
|
278 | |||
279 | int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
279 | int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) | |
280 | { |
|
280 | { | |
281 | /** This function executes specific actions when a TC_LFR_DISABLE_CALIBRATION TeleCommand has been received. |
|
281 | /** This function executes specific actions when a TC_LFR_DISABLE_CALIBRATION TeleCommand has been received. | |
282 | * |
|
282 | * | |
283 | * @param TC points to the TeleCommand packet that is being processed |
|
283 | * @param TC points to the TeleCommand packet that is being processed | |
284 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
284 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver | |
285 | * |
|
285 | * | |
286 | */ |
|
286 | */ | |
287 |
|
287 | |||
288 | int result; |
|
288 | int result; | |
289 | unsigned char lfrMode; |
|
289 | unsigned char lfrMode; | |
290 |
|
290 | |||
291 | result = LFR_DEFAULT; |
|
291 | result = LFR_DEFAULT; | |
292 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
292 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
293 |
|
293 | |||
294 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); |
|
294 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); | |
295 | result = LFR_DEFAULT; |
|
295 | result = LFR_DEFAULT; | |
296 |
|
296 | |||
297 | return result; |
|
297 | return result; | |
298 | } |
|
298 | } | |
299 |
|
299 | |||
300 | int action_update_time(ccsdsTelecommandPacket_t *TC) |
|
300 | int action_update_time(ccsdsTelecommandPacket_t *TC) | |
301 | { |
|
301 | { | |
302 | /** This function executes specific actions when a TC_LFR_UPDATE_TIME TeleCommand has been received. |
|
302 | /** This function executes specific actions when a TC_LFR_UPDATE_TIME TeleCommand has been received. | |
303 | * |
|
303 | * | |
304 | * @param TC points to the TeleCommand packet that is being processed |
|
304 | * @param TC points to the TeleCommand packet that is being processed | |
305 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
305 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver | |
306 | * |
|
306 | * | |
307 | * @return LFR_SUCCESSFUL |
|
307 | * @return LFR_SUCCESSFUL | |
308 | * |
|
308 | * | |
309 | */ |
|
309 | */ | |
310 |
|
310 | |||
311 | unsigned int val; |
|
311 | unsigned int val; | |
312 |
|
312 | |||
313 | time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24) |
|
313 | time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24) | |
314 | + (TC->dataAndCRC[1] << 16) |
|
314 | + (TC->dataAndCRC[1] << 16) | |
315 | + (TC->dataAndCRC[2] << 8) |
|
315 | + (TC->dataAndCRC[2] << 8) | |
316 | + TC->dataAndCRC[3]; |
|
316 | + TC->dataAndCRC[3]; | |
317 |
|
317 | |||
318 | PRINTF1("time received: %x\n", time_management_regs->coarse_time_load) |
|
318 | PRINTF1("time received: %x\n", time_management_regs->coarse_time_load) | |
319 |
|
319 | |||
320 | val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256 |
|
320 | val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256 | |
321 | + housekeeping_packet.hk_lfr_update_time_tc_cnt[1]; |
|
321 | + housekeeping_packet.hk_lfr_update_time_tc_cnt[1]; | |
322 | val++; |
|
322 | val++; | |
323 | housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8); |
|
323 | housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8); | |
324 | housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val); |
|
324 | housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val); | |
325 | // time_management_regs->ctrl = time_management_regs->ctrl | 1; // force tick |
|
|||
326 |
|
325 | |||
327 | return LFR_SUCCESSFUL; |
|
326 | return LFR_SUCCESSFUL; | |
328 | } |
|
327 | } | |
329 |
|
328 | |||
330 | //******************* |
|
329 | //******************* | |
331 | // ENTERING THE MODES |
|
330 | // ENTERING THE MODES | |
332 | int check_mode_value( unsigned char requestedMode ) |
|
331 | int check_mode_value( unsigned char requestedMode ) | |
333 | { |
|
332 | { | |
334 | int status; |
|
333 | int status; | |
335 |
|
334 | |||
336 | if ( (requestedMode != LFR_MODE_STANDBY) |
|
335 | if ( (requestedMode != LFR_MODE_STANDBY) | |
337 | && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST) |
|
336 | && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST) | |
338 | && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) ) |
|
337 | && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) ) | |
339 | { |
|
338 | { | |
340 | status = LFR_DEFAULT; |
|
339 | status = LFR_DEFAULT; | |
341 | } |
|
340 | } | |
342 | else |
|
341 | else | |
343 | { |
|
342 | { | |
344 | status = LFR_SUCCESSFUL; |
|
343 | status = LFR_SUCCESSFUL; | |
345 | } |
|
344 | } | |
346 |
|
345 | |||
347 | return status; |
|
346 | return status; | |
348 | } |
|
347 | } | |
349 |
|
348 | |||
350 | int check_mode_transition( unsigned char requestedMode ) |
|
349 | int check_mode_transition( unsigned char requestedMode ) | |
351 | { |
|
350 | { | |
352 | /** This function checks the validity of the transition requested by the TC_LFR_ENTER_MODE. |
|
351 | /** This function checks the validity of the transition requested by the TC_LFR_ENTER_MODE. | |
353 | * |
|
352 | * | |
354 | * @param requestedMode is the mode requested by the TC_LFR_ENTER_MODE |
|
353 | * @param requestedMode is the mode requested by the TC_LFR_ENTER_MODE | |
355 | * |
|
354 | * | |
356 | * @return LFR directive status codes: |
|
355 | * @return LFR directive status codes: | |
357 | * - LFR_SUCCESSFUL - the transition is authorized |
|
356 | * - LFR_SUCCESSFUL - the transition is authorized | |
358 | * - LFR_DEFAULT - the transition is not authorized |
|
357 | * - LFR_DEFAULT - the transition is not authorized | |
359 | * |
|
358 | * | |
360 | */ |
|
359 | */ | |
361 |
|
360 | |||
362 | int status; |
|
361 | int status; | |
363 |
|
362 | |||
364 | switch (requestedMode) |
|
363 | switch (requestedMode) | |
365 | { |
|
364 | { | |
366 | case LFR_MODE_STANDBY: |
|
365 | case LFR_MODE_STANDBY: | |
367 | if ( lfrCurrentMode == LFR_MODE_STANDBY ) { |
|
366 | if ( lfrCurrentMode == LFR_MODE_STANDBY ) { | |
368 | status = LFR_DEFAULT; |
|
367 | status = LFR_DEFAULT; | |
369 | } |
|
368 | } | |
370 | else |
|
369 | else | |
371 | { |
|
370 | { | |
372 | status = LFR_SUCCESSFUL; |
|
371 | status = LFR_SUCCESSFUL; | |
373 | } |
|
372 | } | |
374 | break; |
|
373 | break; | |
375 | case LFR_MODE_NORMAL: |
|
374 | case LFR_MODE_NORMAL: | |
376 | if ( lfrCurrentMode == LFR_MODE_NORMAL ) { |
|
375 | if ( lfrCurrentMode == LFR_MODE_NORMAL ) { | |
377 | status = LFR_DEFAULT; |
|
376 | status = LFR_DEFAULT; | |
378 | } |
|
377 | } | |
379 | else { |
|
378 | else { | |
380 | status = LFR_SUCCESSFUL; |
|
379 | status = LFR_SUCCESSFUL; | |
381 | } |
|
380 | } | |
382 | break; |
|
381 | break; | |
383 | case LFR_MODE_BURST: |
|
382 | case LFR_MODE_BURST: | |
384 | if ( lfrCurrentMode == LFR_MODE_BURST ) { |
|
383 | if ( lfrCurrentMode == LFR_MODE_BURST ) { | |
385 | status = LFR_DEFAULT; |
|
384 | status = LFR_DEFAULT; | |
386 | } |
|
385 | } | |
387 | else { |
|
386 | else { | |
388 | status = LFR_SUCCESSFUL; |
|
387 | status = LFR_SUCCESSFUL; | |
389 | } |
|
388 | } | |
390 | break; |
|
389 | break; | |
391 | case LFR_MODE_SBM1: |
|
390 | case LFR_MODE_SBM1: | |
392 | if ( lfrCurrentMode == LFR_MODE_SBM1 ) { |
|
391 | if ( lfrCurrentMode == LFR_MODE_SBM1 ) { | |
393 | status = LFR_DEFAULT; |
|
392 | status = LFR_DEFAULT; | |
394 | } |
|
393 | } | |
395 | else { |
|
394 | else { | |
396 | status = LFR_SUCCESSFUL; |
|
395 | status = LFR_SUCCESSFUL; | |
397 | } |
|
396 | } | |
398 | break; |
|
397 | break; | |
399 | case LFR_MODE_SBM2: |
|
398 | case LFR_MODE_SBM2: | |
400 | if ( lfrCurrentMode == LFR_MODE_SBM2 ) { |
|
399 | if ( lfrCurrentMode == LFR_MODE_SBM2 ) { | |
401 | status = LFR_DEFAULT; |
|
400 | status = LFR_DEFAULT; | |
402 | } |
|
401 | } | |
403 | else { |
|
402 | else { | |
404 | status = LFR_SUCCESSFUL; |
|
403 | status = LFR_SUCCESSFUL; | |
405 | } |
|
404 | } | |
406 | break; |
|
405 | break; | |
407 | default: |
|
406 | default: | |
408 | status = LFR_DEFAULT; |
|
407 | status = LFR_DEFAULT; | |
409 | break; |
|
408 | break; | |
410 | } |
|
409 | } | |
411 |
|
410 | |||
412 | return status; |
|
411 | return status; | |
413 | } |
|
412 | } | |
414 |
|
413 | |||
415 | int check_transition_date( unsigned int transitionCoarseTime ) |
|
414 | int check_transition_date( unsigned int transitionCoarseTime ) | |
416 | { |
|
415 | { | |
417 | int status; |
|
416 | int status; | |
418 | unsigned int localCoarseTime; |
|
417 | unsigned int localCoarseTime; | |
419 | unsigned int deltaCoarseTime; |
|
418 | unsigned int deltaCoarseTime; | |
420 |
|
419 | |||
421 | status = LFR_SUCCESSFUL; |
|
420 | status = LFR_SUCCESSFUL; | |
422 |
|
421 | |||
423 | if (transitionCoarseTime == 0) // transition time = 0 means an instant transition |
|
422 | if (transitionCoarseTime == 0) // transition time = 0 means an instant transition | |
424 | { |
|
423 | { | |
425 | status = LFR_SUCCESSFUL; |
|
424 | status = LFR_SUCCESSFUL; | |
426 | } |
|
425 | } | |
427 | else |
|
426 | else | |
428 | { |
|
427 | { | |
429 | localCoarseTime = time_management_regs->coarse_time & 0x7fffffff; |
|
428 | localCoarseTime = time_management_regs->coarse_time & 0x7fffffff; | |
430 |
|
429 | |||
431 | if ( transitionCoarseTime <= localCoarseTime ) // SSS-CP-EQS-322 |
|
430 | if ( transitionCoarseTime <= localCoarseTime ) // SSS-CP-EQS-322 | |
432 | { |
|
431 | { | |
433 | status = LFR_DEFAULT; |
|
432 | status = LFR_DEFAULT; | |
434 | PRINTF2("ERR *** in check_transition_date *** transition = %x, local = %x\n", transitionCoarseTime, localCoarseTime) |
|
433 | PRINTF2("ERR *** in check_transition_date *** transition = %x, local = %x\n", transitionCoarseTime, localCoarseTime) | |
435 | } |
|
434 | } | |
436 |
|
435 | |||
437 | if (status == LFR_SUCCESSFUL) |
|
436 | if (status == LFR_SUCCESSFUL) | |
438 | { |
|
437 | { | |
439 | deltaCoarseTime = transitionCoarseTime - localCoarseTime; |
|
438 | deltaCoarseTime = transitionCoarseTime - localCoarseTime; | |
440 | if ( deltaCoarseTime > 3 ) // SSS-CP-EQS-323 |
|
439 | if ( deltaCoarseTime > 3 ) // SSS-CP-EQS-323 | |
441 | { |
|
440 | { | |
442 | status = LFR_DEFAULT; |
|
441 | status = LFR_DEFAULT; | |
443 | PRINTF1("ERR *** in check_transition_date *** deltaCoarseTime = %x\n", deltaCoarseTime) |
|
442 | PRINTF1("ERR *** in check_transition_date *** deltaCoarseTime = %x\n", deltaCoarseTime) | |
444 | } |
|
443 | } | |
445 | } |
|
444 | } | |
446 | } |
|
445 | } | |
447 |
|
446 | |||
448 | return status; |
|
447 | return status; | |
449 | } |
|
448 | } | |
450 |
|
449 | |||
451 | int stop_current_mode( void ) |
|
450 | int stop_current_mode( void ) | |
452 | { |
|
451 | { | |
453 | /** This function stops the current mode by masking interrupt lines and suspending science tasks. |
|
452 | /** This function stops the current mode by masking interrupt lines and suspending science tasks. | |
454 | * |
|
453 | * | |
455 | * @return RTEMS directive status codes: |
|
454 | * @return RTEMS directive status codes: | |
456 | * - RTEMS_SUCCESSFUL - task restarted successfully |
|
455 | * - RTEMS_SUCCESSFUL - task restarted successfully | |
457 | * - RTEMS_INVALID_ID - task id invalid |
|
456 | * - RTEMS_INVALID_ID - task id invalid | |
458 | * - RTEMS_ALREADY_SUSPENDED - task already suspended |
|
457 | * - RTEMS_ALREADY_SUSPENDED - task already suspended | |
459 | * |
|
458 | * | |
460 | */ |
|
459 | */ | |
461 |
|
460 | |||
462 | rtems_status_code status; |
|
461 | rtems_status_code status; | |
463 |
|
462 | |||
464 | status = RTEMS_SUCCESSFUL; |
|
463 | status = RTEMS_SUCCESSFUL; | |
465 |
|
464 | |||
466 | // (1) mask interruptions |
|
465 | // (1) mask interruptions | |
467 | LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt |
|
466 | LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt | |
468 | LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt |
|
467 | LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt | |
469 |
|
468 | |||
470 | // (2) clear interruptions |
|
469 | // (2) clear interruptions | |
471 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt |
|
470 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt | |
472 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt |
|
471 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt | |
473 |
|
472 | |||
474 | // (3) reset waveform picker registers |
|
473 | // (3) reset waveform picker registers | |
475 | reset_wfp_burst_enable(); // reset burst and enable bits |
|
474 | reset_wfp_burst_enable(); // reset burst and enable bits | |
476 | reset_wfp_status(); // reset all the status bits |
|
475 | reset_wfp_status(); // reset all the status bits | |
477 |
|
476 | |||
478 | // (4) reset spectral matrices registers |
|
477 | // (4) reset spectral matrices registers | |
479 | set_irq_on_new_ready_matrix( 0 ); // stop the spectral matrices |
|
478 | set_irq_on_new_ready_matrix( 0 ); // stop the spectral matrices | |
480 | set_run_matrix_spectral( 0 ); // run_matrix_spectral is set to 0 |
|
479 | set_run_matrix_spectral( 0 ); // run_matrix_spectral is set to 0 | |
481 | reset_extractSWF(); // reset the extractSWF flag to false |
|
480 | reset_extractSWF(); // reset the extractSWF flag to false | |
482 |
|
481 | |||
483 | // <Spectral Matrices simulator> |
|
482 | // <Spectral Matrices simulator> | |
484 | LEON_Mask_interrupt( IRQ_SM_SIMULATOR ); // mask spectral matrix interrupt simulator |
|
483 | LEON_Mask_interrupt( IRQ_SM_SIMULATOR ); // mask spectral matrix interrupt simulator | |
485 | timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); |
|
484 | timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); | |
486 | LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); // clear spectral matrix interrupt simulator |
|
485 | LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); // clear spectral matrix interrupt simulator | |
487 | // </Spectral Matrices simulator> |
|
486 | // </Spectral Matrices simulator> | |
488 |
|
487 | |||
489 | // suspend several tasks |
|
488 | // suspend several tasks | |
490 | if (lfrCurrentMode != LFR_MODE_STANDBY) { |
|
489 | if (lfrCurrentMode != LFR_MODE_STANDBY) { | |
491 | status = suspend_science_tasks(); |
|
490 | status = suspend_science_tasks(); | |
492 | } |
|
491 | } | |
493 |
|
492 | |||
494 | if (status != RTEMS_SUCCESSFUL) |
|
493 | if (status != RTEMS_SUCCESSFUL) | |
495 | { |
|
494 | { | |
496 | PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status) |
|
495 | PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status) | |
497 | } |
|
496 | } | |
498 |
|
497 | |||
499 | return status; |
|
498 | return status; | |
500 | } |
|
499 | } | |
501 |
|
500 | |||
502 | int enter_mode( unsigned char mode, unsigned int transitionCoarseTime ) |
|
501 | int enter_mode( unsigned char mode, unsigned int transitionCoarseTime ) | |
503 | { |
|
502 | { | |
504 | /** This function is launched after a mode transition validation. |
|
503 | /** This function is launched after a mode transition validation. | |
505 | * |
|
504 | * | |
506 | * @param mode is the mode in which LFR will be put. |
|
505 | * @param mode is the mode in which LFR will be put. | |
507 | * |
|
506 | * | |
508 | * @return RTEMS directive status codes: |
|
507 | * @return RTEMS directive status codes: | |
509 | * - RTEMS_SUCCESSFUL - the mode has been entered successfully |
|
508 | * - RTEMS_SUCCESSFUL - the mode has been entered successfully | |
510 | * - RTEMS_NOT_SATISFIED - the mode has not been entered successfully |
|
509 | * - RTEMS_NOT_SATISFIED - the mode has not been entered successfully | |
511 | * |
|
510 | * | |
512 | */ |
|
511 | */ | |
513 |
|
512 | |||
514 | rtems_status_code status; |
|
513 | rtems_status_code status; | |
515 |
|
514 | |||
516 | //********************** |
|
515 | //********************** | |
517 | // STOP THE CURRENT MODE |
|
516 | // STOP THE CURRENT MODE | |
518 | status = stop_current_mode(); |
|
517 | status = stop_current_mode(); | |
519 | if (status != RTEMS_SUCCESSFUL) |
|
518 | if (status != RTEMS_SUCCESSFUL) | |
520 | { |
|
519 | { | |
521 | PRINTF1("ERR *** in enter_mode *** stop_current_mode with mode = %d\n", mode) |
|
520 | PRINTF1("ERR *** in enter_mode *** stop_current_mode with mode = %d\n", mode) | |
522 | } |
|
521 | } | |
523 |
|
522 | |||
524 | //************************* |
|
523 | //************************* | |
525 | // ENTER THE REQUESTED MODE |
|
524 | // ENTER THE REQUESTED MODE | |
526 | if ( (mode == LFR_MODE_NORMAL) || (mode == LFR_MODE_BURST) |
|
525 | if ( (mode == LFR_MODE_NORMAL) || (mode == LFR_MODE_BURST) | |
527 | || (mode == LFR_MODE_SBM1) || (mode == LFR_MODE_SBM2) ) |
|
526 | || (mode == LFR_MODE_SBM1) || (mode == LFR_MODE_SBM2) ) | |
528 | { |
|
527 | { | |
529 | #ifdef PRINT_TASK_STATISTICS |
|
528 | #ifdef PRINT_TASK_STATISTICS | |
530 | rtems_cpu_usage_reset(); |
|
529 | rtems_cpu_usage_reset(); | |
531 | maxCount = 0; |
|
530 | maxCount = 0; | |
532 | #endif |
|
531 | #endif | |
533 | status = restart_science_tasks( mode ); |
|
532 | status = restart_science_tasks( mode ); | |
534 | launch_waveform_picker( mode, transitionCoarseTime ); |
|
533 | launch_waveform_picker( mode, transitionCoarseTime ); | |
535 | launch_spectral_matrix( ); |
|
534 | launch_spectral_matrix( ); | |
536 | // launch_spectral_matrix_simu( ); |
|
535 | // launch_spectral_matrix_simu( ); | |
537 | } |
|
536 | } | |
538 | else if ( mode == LFR_MODE_STANDBY ) |
|
537 | else if ( mode == LFR_MODE_STANDBY ) | |
539 | { |
|
538 | { | |
540 | #ifdef PRINT_TASK_STATISTICS |
|
539 | #ifdef PRINT_TASK_STATISTICS | |
541 | rtems_cpu_usage_report(); |
|
540 | rtems_cpu_usage_report(); | |
542 | #endif |
|
541 | #endif | |
543 |
|
542 | |||
544 | #ifdef PRINT_STACK_REPORT |
|
543 | #ifdef PRINT_STACK_REPORT | |
545 | PRINTF("stack report selected\n") |
|
544 | PRINTF("stack report selected\n") | |
546 | rtems_stack_checker_report_usage(); |
|
545 | rtems_stack_checker_report_usage(); | |
547 | #endif |
|
546 | #endif | |
548 | PRINTF1("maxCount = %d\n", maxCount) |
|
547 | PRINTF1("maxCount = %d\n", maxCount) | |
549 | } |
|
548 | } | |
550 | else |
|
549 | else | |
551 | { |
|
550 | { | |
552 | status = RTEMS_UNSATISFIED; |
|
551 | status = RTEMS_UNSATISFIED; | |
553 | } |
|
552 | } | |
554 |
|
553 | |||
555 | if (status != RTEMS_SUCCESSFUL) |
|
554 | if (status != RTEMS_SUCCESSFUL) | |
556 | { |
|
555 | { | |
557 | PRINTF1("ERR *** in enter_mode *** status = %d\n", status) |
|
556 | PRINTF1("ERR *** in enter_mode *** status = %d\n", status) | |
558 | status = RTEMS_UNSATISFIED; |
|
557 | status = RTEMS_UNSATISFIED; | |
559 | } |
|
558 | } | |
560 |
|
559 | |||
561 | return status; |
|
560 | return status; | |
562 | } |
|
561 | } | |
563 |
|
562 | |||
564 | int restart_science_tasks(unsigned char lfrRequestedMode ) |
|
563 | int restart_science_tasks(unsigned char lfrRequestedMode ) | |
565 | { |
|
564 | { | |
566 | /** This function is used to restart all science tasks. |
|
565 | /** This function is used to restart all science tasks. | |
567 | * |
|
566 | * | |
568 | * @return RTEMS directive status codes: |
|
567 | * @return RTEMS directive status codes: | |
569 | * - RTEMS_SUCCESSFUL - task restarted successfully |
|
568 | * - RTEMS_SUCCESSFUL - task restarted successfully | |
570 | * - RTEMS_INVALID_ID - task id invalid |
|
569 | * - RTEMS_INVALID_ID - task id invalid | |
571 | * - RTEMS_INCORRECT_STATE - task never started |
|
570 | * - RTEMS_INCORRECT_STATE - task never started | |
572 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task |
|
571 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task | |
573 | * |
|
572 | * | |
574 | * Science tasks are AVF0, PRC0, WFRM, CWF3, CW2, CWF1 |
|
573 | * Science tasks are AVF0, PRC0, WFRM, CWF3, CW2, CWF1 | |
575 | * |
|
574 | * | |
576 | */ |
|
575 | */ | |
577 |
|
576 | |||
578 | rtems_status_code status[10]; |
|
577 | rtems_status_code status[10]; | |
579 | rtems_status_code ret; |
|
578 | rtems_status_code ret; | |
580 |
|
579 | |||
581 | ret = RTEMS_SUCCESSFUL; |
|
580 | ret = RTEMS_SUCCESSFUL; | |
582 |
|
581 | |||
583 | status[0] = rtems_task_restart( Task_id[TASKID_AVF0], lfrRequestedMode ); |
|
582 | status[0] = rtems_task_restart( Task_id[TASKID_AVF0], lfrRequestedMode ); | |
584 | if (status[0] != RTEMS_SUCCESSFUL) |
|
583 | if (status[0] != RTEMS_SUCCESSFUL) | |
585 | { |
|
584 | { | |
586 | PRINTF1("in restart_science_task *** AVF0 ERR %d\n", status[0]) |
|
585 | PRINTF1("in restart_science_task *** AVF0 ERR %d\n", status[0]) | |
587 | } |
|
586 | } | |
588 |
|
587 | |||
589 | status[1] = rtems_task_restart( Task_id[TASKID_PRC0], lfrRequestedMode ); |
|
588 | status[1] = rtems_task_restart( Task_id[TASKID_PRC0], lfrRequestedMode ); | |
590 | if (status[1] != RTEMS_SUCCESSFUL) |
|
589 | if (status[1] != RTEMS_SUCCESSFUL) | |
591 | { |
|
590 | { | |
592 | PRINTF1("in restart_science_task *** PRC0 ERR %d\n", status[1]) |
|
591 | PRINTF1("in restart_science_task *** PRC0 ERR %d\n", status[1]) | |
593 | } |
|
592 | } | |
594 |
|
593 | |||
595 | status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 ); |
|
594 | status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 ); | |
596 | if (status[2] != RTEMS_SUCCESSFUL) |
|
595 | if (status[2] != RTEMS_SUCCESSFUL) | |
597 | { |
|
596 | { | |
598 | PRINTF1("in restart_science_task *** WFRM ERR %d\n", status[2]) |
|
597 | PRINTF1("in restart_science_task *** WFRM ERR %d\n", status[2]) | |
599 | } |
|
598 | } | |
600 |
|
599 | |||
601 | status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 ); |
|
600 | status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 ); | |
602 | if (status[3] != RTEMS_SUCCESSFUL) |
|
601 | if (status[3] != RTEMS_SUCCESSFUL) | |
603 | { |
|
602 | { | |
604 | PRINTF1("in restart_science_task *** CWF3 ERR %d\n", status[3]) |
|
603 | PRINTF1("in restart_science_task *** CWF3 ERR %d\n", status[3]) | |
605 | } |
|
604 | } | |
606 |
|
605 | |||
607 | status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 ); |
|
606 | status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 ); | |
608 | if (status[4] != RTEMS_SUCCESSFUL) |
|
607 | if (status[4] != RTEMS_SUCCESSFUL) | |
609 | { |
|
608 | { | |
610 | PRINTF1("in restart_science_task *** CWF2 ERR %d\n", status[4]) |
|
609 | PRINTF1("in restart_science_task *** CWF2 ERR %d\n", status[4]) | |
611 | } |
|
610 | } | |
612 |
|
611 | |||
613 | status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 ); |
|
612 | status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 ); | |
614 | if (status[5] != RTEMS_SUCCESSFUL) |
|
613 | if (status[5] != RTEMS_SUCCESSFUL) | |
615 | { |
|
614 | { | |
616 | PRINTF1("in restart_science_task *** CWF1 ERR %d\n", status[5]) |
|
615 | PRINTF1("in restart_science_task *** CWF1 ERR %d\n", status[5]) | |
617 | } |
|
616 | } | |
618 |
|
617 | |||
619 | status[6] = rtems_task_restart( Task_id[TASKID_AVF1], lfrRequestedMode ); |
|
618 | status[6] = rtems_task_restart( Task_id[TASKID_AVF1], lfrRequestedMode ); | |
620 | if (status[6] != RTEMS_SUCCESSFUL) |
|
619 | if (status[6] != RTEMS_SUCCESSFUL) | |
621 | { |
|
620 | { | |
622 | PRINTF1("in restart_science_task *** AVF1 ERR %d\n", status[6]) |
|
621 | PRINTF1("in restart_science_task *** AVF1 ERR %d\n", status[6]) | |
623 | } |
|
622 | } | |
624 |
|
623 | |||
625 | status[7] = rtems_task_restart( Task_id[TASKID_PRC1],lfrRequestedMode ); |
|
624 | status[7] = rtems_task_restart( Task_id[TASKID_PRC1],lfrRequestedMode ); | |
626 | if (status[7] != RTEMS_SUCCESSFUL) |
|
625 | if (status[7] != RTEMS_SUCCESSFUL) | |
627 | { |
|
626 | { | |
628 | PRINTF1("in restart_science_task *** PRC1 ERR %d\n", status[7]) |
|
627 | PRINTF1("in restart_science_task *** PRC1 ERR %d\n", status[7]) | |
629 | } |
|
628 | } | |
630 |
|
629 | |||
631 | status[8] = rtems_task_restart( Task_id[TASKID_AVF2], 1 ); |
|
630 | status[8] = rtems_task_restart( Task_id[TASKID_AVF2], 1 ); | |
632 | if (status[8] != RTEMS_SUCCESSFUL) |
|
631 | if (status[8] != RTEMS_SUCCESSFUL) | |
633 | { |
|
632 | { | |
634 | PRINTF1("in restart_science_task *** AVF2 ERR %d\n", status[8]) |
|
633 | PRINTF1("in restart_science_task *** AVF2 ERR %d\n", status[8]) | |
635 | } |
|
634 | } | |
636 |
|
635 | |||
637 | status[9] = rtems_task_restart( Task_id[TASKID_PRC2], 1 ); |
|
636 | status[9] = rtems_task_restart( Task_id[TASKID_PRC2], 1 ); | |
638 | if (status[9] != RTEMS_SUCCESSFUL) |
|
637 | if (status[9] != RTEMS_SUCCESSFUL) | |
639 | { |
|
638 | { | |
640 | PRINTF1("in restart_science_task *** PRC2 ERR %d\n", status[9]) |
|
639 | PRINTF1("in restart_science_task *** PRC2 ERR %d\n", status[9]) | |
641 | } |
|
640 | } | |
642 |
|
641 | |||
643 | if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) || |
|
642 | if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) || | |
644 | (status[2] != RTEMS_SUCCESSFUL) || (status[3] != RTEMS_SUCCESSFUL) || |
|
643 | (status[2] != RTEMS_SUCCESSFUL) || (status[3] != RTEMS_SUCCESSFUL) || | |
645 | (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) || |
|
644 | (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) || | |
646 | (status[6] != RTEMS_SUCCESSFUL) || (status[7] != RTEMS_SUCCESSFUL) || |
|
645 | (status[6] != RTEMS_SUCCESSFUL) || (status[7] != RTEMS_SUCCESSFUL) || | |
647 | (status[8] != RTEMS_SUCCESSFUL) || (status[9] != RTEMS_SUCCESSFUL) ) |
|
646 | (status[8] != RTEMS_SUCCESSFUL) || (status[9] != RTEMS_SUCCESSFUL) ) | |
648 | { |
|
647 | { | |
649 | ret = RTEMS_UNSATISFIED; |
|
648 | ret = RTEMS_UNSATISFIED; | |
650 | } |
|
649 | } | |
651 |
|
650 | |||
652 | return ret; |
|
651 | return ret; | |
653 | } |
|
652 | } | |
654 |
|
653 | |||
655 | int suspend_science_tasks() |
|
654 | int suspend_science_tasks() | |
656 | { |
|
655 | { | |
657 | /** This function suspends the science tasks. |
|
656 | /** This function suspends the science tasks. | |
658 | * |
|
657 | * | |
659 | * @return RTEMS directive status codes: |
|
658 | * @return RTEMS directive status codes: | |
660 | * - RTEMS_SUCCESSFUL - task restarted successfully |
|
659 | * - RTEMS_SUCCESSFUL - task restarted successfully | |
661 | * - RTEMS_INVALID_ID - task id invalid |
|
660 | * - RTEMS_INVALID_ID - task id invalid | |
662 | * - RTEMS_ALREADY_SUSPENDED - task already suspended |
|
661 | * - RTEMS_ALREADY_SUSPENDED - task already suspended | |
663 | * |
|
662 | * | |
664 | */ |
|
663 | */ | |
665 |
|
664 | |||
666 | rtems_status_code status; |
|
665 | rtems_status_code status; | |
667 |
|
666 | |||
668 | status = rtems_task_suspend( Task_id[TASKID_AVF0] ); // suspend AVF0 |
|
667 | status = rtems_task_suspend( Task_id[TASKID_AVF0] ); // suspend AVF0 | |
669 | if (status != RTEMS_SUCCESSFUL) |
|
668 | if (status != RTEMS_SUCCESSFUL) | |
670 | { |
|
669 | { | |
671 | PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status) |
|
670 | PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status) | |
672 | } |
|
671 | } | |
673 | if (status == RTEMS_SUCCESSFUL) // suspend PRC0 |
|
672 | if (status == RTEMS_SUCCESSFUL) // suspend PRC0 | |
674 | { |
|
673 | { | |
675 | status = rtems_task_suspend( Task_id[TASKID_PRC0] ); |
|
674 | status = rtems_task_suspend( Task_id[TASKID_PRC0] ); | |
676 | if (status != RTEMS_SUCCESSFUL) |
|
675 | if (status != RTEMS_SUCCESSFUL) | |
677 | { |
|
676 | { | |
678 | PRINTF1("in suspend_science_task *** PRC0 ERR %d\n", status) |
|
677 | PRINTF1("in suspend_science_task *** PRC0 ERR %d\n", status) | |
679 | } |
|
678 | } | |
680 | } |
|
679 | } | |
681 | if (status == RTEMS_SUCCESSFUL) // suspend AVF1 |
|
680 | if (status == RTEMS_SUCCESSFUL) // suspend AVF1 | |
682 | { |
|
681 | { | |
683 | status = rtems_task_suspend( Task_id[TASKID_AVF1] ); |
|
682 | status = rtems_task_suspend( Task_id[TASKID_AVF1] ); | |
684 | if (status != RTEMS_SUCCESSFUL) |
|
683 | if (status != RTEMS_SUCCESSFUL) | |
685 | { |
|
684 | { | |
686 | PRINTF1("in suspend_science_task *** AVF1 ERR %d\n", status) |
|
685 | PRINTF1("in suspend_science_task *** AVF1 ERR %d\n", status) | |
687 | } |
|
686 | } | |
688 | } |
|
687 | } | |
689 | if (status == RTEMS_SUCCESSFUL) // suspend PRC1 |
|
688 | if (status == RTEMS_SUCCESSFUL) // suspend PRC1 | |
690 | { |
|
689 | { | |
691 | status = rtems_task_suspend( Task_id[TASKID_PRC1] ); |
|
690 | status = rtems_task_suspend( Task_id[TASKID_PRC1] ); | |
692 | if (status != RTEMS_SUCCESSFUL) |
|
691 | if (status != RTEMS_SUCCESSFUL) | |
693 | { |
|
692 | { | |
694 | PRINTF1("in suspend_science_task *** PRC1 ERR %d\n", status) |
|
693 | PRINTF1("in suspend_science_task *** PRC1 ERR %d\n", status) | |
695 | } |
|
694 | } | |
696 | } |
|
695 | } | |
697 | if (status == RTEMS_SUCCESSFUL) // suspend AVF2 |
|
696 | if (status == RTEMS_SUCCESSFUL) // suspend AVF2 | |
698 | { |
|
697 | { | |
699 | status = rtems_task_suspend( Task_id[TASKID_AVF2] ); |
|
698 | status = rtems_task_suspend( Task_id[TASKID_AVF2] ); | |
700 | if (status != RTEMS_SUCCESSFUL) |
|
699 | if (status != RTEMS_SUCCESSFUL) | |
701 | { |
|
700 | { | |
702 | PRINTF1("in suspend_science_task *** AVF2 ERR %d\n", status) |
|
701 | PRINTF1("in suspend_science_task *** AVF2 ERR %d\n", status) | |
703 | } |
|
702 | } | |
704 | } |
|
703 | } | |
705 | if (status == RTEMS_SUCCESSFUL) // suspend PRC2 |
|
704 | if (status == RTEMS_SUCCESSFUL) // suspend PRC2 | |
706 | { |
|
705 | { | |
707 | status = rtems_task_suspend( Task_id[TASKID_PRC2] ); |
|
706 | status = rtems_task_suspend( Task_id[TASKID_PRC2] ); | |
708 | if (status != RTEMS_SUCCESSFUL) |
|
707 | if (status != RTEMS_SUCCESSFUL) | |
709 | { |
|
708 | { | |
710 | PRINTF1("in suspend_science_task *** PRC2 ERR %d\n", status) |
|
709 | PRINTF1("in suspend_science_task *** PRC2 ERR %d\n", status) | |
711 | } |
|
710 | } | |
712 | } |
|
711 | } | |
713 | if (status == RTEMS_SUCCESSFUL) // suspend WFRM |
|
712 | if (status == RTEMS_SUCCESSFUL) // suspend WFRM | |
714 | { |
|
713 | { | |
715 | status = rtems_task_suspend( Task_id[TASKID_WFRM] ); |
|
714 | status = rtems_task_suspend( Task_id[TASKID_WFRM] ); | |
716 | if (status != RTEMS_SUCCESSFUL) |
|
715 | if (status != RTEMS_SUCCESSFUL) | |
717 | { |
|
716 | { | |
718 | PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status) |
|
717 | PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status) | |
719 | } |
|
718 | } | |
720 | } |
|
719 | } | |
721 | if (status == RTEMS_SUCCESSFUL) // suspend CWF3 |
|
720 | if (status == RTEMS_SUCCESSFUL) // suspend CWF3 | |
722 | { |
|
721 | { | |
723 | status = rtems_task_suspend( Task_id[TASKID_CWF3] ); |
|
722 | status = rtems_task_suspend( Task_id[TASKID_CWF3] ); | |
724 | if (status != RTEMS_SUCCESSFUL) |
|
723 | if (status != RTEMS_SUCCESSFUL) | |
725 | { |
|
724 | { | |
726 | PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status) |
|
725 | PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status) | |
727 | } |
|
726 | } | |
728 | } |
|
727 | } | |
729 | if (status == RTEMS_SUCCESSFUL) // suspend CWF2 |
|
728 | if (status == RTEMS_SUCCESSFUL) // suspend CWF2 | |
730 | { |
|
729 | { | |
731 | status = rtems_task_suspend( Task_id[TASKID_CWF2] ); |
|
730 | status = rtems_task_suspend( Task_id[TASKID_CWF2] ); | |
732 | if (status != RTEMS_SUCCESSFUL) |
|
731 | if (status != RTEMS_SUCCESSFUL) | |
733 | { |
|
732 | { | |
734 | PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status) |
|
733 | PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status) | |
735 | } |
|
734 | } | |
736 | } |
|
735 | } | |
737 | if (status == RTEMS_SUCCESSFUL) // suspend CWF1 |
|
736 | if (status == RTEMS_SUCCESSFUL) // suspend CWF1 | |
738 | { |
|
737 | { | |
739 | status = rtems_task_suspend( Task_id[TASKID_CWF1] ); |
|
738 | status = rtems_task_suspend( Task_id[TASKID_CWF1] ); | |
740 | if (status != RTEMS_SUCCESSFUL) |
|
739 | if (status != RTEMS_SUCCESSFUL) | |
741 | { |
|
740 | { | |
742 | PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status) |
|
741 | PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status) | |
743 | } |
|
742 | } | |
744 | } |
|
743 | } | |
745 |
|
744 | |||
746 | return status; |
|
745 | return status; | |
747 | } |
|
746 | } | |
748 |
|
747 | |||
749 | void launch_waveform_picker( unsigned char mode, unsigned int transitionCoarseTime ) |
|
748 | void launch_waveform_picker( unsigned char mode, unsigned int transitionCoarseTime ) | |
750 | { |
|
749 | { | |
751 | WFP_reset_current_ring_nodes(); |
|
750 | WFP_reset_current_ring_nodes(); | |
752 | reset_waveform_picker_regs(); |
|
751 | reset_waveform_picker_regs(); | |
753 | set_wfp_burst_enable_register( mode ); |
|
752 | set_wfp_burst_enable_register( mode ); | |
754 |
|
753 | |||
755 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); |
|
754 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); | |
756 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); |
|
755 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); | |
757 |
|
756 | |||
758 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x80; // [1000 0000] |
|
757 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x80; // [1000 0000] | |
759 | if (transitionCoarseTime == 0) |
|
758 | if (transitionCoarseTime == 0) | |
760 | { |
|
759 | { | |
761 | waveform_picker_regs->start_date = time_management_regs->coarse_time; |
|
760 | waveform_picker_regs->start_date = time_management_regs->coarse_time; | |
762 | } |
|
761 | } | |
763 | else |
|
762 | else | |
764 | { |
|
763 | { | |
765 | waveform_picker_regs->start_date = transitionCoarseTime; |
|
764 | waveform_picker_regs->start_date = transitionCoarseTime; | |
766 | } |
|
765 | } | |
|
766 | ||||
|
767 | PRINTF1("commutation coarse time = %d\n", transitionCoarseTime) | |||
767 | } |
|
768 | } | |
768 |
|
769 | |||
769 | void launch_spectral_matrix( void ) |
|
770 | void launch_spectral_matrix( void ) | |
770 | { |
|
771 | { | |
771 | SM_reset_current_ring_nodes(); |
|
772 | SM_reset_current_ring_nodes(); | |
772 | reset_spectral_matrix_regs(); |
|
773 | reset_spectral_matrix_regs(); | |
773 | reset_nb_sm(); |
|
774 | reset_nb_sm(); | |
774 |
|
775 | |||
775 | struct grgpio_regs_str *grgpio_regs = (struct grgpio_regs_str *) REGS_ADDR_GRGPIO; |
|
776 | struct grgpio_regs_str *grgpio_regs = (struct grgpio_regs_str *) REGS_ADDR_GRGPIO; | |
776 | grgpio_regs->io_port_direction_register = |
|
777 | grgpio_regs->io_port_direction_register = | |
777 | grgpio_regs->io_port_direction_register | 0x01; // [0000 0001], 0 = output disabled, 1 = output enabled |
|
778 | grgpio_regs->io_port_direction_register | 0x01; // [0000 0001], 0 = output disabled, 1 = output enabled | |
778 | grgpio_regs->io_port_output_register = grgpio_regs->io_port_output_register & 0xfffffffe; // set the bit 0 to 0 |
|
779 | grgpio_regs->io_port_output_register = grgpio_regs->io_port_output_register & 0xfffffffe; // set the bit 0 to 0 | |
779 | set_irq_on_new_ready_matrix( 1 ); |
|
780 | set_irq_on_new_ready_matrix( 1 ); | |
780 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); |
|
781 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); | |
781 | LEON_Unmask_interrupt( IRQ_SPECTRAL_MATRIX ); |
|
782 | LEON_Unmask_interrupt( IRQ_SPECTRAL_MATRIX ); | |
782 | set_run_matrix_spectral( 1 ); |
|
783 | set_run_matrix_spectral( 1 ); | |
783 | } |
|
784 | } | |
784 |
|
785 | |||
785 | void launch_spectral_matrix_simu( void ) |
|
786 | void launch_spectral_matrix_simu( void ) | |
786 | { |
|
787 | { | |
787 | SM_reset_current_ring_nodes(); |
|
788 | SM_reset_current_ring_nodes(); | |
788 | reset_spectral_matrix_regs(); |
|
789 | reset_spectral_matrix_regs(); | |
789 | reset_nb_sm(); |
|
790 | reset_nb_sm(); | |
790 |
|
791 | |||
791 | // Spectral Matrices simulator |
|
792 | // Spectral Matrices simulator | |
792 | timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); |
|
793 | timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); | |
793 | LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); |
|
794 | LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); | |
794 | LEON_Unmask_interrupt( IRQ_SM_SIMULATOR ); |
|
795 | LEON_Unmask_interrupt( IRQ_SM_SIMULATOR ); | |
795 | } |
|
796 | } | |
796 |
|
797 | |||
797 | void set_irq_on_new_ready_matrix( unsigned char value ) |
|
798 | void set_irq_on_new_ready_matrix( unsigned char value ) | |
798 | { |
|
799 | { | |
799 | if (value == 1) |
|
800 | if (value == 1) | |
800 | { |
|
801 | { | |
801 | spectral_matrix_regs->config = spectral_matrix_regs->config | 0x01; |
|
802 | spectral_matrix_regs->config = spectral_matrix_regs->config | 0x01; | |
802 | } |
|
803 | } | |
803 | else |
|
804 | else | |
804 | { |
|
805 | { | |
805 | spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffe; // 1110 |
|
806 | spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffe; // 1110 | |
806 | } |
|
807 | } | |
807 | } |
|
808 | } | |
808 |
|
809 | |||
809 | void set_run_matrix_spectral( unsigned char value ) |
|
810 | void set_run_matrix_spectral( unsigned char value ) | |
810 | { |
|
811 | { | |
811 | if (value == 1) |
|
812 | if (value == 1) | |
812 | { |
|
813 | { | |
813 | spectral_matrix_regs->config = spectral_matrix_regs->config | 0x4; // [0100] set run_matrix spectral to 1 |
|
814 | spectral_matrix_regs->config = spectral_matrix_regs->config | 0x4; // [0100] set run_matrix spectral to 1 | |
814 | } |
|
815 | } | |
815 | else |
|
816 | else | |
816 | { |
|
817 | { | |
817 | spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffb; // [1011] set run_matrix spectral to 0 |
|
818 | spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffb; // [1011] set run_matrix spectral to 0 | |
818 | } |
|
819 | } | |
819 | } |
|
820 | } | |
820 |
|
821 | |||
821 | //**************** |
|
822 | //**************** | |
822 | // CLOSING ACTIONS |
|
823 | // CLOSING ACTIONS | |
823 | void update_last_TC_exe( ccsdsTelecommandPacket_t *TC, unsigned char * time ) |
|
824 | void update_last_TC_exe( ccsdsTelecommandPacket_t *TC, unsigned char * time ) | |
824 | { |
|
825 | { | |
825 | /** This function is used to update the HK packets statistics after a successful TC execution. |
|
826 | /** This function is used to update the HK packets statistics after a successful TC execution. | |
826 | * |
|
827 | * | |
827 | * @param TC points to the TC being processed |
|
828 | * @param TC points to the TC being processed | |
828 | * @param time is the time used to date the TC execution |
|
829 | * @param time is the time used to date the TC execution | |
829 | * |
|
830 | * | |
830 | */ |
|
831 | */ | |
831 |
|
832 | |||
832 | unsigned int val; |
|
833 | unsigned int val; | |
833 |
|
834 | |||
834 | housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0]; |
|
835 | housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0]; | |
835 | housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1]; |
|
836 | housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1]; | |
836 | housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00; |
|
837 | housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00; | |
837 | housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType; |
|
838 | housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType; | |
838 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00; |
|
839 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00; | |
839 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType; |
|
840 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType; | |
840 | housekeeping_packet.hk_lfr_last_exe_tc_time[0] = time[0]; |
|
841 | housekeeping_packet.hk_lfr_last_exe_tc_time[0] = time[0]; | |
841 | housekeeping_packet.hk_lfr_last_exe_tc_time[1] = time[1]; |
|
842 | housekeeping_packet.hk_lfr_last_exe_tc_time[1] = time[1]; | |
842 | housekeeping_packet.hk_lfr_last_exe_tc_time[2] = time[2]; |
|
843 | housekeeping_packet.hk_lfr_last_exe_tc_time[2] = time[2]; | |
843 | housekeeping_packet.hk_lfr_last_exe_tc_time[3] = time[3]; |
|
844 | housekeeping_packet.hk_lfr_last_exe_tc_time[3] = time[3]; | |
844 | housekeeping_packet.hk_lfr_last_exe_tc_time[4] = time[4]; |
|
845 | housekeeping_packet.hk_lfr_last_exe_tc_time[4] = time[4]; | |
845 | housekeeping_packet.hk_lfr_last_exe_tc_time[5] = time[5]; |
|
846 | housekeeping_packet.hk_lfr_last_exe_tc_time[5] = time[5]; | |
846 |
|
847 | |||
847 | val = housekeeping_packet.hk_lfr_exe_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_exe_tc_cnt[1]; |
|
848 | val = housekeeping_packet.hk_lfr_exe_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_exe_tc_cnt[1]; | |
848 | val++; |
|
849 | val++; | |
849 | housekeeping_packet.hk_lfr_exe_tc_cnt[0] = (unsigned char) (val >> 8); |
|
850 | housekeeping_packet.hk_lfr_exe_tc_cnt[0] = (unsigned char) (val >> 8); | |
850 | housekeeping_packet.hk_lfr_exe_tc_cnt[1] = (unsigned char) (val); |
|
851 | housekeeping_packet.hk_lfr_exe_tc_cnt[1] = (unsigned char) (val); | |
851 | } |
|
852 | } | |
852 |
|
853 | |||
853 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char * time ) |
|
854 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char * time ) | |
854 | { |
|
855 | { | |
855 | /** This function is used to update the HK packets statistics after a TC rejection. |
|
856 | /** This function is used to update the HK packets statistics after a TC rejection. | |
856 | * |
|
857 | * | |
857 | * @param TC points to the TC being processed |
|
858 | * @param TC points to the TC being processed | |
858 | * @param time is the time used to date the TC rejection |
|
859 | * @param time is the time used to date the TC rejection | |
859 | * |
|
860 | * | |
860 | */ |
|
861 | */ | |
861 |
|
862 | |||
862 | unsigned int val; |
|
863 | unsigned int val; | |
863 |
|
864 | |||
864 | housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0]; |
|
865 | housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0]; | |
865 | housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1]; |
|
866 | housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1]; | |
866 | housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00; |
|
867 | housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00; | |
867 | housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType; |
|
868 | housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType; | |
868 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00; |
|
869 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00; | |
869 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType; |
|
870 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType; | |
870 | housekeeping_packet.hk_lfr_last_rej_tc_time[0] = time[0]; |
|
871 | housekeeping_packet.hk_lfr_last_rej_tc_time[0] = time[0]; | |
871 | housekeeping_packet.hk_lfr_last_rej_tc_time[1] = time[1]; |
|
872 | housekeeping_packet.hk_lfr_last_rej_tc_time[1] = time[1]; | |
872 | housekeeping_packet.hk_lfr_last_rej_tc_time[2] = time[2]; |
|
873 | housekeeping_packet.hk_lfr_last_rej_tc_time[2] = time[2]; | |
873 | housekeeping_packet.hk_lfr_last_rej_tc_time[3] = time[3]; |
|
874 | housekeeping_packet.hk_lfr_last_rej_tc_time[3] = time[3]; | |
874 | housekeeping_packet.hk_lfr_last_rej_tc_time[4] = time[4]; |
|
875 | housekeeping_packet.hk_lfr_last_rej_tc_time[4] = time[4]; | |
875 | housekeeping_packet.hk_lfr_last_rej_tc_time[5] = time[5]; |
|
876 | housekeeping_packet.hk_lfr_last_rej_tc_time[5] = time[5]; | |
876 |
|
877 | |||
877 | val = housekeeping_packet.hk_lfr_rej_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_rej_tc_cnt[1]; |
|
878 | val = housekeeping_packet.hk_lfr_rej_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_rej_tc_cnt[1]; | |
878 | val++; |
|
879 | val++; | |
879 | housekeeping_packet.hk_lfr_rej_tc_cnt[0] = (unsigned char) (val >> 8); |
|
880 | housekeeping_packet.hk_lfr_rej_tc_cnt[0] = (unsigned char) (val >> 8); | |
880 | housekeeping_packet.hk_lfr_rej_tc_cnt[1] = (unsigned char) (val); |
|
881 | housekeeping_packet.hk_lfr_rej_tc_cnt[1] = (unsigned char) (val); | |
881 | } |
|
882 | } | |
882 |
|
883 | |||
883 | void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id ) |
|
884 | void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id ) | |
884 | { |
|
885 | { | |
885 | /** This function is the last step of the TC execution workflow. |
|
886 | /** This function is the last step of the TC execution workflow. | |
886 | * |
|
887 | * | |
887 | * @param TC points to the TC being processed |
|
888 | * @param TC points to the TC being processed | |
888 | * @param result is the result of the TC execution (LFR_SUCCESSFUL / LFR_DEFAULT) |
|
889 | * @param result is the result of the TC execution (LFR_SUCCESSFUL / LFR_DEFAULT) | |
889 | * @param queue_id is the id of the RTEMS message queue used to send TM packets |
|
890 | * @param queue_id is the id of the RTEMS message queue used to send TM packets | |
890 | * @param time is the time used to date the TC execution |
|
891 | * @param time is the time used to date the TC execution | |
891 | * |
|
892 | * | |
892 | */ |
|
893 | */ | |
893 |
|
894 | |||
894 | unsigned char requestedMode; |
|
895 | unsigned char requestedMode; | |
895 |
|
896 | |||
896 | if (result == LFR_SUCCESSFUL) |
|
897 | if (result == LFR_SUCCESSFUL) | |
897 | { |
|
898 | { | |
898 | if ( !( (TC->serviceType==TC_TYPE_TIME) & (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) ) |
|
899 | if ( !( (TC->serviceType==TC_TYPE_TIME) & (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) ) | |
899 | & |
|
900 | & | |
900 | !( (TC->serviceType==TC_TYPE_GEN) & (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO)) |
|
901 | !( (TC->serviceType==TC_TYPE_GEN) & (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO)) | |
901 | ) |
|
902 | ) | |
902 | { |
|
903 | { | |
903 | send_tm_lfr_tc_exe_success( TC, queue_id ); |
|
904 | send_tm_lfr_tc_exe_success( TC, queue_id ); | |
904 | } |
|
905 | } | |
905 | if ( (TC->serviceType == TC_TYPE_GEN) & (TC->serviceSubType == TC_SUBTYPE_ENTER) ) |
|
906 | if ( (TC->serviceType == TC_TYPE_GEN) & (TC->serviceSubType == TC_SUBTYPE_ENTER) ) | |
906 | { |
|
907 | { | |
907 | //********************************** |
|
908 | //********************************** | |
908 | // UPDATE THE LFRMODE LOCAL VARIABLE |
|
909 | // UPDATE THE LFRMODE LOCAL VARIABLE | |
909 | requestedMode = TC->dataAndCRC[1]; |
|
910 | requestedMode = TC->dataAndCRC[1]; | |
910 | housekeeping_packet.lfr_status_word[0] = (unsigned char) ((requestedMode << 4) + 0x0d); |
|
911 | housekeeping_packet.lfr_status_word[0] = (unsigned char) ((requestedMode << 4) + 0x0d); | |
911 | updateLFRCurrentMode(); |
|
912 | updateLFRCurrentMode(); | |
912 | } |
|
913 | } | |
913 | } |
|
914 | } | |
914 | else if (result == LFR_EXE_ERROR) |
|
915 | else if (result == LFR_EXE_ERROR) | |
915 | { |
|
916 | { | |
916 | send_tm_lfr_tc_exe_error( TC, queue_id ); |
|
917 | send_tm_lfr_tc_exe_error( TC, queue_id ); | |
917 | } |
|
918 | } | |
918 | } |
|
919 | } | |
919 |
|
920 | |||
920 | //*************************** |
|
921 | //*************************** | |
921 | // Interrupt Service Routines |
|
922 | // Interrupt Service Routines | |
922 | rtems_isr commutation_isr1( rtems_vector_number vector ) |
|
923 | rtems_isr commutation_isr1( rtems_vector_number vector ) | |
923 | { |
|
924 | { | |
924 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
925 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { | |
925 | printf("In commutation_isr1 *** Error sending event to DUMB\n"); |
|
926 | printf("In commutation_isr1 *** Error sending event to DUMB\n"); | |
926 | } |
|
927 | } | |
927 | } |
|
928 | } | |
928 |
|
929 | |||
929 | rtems_isr commutation_isr2( rtems_vector_number vector ) |
|
930 | rtems_isr commutation_isr2( rtems_vector_number vector ) | |
930 | { |
|
931 | { | |
931 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
932 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { | |
932 | printf("In commutation_isr2 *** Error sending event to DUMB\n"); |
|
933 | printf("In commutation_isr2 *** Error sending event to DUMB\n"); | |
933 | } |
|
934 | } | |
934 | } |
|
935 | } | |
935 |
|
936 | |||
936 | //**************** |
|
937 | //**************** | |
937 | // OTHER FUNCTIONS |
|
938 | // OTHER FUNCTIONS | |
938 | void updateLFRCurrentMode() |
|
939 | void updateLFRCurrentMode() | |
939 | { |
|
940 | { | |
940 | /** This function updates the value of the global variable lfrCurrentMode. |
|
941 | /** This function updates the value of the global variable lfrCurrentMode. | |
941 | * |
|
942 | * | |
942 | * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running. |
|
943 | * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running. | |
943 | * |
|
944 | * | |
944 | */ |
|
945 | */ | |
945 | // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure |
|
946 | // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure | |
946 | lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
947 | lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
947 | } |
|
948 | } | |
948 |
|
949 |
@@ -1,772 +1,772 | |||||
1 | /** Functions to load and dump parameters in the LFR registers. |
|
1 | /** Functions to load and dump parameters in the LFR registers. | |
2 | * |
|
2 | * | |
3 | * @file |
|
3 | * @file | |
4 | * @author P. LEROY |
|
4 | * @author P. LEROY | |
5 | * |
|
5 | * | |
6 | * A group of functions to handle TC related to parameter loading and dumping.\n |
|
6 | * A group of functions to handle TC related to parameter loading and dumping.\n | |
7 | * TC_LFR_LOAD_COMMON_PAR\n |
|
7 | * TC_LFR_LOAD_COMMON_PAR\n | |
8 | * TC_LFR_LOAD_NORMAL_PAR\n |
|
8 | * TC_LFR_LOAD_NORMAL_PAR\n | |
9 | * TC_LFR_LOAD_BURST_PAR\n |
|
9 | * TC_LFR_LOAD_BURST_PAR\n | |
10 | * TC_LFR_LOAD_SBM1_PAR\n |
|
10 | * TC_LFR_LOAD_SBM1_PAR\n | |
11 | * TC_LFR_LOAD_SBM2_PAR\n |
|
11 | * TC_LFR_LOAD_SBM2_PAR\n | |
12 | * |
|
12 | * | |
13 | */ |
|
13 | */ | |
14 |
|
14 | |||
15 | #include "tc_load_dump_parameters.h" |
|
15 | #include "tc_load_dump_parameters.h" | |
16 |
|
16 | |||
17 | int action_load_common_par(ccsdsTelecommandPacket_t *TC) |
|
17 | int action_load_common_par(ccsdsTelecommandPacket_t *TC) | |
18 | { |
|
18 | { | |
19 | /** This function updates the LFR registers with the incoming common parameters. |
|
19 | /** This function updates the LFR registers with the incoming common parameters. | |
20 | * |
|
20 | * | |
21 | * @param TC points to the TeleCommand packet that is being processed |
|
21 | * @param TC points to the TeleCommand packet that is being processed | |
22 | * |
|
22 | * | |
23 | * |
|
23 | * | |
24 | */ |
|
24 | */ | |
25 |
|
25 | |||
26 | parameter_dump_packet.unused0 = TC->dataAndCRC[0]; |
|
26 | parameter_dump_packet.unused0 = TC->dataAndCRC[0]; | |
27 | parameter_dump_packet.bw_sp0_sp1_r0_r1 = TC->dataAndCRC[1]; |
|
27 | parameter_dump_packet.bw_sp0_sp1_r0_r1 = TC->dataAndCRC[1]; | |
28 | set_wfp_data_shaping( ); |
|
28 | set_wfp_data_shaping( ); | |
29 | return LFR_SUCCESSFUL; |
|
29 | return LFR_SUCCESSFUL; | |
30 | } |
|
30 | } | |
31 |
|
31 | |||
32 | int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
32 | int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) | |
33 | { |
|
33 | { | |
34 | /** This function updates the LFR registers with the incoming normal parameters. |
|
34 | /** This function updates the LFR registers with the incoming normal parameters. | |
35 | * |
|
35 | * | |
36 | * @param TC points to the TeleCommand packet that is being processed |
|
36 | * @param TC points to the TeleCommand packet that is being processed | |
37 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
37 | * @param queue_id is the id of the queue which handles TM related to this execution step | |
38 | * |
|
38 | * | |
39 | */ |
|
39 | */ | |
40 |
|
40 | |||
41 | int result; |
|
41 | int result; | |
42 | int flag; |
|
42 | int flag; | |
43 | rtems_status_code status; |
|
43 | rtems_status_code status; | |
44 |
|
44 | |||
45 | flag = LFR_SUCCESSFUL; |
|
45 | flag = LFR_SUCCESSFUL; | |
46 |
|
46 | |||
47 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) || |
|
47 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) || | |
48 | (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) { |
|
48 | (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) { | |
49 | status = send_tm_lfr_tc_exe_not_executable( TC, queue_id ); |
|
49 | status = send_tm_lfr_tc_exe_not_executable( TC, queue_id ); | |
50 | flag = LFR_DEFAULT; |
|
50 | flag = LFR_DEFAULT; | |
51 | } |
|
51 | } | |
52 |
|
52 | |||
53 | // CHECK THE PARAMETERS SET CONSISTENCY |
|
53 | // CHECK THE PARAMETERS SET CONSISTENCY | |
54 | if (flag == LFR_SUCCESSFUL) |
|
54 | if (flag == LFR_SUCCESSFUL) | |
55 | { |
|
55 | { | |
56 | flag = check_common_par_consistency( TC, queue_id ); |
|
56 | flag = check_common_par_consistency( TC, queue_id ); | |
57 | } |
|
57 | } | |
58 |
|
58 | |||
59 | // SET THE PARAMETERS IF THEY ARE CONSISTENT |
|
59 | // SET THE PARAMETERS IF THEY ARE CONSISTENT | |
60 | if (flag == LFR_SUCCESSFUL) |
|
60 | if (flag == LFR_SUCCESSFUL) | |
61 | { |
|
61 | { | |
62 | result = set_sy_lfr_n_swf_l( TC ); |
|
62 | result = set_sy_lfr_n_swf_l( TC ); | |
63 | result = set_sy_lfr_n_swf_p( TC ); |
|
63 | result = set_sy_lfr_n_swf_p( TC ); | |
64 | result = set_sy_lfr_n_bp_p0( TC ); |
|
64 | result = set_sy_lfr_n_bp_p0( TC ); | |
65 | result = set_sy_lfr_n_bp_p1( TC ); |
|
65 | result = set_sy_lfr_n_bp_p1( TC ); | |
66 | result = set_sy_lfr_n_asm_p( TC ); |
|
66 | result = set_sy_lfr_n_asm_p( TC ); | |
67 | result = set_sy_lfr_n_cwf_long_f3( TC ); |
|
67 | result = set_sy_lfr_n_cwf_long_f3( TC ); | |
68 | } |
|
68 | } | |
69 |
|
69 | |||
70 | return flag; |
|
70 | return flag; | |
71 | } |
|
71 | } | |
72 |
|
72 | |||
73 | int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
73 | int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) | |
74 | { |
|
74 | { | |
75 | /** This function updates the LFR registers with the incoming burst parameters. |
|
75 | /** This function updates the LFR registers with the incoming burst parameters. | |
76 | * |
|
76 | * | |
77 | * @param TC points to the TeleCommand packet that is being processed |
|
77 | * @param TC points to the TeleCommand packet that is being processed | |
78 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
78 | * @param queue_id is the id of the queue which handles TM related to this execution step | |
79 | * |
|
79 | * | |
80 | */ |
|
80 | */ | |
81 |
|
81 | |||
82 | int flag; |
|
82 | int flag; | |
83 | rtems_status_code status; |
|
83 | rtems_status_code status; | |
84 | unsigned char sy_lfr_b_bp_p0; |
|
84 | unsigned char sy_lfr_b_bp_p0; | |
85 | unsigned char sy_lfr_b_bp_p1; |
|
85 | unsigned char sy_lfr_b_bp_p1; | |
86 | float aux; |
|
86 | float aux; | |
87 |
|
87 | |||
88 | flag = LFR_SUCCESSFUL; |
|
88 | flag = LFR_SUCCESSFUL; | |
89 |
|
89 | |||
90 | if ( lfrCurrentMode == LFR_MODE_BURST ) { |
|
90 | if ( lfrCurrentMode == LFR_MODE_BURST ) { | |
91 | status = send_tm_lfr_tc_exe_not_executable( TC, queue_id ); |
|
91 | status = send_tm_lfr_tc_exe_not_executable( TC, queue_id ); | |
92 | flag = LFR_DEFAULT; |
|
92 | flag = LFR_DEFAULT; | |
93 | } |
|
93 | } | |
94 |
|
94 | |||
95 | sy_lfr_b_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_B_BP_P0 ]; |
|
95 | sy_lfr_b_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_B_BP_P0 ]; | |
96 | sy_lfr_b_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_B_BP_P1 ]; |
|
96 | sy_lfr_b_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_B_BP_P1 ]; | |
97 |
|
97 | |||
98 | // sy_lfr_b_bp_p0 |
|
98 | // sy_lfr_b_bp_p0 | |
99 | if (flag == LFR_SUCCESSFUL) |
|
99 | if (flag == LFR_SUCCESSFUL) | |
100 | { |
|
100 | { | |
101 | if (sy_lfr_b_bp_p0 < DEFAULT_SY_LFR_B_BP_P0 ) |
|
101 | if (sy_lfr_b_bp_p0 < DEFAULT_SY_LFR_B_BP_P0 ) | |
102 | { |
|
102 | { | |
103 | status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_B_BP_P0+10, sy_lfr_b_bp_p0 ); |
|
103 | status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_B_BP_P0+10, sy_lfr_b_bp_p0 ); | |
104 | flag = WRONG_APP_DATA; |
|
104 | flag = WRONG_APP_DATA; | |
105 | } |
|
105 | } | |
106 | } |
|
106 | } | |
107 | // sy_lfr_b_bp_p1 |
|
107 | // sy_lfr_b_bp_p1 | |
108 | if (flag == LFR_SUCCESSFUL) |
|
108 | if (flag == LFR_SUCCESSFUL) | |
109 | { |
|
109 | { | |
110 | if (sy_lfr_b_bp_p1 < DEFAULT_SY_LFR_B_BP_P1 ) |
|
110 | if (sy_lfr_b_bp_p1 < DEFAULT_SY_LFR_B_BP_P1 ) | |
111 | { |
|
111 | { | |
112 | status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_B_BP_P1+10, sy_lfr_b_bp_p1 ); |
|
112 | status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_B_BP_P1+10, sy_lfr_b_bp_p1 ); | |
113 | flag = WRONG_APP_DATA; |
|
113 | flag = WRONG_APP_DATA; | |
114 | } |
|
114 | } | |
115 | } |
|
115 | } | |
116 | //**************************************************************** |
|
116 | //**************************************************************** | |
117 | // check the consistency between sy_lfr_b_bp_p0 and sy_lfr_b_bp_p1 |
|
117 | // check the consistency between sy_lfr_b_bp_p0 and sy_lfr_b_bp_p1 | |
118 | if (flag == LFR_SUCCESSFUL) |
|
118 | if (flag == LFR_SUCCESSFUL) | |
119 | { |
|
119 | { | |
120 | sy_lfr_b_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_B_BP_P0 ]; |
|
120 | sy_lfr_b_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_B_BP_P0 ]; | |
121 | sy_lfr_b_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_B_BP_P1 ]; |
|
121 | sy_lfr_b_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_B_BP_P1 ]; | |
122 | aux = ( (float ) sy_lfr_b_bp_p1 / sy_lfr_b_bp_p0 ) - floor(sy_lfr_b_bp_p1 / sy_lfr_b_bp_p0); |
|
122 | aux = ( (float ) sy_lfr_b_bp_p1 / sy_lfr_b_bp_p0 ) - floor(sy_lfr_b_bp_p1 / sy_lfr_b_bp_p0); | |
123 |
if (aux |
|
123 | if (aux > FLOAT_EQUAL_ZERO) | |
124 | { |
|
124 | { | |
125 | status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_B_BP_P0+10, sy_lfr_b_bp_p0 ); |
|
125 | status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_B_BP_P0+10, sy_lfr_b_bp_p0 ); | |
126 | flag = LFR_DEFAULT; |
|
126 | flag = LFR_DEFAULT; | |
127 | } |
|
127 | } | |
128 | } |
|
128 | } | |
129 |
|
129 | |||
130 | // SET HTE PARAMETERS |
|
130 | // SET HTE PARAMETERS | |
131 | if (flag == LFR_SUCCESSFUL) |
|
131 | if (flag == LFR_SUCCESSFUL) | |
132 | { |
|
132 | { | |
133 | flag = set_sy_lfr_b_bp_p0( TC ); |
|
133 | flag = set_sy_lfr_b_bp_p0( TC ); | |
134 | flag = set_sy_lfr_b_bp_p1( TC ); |
|
134 | flag = set_sy_lfr_b_bp_p1( TC ); | |
135 | } |
|
135 | } | |
136 |
|
136 | |||
137 | return flag; |
|
137 | return flag; | |
138 | } |
|
138 | } | |
139 |
|
139 | |||
140 | int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
140 | int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) | |
141 | { |
|
141 | { | |
142 | /** This function updates the LFR registers with the incoming sbm1 parameters. |
|
142 | /** This function updates the LFR registers with the incoming sbm1 parameters. | |
143 | * |
|
143 | * | |
144 | * @param TC points to the TeleCommand packet that is being processed |
|
144 | * @param TC points to the TeleCommand packet that is being processed | |
145 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
145 | * @param queue_id is the id of the queue which handles TM related to this execution step | |
146 | * |
|
146 | * | |
147 | */ |
|
147 | */ | |
148 |
|
148 | |||
149 | int flag; |
|
149 | int flag; | |
150 | rtems_status_code status; |
|
150 | rtems_status_code status; | |
151 | unsigned char sy_lfr_s1_bp_p0; |
|
151 | unsigned char sy_lfr_s1_bp_p0; | |
152 | unsigned char sy_lfr_s1_bp_p1; |
|
152 | unsigned char sy_lfr_s1_bp_p1; | |
153 | float aux; |
|
153 | float aux; | |
154 |
|
154 | |||
155 | flag = LFR_SUCCESSFUL; |
|
155 | flag = LFR_SUCCESSFUL; | |
156 |
|
156 | |||
157 | if ( lfrCurrentMode == LFR_MODE_SBM1 ) { |
|
157 | if ( lfrCurrentMode == LFR_MODE_SBM1 ) { | |
158 | status = send_tm_lfr_tc_exe_not_executable( TC, queue_id ); |
|
158 | status = send_tm_lfr_tc_exe_not_executable( TC, queue_id ); | |
159 | flag = LFR_DEFAULT; |
|
159 | flag = LFR_DEFAULT; | |
160 | } |
|
160 | } | |
161 |
|
161 | |||
162 | sy_lfr_s1_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S1_BP_P0 ]; |
|
162 | sy_lfr_s1_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S1_BP_P0 ]; | |
163 | sy_lfr_s1_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S1_BP_P1 ]; |
|
163 | sy_lfr_s1_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S1_BP_P1 ]; | |
164 |
|
164 | |||
165 | // sy_lfr_s1_bp_p0 |
|
165 | // sy_lfr_s1_bp_p0 | |
166 | if (flag == LFR_SUCCESSFUL) |
|
166 | if (flag == LFR_SUCCESSFUL) | |
167 | { |
|
167 | { | |
168 | if (sy_lfr_s1_bp_p0 < DEFAULT_SY_LFR_S1_BP_P0 ) |
|
168 | if (sy_lfr_s1_bp_p0 < DEFAULT_SY_LFR_S1_BP_P0 ) | |
169 | { |
|
169 | { | |
170 | status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_S1_BP_P0+10, sy_lfr_s1_bp_p0 ); |
|
170 | status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_S1_BP_P0+10, sy_lfr_s1_bp_p0 ); | |
171 | flag = WRONG_APP_DATA; |
|
171 | flag = WRONG_APP_DATA; | |
172 | } |
|
172 | } | |
173 | } |
|
173 | } | |
174 | // sy_lfr_s1_bp_p1 |
|
174 | // sy_lfr_s1_bp_p1 | |
175 | if (flag == LFR_SUCCESSFUL) |
|
175 | if (flag == LFR_SUCCESSFUL) | |
176 | { |
|
176 | { | |
177 | if (sy_lfr_s1_bp_p1 < DEFAULT_SY_LFR_S1_BP_P1 ) |
|
177 | if (sy_lfr_s1_bp_p1 < DEFAULT_SY_LFR_S1_BP_P1 ) | |
178 | { |
|
178 | { | |
179 | status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_S1_BP_P1+10, sy_lfr_s1_bp_p1 ); |
|
179 | status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_S1_BP_P1+10, sy_lfr_s1_bp_p1 ); | |
180 | flag = WRONG_APP_DATA; |
|
180 | flag = WRONG_APP_DATA; | |
181 | } |
|
181 | } | |
182 | } |
|
182 | } | |
183 | //****************************************************************** |
|
183 | //****************************************************************** | |
184 | // check the consistency between sy_lfr_s1_bp_p0 and sy_lfr_s1_bp_p1 |
|
184 | // check the consistency between sy_lfr_s1_bp_p0 and sy_lfr_s1_bp_p1 | |
185 | if (flag == LFR_SUCCESSFUL) |
|
185 | if (flag == LFR_SUCCESSFUL) | |
186 | { |
|
186 | { | |
187 | aux = ( (float ) sy_lfr_s1_bp_p1 / (sy_lfr_s1_bp_p0*0.25) ) - floor(sy_lfr_s1_bp_p1 / (sy_lfr_s1_bp_p0*0.25)); |
|
187 | aux = ( (float ) sy_lfr_s1_bp_p1 / (sy_lfr_s1_bp_p0*0.25) ) - floor(sy_lfr_s1_bp_p1 / (sy_lfr_s1_bp_p0*0.25)); | |
188 |
if (aux |
|
188 | if (aux > FLOAT_EQUAL_ZERO) | |
189 | { |
|
189 | { | |
190 | status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_S1_BP_P0+10, sy_lfr_s1_bp_p0 ); |
|
190 | status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_S1_BP_P0+10, sy_lfr_s1_bp_p0 ); | |
191 | flag = LFR_DEFAULT; |
|
191 | flag = LFR_DEFAULT; | |
192 | } |
|
192 | } | |
193 | } |
|
193 | } | |
194 |
|
194 | |||
195 | // SET THE PARAMETERS |
|
195 | // SET THE PARAMETERS | |
196 | if (flag == LFR_SUCCESSFUL) |
|
196 | if (flag == LFR_SUCCESSFUL) | |
197 | { |
|
197 | { | |
198 | flag = set_sy_lfr_s1_bp_p0( TC ); |
|
198 | flag = set_sy_lfr_s1_bp_p0( TC ); | |
199 | flag = set_sy_lfr_s1_bp_p1( TC ); |
|
199 | flag = set_sy_lfr_s1_bp_p1( TC ); | |
200 | } |
|
200 | } | |
201 |
|
201 | |||
202 | return flag; |
|
202 | return flag; | |
203 | } |
|
203 | } | |
204 |
|
204 | |||
205 | int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
205 | int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) | |
206 | { |
|
206 | { | |
207 | /** This function updates the LFR registers with the incoming sbm2 parameters. |
|
207 | /** This function updates the LFR registers with the incoming sbm2 parameters. | |
208 | * |
|
208 | * | |
209 | * @param TC points to the TeleCommand packet that is being processed |
|
209 | * @param TC points to the TeleCommand packet that is being processed | |
210 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
210 | * @param queue_id is the id of the queue which handles TM related to this execution step | |
211 | * |
|
211 | * | |
212 | */ |
|
212 | */ | |
213 |
|
213 | |||
214 | int flag; |
|
214 | int flag; | |
215 | rtems_status_code status; |
|
215 | rtems_status_code status; | |
216 | unsigned char sy_lfr_s2_bp_p0; |
|
216 | unsigned char sy_lfr_s2_bp_p0; | |
217 | unsigned char sy_lfr_s2_bp_p1; |
|
217 | unsigned char sy_lfr_s2_bp_p1; | |
218 | float aux; |
|
218 | float aux; | |
219 |
|
219 | |||
220 | flag = LFR_SUCCESSFUL; |
|
220 | flag = LFR_SUCCESSFUL; | |
221 |
|
221 | |||
222 | if ( lfrCurrentMode == LFR_MODE_SBM2 ) { |
|
222 | if ( lfrCurrentMode == LFR_MODE_SBM2 ) { | |
223 | status = send_tm_lfr_tc_exe_not_executable( TC, queue_id ); |
|
223 | status = send_tm_lfr_tc_exe_not_executable( TC, queue_id ); | |
224 | flag = LFR_DEFAULT; |
|
224 | flag = LFR_DEFAULT; | |
225 | } |
|
225 | } | |
226 |
|
226 | |||
227 | sy_lfr_s2_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S2_BP_P0 ]; |
|
227 | sy_lfr_s2_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S2_BP_P0 ]; | |
228 | sy_lfr_s2_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S2_BP_P1 ]; |
|
228 | sy_lfr_s2_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S2_BP_P1 ]; | |
229 |
|
229 | |||
230 | // sy_lfr_s2_bp_p0 |
|
230 | // sy_lfr_s2_bp_p0 | |
231 | if (flag == LFR_SUCCESSFUL) |
|
231 | if (flag == LFR_SUCCESSFUL) | |
232 | { |
|
232 | { | |
233 | if (sy_lfr_s2_bp_p0 < DEFAULT_SY_LFR_S2_BP_P0 ) |
|
233 | if (sy_lfr_s2_bp_p0 < DEFAULT_SY_LFR_S2_BP_P0 ) | |
234 | { |
|
234 | { | |
235 | status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_S2_BP_P0+10, sy_lfr_s2_bp_p0 ); |
|
235 | status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_S2_BP_P0+10, sy_lfr_s2_bp_p0 ); | |
236 | flag = WRONG_APP_DATA; |
|
236 | flag = WRONG_APP_DATA; | |
237 | } |
|
237 | } | |
238 | } |
|
238 | } | |
239 | // sy_lfr_s2_bp_p1 |
|
239 | // sy_lfr_s2_bp_p1 | |
240 | if (flag == LFR_SUCCESSFUL) |
|
240 | if (flag == LFR_SUCCESSFUL) | |
241 | { |
|
241 | { | |
242 | if (sy_lfr_s2_bp_p1 < DEFAULT_SY_LFR_S2_BP_P1 ) |
|
242 | if (sy_lfr_s2_bp_p1 < DEFAULT_SY_LFR_S2_BP_P1 ) | |
243 | { |
|
243 | { | |
244 | status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_S2_BP_P1+10, sy_lfr_s2_bp_p1 ); |
|
244 | status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_S2_BP_P1+10, sy_lfr_s2_bp_p1 ); | |
245 | flag = WRONG_APP_DATA; |
|
245 | flag = WRONG_APP_DATA; | |
246 | } |
|
246 | } | |
247 | } |
|
247 | } | |
248 | //****************************************************************** |
|
248 | //****************************************************************** | |
249 | // check the consistency between sy_lfr_s2_bp_p0 and sy_lfr_s2_bp_p1 |
|
249 | // check the consistency between sy_lfr_s2_bp_p0 and sy_lfr_s2_bp_p1 | |
250 | if (flag == LFR_SUCCESSFUL) |
|
250 | if (flag == LFR_SUCCESSFUL) | |
251 | { |
|
251 | { | |
252 | sy_lfr_s2_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S2_BP_P0 ]; |
|
252 | sy_lfr_s2_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S2_BP_P0 ]; | |
253 | sy_lfr_s2_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S2_BP_P1 ]; |
|
253 | sy_lfr_s2_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S2_BP_P1 ]; | |
254 | aux = ( (float ) sy_lfr_s2_bp_p1 / sy_lfr_s2_bp_p0 ) - floor(sy_lfr_s2_bp_p1 / sy_lfr_s2_bp_p0); |
|
254 | aux = ( (float ) sy_lfr_s2_bp_p1 / sy_lfr_s2_bp_p0 ) - floor(sy_lfr_s2_bp_p1 / sy_lfr_s2_bp_p0); | |
255 |
if (aux |
|
255 | if (aux > FLOAT_EQUAL_ZERO) | |
256 | { |
|
256 | { | |
257 | status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_S2_BP_P0+10, sy_lfr_s2_bp_p0 ); |
|
257 | status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_S2_BP_P0+10, sy_lfr_s2_bp_p0 ); | |
258 | flag = LFR_DEFAULT; |
|
258 | flag = LFR_DEFAULT; | |
259 | } |
|
259 | } | |
260 | } |
|
260 | } | |
261 |
|
261 | |||
262 | // SET THE PARAMETERS |
|
262 | // SET THE PARAMETERS | |
263 | if (flag == LFR_SUCCESSFUL) |
|
263 | if (flag == LFR_SUCCESSFUL) | |
264 | { |
|
264 | { | |
265 | flag = set_sy_lfr_s2_bp_p0( TC ); |
|
265 | flag = set_sy_lfr_s2_bp_p0( TC ); | |
266 | flag = set_sy_lfr_s2_bp_p1( TC ); |
|
266 | flag = set_sy_lfr_s2_bp_p1( TC ); | |
267 | } |
|
267 | } | |
268 |
|
268 | |||
269 | return flag; |
|
269 | return flag; | |
270 | } |
|
270 | } | |
271 |
|
271 | |||
272 | int action_dump_par( rtems_id queue_id ) |
|
272 | int action_dump_par( rtems_id queue_id ) | |
273 | { |
|
273 | { | |
274 | /** This function dumps the LFR parameters by sending the appropriate TM packet to the dedicated RTEMS message queue. |
|
274 | /** This function dumps the LFR parameters by sending the appropriate TM packet to the dedicated RTEMS message queue. | |
275 | * |
|
275 | * | |
276 | * @param queue_id is the id of the queue which handles TM related to this execution step. |
|
276 | * @param queue_id is the id of the queue which handles TM related to this execution step. | |
277 | * |
|
277 | * | |
278 | * @return RTEMS directive status codes: |
|
278 | * @return RTEMS directive status codes: | |
279 | * - RTEMS_SUCCESSFUL - message sent successfully |
|
279 | * - RTEMS_SUCCESSFUL - message sent successfully | |
280 | * - RTEMS_INVALID_ID - invalid queue id |
|
280 | * - RTEMS_INVALID_ID - invalid queue id | |
281 | * - RTEMS_INVALID_SIZE - invalid message size |
|
281 | * - RTEMS_INVALID_SIZE - invalid message size | |
282 | * - RTEMS_INVALID_ADDRESS - buffer is NULL |
|
282 | * - RTEMS_INVALID_ADDRESS - buffer is NULL | |
283 | * - RTEMS_UNSATISFIED - out of message buffers |
|
283 | * - RTEMS_UNSATISFIED - out of message buffers | |
284 | * - RTEMS_TOO_MANY - queue s limit has been reached |
|
284 | * - RTEMS_TOO_MANY - queue s limit has been reached | |
285 | * |
|
285 | * | |
286 | */ |
|
286 | */ | |
287 |
|
287 | |||
288 | int status; |
|
288 | int status; | |
289 |
|
289 | |||
290 | // UPDATE TIME |
|
290 | // UPDATE TIME | |
291 | parameter_dump_packet.packetSequenceControl[0] = (unsigned char) (sequenceCounterParameterDump >> 8); |
|
291 | parameter_dump_packet.packetSequenceControl[0] = (unsigned char) (sequenceCounterParameterDump >> 8); | |
292 | parameter_dump_packet.packetSequenceControl[1] = (unsigned char) (sequenceCounterParameterDump ); |
|
292 | parameter_dump_packet.packetSequenceControl[1] = (unsigned char) (sequenceCounterParameterDump ); | |
293 | increment_seq_counter( &sequenceCounterParameterDump ); |
|
293 | increment_seq_counter( &sequenceCounterParameterDump ); | |
294 |
|
294 | |||
295 | parameter_dump_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
295 | parameter_dump_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
296 | parameter_dump_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
296 | parameter_dump_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
297 | parameter_dump_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
297 | parameter_dump_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
298 | parameter_dump_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
298 | parameter_dump_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); | |
299 | parameter_dump_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
299 | parameter_dump_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
300 | parameter_dump_packet.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
300 | parameter_dump_packet.time[5] = (unsigned char) (time_management_regs->fine_time); | |
301 | // SEND DATA |
|
301 | // SEND DATA | |
302 | status = rtems_message_queue_send( queue_id, ¶meter_dump_packet, |
|
302 | status = rtems_message_queue_send( queue_id, ¶meter_dump_packet, | |
303 | PACKET_LENGTH_PARAMETER_DUMP + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES); |
|
303 | PACKET_LENGTH_PARAMETER_DUMP + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES); | |
304 | if (status != RTEMS_SUCCESSFUL) { |
|
304 | if (status != RTEMS_SUCCESSFUL) { | |
305 | PRINTF1("in action_dump *** ERR sending packet, code %d", status) |
|
305 | PRINTF1("in action_dump *** ERR sending packet, code %d", status) | |
306 | } |
|
306 | } | |
307 |
|
307 | |||
308 | return status; |
|
308 | return status; | |
309 | } |
|
309 | } | |
310 |
|
310 | |||
311 | //*********************** |
|
311 | //*********************** | |
312 | // NORMAL MODE PARAMETERS |
|
312 | // NORMAL MODE PARAMETERS | |
313 |
|
313 | |||
314 | int check_common_par_consistency( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) |
|
314 | int check_common_par_consistency( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) | |
315 | { |
|
315 | { | |
316 | unsigned char msb; |
|
316 | unsigned char msb; | |
317 | unsigned char lsb; |
|
317 | unsigned char lsb; | |
318 | int flag; |
|
318 | int flag; | |
319 | float aux; |
|
319 | float aux; | |
320 | rtems_status_code status; |
|
320 | rtems_status_code status; | |
321 |
|
321 | |||
322 | unsigned int sy_lfr_n_swf_l; |
|
322 | unsigned int sy_lfr_n_swf_l; | |
323 | unsigned int sy_lfr_n_swf_p; |
|
323 | unsigned int sy_lfr_n_swf_p; | |
324 | unsigned int sy_lfr_n_asm_p; |
|
324 | unsigned int sy_lfr_n_asm_p; | |
325 | unsigned char sy_lfr_n_bp_p0; |
|
325 | unsigned char sy_lfr_n_bp_p0; | |
326 | unsigned char sy_lfr_n_bp_p1; |
|
326 | unsigned char sy_lfr_n_bp_p1; | |
327 | unsigned char sy_lfr_n_cwf_long_f3; |
|
327 | unsigned char sy_lfr_n_cwf_long_f3; | |
328 |
|
328 | |||
329 | flag = LFR_SUCCESSFUL; |
|
329 | flag = LFR_SUCCESSFUL; | |
330 |
|
330 | |||
331 | //*************** |
|
331 | //*************** | |
332 | // get parameters |
|
332 | // get parameters | |
333 | msb = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_SWF_L ]; |
|
333 | msb = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_SWF_L ]; | |
334 | lsb = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_SWF_L+1 ]; |
|
334 | lsb = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_SWF_L+1 ]; | |
335 | sy_lfr_n_swf_l = msb * 256 + lsb; |
|
335 | sy_lfr_n_swf_l = msb * 256 + lsb; | |
336 |
|
336 | |||
337 | msb = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_SWF_P ]; |
|
337 | msb = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_SWF_P ]; | |
338 | lsb = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_SWF_P+1 ]; |
|
338 | lsb = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_SWF_P+1 ]; | |
339 | sy_lfr_n_swf_p = msb * 256 + lsb; |
|
339 | sy_lfr_n_swf_p = msb * 256 + lsb; | |
340 |
|
340 | |||
341 | msb = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_ASM_P ]; |
|
341 | msb = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_ASM_P ]; | |
342 | lsb = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_ASM_P+1 ]; |
|
342 | lsb = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_ASM_P+1 ]; | |
343 | sy_lfr_n_asm_p = msb * 256 + lsb; |
|
343 | sy_lfr_n_asm_p = msb * 256 + lsb; | |
344 |
|
344 | |||
345 | sy_lfr_n_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_BP_P0 ]; |
|
345 | sy_lfr_n_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_BP_P0 ]; | |
346 |
|
346 | |||
347 | sy_lfr_n_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_BP_P1 ]; |
|
347 | sy_lfr_n_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_BP_P1 ]; | |
348 |
|
348 | |||
349 | sy_lfr_n_cwf_long_f3 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_CWF_LONG_F3 ]; |
|
349 | sy_lfr_n_cwf_long_f3 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_CWF_LONG_F3 ]; | |
350 |
|
350 | |||
351 | //****************** |
|
351 | //****************** | |
352 | // check consistency |
|
352 | // check consistency | |
353 | // sy_lfr_n_swf_l |
|
353 | // sy_lfr_n_swf_l | |
354 | if (sy_lfr_n_swf_l != 2048) |
|
354 | if (sy_lfr_n_swf_l != 2048) | |
355 | { |
|
355 | { | |
356 | status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_N_SWF_L+10, sy_lfr_n_swf_l ); |
|
356 | status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_N_SWF_L+10, sy_lfr_n_swf_l ); | |
357 | flag = WRONG_APP_DATA; |
|
357 | flag = WRONG_APP_DATA; | |
358 | } |
|
358 | } | |
359 | // sy_lfr_n_swf_p |
|
359 | // sy_lfr_n_swf_p | |
360 | if (flag == LFR_SUCCESSFUL) |
|
360 | if (flag == LFR_SUCCESSFUL) | |
361 | { |
|
361 | { | |
362 | if ( sy_lfr_n_swf_p < 16 ) |
|
362 | if ( sy_lfr_n_swf_p < 16 ) | |
363 | { |
|
363 | { | |
364 | status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_N_SWF_P+10, sy_lfr_n_swf_p ); |
|
364 | status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_N_SWF_P+10, sy_lfr_n_swf_p ); | |
365 | flag = WRONG_APP_DATA; |
|
365 | flag = WRONG_APP_DATA; | |
366 | } |
|
366 | } | |
367 | } |
|
367 | } | |
368 | // sy_lfr_n_bp_p0 |
|
368 | // sy_lfr_n_bp_p0 | |
369 | if (flag == LFR_SUCCESSFUL) |
|
369 | if (flag == LFR_SUCCESSFUL) | |
370 | { |
|
370 | { | |
371 | if (sy_lfr_n_bp_p0 < SY_LFR_N_BP_P0) |
|
371 | if (sy_lfr_n_bp_p0 < DFLT_SY_LFR_N_BP_P0) | |
372 | { |
|
372 | { | |
373 | status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_N_BP_P0+10, sy_lfr_n_bp_p0 ); |
|
373 | status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_N_BP_P0+10, sy_lfr_n_bp_p0 ); | |
374 | flag = WRONG_APP_DATA; |
|
374 | flag = WRONG_APP_DATA; | |
375 | } |
|
375 | } | |
376 | } |
|
376 | } | |
377 | // sy_lfr_n_asm_p |
|
377 | // sy_lfr_n_asm_p | |
378 | if (flag == LFR_SUCCESSFUL) |
|
378 | if (flag == LFR_SUCCESSFUL) | |
379 | { |
|
379 | { | |
380 | if (sy_lfr_n_asm_p == 0) |
|
380 | if (sy_lfr_n_asm_p == 0) | |
381 | { |
|
381 | { | |
382 | status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_N_ASM_P+10, sy_lfr_n_asm_p ); |
|
382 | status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_N_ASM_P+10, sy_lfr_n_asm_p ); | |
383 | flag = WRONG_APP_DATA; |
|
383 | flag = WRONG_APP_DATA; | |
384 | } |
|
384 | } | |
385 | } |
|
385 | } | |
386 | // sy_lfr_n_asm_p shall be a whole multiple of sy_lfr_n_bp_p0 |
|
386 | // sy_lfr_n_asm_p shall be a whole multiple of sy_lfr_n_bp_p0 | |
387 | if (flag == LFR_SUCCESSFUL) |
|
387 | if (flag == LFR_SUCCESSFUL) | |
388 | { |
|
388 | { | |
389 | aux = ( (float ) sy_lfr_n_asm_p / sy_lfr_n_bp_p0 ) - floor(sy_lfr_n_asm_p / sy_lfr_n_bp_p0); |
|
389 | aux = ( (float ) sy_lfr_n_asm_p / sy_lfr_n_bp_p0 ) - floor(sy_lfr_n_asm_p / sy_lfr_n_bp_p0); | |
390 |
if (aux |
|
390 | if (aux > FLOAT_EQUAL_ZERO) | |
391 | { |
|
391 | { | |
392 | status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_N_ASM_P+10, sy_lfr_n_asm_p ); |
|
392 | status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_N_ASM_P+10, sy_lfr_n_asm_p ); | |
393 | flag = WRONG_APP_DATA; |
|
393 | flag = WRONG_APP_DATA; | |
394 | } |
|
394 | } | |
395 | } |
|
395 | } | |
396 | // sy_lfr_n_bp_p1 |
|
396 | // sy_lfr_n_bp_p1 | |
397 | if (flag == LFR_SUCCESSFUL) |
|
397 | if (flag == LFR_SUCCESSFUL) | |
398 | { |
|
398 | { | |
399 | if (sy_lfr_n_bp_p1 < SY_LFR_N_BP_P1) |
|
399 | if (sy_lfr_n_bp_p1 < DFLT_SY_LFR_N_BP_P1) | |
400 | { |
|
400 | { | |
401 | status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_N_BP_P1+10, sy_lfr_n_bp_p1 ); |
|
401 | status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_N_BP_P1+10, sy_lfr_n_bp_p1 ); | |
402 | flag = WRONG_APP_DATA; |
|
402 | flag = WRONG_APP_DATA; | |
403 | } |
|
403 | } | |
404 | } |
|
404 | } | |
405 | // sy_lfr_n_bp_p1 shall be a whole multiple of sy_lfr_n_bp_p0 |
|
405 | // sy_lfr_n_bp_p1 shall be a whole multiple of sy_lfr_n_bp_p0 | |
406 | if (flag == LFR_SUCCESSFUL) |
|
406 | if (flag == LFR_SUCCESSFUL) | |
407 | { |
|
407 | { | |
408 | aux = ( (float ) sy_lfr_n_bp_p1 / sy_lfr_n_bp_p0 ) - floor(sy_lfr_n_bp_p1 / sy_lfr_n_bp_p0); |
|
408 | aux = ( (float ) sy_lfr_n_bp_p1 / sy_lfr_n_bp_p0 ) - floor(sy_lfr_n_bp_p1 / sy_lfr_n_bp_p0); | |
409 |
if (aux |
|
409 | if (aux > FLOAT_EQUAL_ZERO) | |
410 | { |
|
410 | { | |
411 | status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_N_BP_P1+10, sy_lfr_n_bp_p1 ); |
|
411 | status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_N_BP_P1+10, sy_lfr_n_bp_p1 ); | |
412 | flag = LFR_DEFAULT; |
|
412 | flag = LFR_DEFAULT; | |
413 | } |
|
413 | } | |
414 | } |
|
414 | } | |
415 | // sy_lfr_n_cwf_long_f3 |
|
415 | // sy_lfr_n_cwf_long_f3 | |
416 |
|
416 | |||
417 | return flag; |
|
417 | return flag; | |
418 | } |
|
418 | } | |
419 |
|
419 | |||
420 | int set_sy_lfr_n_swf_l( ccsdsTelecommandPacket_t *TC ) |
|
420 | int set_sy_lfr_n_swf_l( ccsdsTelecommandPacket_t *TC ) | |
421 | { |
|
421 | { | |
422 | /** This function sets the number of points of a snapshot (sy_lfr_n_swf_l). |
|
422 | /** This function sets the number of points of a snapshot (sy_lfr_n_swf_l). | |
423 | * |
|
423 | * | |
424 | * @param TC points to the TeleCommand packet that is being processed |
|
424 | * @param TC points to the TeleCommand packet that is being processed | |
425 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
425 | * @param queue_id is the id of the queue which handles TM related to this execution step | |
426 | * |
|
426 | * | |
427 | */ |
|
427 | */ | |
428 |
|
428 | |||
429 | int result; |
|
429 | int result; | |
430 |
|
430 | |||
431 | result = LFR_SUCCESSFUL; |
|
431 | result = LFR_SUCCESSFUL; | |
432 |
|
432 | |||
433 | parameter_dump_packet.sy_lfr_n_swf_l[0] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_SWF_L ]; |
|
433 | parameter_dump_packet.sy_lfr_n_swf_l[0] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_SWF_L ]; | |
434 | parameter_dump_packet.sy_lfr_n_swf_l[1] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_SWF_L+1 ]; |
|
434 | parameter_dump_packet.sy_lfr_n_swf_l[1] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_SWF_L+1 ]; | |
435 |
|
435 | |||
436 | return result; |
|
436 | return result; | |
437 | } |
|
437 | } | |
438 |
|
438 | |||
439 | int set_sy_lfr_n_swf_p(ccsdsTelecommandPacket_t *TC ) |
|
439 | int set_sy_lfr_n_swf_p(ccsdsTelecommandPacket_t *TC ) | |
440 | { |
|
440 | { | |
441 | /** This function sets the time between two snapshots, in s (sy_lfr_n_swf_p). |
|
441 | /** This function sets the time between two snapshots, in s (sy_lfr_n_swf_p). | |
442 | * |
|
442 | * | |
443 | * @param TC points to the TeleCommand packet that is being processed |
|
443 | * @param TC points to the TeleCommand packet that is being processed | |
444 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
444 | * @param queue_id is the id of the queue which handles TM related to this execution step | |
445 | * |
|
445 | * | |
446 | */ |
|
446 | */ | |
447 |
|
447 | |||
448 | int result; |
|
448 | int result; | |
449 |
|
449 | |||
450 | result = LFR_SUCCESSFUL; |
|
450 | result = LFR_SUCCESSFUL; | |
451 |
|
451 | |||
452 | parameter_dump_packet.sy_lfr_n_swf_p[0] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_SWF_P ]; |
|
452 | parameter_dump_packet.sy_lfr_n_swf_p[0] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_SWF_P ]; | |
453 | parameter_dump_packet.sy_lfr_n_swf_p[1] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_SWF_P+1 ]; |
|
453 | parameter_dump_packet.sy_lfr_n_swf_p[1] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_SWF_P+1 ]; | |
454 |
|
454 | |||
455 | return result; |
|
455 | return result; | |
456 | } |
|
456 | } | |
457 |
|
457 | |||
458 | int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC ) |
|
458 | int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC ) | |
459 | { |
|
459 | { | |
460 | /** This function sets the time between two full spectral matrices transmission, in s (SY_LFR_N_ASM_P). |
|
460 | /** This function sets the time between two full spectral matrices transmission, in s (SY_LFR_N_ASM_P). | |
461 | * |
|
461 | * | |
462 | * @param TC points to the TeleCommand packet that is being processed |
|
462 | * @param TC points to the TeleCommand packet that is being processed | |
463 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
463 | * @param queue_id is the id of the queue which handles TM related to this execution step | |
464 | * |
|
464 | * | |
465 | */ |
|
465 | */ | |
466 |
|
466 | |||
467 | int result; |
|
467 | int result; | |
468 |
|
468 | |||
469 | result = LFR_SUCCESSFUL; |
|
469 | result = LFR_SUCCESSFUL; | |
470 |
|
470 | |||
471 | parameter_dump_packet.sy_lfr_n_asm_p[0] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_ASM_P ]; |
|
471 | parameter_dump_packet.sy_lfr_n_asm_p[0] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_ASM_P ]; | |
472 | parameter_dump_packet.sy_lfr_n_asm_p[1] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_ASM_P+1 ]; |
|
472 | parameter_dump_packet.sy_lfr_n_asm_p[1] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_ASM_P+1 ]; | |
473 |
|
473 | |||
474 | return result; |
|
474 | return result; | |
475 | } |
|
475 | } | |
476 |
|
476 | |||
477 | int set_sy_lfr_n_bp_p0( ccsdsTelecommandPacket_t *TC ) |
|
477 | int set_sy_lfr_n_bp_p0( ccsdsTelecommandPacket_t *TC ) | |
478 | { |
|
478 | { | |
479 | /** This function sets the time between two basic parameter sets, in s (SY_LFR_N_BP_P0). |
|
479 | /** This function sets the time between two basic parameter sets, in s (DFLT_SY_LFR_N_BP_P0). | |
480 | * |
|
480 | * | |
481 | * @param TC points to the TeleCommand packet that is being processed |
|
481 | * @param TC points to the TeleCommand packet that is being processed | |
482 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
482 | * @param queue_id is the id of the queue which handles TM related to this execution step | |
483 | * |
|
483 | * | |
484 | */ |
|
484 | */ | |
485 |
|
485 | |||
486 | int status; |
|
486 | int status; | |
487 |
|
487 | |||
488 | status = LFR_SUCCESSFUL; |
|
488 | status = LFR_SUCCESSFUL; | |
489 |
|
489 | |||
490 | parameter_dump_packet.sy_lfr_n_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_BP_P0 ]; |
|
490 | parameter_dump_packet.sy_lfr_n_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_BP_P0 ]; | |
491 |
|
491 | |||
492 | return status; |
|
492 | return status; | |
493 | } |
|
493 | } | |
494 |
|
494 | |||
495 | int set_sy_lfr_n_bp_p1(ccsdsTelecommandPacket_t *TC ) |
|
495 | int set_sy_lfr_n_bp_p1(ccsdsTelecommandPacket_t *TC ) | |
496 | { |
|
496 | { | |
497 | /** This function sets the time between two basic parameter sets (autocorrelation + crosscorrelation), in s (sy_lfr_n_bp_p1). |
|
497 | /** This function sets the time between two basic parameter sets (autocorrelation + crosscorrelation), in s (sy_lfr_n_bp_p1). | |
498 | * |
|
498 | * | |
499 | * @param TC points to the TeleCommand packet that is being processed |
|
499 | * @param TC points to the TeleCommand packet that is being processed | |
500 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
500 | * @param queue_id is the id of the queue which handles TM related to this execution step | |
501 | * |
|
501 | * | |
502 | */ |
|
502 | */ | |
503 |
|
503 | |||
504 | int status; |
|
504 | int status; | |
505 |
|
505 | |||
506 | status = LFR_SUCCESSFUL; |
|
506 | status = LFR_SUCCESSFUL; | |
507 |
|
507 | |||
508 | parameter_dump_packet.sy_lfr_n_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_BP_P1 ]; |
|
508 | parameter_dump_packet.sy_lfr_n_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_BP_P1 ]; | |
509 |
|
509 | |||
510 | return status; |
|
510 | return status; | |
511 | } |
|
511 | } | |
512 |
|
512 | |||
513 | int set_sy_lfr_n_cwf_long_f3(ccsdsTelecommandPacket_t *TC ) |
|
513 | int set_sy_lfr_n_cwf_long_f3(ccsdsTelecommandPacket_t *TC ) | |
514 | { |
|
514 | { | |
515 | /** This function allows to switch from CWF_F3 packets to CWF_LONG_F3 packets. |
|
515 | /** This function allows to switch from CWF_F3 packets to CWF_LONG_F3 packets. | |
516 | * |
|
516 | * | |
517 | * @param TC points to the TeleCommand packet that is being processed |
|
517 | * @param TC points to the TeleCommand packet that is being processed | |
518 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
518 | * @param queue_id is the id of the queue which handles TM related to this execution step | |
519 | * |
|
519 | * | |
520 | */ |
|
520 | */ | |
521 |
|
521 | |||
522 | int status; |
|
522 | int status; | |
523 |
|
523 | |||
524 | status = LFR_SUCCESSFUL; |
|
524 | status = LFR_SUCCESSFUL; | |
525 |
|
525 | |||
526 | parameter_dump_packet.sy_lfr_n_cwf_long_f3 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_CWF_LONG_F3 ]; |
|
526 | parameter_dump_packet.sy_lfr_n_cwf_long_f3 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_CWF_LONG_F3 ]; | |
527 |
|
527 | |||
528 | return status; |
|
528 | return status; | |
529 | } |
|
529 | } | |
530 |
|
530 | |||
531 | //********************** |
|
531 | //********************** | |
532 | // BURST MODE PARAMETERS |
|
532 | // BURST MODE PARAMETERS | |
533 | int set_sy_lfr_b_bp_p0(ccsdsTelecommandPacket_t *TC) |
|
533 | int set_sy_lfr_b_bp_p0(ccsdsTelecommandPacket_t *TC) | |
534 | { |
|
534 | { | |
535 | /** This function sets the time between two basic parameter sets, in s (SY_LFR_B_BP_P0). |
|
535 | /** This function sets the time between two basic parameter sets, in s (SY_LFR_B_BP_P0). | |
536 | * |
|
536 | * | |
537 | * @param TC points to the TeleCommand packet that is being processed |
|
537 | * @param TC points to the TeleCommand packet that is being processed | |
538 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
538 | * @param queue_id is the id of the queue which handles TM related to this execution step | |
539 | * |
|
539 | * | |
540 | */ |
|
540 | */ | |
541 |
|
541 | |||
542 | int status; |
|
542 | int status; | |
543 |
|
543 | |||
544 | status = LFR_SUCCESSFUL; |
|
544 | status = LFR_SUCCESSFUL; | |
545 |
|
545 | |||
546 | parameter_dump_packet.sy_lfr_b_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_B_BP_P0 ]; |
|
546 | parameter_dump_packet.sy_lfr_b_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_B_BP_P0 ]; | |
547 |
|
547 | |||
548 | return status; |
|
548 | return status; | |
549 | } |
|
549 | } | |
550 |
|
550 | |||
551 | int set_sy_lfr_b_bp_p1( ccsdsTelecommandPacket_t *TC ) |
|
551 | int set_sy_lfr_b_bp_p1( ccsdsTelecommandPacket_t *TC ) | |
552 | { |
|
552 | { | |
553 | /** This function sets the time between two basic parameter sets, in s (SY_LFR_B_BP_P1). |
|
553 | /** This function sets the time between two basic parameter sets, in s (SY_LFR_B_BP_P1). | |
554 | * |
|
554 | * | |
555 | * @param TC points to the TeleCommand packet that is being processed |
|
555 | * @param TC points to the TeleCommand packet that is being processed | |
556 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
556 | * @param queue_id is the id of the queue which handles TM related to this execution step | |
557 | * |
|
557 | * | |
558 | */ |
|
558 | */ | |
559 |
|
559 | |||
560 | int status; |
|
560 | int status; | |
561 |
|
561 | |||
562 | status = LFR_SUCCESSFUL; |
|
562 | status = LFR_SUCCESSFUL; | |
563 |
|
563 | |||
564 | parameter_dump_packet.sy_lfr_b_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_B_BP_P1 ]; |
|
564 | parameter_dump_packet.sy_lfr_b_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_B_BP_P1 ]; | |
565 |
|
565 | |||
566 | return status; |
|
566 | return status; | |
567 | } |
|
567 | } | |
568 |
|
568 | |||
569 | //********************* |
|
569 | //********************* | |
570 | // SBM1 MODE PARAMETERS |
|
570 | // SBM1 MODE PARAMETERS | |
571 | int set_sy_lfr_s1_bp_p0( ccsdsTelecommandPacket_t *TC ) |
|
571 | int set_sy_lfr_s1_bp_p0( ccsdsTelecommandPacket_t *TC ) | |
572 | { |
|
572 | { | |
573 | /** This function sets the time between two basic parameter sets, in s (SY_LFR_S1_BP_P0). |
|
573 | /** This function sets the time between two basic parameter sets, in s (SY_LFR_S1_BP_P0). | |
574 | * |
|
574 | * | |
575 | * @param TC points to the TeleCommand packet that is being processed |
|
575 | * @param TC points to the TeleCommand packet that is being processed | |
576 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
576 | * @param queue_id is the id of the queue which handles TM related to this execution step | |
577 | * |
|
577 | * | |
578 | */ |
|
578 | */ | |
579 |
|
579 | |||
580 | int status; |
|
580 | int status; | |
581 |
|
581 | |||
582 | status = LFR_SUCCESSFUL; |
|
582 | status = LFR_SUCCESSFUL; | |
583 |
|
583 | |||
584 | parameter_dump_packet.sy_lfr_s1_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S1_BP_P0 ]; |
|
584 | parameter_dump_packet.sy_lfr_s1_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S1_BP_P0 ]; | |
585 |
|
585 | |||
586 | return status; |
|
586 | return status; | |
587 | } |
|
587 | } | |
588 |
|
588 | |||
589 | int set_sy_lfr_s1_bp_p1( ccsdsTelecommandPacket_t *TC ) |
|
589 | int set_sy_lfr_s1_bp_p1( ccsdsTelecommandPacket_t *TC ) | |
590 | { |
|
590 | { | |
591 | /** This function sets the time between two basic parameter sets, in s (SY_LFR_S1_BP_P1). |
|
591 | /** This function sets the time between two basic parameter sets, in s (SY_LFR_S1_BP_P1). | |
592 | * |
|
592 | * | |
593 | * @param TC points to the TeleCommand packet that is being processed |
|
593 | * @param TC points to the TeleCommand packet that is being processed | |
594 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
594 | * @param queue_id is the id of the queue which handles TM related to this execution step | |
595 | * |
|
595 | * | |
596 | */ |
|
596 | */ | |
597 |
|
597 | |||
598 | int status; |
|
598 | int status; | |
599 |
|
599 | |||
600 | status = LFR_SUCCESSFUL; |
|
600 | status = LFR_SUCCESSFUL; | |
601 |
|
601 | |||
602 | parameter_dump_packet.sy_lfr_s1_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S1_BP_P1 ]; |
|
602 | parameter_dump_packet.sy_lfr_s1_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S1_BP_P1 ]; | |
603 |
|
603 | |||
604 | return status; |
|
604 | return status; | |
605 | } |
|
605 | } | |
606 |
|
606 | |||
607 | //********************* |
|
607 | //********************* | |
608 | // SBM2 MODE PARAMETERS |
|
608 | // SBM2 MODE PARAMETERS | |
609 | int set_sy_lfr_s2_bp_p0(ccsdsTelecommandPacket_t *TC) |
|
609 | int set_sy_lfr_s2_bp_p0(ccsdsTelecommandPacket_t *TC) | |
610 | { |
|
610 | { | |
611 | /** This function sets the time between two basic parameter sets, in s (SY_LFR_S2_BP_P0). |
|
611 | /** This function sets the time between two basic parameter sets, in s (SY_LFR_S2_BP_P0). | |
612 | * |
|
612 | * | |
613 | * @param TC points to the TeleCommand packet that is being processed |
|
613 | * @param TC points to the TeleCommand packet that is being processed | |
614 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
614 | * @param queue_id is the id of the queue which handles TM related to this execution step | |
615 | * |
|
615 | * | |
616 | */ |
|
616 | */ | |
617 |
|
617 | |||
618 | int status; |
|
618 | int status; | |
619 |
|
619 | |||
620 | status = LFR_SUCCESSFUL; |
|
620 | status = LFR_SUCCESSFUL; | |
621 |
|
621 | |||
622 | parameter_dump_packet.sy_lfr_s2_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S2_BP_P0 ]; |
|
622 | parameter_dump_packet.sy_lfr_s2_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S2_BP_P0 ]; | |
623 |
|
623 | |||
624 | return status; |
|
624 | return status; | |
625 | } |
|
625 | } | |
626 |
|
626 | |||
627 | int set_sy_lfr_s2_bp_p1( ccsdsTelecommandPacket_t *TC ) |
|
627 | int set_sy_lfr_s2_bp_p1( ccsdsTelecommandPacket_t *TC ) | |
628 | { |
|
628 | { | |
629 | /** This function sets the time between two basic parameter sets, in s (SY_LFR_S2_BP_P1). |
|
629 | /** This function sets the time between two basic parameter sets, in s (SY_LFR_S2_BP_P1). | |
630 | * |
|
630 | * | |
631 | * @param TC points to the TeleCommand packet that is being processed |
|
631 | * @param TC points to the TeleCommand packet that is being processed | |
632 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
632 | * @param queue_id is the id of the queue which handles TM related to this execution step | |
633 | * |
|
633 | * | |
634 | */ |
|
634 | */ | |
635 |
|
635 | |||
636 | int status; |
|
636 | int status; | |
637 |
|
637 | |||
638 | status = LFR_SUCCESSFUL; |
|
638 | status = LFR_SUCCESSFUL; | |
639 |
|
639 | |||
640 | parameter_dump_packet.sy_lfr_s2_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S2_BP_P1 ]; |
|
640 | parameter_dump_packet.sy_lfr_s2_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S2_BP_P1 ]; | |
641 |
|
641 | |||
642 | return status; |
|
642 | return status; | |
643 | } |
|
643 | } | |
644 |
|
644 | |||
645 |
|
645 | |||
646 | //******************* |
|
646 | //******************* | |
647 | // TC_LFR_UPDATE_INFO |
|
647 | // TC_LFR_UPDATE_INFO | |
648 | unsigned int check_update_info_hk_lfr_mode( unsigned char mode ) |
|
648 | unsigned int check_update_info_hk_lfr_mode( unsigned char mode ) | |
649 | { |
|
649 | { | |
650 | unsigned int status; |
|
650 | unsigned int status; | |
651 |
|
651 | |||
652 | if ( (mode == LFR_MODE_STANDBY) || (mode == LFR_MODE_NORMAL) |
|
652 | if ( (mode == LFR_MODE_STANDBY) || (mode == LFR_MODE_NORMAL) | |
653 | || (mode == LFR_MODE_BURST) |
|
653 | || (mode == LFR_MODE_BURST) | |
654 | || (mode == LFR_MODE_SBM1) || (mode == LFR_MODE_SBM2)) |
|
654 | || (mode == LFR_MODE_SBM1) || (mode == LFR_MODE_SBM2)) | |
655 | { |
|
655 | { | |
656 | status = LFR_SUCCESSFUL; |
|
656 | status = LFR_SUCCESSFUL; | |
657 | } |
|
657 | } | |
658 | else |
|
658 | else | |
659 | { |
|
659 | { | |
660 | status = LFR_DEFAULT; |
|
660 | status = LFR_DEFAULT; | |
661 | } |
|
661 | } | |
662 |
|
662 | |||
663 | return status; |
|
663 | return status; | |
664 | } |
|
664 | } | |
665 |
|
665 | |||
666 | unsigned int check_update_info_hk_tds_mode( unsigned char mode ) |
|
666 | unsigned int check_update_info_hk_tds_mode( unsigned char mode ) | |
667 | { |
|
667 | { | |
668 | unsigned int status; |
|
668 | unsigned int status; | |
669 |
|
669 | |||
670 | if ( (mode == TDS_MODE_STANDBY) || (mode == TDS_MODE_NORMAL) |
|
670 | if ( (mode == TDS_MODE_STANDBY) || (mode == TDS_MODE_NORMAL) | |
671 | || (mode == TDS_MODE_BURST) |
|
671 | || (mode == TDS_MODE_BURST) | |
672 | || (mode == TDS_MODE_SBM1) || (mode == TDS_MODE_SBM2) |
|
672 | || (mode == TDS_MODE_SBM1) || (mode == TDS_MODE_SBM2) | |
673 | || (mode == TDS_MODE_LFM)) |
|
673 | || (mode == TDS_MODE_LFM)) | |
674 | { |
|
674 | { | |
675 | status = LFR_SUCCESSFUL; |
|
675 | status = LFR_SUCCESSFUL; | |
676 | } |
|
676 | } | |
677 | else |
|
677 | else | |
678 | { |
|
678 | { | |
679 | status = LFR_DEFAULT; |
|
679 | status = LFR_DEFAULT; | |
680 | } |
|
680 | } | |
681 |
|
681 | |||
682 | return status; |
|
682 | return status; | |
683 | } |
|
683 | } | |
684 |
|
684 | |||
685 | unsigned int check_update_info_hk_thr_mode( unsigned char mode ) |
|
685 | unsigned int check_update_info_hk_thr_mode( unsigned char mode ) | |
686 | { |
|
686 | { | |
687 | unsigned int status; |
|
687 | unsigned int status; | |
688 |
|
688 | |||
689 | if ( (mode == THR_MODE_STANDBY) || (mode == THR_MODE_NORMAL) |
|
689 | if ( (mode == THR_MODE_STANDBY) || (mode == THR_MODE_NORMAL) | |
690 | || (mode == THR_MODE_BURST)) |
|
690 | || (mode == THR_MODE_BURST)) | |
691 | { |
|
691 | { | |
692 | status = LFR_SUCCESSFUL; |
|
692 | status = LFR_SUCCESSFUL; | |
693 | } |
|
693 | } | |
694 | else |
|
694 | else | |
695 | { |
|
695 | { | |
696 | status = LFR_DEFAULT; |
|
696 | status = LFR_DEFAULT; | |
697 | } |
|
697 | } | |
698 |
|
698 | |||
699 | return status; |
|
699 | return status; | |
700 | } |
|
700 | } | |
701 |
|
701 | |||
702 | //********** |
|
702 | //********** | |
703 | // init dump |
|
703 | // init dump | |
704 |
|
704 | |||
705 | void init_parameter_dump( void ) |
|
705 | void init_parameter_dump( void ) | |
706 | { |
|
706 | { | |
707 | /** This function initialize the parameter_dump_packet global variable with default values. |
|
707 | /** This function initialize the parameter_dump_packet global variable with default values. | |
708 | * |
|
708 | * | |
709 | */ |
|
709 | */ | |
710 |
|
710 | |||
711 | parameter_dump_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
711 | parameter_dump_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; | |
712 | parameter_dump_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
712 | parameter_dump_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
713 | parameter_dump_packet.reserved = CCSDS_RESERVED; |
|
713 | parameter_dump_packet.reserved = CCSDS_RESERVED; | |
714 | parameter_dump_packet.userApplication = CCSDS_USER_APP; |
|
714 | parameter_dump_packet.userApplication = CCSDS_USER_APP; | |
715 | parameter_dump_packet.packetID[0] = (unsigned char) (APID_TM_PARAMETER_DUMP >> 8); |
|
715 | parameter_dump_packet.packetID[0] = (unsigned char) (APID_TM_PARAMETER_DUMP >> 8); | |
716 | parameter_dump_packet.packetID[1] = (unsigned char) APID_TM_PARAMETER_DUMP; |
|
716 | parameter_dump_packet.packetID[1] = (unsigned char) APID_TM_PARAMETER_DUMP; | |
717 | parameter_dump_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
717 | parameter_dump_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
718 | parameter_dump_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
718 | parameter_dump_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
719 | parameter_dump_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_PARAMETER_DUMP >> 8); |
|
719 | parameter_dump_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_PARAMETER_DUMP >> 8); | |
720 | parameter_dump_packet.packetLength[1] = (unsigned char) PACKET_LENGTH_PARAMETER_DUMP; |
|
720 | parameter_dump_packet.packetLength[1] = (unsigned char) PACKET_LENGTH_PARAMETER_DUMP; | |
721 | // DATA FIELD HEADER |
|
721 | // DATA FIELD HEADER | |
722 | parameter_dump_packet.spare1_pusVersion_spare2 = SPARE1_PUSVERSION_SPARE2; |
|
722 | parameter_dump_packet.spare1_pusVersion_spare2 = SPARE1_PUSVERSION_SPARE2; | |
723 | parameter_dump_packet.serviceType = TM_TYPE_PARAMETER_DUMP; |
|
723 | parameter_dump_packet.serviceType = TM_TYPE_PARAMETER_DUMP; | |
724 | parameter_dump_packet.serviceSubType = TM_SUBTYPE_PARAMETER_DUMP; |
|
724 | parameter_dump_packet.serviceSubType = TM_SUBTYPE_PARAMETER_DUMP; | |
725 | parameter_dump_packet.destinationID = TM_DESTINATION_ID_GROUND; |
|
725 | parameter_dump_packet.destinationID = TM_DESTINATION_ID_GROUND; | |
726 | parameter_dump_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
726 | parameter_dump_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
727 | parameter_dump_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
727 | parameter_dump_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
728 | parameter_dump_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
728 | parameter_dump_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
729 | parameter_dump_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
729 | parameter_dump_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); | |
730 | parameter_dump_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
730 | parameter_dump_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
731 | parameter_dump_packet.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
731 | parameter_dump_packet.time[5] = (unsigned char) (time_management_regs->fine_time); | |
732 | parameter_dump_packet.sid = SID_PARAMETER_DUMP; |
|
732 | parameter_dump_packet.sid = SID_PARAMETER_DUMP; | |
733 |
|
733 | |||
734 | //****************** |
|
734 | //****************** | |
735 | // COMMON PARAMETERS |
|
735 | // COMMON PARAMETERS | |
736 | parameter_dump_packet.unused0 = DEFAULT_SY_LFR_COMMON0; |
|
736 | parameter_dump_packet.unused0 = DEFAULT_SY_LFR_COMMON0; | |
737 | parameter_dump_packet.bw_sp0_sp1_r0_r1 = DEFAULT_SY_LFR_COMMON1; |
|
737 | parameter_dump_packet.bw_sp0_sp1_r0_r1 = DEFAULT_SY_LFR_COMMON1; | |
738 |
|
738 | |||
739 | //****************** |
|
739 | //****************** | |
740 | // NORMAL PARAMETERS |
|
740 | // NORMAL PARAMETERS | |
741 | parameter_dump_packet.sy_lfr_n_swf_l[0] = (unsigned char) (SY_LFR_N_SWF_L >> 8); |
|
741 | parameter_dump_packet.sy_lfr_n_swf_l[0] = (unsigned char) (DFLT_SY_LFR_N_SWF_L >> 8); | |
742 | parameter_dump_packet.sy_lfr_n_swf_l[1] = (unsigned char) (SY_LFR_N_SWF_L ); |
|
742 | parameter_dump_packet.sy_lfr_n_swf_l[1] = (unsigned char) (DFLT_SY_LFR_N_SWF_L ); | |
743 | parameter_dump_packet.sy_lfr_n_swf_p[0] = (unsigned char) (SY_LFR_N_SWF_P >> 8); |
|
743 | parameter_dump_packet.sy_lfr_n_swf_p[0] = (unsigned char) (DFLT_SY_LFR_N_SWF_P >> 8); | |
744 | parameter_dump_packet.sy_lfr_n_swf_p[1] = (unsigned char) (SY_LFR_N_SWF_P ); |
|
744 | parameter_dump_packet.sy_lfr_n_swf_p[1] = (unsigned char) (DFLT_SY_LFR_N_SWF_P ); | |
745 | parameter_dump_packet.sy_lfr_n_asm_p[0] = (unsigned char) (SY_LFR_N_ASM_P >> 8); |
|
745 | parameter_dump_packet.sy_lfr_n_asm_p[0] = (unsigned char) (DFLT_SY_LFR_N_ASM_P >> 8); | |
746 | parameter_dump_packet.sy_lfr_n_asm_p[1] = (unsigned char) (SY_LFR_N_ASM_P ); |
|
746 | parameter_dump_packet.sy_lfr_n_asm_p[1] = (unsigned char) (DFLT_SY_LFR_N_ASM_P ); | |
747 | parameter_dump_packet.sy_lfr_n_bp_p0 = (unsigned char) SY_LFR_N_BP_P0; |
|
747 | parameter_dump_packet.sy_lfr_n_bp_p0 = (unsigned char) DFLT_SY_LFR_N_BP_P0; | |
748 | parameter_dump_packet.sy_lfr_n_bp_p1 = (unsigned char) SY_LFR_N_BP_P1; |
|
748 | parameter_dump_packet.sy_lfr_n_bp_p1 = (unsigned char) DFLT_SY_LFR_N_BP_P1; | |
749 | parameter_dump_packet.sy_lfr_n_cwf_long_f3 = (unsigned char) SY_LFR_N_CWF_LONG_F3; |
|
749 | parameter_dump_packet.sy_lfr_n_cwf_long_f3 = (unsigned char) DFLT_SY_LFR_N_CWF_LONG_F3; | |
750 |
|
750 | |||
751 | //***************** |
|
751 | //***************** | |
752 | // BURST PARAMETERS |
|
752 | // BURST PARAMETERS | |
753 | parameter_dump_packet.sy_lfr_b_bp_p0 = (unsigned char) DEFAULT_SY_LFR_B_BP_P0; |
|
753 | parameter_dump_packet.sy_lfr_b_bp_p0 = (unsigned char) DEFAULT_SY_LFR_B_BP_P0; | |
754 | parameter_dump_packet.sy_lfr_b_bp_p1 = (unsigned char) DEFAULT_SY_LFR_B_BP_P1; |
|
754 | parameter_dump_packet.sy_lfr_b_bp_p1 = (unsigned char) DEFAULT_SY_LFR_B_BP_P1; | |
755 |
|
755 | |||
756 | //**************** |
|
756 | //**************** | |
757 | // SBM1 PARAMETERS |
|
757 | // SBM1 PARAMETERS | |
758 | 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 |
|
758 | 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 | |
759 | parameter_dump_packet.sy_lfr_s1_bp_p1 = (unsigned char) DEFAULT_SY_LFR_S1_BP_P1; |
|
759 | parameter_dump_packet.sy_lfr_s1_bp_p1 = (unsigned char) DEFAULT_SY_LFR_S1_BP_P1; | |
760 |
|
760 | |||
761 | //**************** |
|
761 | //**************** | |
762 | // SBM2 PARAMETERS |
|
762 | // SBM2 PARAMETERS | |
763 | parameter_dump_packet.sy_lfr_s2_bp_p0 = (unsigned char) DEFAULT_SY_LFR_S2_BP_P0; |
|
763 | parameter_dump_packet.sy_lfr_s2_bp_p0 = (unsigned char) DEFAULT_SY_LFR_S2_BP_P0; | |
764 | parameter_dump_packet.sy_lfr_s2_bp_p1 = (unsigned char) DEFAULT_SY_LFR_S2_BP_P1; |
|
764 | parameter_dump_packet.sy_lfr_s2_bp_p1 = (unsigned char) DEFAULT_SY_LFR_S2_BP_P1; | |
765 | } |
|
765 | } | |
766 |
|
766 | |||
767 |
|
767 | |||
768 |
|
768 | |||
769 |
|
769 | |||
770 |
|
770 | |||
771 |
|
771 | |||
772 |
|
772 |
@@ -1,1310 +1,1323 | |||||
1 | /** Functions and tasks related to waveform packet generation. |
|
1 | /** Functions and tasks related to waveform packet generation. | |
2 | * |
|
2 | * | |
3 | * @file |
|
3 | * @file | |
4 | * @author P. LEROY |
|
4 | * @author P. LEROY | |
5 | * |
|
5 | * | |
6 | * A group of functions to handle waveforms, in snapshot or continuous format.\n |
|
6 | * A group of functions to handle waveforms, in snapshot or continuous format.\n | |
7 | * |
|
7 | * | |
8 | */ |
|
8 | */ | |
9 |
|
9 | |||
10 | #include "wf_handler.h" |
|
10 | #include "wf_handler.h" | |
11 |
|
11 | |||
12 | //***************** |
|
12 | //***************** | |
13 | // waveform headers |
|
13 | // waveform headers | |
14 | // SWF |
|
14 | // SWF | |
15 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F0[7]; |
|
15 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F0[7]; | |
16 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F1[7]; |
|
16 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F1[7]; | |
17 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F2[7]; |
|
17 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F2[7]; | |
18 | // CWF |
|
18 | // CWF | |
19 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F1[ NB_PACKETS_PER_GROUP_OF_CWF ]; |
|
19 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F1[ NB_PACKETS_PER_GROUP_OF_CWF ]; | |
20 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_BURST[ NB_PACKETS_PER_GROUP_OF_CWF ]; |
|
20 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_BURST[ NB_PACKETS_PER_GROUP_OF_CWF ]; | |
21 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_SBM2[ NB_PACKETS_PER_GROUP_OF_CWF ]; |
|
21 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_SBM2[ NB_PACKETS_PER_GROUP_OF_CWF ]; | |
22 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3[ NB_PACKETS_PER_GROUP_OF_CWF ]; |
|
22 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3[ NB_PACKETS_PER_GROUP_OF_CWF ]; | |
23 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3_light[ NB_PACKETS_PER_GROUP_OF_CWF_LIGHT ]; |
|
23 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3_light[ NB_PACKETS_PER_GROUP_OF_CWF_LIGHT ]; | |
24 |
|
24 | |||
25 | //************** |
|
25 | //************** | |
26 | // waveform ring |
|
26 | // waveform ring | |
27 | ring_node waveform_ring_f0[NB_RING_NODES_F0]; |
|
27 | ring_node waveform_ring_f0[NB_RING_NODES_F0]; | |
28 | ring_node waveform_ring_f1[NB_RING_NODES_F1]; |
|
28 | ring_node waveform_ring_f1[NB_RING_NODES_F1]; | |
29 | ring_node waveform_ring_f2[NB_RING_NODES_F2]; |
|
29 | ring_node waveform_ring_f2[NB_RING_NODES_F2]; | |
30 | ring_node waveform_ring_f3[NB_RING_NODES_F3]; |
|
30 | ring_node waveform_ring_f3[NB_RING_NODES_F3]; | |
31 | ring_node *current_ring_node_f0; |
|
31 | ring_node *current_ring_node_f0; | |
32 | ring_node *ring_node_to_send_swf_f0; |
|
32 | ring_node *ring_node_to_send_swf_f0; | |
33 | ring_node *current_ring_node_f1; |
|
33 | ring_node *current_ring_node_f1; | |
34 | ring_node *ring_node_to_send_swf_f1; |
|
34 | ring_node *ring_node_to_send_swf_f1; | |
35 | ring_node *ring_node_to_send_cwf_f1; |
|
35 | ring_node *ring_node_to_send_cwf_f1; | |
36 | ring_node *current_ring_node_f2; |
|
36 | ring_node *current_ring_node_f2; | |
37 | ring_node *ring_node_to_send_swf_f2; |
|
37 | ring_node *ring_node_to_send_swf_f2; | |
38 | ring_node *ring_node_to_send_cwf_f2; |
|
38 | ring_node *ring_node_to_send_cwf_f2; | |
39 | ring_node *current_ring_node_f3; |
|
39 | ring_node *current_ring_node_f3; | |
40 | ring_node *ring_node_to_send_cwf_f3; |
|
40 | ring_node *ring_node_to_send_cwf_f3; | |
41 |
|
41 | |||
42 | bool extractSWF = false; |
|
42 | bool extractSWF = false; | |
43 | bool swf_f0_ready = false; |
|
43 | bool swf_f0_ready = false; | |
44 | bool swf_f1_ready = false; |
|
44 | bool swf_f1_ready = false; | |
45 | bool swf_f2_ready = false; |
|
45 | bool swf_f2_ready = false; | |
46 |
|
46 | |||
47 | int wf_snap_extracted[ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET ]; |
|
47 | int wf_snap_extracted[ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET ]; | |
48 |
|
48 | |||
49 | //********************* |
|
49 | //********************* | |
50 | // Interrupt SubRoutine |
|
50 | // Interrupt SubRoutine | |
51 |
|
51 | |||
52 | void reset_extractSWF( void ) |
|
52 | void reset_extractSWF( void ) | |
53 | { |
|
53 | { | |
54 | extractSWF = false; |
|
54 | extractSWF = false; | |
55 | swf_f0_ready = false; |
|
55 | swf_f0_ready = false; | |
56 | swf_f1_ready = false; |
|
56 | swf_f1_ready = false; | |
57 | swf_f2_ready = false; |
|
57 | swf_f2_ready = false; | |
58 | } |
|
58 | } | |
59 |
|
59 | |||
60 | rtems_isr waveforms_isr( rtems_vector_number vector ) |
|
60 | rtems_isr waveforms_isr( rtems_vector_number vector ) | |
61 | { |
|
61 | { | |
62 | /** This is the interrupt sub routine called by the waveform picker core. |
|
62 | /** This is the interrupt sub routine called by the waveform picker core. | |
63 | * |
|
63 | * | |
64 | * This ISR launch different actions depending mainly on two pieces of information: |
|
64 | * This ISR launch different actions depending mainly on two pieces of information: | |
65 | * 1. the values read in the registers of the waveform picker. |
|
65 | * 1. the values read in the registers of the waveform picker. | |
66 | * 2. the current LFR mode. |
|
66 | * 2. the current LFR mode. | |
67 | * |
|
67 | * | |
68 | */ |
|
68 | */ | |
69 |
|
69 | |||
70 | rtems_status_code status; |
|
70 | rtems_status_code status; | |
|
71 | rtems_status_code spare_status; | |||
71 |
|
72 | |||
72 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) || (lfrCurrentMode == LFR_MODE_BURST) // in BURST the data are used to place v, e1 and e2 in the HK packet |
|
73 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) || (lfrCurrentMode == LFR_MODE_BURST) // in BURST the data are used to place v, e1 and e2 in the HK packet | |
73 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
74 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) | |
74 | { // in modes other than STANDBY and BURST, send the CWF_F3 data |
|
75 | { // in modes other than STANDBY and BURST, send the CWF_F3 data | |
75 | if ((waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full |
|
76 | if ((waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full | |
76 | // (1) change the receiving buffer for the waveform picker |
|
77 | // (1) change the receiving buffer for the waveform picker | |
77 | ring_node_to_send_cwf_f3 = current_ring_node_f3; |
|
78 | ring_node_to_send_cwf_f3 = current_ring_node_f3; | |
78 | current_ring_node_f3 = current_ring_node_f3->next; |
|
79 | current_ring_node_f3 = current_ring_node_f3->next; | |
79 | waveform_picker_regs->addr_data_f3 = current_ring_node_f3->buffer_address; |
|
80 | waveform_picker_regs->addr_data_f3 = current_ring_node_f3->buffer_address; | |
80 | // (2) send an event for the waveforms transmission |
|
81 | // (2) send an event for the waveforms transmission | |
81 | if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
82 | if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { | |
82 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
83 | spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
83 | } |
|
84 | } | |
84 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2); |
|
85 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2); | |
85 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff777; // reset f3 bits to 0, [1111 0111 0111 0111] |
|
86 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff777; // reset f3 bits to 0, [1111 0111 0111 0111] | |
86 | } |
|
87 | } | |
87 | } |
|
88 | } | |
88 |
|
89 | |||
89 | switch(lfrCurrentMode) |
|
90 | switch(lfrCurrentMode) | |
90 | { |
|
91 | { | |
91 | //******** |
|
92 | //******** | |
92 | // STANDBY |
|
93 | // STANDBY | |
93 | case(LFR_MODE_STANDBY): |
|
94 | case(LFR_MODE_STANDBY): | |
94 | break; |
|
95 | break; | |
95 |
|
96 | |||
96 | //****** |
|
97 | //****** | |
97 | // NORMAL |
|
98 | // NORMAL | |
98 | case(LFR_MODE_NORMAL): |
|
99 | case(LFR_MODE_NORMAL): | |
99 | if ( (waveform_picker_regs->status & 0xff8) != 0x00) // [1000] check the error bits |
|
100 | if ( (waveform_picker_regs->status & 0xff8) != 0x00) // [1000] check the error bits | |
100 | { |
|
101 | { | |
101 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
102 | spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
102 | } |
|
103 | } | |
103 | if ( (waveform_picker_regs->status & 0x07) == 0x07) // [0111] check the f2, f1, f0 full bits |
|
104 | if ( (waveform_picker_regs->status & 0x07) == 0x07) // [0111] check the f2, f1, f0 full bits | |
104 | { |
|
105 | { | |
105 | // change F0 ring node |
|
106 | // change F0 ring node | |
106 | ring_node_to_send_swf_f0 = current_ring_node_f0; |
|
107 | ring_node_to_send_swf_f0 = current_ring_node_f0; | |
107 | current_ring_node_f0 = current_ring_node_f0->next; |
|
108 | current_ring_node_f0 = current_ring_node_f0->next; | |
108 | waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address; |
|
109 | waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address; | |
109 | // change F1 ring node |
|
110 | // change F1 ring node | |
110 | ring_node_to_send_swf_f1 = current_ring_node_f1; |
|
111 | ring_node_to_send_swf_f1 = current_ring_node_f1; | |
111 | current_ring_node_f1 = current_ring_node_f1->next; |
|
112 | current_ring_node_f1 = current_ring_node_f1->next; | |
112 | waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; |
|
113 | waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; | |
113 | // change F2 ring node |
|
114 | // change F2 ring node | |
114 | ring_node_to_send_swf_f2 = current_ring_node_f2; |
|
115 | ring_node_to_send_swf_f2 = current_ring_node_f2; | |
115 | current_ring_node_f2 = current_ring_node_f2->next; |
|
116 | current_ring_node_f2 = current_ring_node_f2->next; | |
116 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; |
|
117 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; | |
117 | // |
|
118 | // | |
118 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) |
|
119 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) | |
119 | { |
|
120 | { | |
120 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
121 | spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
121 | } |
|
122 | } | |
122 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff888; // [1000 1000 1000] |
|
123 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff888; // [1000 1000 1000] | |
123 | } |
|
124 | } | |
124 | break; |
|
125 | break; | |
125 |
|
126 | |||
126 | //****** |
|
127 | //****** | |
127 | // BURST |
|
128 | // BURST | |
128 | case(LFR_MODE_BURST): |
|
129 | case(LFR_MODE_BURST): | |
129 | if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit |
|
130 | if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit | |
130 | // (1) change the receiving buffer for the waveform picker |
|
131 | // (1) change the receiving buffer for the waveform picker | |
131 | ring_node_to_send_cwf_f2 = current_ring_node_f2; |
|
132 | ring_node_to_send_cwf_f2 = current_ring_node_f2; | |
132 | current_ring_node_f2 = current_ring_node_f2->next; |
|
133 | current_ring_node_f2 = current_ring_node_f2->next; | |
133 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; |
|
134 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; | |
134 | // (2) send an event for the waveforms transmission |
|
135 | // (2) send an event for the waveforms transmission | |
135 | if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) { |
|
136 | if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) { | |
136 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
137 | spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
137 | } |
|
138 | } | |
138 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0 |
|
139 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0 | |
139 | } |
|
140 | } | |
140 | break; |
|
141 | break; | |
141 |
|
142 | |||
142 | //***** |
|
143 | //***** | |
143 | // SBM1 |
|
144 | // SBM1 | |
144 | case(LFR_MODE_SBM1): |
|
145 | case(LFR_MODE_SBM1): | |
145 | if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit |
|
146 | if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit | |
146 | // (1) change the receiving buffer for the waveform picker |
|
147 | // (1) change the receiving buffer for the waveform picker | |
147 | ring_node_to_send_cwf_f1 = current_ring_node_f1; |
|
148 | ring_node_to_send_cwf_f1 = current_ring_node_f1; | |
148 | current_ring_node_f1 = current_ring_node_f1->next; |
|
149 | current_ring_node_f1 = current_ring_node_f1->next; | |
149 | waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; |
|
150 | waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; | |
150 | // (2) send an event for the the CWF1 task for transmission (and snapshot extraction if needed) |
|
151 | // (2) send an event for the the CWF1 task for transmission (and snapshot extraction if needed) | |
151 | status = rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 ); |
|
152 | status = rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 ); | |
152 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bits = 0 |
|
153 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bits = 0 | |
153 | } |
|
154 | } | |
154 | if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit |
|
155 | if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit | |
155 | swf_f0_ready = true; |
|
156 | swf_f0_ready = true; | |
156 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffeee; // [1111 1110 1110 1110] f0 bits = 0 |
|
157 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffeee; // [1111 1110 1110 1110] f0 bits = 0 | |
157 | } |
|
158 | } | |
158 | if ( (waveform_picker_regs->status & 0x04) == 0x04 ) { // [0100] check the f2 full bit |
|
159 | if ( (waveform_picker_regs->status & 0x04) == 0x04 ) { // [0100] check the f2 full bit | |
159 | swf_f2_ready = true; |
|
160 | swf_f2_ready = true; | |
160 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bits = 0 |
|
161 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bits = 0 | |
161 | } |
|
162 | } | |
162 | break; |
|
163 | break; | |
163 |
|
164 | |||
164 | //***** |
|
165 | //***** | |
165 | // SBM2 |
|
166 | // SBM2 | |
166 | case(LFR_MODE_SBM2): |
|
167 | case(LFR_MODE_SBM2): | |
167 | if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit |
|
168 | if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit | |
168 | // (1) change the receiving buffer for the waveform picker |
|
169 | // (1) change the receiving buffer for the waveform picker | |
169 | ring_node_to_send_cwf_f2 = current_ring_node_f2; |
|
170 | ring_node_to_send_cwf_f2 = current_ring_node_f2; | |
170 | current_ring_node_f2 = current_ring_node_f2->next; |
|
171 | current_ring_node_f2 = current_ring_node_f2->next; | |
171 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; |
|
172 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; | |
172 | // (2) send an event for the waveforms transmission |
|
173 | // (2) send an event for the waveforms transmission | |
173 | status = rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 ); |
|
174 | status = rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 ); | |
174 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0 |
|
175 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0 | |
175 | } |
|
176 | } | |
176 | if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit |
|
177 | if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit | |
177 | swf_f0_ready = true; |
|
178 | swf_f0_ready = true; | |
178 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffeee; // [1111 1110 1110 1110] f0 bits = 0 |
|
179 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffeee; // [1111 1110 1110 1110] f0 bits = 0 | |
179 | } |
|
180 | } | |
180 | if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit |
|
181 | if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit | |
181 | swf_f1_ready = true; |
|
182 | swf_f1_ready = true; | |
182 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1, f0 bits = 0 |
|
183 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1, f0 bits = 0 | |
183 | } |
|
184 | } | |
184 | break; |
|
185 | break; | |
185 |
|
186 | |||
186 | //******** |
|
187 | //******** | |
187 | // DEFAULT |
|
188 | // DEFAULT | |
188 | default: |
|
189 | default: | |
189 | break; |
|
190 | break; | |
190 | } |
|
191 | } | |
191 | } |
|
192 | } | |
192 |
|
193 | |||
193 | //************ |
|
194 | //************ | |
194 | // RTEMS TASKS |
|
195 | // RTEMS TASKS | |
195 |
|
196 | |||
196 | rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP |
|
197 | rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP | |
197 | { |
|
198 | { | |
198 | /** This RTEMS task is dedicated to the transmission of snapshots of the NORMAL mode. |
|
199 | /** This RTEMS task is dedicated to the transmission of snapshots of the NORMAL mode. | |
199 | * |
|
200 | * | |
200 | * @param unused is the starting argument of the RTEMS task |
|
201 | * @param unused is the starting argument of the RTEMS task | |
201 | * |
|
202 | * | |
202 | * The following data packets are sent by this task: |
|
203 | * The following data packets are sent by this task: | |
203 | * - TM_LFR_SCIENCE_NORMAL_SWF_F0 |
|
204 | * - TM_LFR_SCIENCE_NORMAL_SWF_F0 | |
204 | * - TM_LFR_SCIENCE_NORMAL_SWF_F1 |
|
205 | * - TM_LFR_SCIENCE_NORMAL_SWF_F1 | |
205 | * - TM_LFR_SCIENCE_NORMAL_SWF_F2 |
|
206 | * - TM_LFR_SCIENCE_NORMAL_SWF_F2 | |
206 | * |
|
207 | * | |
207 | */ |
|
208 | */ | |
208 |
|
209 | |||
209 | rtems_event_set event_out; |
|
210 | rtems_event_set event_out; | |
210 | rtems_id queue_id; |
|
211 | rtems_id queue_id; | |
211 | rtems_status_code status; |
|
212 | rtems_status_code status; | |
212 |
|
213 | |||
213 | init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 ); |
|
214 | init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 ); | |
214 | init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 ); |
|
215 | init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 ); | |
215 | init_header_snapshot_wf_table( SID_NORM_SWF_F2, headerSWF_F2 ); |
|
216 | init_header_snapshot_wf_table( SID_NORM_SWF_F2, headerSWF_F2 ); | |
216 |
|
217 | |||
217 | status = get_message_queue_id_send( &queue_id ); |
|
218 | status = get_message_queue_id_send( &queue_id ); | |
218 | if (status != RTEMS_SUCCESSFUL) |
|
219 | if (status != RTEMS_SUCCESSFUL) | |
219 | { |
|
220 | { | |
220 | PRINTF1("in WFRM *** ERR get_message_queue_id_send %d\n", status) |
|
221 | PRINTF1("in WFRM *** ERR get_message_queue_id_send %d\n", status) | |
221 | } |
|
222 | } | |
222 |
|
223 | |||
223 | BOOT_PRINTF("in WFRM ***\n") |
|
224 | BOOT_PRINTF("in WFRM ***\n") | |
224 |
|
225 | |||
225 | while(1){ |
|
226 | while(1){ | |
226 | // wait for an RTEMS_EVENT |
|
227 | // wait for an RTEMS_EVENT | |
227 | rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1 |
|
228 | rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1 | |
228 | | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM, |
|
229 | | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM, | |
229 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
230 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
230 | if (event_out == RTEMS_EVENT_MODE_NORMAL) |
|
231 | if (event_out == RTEMS_EVENT_MODE_NORMAL) | |
231 | { |
|
232 | { | |
232 | DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_NORMAL\n") |
|
233 | DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_NORMAL\n") | |
233 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id); |
|
234 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id); | |
234 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id); |
|
235 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id); | |
235 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id); |
|
236 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id); | |
236 | } |
|
237 | } | |
237 | if (event_out == RTEMS_EVENT_MODE_SBM1) |
|
238 | if (event_out == RTEMS_EVENT_MODE_SBM1) | |
238 | { |
|
239 | { | |
239 | DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM1\n") |
|
240 | DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM1\n") | |
240 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id); |
|
241 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id); | |
241 | send_waveform_SWF((volatile int*) wf_snap_extracted , SID_NORM_SWF_F1, headerSWF_F1, queue_id); |
|
242 | send_waveform_SWF((volatile int*) wf_snap_extracted , SID_NORM_SWF_F1, headerSWF_F1, queue_id); | |
242 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id); |
|
243 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id); | |
243 | } |
|
244 | } | |
244 | if (event_out == RTEMS_EVENT_MODE_SBM2) |
|
245 | if (event_out == RTEMS_EVENT_MODE_SBM2) | |
245 | { |
|
246 | { | |
246 | DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM2\n") |
|
247 | DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM2\n") | |
247 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id); |
|
248 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id); | |
248 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id); |
|
249 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id); | |
249 | send_waveform_SWF((volatile int*) wf_snap_extracted , SID_NORM_SWF_F2, headerSWF_F2, queue_id); |
|
250 | send_waveform_SWF((volatile int*) wf_snap_extracted , SID_NORM_SWF_F2, headerSWF_F2, queue_id); | |
250 | } |
|
251 | } | |
251 | } |
|
252 | } | |
252 | } |
|
253 | } | |
253 |
|
254 | |||
254 | rtems_task cwf3_task(rtems_task_argument argument) //used with the waveform picker VHDL IP |
|
255 | rtems_task cwf3_task(rtems_task_argument argument) //used with the waveform picker VHDL IP | |
255 | { |
|
256 | { | |
256 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f3. |
|
257 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f3. | |
257 | * |
|
258 | * | |
258 | * @param unused is the starting argument of the RTEMS task |
|
259 | * @param unused is the starting argument of the RTEMS task | |
259 | * |
|
260 | * | |
260 | * The following data packet is sent by this task: |
|
261 | * The following data packet is sent by this task: | |
261 | * - TM_LFR_SCIENCE_NORMAL_CWF_F3 |
|
262 | * - TM_LFR_SCIENCE_NORMAL_CWF_F3 | |
262 | * |
|
263 | * | |
263 | */ |
|
264 | */ | |
264 |
|
265 | |||
265 | rtems_event_set event_out; |
|
266 | rtems_event_set event_out; | |
266 | rtems_id queue_id; |
|
267 | rtems_id queue_id; | |
267 | rtems_status_code status; |
|
268 | rtems_status_code status; | |
268 |
|
269 | |||
269 | init_header_continuous_wf_table( SID_NORM_CWF_LONG_F3, headerCWF_F3 ); |
|
270 | init_header_continuous_wf_table( SID_NORM_CWF_LONG_F3, headerCWF_F3 ); | |
270 | init_header_continuous_cwf3_light_table( headerCWF_F3_light ); |
|
271 | init_header_continuous_cwf3_light_table( headerCWF_F3_light ); | |
271 |
|
272 | |||
272 | status = get_message_queue_id_send( &queue_id ); |
|
273 | status = get_message_queue_id_send( &queue_id ); | |
273 | if (status != RTEMS_SUCCESSFUL) |
|
274 | if (status != RTEMS_SUCCESSFUL) | |
274 | { |
|
275 | { | |
275 | PRINTF1("in CWF3 *** ERR get_message_queue_id_send %d\n", status) |
|
276 | PRINTF1("in CWF3 *** ERR get_message_queue_id_send %d\n", status) | |
276 | } |
|
277 | } | |
277 |
|
278 | |||
278 | BOOT_PRINTF("in CWF3 ***\n") |
|
279 | BOOT_PRINTF("in CWF3 ***\n") | |
279 |
|
280 | |||
280 | while(1){ |
|
281 | while(1){ | |
281 | // wait for an RTEMS_EVENT |
|
282 | // wait for an RTEMS_EVENT | |
282 | rtems_event_receive( RTEMS_EVENT_0, |
|
283 | rtems_event_receive( RTEMS_EVENT_0, | |
283 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
284 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
284 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) |
|
285 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) | |
285 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode==LFR_MODE_SBM2) ) |
|
286 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode==LFR_MODE_SBM2) ) | |
286 | { |
|
287 | { | |
287 | if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01) |
|
288 | if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01) | |
288 | { |
|
289 | { | |
289 | PRINTF("send CWF_LONG_F3\n") |
|
290 | PRINTF("send CWF_LONG_F3\n") | |
290 | send_waveform_CWF( |
|
291 | send_waveform_CWF( | |
291 | (volatile int*) ring_node_to_send_cwf_f3->buffer_address, |
|
292 | (volatile int*) ring_node_to_send_cwf_f3->buffer_address, | |
292 | SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id ); |
|
293 | SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id ); | |
293 | } |
|
294 | } | |
294 | else |
|
295 | else | |
295 | { |
|
296 | { | |
296 | PRINTF("send CWF_F3 (light)\n") |
|
297 | PRINTF("send CWF_F3 (light)\n") | |
297 | send_waveform_CWF3_light( |
|
298 | send_waveform_CWF3_light( | |
298 | (volatile int*) ring_node_to_send_cwf_f3->buffer_address, |
|
299 | (volatile int*) ring_node_to_send_cwf_f3->buffer_address, | |
299 | headerCWF_F3_light, queue_id ); |
|
300 | headerCWF_F3_light, queue_id ); | |
300 | } |
|
301 | } | |
301 |
|
302 | |||
302 | } |
|
303 | } | |
303 | else |
|
304 | else | |
304 | { |
|
305 | { | |
305 | PRINTF1("in CWF3 *** lfrCurrentMode is %d, no data will be sent\n", lfrCurrentMode) |
|
306 | PRINTF1("in CWF3 *** lfrCurrentMode is %d, no data will be sent\n", lfrCurrentMode) | |
306 | } |
|
307 | } | |
307 | } |
|
308 | } | |
308 | } |
|
309 | } | |
309 |
|
310 | |||
310 | rtems_task cwf2_task(rtems_task_argument argument) // ONLY USED IN BURST AND SBM2 |
|
311 | rtems_task cwf2_task(rtems_task_argument argument) // ONLY USED IN BURST AND SBM2 | |
311 | { |
|
312 | { | |
312 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f2. |
|
313 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f2. | |
313 | * |
|
314 | * | |
314 | * @param unused is the starting argument of the RTEMS task |
|
315 | * @param unused is the starting argument of the RTEMS task | |
315 | * |
|
316 | * | |
316 | * The following data packet is sent by this function: |
|
317 | * The following data packet is sent by this function: | |
317 | * - TM_LFR_SCIENCE_BURST_CWF_F2 |
|
318 | * - TM_LFR_SCIENCE_BURST_CWF_F2 | |
318 | * - TM_LFR_SCIENCE_SBM2_CWF_F2 |
|
319 | * - TM_LFR_SCIENCE_SBM2_CWF_F2 | |
319 | * |
|
320 | * | |
320 | */ |
|
321 | */ | |
321 |
|
322 | |||
322 | rtems_event_set event_out; |
|
323 | rtems_event_set event_out; | |
323 | rtems_id queue_id; |
|
324 | rtems_id queue_id; | |
324 | rtems_status_code status; |
|
325 | rtems_status_code status; | |
325 |
|
326 | |||
326 | init_header_continuous_wf_table( SID_BURST_CWF_F2, headerCWF_F2_BURST ); |
|
327 | init_header_continuous_wf_table( SID_BURST_CWF_F2, headerCWF_F2_BURST ); | |
327 | init_header_continuous_wf_table( SID_SBM2_CWF_F2, headerCWF_F2_SBM2 ); |
|
328 | init_header_continuous_wf_table( SID_SBM2_CWF_F2, headerCWF_F2_SBM2 ); | |
328 |
|
329 | |||
329 | status = get_message_queue_id_send( &queue_id ); |
|
330 | status = get_message_queue_id_send( &queue_id ); | |
330 | if (status != RTEMS_SUCCESSFUL) |
|
331 | if (status != RTEMS_SUCCESSFUL) | |
331 | { |
|
332 | { | |
332 | PRINTF1("in CWF2 *** ERR get_message_queue_id_send %d\n", status) |
|
333 | PRINTF1("in CWF2 *** ERR get_message_queue_id_send %d\n", status) | |
333 | } |
|
334 | } | |
334 |
|
335 | |||
335 | BOOT_PRINTF("in CWF2 ***\n") |
|
336 | BOOT_PRINTF("in CWF2 ***\n") | |
336 |
|
337 | |||
337 | while(1){ |
|
338 | while(1){ | |
338 | // wait for an RTEMS_EVENT |
|
339 | // wait for an RTEMS_EVENT | |
339 | rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2, |
|
340 | rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2, | |
340 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
341 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
341 | if (event_out == RTEMS_EVENT_MODE_BURST) |
|
342 | if (event_out == RTEMS_EVENT_MODE_BURST) | |
342 | { |
|
343 | { | |
343 | send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id ); |
|
344 | send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id ); | |
344 | } |
|
345 | } | |
345 | if (event_out == RTEMS_EVENT_MODE_SBM2) |
|
346 | if (event_out == RTEMS_EVENT_MODE_SBM2) | |
346 | { |
|
347 | { | |
347 | send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id ); |
|
348 | send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id ); | |
348 | // launch snapshot extraction if needed |
|
349 | // launch snapshot extraction if needed | |
349 | if (extractSWF == true) |
|
350 | if (extractSWF == true) | |
350 | { |
|
351 | { | |
351 | ring_node_to_send_swf_f2 = ring_node_to_send_cwf_f2; |
|
352 | ring_node_to_send_swf_f2 = ring_node_to_send_cwf_f2; | |
352 | // extract the snapshot |
|
353 | // extract the snapshot | |
353 | build_snapshot_from_ring( ring_node_to_send_swf_f2, 2 ); |
|
354 | build_snapshot_from_ring( ring_node_to_send_swf_f2, 2 ); | |
354 | // send the snapshot when built |
|
355 | // send the snapshot when built | |
355 | status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 ); |
|
356 | status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 ); | |
356 | extractSWF = false; |
|
357 | extractSWF = false; | |
357 | } |
|
358 | } | |
358 | if (swf_f0_ready && swf_f1_ready) |
|
359 | if (swf_f0_ready && swf_f1_ready) | |
359 | { |
|
360 | { | |
360 | extractSWF = true; |
|
361 | extractSWF = true; | |
361 | swf_f0_ready = false; |
|
362 | swf_f0_ready = false; | |
362 | swf_f1_ready = false; |
|
363 | swf_f1_ready = false; | |
363 | } |
|
364 | } | |
364 | } |
|
365 | } | |
365 | } |
|
366 | } | |
366 | } |
|
367 | } | |
367 |
|
368 | |||
368 | rtems_task cwf1_task(rtems_task_argument argument) // ONLY USED IN SBM1 |
|
369 | rtems_task cwf1_task(rtems_task_argument argument) // ONLY USED IN SBM1 | |
369 | { |
|
370 | { | |
370 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f1. |
|
371 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f1. | |
371 | * |
|
372 | * | |
372 | * @param unused is the starting argument of the RTEMS task |
|
373 | * @param unused is the starting argument of the RTEMS task | |
373 | * |
|
374 | * | |
374 | * The following data packet is sent by this function: |
|
375 | * The following data packet is sent by this function: | |
375 | * - TM_LFR_SCIENCE_SBM1_CWF_F1 |
|
376 | * - TM_LFR_SCIENCE_SBM1_CWF_F1 | |
376 | * |
|
377 | * | |
377 | */ |
|
378 | */ | |
378 |
|
379 | |||
379 | rtems_event_set event_out; |
|
380 | rtems_event_set event_out; | |
380 | rtems_id queue_id; |
|
381 | rtems_id queue_id; | |
381 | rtems_status_code status; |
|
382 | rtems_status_code status; | |
382 |
|
383 | |||
383 | init_header_continuous_wf_table( SID_SBM1_CWF_F1, headerCWF_F1 ); |
|
384 | init_header_continuous_wf_table( SID_SBM1_CWF_F1, headerCWF_F1 ); | |
384 |
|
385 | |||
385 | status = get_message_queue_id_send( &queue_id ); |
|
386 | status = get_message_queue_id_send( &queue_id ); | |
386 | if (status != RTEMS_SUCCESSFUL) |
|
387 | if (status != RTEMS_SUCCESSFUL) | |
387 | { |
|
388 | { | |
388 | PRINTF1("in CWF1 *** ERR get_message_queue_id_send %d\n", status) |
|
389 | PRINTF1("in CWF1 *** ERR get_message_queue_id_send %d\n", status) | |
389 | } |
|
390 | } | |
390 |
|
391 | |||
391 | BOOT_PRINTF("in CWF1 ***\n") |
|
392 | BOOT_PRINTF("in CWF1 ***\n") | |
392 |
|
393 | |||
393 | while(1){ |
|
394 | while(1){ | |
394 | // wait for an RTEMS_EVENT |
|
395 | // wait for an RTEMS_EVENT | |
395 | rtems_event_receive( RTEMS_EVENT_MODE_SBM1, |
|
396 | rtems_event_receive( RTEMS_EVENT_MODE_SBM1, | |
396 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
397 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
397 | send_waveform_CWF( (volatile int*) ring_node_to_send_cwf_f1->buffer_address, SID_SBM1_CWF_F1, headerCWF_F1, queue_id ); |
|
398 | send_waveform_CWF( (volatile int*) ring_node_to_send_cwf_f1->buffer_address, SID_SBM1_CWF_F1, headerCWF_F1, queue_id ); | |
398 | // launch snapshot extraction if needed |
|
399 | // launch snapshot extraction if needed | |
399 | if (extractSWF == true) |
|
400 | if (extractSWF == true) | |
400 | { |
|
401 | { | |
401 | ring_node_to_send_swf_f1 = ring_node_to_send_cwf_f1; |
|
402 | ring_node_to_send_swf_f1 = ring_node_to_send_cwf_f1; | |
402 | // launch the snapshot extraction |
|
403 | // launch the snapshot extraction | |
403 | status = rtems_event_send( Task_id[TASKID_SWBD], RTEMS_EVENT_MODE_SBM1 ); |
|
404 | status = rtems_event_send( Task_id[TASKID_SWBD], RTEMS_EVENT_MODE_SBM1 ); | |
404 | extractSWF = false; |
|
405 | extractSWF = false; | |
405 | } |
|
406 | } | |
406 | if (swf_f0_ready == true) |
|
407 | if (swf_f0_ready == true) | |
407 | { |
|
408 | { | |
408 | extractSWF = true; |
|
409 | extractSWF = true; | |
409 | swf_f0_ready = false; // this step shall be executed only one time |
|
410 | swf_f0_ready = false; // this step shall be executed only one time | |
410 | } |
|
411 | } | |
411 | if ((swf_f1_ready == true) && (swf_f2_ready == true)) // swf_f1 is ready after the extraction |
|
412 | if ((swf_f1_ready == true) && (swf_f2_ready == true)) // swf_f1 is ready after the extraction | |
412 | { |
|
413 | { | |
413 | status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM1 ); |
|
414 | status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM1 ); | |
414 | swf_f1_ready = false; |
|
415 | swf_f1_ready = false; | |
415 | swf_f2_ready = false; |
|
416 | swf_f2_ready = false; | |
416 | } |
|
417 | } | |
417 | } |
|
418 | } | |
418 | } |
|
419 | } | |
419 |
|
420 | |||
420 | rtems_task swbd_task(rtems_task_argument argument) |
|
421 | rtems_task swbd_task(rtems_task_argument argument) | |
421 | { |
|
422 | { | |
422 | /** This RTEMS task is dedicated to the building of snapshots from different continuous waveforms buffers. |
|
423 | /** This RTEMS task is dedicated to the building of snapshots from different continuous waveforms buffers. | |
423 | * |
|
424 | * | |
424 | * @param unused is the starting argument of the RTEMS task |
|
425 | * @param unused is the starting argument of the RTEMS task | |
425 | * |
|
426 | * | |
426 | */ |
|
427 | */ | |
427 |
|
428 | |||
428 | rtems_event_set event_out; |
|
429 | rtems_event_set event_out; | |
429 |
|
430 | |||
430 | BOOT_PRINTF("in SWBD ***\n") |
|
431 | BOOT_PRINTF("in SWBD ***\n") | |
431 |
|
432 | |||
432 | while(1){ |
|
433 | while(1){ | |
433 | // wait for an RTEMS_EVENT |
|
434 | // wait for an RTEMS_EVENT | |
434 | rtems_event_receive( RTEMS_EVENT_MODE_SBM1 | RTEMS_EVENT_MODE_SBM2, |
|
435 | rtems_event_receive( RTEMS_EVENT_MODE_SBM1 | RTEMS_EVENT_MODE_SBM2, | |
435 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
436 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
436 | if (event_out == RTEMS_EVENT_MODE_SBM1) |
|
437 | if (event_out == RTEMS_EVENT_MODE_SBM1) | |
437 | { |
|
438 | { | |
438 | build_snapshot_from_ring( ring_node_to_send_swf_f1, 1 ); |
|
439 | build_snapshot_from_ring( ring_node_to_send_swf_f1, 1 ); | |
439 | swf_f1_ready = true; // the snapshot has been extracted and is ready to be sent |
|
440 | swf_f1_ready = true; // the snapshot has been extracted and is ready to be sent | |
440 | } |
|
441 | } | |
441 | else |
|
442 | else | |
442 | { |
|
443 | { | |
443 | PRINTF1("in SWBD *** unexpected rtems event received %x\n", (int) event_out) |
|
444 | PRINTF1("in SWBD *** unexpected rtems event received %x\n", (int) event_out) | |
444 | } |
|
445 | } | |
445 | } |
|
446 | } | |
446 | } |
|
447 | } | |
447 |
|
448 | |||
448 | //****************** |
|
449 | //****************** | |
449 | // general functions |
|
450 | // general functions | |
450 |
|
451 | |||
451 | void WFP_init_rings( void ) |
|
452 | void WFP_init_rings( void ) | |
452 | { |
|
453 | { | |
453 | // F0 RING |
|
454 | // F0 RING | |
454 | init_waveform_ring( waveform_ring_f0, NB_RING_NODES_F0, wf_snap_f0 ); |
|
455 | init_waveform_ring( waveform_ring_f0, NB_RING_NODES_F0, wf_snap_f0 ); | |
455 | // F1 RING |
|
456 | // F1 RING | |
456 | init_waveform_ring( waveform_ring_f1, NB_RING_NODES_F1, wf_snap_f1 ); |
|
457 | init_waveform_ring( waveform_ring_f1, NB_RING_NODES_F1, wf_snap_f1 ); | |
457 | // F2 RING |
|
458 | // F2 RING | |
458 | init_waveform_ring( waveform_ring_f2, NB_RING_NODES_F2, wf_snap_f2 ); |
|
459 | init_waveform_ring( waveform_ring_f2, NB_RING_NODES_F2, wf_snap_f2 ); | |
459 | // F3 RING |
|
460 | // F3 RING | |
460 | init_waveform_ring( waveform_ring_f3, NB_RING_NODES_F3, wf_cont_f3 ); |
|
461 | init_waveform_ring( waveform_ring_f3, NB_RING_NODES_F3, wf_cont_f3 ); | |
461 |
|
462 | |||
462 | DEBUG_PRINTF1("waveform_ring_f0 @%x\n", (unsigned int) waveform_ring_f0) |
|
463 | DEBUG_PRINTF1("waveform_ring_f0 @%x\n", (unsigned int) waveform_ring_f0) | |
463 | DEBUG_PRINTF1("waveform_ring_f1 @%x\n", (unsigned int) waveform_ring_f1) |
|
464 | DEBUG_PRINTF1("waveform_ring_f1 @%x\n", (unsigned int) waveform_ring_f1) | |
464 | DEBUG_PRINTF1("waveform_ring_f2 @%x\n", (unsigned int) waveform_ring_f2) |
|
465 | DEBUG_PRINTF1("waveform_ring_f2 @%x\n", (unsigned int) waveform_ring_f2) | |
465 | DEBUG_PRINTF1("waveform_ring_f3 @%x\n", (unsigned int) waveform_ring_f3) |
|
466 | DEBUG_PRINTF1("waveform_ring_f3 @%x\n", (unsigned int) waveform_ring_f3) | |
466 | } |
|
467 | } | |
467 |
|
468 | |||
468 | void init_waveform_ring(ring_node waveform_ring[], unsigned char nbNodes, volatile int wfrm[] ) |
|
469 | void init_waveform_ring(ring_node waveform_ring[], unsigned char nbNodes, volatile int wfrm[] ) | |
469 | { |
|
470 | { | |
470 | unsigned char i; |
|
471 | unsigned char i; | |
471 |
|
472 | |||
472 | waveform_ring[0].next = (ring_node*) &waveform_ring[ 1 ]; |
|
473 | waveform_ring[0].next = (ring_node*) &waveform_ring[ 1 ]; | |
473 | waveform_ring[0].previous = (ring_node*) &waveform_ring[ nbNodes - 1 ]; |
|
474 | waveform_ring[0].previous = (ring_node*) &waveform_ring[ nbNodes - 1 ]; | |
474 | waveform_ring[0].buffer_address = (int) &wfrm[0]; |
|
475 | waveform_ring[0].buffer_address = (int) &wfrm[0]; | |
475 |
|
476 | |||
476 | waveform_ring[nbNodes-1].next = (ring_node*) &waveform_ring[ 0 ]; |
|
477 | waveform_ring[nbNodes-1].next = (ring_node*) &waveform_ring[ 0 ]; | |
477 | waveform_ring[nbNodes-1].previous = (ring_node*) &waveform_ring[ nbNodes - 2 ]; |
|
478 | waveform_ring[nbNodes-1].previous = (ring_node*) &waveform_ring[ nbNodes - 2 ]; | |
478 | waveform_ring[nbNodes-1].buffer_address = (int) &wfrm[ (nbNodes-1) * WFRM_BUFFER ]; |
|
479 | waveform_ring[nbNodes-1].buffer_address = (int) &wfrm[ (nbNodes-1) * WFRM_BUFFER ]; | |
479 |
|
480 | |||
480 | for(i=1; i<nbNodes-1; i++) |
|
481 | for(i=1; i<nbNodes-1; i++) | |
481 | { |
|
482 | { | |
482 | waveform_ring[i].next = (ring_node*) &waveform_ring[ i + 1 ]; |
|
483 | waveform_ring[i].next = (ring_node*) &waveform_ring[ i + 1 ]; | |
483 | waveform_ring[i].previous = (ring_node*) &waveform_ring[ i - 1 ]; |
|
484 | waveform_ring[i].previous = (ring_node*) &waveform_ring[ i - 1 ]; | |
484 | waveform_ring[i].buffer_address = (int) &wfrm[ i * WFRM_BUFFER ]; |
|
485 | waveform_ring[i].buffer_address = (int) &wfrm[ i * WFRM_BUFFER ]; | |
485 | } |
|
486 | } | |
486 | } |
|
487 | } | |
487 |
|
488 | |||
488 | void WFP_reset_current_ring_nodes( void ) |
|
489 | void WFP_reset_current_ring_nodes( void ) | |
489 | { |
|
490 | { | |
490 | current_ring_node_f0 = waveform_ring_f0; |
|
491 | current_ring_node_f0 = waveform_ring_f0; | |
491 | ring_node_to_send_swf_f0 = waveform_ring_f0; |
|
492 | ring_node_to_send_swf_f0 = waveform_ring_f0; | |
492 |
|
493 | |||
493 | current_ring_node_f1 = waveform_ring_f1; |
|
494 | current_ring_node_f1 = waveform_ring_f1; | |
494 | ring_node_to_send_cwf_f1 = waveform_ring_f1; |
|
495 | ring_node_to_send_cwf_f1 = waveform_ring_f1; | |
495 | ring_node_to_send_swf_f1 = waveform_ring_f1; |
|
496 | ring_node_to_send_swf_f1 = waveform_ring_f1; | |
496 |
|
497 | |||
497 | current_ring_node_f2 = waveform_ring_f2; |
|
498 | current_ring_node_f2 = waveform_ring_f2; | |
498 | ring_node_to_send_cwf_f2 = waveform_ring_f2; |
|
499 | ring_node_to_send_cwf_f2 = waveform_ring_f2; | |
499 | ring_node_to_send_swf_f2 = waveform_ring_f2; |
|
500 | ring_node_to_send_swf_f2 = waveform_ring_f2; | |
500 |
|
501 | |||
501 | current_ring_node_f3 = waveform_ring_f3; |
|
502 | current_ring_node_f3 = waveform_ring_f3; | |
502 | ring_node_to_send_cwf_f3 = waveform_ring_f3; |
|
503 | ring_node_to_send_cwf_f3 = waveform_ring_f3; | |
503 | } |
|
504 | } | |
504 |
|
505 | |||
505 | int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF) |
|
506 | int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF) | |
506 | { |
|
507 | { | |
507 | unsigned char i; |
|
508 | unsigned char i; | |
|
509 | int return_value; | |||
|
510 | ||||
|
511 | return_value = LFR_SUCCESSFUL; | |||
508 |
|
512 | |||
509 | for (i=0; i<7; i++) |
|
513 | for (i=0; i<7; i++) | |
510 | { |
|
514 | { | |
511 | headerSWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
515 | headerSWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; | |
512 | headerSWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
516 | headerSWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
513 | headerSWF[ i ].reserved = DEFAULT_RESERVED; |
|
517 | headerSWF[ i ].reserved = DEFAULT_RESERVED; | |
514 | headerSWF[ i ].userApplication = CCSDS_USER_APP; |
|
518 | headerSWF[ i ].userApplication = CCSDS_USER_APP; | |
515 | headerSWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8); |
|
519 | headerSWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8); | |
516 | headerSWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST); |
|
520 | headerSWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST); | |
517 | headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
521 | headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
518 | if (i == 6) |
|
522 | if (i == 6) | |
519 | { |
|
523 | { | |
520 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_224 >> 8); |
|
524 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_224 >> 8); | |
521 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_224 ); |
|
525 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_224 ); | |
522 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_224 >> 8); |
|
526 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_224 >> 8); | |
523 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_224 ); |
|
527 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_224 ); | |
524 | } |
|
528 | } | |
525 | else |
|
529 | else | |
526 | { |
|
530 | { | |
527 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_304 >> 8); |
|
531 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_304 >> 8); | |
528 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_304 ); |
|
532 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_304 ); | |
529 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_304 >> 8); |
|
533 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_304 >> 8); | |
530 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_304 ); |
|
534 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_304 ); | |
531 | } |
|
535 | } | |
532 | headerSWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
536 | headerSWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
533 | headerSWF[ i ].pktCnt = DEFAULT_PKTCNT; // PKT_CNT |
|
537 | headerSWF[ i ].pktCnt = DEFAULT_PKTCNT; // PKT_CNT | |
534 | headerSWF[ i ].pktNr = i+1; // PKT_NR |
|
538 | headerSWF[ i ].pktNr = i+1; // PKT_NR | |
535 | // DATA FIELD HEADER |
|
539 | // DATA FIELD HEADER | |
536 | headerSWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
540 | headerSWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
537 | headerSWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
541 | headerSWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
538 | headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
542 | headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
539 | headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; |
|
543 | headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; | |
540 | // AUXILIARY DATA HEADER |
|
544 | // AUXILIARY DATA HEADER | |
541 | headerSWF[ i ].time[0] = 0x00; |
|
545 | headerSWF[ i ].time[0] = 0x00; | |
542 | headerSWF[ i ].time[0] = 0x00; |
|
546 | headerSWF[ i ].time[0] = 0x00; | |
543 | headerSWF[ i ].time[0] = 0x00; |
|
547 | headerSWF[ i ].time[0] = 0x00; | |
544 | headerSWF[ i ].time[0] = 0x00; |
|
548 | headerSWF[ i ].time[0] = 0x00; | |
545 | headerSWF[ i ].time[0] = 0x00; |
|
549 | headerSWF[ i ].time[0] = 0x00; | |
546 | headerSWF[ i ].time[0] = 0x00; |
|
550 | headerSWF[ i ].time[0] = 0x00; | |
547 | headerSWF[ i ].sid = sid; |
|
551 | headerSWF[ i ].sid = sid; | |
548 | headerSWF[ i ].hkBIA = DEFAULT_HKBIA; |
|
552 | headerSWF[ i ].hkBIA = DEFAULT_HKBIA; | |
549 | } |
|
553 | } | |
550 | return LFR_SUCCESSFUL; |
|
554 | ||
|
555 | return return_value; | |||
551 | } |
|
556 | } | |
552 |
|
557 | |||
553 | int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF ) |
|
558 | int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF ) | |
554 | { |
|
559 | { | |
555 | unsigned int i; |
|
560 | unsigned int i; | |
|
561 | int return_value; | |||
|
562 | ||||
|
563 | return_value = LFR_SUCCESSFUL; | |||
556 |
|
564 | |||
557 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF; i++) |
|
565 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF; i++) | |
558 | { |
|
566 | { | |
559 | headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
567 | headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; | |
560 | headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
568 | headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
561 | headerCWF[ i ].reserved = DEFAULT_RESERVED; |
|
569 | headerCWF[ i ].reserved = DEFAULT_RESERVED; | |
562 | headerCWF[ i ].userApplication = CCSDS_USER_APP; |
|
570 | headerCWF[ i ].userApplication = CCSDS_USER_APP; | |
563 | if ( (sid == SID_SBM1_CWF_F1) || (sid == SID_SBM2_CWF_F2) ) |
|
571 | if ( (sid == SID_SBM1_CWF_F1) || (sid == SID_SBM2_CWF_F2) ) | |
564 | { |
|
572 | { | |
565 | headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_SBM1_SBM2 >> 8); |
|
573 | headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_SBM1_SBM2 >> 8); | |
566 | headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_SBM1_SBM2); |
|
574 | headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_SBM1_SBM2); | |
567 | } |
|
575 | } | |
568 | else |
|
576 | else | |
569 | { |
|
577 | { | |
570 | headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8); |
|
578 | headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8); | |
571 | headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST); |
|
579 | headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST); | |
572 | } |
|
580 | } | |
573 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
581 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
574 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_336 >> 8); |
|
582 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_336 >> 8); | |
575 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_336 ); |
|
583 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_336 ); | |
576 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF >> 8); |
|
584 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF >> 8); | |
577 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF ); |
|
585 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF ); | |
578 | headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
586 | headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
579 | // DATA FIELD HEADER |
|
587 | // DATA FIELD HEADER | |
580 | headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
588 | headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
581 | headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
589 | headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
582 | headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
590 | headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
583 | headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; |
|
591 | headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; | |
584 | // AUXILIARY DATA HEADER |
|
592 | // AUXILIARY DATA HEADER | |
585 | headerCWF[ i ].sid = sid; |
|
593 | headerCWF[ i ].sid = sid; | |
586 | headerCWF[ i ].hkBIA = DEFAULT_HKBIA; |
|
594 | headerCWF[ i ].hkBIA = DEFAULT_HKBIA; | |
587 | headerCWF[ i ].time[0] = 0x00; |
|
595 | headerCWF[ i ].time[0] = 0x00; | |
588 | headerCWF[ i ].time[0] = 0x00; |
|
596 | headerCWF[ i ].time[0] = 0x00; | |
589 | headerCWF[ i ].time[0] = 0x00; |
|
597 | headerCWF[ i ].time[0] = 0x00; | |
590 | headerCWF[ i ].time[0] = 0x00; |
|
598 | headerCWF[ i ].time[0] = 0x00; | |
591 | headerCWF[ i ].time[0] = 0x00; |
|
599 | headerCWF[ i ].time[0] = 0x00; | |
592 | headerCWF[ i ].time[0] = 0x00; |
|
600 | headerCWF[ i ].time[0] = 0x00; | |
593 | } |
|
601 | } | |
594 | return LFR_SUCCESSFUL; |
|
602 | ||
|
603 | return return_value; | |||
595 | } |
|
604 | } | |
596 |
|
605 | |||
597 | int init_header_continuous_cwf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF ) |
|
606 | int init_header_continuous_cwf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF ) | |
598 | { |
|
607 | { | |
599 | unsigned int i; |
|
608 | unsigned int i; | |
|
609 | int return_value; | |||
|
610 | ||||
|
611 | return_value = LFR_SUCCESSFUL; | |||
600 |
|
612 | |||
601 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF_LIGHT; i++) |
|
613 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF_LIGHT; i++) | |
602 | { |
|
614 | { | |
603 | headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
615 | headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; | |
604 | headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
616 | headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
605 | headerCWF[ i ].reserved = DEFAULT_RESERVED; |
|
617 | headerCWF[ i ].reserved = DEFAULT_RESERVED; | |
606 | headerCWF[ i ].userApplication = CCSDS_USER_APP; |
|
618 | headerCWF[ i ].userApplication = CCSDS_USER_APP; | |
607 |
|
619 | |||
608 | headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8); |
|
620 | headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8); | |
609 | headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST); |
|
621 | headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST); | |
610 |
|
622 | |||
611 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
623 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
612 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_672 >> 8); |
|
624 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_672 >> 8); | |
613 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_672 ); |
|
625 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_672 ); | |
614 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF_SHORT_F3 >> 8); |
|
626 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF_SHORT_F3 >> 8); | |
615 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF_SHORT_F3 ); |
|
627 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF_SHORT_F3 ); | |
616 |
|
628 | |||
617 | headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
629 | headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
618 | // DATA FIELD HEADER |
|
630 | // DATA FIELD HEADER | |
619 | headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
631 | headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
620 | headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
632 | headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
621 | headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
633 | headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
622 | headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; |
|
634 | headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; | |
623 | // AUXILIARY DATA HEADER |
|
635 | // AUXILIARY DATA HEADER | |
624 | headerCWF[ i ].sid = SID_NORM_CWF_F3; |
|
636 | headerCWF[ i ].sid = SID_NORM_CWF_F3; | |
625 | headerCWF[ i ].hkBIA = DEFAULT_HKBIA; |
|
637 | headerCWF[ i ].hkBIA = DEFAULT_HKBIA; | |
626 | headerCWF[ i ].time[0] = 0x00; |
|
638 | headerCWF[ i ].time[0] = 0x00; | |
627 | headerCWF[ i ].time[0] = 0x00; |
|
639 | headerCWF[ i ].time[0] = 0x00; | |
628 | headerCWF[ i ].time[0] = 0x00; |
|
640 | headerCWF[ i ].time[0] = 0x00; | |
629 | headerCWF[ i ].time[0] = 0x00; |
|
641 | headerCWF[ i ].time[0] = 0x00; | |
630 | headerCWF[ i ].time[0] = 0x00; |
|
642 | headerCWF[ i ].time[0] = 0x00; | |
631 | headerCWF[ i ].time[0] = 0x00; |
|
643 | headerCWF[ i ].time[0] = 0x00; | |
632 | } |
|
644 | } | |
633 | return LFR_SUCCESSFUL; |
|
645 | ||
|
646 | return return_value; | |||
634 | } |
|
647 | } | |
635 |
|
648 | |||
636 | int send_waveform_SWF( volatile int *waveform, unsigned int sid, |
|
649 | int send_waveform_SWF( volatile int *waveform, unsigned int sid, | |
637 | Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id ) |
|
650 | Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id ) | |
638 | { |
|
651 | { | |
639 | /** This function sends SWF CCSDS packets (F2, F1 or F0). |
|
652 | /** This function sends SWF CCSDS packets (F2, F1 or F0). | |
640 | * |
|
653 | * | |
641 | * @param waveform points to the buffer containing the data that will be send. |
|
654 | * @param waveform points to the buffer containing the data that will be send. | |
642 | * @param sid is the source identifier of the data that will be sent. |
|
655 | * @param sid is the source identifier of the data that will be sent. | |
643 | * @param headerSWF points to a table of headers that have been prepared for the data transmission. |
|
656 | * @param headerSWF points to a table of headers that have been prepared for the data transmission. | |
644 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures |
|
657 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures | |
645 | * contain information to setup the transmission of the data packets. |
|
658 | * contain information to setup the transmission of the data packets. | |
646 | * |
|
659 | * | |
647 | * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks. |
|
660 | * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks. | |
648 | * |
|
661 | * | |
649 | */ |
|
662 | */ | |
650 |
|
663 | |||
651 | unsigned int i; |
|
664 | unsigned int i; | |
652 | int ret; |
|
665 | int ret; | |
653 | unsigned int coarseTime; |
|
666 | unsigned int coarseTime; | |
654 | unsigned int fineTime; |
|
667 | unsigned int fineTime; | |
655 | rtems_status_code status; |
|
668 | rtems_status_code status; | |
656 | spw_ioctl_pkt_send spw_ioctl_send_SWF; |
|
669 | spw_ioctl_pkt_send spw_ioctl_send_SWF; | |
657 |
|
670 | |||
658 | spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header |
|
671 | spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header | |
659 | spw_ioctl_send_SWF.options = 0; |
|
672 | spw_ioctl_send_SWF.options = 0; | |
660 |
|
673 | |||
661 | ret = LFR_DEFAULT; |
|
674 | ret = LFR_DEFAULT; | |
662 |
|
675 | |||
663 | coarseTime = waveform[0]; |
|
676 | coarseTime = waveform[0]; | |
664 | fineTime = waveform[1]; |
|
677 | fineTime = waveform[1]; | |
665 |
|
678 | |||
666 | for (i=0; i<7; i++) // send waveform |
|
679 | for (i=0; i<7; i++) // send waveform | |
667 | { |
|
680 | { | |
668 | spw_ioctl_send_SWF.data = (char*) &waveform[ (i * BLK_NR_304 * NB_WORDS_SWF_BLK) + TIME_OFFSET]; |
|
681 | spw_ioctl_send_SWF.data = (char*) &waveform[ (i * BLK_NR_304 * NB_WORDS_SWF_BLK) + TIME_OFFSET]; | |
669 | spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ]; |
|
682 | spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ]; | |
670 | // BUILD THE DATA |
|
683 | // BUILD THE DATA | |
671 | if (i==6) { |
|
684 | if (i==6) { | |
672 | spw_ioctl_send_SWF.dlen = BLK_NR_224 * NB_BYTES_SWF_BLK; |
|
685 | spw_ioctl_send_SWF.dlen = BLK_NR_224 * NB_BYTES_SWF_BLK; | |
673 | } |
|
686 | } | |
674 | else { |
|
687 | else { | |
675 | spw_ioctl_send_SWF.dlen = BLK_NR_304 * NB_BYTES_SWF_BLK; |
|
688 | spw_ioctl_send_SWF.dlen = BLK_NR_304 * NB_BYTES_SWF_BLK; | |
676 | } |
|
689 | } | |
677 | // SET PACKET SEQUENCE COUNTER |
|
690 | // SET PACKET SEQUENCE COUNTER | |
678 | increment_seq_counter_source_id( headerSWF[ i ].packetSequenceControl, sid ); |
|
691 | increment_seq_counter_source_id( headerSWF[ i ].packetSequenceControl, sid ); | |
679 | // SET PACKET TIME |
|
692 | // SET PACKET TIME | |
680 | compute_acquisition_time( coarseTime, fineTime, sid, i, headerSWF[ i ].acquisitionTime ); |
|
693 | compute_acquisition_time( coarseTime, fineTime, sid, i, headerSWF[ i ].acquisitionTime ); | |
681 | // |
|
694 | // | |
682 | headerSWF[ i ].time[0] = headerSWF[ i ].acquisitionTime[0]; |
|
695 | headerSWF[ i ].time[0] = headerSWF[ i ].acquisitionTime[0]; | |
683 | headerSWF[ i ].time[1] = headerSWF[ i ].acquisitionTime[1]; |
|
696 | headerSWF[ i ].time[1] = headerSWF[ i ].acquisitionTime[1]; | |
684 | headerSWF[ i ].time[2] = headerSWF[ i ].acquisitionTime[2]; |
|
697 | headerSWF[ i ].time[2] = headerSWF[ i ].acquisitionTime[2]; | |
685 | headerSWF[ i ].time[3] = headerSWF[ i ].acquisitionTime[3]; |
|
698 | headerSWF[ i ].time[3] = headerSWF[ i ].acquisitionTime[3]; | |
686 | headerSWF[ i ].time[4] = headerSWF[ i ].acquisitionTime[4]; |
|
699 | headerSWF[ i ].time[4] = headerSWF[ i ].acquisitionTime[4]; | |
687 | headerSWF[ i ].time[5] = headerSWF[ i ].acquisitionTime[5]; |
|
700 | headerSWF[ i ].time[5] = headerSWF[ i ].acquisitionTime[5]; | |
688 | // SEND PACKET |
|
701 | // SEND PACKET | |
689 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_SWF, ACTION_MSG_SPW_IOCTL_SEND_SIZE); |
|
702 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_SWF, ACTION_MSG_SPW_IOCTL_SEND_SIZE); | |
690 | if (status != RTEMS_SUCCESSFUL) { |
|
703 | if (status != RTEMS_SUCCESSFUL) { | |
691 | printf("%d-%d, ERR %d\n", sid, i, (int) status); |
|
704 | printf("%d-%d, ERR %d\n", sid, i, (int) status); | |
692 | ret = LFR_DEFAULT; |
|
705 | ret = LFR_DEFAULT; | |
693 | } |
|
706 | } | |
694 | rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds |
|
707 | rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds | |
695 | } |
|
708 | } | |
696 |
|
709 | |||
697 | return ret; |
|
710 | return ret; | |
698 | } |
|
711 | } | |
699 |
|
712 | |||
700 | int send_waveform_CWF(volatile int *waveform, unsigned int sid, |
|
713 | int send_waveform_CWF(volatile int *waveform, unsigned int sid, | |
701 | Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id) |
|
714 | Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id) | |
702 | { |
|
715 | { | |
703 | /** This function sends CWF CCSDS packets (F2, F1 or F0). |
|
716 | /** This function sends CWF CCSDS packets (F2, F1 or F0). | |
704 | * |
|
717 | * | |
705 | * @param waveform points to the buffer containing the data that will be send. |
|
718 | * @param waveform points to the buffer containing the data that will be send. | |
706 | * @param sid is the source identifier of the data that will be sent. |
|
719 | * @param sid is the source identifier of the data that will be sent. | |
707 | * @param headerCWF points to a table of headers that have been prepared for the data transmission. |
|
720 | * @param headerCWF points to a table of headers that have been prepared for the data transmission. | |
708 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures |
|
721 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures | |
709 | * contain information to setup the transmission of the data packets. |
|
722 | * contain information to setup the transmission of the data packets. | |
710 | * |
|
723 | * | |
711 | * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks. |
|
724 | * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks. | |
712 | * |
|
725 | * | |
713 | */ |
|
726 | */ | |
714 |
|
727 | |||
715 | unsigned int i; |
|
728 | unsigned int i; | |
716 | int ret; |
|
729 | int ret; | |
717 | unsigned int coarseTime; |
|
730 | unsigned int coarseTime; | |
718 | unsigned int fineTime; |
|
731 | unsigned int fineTime; | |
719 | rtems_status_code status; |
|
732 | rtems_status_code status; | |
720 | spw_ioctl_pkt_send spw_ioctl_send_CWF; |
|
733 | spw_ioctl_pkt_send spw_ioctl_send_CWF; | |
721 |
|
734 | |||
722 | spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header |
|
735 | spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header | |
723 | spw_ioctl_send_CWF.options = 0; |
|
736 | spw_ioctl_send_CWF.options = 0; | |
724 |
|
737 | |||
725 | ret = LFR_DEFAULT; |
|
738 | ret = LFR_DEFAULT; | |
726 |
|
739 | |||
727 | coarseTime = waveform[0]; |
|
740 | coarseTime = waveform[0]; | |
728 | fineTime = waveform[1]; |
|
741 | fineTime = waveform[1]; | |
729 |
|
742 | |||
730 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF; i++) // send waveform |
|
743 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF; i++) // send waveform | |
731 | { |
|
744 | { | |
732 | spw_ioctl_send_CWF.data = (char*) &waveform[ (i * BLK_NR_CWF * NB_WORDS_SWF_BLK) + TIME_OFFSET]; |
|
745 | spw_ioctl_send_CWF.data = (char*) &waveform[ (i * BLK_NR_CWF * NB_WORDS_SWF_BLK) + TIME_OFFSET]; | |
733 | spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ]; |
|
746 | spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ]; | |
734 | // BUILD THE DATA |
|
747 | // BUILD THE DATA | |
735 | spw_ioctl_send_CWF.dlen = BLK_NR_CWF * NB_BYTES_SWF_BLK; |
|
748 | spw_ioctl_send_CWF.dlen = BLK_NR_CWF * NB_BYTES_SWF_BLK; | |
736 | // SET PACKET SEQUENCE COUNTER |
|
749 | // SET PACKET SEQUENCE COUNTER | |
737 | increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, sid ); |
|
750 | increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, sid ); | |
738 | // SET PACKET TIME |
|
751 | // SET PACKET TIME | |
739 | compute_acquisition_time( coarseTime, fineTime, sid, i, headerCWF[ i ].acquisitionTime); |
|
752 | compute_acquisition_time( coarseTime, fineTime, sid, i, headerCWF[ i ].acquisitionTime); | |
740 | // |
|
753 | // | |
741 | headerCWF[ i ].time[0] = headerCWF[ i ].acquisitionTime[0]; |
|
754 | headerCWF[ i ].time[0] = headerCWF[ i ].acquisitionTime[0]; | |
742 | headerCWF[ i ].time[1] = headerCWF[ i ].acquisitionTime[1]; |
|
755 | headerCWF[ i ].time[1] = headerCWF[ i ].acquisitionTime[1]; | |
743 | headerCWF[ i ].time[2] = headerCWF[ i ].acquisitionTime[2]; |
|
756 | headerCWF[ i ].time[2] = headerCWF[ i ].acquisitionTime[2]; | |
744 | headerCWF[ i ].time[3] = headerCWF[ i ].acquisitionTime[3]; |
|
757 | headerCWF[ i ].time[3] = headerCWF[ i ].acquisitionTime[3]; | |
745 | headerCWF[ i ].time[4] = headerCWF[ i ].acquisitionTime[4]; |
|
758 | headerCWF[ i ].time[4] = headerCWF[ i ].acquisitionTime[4]; | |
746 | headerCWF[ i ].time[5] = headerCWF[ i ].acquisitionTime[5]; |
|
759 | headerCWF[ i ].time[5] = headerCWF[ i ].acquisitionTime[5]; | |
747 | // SEND PACKET |
|
760 | // SEND PACKET | |
748 | if (sid == SID_NORM_CWF_LONG_F3) |
|
761 | if (sid == SID_NORM_CWF_LONG_F3) | |
749 | { |
|
762 | { | |
750 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); |
|
763 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); | |
751 | if (status != RTEMS_SUCCESSFUL) { |
|
764 | if (status != RTEMS_SUCCESSFUL) { | |
752 | printf("%d-%d, ERR %d\n", sid, i, (int) status); |
|
765 | printf("%d-%d, ERR %d\n", sid, i, (int) status); | |
753 | ret = LFR_DEFAULT; |
|
766 | ret = LFR_DEFAULT; | |
754 | } |
|
767 | } | |
755 | rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS); |
|
768 | rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS); | |
756 | } |
|
769 | } | |
757 | else |
|
770 | else | |
758 | { |
|
771 | { | |
759 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); |
|
772 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); | |
760 | if (status != RTEMS_SUCCESSFUL) { |
|
773 | if (status != RTEMS_SUCCESSFUL) { | |
761 | printf("%d-%d, ERR %d\n", sid, i, (int) status); |
|
774 | printf("%d-%d, ERR %d\n", sid, i, (int) status); | |
762 | ret = LFR_DEFAULT; |
|
775 | ret = LFR_DEFAULT; | |
763 | } |
|
776 | } | |
764 | } |
|
777 | } | |
765 | } |
|
778 | } | |
766 |
|
779 | |||
767 | return ret; |
|
780 | return ret; | |
768 | } |
|
781 | } | |
769 |
|
782 | |||
770 | int send_waveform_CWF3_light(volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id) |
|
783 | int send_waveform_CWF3_light(volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id) | |
771 | { |
|
784 | { | |
772 | /** This function sends CWF_F3 CCSDS packets without the b1, b2 and b3 data. |
|
785 | /** This function sends CWF_F3 CCSDS packets without the b1, b2 and b3 data. | |
773 | * |
|
786 | * | |
774 | * @param waveform points to the buffer containing the data that will be send. |
|
787 | * @param waveform points to the buffer containing the data that will be send. | |
775 | * @param headerCWF points to a table of headers that have been prepared for the data transmission. |
|
788 | * @param headerCWF points to a table of headers that have been prepared for the data transmission. | |
776 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures |
|
789 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures | |
777 | * contain information to setup the transmission of the data packets. |
|
790 | * contain information to setup the transmission of the data packets. | |
778 | * |
|
791 | * | |
779 | * By default, CWF_F3 packet are send without the b1, b2 and b3 data. This function rebuilds a data buffer |
|
792 | * By default, CWF_F3 packet are send without the b1, b2 and b3 data. This function rebuilds a data buffer | |
780 | * from the incoming data and sends it in 7 packets, 6 containing 340 blocks and 1 one containing 8 blocks. |
|
793 | * from the incoming data and sends it in 7 packets, 6 containing 340 blocks and 1 one containing 8 blocks. | |
781 | * |
|
794 | * | |
782 | */ |
|
795 | */ | |
783 |
|
796 | |||
784 | unsigned int i; |
|
797 | unsigned int i; | |
785 | int ret; |
|
798 | int ret; | |
786 | unsigned int coarseTime; |
|
799 | unsigned int coarseTime; | |
787 | unsigned int fineTime; |
|
800 | unsigned int fineTime; | |
788 | rtems_status_code status; |
|
801 | rtems_status_code status; | |
789 | spw_ioctl_pkt_send spw_ioctl_send_CWF; |
|
802 | spw_ioctl_pkt_send spw_ioctl_send_CWF; | |
790 | char *sample; |
|
803 | char *sample; | |
791 |
|
804 | |||
792 | spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header |
|
805 | spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header | |
793 | spw_ioctl_send_CWF.options = 0; |
|
806 | spw_ioctl_send_CWF.options = 0; | |
794 |
|
807 | |||
795 | ret = LFR_DEFAULT; |
|
808 | ret = LFR_DEFAULT; | |
796 |
|
809 | |||
797 | //********************** |
|
810 | //********************** | |
798 | // BUILD CWF3_light DATA |
|
811 | // BUILD CWF3_light DATA | |
799 | for ( i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++) |
|
812 | for ( i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++) | |
800 | { |
|
813 | { | |
801 | sample = (char*) &waveform[ (i * NB_WORDS_SWF_BLK) + TIME_OFFSET ]; |
|
814 | sample = (char*) &waveform[ (i * NB_WORDS_SWF_BLK) + TIME_OFFSET ]; | |
802 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + TIME_OFFSET_IN_BYTES ] = sample[ 0 ]; |
|
815 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + TIME_OFFSET_IN_BYTES ] = sample[ 0 ]; | |
803 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 + TIME_OFFSET_IN_BYTES ] = sample[ 1 ]; |
|
816 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 + TIME_OFFSET_IN_BYTES ] = sample[ 1 ]; | |
804 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 + TIME_OFFSET_IN_BYTES ] = sample[ 2 ]; |
|
817 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 + TIME_OFFSET_IN_BYTES ] = sample[ 2 ]; | |
805 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 + TIME_OFFSET_IN_BYTES ] = sample[ 3 ]; |
|
818 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 + TIME_OFFSET_IN_BYTES ] = sample[ 3 ]; | |
806 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 + TIME_OFFSET_IN_BYTES ] = sample[ 4 ]; |
|
819 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 + TIME_OFFSET_IN_BYTES ] = sample[ 4 ]; | |
807 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 + TIME_OFFSET_IN_BYTES ] = sample[ 5 ]; |
|
820 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 + TIME_OFFSET_IN_BYTES ] = sample[ 5 ]; | |
808 | } |
|
821 | } | |
809 |
|
822 | |||
810 | coarseTime = waveform[0]; |
|
823 | coarseTime = waveform[0]; | |
811 | fineTime = waveform[1]; |
|
824 | fineTime = waveform[1]; | |
812 |
|
825 | |||
813 | //********************* |
|
826 | //********************* | |
814 | // SEND CWF3_light DATA |
|
827 | // SEND CWF3_light DATA | |
815 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF_LIGHT; i++) // send waveform |
|
828 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF_LIGHT; i++) // send waveform | |
816 | { |
|
829 | { | |
817 | spw_ioctl_send_CWF.data = (char*) &wf_cont_f3_light[ (i * BLK_NR_CWF_SHORT_F3 * NB_BYTES_CWF3_LIGHT_BLK) + TIME_OFFSET_IN_BYTES]; |
|
830 | spw_ioctl_send_CWF.data = (char*) &wf_cont_f3_light[ (i * BLK_NR_CWF_SHORT_F3 * NB_BYTES_CWF3_LIGHT_BLK) + TIME_OFFSET_IN_BYTES]; | |
818 | spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ]; |
|
831 | spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ]; | |
819 | // BUILD THE DATA |
|
832 | // BUILD THE DATA | |
820 | spw_ioctl_send_CWF.dlen = BLK_NR_CWF_SHORT_F3 * NB_BYTES_CWF3_LIGHT_BLK; |
|
833 | spw_ioctl_send_CWF.dlen = BLK_NR_CWF_SHORT_F3 * NB_BYTES_CWF3_LIGHT_BLK; | |
821 | // SET PACKET SEQUENCE COUNTER |
|
834 | // SET PACKET SEQUENCE COUNTER | |
822 | increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, SID_NORM_CWF_F3 ); |
|
835 | increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, SID_NORM_CWF_F3 ); | |
823 | // SET PACKET TIME |
|
836 | // SET PACKET TIME | |
824 | compute_acquisition_time( coarseTime, fineTime, SID_NORM_CWF_F3, i, headerCWF[ i ].acquisitionTime ); |
|
837 | compute_acquisition_time( coarseTime, fineTime, SID_NORM_CWF_F3, i, headerCWF[ i ].acquisitionTime ); | |
825 | // |
|
838 | // | |
826 | headerCWF[ i ].time[0] = headerCWF[ i ].acquisitionTime[0]; |
|
839 | headerCWF[ i ].time[0] = headerCWF[ i ].acquisitionTime[0]; | |
827 | headerCWF[ i ].time[1] = headerCWF[ i ].acquisitionTime[1]; |
|
840 | headerCWF[ i ].time[1] = headerCWF[ i ].acquisitionTime[1]; | |
828 | headerCWF[ i ].time[2] = headerCWF[ i ].acquisitionTime[2]; |
|
841 | headerCWF[ i ].time[2] = headerCWF[ i ].acquisitionTime[2]; | |
829 | headerCWF[ i ].time[3] = headerCWF[ i ].acquisitionTime[3]; |
|
842 | headerCWF[ i ].time[3] = headerCWF[ i ].acquisitionTime[3]; | |
830 | headerCWF[ i ].time[4] = headerCWF[ i ].acquisitionTime[4]; |
|
843 | headerCWF[ i ].time[4] = headerCWF[ i ].acquisitionTime[4]; | |
831 | headerCWF[ i ].time[5] = headerCWF[ i ].acquisitionTime[5]; |
|
844 | headerCWF[ i ].time[5] = headerCWF[ i ].acquisitionTime[5]; | |
832 | // SEND PACKET |
|
845 | // SEND PACKET | |
833 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); |
|
846 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); | |
834 | if (status != RTEMS_SUCCESSFUL) { |
|
847 | if (status != RTEMS_SUCCESSFUL) { | |
835 | printf("%d-%d, ERR %d\n", SID_NORM_CWF_F3, i, (int) status); |
|
848 | printf("%d-%d, ERR %d\n", SID_NORM_CWF_F3, i, (int) status); | |
836 | ret = LFR_DEFAULT; |
|
849 | ret = LFR_DEFAULT; | |
837 | } |
|
850 | } | |
838 | rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS); |
|
851 | rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS); | |
839 | } |
|
852 | } | |
840 |
|
853 | |||
841 | return ret; |
|
854 | return ret; | |
842 | } |
|
855 | } | |
843 |
|
856 | |||
844 | void compute_acquisition_time( unsigned int coarseTime, unsigned int fineTime, |
|
857 | void compute_acquisition_time( unsigned int coarseTime, unsigned int fineTime, | |
845 | unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char * acquisitionTime ) |
|
858 | unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char * acquisitionTime ) | |
846 | { |
|
859 | { | |
847 | unsigned long long int acquisitionTimeAsLong; |
|
860 | unsigned long long int acquisitionTimeAsLong; | |
848 | unsigned char localAcquisitionTime[6]; |
|
861 | unsigned char localAcquisitionTime[6]; | |
849 | double deltaT; |
|
862 | double deltaT; | |
850 |
|
863 | |||
851 | deltaT = 0.; |
|
864 | deltaT = 0.; | |
852 |
|
865 | |||
853 | localAcquisitionTime[0] = (unsigned char) ( coarseTime >> 24 ); |
|
866 | localAcquisitionTime[0] = (unsigned char) ( coarseTime >> 24 ); | |
854 | localAcquisitionTime[1] = (unsigned char) ( coarseTime >> 16 ); |
|
867 | localAcquisitionTime[1] = (unsigned char) ( coarseTime >> 16 ); | |
855 | localAcquisitionTime[2] = (unsigned char) ( coarseTime >> 8 ); |
|
868 | localAcquisitionTime[2] = (unsigned char) ( coarseTime >> 8 ); | |
856 | localAcquisitionTime[3] = (unsigned char) ( coarseTime ); |
|
869 | localAcquisitionTime[3] = (unsigned char) ( coarseTime ); | |
857 | localAcquisitionTime[4] = (unsigned char) ( fineTime >> 8 ); |
|
870 | localAcquisitionTime[4] = (unsigned char) ( fineTime >> 8 ); | |
858 | localAcquisitionTime[5] = (unsigned char) ( fineTime ); |
|
871 | localAcquisitionTime[5] = (unsigned char) ( fineTime ); | |
859 |
|
872 | |||
860 | acquisitionTimeAsLong = ( (unsigned long long int) localAcquisitionTime[0] << 40 ) |
|
873 | acquisitionTimeAsLong = ( (unsigned long long int) localAcquisitionTime[0] << 40 ) | |
861 | + ( (unsigned long long int) localAcquisitionTime[1] << 32 ) |
|
874 | + ( (unsigned long long int) localAcquisitionTime[1] << 32 ) | |
862 | + ( (unsigned long long int) localAcquisitionTime[2] << 24 ) |
|
875 | + ( (unsigned long long int) localAcquisitionTime[2] << 24 ) | |
863 | + ( (unsigned long long int) localAcquisitionTime[3] << 16 ) |
|
876 | + ( (unsigned long long int) localAcquisitionTime[3] << 16 ) | |
864 | + ( (unsigned long long int) localAcquisitionTime[4] << 8 ) |
|
877 | + ( (unsigned long long int) localAcquisitionTime[4] << 8 ) | |
865 | + ( (unsigned long long int) localAcquisitionTime[5] ); |
|
878 | + ( (unsigned long long int) localAcquisitionTime[5] ); | |
866 |
|
879 | |||
867 | switch( sid ) |
|
880 | switch( sid ) | |
868 | { |
|
881 | { | |
869 | case SID_NORM_SWF_F0: |
|
882 | case SID_NORM_SWF_F0: | |
870 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 24576. ; |
|
883 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 24576. ; | |
871 | break; |
|
884 | break; | |
872 |
|
885 | |||
873 | case SID_NORM_SWF_F1: |
|
886 | case SID_NORM_SWF_F1: | |
874 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 4096. ; |
|
887 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 4096. ; | |
875 | break; |
|
888 | break; | |
876 |
|
889 | |||
877 | case SID_NORM_SWF_F2: |
|
890 | case SID_NORM_SWF_F2: | |
878 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 256. ; |
|
891 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 256. ; | |
879 | break; |
|
892 | break; | |
880 |
|
893 | |||
881 | case SID_SBM1_CWF_F1: |
|
894 | case SID_SBM1_CWF_F1: | |
882 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 4096. ; |
|
895 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 4096. ; | |
883 | break; |
|
896 | break; | |
884 |
|
897 | |||
885 | case SID_SBM2_CWF_F2: |
|
898 | case SID_SBM2_CWF_F2: | |
886 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ; |
|
899 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ; | |
887 | break; |
|
900 | break; | |
888 |
|
901 | |||
889 | case SID_BURST_CWF_F2: |
|
902 | case SID_BURST_CWF_F2: | |
890 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ; |
|
903 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ; | |
891 | break; |
|
904 | break; | |
892 |
|
905 | |||
893 | case SID_NORM_CWF_F3: |
|
906 | case SID_NORM_CWF_F3: | |
894 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF_SHORT_F3 * 65536. / 16. ; |
|
907 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF_SHORT_F3 * 65536. / 16. ; | |
895 | break; |
|
908 | break; | |
896 |
|
909 | |||
897 | case SID_NORM_CWF_LONG_F3: |
|
910 | case SID_NORM_CWF_LONG_F3: | |
898 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 16. ; |
|
911 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 16. ; | |
899 | break; |
|
912 | break; | |
900 |
|
913 | |||
901 | default: |
|
914 | default: | |
902 | PRINTF1("in compute_acquisition_time *** ERR unexpected sid %d", sid) |
|
915 | PRINTF1("in compute_acquisition_time *** ERR unexpected sid %d", sid) | |
903 | deltaT = 0.; |
|
916 | deltaT = 0.; | |
904 | break; |
|
917 | break; | |
905 | } |
|
918 | } | |
906 |
|
919 | |||
907 | acquisitionTimeAsLong = acquisitionTimeAsLong + (unsigned long long int) deltaT; |
|
920 | acquisitionTimeAsLong = acquisitionTimeAsLong + (unsigned long long int) deltaT; | |
908 | // |
|
921 | // | |
909 | acquisitionTime[0] = (unsigned char) (acquisitionTimeAsLong >> 40); |
|
922 | acquisitionTime[0] = (unsigned char) (acquisitionTimeAsLong >> 40); | |
910 | acquisitionTime[1] = (unsigned char) (acquisitionTimeAsLong >> 32); |
|
923 | acquisitionTime[1] = (unsigned char) (acquisitionTimeAsLong >> 32); | |
911 | acquisitionTime[2] = (unsigned char) (acquisitionTimeAsLong >> 24); |
|
924 | acquisitionTime[2] = (unsigned char) (acquisitionTimeAsLong >> 24); | |
912 | acquisitionTime[3] = (unsigned char) (acquisitionTimeAsLong >> 16); |
|
925 | acquisitionTime[3] = (unsigned char) (acquisitionTimeAsLong >> 16); | |
913 | acquisitionTime[4] = (unsigned char) (acquisitionTimeAsLong >> 8 ); |
|
926 | acquisitionTime[4] = (unsigned char) (acquisitionTimeAsLong >> 8 ); | |
914 | acquisitionTime[5] = (unsigned char) (acquisitionTimeAsLong ); |
|
927 | acquisitionTime[5] = (unsigned char) (acquisitionTimeAsLong ); | |
915 |
|
928 | |||
916 | } |
|
929 | } | |
917 |
|
930 | |||
918 | void build_snapshot_from_ring( ring_node *ring_node_to_send, unsigned char frequencyChannel ) |
|
931 | void build_snapshot_from_ring( ring_node *ring_node_to_send, unsigned char frequencyChannel ) | |
919 | { |
|
932 | { | |
920 | unsigned int i; |
|
933 | unsigned int i; | |
921 | unsigned long long int centerTime_asLong; |
|
934 | unsigned long long int centerTime_asLong; | |
922 | unsigned long long int acquisitionTimeF0_asLong; |
|
935 | unsigned long long int acquisitionTimeF0_asLong; | |
923 | unsigned long long int acquisitionTime_asLong; |
|
936 | unsigned long long int acquisitionTime_asLong; | |
924 | unsigned long long int bufferAcquisitionTime_asLong; |
|
937 | unsigned long long int bufferAcquisitionTime_asLong; | |
925 | unsigned char *ptr1; |
|
938 | unsigned char *ptr1; | |
926 | unsigned char *ptr2; |
|
939 | unsigned char *ptr2; | |
927 | unsigned char *timeCharPtr; |
|
940 | unsigned char *timeCharPtr; | |
928 | unsigned char nb_ring_nodes; |
|
941 | unsigned char nb_ring_nodes; | |
929 | unsigned long long int frequency_asLong; |
|
942 | unsigned long long int frequency_asLong; | |
930 | unsigned long long int nbTicksPerSample_asLong; |
|
943 | unsigned long long int nbTicksPerSample_asLong; | |
931 | unsigned long long int nbSamplesPart1_asLong; |
|
944 | unsigned long long int nbSamplesPart1_asLong; | |
932 | unsigned long long int sampleOffset_asLong; |
|
945 | unsigned long long int sampleOffset_asLong; | |
933 |
|
946 | |||
934 | unsigned int deltaT_F0; |
|
947 | unsigned int deltaT_F0; | |
935 | unsigned int deltaT_F1; |
|
948 | unsigned int deltaT_F1; | |
936 | unsigned long long int deltaT_F2; |
|
949 | unsigned long long int deltaT_F2; | |
937 |
|
950 | |||
938 | deltaT_F0 = 2731; // (2048. / 24576. / 2.) * 65536. = 2730.667; |
|
951 | deltaT_F0 = 2731; // (2048. / 24576. / 2.) * 65536. = 2730.667; | |
939 | deltaT_F1 = 16384; // (2048. / 4096. / 2.) * 65536. = 16384; |
|
952 | deltaT_F1 = 16384; // (2048. / 4096. / 2.) * 65536. = 16384; | |
940 | deltaT_F2 = 262144; // (2048. / 256. / 2.) * 65536. = 262144; |
|
953 | deltaT_F2 = 262144; // (2048. / 256. / 2.) * 65536. = 262144; | |
941 | sampleOffset_asLong = 0x00; |
|
954 | sampleOffset_asLong = 0x00; | |
942 |
|
955 | |||
943 | // (1) get the f0 acquisition time |
|
956 | // (1) get the f0 acquisition time | |
944 | build_acquisition_time( &acquisitionTimeF0_asLong, current_ring_node_f0 ); |
|
957 | build_acquisition_time( &acquisitionTimeF0_asLong, current_ring_node_f0 ); | |
945 |
|
958 | |||
946 | // (2) compute the central reference time |
|
959 | // (2) compute the central reference time | |
947 | centerTime_asLong = acquisitionTimeF0_asLong + deltaT_F0; |
|
960 | centerTime_asLong = acquisitionTimeF0_asLong + deltaT_F0; | |
948 |
|
961 | |||
949 | // (3) compute the acquisition time of the current snapshot |
|
962 | // (3) compute the acquisition time of the current snapshot | |
950 | switch(frequencyChannel) |
|
963 | switch(frequencyChannel) | |
951 | { |
|
964 | { | |
952 | case 1: // 1 is for F1 = 4096 Hz |
|
965 | case 1: // 1 is for F1 = 4096 Hz | |
953 | acquisitionTime_asLong = centerTime_asLong - deltaT_F1; |
|
966 | acquisitionTime_asLong = centerTime_asLong - deltaT_F1; | |
954 | nb_ring_nodes = NB_RING_NODES_F1; |
|
967 | nb_ring_nodes = NB_RING_NODES_F1; | |
955 | frequency_asLong = 4096; |
|
968 | frequency_asLong = 4096; | |
956 | nbTicksPerSample_asLong = 16; // 65536 / 4096; |
|
969 | nbTicksPerSample_asLong = 16; // 65536 / 4096; | |
957 | break; |
|
970 | break; | |
958 | case 2: // 2 is for F2 = 256 Hz |
|
971 | case 2: // 2 is for F2 = 256 Hz | |
959 | acquisitionTime_asLong = centerTime_asLong - deltaT_F2; |
|
972 | acquisitionTime_asLong = centerTime_asLong - deltaT_F2; | |
960 | nb_ring_nodes = NB_RING_NODES_F2; |
|
973 | nb_ring_nodes = NB_RING_NODES_F2; | |
961 | frequency_asLong = 256; |
|
974 | frequency_asLong = 256; | |
962 | nbTicksPerSample_asLong = 256; // 65536 / 256; |
|
975 | nbTicksPerSample_asLong = 256; // 65536 / 256; | |
963 | break; |
|
976 | break; | |
964 | default: |
|
977 | default: | |
965 | acquisitionTime_asLong = centerTime_asLong; |
|
978 | acquisitionTime_asLong = centerTime_asLong; | |
966 | frequency_asLong = 256; |
|
979 | frequency_asLong = 256; | |
967 | nbTicksPerSample_asLong = 256; |
|
980 | nbTicksPerSample_asLong = 256; | |
968 | break; |
|
981 | break; | |
969 | } |
|
982 | } | |
970 |
|
983 | |||
971 | //**************************************************************************** |
|
984 | //**************************************************************************** | |
972 | // (4) search the ring_node with the acquisition time <= acquisitionTime_asLong |
|
985 | // (4) search the ring_node with the acquisition time <= acquisitionTime_asLong | |
973 | for (i=0; i<nb_ring_nodes; i++) |
|
986 | for (i=0; i<nb_ring_nodes; i++) | |
974 | { |
|
987 | { | |
975 | PRINTF1("%d ... ", i) |
|
988 | PRINTF1("%d ... ", i) | |
976 | build_acquisition_time( &bufferAcquisitionTime_asLong, ring_node_to_send ); |
|
989 | build_acquisition_time( &bufferAcquisitionTime_asLong, ring_node_to_send ); | |
977 | if (bufferAcquisitionTime_asLong <= acquisitionTime_asLong) |
|
990 | if (bufferAcquisitionTime_asLong <= acquisitionTime_asLong) | |
978 | { |
|
991 | { | |
979 | PRINTF1("buffer found with acquisition time = %llx\n", bufferAcquisitionTime_asLong) |
|
992 | PRINTF1("buffer found with acquisition time = %llx\n", bufferAcquisitionTime_asLong) | |
980 | break; |
|
993 | break; | |
981 | } |
|
994 | } | |
982 | ring_node_to_send = ring_node_to_send->previous; |
|
995 | ring_node_to_send = ring_node_to_send->previous; | |
983 | } |
|
996 | } | |
984 |
|
997 | |||
985 | // (5) compute the number of samples to take in the current buffer |
|
998 | // (5) compute the number of samples to take in the current buffer | |
986 | sampleOffset_asLong = ((acquisitionTime_asLong - bufferAcquisitionTime_asLong) * frequency_asLong ) >> 16; |
|
999 | sampleOffset_asLong = ((acquisitionTime_asLong - bufferAcquisitionTime_asLong) * frequency_asLong ) >> 16; | |
987 | nbSamplesPart1_asLong = NB_SAMPLES_PER_SNAPSHOT - sampleOffset_asLong; |
|
1000 | nbSamplesPart1_asLong = NB_SAMPLES_PER_SNAPSHOT - sampleOffset_asLong; | |
988 | PRINTF2("sampleOffset_asLong = %llx, nbSamplesPart1_asLong = %llx\n", sampleOffset_asLong, nbSamplesPart1_asLong) |
|
1001 | PRINTF2("sampleOffset_asLong = %llx, nbSamplesPart1_asLong = %llx\n", sampleOffset_asLong, nbSamplesPart1_asLong) | |
989 |
|
1002 | |||
990 | // (6) compute the final acquisition time |
|
1003 | // (6) compute the final acquisition time | |
991 | acquisitionTime_asLong = bufferAcquisitionTime_asLong + |
|
1004 | acquisitionTime_asLong = bufferAcquisitionTime_asLong + | |
992 | sampleOffset_asLong * nbTicksPerSample_asLong; |
|
1005 | sampleOffset_asLong * nbTicksPerSample_asLong; | |
993 |
|
1006 | |||
994 | // (7) copy the acquisition time at the beginning of the extrated snapshot |
|
1007 | // (7) copy the acquisition time at the beginning of the extrated snapshot | |
995 | ptr1 = (unsigned char*) &acquisitionTime_asLong; |
|
1008 | ptr1 = (unsigned char*) &acquisitionTime_asLong; | |
996 | ptr2 = (unsigned char*) wf_snap_extracted; |
|
1009 | ptr2 = (unsigned char*) wf_snap_extracted; | |
997 | ptr2[0] = ptr1[ 0 + 2 ]; |
|
1010 | ptr2[0] = ptr1[ 0 + 2 ]; | |
998 | ptr2[1] = ptr1[ 1 + 2 ]; |
|
1011 | ptr2[1] = ptr1[ 1 + 2 ]; | |
999 | ptr2[2] = ptr1[ 2 + 2 ]; |
|
1012 | ptr2[2] = ptr1[ 2 + 2 ]; | |
1000 | ptr2[3] = ptr1[ 3 + 2 ]; |
|
1013 | ptr2[3] = ptr1[ 3 + 2 ]; | |
1001 | ptr2[6] = ptr1[ 4 + 2 ]; |
|
1014 | ptr2[6] = ptr1[ 4 + 2 ]; | |
1002 | ptr2[7] = ptr1[ 5 + 2 ]; |
|
1015 | ptr2[7] = ptr1[ 5 + 2 ]; | |
1003 |
|
1016 | |||
1004 | // re set the synchronization bit |
|
1017 | // re set the synchronization bit | |
1005 | timeCharPtr = (unsigned char*) ring_node_to_send->buffer_address; |
|
1018 | timeCharPtr = (unsigned char*) ring_node_to_send->buffer_address; | |
1006 | ptr2[0] = ptr2[0] | (timeCharPtr[0] & 0x80); // [1000 0000] |
|
1019 | ptr2[0] = ptr2[0] | (timeCharPtr[0] & 0x80); // [1000 0000] | |
1007 |
|
1020 | |||
1008 | if ( (nbSamplesPart1_asLong >= NB_SAMPLES_PER_SNAPSHOT) | (nbSamplesPart1_asLong < 0) ) |
|
1021 | if ( (nbSamplesPart1_asLong >= NB_SAMPLES_PER_SNAPSHOT) | (nbSamplesPart1_asLong < 0) ) | |
1009 | { |
|
1022 | { | |
1010 | nbSamplesPart1_asLong = 0; |
|
1023 | nbSamplesPart1_asLong = 0; | |
1011 | } |
|
1024 | } | |
1012 | // copy the part 1 of the snapshot in the extracted buffer |
|
1025 | // copy the part 1 of the snapshot in the extracted buffer | |
1013 | for ( i = 0; i < (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i++ ) |
|
1026 | for ( i = 0; i < (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i++ ) | |
1014 | { |
|
1027 | { | |
1015 | wf_snap_extracted[i + TIME_OFFSET] = |
|
1028 | wf_snap_extracted[i + TIME_OFFSET] = | |
1016 | ((int*) ring_node_to_send->buffer_address)[i + (sampleOffset_asLong * NB_WORDS_SWF_BLK) + TIME_OFFSET]; |
|
1029 | ((int*) ring_node_to_send->buffer_address)[i + (sampleOffset_asLong * NB_WORDS_SWF_BLK) + TIME_OFFSET]; | |
1017 | } |
|
1030 | } | |
1018 | // copy the part 2 of the snapshot in the extracted buffer |
|
1031 | // copy the part 2 of the snapshot in the extracted buffer | |
1019 | ring_node_to_send = ring_node_to_send->next; |
|
1032 | ring_node_to_send = ring_node_to_send->next; | |
1020 | for ( i = (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i < (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK); i++ ) |
|
1033 | for ( i = (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i < (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK); i++ ) | |
1021 | { |
|
1034 | { | |
1022 | wf_snap_extracted[i + TIME_OFFSET] = |
|
1035 | wf_snap_extracted[i + TIME_OFFSET] = | |
1023 | ((int*) ring_node_to_send->buffer_address)[(i-(nbSamplesPart1_asLong * NB_WORDS_SWF_BLK)) + TIME_OFFSET]; |
|
1036 | ((int*) ring_node_to_send->buffer_address)[(i-(nbSamplesPart1_asLong * NB_WORDS_SWF_BLK)) + TIME_OFFSET]; | |
1024 | } |
|
1037 | } | |
1025 | } |
|
1038 | } | |
1026 |
|
1039 | |||
1027 | void build_acquisition_time( unsigned long long int *acquisitionTimeAslong, ring_node *current_ring_node ) |
|
1040 | void build_acquisition_time( unsigned long long int *acquisitionTimeAslong, ring_node *current_ring_node ) | |
1028 | { |
|
1041 | { | |
1029 | unsigned char *acquisitionTimeCharPtr; |
|
1042 | unsigned char *acquisitionTimeCharPtr; | |
1030 |
|
1043 | |||
1031 | acquisitionTimeCharPtr = (unsigned char*) current_ring_node->buffer_address; |
|
1044 | acquisitionTimeCharPtr = (unsigned char*) current_ring_node->buffer_address; | |
1032 |
|
1045 | |||
1033 | *acquisitionTimeAslong = 0x00; |
|
1046 | *acquisitionTimeAslong = 0x00; | |
1034 | *acquisitionTimeAslong = ( (unsigned long long int) (acquisitionTimeCharPtr[0] & 0x7f) << 40 ) // [0111 1111] mask the synchronization bit |
|
1047 | *acquisitionTimeAslong = ( (unsigned long long int) (acquisitionTimeCharPtr[0] & 0x7f) << 40 ) // [0111 1111] mask the synchronization bit | |
1035 | + ( (unsigned long long int) acquisitionTimeCharPtr[1] << 32 ) |
|
1048 | + ( (unsigned long long int) acquisitionTimeCharPtr[1] << 32 ) | |
1036 | + ( (unsigned long long int) acquisitionTimeCharPtr[2] << 24 ) |
|
1049 | + ( (unsigned long long int) acquisitionTimeCharPtr[2] << 24 ) | |
1037 | + ( (unsigned long long int) acquisitionTimeCharPtr[3] << 16 ) |
|
1050 | + ( (unsigned long long int) acquisitionTimeCharPtr[3] << 16 ) | |
1038 | + ( (unsigned long long int) acquisitionTimeCharPtr[6] << 8 ) |
|
1051 | + ( (unsigned long long int) acquisitionTimeCharPtr[6] << 8 ) | |
1039 | + ( (unsigned long long int) acquisitionTimeCharPtr[7] ); |
|
1052 | + ( (unsigned long long int) acquisitionTimeCharPtr[7] ); | |
1040 | } |
|
1053 | } | |
1041 |
|
1054 | |||
1042 | //************** |
|
1055 | //************** | |
1043 | // wfp registers |
|
1056 | // wfp registers | |
1044 | void reset_wfp_burst_enable(void) |
|
1057 | void reset_wfp_burst_enable(void) | |
1045 | { |
|
1058 | { | |
1046 | /** This function resets the waveform picker burst_enable register. |
|
1059 | /** This function resets the waveform picker burst_enable register. | |
1047 | * |
|
1060 | * | |
1048 | * The burst bits [f2 f1 f0] and the enable bits [f3 f2 f1 f0] are set to 0. |
|
1061 | * The burst bits [f2 f1 f0] and the enable bits [f3 f2 f1 f0] are set to 0. | |
1049 | * |
|
1062 | * | |
1050 | */ |
|
1063 | */ | |
1051 |
|
1064 | |||
1052 | waveform_picker_regs->run_burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 |
|
1065 | waveform_picker_regs->run_burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 | |
1053 | } |
|
1066 | } | |
1054 |
|
1067 | |||
1055 | void reset_wfp_status( void ) |
|
1068 | void reset_wfp_status( void ) | |
1056 | { |
|
1069 | { | |
1057 | /** This function resets the waveform picker status register. |
|
1070 | /** This function resets the waveform picker status register. | |
1058 | * |
|
1071 | * | |
1059 | * All status bits are set to 0 [new_err full_err full]. |
|
1072 | * All status bits are set to 0 [new_err full_err full]. | |
1060 | * |
|
1073 | * | |
1061 | */ |
|
1074 | */ | |
1062 |
|
1075 | |||
1063 | waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 |
|
1076 | waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 | |
1064 | } |
|
1077 | } | |
1065 |
|
1078 | |||
1066 | void reset_waveform_picker_regs(void) |
|
1079 | void reset_waveform_picker_regs(void) | |
1067 | { |
|
1080 | { | |
1068 | /** This function resets the waveform picker module registers. |
|
1081 | /** This function resets the waveform picker module registers. | |
1069 | * |
|
1082 | * | |
1070 | * The registers affected by this function are located at the following offset addresses: |
|
1083 | * The registers affected by this function are located at the following offset addresses: | |
1071 | * - 0x00 data_shaping |
|
1084 | * - 0x00 data_shaping | |
1072 | * - 0x04 run_burst_enable |
|
1085 | * - 0x04 run_burst_enable | |
1073 | * - 0x08 addr_data_f0 |
|
1086 | * - 0x08 addr_data_f0 | |
1074 | * - 0x0C addr_data_f1 |
|
1087 | * - 0x0C addr_data_f1 | |
1075 | * - 0x10 addr_data_f2 |
|
1088 | * - 0x10 addr_data_f2 | |
1076 | * - 0x14 addr_data_f3 |
|
1089 | * - 0x14 addr_data_f3 | |
1077 | * - 0x18 status |
|
1090 | * - 0x18 status | |
1078 | * - 0x1C delta_snapshot |
|
1091 | * - 0x1C delta_snapshot | |
1079 | * - 0x20 delta_f0 |
|
1092 | * - 0x20 delta_f0 | |
1080 | * - 0x24 delta_f0_2 |
|
1093 | * - 0x24 delta_f0_2 | |
1081 | * - 0x28 delta_f1 |
|
1094 | * - 0x28 delta_f1 | |
1082 | * - 0x2c delta_f2 |
|
1095 | * - 0x2c delta_f2 | |
1083 | * - 0x30 nb_data_by_buffer |
|
1096 | * - 0x30 nb_data_by_buffer | |
1084 | * - 0x34 nb_snapshot_param |
|
1097 | * - 0x34 nb_snapshot_param | |
1085 | * - 0x38 start_date |
|
1098 | * - 0x38 start_date | |
1086 | * - 0x3c nb_word_in_buffer |
|
1099 | * - 0x3c nb_word_in_buffer | |
1087 | * |
|
1100 | * | |
1088 | */ |
|
1101 | */ | |
1089 |
|
1102 | |||
1090 | set_wfp_data_shaping(); // 0x00 *** R1 R0 SP1 SP0 BW |
|
1103 | set_wfp_data_shaping(); // 0x00 *** R1 R0 SP1 SP0 BW | |
1091 | reset_wfp_burst_enable(); // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ] |
|
1104 | reset_wfp_burst_enable(); // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ] | |
1092 | waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address; // 0x08 |
|
1105 | waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address; // 0x08 | |
1093 | waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; // 0x0c |
|
1106 | waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; // 0x0c | |
1094 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; // 0x10 |
|
1107 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; // 0x10 | |
1095 | waveform_picker_regs->addr_data_f3 = current_ring_node_f3->buffer_address; // 0x14 |
|
1108 | waveform_picker_regs->addr_data_f3 = current_ring_node_f3->buffer_address; // 0x14 | |
1096 | reset_wfp_status(); // 0x18 |
|
1109 | reset_wfp_status(); // 0x18 | |
1097 | // |
|
1110 | // | |
1098 | set_wfp_delta_snapshot(); // 0x1c |
|
1111 | set_wfp_delta_snapshot(); // 0x1c | |
1099 | set_wfp_delta_f0_f0_2(); // 0x20, 0x24 |
|
1112 | set_wfp_delta_f0_f0_2(); // 0x20, 0x24 | |
1100 | set_wfp_delta_f1(); // 0x28 |
|
1113 | set_wfp_delta_f1(); // 0x28 | |
1101 | set_wfp_delta_f2(); // 0x2c |
|
1114 | set_wfp_delta_f2(); // 0x2c | |
1102 | DEBUG_PRINTF1("delta_snapshot %x\n", waveform_picker_regs->delta_snapshot) |
|
1115 | DEBUG_PRINTF1("delta_snapshot %x\n", waveform_picker_regs->delta_snapshot) | |
1103 | DEBUG_PRINTF1("delta_f0 %x\n", waveform_picker_regs->delta_f0) |
|
1116 | DEBUG_PRINTF1("delta_f0 %x\n", waveform_picker_regs->delta_f0) | |
1104 | DEBUG_PRINTF1("delta_f0_2 %x\n", waveform_picker_regs->delta_f0_2) |
|
1117 | DEBUG_PRINTF1("delta_f0_2 %x\n", waveform_picker_regs->delta_f0_2) | |
1105 | DEBUG_PRINTF1("delta_f1 %x\n", waveform_picker_regs->delta_f1) |
|
1118 | DEBUG_PRINTF1("delta_f1 %x\n", waveform_picker_regs->delta_f1) | |
1106 | DEBUG_PRINTF1("delta_f2 %x\n", waveform_picker_regs->delta_f2) |
|
1119 | DEBUG_PRINTF1("delta_f2 %x\n", waveform_picker_regs->delta_f2) | |
1107 | // 2688 = 8 * 336 |
|
1120 | // 2688 = 8 * 336 | |
1108 | waveform_picker_regs->nb_data_by_buffer = 0xa7f; // 0x30 *** 2688 - 1 => nb samples -1 |
|
1121 | waveform_picker_regs->nb_data_by_buffer = 0xa7f; // 0x30 *** 2688 - 1 => nb samples -1 | |
1109 | waveform_picker_regs->snapshot_param = 0xa80; // 0x34 *** 2688 => nb samples |
|
1122 | waveform_picker_regs->snapshot_param = 0xa80; // 0x34 *** 2688 => nb samples | |
1110 | waveform_picker_regs->start_date = 0x00; // 0x38 |
|
1123 | waveform_picker_regs->start_date = 0x00; // 0x38 | |
1111 | waveform_picker_regs->nb_word_in_buffer = 0x1f82; // 0x3c *** 2688 * 3 + 2 = 8066 |
|
1124 | waveform_picker_regs->nb_word_in_buffer = 0x1f82; // 0x3c *** 2688 * 3 + 2 = 8066 | |
1112 | } |
|
1125 | } | |
1113 |
|
1126 | |||
1114 | void set_wfp_data_shaping( void ) |
|
1127 | void set_wfp_data_shaping( void ) | |
1115 | { |
|
1128 | { | |
1116 | /** This function sets the data_shaping register of the waveform picker module. |
|
1129 | /** This function sets the data_shaping register of the waveform picker module. | |
1117 | * |
|
1130 | * | |
1118 | * The value is read from one field of the parameter_dump_packet structure:\n |
|
1131 | * The value is read from one field of the parameter_dump_packet structure:\n | |
1119 | * bw_sp0_sp1_r0_r1 |
|
1132 | * bw_sp0_sp1_r0_r1 | |
1120 | * |
|
1133 | * | |
1121 | */ |
|
1134 | */ | |
1122 |
|
1135 | |||
1123 | unsigned char data_shaping; |
|
1136 | unsigned char data_shaping; | |
1124 |
|
1137 | |||
1125 | // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register |
|
1138 | // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register | |
1126 | // waveform picker : [R1 R0 SP1 SP0 BW] |
|
1139 | // waveform picker : [R1 R0 SP1 SP0 BW] | |
1127 |
|
1140 | |||
1128 | data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1; |
|
1141 | data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1; | |
1129 |
|
1142 | |||
1130 | waveform_picker_regs->data_shaping = |
|
1143 | waveform_picker_regs->data_shaping = | |
1131 | ( (data_shaping & 0x10) >> 4 ) // BW |
|
1144 | ( (data_shaping & 0x10) >> 4 ) // BW | |
1132 | + ( (data_shaping & 0x08) >> 2 ) // SP0 |
|
1145 | + ( (data_shaping & 0x08) >> 2 ) // SP0 | |
1133 | + ( (data_shaping & 0x04) ) // SP1 |
|
1146 | + ( (data_shaping & 0x04) ) // SP1 | |
1134 | + ( (data_shaping & 0x02) << 2 ) // R0 |
|
1147 | + ( (data_shaping & 0x02) << 2 ) // R0 | |
1135 | + ( (data_shaping & 0x01) << 4 ); // R1 |
|
1148 | + ( (data_shaping & 0x01) << 4 ); // R1 | |
1136 | } |
|
1149 | } | |
1137 |
|
1150 | |||
1138 | void set_wfp_burst_enable_register( unsigned char mode ) |
|
1151 | void set_wfp_burst_enable_register( unsigned char mode ) | |
1139 | { |
|
1152 | { | |
1140 | /** This function sets the waveform picker burst_enable register depending on the mode. |
|
1153 | /** This function sets the waveform picker burst_enable register depending on the mode. | |
1141 | * |
|
1154 | * | |
1142 | * @param mode is the LFR mode to launch. |
|
1155 | * @param mode is the LFR mode to launch. | |
1143 | * |
|
1156 | * | |
1144 | * The burst bits shall be before the enable bits. |
|
1157 | * The burst bits shall be before the enable bits. | |
1145 | * |
|
1158 | * | |
1146 | */ |
|
1159 | */ | |
1147 |
|
1160 | |||
1148 | // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0 |
|
1161 | // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0 | |
1149 | // the burst bits shall be set first, before the enable bits |
|
1162 | // the burst bits shall be set first, before the enable bits | |
1150 | switch(mode) { |
|
1163 | switch(mode) { | |
1151 | case(LFR_MODE_NORMAL): |
|
1164 | case(LFR_MODE_NORMAL): | |
1152 | waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enable |
|
1165 | waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enable | |
1153 | waveform_picker_regs->run_burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0 |
|
1166 | waveform_picker_regs->run_burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0 | |
1154 | break; |
|
1167 | break; | |
1155 | case(LFR_MODE_BURST): |
|
1168 | case(LFR_MODE_BURST): | |
1156 | waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled |
|
1169 | waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled | |
1157 | // waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x04; // [0100] enable f2 |
|
1170 | // waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x04; // [0100] enable f2 | |
1158 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0c; // [1100] enable f3 AND f2 |
|
1171 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0c; // [1100] enable f3 AND f2 | |
1159 | break; |
|
1172 | break; | |
1160 | case(LFR_MODE_SBM1): |
|
1173 | case(LFR_MODE_SBM1): | |
1161 | waveform_picker_regs->run_burst_enable = 0x20; // [0010 0000] f1 burst enabled |
|
1174 | waveform_picker_regs->run_burst_enable = 0x20; // [0010 0000] f1 burst enabled | |
1162 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 |
|
1175 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 | |
1163 | break; |
|
1176 | break; | |
1164 | case(LFR_MODE_SBM2): |
|
1177 | case(LFR_MODE_SBM2): | |
1165 | waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled |
|
1178 | waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled | |
1166 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 |
|
1179 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 | |
1167 | break; |
|
1180 | break; | |
1168 | default: |
|
1181 | default: | |
1169 | waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled |
|
1182 | waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled | |
1170 | break; |
|
1183 | break; | |
1171 | } |
|
1184 | } | |
1172 | } |
|
1185 | } | |
1173 |
|
1186 | |||
1174 | void set_wfp_delta_snapshot( void ) |
|
1187 | void set_wfp_delta_snapshot( void ) | |
1175 | { |
|
1188 | { | |
1176 | /** This function sets the delta_snapshot register of the waveform picker module. |
|
1189 | /** This function sets the delta_snapshot register of the waveform picker module. | |
1177 | * |
|
1190 | * | |
1178 | * The value is read from two (unsigned char) of the parameter_dump_packet structure: |
|
1191 | * The value is read from two (unsigned char) of the parameter_dump_packet structure: | |
1179 | * - sy_lfr_n_swf_p[0] |
|
1192 | * - sy_lfr_n_swf_p[0] | |
1180 | * - sy_lfr_n_swf_p[1] |
|
1193 | * - sy_lfr_n_swf_p[1] | |
1181 | * |
|
1194 | * | |
1182 | */ |
|
1195 | */ | |
1183 |
|
1196 | |||
1184 | unsigned int delta_snapshot; |
|
1197 | unsigned int delta_snapshot; | |
1185 | unsigned int delta_snapshot_in_T2; |
|
1198 | unsigned int delta_snapshot_in_T2; | |
1186 |
|
1199 | |||
1187 | delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256 |
|
1200 | delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256 | |
1188 | + parameter_dump_packet.sy_lfr_n_swf_p[1]; |
|
1201 | + parameter_dump_packet.sy_lfr_n_swf_p[1]; | |
1189 |
|
1202 | |||
1190 | delta_snapshot_in_T2 = delta_snapshot * 256; |
|
1203 | delta_snapshot_in_T2 = delta_snapshot * 256; | |
1191 | waveform_picker_regs->delta_snapshot = delta_snapshot_in_T2 - 1; // max 4 bytes |
|
1204 | waveform_picker_regs->delta_snapshot = delta_snapshot_in_T2 - 1; // max 4 bytes | |
1192 | } |
|
1205 | } | |
1193 |
|
1206 | |||
1194 | void set_wfp_delta_f0_f0_2( void ) |
|
1207 | void set_wfp_delta_f0_f0_2( void ) | |
1195 | { |
|
1208 | { | |
1196 | unsigned int delta_snapshot; |
|
1209 | unsigned int delta_snapshot; | |
1197 | unsigned int nb_samples_per_snapshot; |
|
1210 | unsigned int nb_samples_per_snapshot; | |
1198 | float delta_f0_in_float; |
|
1211 | float delta_f0_in_float; | |
1199 |
|
1212 | |||
1200 | delta_snapshot = waveform_picker_regs->delta_snapshot; |
|
1213 | delta_snapshot = waveform_picker_regs->delta_snapshot; | |
1201 | nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1]; |
|
1214 | nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1]; | |
1202 | delta_f0_in_float =nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 24576.) * 256.; |
|
1215 | delta_f0_in_float =nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 24576.) * 256.; | |
1203 |
|
1216 | |||
1204 | waveform_picker_regs->delta_f0 = delta_snapshot - floor( delta_f0_in_float ); |
|
1217 | waveform_picker_regs->delta_f0 = delta_snapshot - floor( delta_f0_in_float ); | |
1205 | waveform_picker_regs->delta_f0_2 = 0x7; // max 7 bits |
|
1218 | waveform_picker_regs->delta_f0_2 = 0x7; // max 7 bits | |
1206 | } |
|
1219 | } | |
1207 |
|
1220 | |||
1208 | void set_wfp_delta_f1( void ) |
|
1221 | void set_wfp_delta_f1( void ) | |
1209 | { |
|
1222 | { | |
1210 | unsigned int delta_snapshot; |
|
1223 | unsigned int delta_snapshot; | |
1211 | unsigned int nb_samples_per_snapshot; |
|
1224 | unsigned int nb_samples_per_snapshot; | |
1212 | float delta_f1_in_float; |
|
1225 | float delta_f1_in_float; | |
1213 |
|
1226 | |||
1214 | delta_snapshot = waveform_picker_regs->delta_snapshot; |
|
1227 | delta_snapshot = waveform_picker_regs->delta_snapshot; | |
1215 | nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1]; |
|
1228 | nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1]; | |
1216 | delta_f1_in_float = nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 4096.) * 256.; |
|
1229 | delta_f1_in_float = nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 4096.) * 256.; | |
1217 |
|
1230 | |||
1218 | waveform_picker_regs->delta_f1 = delta_snapshot - floor( delta_f1_in_float ); |
|
1231 | waveform_picker_regs->delta_f1 = delta_snapshot - floor( delta_f1_in_float ); | |
1219 | } |
|
1232 | } | |
1220 |
|
1233 | |||
1221 | void set_wfp_delta_f2() |
|
1234 | void set_wfp_delta_f2() | |
1222 | { |
|
1235 | { | |
1223 | unsigned int delta_snapshot; |
|
1236 | unsigned int delta_snapshot; | |
1224 | unsigned int nb_samples_per_snapshot; |
|
1237 | unsigned int nb_samples_per_snapshot; | |
1225 |
|
1238 | |||
1226 | delta_snapshot = waveform_picker_regs->delta_snapshot; |
|
1239 | delta_snapshot = waveform_picker_regs->delta_snapshot; | |
1227 | nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1]; |
|
1240 | nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1]; | |
1228 |
|
1241 | |||
1229 | waveform_picker_regs->delta_f2 = delta_snapshot - nb_samples_per_snapshot / 2; |
|
1242 | waveform_picker_regs->delta_f2 = delta_snapshot - nb_samples_per_snapshot / 2; | |
1230 | } |
|
1243 | } | |
1231 |
|
1244 | |||
1232 | //***************** |
|
1245 | //***************** | |
1233 | // local parameters |
|
1246 | // local parameters | |
1234 |
|
1247 | |||
1235 | void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid ) |
|
1248 | void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid ) | |
1236 | { |
|
1249 | { | |
1237 | /** This function increments the parameter "sequence_cnt" depending on the sid passed in argument. |
|
1250 | /** This function increments the parameter "sequence_cnt" depending on the sid passed in argument. | |
1238 | * |
|
1251 | * | |
1239 | * @param packet_sequence_control is a pointer toward the parameter sequence_cnt to update. |
|
1252 | * @param packet_sequence_control is a pointer toward the parameter sequence_cnt to update. | |
1240 | * @param sid is the source identifier of the packet being updated. |
|
1253 | * @param sid is the source identifier of the packet being updated. | |
1241 | * |
|
1254 | * | |
1242 | * REQ-LFR-SRS-5240 / SSS-CP-FS-590 |
|
1255 | * REQ-LFR-SRS-5240 / SSS-CP-FS-590 | |
1243 | * The sequence counters shall wrap around from 2^14 to zero. |
|
1256 | * The sequence counters shall wrap around from 2^14 to zero. | |
1244 | * The sequence counter shall start at zero at startup. |
|
1257 | * The sequence counter shall start at zero at startup. | |
1245 | * |
|
1258 | * | |
1246 | * REQ-LFR-SRS-5239 / SSS-CP-FS-580 |
|
1259 | * REQ-LFR-SRS-5239 / SSS-CP-FS-580 | |
1247 | * All TM_LFR_SCIENCE_ packets are sent to ground, i.e. destination id = 0 |
|
1260 | * All TM_LFR_SCIENCE_ packets are sent to ground, i.e. destination id = 0 | |
1248 | * |
|
1261 | * | |
1249 | */ |
|
1262 | */ | |
1250 |
|
1263 | |||
1251 | unsigned short *sequence_cnt; |
|
1264 | unsigned short *sequence_cnt; | |
1252 | unsigned short segmentation_grouping_flag; |
|
1265 | unsigned short segmentation_grouping_flag; | |
1253 | unsigned short new_packet_sequence_control; |
|
1266 | unsigned short new_packet_sequence_control; | |
1254 | rtems_mode initial_mode_set; |
|
1267 | rtems_mode initial_mode_set; | |
1255 | rtems_mode current_mode_set; |
|
1268 | rtems_mode current_mode_set; | |
1256 | rtems_status_code status; |
|
1269 | rtems_status_code status; | |
1257 |
|
1270 | |||
1258 | //****************************************** |
|
1271 | //****************************************** | |
1259 | // CHANGE THE MODE OF THE CALLING RTEMS TASK |
|
1272 | // CHANGE THE MODE OF THE CALLING RTEMS TASK | |
1260 | status = rtems_task_mode( RTEMS_NO_PREEMPT, RTEMS_PREEMPT_MASK, &initial_mode_set ); |
|
1273 | status = rtems_task_mode( RTEMS_NO_PREEMPT, RTEMS_PREEMPT_MASK, &initial_mode_set ); | |
1261 |
|
1274 | |||
1262 | if ( (sid == SID_NORM_SWF_F0) || (sid == SID_NORM_SWF_F1) || (sid == SID_NORM_SWF_F2) |
|
1275 | if ( (sid == SID_NORM_SWF_F0) || (sid == SID_NORM_SWF_F1) || (sid == SID_NORM_SWF_F2) | |
1263 | || (sid == SID_NORM_CWF_F3) || (sid == SID_NORM_CWF_LONG_F3) |
|
1276 | || (sid == SID_NORM_CWF_F3) || (sid == SID_NORM_CWF_LONG_F3) | |
1264 | || (sid == SID_BURST_CWF_F2) |
|
1277 | || (sid == SID_BURST_CWF_F2) | |
1265 | || (sid == SID_NORM_ASM_F0) || (sid == SID_NORM_ASM_F1) || (sid == SID_NORM_ASM_F2) |
|
1278 | || (sid == SID_NORM_ASM_F0) || (sid == SID_NORM_ASM_F1) || (sid == SID_NORM_ASM_F2) | |
1266 | || (sid == SID_NORM_BP1_F0) || (sid == SID_NORM_BP1_F1) || (sid == SID_NORM_BP1_F2) |
|
1279 | || (sid == SID_NORM_BP1_F0) || (sid == SID_NORM_BP1_F1) || (sid == SID_NORM_BP1_F2) | |
1267 | || (sid == SID_NORM_BP2_F0) || (sid == SID_NORM_BP2_F1) || (sid == SID_NORM_BP2_F2) |
|
1280 | || (sid == SID_NORM_BP2_F0) || (sid == SID_NORM_BP2_F1) || (sid == SID_NORM_BP2_F2) | |
1268 | || (sid == SID_BURST_BP1_F0) || (sid == SID_BURST_BP2_F0) |
|
1281 | || (sid == SID_BURST_BP1_F0) || (sid == SID_BURST_BP2_F0) | |
1269 | || (sid == SID_BURST_BP1_F1) || (sid == SID_BURST_BP2_F1) ) |
|
1282 | || (sid == SID_BURST_BP1_F1) || (sid == SID_BURST_BP2_F1) ) | |
1270 | { |
|
1283 | { | |
1271 | sequence_cnt = (unsigned short *) &sequenceCounters_SCIENCE_NORMAL_BURST; |
|
1284 | sequence_cnt = (unsigned short *) &sequenceCounters_SCIENCE_NORMAL_BURST; | |
1272 | } |
|
1285 | } | |
1273 | else if ( (sid ==SID_SBM1_CWF_F1) || (sid ==SID_SBM2_CWF_F2) |
|
1286 | else if ( (sid ==SID_SBM1_CWF_F1) || (sid ==SID_SBM2_CWF_F2) | |
1274 | || (sid == SID_SBM1_BP1_F0) || (sid == SID_SBM1_BP2_F0) |
|
1287 | || (sid == SID_SBM1_BP1_F0) || (sid == SID_SBM1_BP2_F0) | |
1275 | || (sid == SID_SBM2_BP1_F0) || (sid == SID_SBM2_BP2_F0) |
|
1288 | || (sid == SID_SBM2_BP1_F0) || (sid == SID_SBM2_BP2_F0) | |
1276 | || (sid == SID_SBM2_BP1_F1) || (sid == SID_SBM2_BP2_F1) ) |
|
1289 | || (sid == SID_SBM2_BP1_F1) || (sid == SID_SBM2_BP2_F1) ) | |
1277 | { |
|
1290 | { | |
1278 | sequence_cnt = (unsigned short *) &sequenceCounters_SCIENCE_SBM1_SBM2; |
|
1291 | sequence_cnt = (unsigned short *) &sequenceCounters_SCIENCE_SBM1_SBM2; | |
1279 | } |
|
1292 | } | |
1280 | else |
|
1293 | else | |
1281 | { |
|
1294 | { | |
1282 | sequence_cnt = (unsigned short *) NULL; |
|
1295 | sequence_cnt = (unsigned short *) NULL; | |
1283 | PRINTF1("in increment_seq_counter_source_id *** ERR apid_destid %d not known\n", sid) |
|
1296 | PRINTF1("in increment_seq_counter_source_id *** ERR apid_destid %d not known\n", sid) | |
1284 | } |
|
1297 | } | |
1285 |
|
1298 | |||
1286 | if (sequence_cnt != NULL) |
|
1299 | if (sequence_cnt != NULL) | |
1287 | { |
|
1300 | { | |
1288 | segmentation_grouping_flag = TM_PACKET_SEQ_CTRL_STANDALONE << 8; |
|
1301 | segmentation_grouping_flag = TM_PACKET_SEQ_CTRL_STANDALONE << 8; | |
1289 | *sequence_cnt = (*sequence_cnt) & 0x3fff; |
|
1302 | *sequence_cnt = (*sequence_cnt) & 0x3fff; | |
1290 |
|
1303 | |||
1291 | new_packet_sequence_control = segmentation_grouping_flag | (*sequence_cnt) ; |
|
1304 | new_packet_sequence_control = segmentation_grouping_flag | (*sequence_cnt) ; | |
1292 |
|
1305 | |||
1293 | packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8); |
|
1306 | packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8); | |
1294 | packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control ); |
|
1307 | packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control ); | |
1295 |
|
1308 | |||
1296 | // increment the sequence counter |
|
1309 | // increment the sequence counter | |
1297 | if ( *sequence_cnt < SEQ_CNT_MAX) |
|
1310 | if ( *sequence_cnt < SEQ_CNT_MAX) | |
1298 | { |
|
1311 | { | |
1299 | *sequence_cnt = *sequence_cnt + 1; |
|
1312 | *sequence_cnt = *sequence_cnt + 1; | |
1300 | } |
|
1313 | } | |
1301 | else |
|
1314 | else | |
1302 | { |
|
1315 | { | |
1303 | *sequence_cnt = 0; |
|
1316 | *sequence_cnt = 0; | |
1304 | } |
|
1317 | } | |
1305 | } |
|
1318 | } | |
1306 |
|
1319 | |||
1307 | //*********************************** |
|
1320 | //*********************************** | |
1308 | // RESET THE MODE OF THE CALLING TASK |
|
1321 | // RESET THE MODE OF THE CALLING TASK | |
1309 | status = rtems_task_mode( initial_mode_set, RTEMS_PREEMPT_MASK, ¤t_mode_set ); |
|
1322 | status = rtems_task_mode( initial_mode_set, RTEMS_PREEMPT_MASK, ¤t_mode_set ); | |
1310 | } |
|
1323 | } |
General Comments 0
You need to be logged in to leave comments.
Login now