@@ -1,268 +1,268 | |||||
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: Tue May 6 |
|
3 | # Generated by qmake (2.01a) (Qt 4.8.6) on: Tue May 6 15:49:26 2014 | |
4 | # Project: fsw-qt.pro |
|
4 | # Project: fsw-qt.pro | |
5 | # Template: app |
|
5 | # Template: app | |
6 | # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro |
|
6 | # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro | |
7 | ############################################################################# |
|
7 | ############################################################################# | |
8 |
|
8 | |||
9 | ####### Compiler, tools and options |
|
9 | ####### Compiler, tools and options | |
10 |
|
10 | |||
11 | CC = sparc-rtems-gcc |
|
11 | CC = sparc-rtems-gcc | |
12 | CXX = sparc-rtems-g++ |
|
12 | CXX = sparc-rtems-g++ | |
13 | DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=7 -DPRINT_MESSAGES_ON_CONSOLE -DPRINT_TASK_STATISTICS |
|
13 | DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=7 -DPRINT_MESSAGES_ON_CONSOLE -DPRINT_TASK_STATISTICS | |
14 | CFLAGS = -pipe -O3 -Wall $(DEFINES) |
|
14 | CFLAGS = -pipe -O3 -Wall $(DEFINES) | |
15 | CXXFLAGS = -pipe -O3 -Wall $(DEFINES) |
|
15 | CXXFLAGS = -pipe -O3 -Wall $(DEFINES) | |
16 | INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header -I../header/processing -I../src/basic_parameters |
|
16 | INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header -I../header/processing -I../src/basic_parameters | |
17 | LINK = sparc-rtems-g++ |
|
17 | LINK = sparc-rtems-g++ | |
18 | LFLAGS = |
|
18 | LFLAGS = | |
19 | LIBS = $(SUBLIBS) |
|
19 | LIBS = $(SUBLIBS) | |
20 | AR = sparc-rtems-ar rcs |
|
20 | AR = sparc-rtems-ar rcs | |
21 | RANLIB = |
|
21 | RANLIB = | |
22 | QMAKE = /usr/bin/qmake-qt4 |
|
22 | QMAKE = /usr/bin/qmake-qt4 | |
23 | TAR = tar -cf |
|
23 | TAR = tar -cf | |
24 | COMPRESS = gzip -9f |
|
24 | COMPRESS = gzip -9f | |
25 | COPY = cp -f |
|
25 | COPY = cp -f | |
26 | SED = sed |
|
26 | SED = sed | |
27 | COPY_FILE = $(COPY) |
|
27 | COPY_FILE = $(COPY) | |
28 | COPY_DIR = $(COPY) -r |
|
28 | COPY_DIR = $(COPY) -r | |
29 | STRIP = sparc-rtems-strip |
|
29 | STRIP = sparc-rtems-strip | |
30 | INSTALL_FILE = install -m 644 -p |
|
30 | INSTALL_FILE = install -m 644 -p | |
31 | INSTALL_DIR = $(COPY_DIR) |
|
31 | INSTALL_DIR = $(COPY_DIR) | |
32 | INSTALL_PROGRAM = install -m 755 -p |
|
32 | INSTALL_PROGRAM = install -m 755 -p | |
33 | DEL_FILE = rm -f |
|
33 | DEL_FILE = rm -f | |
34 | SYMLINK = ln -f -s |
|
34 | SYMLINK = ln -f -s | |
35 | DEL_DIR = rmdir |
|
35 | DEL_DIR = rmdir | |
36 | MOVE = mv -f |
|
36 | MOVE = mv -f | |
37 | CHK_DIR_EXISTS= test -d |
|
37 | CHK_DIR_EXISTS= test -d | |
38 | MKDIR = mkdir -p |
|
38 | MKDIR = mkdir -p | |
39 |
|
39 | |||
40 | ####### Output directory |
|
40 | ####### Output directory | |
41 |
|
41 | |||
42 | OBJECTS_DIR = obj/ |
|
42 | OBJECTS_DIR = obj/ | |
43 |
|
43 | |||
44 | ####### Files |
|
44 | ####### Files | |
45 |
|
45 | |||
46 | SOURCES = ../src/wf_handler.c \ |
|
46 | SOURCES = ../src/wf_handler.c \ | |
47 | ../src/tc_handler.c \ |
|
47 | ../src/tc_handler.c \ | |
48 | ../src/fsw_misc.c \ |
|
48 | ../src/fsw_misc.c \ | |
49 | ../src/fsw_init.c \ |
|
49 | ../src/fsw_init.c \ | |
50 | ../src/fsw_globals.c \ |
|
50 | ../src/fsw_globals.c \ | |
51 | ../src/fsw_spacewire.c \ |
|
51 | ../src/fsw_spacewire.c \ | |
52 | ../src/tc_load_dump_parameters.c \ |
|
52 | ../src/tc_load_dump_parameters.c \ | |
53 | ../src/tm_lfr_tc_exe.c \ |
|
53 | ../src/tm_lfr_tc_exe.c \ | |
54 | ../src/tc_acceptance.c \ |
|
54 | ../src/tc_acceptance.c \ | |
55 | ../src/basic_parameters/basic_parameters.c \ |
|
55 | ../src/basic_parameters/basic_parameters.c \ | |
56 | ../src/processing/fsw_processing.c \ |
|
56 | ../src/processing/fsw_processing.c \ | |
57 | ../src/processing/avf0_prc0.c \ |
|
57 | ../src/processing/avf0_prc0.c \ | |
58 | ../src/processing/avf1_prc1.c \ |
|
58 | ../src/processing/avf1_prc1.c \ | |
59 | ../src/processing/avf2_prc2.c |
|
59 | ../src/processing/avf2_prc2.c | |
60 | OBJECTS = obj/wf_handler.o \ |
|
60 | OBJECTS = obj/wf_handler.o \ | |
61 | obj/tc_handler.o \ |
|
61 | obj/tc_handler.o \ | |
62 | obj/fsw_misc.o \ |
|
62 | obj/fsw_misc.o \ | |
63 | obj/fsw_init.o \ |
|
63 | obj/fsw_init.o \ | |
64 | obj/fsw_globals.o \ |
|
64 | obj/fsw_globals.o \ | |
65 | obj/fsw_spacewire.o \ |
|
65 | obj/fsw_spacewire.o \ | |
66 | obj/tc_load_dump_parameters.o \ |
|
66 | obj/tc_load_dump_parameters.o \ | |
67 | obj/tm_lfr_tc_exe.o \ |
|
67 | obj/tm_lfr_tc_exe.o \ | |
68 | obj/tc_acceptance.o \ |
|
68 | obj/tc_acceptance.o \ | |
69 | obj/basic_parameters.o \ |
|
69 | obj/basic_parameters.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 | DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \ |
|
74 | DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \ | |
75 | /usr/lib64/qt4/mkspecs/common/linux.conf \ |
|
75 | /usr/lib64/qt4/mkspecs/common/linux.conf \ | |
76 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ |
|
76 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ | |
77 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ |
|
77 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ | |
78 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ |
|
78 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ | |
79 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ |
|
79 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ | |
80 | /usr/lib64/qt4/mkspecs/qconfig.pri \ |
|
80 | /usr/lib64/qt4/mkspecs/qconfig.pri \ | |
81 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ |
|
81 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ | |
82 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ |
|
82 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ | |
83 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ |
|
83 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ | |
84 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ |
|
84 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ | |
85 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ |
|
85 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ | |
86 | sparc.pri \ |
|
86 | sparc.pri \ | |
87 | /usr/lib64/qt4/mkspecs/features/release.prf \ |
|
87 | /usr/lib64/qt4/mkspecs/features/release.prf \ | |
88 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ |
|
88 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ | |
89 | /usr/lib64/qt4/mkspecs/features/shared.prf \ |
|
89 | /usr/lib64/qt4/mkspecs/features/shared.prf \ | |
90 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ |
|
90 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ | |
91 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ |
|
91 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ | |
92 | /usr/lib64/qt4/mkspecs/features/resources.prf \ |
|
92 | /usr/lib64/qt4/mkspecs/features/resources.prf \ | |
93 | /usr/lib64/qt4/mkspecs/features/uic.prf \ |
|
93 | /usr/lib64/qt4/mkspecs/features/uic.prf \ | |
94 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ |
|
94 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ | |
95 | /usr/lib64/qt4/mkspecs/features/lex.prf \ |
|
95 | /usr/lib64/qt4/mkspecs/features/lex.prf \ | |
96 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \ |
|
96 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \ | |
97 | fsw-qt.pro |
|
97 | fsw-qt.pro | |
98 | QMAKE_TARGET = fsw |
|
98 | QMAKE_TARGET = fsw | |
99 | DESTDIR = bin/ |
|
99 | DESTDIR = bin/ | |
100 | TARGET = bin/fsw |
|
100 | TARGET = bin/fsw | |
101 |
|
101 | |||
102 | first: all |
|
102 | first: all | |
103 | ####### Implicit rules |
|
103 | ####### Implicit rules | |
104 |
|
104 | |||
105 | .SUFFIXES: .o .c .cpp .cc .cxx .C |
|
105 | .SUFFIXES: .o .c .cpp .cc .cxx .C | |
106 |
|
106 | |||
107 | .cpp.o: |
|
107 | .cpp.o: | |
108 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
108 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" | |
109 |
|
109 | |||
110 | .cc.o: |
|
110 | .cc.o: | |
111 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
111 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" | |
112 |
|
112 | |||
113 | .cxx.o: |
|
113 | .cxx.o: | |
114 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
114 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" | |
115 |
|
115 | |||
116 | .C.o: |
|
116 | .C.o: | |
117 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
117 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" | |
118 |
|
118 | |||
119 | .c.o: |
|
119 | .c.o: | |
120 | $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<" |
|
120 | $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<" | |
121 |
|
121 | |||
122 | ####### Build rules |
|
122 | ####### Build rules | |
123 |
|
123 | |||
124 | all: Makefile $(TARGET) |
|
124 | all: Makefile $(TARGET) | |
125 |
|
125 | |||
126 | $(TARGET): $(OBJECTS) |
|
126 | $(TARGET): $(OBJECTS) | |
127 | @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/ |
|
127 | @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/ | |
128 | $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) |
|
128 | $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) | |
129 |
|
129 | |||
130 | Makefile: fsw-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \ |
|
130 | Makefile: fsw-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \ | |
131 | /usr/lib64/qt4/mkspecs/common/linux.conf \ |
|
131 | /usr/lib64/qt4/mkspecs/common/linux.conf \ | |
132 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ |
|
132 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ | |
133 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ |
|
133 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ | |
134 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ |
|
134 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ | |
135 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ |
|
135 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ | |
136 | /usr/lib64/qt4/mkspecs/qconfig.pri \ |
|
136 | /usr/lib64/qt4/mkspecs/qconfig.pri \ | |
137 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ |
|
137 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ | |
138 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ |
|
138 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ | |
139 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ |
|
139 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ | |
140 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ |
|
140 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ | |
141 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ |
|
141 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ | |
142 | sparc.pri \ |
|
142 | sparc.pri \ | |
143 | /usr/lib64/qt4/mkspecs/features/release.prf \ |
|
143 | /usr/lib64/qt4/mkspecs/features/release.prf \ | |
144 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ |
|
144 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ | |
145 | /usr/lib64/qt4/mkspecs/features/shared.prf \ |
|
145 | /usr/lib64/qt4/mkspecs/features/shared.prf \ | |
146 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ |
|
146 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ | |
147 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ |
|
147 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ | |
148 | /usr/lib64/qt4/mkspecs/features/resources.prf \ |
|
148 | /usr/lib64/qt4/mkspecs/features/resources.prf \ | |
149 | /usr/lib64/qt4/mkspecs/features/uic.prf \ |
|
149 | /usr/lib64/qt4/mkspecs/features/uic.prf \ | |
150 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ |
|
150 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ | |
151 | /usr/lib64/qt4/mkspecs/features/lex.prf \ |
|
151 | /usr/lib64/qt4/mkspecs/features/lex.prf \ | |
152 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf |
|
152 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf | |
153 | $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro |
|
153 | $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro | |
154 | /usr/lib64/qt4/mkspecs/common/unix.conf: |
|
154 | /usr/lib64/qt4/mkspecs/common/unix.conf: | |
155 | /usr/lib64/qt4/mkspecs/common/linux.conf: |
|
155 | /usr/lib64/qt4/mkspecs/common/linux.conf: | |
156 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf: |
|
156 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf: | |
157 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf: |
|
157 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf: | |
158 | /usr/lib64/qt4/mkspecs/common/g++-base.conf: |
|
158 | /usr/lib64/qt4/mkspecs/common/g++-base.conf: | |
159 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf: |
|
159 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf: | |
160 | /usr/lib64/qt4/mkspecs/qconfig.pri: |
|
160 | /usr/lib64/qt4/mkspecs/qconfig.pri: | |
161 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri: |
|
161 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri: | |
162 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf: |
|
162 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf: | |
163 | /usr/lib64/qt4/mkspecs/features/qt_config.prf: |
|
163 | /usr/lib64/qt4/mkspecs/features/qt_config.prf: | |
164 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf: |
|
164 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf: | |
165 | /usr/lib64/qt4/mkspecs/features/default_pre.prf: |
|
165 | /usr/lib64/qt4/mkspecs/features/default_pre.prf: | |
166 | sparc.pri: |
|
166 | sparc.pri: | |
167 | /usr/lib64/qt4/mkspecs/features/release.prf: |
|
167 | /usr/lib64/qt4/mkspecs/features/release.prf: | |
168 | /usr/lib64/qt4/mkspecs/features/default_post.prf: |
|
168 | /usr/lib64/qt4/mkspecs/features/default_post.prf: | |
169 | /usr/lib64/qt4/mkspecs/features/shared.prf: |
|
169 | /usr/lib64/qt4/mkspecs/features/shared.prf: | |
170 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf: |
|
170 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf: | |
171 | /usr/lib64/qt4/mkspecs/features/warn_on.prf: |
|
171 | /usr/lib64/qt4/mkspecs/features/warn_on.prf: | |
172 | /usr/lib64/qt4/mkspecs/features/resources.prf: |
|
172 | /usr/lib64/qt4/mkspecs/features/resources.prf: | |
173 | /usr/lib64/qt4/mkspecs/features/uic.prf: |
|
173 | /usr/lib64/qt4/mkspecs/features/uic.prf: | |
174 | /usr/lib64/qt4/mkspecs/features/yacc.prf: |
|
174 | /usr/lib64/qt4/mkspecs/features/yacc.prf: | |
175 | /usr/lib64/qt4/mkspecs/features/lex.prf: |
|
175 | /usr/lib64/qt4/mkspecs/features/lex.prf: | |
176 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf: |
|
176 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf: | |
177 | qmake: FORCE |
|
177 | qmake: FORCE | |
178 | @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro |
|
178 | @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro | |
179 |
|
179 | |||
180 | dist: |
|
180 | dist: | |
181 | @$(CHK_DIR_EXISTS) obj/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0 |
|
181 | @$(CHK_DIR_EXISTS) obj/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0 | |
182 | $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/fsw1.0.0/ && (cd `dirname obj/fsw1.0.0` && $(TAR) fsw1.0.0.tar fsw1.0.0 && $(COMPRESS) fsw1.0.0.tar) && $(MOVE) `dirname obj/fsw1.0.0`/fsw1.0.0.tar.gz . && $(DEL_FILE) -r obj/fsw1.0.0 |
|
182 | $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/fsw1.0.0/ && (cd `dirname obj/fsw1.0.0` && $(TAR) fsw1.0.0.tar fsw1.0.0 && $(COMPRESS) fsw1.0.0.tar) && $(MOVE) `dirname obj/fsw1.0.0`/fsw1.0.0.tar.gz . && $(DEL_FILE) -r obj/fsw1.0.0 | |
183 |
|
183 | |||
184 |
|
184 | |||
185 | clean:compiler_clean |
|
185 | clean:compiler_clean | |
186 | -$(DEL_FILE) $(OBJECTS) |
|
186 | -$(DEL_FILE) $(OBJECTS) | |
187 | -$(DEL_FILE) *~ core *.core |
|
187 | -$(DEL_FILE) *~ core *.core | |
188 |
|
188 | |||
189 |
|
189 | |||
190 | ####### Sub-libraries |
|
190 | ####### Sub-libraries | |
191 |
|
191 | |||
192 | distclean: clean |
|
192 | distclean: clean | |
193 | -$(DEL_FILE) $(TARGET) |
|
193 | -$(DEL_FILE) $(TARGET) | |
194 | -$(DEL_FILE) Makefile |
|
194 | -$(DEL_FILE) Makefile | |
195 |
|
195 | |||
196 |
|
196 | |||
197 | grmon: |
|
197 | grmon: | |
198 | cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u |
|
198 | cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u | |
199 |
|
199 | |||
200 | check: first |
|
200 | check: first | |
201 |
|
201 | |||
202 | compiler_rcc_make_all: |
|
202 | compiler_rcc_make_all: | |
203 | compiler_rcc_clean: |
|
203 | compiler_rcc_clean: | |
204 | compiler_uic_make_all: |
|
204 | compiler_uic_make_all: | |
205 | compiler_uic_clean: |
|
205 | compiler_uic_clean: | |
206 | compiler_image_collection_make_all: qmake_image_collection.cpp |
|
206 | compiler_image_collection_make_all: qmake_image_collection.cpp | |
207 | compiler_image_collection_clean: |
|
207 | compiler_image_collection_clean: | |
208 | -$(DEL_FILE) qmake_image_collection.cpp |
|
208 | -$(DEL_FILE) qmake_image_collection.cpp | |
209 | compiler_yacc_decl_make_all: |
|
209 | compiler_yacc_decl_make_all: | |
210 | compiler_yacc_decl_clean: |
|
210 | compiler_yacc_decl_clean: | |
211 | compiler_yacc_impl_make_all: |
|
211 | compiler_yacc_impl_make_all: | |
212 | compiler_yacc_impl_clean: |
|
212 | compiler_yacc_impl_clean: | |
213 | compiler_lex_make_all: |
|
213 | compiler_lex_make_all: | |
214 | compiler_lex_clean: |
|
214 | compiler_lex_clean: | |
215 | compiler_clean: |
|
215 | compiler_clean: | |
216 |
|
216 | |||
217 | ####### Compile |
|
217 | ####### Compile | |
218 |
|
218 | |||
219 | obj/wf_handler.o: ../src/wf_handler.c |
|
219 | obj/wf_handler.o: ../src/wf_handler.c | |
220 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/wf_handler.o ../src/wf_handler.c |
|
220 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/wf_handler.o ../src/wf_handler.c | |
221 |
|
221 | |||
222 | obj/tc_handler.o: ../src/tc_handler.c |
|
222 | obj/tc_handler.o: ../src/tc_handler.c | |
223 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o ../src/tc_handler.c |
|
223 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o ../src/tc_handler.c | |
224 |
|
224 | |||
225 | obj/fsw_misc.o: ../src/fsw_misc.c |
|
225 | obj/fsw_misc.o: ../src/fsw_misc.c | |
226 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c |
|
226 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c | |
227 |
|
227 | |||
228 | obj/fsw_init.o: ../src/fsw_init.c ../src/fsw_config.c |
|
228 | obj/fsw_init.o: ../src/fsw_init.c ../src/fsw_config.c | |
229 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o ../src/fsw_init.c |
|
229 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o ../src/fsw_init.c | |
230 |
|
230 | |||
231 | obj/fsw_globals.o: ../src/fsw_globals.c |
|
231 | obj/fsw_globals.o: ../src/fsw_globals.c | |
232 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c |
|
232 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c | |
233 |
|
233 | |||
234 | obj/fsw_spacewire.o: ../src/fsw_spacewire.c |
|
234 | obj/fsw_spacewire.o: ../src/fsw_spacewire.c | |
235 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spacewire.o ../src/fsw_spacewire.c |
|
235 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spacewire.o ../src/fsw_spacewire.c | |
236 |
|
236 | |||
237 | obj/tc_load_dump_parameters.o: ../src/tc_load_dump_parameters.c |
|
237 | obj/tc_load_dump_parameters.o: ../src/tc_load_dump_parameters.c | |
238 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_load_dump_parameters.o ../src/tc_load_dump_parameters.c |
|
238 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_load_dump_parameters.o ../src/tc_load_dump_parameters.c | |
239 |
|
239 | |||
240 | obj/tm_lfr_tc_exe.o: ../src/tm_lfr_tc_exe.c |
|
240 | obj/tm_lfr_tc_exe.o: ../src/tm_lfr_tc_exe.c | |
241 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tm_lfr_tc_exe.o ../src/tm_lfr_tc_exe.c |
|
241 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tm_lfr_tc_exe.o ../src/tm_lfr_tc_exe.c | |
242 |
|
242 | |||
243 | obj/tc_acceptance.o: ../src/tc_acceptance.c |
|
243 | obj/tc_acceptance.o: ../src/tc_acceptance.c | |
244 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_acceptance.o ../src/tc_acceptance.c |
|
244 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_acceptance.o ../src/tc_acceptance.c | |
245 |
|
245 | |||
246 | obj/basic_parameters.o: ../src/basic_parameters/basic_parameters.c ../src/basic_parameters/basic_parameters.h |
|
246 | obj/basic_parameters.o: ../src/basic_parameters/basic_parameters.c ../src/basic_parameters/basic_parameters.h | |
247 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/basic_parameters.o ../src/basic_parameters/basic_parameters.c |
|
247 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/basic_parameters.o ../src/basic_parameters/basic_parameters.c | |
248 |
|
248 | |||
249 | obj/fsw_processing.o: ../src/processing/fsw_processing.c |
|
249 | obj/fsw_processing.o: ../src/processing/fsw_processing.c | |
250 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/processing/fsw_processing.c |
|
250 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/processing/fsw_processing.c | |
251 |
|
251 | |||
252 | obj/avf0_prc0.o: ../src/processing/avf0_prc0.c |
|
252 | obj/avf0_prc0.o: ../src/processing/avf0_prc0.c | |
253 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf0_prc0.o ../src/processing/avf0_prc0.c |
|
253 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf0_prc0.o ../src/processing/avf0_prc0.c | |
254 |
|
254 | |||
255 | obj/avf1_prc1.o: ../src/processing/avf1_prc1.c |
|
255 | obj/avf1_prc1.o: ../src/processing/avf1_prc1.c | |
256 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf1_prc1.o ../src/processing/avf1_prc1.c |
|
256 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf1_prc1.o ../src/processing/avf1_prc1.c | |
257 |
|
257 | |||
258 | obj/avf2_prc2.o: ../src/processing/avf2_prc2.c |
|
258 | obj/avf2_prc2.o: ../src/processing/avf2_prc2.c | |
259 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf2_prc2.o ../src/processing/avf2_prc2.c |
|
259 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf2_prc2.o ../src/processing/avf2_prc2.c | |
260 |
|
260 | |||
261 | ####### Install |
|
261 | ####### Install | |
262 |
|
262 | |||
263 | install: FORCE |
|
263 | install: FORCE | |
264 |
|
264 | |||
265 | uninstall: FORCE |
|
265 | uninstall: FORCE | |
266 |
|
266 | |||
267 | FORCE: |
|
267 | FORCE: | |
268 |
|
268 |
@@ -1,201 +1,201 | |||||
1 | <?xml version="1.0" encoding="UTF-8"?> |
|
1 | <?xml version="1.0" encoding="UTF-8"?> | |
2 | <!DOCTYPE QtCreatorProject> |
|
2 | <!DOCTYPE QtCreatorProject> | |
3 |
<!-- Written by QtCreator 3.0.1, 2014-05- |
|
3 | <!-- Written by QtCreator 3.0.1, 2014-05-12T06:56:36. --> | |
4 | <qtcreator> |
|
4 | <qtcreator> | |
5 | <data> |
|
5 | <data> | |
6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
|
6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> | |
7 | <value type="int">0</value> |
|
7 | <value type="int">0</value> | |
8 | </data> |
|
8 | </data> | |
9 | <data> |
|
9 | <data> | |
10 | <variable>ProjectExplorer.Project.EditorSettings</variable> |
|
10 | <variable>ProjectExplorer.Project.EditorSettings</variable> | |
11 | <valuemap type="QVariantMap"> |
|
11 | <valuemap type="QVariantMap"> | |
12 | <value type="bool" key="EditorConfiguration.AutoIndent">true</value> |
|
12 | <value type="bool" key="EditorConfiguration.AutoIndent">true</value> | |
13 | <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value> |
|
13 | <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value> | |
14 | <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value> |
|
14 | <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value> | |
15 | <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0"> |
|
15 | <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0"> | |
16 | <value type="QString" key="language">Cpp</value> |
|
16 | <value type="QString" key="language">Cpp</value> | |
17 | <valuemap type="QVariantMap" key="value"> |
|
17 | <valuemap type="QVariantMap" key="value"> | |
18 | <value type="QByteArray" key="CurrentPreferences">CppGlobal</value> |
|
18 | <value type="QByteArray" key="CurrentPreferences">CppGlobal</value> | |
19 | </valuemap> |
|
19 | </valuemap> | |
20 | </valuemap> |
|
20 | </valuemap> | |
21 | <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1"> |
|
21 | <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1"> | |
22 | <value type="QString" key="language">QmlJS</value> |
|
22 | <value type="QString" key="language">QmlJS</value> | |
23 | <valuemap type="QVariantMap" key="value"> |
|
23 | <valuemap type="QVariantMap" key="value"> | |
24 | <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value> |
|
24 | <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value> | |
25 | </valuemap> |
|
25 | </valuemap> | |
26 | </valuemap> |
|
26 | </valuemap> | |
27 | <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value> |
|
27 | <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value> | |
28 | <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value> |
|
28 | <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value> | |
29 | <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value> |
|
29 | <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value> | |
30 | <value type="int" key="EditorConfiguration.IndentSize">4</value> |
|
30 | <value type="int" key="EditorConfiguration.IndentSize">4</value> | |
31 | <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value> |
|
31 | <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value> | |
32 | <value type="bool" key="EditorConfiguration.MouseNavigation">true</value> |
|
32 | <value type="bool" key="EditorConfiguration.MouseNavigation">true</value> | |
33 | <value type="int" key="EditorConfiguration.PaddingMode">1</value> |
|
33 | <value type="int" key="EditorConfiguration.PaddingMode">1</value> | |
34 | <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value> |
|
34 | <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value> | |
35 | <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value> |
|
35 | <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value> | |
36 | <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value> |
|
36 | <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value> | |
37 | <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value> |
|
37 | <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value> | |
38 | <value type="int" key="EditorConfiguration.TabSize">8</value> |
|
38 | <value type="int" key="EditorConfiguration.TabSize">8</value> | |
39 | <value type="bool" key="EditorConfiguration.UseGlobal">true</value> |
|
39 | <value type="bool" key="EditorConfiguration.UseGlobal">true</value> | |
40 | <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value> |
|
40 | <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value> | |
41 | <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value> |
|
41 | <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value> | |
42 | <value type="bool" key="EditorConfiguration.cleanIndentation">true</value> |
|
42 | <value type="bool" key="EditorConfiguration.cleanIndentation">true</value> | |
43 | <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value> |
|
43 | <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value> | |
44 | <value type="bool" key="EditorConfiguration.inEntireDocument">false</value> |
|
44 | <value type="bool" key="EditorConfiguration.inEntireDocument">false</value> | |
45 | </valuemap> |
|
45 | </valuemap> | |
46 | </data> |
|
46 | </data> | |
47 | <data> |
|
47 | <data> | |
48 | <variable>ProjectExplorer.Project.PluginSettings</variable> |
|
48 | <variable>ProjectExplorer.Project.PluginSettings</variable> | |
49 | <valuemap type="QVariantMap"/> |
|
49 | <valuemap type="QVariantMap"/> | |
50 | </data> |
|
50 | </data> | |
51 | <data> |
|
51 | <data> | |
52 | <variable>ProjectExplorer.Project.Target.0</variable> |
|
52 | <variable>ProjectExplorer.Project.Target.0</variable> | |
53 | <valuemap type="QVariantMap"> |
|
53 | <valuemap type="QVariantMap"> | |
54 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.2 in PATH (System)</value> |
|
54 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.2 in PATH (System)</value> | |
55 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.2 in PATH (System)</value> |
|
55 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.2 in PATH (System)</value> | |
56 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{5289e843-9ef2-45ce-88c6-ad27d8e08def}</value> |
|
56 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{5289e843-9ef2-45ce-88c6-ad27d8e08def}</value> | |
57 | <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value> |
|
57 | <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value> | |
58 | <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> |
|
58 | <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> | |
59 | <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> |
|
59 | <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> | |
60 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> |
|
60 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> | |
61 | <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory"></value> |
|
61 | <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory"></value> | |
62 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|
62 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> | |
63 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
63 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> | |
64 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
64 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> | |
65 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> |
|
65 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> | |
66 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
66 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
67 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> |
|
67 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> | |
68 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> |
|
68 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> | |
69 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value> |
|
69 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value> | |
70 | <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> |
|
70 | <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> | |
71 | <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> |
|
71 | <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> | |
72 | </valuemap> |
|
72 | </valuemap> | |
73 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> |
|
73 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> | |
74 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
74 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> | |
75 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
75 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> | |
76 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
76 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
77 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
77 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> | |
78 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
78 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> | |
79 | <value type="QString">-w</value> |
|
79 | <value type="QString">-w</value> | |
80 | <value type="QString">-r</value> |
|
80 | <value type="QString">-r</value> | |
81 | </valuelist> |
|
81 | </valuelist> | |
82 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> |
|
82 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> | |
83 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> |
|
83 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> | |
84 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
84 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> | |
85 | </valuemap> |
|
85 | </valuemap> | |
86 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> |
|
86 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> | |
87 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> |
|
87 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> | |
88 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
88 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
89 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> |
|
89 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> | |
90 | </valuemap> |
|
90 | </valuemap> | |
91 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> |
|
91 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> | |
92 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
92 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> | |
93 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
93 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> | |
94 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
94 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> | |
95 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
95 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
96 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
96 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> | |
97 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
97 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> | |
98 | <value type="QString">-w</value> |
|
98 | <value type="QString">-w</value> | |
99 | <value type="QString">-r</value> |
|
99 | <value type="QString">-r</value> | |
100 | </valuelist> |
|
100 | </valuelist> | |
101 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> |
|
101 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> | |
102 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> |
|
102 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> | |
103 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
103 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> | |
104 | </valuemap> |
|
104 | </valuemap> | |
105 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> |
|
105 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> | |
106 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> |
|
106 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> | |
107 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
107 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
108 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> |
|
108 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> | |
109 | </valuemap> |
|
109 | </valuemap> | |
110 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> |
|
110 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> | |
111 | <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> |
|
111 | <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> | |
112 | <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> |
|
112 | <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> | |
113 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value> |
|
113 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value> | |
114 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
114 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
115 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> |
|
115 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> | |
116 | <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> |
|
116 | <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> | |
117 | <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> |
|
117 | <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> | |
118 | </valuemap> |
|
118 | </valuemap> | |
119 | <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value> |
|
119 | <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value> | |
120 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0"> |
|
120 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0"> | |
121 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|
121 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> | |
122 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value> |
|
122 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value> | |
123 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value> |
|
123 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value> | |
124 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
124 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
125 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value> |
|
125 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value> | |
126 | </valuemap> |
|
126 | </valuemap> | |
127 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value> |
|
127 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value> | |
128 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value> |
|
128 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value> | |
129 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
129 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
130 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value> |
|
130 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value> | |
131 | </valuemap> |
|
131 | </valuemap> | |
132 | <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> |
|
132 | <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> | |
133 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/> |
|
133 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/> | |
134 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> |
|
134 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> | |
135 | <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> |
|
135 | <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> | |
136 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> |
|
136 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> | |
137 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> |
|
137 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> | |
138 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> |
|
138 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> | |
139 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> |
|
139 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> | |
140 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> |
|
140 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> | |
141 | <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> |
|
141 | <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> | |
142 | <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> |
|
142 | <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> | |
143 | <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> |
|
143 | <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> | |
144 | <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value> |
|
144 | <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value> | |
145 | <value type="int" key="Analyzer.Valgrind.NumCallers">25</value> |
|
145 | <value type="int" key="Analyzer.Valgrind.NumCallers">25</value> | |
146 | <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> |
|
146 | <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> | |
147 | <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value> |
|
147 | <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value> | |
148 | <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value> |
|
148 | <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value> | |
149 | <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value> |
|
149 | <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value> | |
150 | <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> |
|
150 | <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> | |
151 | <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> |
|
151 | <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> | |
152 | <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> |
|
152 | <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> | |
153 | <value type="int">0</value> |
|
153 | <value type="int">0</value> | |
154 | <value type="int">1</value> |
|
154 | <value type="int">1</value> | |
155 | <value type="int">2</value> |
|
155 | <value type="int">2</value> | |
156 | <value type="int">3</value> |
|
156 | <value type="int">3</value> | |
157 | <value type="int">4</value> |
|
157 | <value type="int">4</value> | |
158 | <value type="int">5</value> |
|
158 | <value type="int">5</value> | |
159 | <value type="int">6</value> |
|
159 | <value type="int">6</value> | |
160 | <value type="int">7</value> |
|
160 | <value type="int">7</value> | |
161 | <value type="int">8</value> |
|
161 | <value type="int">8</value> | |
162 | <value type="int">9</value> |
|
162 | <value type="int">9</value> | |
163 | <value type="int">10</value> |
|
163 | <value type="int">10</value> | |
164 | <value type="int">11</value> |
|
164 | <value type="int">11</value> | |
165 | <value type="int">12</value> |
|
165 | <value type="int">12</value> | |
166 | <value type="int">13</value> |
|
166 | <value type="int">13</value> | |
167 | <value type="int">14</value> |
|
167 | <value type="int">14</value> | |
168 | </valuelist> |
|
168 | </valuelist> | |
169 | <value type="int" key="PE.EnvironmentAspect.Base">2</value> |
|
169 | <value type="int" key="PE.EnvironmentAspect.Base">2</value> | |
170 | <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> |
|
170 | <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> | |
171 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value> |
|
171 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value> | |
172 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
172 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
173 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value> |
|
173 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value> | |
174 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value> |
|
174 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value> | |
175 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value> |
|
175 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value> | |
176 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value> |
|
176 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value> | |
177 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value> |
|
177 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value> | |
178 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value> |
|
178 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value> | |
179 | <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> |
|
179 | <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> | |
180 | <value type="bool" key="RunConfiguration.UseCppDebugger">true</value> |
|
180 | <value type="bool" key="RunConfiguration.UseCppDebugger">true</value> | |
181 | <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value> |
|
181 | <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value> | |
182 | <value type="bool" key="RunConfiguration.UseMultiProcess">false</value> |
|
182 | <value type="bool" key="RunConfiguration.UseMultiProcess">false</value> | |
183 | <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> |
|
183 | <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> | |
184 | <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> |
|
184 | <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> | |
185 | </valuemap> |
|
185 | </valuemap> | |
186 | <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value> |
|
186 | <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value> | |
187 | </valuemap> |
|
187 | </valuemap> | |
188 | </data> |
|
188 | </data> | |
189 | <data> |
|
189 | <data> | |
190 | <variable>ProjectExplorer.Project.TargetCount</variable> |
|
190 | <variable>ProjectExplorer.Project.TargetCount</variable> | |
191 | <value type="int">1</value> |
|
191 | <value type="int">1</value> | |
192 | </data> |
|
192 | </data> | |
193 | <data> |
|
193 | <data> | |
194 | <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable> |
|
194 | <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable> | |
195 | <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value> |
|
195 | <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value> | |
196 | </data> |
|
196 | </data> | |
197 | <data> |
|
197 | <data> | |
198 | <variable>ProjectExplorer.Project.Updater.FileVersion</variable> |
|
198 | <variable>ProjectExplorer.Project.Updater.FileVersion</variable> | |
199 | <value type="int">15</value> |
|
199 | <value type="int">15</value> | |
200 | </data> |
|
200 | </data> | |
201 | </qtcreator> |
|
201 | </qtcreator> |
@@ -1,501 +1,503 | |||||
1 | /** General usage functions and RTEMS tasks. |
|
1 | /** General usage functions and RTEMS tasks. | |
2 | * |
|
2 | * | |
3 | * @file |
|
3 | * @file | |
4 | * @author P. LEROY |
|
4 | * @author P. LEROY | |
5 | * |
|
5 | * | |
6 | */ |
|
6 | */ | |
7 |
|
7 | |||
8 | #include "fsw_misc.h" |
|
8 | #include "fsw_misc.h" | |
9 |
|
9 | |||
10 | void configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider, |
|
10 | void configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider, | |
11 | unsigned char interrupt_level, rtems_isr (*timer_isr)() ) |
|
11 | unsigned char interrupt_level, rtems_isr (*timer_isr)() ) | |
12 | { |
|
12 | { | |
13 | /** This function configures a GPTIMER timer instantiated in the VHDL design. |
|
13 | /** This function configures a GPTIMER timer instantiated in the VHDL design. | |
14 | * |
|
14 | * | |
15 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. |
|
15 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. | |
16 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). |
|
16 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). | |
17 | * @param clock_divider is the divider of the 1 MHz clock that will be configured. |
|
17 | * @param clock_divider is the divider of the 1 MHz clock that will be configured. | |
18 | * @param interrupt_level is the interrupt level that the timer drives. |
|
18 | * @param interrupt_level is the interrupt level that the timer drives. | |
19 | * @param timer_isr is the interrupt subroutine that will be attached to the IRQ driven by the timer. |
|
19 | * @param timer_isr is the interrupt subroutine that will be attached to the IRQ driven by the timer. | |
20 | * |
|
20 | * | |
21 | * Interrupt levels are described in the SPARC documentation sparcv8.pdf p.76 |
|
21 | * Interrupt levels are described in the SPARC documentation sparcv8.pdf p.76 | |
22 | * |
|
22 | * | |
23 | */ |
|
23 | */ | |
24 |
|
24 | |||
25 | rtems_status_code status; |
|
25 | rtems_status_code status; | |
26 | rtems_isr_entry old_isr_handler; |
|
26 | rtems_isr_entry old_isr_handler; | |
27 |
|
27 | |||
28 | gptimer_regs->timer[timer].ctrl = 0x00; // reset the control register |
|
28 | gptimer_regs->timer[timer].ctrl = 0x00; // reset the control register | |
29 |
|
29 | |||
30 | status = rtems_interrupt_catch( timer_isr, interrupt_level, &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels |
|
30 | status = rtems_interrupt_catch( timer_isr, interrupt_level, &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels | |
31 | if (status!=RTEMS_SUCCESSFUL) |
|
31 | if (status!=RTEMS_SUCCESSFUL) | |
32 | { |
|
32 | { | |
33 | PRINTF("in configure_timer *** ERR rtems_interrupt_catch\n") |
|
33 | PRINTF("in configure_timer *** ERR rtems_interrupt_catch\n") | |
34 | } |
|
34 | } | |
35 |
|
35 | |||
36 | timer_set_clock_divider( gptimer_regs, timer, clock_divider); |
|
36 | timer_set_clock_divider( gptimer_regs, timer, clock_divider); | |
37 | } |
|
37 | } | |
38 |
|
38 | |||
39 | void timer_start(gptimer_regs_t *gptimer_regs, unsigned char timer) |
|
39 | void timer_start(gptimer_regs_t *gptimer_regs, unsigned char timer) | |
40 | { |
|
40 | { | |
41 | /** This function starts a GPTIMER timer. |
|
41 | /** This function starts a GPTIMER timer. | |
42 | * |
|
42 | * | |
43 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. |
|
43 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. | |
44 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). |
|
44 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). | |
45 | * |
|
45 | * | |
46 | */ |
|
46 | */ | |
47 |
|
47 | |||
48 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any |
|
48 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any | |
49 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000004; // LD load value from the reload register |
|
49 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000004; // LD load value from the reload register | |
50 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000001; // EN enable the timer |
|
50 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000001; // EN enable the timer | |
51 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000002; // RS restart |
|
51 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000002; // RS restart | |
52 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000008; // IE interrupt enable |
|
52 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000008; // IE interrupt enable | |
53 | } |
|
53 | } | |
54 |
|
54 | |||
55 | void timer_stop(gptimer_regs_t *gptimer_regs, unsigned char timer) |
|
55 | void timer_stop(gptimer_regs_t *gptimer_regs, unsigned char timer) | |
56 | { |
|
56 | { | |
57 | /** This function stops a GPTIMER timer. |
|
57 | /** This function stops a GPTIMER timer. | |
58 | * |
|
58 | * | |
59 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. |
|
59 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. | |
60 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). |
|
60 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). | |
61 | * |
|
61 | * | |
62 | */ |
|
62 | */ | |
63 |
|
63 | |||
64 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xfffffffe; // EN enable the timer |
|
64 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xfffffffe; // EN enable the timer | |
65 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xffffffef; // IE interrupt enable |
|
65 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xffffffef; // IE interrupt enable | |
66 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any |
|
66 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any | |
67 | } |
|
67 | } | |
68 |
|
68 | |||
69 | void timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider) |
|
69 | void timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider) | |
70 | { |
|
70 | { | |
71 | /** This function sets the clock divider of a GPTIMER timer. |
|
71 | /** This function sets the clock divider of a GPTIMER timer. | |
72 | * |
|
72 | * | |
73 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. |
|
73 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. | |
74 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). |
|
74 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). | |
75 | * @param clock_divider is the divider of the 1 MHz clock that will be configured. |
|
75 | * @param clock_divider is the divider of the 1 MHz clock that will be configured. | |
76 | * |
|
76 | * | |
77 | */ |
|
77 | */ | |
78 |
|
78 | |||
79 | gptimer_regs->timer[timer].reload = clock_divider; // base clock frequency is 1 MHz |
|
79 | gptimer_regs->timer[timer].reload = clock_divider; // base clock frequency is 1 MHz | |
80 | } |
|
80 | } | |
81 |
|
81 | |||
82 | int send_console_outputs_on_apbuart_port( void ) // Send the console outputs on the apbuart port |
|
82 | int send_console_outputs_on_apbuart_port( void ) // Send the console outputs on the apbuart port | |
83 | { |
|
83 | { | |
84 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART; |
|
84 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART; | |
85 |
|
85 | |||
86 | apbuart_regs->ctrl = APBUART_CTRL_REG_MASK_TE; |
|
86 | apbuart_regs->ctrl = APBUART_CTRL_REG_MASK_TE; | |
87 |
|
87 | |||
88 | return 0; |
|
88 | return 0; | |
89 | } |
|
89 | } | |
90 |
|
90 | |||
91 | int enable_apbuart_transmitter( void ) // set the bit 1, TE Transmitter Enable to 1 in the APBUART control register |
|
91 | int enable_apbuart_transmitter( void ) // set the bit 1, TE Transmitter Enable to 1 in the APBUART control register | |
92 | { |
|
92 | { | |
93 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART; |
|
93 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART; | |
94 |
|
94 | |||
95 | apbuart_regs->ctrl = apbuart_regs->ctrl | APBUART_CTRL_REG_MASK_TE; |
|
95 | apbuart_regs->ctrl = apbuart_regs->ctrl | APBUART_CTRL_REG_MASK_TE; | |
96 |
|
96 | |||
97 | return 0; |
|
97 | return 0; | |
98 | } |
|
98 | } | |
99 |
|
99 | |||
100 | void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value) |
|
100 | void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value) | |
101 | { |
|
101 | { | |
102 | /** This function sets the scaler reload register of the apbuart module |
|
102 | /** This function sets the scaler reload register of the apbuart module | |
103 | * |
|
103 | * | |
104 | * @param regs is the address of the apbuart registers in memory |
|
104 | * @param regs is the address of the apbuart registers in memory | |
105 | * @param value is the value that will be stored in the scaler register |
|
105 | * @param value is the value that will be stored in the scaler register | |
106 | * |
|
106 | * | |
107 | * The value shall be set by the software to get data on the serial interface. |
|
107 | * The value shall be set by the software to get data on the serial interface. | |
108 | * |
|
108 | * | |
109 | */ |
|
109 | */ | |
110 |
|
110 | |||
111 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) regs; |
|
111 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) regs; | |
112 |
|
112 | |||
113 | apbuart_regs->scaler = value; |
|
113 | apbuart_regs->scaler = value; | |
114 | BOOT_PRINTF1("OK *** apbuart port scaler reload register set to 0x%x\n", value) |
|
114 | BOOT_PRINTF1("OK *** apbuart port scaler reload register set to 0x%x\n", value) | |
115 | } |
|
115 | } | |
116 |
|
116 | |||
117 | //************ |
|
117 | //************ | |
118 | // RTEMS TASKS |
|
118 | // RTEMS TASKS | |
119 |
|
119 | |||
120 | rtems_task stat_task(rtems_task_argument argument) |
|
120 | rtems_task stat_task(rtems_task_argument argument) | |
121 | { |
|
121 | { | |
122 | int i; |
|
122 | int i; | |
123 | int j; |
|
123 | int j; | |
124 | i = 0; |
|
124 | i = 0; | |
125 | j = 0; |
|
125 | j = 0; | |
126 | BOOT_PRINTF("in STAT *** \n") |
|
126 | BOOT_PRINTF("in STAT *** \n") | |
127 | while(1){ |
|
127 | while(1){ | |
128 | rtems_task_wake_after(1000); |
|
128 | rtems_task_wake_after(1000); | |
129 | PRINTF1("%d\n", j) |
|
129 | PRINTF1("%d\n", j) | |
130 | if (i == CPU_USAGE_REPORT_PERIOD) { |
|
130 | if (i == CPU_USAGE_REPORT_PERIOD) { | |
131 | // #ifdef PRINT_TASK_STATISTICS |
|
131 | // #ifdef PRINT_TASK_STATISTICS | |
132 | // rtems_cpu_usage_report(); |
|
132 | // rtems_cpu_usage_report(); | |
133 | // rtems_cpu_usage_reset(); |
|
133 | // rtems_cpu_usage_reset(); | |
134 | // #endif |
|
134 | // #endif | |
135 | i = 0; |
|
135 | i = 0; | |
136 | } |
|
136 | } | |
137 | else i++; |
|
137 | else i++; | |
138 | j++; |
|
138 | j++; | |
139 | } |
|
139 | } | |
140 | } |
|
140 | } | |
141 |
|
141 | |||
142 | rtems_task hous_task(rtems_task_argument argument) |
|
142 | rtems_task hous_task(rtems_task_argument argument) | |
143 | { |
|
143 | { | |
144 | rtems_status_code status; |
|
144 | rtems_status_code status; | |
145 | rtems_id queue_id; |
|
145 | rtems_id queue_id; | |
146 | rtems_rate_monotonic_period_status period_status; |
|
146 | rtems_rate_monotonic_period_status period_status; | |
147 |
|
147 | |||
148 | status = get_message_queue_id_send( &queue_id ); |
|
148 | status = get_message_queue_id_send( &queue_id ); | |
149 | if (status != RTEMS_SUCCESSFUL) |
|
149 | if (status != RTEMS_SUCCESSFUL) | |
150 | { |
|
150 | { | |
151 | PRINTF1("in HOUS *** ERR get_message_queue_id_send %d\n", status) |
|
151 | PRINTF1("in HOUS *** ERR get_message_queue_id_send %d\n", status) | |
152 | } |
|
152 | } | |
153 |
|
153 | |||
154 | BOOT_PRINTF("in HOUS ***\n") |
|
154 | BOOT_PRINTF("in HOUS ***\n") | |
155 |
|
155 | |||
156 | if (rtems_rate_monotonic_ident( name_hk_rate_monotonic, &HK_id) != RTEMS_SUCCESSFUL) { |
|
156 | if (rtems_rate_monotonic_ident( name_hk_rate_monotonic, &HK_id) != RTEMS_SUCCESSFUL) { | |
157 | status = rtems_rate_monotonic_create( name_hk_rate_monotonic, &HK_id ); |
|
157 | status = rtems_rate_monotonic_create( name_hk_rate_monotonic, &HK_id ); | |
158 | if( status != RTEMS_SUCCESSFUL ) { |
|
158 | if( status != RTEMS_SUCCESSFUL ) { | |
159 | PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status ) |
|
159 | PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status ) | |
160 | } |
|
160 | } | |
161 | } |
|
161 | } | |
162 |
|
162 | |||
163 | housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
163 | housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; | |
164 | housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
164 | housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
165 | housekeeping_packet.reserved = DEFAULT_RESERVED; |
|
165 | housekeeping_packet.reserved = DEFAULT_RESERVED; | |
166 | housekeeping_packet.userApplication = CCSDS_USER_APP; |
|
166 | housekeeping_packet.userApplication = CCSDS_USER_APP; | |
167 | housekeeping_packet.packetID[0] = (unsigned char) (APID_TM_HK >> 8); |
|
167 | housekeeping_packet.packetID[0] = (unsigned char) (APID_TM_HK >> 8); | |
168 | housekeeping_packet.packetID[1] = (unsigned char) (APID_TM_HK); |
|
168 | housekeeping_packet.packetID[1] = (unsigned char) (APID_TM_HK); | |
169 | housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
169 | housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
170 | housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
170 | housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
171 | housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8); |
|
171 | housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8); | |
172 | housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK ); |
|
172 | housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK ); | |
173 | housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
173 | housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
174 | housekeeping_packet.serviceType = TM_TYPE_HK; |
|
174 | housekeeping_packet.serviceType = TM_TYPE_HK; | |
175 | housekeeping_packet.serviceSubType = TM_SUBTYPE_HK; |
|
175 | housekeeping_packet.serviceSubType = TM_SUBTYPE_HK; | |
176 | housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND; |
|
176 | housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND; | |
177 | housekeeping_packet.sid = SID_HK; |
|
177 | housekeeping_packet.sid = SID_HK; | |
178 |
|
178 | |||
179 | status = rtems_rate_monotonic_cancel(HK_id); |
|
179 | status = rtems_rate_monotonic_cancel(HK_id); | |
180 | if( status != RTEMS_SUCCESSFUL ) { |
|
180 | if( status != RTEMS_SUCCESSFUL ) { | |
181 | PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status ) |
|
181 | PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status ) | |
182 | } |
|
182 | } | |
183 | else { |
|
183 | else { | |
184 | DEBUG_PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n") |
|
184 | DEBUG_PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n") | |
185 | } |
|
185 | } | |
186 |
|
186 | |||
187 | // startup phase |
|
187 | // startup phase | |
188 | status = rtems_rate_monotonic_period( HK_id, SY_LFR_TIME_SYN_TIMEOUT_in_ticks ); |
|
188 | status = rtems_rate_monotonic_period( HK_id, SY_LFR_TIME_SYN_TIMEOUT_in_ticks ); | |
189 | status = rtems_rate_monotonic_get_status( HK_id, &period_status ); |
|
189 | status = rtems_rate_monotonic_get_status( HK_id, &period_status ); | |
190 | DEBUG_PRINTF1("startup HK, HK_id status = %d\n", period_status.state) |
|
190 | DEBUG_PRINTF1("startup HK, HK_id status = %d\n", period_status.state) | |
191 | while(period_status.state != RATE_MONOTONIC_EXPIRED ) // after SY_LFR_TIME_SYN_TIMEOUT ms, starts HK anyway |
|
191 | while(period_status.state != RATE_MONOTONIC_EXPIRED ) // after SY_LFR_TIME_SYN_TIMEOUT ms, starts HK anyway | |
192 | { |
|
192 | { | |
193 | if ((time_management_regs->coarse_time & 0x80000000) == 0x00000000) // check time synchronization |
|
193 | if ((time_management_regs->coarse_time & 0x80000000) == 0x00000000) // check time synchronization | |
194 | { |
|
194 | { | |
195 | break; // break if LFR is synchronized |
|
195 | break; // break if LFR is synchronized | |
196 | } |
|
196 | } | |
197 | else |
|
197 | else | |
198 | { |
|
198 | { | |
199 | status = rtems_rate_monotonic_get_status( HK_id, &period_status ); |
|
199 | status = rtems_rate_monotonic_get_status( HK_id, &period_status ); | |
200 | // sched_yield(); |
|
200 | // sched_yield(); | |
201 | status = rtems_task_wake_after( 10 ); // wait SY_LFR_DPU_CONNECT_TIMEOUT 100 ms = 10 * 10 ms |
|
201 | status = rtems_task_wake_after( 10 ); // wait SY_LFR_DPU_CONNECT_TIMEOUT 100 ms = 10 * 10 ms | |
202 | } |
|
202 | } | |
203 | } |
|
203 | } | |
204 | status = rtems_rate_monotonic_cancel(HK_id); |
|
204 | status = rtems_rate_monotonic_cancel(HK_id); | |
205 | DEBUG_PRINTF1("startup HK, HK_id status = %d\n", period_status.state) |
|
205 | DEBUG_PRINTF1("startup HK, HK_id status = %d\n", period_status.state) | |
206 |
|
206 | |||
207 | while(1){ // launch the rate monotonic task |
|
207 | while(1){ // launch the rate monotonic task | |
208 | status = rtems_rate_monotonic_period( HK_id, HK_PERIOD ); |
|
208 | status = rtems_rate_monotonic_period( HK_id, HK_PERIOD ); | |
209 | if ( status != RTEMS_SUCCESSFUL ) { |
|
209 | if ( status != RTEMS_SUCCESSFUL ) { | |
210 | PRINTF1( "in HOUS *** ERR period: %d\n", status); |
|
210 | PRINTF1( "in HOUS *** ERR period: %d\n", status); | |
211 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_6 ); |
|
211 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_6 ); | |
212 | } |
|
212 | } | |
213 | else { |
|
213 | else { | |
214 | increment_seq_counter( housekeeping_packet.packetSequenceControl ); |
|
214 | increment_seq_counter( housekeeping_packet.packetSequenceControl ); | |
215 | housekeeping_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
215 | housekeeping_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
216 | housekeeping_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
216 | housekeeping_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
217 | housekeeping_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
217 | housekeeping_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
218 | housekeeping_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
218 | housekeeping_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); | |
219 | housekeeping_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
219 | housekeeping_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
220 | housekeeping_packet.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
220 | housekeeping_packet.time[5] = (unsigned char) (time_management_regs->fine_time); | |
221 |
|
221 | |||
222 | spacewire_update_statistics(); |
|
222 | spacewire_update_statistics(); | |
223 |
|
223 | |||
224 | get_v_e1_e2_f3( |
|
224 | get_v_e1_e2_f3( | |
225 | housekeeping_packet.hk_lfr_sc_v_f3, housekeeping_packet.hk_lfr_sc_e1_f3, housekeeping_packet.hk_lfr_sc_e2_f3, |
|
225 | housekeeping_packet.hk_lfr_sc_v_f3, housekeeping_packet.hk_lfr_sc_e1_f3, housekeeping_packet.hk_lfr_sc_e2_f3, | |
226 | false ); |
|
226 | false ); | |
227 |
|
227 | |||
228 | // SEND PACKET |
|
228 | // SEND PACKET | |
229 | status = rtems_message_queue_urgent( queue_id, &housekeeping_packet, |
|
229 | status = rtems_message_queue_urgent( queue_id, &housekeeping_packet, | |
230 | PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES); |
|
230 | PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES); | |
231 | if (status != RTEMS_SUCCESSFUL) { |
|
231 | if (status != RTEMS_SUCCESSFUL) { | |
232 | PRINTF1("in HOUS *** ERR send: %d\n", status) |
|
232 | PRINTF1("in HOUS *** ERR send: %d\n", status) | |
233 | } |
|
233 | } | |
234 | } |
|
234 | } | |
235 | } |
|
235 | } | |
236 |
|
236 | |||
237 | PRINTF("in HOUS *** deleting task\n") |
|
237 | PRINTF("in HOUS *** deleting task\n") | |
238 |
|
238 | |||
239 | status = rtems_task_delete( RTEMS_SELF ); // should not return |
|
239 | status = rtems_task_delete( RTEMS_SELF ); // should not return | |
240 | printf( "rtems_task_delete returned with status of %d.\n", status ); |
|
240 | printf( "rtems_task_delete returned with status of %d.\n", status ); | |
241 | return; |
|
241 | return; | |
242 | } |
|
242 | } | |
243 |
|
243 | |||
244 | rtems_task dumb_task( rtems_task_argument unused ) |
|
244 | rtems_task dumb_task( rtems_task_argument unused ) | |
245 | { |
|
245 | { | |
246 | /** This RTEMS taks is used to print messages without affecting the general behaviour of the software. |
|
246 | /** This RTEMS taks is used to print messages without affecting the general behaviour of the software. | |
247 | * |
|
247 | * | |
248 | * @param unused is the starting argument of the RTEMS task |
|
248 | * @param unused is the starting argument of the RTEMS task | |
249 | * |
|
249 | * | |
250 | * The DUMB taks waits for RTEMS events and print messages depending on the incoming events. |
|
250 | * The DUMB taks waits for RTEMS events and print messages depending on the incoming events. | |
251 | * |
|
251 | * | |
252 | */ |
|
252 | */ | |
253 |
|
253 | |||
254 | unsigned int i; |
|
254 | unsigned int i; | |
255 | unsigned int intEventOut; |
|
255 | unsigned int intEventOut; | |
256 | unsigned int coarse_time = 0; |
|
256 | unsigned int coarse_time = 0; | |
257 | unsigned int fine_time = 0; |
|
257 | unsigned int fine_time = 0; | |
258 | rtems_event_set event_out; |
|
258 | rtems_event_set event_out; | |
259 |
|
259 | |||
260 | char *DumbMessages[10] = {"in DUMB *** default", // RTEMS_EVENT_0 |
|
260 | char *DumbMessages[10] = {"in DUMB *** default", // RTEMS_EVENT_0 | |
261 | "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1 |
|
261 | "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1 | |
262 | "in DUMB *** f3 buffer changed", // RTEMS_EVENT_2 |
|
262 | "in DUMB *** f3 buffer changed", // RTEMS_EVENT_2 | |
263 | "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3 |
|
263 | "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3 | |
264 | "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4 |
|
264 | "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4 | |
265 | "in DUMB *** waveforms_simulator_isr", // RTEMS_EVENT_5 |
|
265 | "in DUMB *** waveforms_simulator_isr", // RTEMS_EVENT_5 | |
266 | "ERR HK", // RTEMS_EVENT_6 |
|
266 | "ERR HK", // RTEMS_EVENT_6 | |
267 | "ready for dump", // RTEMS_EVENT_7 |
|
267 | "ready for dump", // RTEMS_EVENT_7 | |
268 | "in DUMB *** spectral_matrices_isr", // RTEMS_EVENT_8 |
|
268 | "in DUMB *** spectral_matrices_isr", // RTEMS_EVENT_8 | |
269 | "tick" // RTEMS_EVENT_9 |
|
269 | "tick" // RTEMS_EVENT_9 | |
270 | }; |
|
270 | }; | |
271 |
|
271 | |||
272 | BOOT_PRINTF("in DUMB *** \n") |
|
272 | BOOT_PRINTF("in DUMB *** \n") | |
273 |
|
273 | |||
274 | while(1){ |
|
274 | while(1){ | |
275 | rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3 |
|
275 | rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3 | |
276 | | RTEMS_EVENT_4 | RTEMS_EVENT_5 | RTEMS_EVENT_6 | RTEMS_EVENT_7 |
|
276 | | RTEMS_EVENT_4 | RTEMS_EVENT_5 | RTEMS_EVENT_6 | RTEMS_EVENT_7 | |
277 | | RTEMS_EVENT_8 | RTEMS_EVENT_9, |
|
277 | | RTEMS_EVENT_8 | RTEMS_EVENT_9, | |
278 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT |
|
278 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT | |
279 | intEventOut = (unsigned int) event_out; |
|
279 | intEventOut = (unsigned int) event_out; | |
280 | for ( i=0; i<32; i++) |
|
280 | for ( i=0; i<32; i++) | |
281 | { |
|
281 | { | |
282 | if ( ((intEventOut >> i) & 0x0001) != 0) |
|
282 | if ( ((intEventOut >> i) & 0x0001) != 0) | |
283 | { |
|
283 | { | |
284 | coarse_time = time_management_regs->coarse_time; |
|
284 | coarse_time = time_management_regs->coarse_time; | |
285 | fine_time = time_management_regs->fine_time; |
|
285 | fine_time = time_management_regs->fine_time; | |
286 | printf("in DUMB *** coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]); |
|
286 | printf("in DUMB *** coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]); | |
287 | } |
|
287 | } | |
288 | } |
|
288 | } | |
289 | } |
|
289 | } | |
290 | } |
|
290 | } | |
291 |
|
291 | |||
292 | //***************************** |
|
292 | //***************************** | |
293 | // init housekeeping parameters |
|
293 | // init housekeeping parameters | |
294 |
|
294 | |||
295 | void init_housekeeping_parameters( void ) |
|
295 | void init_housekeeping_parameters( void ) | |
296 | { |
|
296 | { | |
297 | /** This function initialize the housekeeping_packet global variable with default values. |
|
297 | /** This function initialize the housekeeping_packet global variable with default values. | |
298 | * |
|
298 | * | |
299 | */ |
|
299 | */ | |
300 |
|
300 | |||
301 | unsigned int i = 0; |
|
301 | unsigned int i = 0; | |
302 | unsigned char *parameters; |
|
302 | unsigned char *parameters; | |
303 |
|
303 | |||
304 | parameters = (unsigned char*) &housekeeping_packet.lfr_status_word; |
|
304 | parameters = (unsigned char*) &housekeeping_packet.lfr_status_word; | |
305 | for(i = 0; i< SIZE_HK_PARAMETERS; i++) |
|
305 | for(i = 0; i< SIZE_HK_PARAMETERS; i++) | |
306 | { |
|
306 | { | |
307 | parameters[i] = 0x00; |
|
307 | parameters[i] = 0x00; | |
308 | } |
|
308 | } | |
309 | // init status word |
|
309 | // init status word | |
310 | housekeeping_packet.lfr_status_word[0] = DEFAULT_STATUS_WORD_BYTE0; |
|
310 | housekeeping_packet.lfr_status_word[0] = DEFAULT_STATUS_WORD_BYTE0; | |
311 | housekeeping_packet.lfr_status_word[1] = DEFAULT_STATUS_WORD_BYTE1; |
|
311 | housekeeping_packet.lfr_status_word[1] = DEFAULT_STATUS_WORD_BYTE1; | |
312 | // init software version |
|
312 | // init software version | |
313 | housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1; |
|
313 | housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1; | |
314 | housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2; |
|
314 | housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2; | |
315 | housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3; |
|
315 | housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3; | |
316 | housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4; |
|
316 | housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4; | |
317 | // init fpga version |
|
317 | // init fpga version | |
318 | parameters = (unsigned char *) (REGS_ADDR_WAVEFORM_PICKER + 0xb0); |
|
318 | parameters = (unsigned char *) (REGS_ADDR_WAVEFORM_PICKER + 0xb0); | |
319 | housekeeping_packet.lfr_fpga_version[0] = parameters[1]; // n1 |
|
319 | housekeeping_packet.lfr_fpga_version[0] = parameters[1]; // n1 | |
320 | housekeeping_packet.lfr_fpga_version[1] = parameters[2]; // n2 |
|
320 | housekeeping_packet.lfr_fpga_version[1] = parameters[2]; // n2 | |
321 | housekeeping_packet.lfr_fpga_version[2] = parameters[3]; // n3 |
|
321 | housekeeping_packet.lfr_fpga_version[2] = parameters[3]; // n3 | |
322 | } |
|
322 | } | |
323 |
|
323 | |||
324 | void increment_seq_counter( unsigned char *packet_sequence_control) |
|
324 | void increment_seq_counter( unsigned char *packet_sequence_control) | |
325 | { |
|
325 | { | |
326 | /** This function increment the sequence counter psased in argument. |
|
326 | /** This function increment the sequence counter psased in argument. | |
327 | * |
|
327 | * | |
328 | * The increment does not affect the grouping flag. In case of an overflow, the counter is reset to 0. |
|
328 | * The increment does not affect the grouping flag. In case of an overflow, the counter is reset to 0. | |
329 | * |
|
329 | * | |
330 | */ |
|
330 | */ | |
331 |
|
331 | |||
332 | unsigned short sequence_cnt; |
|
332 | unsigned short sequence_cnt; | |
333 | unsigned short segmentation_grouping_flag; |
|
333 | unsigned short segmentation_grouping_flag; | |
334 | unsigned short new_packet_sequence_control; |
|
334 | unsigned short new_packet_sequence_control; | |
335 |
|
335 | |||
336 | segmentation_grouping_flag = TM_PACKET_SEQ_CTRL_STANDALONE << 8; // keep bits 7 downto 6 |
|
336 | segmentation_grouping_flag = TM_PACKET_SEQ_CTRL_STANDALONE << 8; // keep bits 7 downto 6 | |
337 | sequence_cnt = (unsigned short) ( |
|
337 | sequence_cnt = (unsigned short) ( | |
338 | ( (packet_sequence_control[0] & 0x3f) << 8 ) // keep bits 5 downto 0 |
|
338 | ( (packet_sequence_control[0] & 0x3f) << 8 ) // keep bits 5 downto 0 | |
339 | + packet_sequence_control[1] |
|
339 | + packet_sequence_control[1] | |
340 | ); |
|
340 | ); | |
341 |
|
341 | |||
342 | if ( sequence_cnt < SEQ_CNT_MAX) |
|
342 | if ( sequence_cnt < SEQ_CNT_MAX) | |
343 | { |
|
343 | { | |
344 | sequence_cnt = sequence_cnt + 1; |
|
344 | sequence_cnt = sequence_cnt + 1; | |
345 | } |
|
345 | } | |
346 | else |
|
346 | else | |
347 | { |
|
347 | { | |
348 | sequence_cnt = 0; |
|
348 | sequence_cnt = 0; | |
349 | } |
|
349 | } | |
350 |
|
350 | |||
351 | new_packet_sequence_control = segmentation_grouping_flag | sequence_cnt ; |
|
351 | new_packet_sequence_control = segmentation_grouping_flag | sequence_cnt ; | |
352 |
|
352 | |||
353 | packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8); |
|
353 | packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8); | |
354 | packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control ); |
|
354 | packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control ); | |
355 | } |
|
355 | } | |
356 |
|
356 | |||
357 | void getTime( unsigned char *time) |
|
357 | void getTime( unsigned char *time) | |
358 | { |
|
358 | { | |
359 | /** This function write the current local time in the time buffer passed in argument. |
|
359 | /** This function write the current local time in the time buffer passed in argument. | |
360 | * |
|
360 | * | |
361 | */ |
|
361 | */ | |
362 |
|
362 | |||
363 | time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
363 | time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
364 | time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
364 | time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
365 | time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
365 | time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
366 | time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
366 | time[3] = (unsigned char) (time_management_regs->coarse_time); | |
367 | time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
367 | time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
368 | time[5] = (unsigned char) (time_management_regs->fine_time); |
|
368 | time[5] = (unsigned char) (time_management_regs->fine_time); | |
369 | } |
|
369 | } | |
370 |
|
370 | |||
371 | unsigned long long int getTimeAsUnsignedLongLongInt( ) |
|
371 | unsigned long long int getTimeAsUnsignedLongLongInt( ) | |
372 | { |
|
372 | { | |
373 | /** This function write the current local time in the time buffer passed in argument. |
|
373 | /** This function write the current local time in the time buffer passed in argument. | |
374 | * |
|
374 | * | |
375 | */ |
|
375 | */ | |
376 | unsigned long long int time; |
|
376 | unsigned long long int time; | |
377 |
|
377 | |||
378 | time = ( (unsigned long long int) (time_management_regs->coarse_time & 0x7fffffff) << 16 ) |
|
378 | time = ( (unsigned long long int) (time_management_regs->coarse_time & 0x7fffffff) << 16 ) | |
379 | + time_management_regs->fine_time; |
|
379 | + time_management_regs->fine_time; | |
380 |
|
380 | |||
381 | return time; |
|
381 | return time; | |
382 | } |
|
382 | } | |
383 |
|
383 | |||
384 | void send_dumb_hk( void ) |
|
384 | void send_dumb_hk( void ) | |
385 | { |
|
385 | { | |
386 | Packet_TM_LFR_HK_t dummy_hk_packet; |
|
386 | Packet_TM_LFR_HK_t dummy_hk_packet; | |
387 | unsigned char *parameters; |
|
387 | unsigned char *parameters; | |
388 | unsigned int i; |
|
388 | unsigned int i; | |
389 | rtems_id queue_id; |
|
389 | rtems_id queue_id; | |
390 |
|
390 | |||
391 | dummy_hk_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
391 | dummy_hk_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; | |
392 | dummy_hk_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
392 | dummy_hk_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
393 | dummy_hk_packet.reserved = DEFAULT_RESERVED; |
|
393 | dummy_hk_packet.reserved = DEFAULT_RESERVED; | |
394 | dummy_hk_packet.userApplication = CCSDS_USER_APP; |
|
394 | dummy_hk_packet.userApplication = CCSDS_USER_APP; | |
395 | dummy_hk_packet.packetID[0] = (unsigned char) (APID_TM_HK >> 8); |
|
395 | dummy_hk_packet.packetID[0] = (unsigned char) (APID_TM_HK >> 8); | |
396 | dummy_hk_packet.packetID[1] = (unsigned char) (APID_TM_HK); |
|
396 | dummy_hk_packet.packetID[1] = (unsigned char) (APID_TM_HK); | |
397 | dummy_hk_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
397 | dummy_hk_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
398 | dummy_hk_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
398 | dummy_hk_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
399 | dummy_hk_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8); |
|
399 | dummy_hk_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8); | |
400 | dummy_hk_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK ); |
|
400 | dummy_hk_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK ); | |
401 | dummy_hk_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
401 | dummy_hk_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
402 | dummy_hk_packet.serviceType = TM_TYPE_HK; |
|
402 | dummy_hk_packet.serviceType = TM_TYPE_HK; | |
403 | dummy_hk_packet.serviceSubType = TM_SUBTYPE_HK; |
|
403 | dummy_hk_packet.serviceSubType = TM_SUBTYPE_HK; | |
404 | dummy_hk_packet.destinationID = TM_DESTINATION_ID_GROUND; |
|
404 | dummy_hk_packet.destinationID = TM_DESTINATION_ID_GROUND; | |
405 | dummy_hk_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
405 | dummy_hk_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
406 | dummy_hk_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
406 | dummy_hk_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
407 | dummy_hk_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
407 | dummy_hk_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
408 | dummy_hk_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
408 | dummy_hk_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); | |
409 | dummy_hk_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
409 | dummy_hk_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
410 | dummy_hk_packet.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
410 | dummy_hk_packet.time[5] = (unsigned char) (time_management_regs->fine_time); | |
411 | dummy_hk_packet.sid = SID_HK; |
|
411 | dummy_hk_packet.sid = SID_HK; | |
412 |
|
412 | |||
413 | // init status word |
|
413 | // init status word | |
414 | dummy_hk_packet.lfr_status_word[0] = 0xff; |
|
414 | dummy_hk_packet.lfr_status_word[0] = 0xff; | |
415 | dummy_hk_packet.lfr_status_word[1] = 0xff; |
|
415 | dummy_hk_packet.lfr_status_word[1] = 0xff; | |
416 | // init software version |
|
416 | // init software version | |
417 | dummy_hk_packet.lfr_sw_version[0] = SW_VERSION_N1; |
|
417 | dummy_hk_packet.lfr_sw_version[0] = SW_VERSION_N1; | |
418 | dummy_hk_packet.lfr_sw_version[1] = SW_VERSION_N2; |
|
418 | dummy_hk_packet.lfr_sw_version[1] = SW_VERSION_N2; | |
419 | dummy_hk_packet.lfr_sw_version[2] = SW_VERSION_N3; |
|
419 | dummy_hk_packet.lfr_sw_version[2] = SW_VERSION_N3; | |
420 | dummy_hk_packet.lfr_sw_version[3] = SW_VERSION_N4; |
|
420 | dummy_hk_packet.lfr_sw_version[3] = SW_VERSION_N4; | |
421 | // init fpga version |
|
421 | // init fpga version | |
422 | parameters = (unsigned char *) (REGS_ADDR_WAVEFORM_PICKER + 0xb0); |
|
422 | parameters = (unsigned char *) (REGS_ADDR_WAVEFORM_PICKER + 0xb0); | |
423 | dummy_hk_packet.lfr_fpga_version[0] = parameters[1]; // n1 |
|
423 | dummy_hk_packet.lfr_fpga_version[0] = parameters[1]; // n1 | |
424 | dummy_hk_packet.lfr_fpga_version[1] = parameters[2]; // n2 |
|
424 | dummy_hk_packet.lfr_fpga_version[1] = parameters[2]; // n2 | |
425 | dummy_hk_packet.lfr_fpga_version[2] = parameters[3]; // n3 |
|
425 | dummy_hk_packet.lfr_fpga_version[2] = parameters[3]; // n3 | |
426 |
|
426 | |||
427 | parameters = (unsigned char *) &dummy_hk_packet.hk_lfr_cpu_load; |
|
427 | parameters = (unsigned char *) &dummy_hk_packet.hk_lfr_cpu_load; | |
428 |
|
428 | |||
429 | for (i=0; i<100; i++) |
|
429 | for (i=0; i<100; i++) | |
430 | { |
|
430 | { | |
431 | parameters[i] = 0xff; |
|
431 | parameters[i] = 0xff; | |
432 | } |
|
432 | } | |
433 |
|
433 | |||
434 | get_message_queue_id_send( &queue_id ); |
|
434 | get_message_queue_id_send( &queue_id ); | |
435 |
|
435 | |||
436 | rtems_message_queue_urgent( queue_id, &dummy_hk_packet, |
|
436 | rtems_message_queue_urgent( queue_id, &dummy_hk_packet, | |
437 | PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES); |
|
437 | PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES); | |
438 | } |
|
438 | } | |
439 |
|
439 | |||
440 | void get_v_e1_e2_f3( unsigned char *v, unsigned char *e1, unsigned char *e2, bool init_buffer_addr ) |
|
440 | void get_v_e1_e2_f3( unsigned char *v, unsigned char *e1, unsigned char *e2, bool init_buffer_addr ) | |
441 | { |
|
441 | { | |
442 | static int *current_addr_data_f3 = NULL; |
|
442 | unsigned int coarseTime; | |
443 | int *new_addr_data_f3; |
|
443 | unsigned int acquisitionTime; | |
444 |
unsigned |
|
444 | unsigned int deltaT = 0; | |
|
445 | unsigned char *bufferPtr; | |||
445 |
|
446 | |||
446 | static unsigned int counter = 0; |
|
|||
447 | unsigned int offset_in_samples; |
|
447 | unsigned int offset_in_samples; | |
448 |
unsigned int offset_in_ |
|
448 | unsigned int offset_in_bytes; | |
449 |
unsigned char |
|
449 | unsigned char f3 = 16; // v, e1 and e2 will be picked up each second, f3 = 16 Hz | |
450 |
|
450 | |||
451 | new_addr_data_f3 = (int *) waveform_picker_regs->addr_data_f3; |
|
451 | if (lfrCurrentMode == LFR_MODE_STANDBY) | |
452 |
|
||||
453 | if (init_buffer_addr == true) // when the waveform_picker is launched |
|
|||
454 | { |
|
452 | { | |
455 | current_addr_data_f3 = NULL; |
|
453 | v[0] = 0x00; | |
|
454 | v[1] = 0x00; | |||
|
455 | e1[0] = 0x00; | |||
|
456 | e1[1] = 0x00; | |||
|
457 | e2[0] = 0x00; | |||
|
458 | e2[1] = 0x00; | |||
456 | } |
|
459 | } | |
457 | else |
|
460 | else | |
458 | { |
|
461 | { | |
459 | if (lfrCurrentMode == LFR_MODE_STANDBY) |
|
462 | coarseTime = time_management_regs->coarse_time & 0x7fffffff; | |
|
463 | bufferPtr = (unsigned char*) waveform_picker_regs->addr_data_f3; | |||
|
464 | acquisitionTime = (unsigned int) ( ( bufferPtr[2] & 0x7f ) << 24 ) | |||
|
465 | + (unsigned int) ( bufferPtr[3] << 16 ) | |||
|
466 | + (unsigned int) ( bufferPtr[0] << 8 ) | |||
|
467 | + (unsigned int) ( bufferPtr[1] ); | |||
|
468 | if ( coarseTime > acquisitionTime ) | |||
460 | { |
|
469 | { | |
461 | v[0] = 0x00; |
|
470 | deltaT = coarseTime - acquisitionTime; | |
462 | v[1] = 0x00; |
|
471 | offset_in_samples = (deltaT-1) * f3 ; | |
463 | e1[0] = 0x00; |
|
472 | } | |
464 | e1[1] = 0x00; |
|
473 | else if( coarseTime == acquisitionTime ) | |
465 | e2[0] = 0x00; |
|
474 | { | |
466 |
|
|
475 | offset_in_samples = 0; | |
467 | } |
|
476 | } | |
468 | else |
|
477 | else | |
469 | { |
|
478 | { | |
470 | if ( new_addr_data_f3 != current_addr_data_f3 ) |
|
479 | offset_in_samples = 0; | |
471 | { |
|
480 | PRINTF2("ERR *** in get_v_e1_e2_f3 *** coarseTime = %x, acquisitionTime = %x\n", coarseTime, acquisitionTime) | |
472 | counter = 0; |
|
481 | } | |
473 | offset_in_samples = 0; |
|
482 | ||
474 | current_addr_data_f3 = new_addr_data_f3; |
|
483 | if ( offset_in_samples > (NB_SAMPLES_PER_SNAPSHOT - 1) ) | |
475 |
|
|
484 | { | |
476 | else |
|
485 | PRINTF1("ERR *** in get_v_e1_e2_f3 *** trying to read out the buffer, counter = %d\n", offset_in_samples) | |
477 | { |
|
486 | offset_in_samples = NB_SAMPLES_PER_SNAPSHOT -1; | |
478 | counter = counter + 1; |
|
|||
479 | offset_in_samples = counter * delta; |
|
|||
480 | if ( offset_in_samples > NB_SAMPLES_PER_SNAPSHOT ) |
|
|||
481 | { |
|
|||
482 | offset_in_samples = NB_SAMPLES_PER_SNAPSHOT -1; |
|
|||
483 | PRINTF1("ERR *** in get_v_e1_e2_f3 *** trying to read out the buffer, counter = %d\n", counter) |
|
|||
484 | } |
|
|||
485 | } |
|
|||
486 | offset_in_words = TIME_OFFSET + offset_in_samples * NB_WORDS_SWF_BLK; |
|
|||
487 | ptr = (unsigned char*) ¤t_addr_data_f3[ offset_in_words ]; |
|
|||
488 | v[0] = ptr[0]; |
|
|||
489 | v[1] = ptr[1]; |
|
|||
490 | e1[0] = ptr[2]; |
|
|||
491 | e1[1] = ptr[3]; |
|
|||
492 | e2[0] = ptr[4]; |
|
|||
493 | e2[1] = ptr[5]; |
|
|||
494 | } |
|
487 | } | |
|
488 | PRINTF1("f3 data @ %x *** ", waveform_picker_regs->addr_data_f3 ) | |||
|
489 | PRINTF2("deltaT = %d, offset_in_samples = %d\n", deltaT, offset_in_samples ) | |||
|
490 | offset_in_bytes = TIME_OFFSET_IN_BYTES + offset_in_samples * NB_WORDS_SWF_BLK * 4; | |||
|
491 | v[0] = bufferPtr[ offset_in_bytes + 0]; | |||
|
492 | v[1] = bufferPtr[ offset_in_bytes + 1]; | |||
|
493 | e1[0] = bufferPtr[ offset_in_bytes + 2]; | |||
|
494 | e1[1] = bufferPtr[ offset_in_bytes + 3]; | |||
|
495 | e2[0] = bufferPtr[ offset_in_bytes + 4]; | |||
|
496 | e2[1] = bufferPtr[ offset_in_bytes + 5]; | |||
495 | } |
|
497 | } | |
496 | } |
|
498 | } | |
497 |
|
499 | |||
498 |
|
500 | |||
499 |
|
501 | |||
500 |
|
502 | |||
501 |
|
503 |
@@ -1,951 +1,950 | |||||
1 | /** Functions and tasks related to TeleCommand handling. |
|
1 | /** Functions and tasks related to TeleCommand handling. | |
2 | * |
|
2 | * | |
3 | * @file |
|
3 | * @file | |
4 | * @author P. LEROY |
|
4 | * @author P. LEROY | |
5 | * |
|
5 | * | |
6 | * A group of functions to handle TeleCommands:\n |
|
6 | * A group of functions to handle TeleCommands:\n | |
7 | * action launching\n |
|
7 | * action launching\n | |
8 | * TC parsing\n |
|
8 | * TC parsing\n | |
9 | * ... |
|
9 | * ... | |
10 | * |
|
10 | * | |
11 | */ |
|
11 | */ | |
12 |
|
12 | |||
13 | #include "tc_handler.h" |
|
13 | #include "tc_handler.h" | |
14 |
|
14 | |||
15 | //*********** |
|
15 | //*********** | |
16 | // RTEMS TASK |
|
16 | // RTEMS TASK | |
17 |
|
17 | |||
18 | rtems_task actn_task( rtems_task_argument unused ) |
|
18 | rtems_task actn_task( rtems_task_argument unused ) | |
19 | { |
|
19 | { | |
20 | /** This RTEMS task is responsible for launching actions upton the reception of valid TeleCommands. |
|
20 | /** This RTEMS task is responsible for launching actions upton the reception of valid TeleCommands. | |
21 | * |
|
21 | * | |
22 | * @param unused is the starting argument of the RTEMS task |
|
22 | * @param unused is the starting argument of the RTEMS task | |
23 | * |
|
23 | * | |
24 | * The ACTN task waits for data coming from an RTEMS msesage queue. When data arrives, it launches specific actions depending |
|
24 | * The ACTN task waits for data coming from an RTEMS msesage queue. When data arrives, it launches specific actions depending | |
25 | * on the incoming TeleCommand. |
|
25 | * on the incoming TeleCommand. | |
26 | * |
|
26 | * | |
27 | */ |
|
27 | */ | |
28 |
|
28 | |||
29 | int result; |
|
29 | int result; | |
30 | rtems_status_code status; // RTEMS status code |
|
30 | rtems_status_code status; // RTEMS status code | |
31 | ccsdsTelecommandPacket_t TC; // TC sent to the ACTN task |
|
31 | ccsdsTelecommandPacket_t TC; // TC sent to the ACTN task | |
32 | size_t size; // size of the incoming TC packet |
|
32 | size_t size; // size of the incoming TC packet | |
33 | unsigned char subtype; // subtype of the current TC packet |
|
33 | unsigned char subtype; // subtype of the current TC packet | |
34 | unsigned char time[6]; |
|
34 | unsigned char time[6]; | |
35 | rtems_id queue_rcv_id; |
|
35 | rtems_id queue_rcv_id; | |
36 | rtems_id queue_snd_id; |
|
36 | rtems_id queue_snd_id; | |
37 |
|
37 | |||
38 | status = get_message_queue_id_recv( &queue_rcv_id ); |
|
38 | status = get_message_queue_id_recv( &queue_rcv_id ); | |
39 | if (status != RTEMS_SUCCESSFUL) |
|
39 | if (status != RTEMS_SUCCESSFUL) | |
40 | { |
|
40 | { | |
41 | PRINTF1("in ACTN *** ERR get_message_queue_id_recv %d\n", status) |
|
41 | PRINTF1("in ACTN *** ERR get_message_queue_id_recv %d\n", status) | |
42 | } |
|
42 | } | |
43 |
|
43 | |||
44 | status = get_message_queue_id_send( &queue_snd_id ); |
|
44 | status = get_message_queue_id_send( &queue_snd_id ); | |
45 | if (status != RTEMS_SUCCESSFUL) |
|
45 | if (status != RTEMS_SUCCESSFUL) | |
46 | { |
|
46 | { | |
47 | PRINTF1("in ACTN *** ERR get_message_queue_id_send %d\n", status) |
|
47 | PRINTF1("in ACTN *** ERR get_message_queue_id_send %d\n", status) | |
48 | } |
|
48 | } | |
49 |
|
49 | |||
50 | result = LFR_SUCCESSFUL; |
|
50 | result = LFR_SUCCESSFUL; | |
51 | subtype = 0; // subtype of the current TC packet |
|
51 | subtype = 0; // subtype of the current TC packet | |
52 |
|
52 | |||
53 | BOOT_PRINTF("in ACTN *** \n") |
|
53 | BOOT_PRINTF("in ACTN *** \n") | |
54 |
|
54 | |||
55 | while(1) |
|
55 | while(1) | |
56 | { |
|
56 | { | |
57 | status = rtems_message_queue_receive( queue_rcv_id, (char*) &TC, &size, |
|
57 | status = rtems_message_queue_receive( queue_rcv_id, (char*) &TC, &size, | |
58 | RTEMS_WAIT, RTEMS_NO_TIMEOUT); |
|
58 | RTEMS_WAIT, RTEMS_NO_TIMEOUT); | |
59 | getTime( time ); // set time to the current time |
|
59 | getTime( time ); // set time to the current time | |
60 | if (status!=RTEMS_SUCCESSFUL) |
|
60 | if (status!=RTEMS_SUCCESSFUL) | |
61 | { |
|
61 | { | |
62 | PRINTF1("ERR *** in task ACTN *** error receiving a message, code %d \n", status) |
|
62 | PRINTF1("ERR *** in task ACTN *** error receiving a message, code %d \n", status) | |
63 | } |
|
63 | } | |
64 | else |
|
64 | else | |
65 | { |
|
65 | { | |
66 | subtype = TC.serviceSubType; |
|
66 | subtype = TC.serviceSubType; | |
67 | switch(subtype) |
|
67 | switch(subtype) | |
68 | { |
|
68 | { | |
69 | case TC_SUBTYPE_RESET: |
|
69 | case TC_SUBTYPE_RESET: | |
70 | result = action_reset( &TC, queue_snd_id, time ); |
|
70 | result = action_reset( &TC, queue_snd_id, time ); | |
71 | close_action( &TC, result, queue_snd_id ); |
|
71 | close_action( &TC, result, queue_snd_id ); | |
72 | break; |
|
72 | break; | |
73 | // |
|
73 | // | |
74 | case TC_SUBTYPE_LOAD_COMM: |
|
74 | case TC_SUBTYPE_LOAD_COMM: | |
75 | result = action_load_common_par( &TC ); |
|
75 | result = action_load_common_par( &TC ); | |
76 | close_action( &TC, result, queue_snd_id ); |
|
76 | close_action( &TC, result, queue_snd_id ); | |
77 | break; |
|
77 | break; | |
78 | // |
|
78 | // | |
79 | case TC_SUBTYPE_LOAD_NORM: |
|
79 | case TC_SUBTYPE_LOAD_NORM: | |
80 | result = action_load_normal_par( &TC, queue_snd_id, time ); |
|
80 | result = action_load_normal_par( &TC, queue_snd_id, time ); | |
81 | close_action( &TC, result, queue_snd_id ); |
|
81 | close_action( &TC, result, queue_snd_id ); | |
82 | break; |
|
82 | break; | |
83 | // |
|
83 | // | |
84 | case TC_SUBTYPE_LOAD_BURST: |
|
84 | case TC_SUBTYPE_LOAD_BURST: | |
85 | result = action_load_burst_par( &TC, queue_snd_id, time ); |
|
85 | result = action_load_burst_par( &TC, queue_snd_id, time ); | |
86 | close_action( &TC, result, queue_snd_id ); |
|
86 | close_action( &TC, result, queue_snd_id ); | |
87 | break; |
|
87 | break; | |
88 | // |
|
88 | // | |
89 | case TC_SUBTYPE_LOAD_SBM1: |
|
89 | case TC_SUBTYPE_LOAD_SBM1: | |
90 | result = action_load_sbm1_par( &TC, queue_snd_id, time ); |
|
90 | result = action_load_sbm1_par( &TC, queue_snd_id, time ); | |
91 | close_action( &TC, result, queue_snd_id ); |
|
91 | close_action( &TC, result, queue_snd_id ); | |
92 | break; |
|
92 | break; | |
93 | // |
|
93 | // | |
94 | case TC_SUBTYPE_LOAD_SBM2: |
|
94 | case TC_SUBTYPE_LOAD_SBM2: | |
95 | result = action_load_sbm2_par( &TC, queue_snd_id, time ); |
|
95 | result = action_load_sbm2_par( &TC, queue_snd_id, time ); | |
96 | close_action( &TC, result, queue_snd_id ); |
|
96 | close_action( &TC, result, queue_snd_id ); | |
97 | break; |
|
97 | break; | |
98 | // |
|
98 | // | |
99 | case TC_SUBTYPE_DUMP: |
|
99 | case TC_SUBTYPE_DUMP: | |
100 | result = action_dump_par( queue_snd_id ); |
|
100 | result = action_dump_par( queue_snd_id ); | |
101 | close_action( &TC, result, queue_snd_id ); |
|
101 | close_action( &TC, result, queue_snd_id ); | |
102 | break; |
|
102 | break; | |
103 | // |
|
103 | // | |
104 | case TC_SUBTYPE_ENTER: |
|
104 | case TC_SUBTYPE_ENTER: | |
105 | result = action_enter_mode( &TC, queue_snd_id ); |
|
105 | result = action_enter_mode( &TC, queue_snd_id ); | |
106 | close_action( &TC, result, queue_snd_id ); |
|
106 | close_action( &TC, result, queue_snd_id ); | |
107 | break; |
|
107 | break; | |
108 | // |
|
108 | // | |
109 | case TC_SUBTYPE_UPDT_INFO: |
|
109 | case TC_SUBTYPE_UPDT_INFO: | |
110 | result = action_update_info( &TC, queue_snd_id ); |
|
110 | result = action_update_info( &TC, queue_snd_id ); | |
111 | close_action( &TC, result, queue_snd_id ); |
|
111 | close_action( &TC, result, queue_snd_id ); | |
112 | break; |
|
112 | break; | |
113 | // |
|
113 | // | |
114 | case TC_SUBTYPE_EN_CAL: |
|
114 | case TC_SUBTYPE_EN_CAL: | |
115 | result = action_enable_calibration( &TC, queue_snd_id, time ); |
|
115 | result = action_enable_calibration( &TC, queue_snd_id, time ); | |
116 | close_action( &TC, result, queue_snd_id ); |
|
116 | close_action( &TC, result, queue_snd_id ); | |
117 | break; |
|
117 | break; | |
118 | // |
|
118 | // | |
119 | case TC_SUBTYPE_DIS_CAL: |
|
119 | case TC_SUBTYPE_DIS_CAL: | |
120 | result = action_disable_calibration( &TC, queue_snd_id, time ); |
|
120 | result = action_disable_calibration( &TC, queue_snd_id, time ); | |
121 | close_action( &TC, result, queue_snd_id ); |
|
121 | close_action( &TC, result, queue_snd_id ); | |
122 | break; |
|
122 | break; | |
123 | // |
|
123 | // | |
124 | case TC_SUBTYPE_UPDT_TIME: |
|
124 | case TC_SUBTYPE_UPDT_TIME: | |
125 | result = action_update_time( &TC ); |
|
125 | result = action_update_time( &TC ); | |
126 | close_action( &TC, result, queue_snd_id ); |
|
126 | close_action( &TC, result, queue_snd_id ); | |
127 | break; |
|
127 | break; | |
128 | // |
|
128 | // | |
129 | default: |
|
129 | default: | |
130 | break; |
|
130 | break; | |
131 | } |
|
131 | } | |
132 | } |
|
132 | } | |
133 | } |
|
133 | } | |
134 | } |
|
134 | } | |
135 |
|
135 | |||
136 | //*********** |
|
136 | //*********** | |
137 | // TC ACTIONS |
|
137 | // TC ACTIONS | |
138 |
|
138 | |||
139 | int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
139 | int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) | |
140 | { |
|
140 | { | |
141 | /** This function executes specific actions when a TC_LFR_RESET TeleCommand has been received. |
|
141 | /** This function executes specific actions when a TC_LFR_RESET TeleCommand has been received. | |
142 | * |
|
142 | * | |
143 | * @param TC points to the TeleCommand packet that is being processed |
|
143 | * @param TC points to the TeleCommand packet that is being processed | |
144 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
144 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver | |
145 | * |
|
145 | * | |
146 | */ |
|
146 | */ | |
147 |
|
147 | |||
148 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); |
|
148 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); | |
149 | return LFR_DEFAULT; |
|
149 | return LFR_DEFAULT; | |
150 | } |
|
150 | } | |
151 |
|
151 | |||
152 | int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) |
|
152 | int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) | |
153 | { |
|
153 | { | |
154 | /** This function executes specific actions when a TC_LFR_ENTER_MODE TeleCommand has been received. |
|
154 | /** This function executes specific actions when a TC_LFR_ENTER_MODE TeleCommand has been received. | |
155 | * |
|
155 | * | |
156 | * @param TC points to the TeleCommand packet that is being processed |
|
156 | * @param TC points to the TeleCommand packet that is being processed | |
157 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
157 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver | |
158 | * |
|
158 | * | |
159 | */ |
|
159 | */ | |
160 |
|
160 | |||
161 | rtems_status_code status; |
|
161 | rtems_status_code status; | |
162 | unsigned char requestedMode; |
|
162 | unsigned char requestedMode; | |
163 | unsigned int *transitionCoarseTime_ptr; |
|
163 | unsigned int *transitionCoarseTime_ptr; | |
164 | unsigned int transitionCoarseTime; |
|
164 | unsigned int transitionCoarseTime; | |
165 | unsigned char * bytePosPtr; |
|
165 | unsigned char * bytePosPtr; | |
166 |
|
166 | |||
167 | bytePosPtr = (unsigned char *) &TC->packetID; |
|
167 | bytePosPtr = (unsigned char *) &TC->packetID; | |
168 |
|
168 | |||
169 | requestedMode = bytePosPtr[ BYTE_POS_CP_MODE_LFR_SET ]; |
|
169 | requestedMode = bytePosPtr[ BYTE_POS_CP_MODE_LFR_SET ]; | |
170 | transitionCoarseTime_ptr = (unsigned int *) ( &bytePosPtr[ BYTE_POS_CP_LFR_ENTER_MODE_TIME ] ); |
|
170 | transitionCoarseTime_ptr = (unsigned int *) ( &bytePosPtr[ BYTE_POS_CP_LFR_ENTER_MODE_TIME ] ); | |
171 | transitionCoarseTime = (*transitionCoarseTime_ptr) & 0x7fffffff; |
|
171 | transitionCoarseTime = (*transitionCoarseTime_ptr) & 0x7fffffff; | |
172 |
|
172 | |||
173 | status = check_mode_value( requestedMode ); |
|
173 | status = check_mode_value( requestedMode ); | |
174 |
|
174 | |||
175 | if ( status != LFR_SUCCESSFUL ) // the mode value is inconsistent |
|
175 | if ( status != LFR_SUCCESSFUL ) // the mode value is inconsistent | |
176 | { |
|
176 | { | |
177 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_MODE_LFR_SET, requestedMode ); |
|
177 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_MODE_LFR_SET, requestedMode ); | |
178 | } |
|
178 | } | |
179 | else // the mode value is consistent, check the transition |
|
179 | else // the mode value is consistent, check the transition | |
180 | { |
|
180 | { | |
181 | status = check_mode_transition(requestedMode); |
|
181 | status = check_mode_transition(requestedMode); | |
182 | if (status != LFR_SUCCESSFUL) |
|
182 | if (status != LFR_SUCCESSFUL) | |
183 | { |
|
183 | { | |
184 | PRINTF("ERR *** in action_enter_mode *** check_mode_transition\n") |
|
184 | PRINTF("ERR *** in action_enter_mode *** check_mode_transition\n") | |
185 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); |
|
185 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); | |
186 | } |
|
186 | } | |
187 | } |
|
187 | } | |
188 |
|
188 | |||
189 | if ( status == LFR_SUCCESSFUL ) // the transition is valid, enter the mode |
|
189 | if ( status == LFR_SUCCESSFUL ) // the transition is valid, enter the mode | |
190 | { |
|
190 | { | |
191 | status = check_transition_date( transitionCoarseTime ); |
|
191 | status = check_transition_date( transitionCoarseTime ); | |
192 | if (status != LFR_SUCCESSFUL) |
|
192 | if (status != LFR_SUCCESSFUL) | |
193 | { |
|
193 | { | |
194 | PRINTF("ERR *** in action_enter_mode *** check_transition_date\n") |
|
194 | PRINTF("ERR *** in action_enter_mode *** check_transition_date\n") | |
195 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, |
|
195 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, | |
196 | BYTE_POS_CP_LFR_ENTER_MODE_TIME, |
|
196 | BYTE_POS_CP_LFR_ENTER_MODE_TIME, | |
197 | bytePosPtr[ BYTE_POS_CP_LFR_ENTER_MODE_TIME + 3 ] ); |
|
197 | bytePosPtr[ BYTE_POS_CP_LFR_ENTER_MODE_TIME + 3 ] ); | |
198 | } |
|
198 | } | |
199 | } |
|
199 | } | |
200 |
|
200 | |||
201 | if ( status == LFR_SUCCESSFUL ) // the date is valid, enter the mode |
|
201 | if ( status == LFR_SUCCESSFUL ) // the date is valid, enter the mode | |
202 | { |
|
202 | { | |
203 | PRINTF1("OK *** in action_enter_mode *** enter mode %d\n", requestedMode); |
|
203 | PRINTF1("OK *** in action_enter_mode *** enter mode %d\n", requestedMode); | |
204 | status = enter_mode( requestedMode, transitionCoarseTime ); |
|
204 | status = enter_mode( requestedMode, transitionCoarseTime ); | |
205 | } |
|
205 | } | |
206 |
|
206 | |||
207 | return status; |
|
207 | return status; | |
208 | } |
|
208 | } | |
209 |
|
209 | |||
210 | int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
210 | int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) | |
211 | { |
|
211 | { | |
212 | /** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received. |
|
212 | /** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received. | |
213 | * |
|
213 | * | |
214 | * @param TC points to the TeleCommand packet that is being processed |
|
214 | * @param TC points to the TeleCommand packet that is being processed | |
215 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
215 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver | |
216 | * |
|
216 | * | |
217 | * @return LFR directive status code: |
|
217 | * @return LFR directive status code: | |
218 | * - LFR_DEFAULT |
|
218 | * - LFR_DEFAULT | |
219 | * - LFR_SUCCESSFUL |
|
219 | * - LFR_SUCCESSFUL | |
220 | * |
|
220 | * | |
221 | */ |
|
221 | */ | |
222 |
|
222 | |||
223 | unsigned int val; |
|
223 | unsigned int val; | |
224 | int result; |
|
224 | int result; | |
225 | unsigned int status; |
|
225 | unsigned int status; | |
226 | unsigned char mode; |
|
226 | unsigned char mode; | |
227 | unsigned char * bytePosPtr; |
|
227 | unsigned char * bytePosPtr; | |
228 |
|
228 | |||
229 | bytePosPtr = (unsigned char *) &TC->packetID; |
|
229 | bytePosPtr = (unsigned char *) &TC->packetID; | |
230 |
|
230 | |||
231 | // check LFR mode |
|
231 | // check LFR mode | |
232 | mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET5 ] & 0x1e) >> 1; |
|
232 | mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET5 ] & 0x1e) >> 1; | |
233 | status = check_update_info_hk_lfr_mode( mode ); |
|
233 | status = check_update_info_hk_lfr_mode( mode ); | |
234 | if (status == LFR_SUCCESSFUL) // check TDS mode |
|
234 | if (status == LFR_SUCCESSFUL) // check TDS mode | |
235 | { |
|
235 | { | |
236 | mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 ] & 0xf0) >> 4; |
|
236 | mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 ] & 0xf0) >> 4; | |
237 | status = check_update_info_hk_tds_mode( mode ); |
|
237 | status = check_update_info_hk_tds_mode( mode ); | |
238 | } |
|
238 | } | |
239 | if (status == LFR_SUCCESSFUL) // check THR mode |
|
239 | if (status == LFR_SUCCESSFUL) // check THR mode | |
240 | { |
|
240 | { | |
241 | mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 ] & 0x0f); |
|
241 | mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 ] & 0x0f); | |
242 | status = check_update_info_hk_thr_mode( mode ); |
|
242 | status = check_update_info_hk_thr_mode( mode ); | |
243 | } |
|
243 | } | |
244 | if (status == LFR_SUCCESSFUL) // if the parameter check is successful |
|
244 | if (status == LFR_SUCCESSFUL) // if the parameter check is successful | |
245 | { |
|
245 | { | |
246 | val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256 |
|
246 | val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256 | |
247 | + housekeeping_packet.hk_lfr_update_info_tc_cnt[1]; |
|
247 | + housekeeping_packet.hk_lfr_update_info_tc_cnt[1]; | |
248 | val++; |
|
248 | val++; | |
249 | housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8); |
|
249 | housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8); | |
250 | housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val); |
|
250 | housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val); | |
251 | } |
|
251 | } | |
252 |
|
252 | |||
253 | result = status; |
|
253 | result = status; | |
254 |
|
254 | |||
255 | return result; |
|
255 | return result; | |
256 | } |
|
256 | } | |
257 |
|
257 | |||
258 | int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
258 | int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) | |
259 | { |
|
259 | { | |
260 | /** This function executes specific actions when a TC_LFR_ENABLE_CALIBRATION TeleCommand has been received. |
|
260 | /** This function executes specific actions when a TC_LFR_ENABLE_CALIBRATION TeleCommand has been received. | |
261 | * |
|
261 | * | |
262 | * @param TC points to the TeleCommand packet that is being processed |
|
262 | * @param TC points to the TeleCommand packet that is being processed | |
263 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
263 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver | |
264 | * |
|
264 | * | |
265 | */ |
|
265 | */ | |
266 |
|
266 | |||
267 | int result; |
|
267 | int result; | |
268 | unsigned char lfrMode; |
|
268 | unsigned char lfrMode; | |
269 |
|
269 | |||
270 | result = LFR_DEFAULT; |
|
270 | result = LFR_DEFAULT; | |
271 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
271 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
272 |
|
272 | |||
273 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); |
|
273 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); | |
274 | result = LFR_DEFAULT; |
|
274 | result = LFR_DEFAULT; | |
275 |
|
275 | |||
276 | return result; |
|
276 | return result; | |
277 | } |
|
277 | } | |
278 |
|
278 | |||
279 | int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
279 | int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) | |
280 | { |
|
280 | { | |
281 | /** This function executes specific actions when a TC_LFR_DISABLE_CALIBRATION TeleCommand has been received. |
|
281 | /** This function executes specific actions when a TC_LFR_DISABLE_CALIBRATION TeleCommand has been received. | |
282 | * |
|
282 | * | |
283 | * @param TC points to the TeleCommand packet that is being processed |
|
283 | * @param TC points to the TeleCommand packet that is being processed | |
284 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
284 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver | |
285 | * |
|
285 | * | |
286 | */ |
|
286 | */ | |
287 |
|
287 | |||
288 | int result; |
|
288 | int result; | |
289 | unsigned char lfrMode; |
|
289 | unsigned char lfrMode; | |
290 |
|
290 | |||
291 | result = LFR_DEFAULT; |
|
291 | result = LFR_DEFAULT; | |
292 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
292 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
293 |
|
293 | |||
294 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); |
|
294 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); | |
295 | result = LFR_DEFAULT; |
|
295 | result = LFR_DEFAULT; | |
296 |
|
296 | |||
297 | return result; |
|
297 | return result; | |
298 | } |
|
298 | } | |
299 |
|
299 | |||
300 | int action_update_time(ccsdsTelecommandPacket_t *TC) |
|
300 | int action_update_time(ccsdsTelecommandPacket_t *TC) | |
301 | { |
|
301 | { | |
302 | /** This function executes specific actions when a TC_LFR_UPDATE_TIME TeleCommand has been received. |
|
302 | /** This function executes specific actions when a TC_LFR_UPDATE_TIME TeleCommand has been received. | |
303 | * |
|
303 | * | |
304 | * @param TC points to the TeleCommand packet that is being processed |
|
304 | * @param TC points to the TeleCommand packet that is being processed | |
305 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
305 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver | |
306 | * |
|
306 | * | |
307 | * @return LFR_SUCCESSFUL |
|
307 | * @return LFR_SUCCESSFUL | |
308 | * |
|
308 | * | |
309 | */ |
|
309 | */ | |
310 |
|
310 | |||
311 | unsigned int val; |
|
311 | unsigned int val; | |
312 |
|
312 | |||
313 | time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24) |
|
313 | time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24) | |
314 | + (TC->dataAndCRC[1] << 16) |
|
314 | + (TC->dataAndCRC[1] << 16) | |
315 | + (TC->dataAndCRC[2] << 8) |
|
315 | + (TC->dataAndCRC[2] << 8) | |
316 | + TC->dataAndCRC[3]; |
|
316 | + TC->dataAndCRC[3]; | |
317 |
|
317 | |||
318 | PRINTF1("time received: %x\n", time_management_regs->coarse_time_load) |
|
318 | PRINTF1("time received: %x\n", time_management_regs->coarse_time_load) | |
319 |
|
319 | |||
320 | val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256 |
|
320 | val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256 | |
321 | + housekeeping_packet.hk_lfr_update_time_tc_cnt[1]; |
|
321 | + housekeeping_packet.hk_lfr_update_time_tc_cnt[1]; | |
322 | val++; |
|
322 | val++; | |
323 | housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8); |
|
323 | housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8); | |
324 | housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val); |
|
324 | housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val); | |
325 | // time_management_regs->ctrl = time_management_regs->ctrl | 1; // force tick |
|
325 | // time_management_regs->ctrl = time_management_regs->ctrl | 1; // force tick | |
326 |
|
326 | |||
327 | return LFR_SUCCESSFUL; |
|
327 | return LFR_SUCCESSFUL; | |
328 | } |
|
328 | } | |
329 |
|
329 | |||
330 | //******************* |
|
330 | //******************* | |
331 | // ENTERING THE MODES |
|
331 | // ENTERING THE MODES | |
332 | int check_mode_value( unsigned char requestedMode ) |
|
332 | int check_mode_value( unsigned char requestedMode ) | |
333 | { |
|
333 | { | |
334 | int status; |
|
334 | int status; | |
335 |
|
335 | |||
336 | if ( (requestedMode != LFR_MODE_STANDBY) |
|
336 | if ( (requestedMode != LFR_MODE_STANDBY) | |
337 | && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST) |
|
337 | && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST) | |
338 | && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) ) |
|
338 | && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) ) | |
339 | { |
|
339 | { | |
340 | status = LFR_DEFAULT; |
|
340 | status = LFR_DEFAULT; | |
341 | } |
|
341 | } | |
342 | else |
|
342 | else | |
343 | { |
|
343 | { | |
344 | status = LFR_SUCCESSFUL; |
|
344 | status = LFR_SUCCESSFUL; | |
345 | } |
|
345 | } | |
346 |
|
346 | |||
347 | return status; |
|
347 | return status; | |
348 | } |
|
348 | } | |
349 |
|
349 | |||
350 | int check_mode_transition( unsigned char requestedMode ) |
|
350 | int check_mode_transition( unsigned char requestedMode ) | |
351 | { |
|
351 | { | |
352 | /** This function checks the validity of the transition requested by the TC_LFR_ENTER_MODE. |
|
352 | /** This function checks the validity of the transition requested by the TC_LFR_ENTER_MODE. | |
353 | * |
|
353 | * | |
354 | * @param requestedMode is the mode requested by the TC_LFR_ENTER_MODE |
|
354 | * @param requestedMode is the mode requested by the TC_LFR_ENTER_MODE | |
355 | * |
|
355 | * | |
356 | * @return LFR directive status codes: |
|
356 | * @return LFR directive status codes: | |
357 | * - LFR_SUCCESSFUL - the transition is authorized |
|
357 | * - LFR_SUCCESSFUL - the transition is authorized | |
358 | * - LFR_DEFAULT - the transition is not authorized |
|
358 | * - LFR_DEFAULT - the transition is not authorized | |
359 | * |
|
359 | * | |
360 | */ |
|
360 | */ | |
361 |
|
361 | |||
362 | int status; |
|
362 | int status; | |
363 |
|
363 | |||
364 | switch (requestedMode) |
|
364 | switch (requestedMode) | |
365 | { |
|
365 | { | |
366 | case LFR_MODE_STANDBY: |
|
366 | case LFR_MODE_STANDBY: | |
367 | if ( lfrCurrentMode == LFR_MODE_STANDBY ) { |
|
367 | if ( lfrCurrentMode == LFR_MODE_STANDBY ) { | |
368 | status = LFR_DEFAULT; |
|
368 | status = LFR_DEFAULT; | |
369 | } |
|
369 | } | |
370 | else |
|
370 | else | |
371 | { |
|
371 | { | |
372 | status = LFR_SUCCESSFUL; |
|
372 | status = LFR_SUCCESSFUL; | |
373 | } |
|
373 | } | |
374 | break; |
|
374 | break; | |
375 | case LFR_MODE_NORMAL: |
|
375 | case LFR_MODE_NORMAL: | |
376 | if ( lfrCurrentMode == LFR_MODE_NORMAL ) { |
|
376 | if ( lfrCurrentMode == LFR_MODE_NORMAL ) { | |
377 | status = LFR_DEFAULT; |
|
377 | status = LFR_DEFAULT; | |
378 | } |
|
378 | } | |
379 | else { |
|
379 | else { | |
380 | status = LFR_SUCCESSFUL; |
|
380 | status = LFR_SUCCESSFUL; | |
381 | } |
|
381 | } | |
382 | break; |
|
382 | break; | |
383 | case LFR_MODE_BURST: |
|
383 | case LFR_MODE_BURST: | |
384 | if ( lfrCurrentMode == LFR_MODE_BURST ) { |
|
384 | if ( lfrCurrentMode == LFR_MODE_BURST ) { | |
385 | status = LFR_DEFAULT; |
|
385 | status = LFR_DEFAULT; | |
386 | } |
|
386 | } | |
387 | else { |
|
387 | else { | |
388 | status = LFR_SUCCESSFUL; |
|
388 | status = LFR_SUCCESSFUL; | |
389 | } |
|
389 | } | |
390 | break; |
|
390 | break; | |
391 | case LFR_MODE_SBM1: |
|
391 | case LFR_MODE_SBM1: | |
392 | if ( lfrCurrentMode == LFR_MODE_SBM1 ) { |
|
392 | if ( lfrCurrentMode == LFR_MODE_SBM1 ) { | |
393 | status = LFR_DEFAULT; |
|
393 | status = LFR_DEFAULT; | |
394 | } |
|
394 | } | |
395 | else { |
|
395 | else { | |
396 | status = LFR_SUCCESSFUL; |
|
396 | status = LFR_SUCCESSFUL; | |
397 | } |
|
397 | } | |
398 | break; |
|
398 | break; | |
399 | case LFR_MODE_SBM2: |
|
399 | case LFR_MODE_SBM2: | |
400 | if ( lfrCurrentMode == LFR_MODE_SBM2 ) { |
|
400 | if ( lfrCurrentMode == LFR_MODE_SBM2 ) { | |
401 | status = LFR_DEFAULT; |
|
401 | status = LFR_DEFAULT; | |
402 | } |
|
402 | } | |
403 | else { |
|
403 | else { | |
404 | status = LFR_SUCCESSFUL; |
|
404 | status = LFR_SUCCESSFUL; | |
405 | } |
|
405 | } | |
406 | break; |
|
406 | break; | |
407 | default: |
|
407 | default: | |
408 | status = LFR_DEFAULT; |
|
408 | status = LFR_DEFAULT; | |
409 | break; |
|
409 | break; | |
410 | } |
|
410 | } | |
411 |
|
411 | |||
412 | return status; |
|
412 | return status; | |
413 | } |
|
413 | } | |
414 |
|
414 | |||
415 | int check_transition_date( unsigned int transitionCoarseTime ) |
|
415 | int check_transition_date( unsigned int transitionCoarseTime ) | |
416 | { |
|
416 | { | |
417 | int status; |
|
417 | int status; | |
418 | unsigned int localCoarseTime; |
|
418 | unsigned int localCoarseTime; | |
419 | unsigned int deltaCoarseTime; |
|
419 | unsigned int deltaCoarseTime; | |
420 |
|
420 | |||
421 | status = LFR_SUCCESSFUL; |
|
421 | status = LFR_SUCCESSFUL; | |
422 |
|
422 | |||
423 | if (transitionCoarseTime == 0) // transition time = 0 means an instant transition |
|
423 | if (transitionCoarseTime == 0) // transition time = 0 means an instant transition | |
424 | { |
|
424 | { | |
425 | status = LFR_SUCCESSFUL; |
|
425 | status = LFR_SUCCESSFUL; | |
426 | } |
|
426 | } | |
427 | else |
|
427 | else | |
428 | { |
|
428 | { | |
429 | localCoarseTime = time_management_regs->coarse_time & 0x7fffffff; |
|
429 | localCoarseTime = time_management_regs->coarse_time & 0x7fffffff; | |
430 |
|
430 | |||
431 | if ( transitionCoarseTime <= localCoarseTime ) // SSS-CP-EQS-322 |
|
431 | if ( transitionCoarseTime <= localCoarseTime ) // SSS-CP-EQS-322 | |
432 | { |
|
432 | { | |
433 | status = LFR_DEFAULT; |
|
433 | status = LFR_DEFAULT; | |
434 | PRINTF2("ERR *** in check_transition_date *** transition = %x, local = %x\n", transitionCoarseTime, localCoarseTime) |
|
434 | PRINTF2("ERR *** in check_transition_date *** transition = %x, local = %x\n", transitionCoarseTime, localCoarseTime) | |
435 | } |
|
435 | } | |
436 |
|
436 | |||
437 | if (status == LFR_SUCCESSFUL) |
|
437 | if (status == LFR_SUCCESSFUL) | |
438 | { |
|
438 | { | |
439 | deltaCoarseTime = transitionCoarseTime - localCoarseTime; |
|
439 | deltaCoarseTime = transitionCoarseTime - localCoarseTime; | |
440 | if ( deltaCoarseTime > 3 ) // SSS-CP-EQS-323 |
|
440 | if ( deltaCoarseTime > 3 ) // SSS-CP-EQS-323 | |
441 | { |
|
441 | { | |
442 | status = LFR_DEFAULT; |
|
442 | status = LFR_DEFAULT; | |
443 | PRINTF1("ERR *** in check_transition_date *** deltaCoarseTime = %x\n", deltaCoarseTime) |
|
443 | PRINTF1("ERR *** in check_transition_date *** deltaCoarseTime = %x\n", deltaCoarseTime) | |
444 | } |
|
444 | } | |
445 | } |
|
445 | } | |
446 | } |
|
446 | } | |
447 |
|
447 | |||
448 | return status; |
|
448 | return status; | |
449 | } |
|
449 | } | |
450 |
|
450 | |||
451 | int stop_current_mode( void ) |
|
451 | int stop_current_mode( void ) | |
452 | { |
|
452 | { | |
453 | /** This function stops the current mode by masking interrupt lines and suspending science tasks. |
|
453 | /** This function stops the current mode by masking interrupt lines and suspending science tasks. | |
454 | * |
|
454 | * | |
455 | * @return RTEMS directive status codes: |
|
455 | * @return RTEMS directive status codes: | |
456 | * - RTEMS_SUCCESSFUL - task restarted successfully |
|
456 | * - RTEMS_SUCCESSFUL - task restarted successfully | |
457 | * - RTEMS_INVALID_ID - task id invalid |
|
457 | * - RTEMS_INVALID_ID - task id invalid | |
458 | * - RTEMS_ALREADY_SUSPENDED - task already suspended |
|
458 | * - RTEMS_ALREADY_SUSPENDED - task already suspended | |
459 | * |
|
459 | * | |
460 | */ |
|
460 | */ | |
461 |
|
461 | |||
462 | rtems_status_code status; |
|
462 | rtems_status_code status; | |
463 |
|
463 | |||
464 | status = RTEMS_SUCCESSFUL; |
|
464 | status = RTEMS_SUCCESSFUL; | |
465 |
|
465 | |||
466 | // (1) mask interruptions |
|
466 | // (1) mask interruptions | |
467 | LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt |
|
467 | LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt | |
468 | LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt |
|
468 | LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt | |
469 |
|
469 | |||
470 | // (2) clear interruptions |
|
470 | // (2) clear interruptions | |
471 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt |
|
471 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt | |
472 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt |
|
472 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt | |
473 |
|
473 | |||
474 | // (3) reset waveform picker registers |
|
474 | // (3) reset waveform picker registers | |
475 | reset_wfp_burst_enable(); // reset burst and enable bits |
|
475 | reset_wfp_burst_enable(); // reset burst and enable bits | |
476 | reset_wfp_status(); // reset all the status bits |
|
476 | reset_wfp_status(); // reset all the status bits | |
477 |
|
477 | |||
478 | // (4) reset spectral matrices registers |
|
478 | // (4) reset spectral matrices registers | |
479 | set_irq_on_new_ready_matrix( 0 ); // stop the spectral matrices |
|
479 | set_irq_on_new_ready_matrix( 0 ); // stop the spectral matrices | |
480 | set_run_matrix_spectral( 0 ); // run_matrix_spectral is set to 0 |
|
480 | set_run_matrix_spectral( 0 ); // run_matrix_spectral is set to 0 | |
481 | reset_extractSWF(); // reset the extractSWF flag to false |
|
481 | reset_extractSWF(); // reset the extractSWF flag to false | |
482 |
|
482 | |||
483 | // <Spectral Matrices simulator> |
|
483 | // <Spectral Matrices simulator> | |
484 | LEON_Mask_interrupt( IRQ_SM_SIMULATOR ); // mask spectral matrix interrupt simulator |
|
484 | LEON_Mask_interrupt( IRQ_SM_SIMULATOR ); // mask spectral matrix interrupt simulator | |
485 | timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); |
|
485 | timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); | |
486 | LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); // clear spectral matrix interrupt simulator |
|
486 | LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); // clear spectral matrix interrupt simulator | |
487 | // </Spectral Matrices simulator> |
|
487 | // </Spectral Matrices simulator> | |
488 |
|
488 | |||
489 | // suspend several tasks |
|
489 | // suspend several tasks | |
490 | if (lfrCurrentMode != LFR_MODE_STANDBY) { |
|
490 | if (lfrCurrentMode != LFR_MODE_STANDBY) { | |
491 | status = suspend_science_tasks(); |
|
491 | status = suspend_science_tasks(); | |
492 | } |
|
492 | } | |
493 |
|
493 | |||
494 | if (status != RTEMS_SUCCESSFUL) |
|
494 | if (status != RTEMS_SUCCESSFUL) | |
495 | { |
|
495 | { | |
496 | PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status) |
|
496 | PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status) | |
497 | } |
|
497 | } | |
498 |
|
498 | |||
499 | return status; |
|
499 | return status; | |
500 | } |
|
500 | } | |
501 |
|
501 | |||
502 | int enter_mode( unsigned char mode, unsigned int transitionCoarseTime ) |
|
502 | int enter_mode( unsigned char mode, unsigned int transitionCoarseTime ) | |
503 | { |
|
503 | { | |
504 | /** This function is launched after a mode transition validation. |
|
504 | /** This function is launched after a mode transition validation. | |
505 | * |
|
505 | * | |
506 | * @param mode is the mode in which LFR will be put. |
|
506 | * @param mode is the mode in which LFR will be put. | |
507 | * |
|
507 | * | |
508 | * @return RTEMS directive status codes: |
|
508 | * @return RTEMS directive status codes: | |
509 | * - RTEMS_SUCCESSFUL - the mode has been entered successfully |
|
509 | * - RTEMS_SUCCESSFUL - the mode has been entered successfully | |
510 | * - RTEMS_NOT_SATISFIED - the mode has not been entered successfully |
|
510 | * - RTEMS_NOT_SATISFIED - the mode has not been entered successfully | |
511 | * |
|
511 | * | |
512 | */ |
|
512 | */ | |
513 |
|
513 | |||
514 | rtems_status_code status; |
|
514 | rtems_status_code status; | |
515 |
|
515 | |||
516 | //********************** |
|
516 | //********************** | |
517 | // STOP THE CURRENT MODE |
|
517 | // STOP THE CURRENT MODE | |
518 | status = stop_current_mode(); |
|
518 | status = stop_current_mode(); | |
519 | if (status != RTEMS_SUCCESSFUL) |
|
519 | if (status != RTEMS_SUCCESSFUL) | |
520 | { |
|
520 | { | |
521 | PRINTF1("ERR *** in enter_mode *** stop_current_mode with mode = %d\n", mode) |
|
521 | PRINTF1("ERR *** in enter_mode *** stop_current_mode with mode = %d\n", mode) | |
522 | } |
|
522 | } | |
523 |
|
523 | |||
524 | //************************* |
|
524 | //************************* | |
525 | // ENTER THE REQUESTED MODE |
|
525 | // ENTER THE REQUESTED MODE | |
526 | if ( (mode == LFR_MODE_NORMAL) || (mode == LFR_MODE_BURST) |
|
526 | if ( (mode == LFR_MODE_NORMAL) || (mode == LFR_MODE_BURST) | |
527 | || (mode == LFR_MODE_SBM1) || (mode == LFR_MODE_SBM2) ) |
|
527 | || (mode == LFR_MODE_SBM1) || (mode == LFR_MODE_SBM2) ) | |
528 | { |
|
528 | { | |
529 | #ifdef PRINT_TASK_STATISTICS |
|
529 | #ifdef PRINT_TASK_STATISTICS | |
530 | rtems_cpu_usage_reset(); |
|
530 | rtems_cpu_usage_reset(); | |
531 | maxCount = 0; |
|
531 | maxCount = 0; | |
532 | #endif |
|
532 | #endif | |
533 | status = restart_science_tasks( mode ); |
|
533 | status = restart_science_tasks( mode ); | |
534 | launch_waveform_picker( mode, transitionCoarseTime ); |
|
534 | launch_waveform_picker( mode, transitionCoarseTime ); | |
535 | // launch_spectral_matrix( ); |
|
535 | // launch_spectral_matrix( ); | |
536 | launch_spectral_matrix_simu( ); |
|
536 | launch_spectral_matrix_simu( ); | |
537 | } |
|
537 | } | |
538 | else if ( mode == LFR_MODE_STANDBY ) |
|
538 | else if ( mode == LFR_MODE_STANDBY ) | |
539 | { |
|
539 | { | |
540 | #ifdef PRINT_TASK_STATISTICS |
|
540 | #ifdef PRINT_TASK_STATISTICS | |
541 | rtems_cpu_usage_report(); |
|
541 | rtems_cpu_usage_report(); | |
542 | #endif |
|
542 | #endif | |
543 |
|
543 | |||
544 | #ifdef PRINT_STACK_REPORT |
|
544 | #ifdef PRINT_STACK_REPORT | |
545 | PRINTF("stack report selected\n") |
|
545 | PRINTF("stack report selected\n") | |
546 | rtems_stack_checker_report_usage(); |
|
546 | rtems_stack_checker_report_usage(); | |
547 | #endif |
|
547 | #endif | |
548 | PRINTF1("maxCount = %d\n", maxCount) |
|
548 | PRINTF1("maxCount = %d\n", maxCount) | |
549 | } |
|
549 | } | |
550 | else |
|
550 | else | |
551 | { |
|
551 | { | |
552 | status = RTEMS_UNSATISFIED; |
|
552 | status = RTEMS_UNSATISFIED; | |
553 | } |
|
553 | } | |
554 |
|
554 | |||
555 | if (status != RTEMS_SUCCESSFUL) |
|
555 | if (status != RTEMS_SUCCESSFUL) | |
556 | { |
|
556 | { | |
557 | PRINTF1("ERR *** in enter_mode *** status = %d\n", status) |
|
557 | PRINTF1("ERR *** in enter_mode *** status = %d\n", status) | |
558 | status = RTEMS_UNSATISFIED; |
|
558 | status = RTEMS_UNSATISFIED; | |
559 | } |
|
559 | } | |
560 |
|
560 | |||
561 | return status; |
|
561 | return status; | |
562 | } |
|
562 | } | |
563 |
|
563 | |||
564 | int restart_science_tasks(unsigned char lfrRequestedMode ) |
|
564 | int restart_science_tasks(unsigned char lfrRequestedMode ) | |
565 | { |
|
565 | { | |
566 | /** This function is used to restart all science tasks. |
|
566 | /** This function is used to restart all science tasks. | |
567 | * |
|
567 | * | |
568 | * @return RTEMS directive status codes: |
|
568 | * @return RTEMS directive status codes: | |
569 | * - RTEMS_SUCCESSFUL - task restarted successfully |
|
569 | * - RTEMS_SUCCESSFUL - task restarted successfully | |
570 | * - RTEMS_INVALID_ID - task id invalid |
|
570 | * - RTEMS_INVALID_ID - task id invalid | |
571 | * - RTEMS_INCORRECT_STATE - task never started |
|
571 | * - RTEMS_INCORRECT_STATE - task never started | |
572 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task |
|
572 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task | |
573 | * |
|
573 | * | |
574 | * Science tasks are AVF0, PRC0, WFRM, CWF3, CW2, CWF1 |
|
574 | * Science tasks are AVF0, PRC0, WFRM, CWF3, CW2, CWF1 | |
575 | * |
|
575 | * | |
576 | */ |
|
576 | */ | |
577 |
|
577 | |||
578 | rtems_status_code status[10]; |
|
578 | rtems_status_code status[10]; | |
579 | rtems_status_code ret; |
|
579 | rtems_status_code ret; | |
580 |
|
580 | |||
581 | ret = RTEMS_SUCCESSFUL; |
|
581 | ret = RTEMS_SUCCESSFUL; | |
582 |
|
582 | |||
583 | status[0] = rtems_task_restart( Task_id[TASKID_AVF0], lfrRequestedMode ); |
|
583 | status[0] = rtems_task_restart( Task_id[TASKID_AVF0], lfrRequestedMode ); | |
584 | if (status[0] != RTEMS_SUCCESSFUL) |
|
584 | if (status[0] != RTEMS_SUCCESSFUL) | |
585 | { |
|
585 | { | |
586 | PRINTF1("in restart_science_task *** AVF0 ERR %d\n", status[0]) |
|
586 | PRINTF1("in restart_science_task *** AVF0 ERR %d\n", status[0]) | |
587 | } |
|
587 | } | |
588 |
|
588 | |||
589 | status[1] = rtems_task_restart( Task_id[TASKID_PRC0], lfrRequestedMode ); |
|
589 | status[1] = rtems_task_restart( Task_id[TASKID_PRC0], lfrRequestedMode ); | |
590 | if (status[1] != RTEMS_SUCCESSFUL) |
|
590 | if (status[1] != RTEMS_SUCCESSFUL) | |
591 | { |
|
591 | { | |
592 | PRINTF1("in restart_science_task *** PRC0 ERR %d\n", status[1]) |
|
592 | PRINTF1("in restart_science_task *** PRC0 ERR %d\n", status[1]) | |
593 | } |
|
593 | } | |
594 |
|
594 | |||
595 | status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 ); |
|
595 | status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 ); | |
596 | if (status[2] != RTEMS_SUCCESSFUL) |
|
596 | if (status[2] != RTEMS_SUCCESSFUL) | |
597 | { |
|
597 | { | |
598 | PRINTF1("in restart_science_task *** WFRM ERR %d\n", status[2]) |
|
598 | PRINTF1("in restart_science_task *** WFRM ERR %d\n", status[2]) | |
599 | } |
|
599 | } | |
600 |
|
600 | |||
601 | status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 ); |
|
601 | status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 ); | |
602 | if (status[3] != RTEMS_SUCCESSFUL) |
|
602 | if (status[3] != RTEMS_SUCCESSFUL) | |
603 | { |
|
603 | { | |
604 | PRINTF1("in restart_science_task *** CWF3 ERR %d\n", status[3]) |
|
604 | PRINTF1("in restart_science_task *** CWF3 ERR %d\n", status[3]) | |
605 | } |
|
605 | } | |
606 |
|
606 | |||
607 | status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 ); |
|
607 | status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 ); | |
608 | if (status[4] != RTEMS_SUCCESSFUL) |
|
608 | if (status[4] != RTEMS_SUCCESSFUL) | |
609 | { |
|
609 | { | |
610 | PRINTF1("in restart_science_task *** CWF2 ERR %d\n", status[4]) |
|
610 | PRINTF1("in restart_science_task *** CWF2 ERR %d\n", status[4]) | |
611 | } |
|
611 | } | |
612 |
|
612 | |||
613 | status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 ); |
|
613 | status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 ); | |
614 | if (status[5] != RTEMS_SUCCESSFUL) |
|
614 | if (status[5] != RTEMS_SUCCESSFUL) | |
615 | { |
|
615 | { | |
616 | PRINTF1("in restart_science_task *** CWF1 ERR %d\n", status[5]) |
|
616 | PRINTF1("in restart_science_task *** CWF1 ERR %d\n", status[5]) | |
617 | } |
|
617 | } | |
618 |
|
618 | |||
619 | status[6] = rtems_task_restart( Task_id[TASKID_AVF1], lfrRequestedMode ); |
|
619 | status[6] = rtems_task_restart( Task_id[TASKID_AVF1], lfrRequestedMode ); | |
620 | if (status[6] != RTEMS_SUCCESSFUL) |
|
620 | if (status[6] != RTEMS_SUCCESSFUL) | |
621 | { |
|
621 | { | |
622 | PRINTF1("in restart_science_task *** AVF1 ERR %d\n", status[6]) |
|
622 | PRINTF1("in restart_science_task *** AVF1 ERR %d\n", status[6]) | |
623 | } |
|
623 | } | |
624 |
|
624 | |||
625 | status[7] = rtems_task_restart( Task_id[TASKID_PRC1],lfrRequestedMode ); |
|
625 | status[7] = rtems_task_restart( Task_id[TASKID_PRC1],lfrRequestedMode ); | |
626 | if (status[7] != RTEMS_SUCCESSFUL) |
|
626 | if (status[7] != RTEMS_SUCCESSFUL) | |
627 | { |
|
627 | { | |
628 | PRINTF1("in restart_science_task *** PRC1 ERR %d\n", status[7]) |
|
628 | PRINTF1("in restart_science_task *** PRC1 ERR %d\n", status[7]) | |
629 | } |
|
629 | } | |
630 |
|
630 | |||
631 | status[8] = rtems_task_restart( Task_id[TASKID_AVF2], 1 ); |
|
631 | status[8] = rtems_task_restart( Task_id[TASKID_AVF2], 1 ); | |
632 | if (status[8] != RTEMS_SUCCESSFUL) |
|
632 | if (status[8] != RTEMS_SUCCESSFUL) | |
633 | { |
|
633 | { | |
634 | PRINTF1("in restart_science_task *** AVF2 ERR %d\n", status[8]) |
|
634 | PRINTF1("in restart_science_task *** AVF2 ERR %d\n", status[8]) | |
635 | } |
|
635 | } | |
636 |
|
636 | |||
637 | status[9] = rtems_task_restart( Task_id[TASKID_PRC2], 1 ); |
|
637 | status[9] = rtems_task_restart( Task_id[TASKID_PRC2], 1 ); | |
638 | if (status[9] != RTEMS_SUCCESSFUL) |
|
638 | if (status[9] != RTEMS_SUCCESSFUL) | |
639 | { |
|
639 | { | |
640 | PRINTF1("in restart_science_task *** PRC2 ERR %d\n", status[9]) |
|
640 | PRINTF1("in restart_science_task *** PRC2 ERR %d\n", status[9]) | |
641 | } |
|
641 | } | |
642 |
|
642 | |||
643 | if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) || |
|
643 | if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) || | |
644 | (status[2] != RTEMS_SUCCESSFUL) || (status[3] != RTEMS_SUCCESSFUL) || |
|
644 | (status[2] != RTEMS_SUCCESSFUL) || (status[3] != RTEMS_SUCCESSFUL) || | |
645 | (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) || |
|
645 | (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) || | |
646 | (status[6] != RTEMS_SUCCESSFUL) || (status[7] != RTEMS_SUCCESSFUL) || |
|
646 | (status[6] != RTEMS_SUCCESSFUL) || (status[7] != RTEMS_SUCCESSFUL) || | |
647 | (status[8] != RTEMS_SUCCESSFUL) || (status[9] != RTEMS_SUCCESSFUL) ) |
|
647 | (status[8] != RTEMS_SUCCESSFUL) || (status[9] != RTEMS_SUCCESSFUL) ) | |
648 | { |
|
648 | { | |
649 | ret = RTEMS_UNSATISFIED; |
|
649 | ret = RTEMS_UNSATISFIED; | |
650 | } |
|
650 | } | |
651 |
|
651 | |||
652 | return ret; |
|
652 | return ret; | |
653 | } |
|
653 | } | |
654 |
|
654 | |||
655 | int suspend_science_tasks() |
|
655 | int suspend_science_tasks() | |
656 | { |
|
656 | { | |
657 | /** This function suspends the science tasks. |
|
657 | /** This function suspends the science tasks. | |
658 | * |
|
658 | * | |
659 | * @return RTEMS directive status codes: |
|
659 | * @return RTEMS directive status codes: | |
660 | * - RTEMS_SUCCESSFUL - task restarted successfully |
|
660 | * - RTEMS_SUCCESSFUL - task restarted successfully | |
661 | * - RTEMS_INVALID_ID - task id invalid |
|
661 | * - RTEMS_INVALID_ID - task id invalid | |
662 | * - RTEMS_ALREADY_SUSPENDED - task already suspended |
|
662 | * - RTEMS_ALREADY_SUSPENDED - task already suspended | |
663 | * |
|
663 | * | |
664 | */ |
|
664 | */ | |
665 |
|
665 | |||
666 | rtems_status_code status; |
|
666 | rtems_status_code status; | |
667 |
|
667 | |||
668 | status = rtems_task_suspend( Task_id[TASKID_AVF0] ); // suspend AVF0 |
|
668 | status = rtems_task_suspend( Task_id[TASKID_AVF0] ); // suspend AVF0 | |
669 | if (status != RTEMS_SUCCESSFUL) |
|
669 | if (status != RTEMS_SUCCESSFUL) | |
670 | { |
|
670 | { | |
671 | PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status) |
|
671 | PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status) | |
672 | } |
|
672 | } | |
673 | if (status == RTEMS_SUCCESSFUL) // suspend PRC0 |
|
673 | if (status == RTEMS_SUCCESSFUL) // suspend PRC0 | |
674 | { |
|
674 | { | |
675 | status = rtems_task_suspend( Task_id[TASKID_PRC0] ); |
|
675 | status = rtems_task_suspend( Task_id[TASKID_PRC0] ); | |
676 | if (status != RTEMS_SUCCESSFUL) |
|
676 | if (status != RTEMS_SUCCESSFUL) | |
677 | { |
|
677 | { | |
678 | PRINTF1("in suspend_science_task *** PRC0 ERR %d\n", status) |
|
678 | PRINTF1("in suspend_science_task *** PRC0 ERR %d\n", status) | |
679 | } |
|
679 | } | |
680 | } |
|
680 | } | |
681 | if (status == RTEMS_SUCCESSFUL) // suspend AVF1 |
|
681 | if (status == RTEMS_SUCCESSFUL) // suspend AVF1 | |
682 | { |
|
682 | { | |
683 | status = rtems_task_suspend( Task_id[TASKID_AVF1] ); |
|
683 | status = rtems_task_suspend( Task_id[TASKID_AVF1] ); | |
684 | if (status != RTEMS_SUCCESSFUL) |
|
684 | if (status != RTEMS_SUCCESSFUL) | |
685 | { |
|
685 | { | |
686 | PRINTF1("in suspend_science_task *** AVF1 ERR %d\n", status) |
|
686 | PRINTF1("in suspend_science_task *** AVF1 ERR %d\n", status) | |
687 | } |
|
687 | } | |
688 | } |
|
688 | } | |
689 | if (status == RTEMS_SUCCESSFUL) // suspend PRC1 |
|
689 | if (status == RTEMS_SUCCESSFUL) // suspend PRC1 | |
690 | { |
|
690 | { | |
691 | status = rtems_task_suspend( Task_id[TASKID_PRC1] ); |
|
691 | status = rtems_task_suspend( Task_id[TASKID_PRC1] ); | |
692 | if (status != RTEMS_SUCCESSFUL) |
|
692 | if (status != RTEMS_SUCCESSFUL) | |
693 | { |
|
693 | { | |
694 | PRINTF1("in suspend_science_task *** PRC1 ERR %d\n", status) |
|
694 | PRINTF1("in suspend_science_task *** PRC1 ERR %d\n", status) | |
695 | } |
|
695 | } | |
696 | } |
|
696 | } | |
697 | if (status == RTEMS_SUCCESSFUL) // suspend AVF2 |
|
697 | if (status == RTEMS_SUCCESSFUL) // suspend AVF2 | |
698 | { |
|
698 | { | |
699 | status = rtems_task_suspend( Task_id[TASKID_AVF2] ); |
|
699 | status = rtems_task_suspend( Task_id[TASKID_AVF2] ); | |
700 | if (status != RTEMS_SUCCESSFUL) |
|
700 | if (status != RTEMS_SUCCESSFUL) | |
701 | { |
|
701 | { | |
702 | PRINTF1("in suspend_science_task *** AVF2 ERR %d\n", status) |
|
702 | PRINTF1("in suspend_science_task *** AVF2 ERR %d\n", status) | |
703 | } |
|
703 | } | |
704 | } |
|
704 | } | |
705 | if (status == RTEMS_SUCCESSFUL) // suspend PRC2 |
|
705 | if (status == RTEMS_SUCCESSFUL) // suspend PRC2 | |
706 | { |
|
706 | { | |
707 | status = rtems_task_suspend( Task_id[TASKID_PRC2] ); |
|
707 | status = rtems_task_suspend( Task_id[TASKID_PRC2] ); | |
708 | if (status != RTEMS_SUCCESSFUL) |
|
708 | if (status != RTEMS_SUCCESSFUL) | |
709 | { |
|
709 | { | |
710 | PRINTF1("in suspend_science_task *** PRC2 ERR %d\n", status) |
|
710 | PRINTF1("in suspend_science_task *** PRC2 ERR %d\n", status) | |
711 | } |
|
711 | } | |
712 | } |
|
712 | } | |
713 | if (status == RTEMS_SUCCESSFUL) // suspend WFRM |
|
713 | if (status == RTEMS_SUCCESSFUL) // suspend WFRM | |
714 | { |
|
714 | { | |
715 | status = rtems_task_suspend( Task_id[TASKID_WFRM] ); |
|
715 | status = rtems_task_suspend( Task_id[TASKID_WFRM] ); | |
716 | if (status != RTEMS_SUCCESSFUL) |
|
716 | if (status != RTEMS_SUCCESSFUL) | |
717 | { |
|
717 | { | |
718 | PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status) |
|
718 | PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status) | |
719 | } |
|
719 | } | |
720 | } |
|
720 | } | |
721 | if (status == RTEMS_SUCCESSFUL) // suspend CWF3 |
|
721 | if (status == RTEMS_SUCCESSFUL) // suspend CWF3 | |
722 | { |
|
722 | { | |
723 | status = rtems_task_suspend( Task_id[TASKID_CWF3] ); |
|
723 | status = rtems_task_suspend( Task_id[TASKID_CWF3] ); | |
724 | if (status != RTEMS_SUCCESSFUL) |
|
724 | if (status != RTEMS_SUCCESSFUL) | |
725 | { |
|
725 | { | |
726 | PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status) |
|
726 | PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status) | |
727 | } |
|
727 | } | |
728 | } |
|
728 | } | |
729 | if (status == RTEMS_SUCCESSFUL) // suspend CWF2 |
|
729 | if (status == RTEMS_SUCCESSFUL) // suspend CWF2 | |
730 | { |
|
730 | { | |
731 | status = rtems_task_suspend( Task_id[TASKID_CWF2] ); |
|
731 | status = rtems_task_suspend( Task_id[TASKID_CWF2] ); | |
732 | if (status != RTEMS_SUCCESSFUL) |
|
732 | if (status != RTEMS_SUCCESSFUL) | |
733 | { |
|
733 | { | |
734 | PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status) |
|
734 | PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status) | |
735 | } |
|
735 | } | |
736 | } |
|
736 | } | |
737 | if (status == RTEMS_SUCCESSFUL) // suspend CWF1 |
|
737 | if (status == RTEMS_SUCCESSFUL) // suspend CWF1 | |
738 | { |
|
738 | { | |
739 | status = rtems_task_suspend( Task_id[TASKID_CWF1] ); |
|
739 | status = rtems_task_suspend( Task_id[TASKID_CWF1] ); | |
740 | if (status != RTEMS_SUCCESSFUL) |
|
740 | if (status != RTEMS_SUCCESSFUL) | |
741 | { |
|
741 | { | |
742 | PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status) |
|
742 | PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status) | |
743 | } |
|
743 | } | |
744 | } |
|
744 | } | |
745 |
|
745 | |||
746 | return status; |
|
746 | return status; | |
747 | } |
|
747 | } | |
748 |
|
748 | |||
749 | void launch_waveform_picker( unsigned char mode, unsigned int transitionCoarseTime ) |
|
749 | void launch_waveform_picker( unsigned char mode, unsigned int transitionCoarseTime ) | |
750 | { |
|
750 | { | |
751 | reset_current_ring_nodes(); |
|
751 | reset_current_ring_nodes(); | |
752 | reset_waveform_picker_regs(); |
|
752 | reset_waveform_picker_regs(); | |
753 | set_wfp_burst_enable_register( mode ); |
|
753 | set_wfp_burst_enable_register( mode ); | |
754 | get_v_e1_e2_f3( NULL, NULL, NULL, true ); |
|
|||
755 |
|
754 | |||
756 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); |
|
755 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); | |
757 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); |
|
756 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); | |
758 |
|
757 | |||
759 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x80; // [1000 0000] |
|
758 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x80; // [1000 0000] | |
760 | if (transitionCoarseTime == 0) |
|
759 | if (transitionCoarseTime == 0) | |
761 | { |
|
760 | { | |
762 | waveform_picker_regs->start_date = time_management_regs->coarse_time; |
|
761 | waveform_picker_regs->start_date = time_management_regs->coarse_time; | |
763 | } |
|
762 | } | |
764 | else |
|
763 | else | |
765 | { |
|
764 | { | |
766 | waveform_picker_regs->start_date = transitionCoarseTime; |
|
765 | waveform_picker_regs->start_date = transitionCoarseTime; | |
767 | } |
|
766 | } | |
768 | } |
|
767 | } | |
769 |
|
768 | |||
770 | void launch_spectral_matrix( void ) |
|
769 | void launch_spectral_matrix( void ) | |
771 | { |
|
770 | { | |
772 | SM_reset_current_ring_nodes(); |
|
771 | SM_reset_current_ring_nodes(); | |
773 | reset_spectral_matrix_regs(); |
|
772 | reset_spectral_matrix_regs(); | |
774 | reset_nb_sm(); |
|
773 | reset_nb_sm(); | |
775 |
|
774 | |||
776 | struct grgpio_regs_str *grgpio_regs = (struct grgpio_regs_str *) REGS_ADDR_GRGPIO; |
|
775 | struct grgpio_regs_str *grgpio_regs = (struct grgpio_regs_str *) REGS_ADDR_GRGPIO; | |
777 | grgpio_regs->io_port_direction_register = |
|
776 | grgpio_regs->io_port_direction_register = | |
778 | grgpio_regs->io_port_direction_register | 0x01; // [0000 0001], 0 = output disabled, 1 = output enabled |
|
777 | grgpio_regs->io_port_direction_register | 0x01; // [0000 0001], 0 = output disabled, 1 = output enabled | |
779 | grgpio_regs->io_port_output_register = grgpio_regs->io_port_output_register & 0xfffffffe; // set the bit 0 to 0 |
|
778 | grgpio_regs->io_port_output_register = grgpio_regs->io_port_output_register & 0xfffffffe; // set the bit 0 to 0 | |
780 | set_irq_on_new_ready_matrix( 1 ); |
|
779 | set_irq_on_new_ready_matrix( 1 ); | |
781 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); |
|
780 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); | |
782 | LEON_Unmask_interrupt( IRQ_SPECTRAL_MATRIX ); |
|
781 | LEON_Unmask_interrupt( IRQ_SPECTRAL_MATRIX ); | |
783 | set_run_matrix_spectral( 1 ); |
|
782 | set_run_matrix_spectral( 1 ); | |
784 |
|
783 | |||
785 | } |
|
784 | } | |
786 |
|
785 | |||
787 | void launch_spectral_matrix_simu( void ) |
|
786 | void launch_spectral_matrix_simu( void ) | |
788 | { |
|
787 | { | |
789 | SM_reset_current_ring_nodes(); |
|
788 | SM_reset_current_ring_nodes(); | |
790 | reset_spectral_matrix_regs(); |
|
789 | reset_spectral_matrix_regs(); | |
791 | reset_nb_sm(); |
|
790 | reset_nb_sm(); | |
792 |
|
791 | |||
793 | // Spectral Matrices simulator |
|
792 | // Spectral Matrices simulator | |
794 | timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); |
|
793 | timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); | |
795 | LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); |
|
794 | LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); | |
796 | LEON_Unmask_interrupt( IRQ_SM_SIMULATOR ); |
|
795 | LEON_Unmask_interrupt( IRQ_SM_SIMULATOR ); | |
797 | set_local_nb_interrupt_f0_MAX(); |
|
796 | set_local_nb_interrupt_f0_MAX(); | |
798 | } |
|
797 | } | |
799 |
|
798 | |||
800 | void set_irq_on_new_ready_matrix( unsigned char value ) |
|
799 | void set_irq_on_new_ready_matrix( unsigned char value ) | |
801 | { |
|
800 | { | |
802 | if (value == 1) |
|
801 | if (value == 1) | |
803 | { |
|
802 | { | |
804 | spectral_matrix_regs->config = spectral_matrix_regs->config | 0x01; |
|
803 | spectral_matrix_regs->config = spectral_matrix_regs->config | 0x01; | |
805 | } |
|
804 | } | |
806 | else |
|
805 | else | |
807 | { |
|
806 | { | |
808 | spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffe; // 1110 |
|
807 | spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffe; // 1110 | |
809 | } |
|
808 | } | |
810 | } |
|
809 | } | |
811 |
|
810 | |||
812 | void set_run_matrix_spectral( unsigned char value ) |
|
811 | void set_run_matrix_spectral( unsigned char value ) | |
813 | { |
|
812 | { | |
814 | if (value == 1) |
|
813 | if (value == 1) | |
815 | { |
|
814 | { | |
816 | spectral_matrix_regs->config = spectral_matrix_regs->config | 0x4; // [0100] set run_matrix spectral to 1 |
|
815 | spectral_matrix_regs->config = spectral_matrix_regs->config | 0x4; // [0100] set run_matrix spectral to 1 | |
817 | } |
|
816 | } | |
818 | else |
|
817 | else | |
819 | { |
|
818 | { | |
820 | spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffb; // [1011] set run_matrix spectral to 0 |
|
819 | spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffb; // [1011] set run_matrix spectral to 0 | |
821 | } |
|
820 | } | |
822 | } |
|
821 | } | |
823 |
|
822 | |||
824 | //**************** |
|
823 | //**************** | |
825 | // CLOSING ACTIONS |
|
824 | // CLOSING ACTIONS | |
826 | void update_last_TC_exe( ccsdsTelecommandPacket_t *TC, unsigned char * time ) |
|
825 | void update_last_TC_exe( ccsdsTelecommandPacket_t *TC, unsigned char * time ) | |
827 | { |
|
826 | { | |
828 | /** This function is used to update the HK packets statistics after a successful TC execution. |
|
827 | /** This function is used to update the HK packets statistics after a successful TC execution. | |
829 | * |
|
828 | * | |
830 | * @param TC points to the TC being processed |
|
829 | * @param TC points to the TC being processed | |
831 | * @param time is the time used to date the TC execution |
|
830 | * @param time is the time used to date the TC execution | |
832 | * |
|
831 | * | |
833 | */ |
|
832 | */ | |
834 |
|
833 | |||
835 | unsigned int val; |
|
834 | unsigned int val; | |
836 |
|
835 | |||
837 | housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0]; |
|
836 | housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0]; | |
838 | housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1]; |
|
837 | housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1]; | |
839 | housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00; |
|
838 | housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00; | |
840 | housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType; |
|
839 | housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType; | |
841 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00; |
|
840 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00; | |
842 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType; |
|
841 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType; | |
843 | housekeeping_packet.hk_lfr_last_exe_tc_time[0] = time[0]; |
|
842 | housekeeping_packet.hk_lfr_last_exe_tc_time[0] = time[0]; | |
844 | housekeeping_packet.hk_lfr_last_exe_tc_time[1] = time[1]; |
|
843 | housekeeping_packet.hk_lfr_last_exe_tc_time[1] = time[1]; | |
845 | housekeeping_packet.hk_lfr_last_exe_tc_time[2] = time[2]; |
|
844 | housekeeping_packet.hk_lfr_last_exe_tc_time[2] = time[2]; | |
846 | housekeeping_packet.hk_lfr_last_exe_tc_time[3] = time[3]; |
|
845 | housekeeping_packet.hk_lfr_last_exe_tc_time[3] = time[3]; | |
847 | housekeeping_packet.hk_lfr_last_exe_tc_time[4] = time[4]; |
|
846 | housekeeping_packet.hk_lfr_last_exe_tc_time[4] = time[4]; | |
848 | housekeeping_packet.hk_lfr_last_exe_tc_time[5] = time[5]; |
|
847 | housekeeping_packet.hk_lfr_last_exe_tc_time[5] = time[5]; | |
849 |
|
848 | |||
850 | val = housekeeping_packet.hk_lfr_exe_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_exe_tc_cnt[1]; |
|
849 | val = housekeeping_packet.hk_lfr_exe_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_exe_tc_cnt[1]; | |
851 | val++; |
|
850 | val++; | |
852 | housekeeping_packet.hk_lfr_exe_tc_cnt[0] = (unsigned char) (val >> 8); |
|
851 | housekeeping_packet.hk_lfr_exe_tc_cnt[0] = (unsigned char) (val >> 8); | |
853 | housekeeping_packet.hk_lfr_exe_tc_cnt[1] = (unsigned char) (val); |
|
852 | housekeeping_packet.hk_lfr_exe_tc_cnt[1] = (unsigned char) (val); | |
854 | } |
|
853 | } | |
855 |
|
854 | |||
856 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char * time ) |
|
855 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char * time ) | |
857 | { |
|
856 | { | |
858 | /** This function is used to update the HK packets statistics after a TC rejection. |
|
857 | /** This function is used to update the HK packets statistics after a TC rejection. | |
859 | * |
|
858 | * | |
860 | * @param TC points to the TC being processed |
|
859 | * @param TC points to the TC being processed | |
861 | * @param time is the time used to date the TC rejection |
|
860 | * @param time is the time used to date the TC rejection | |
862 | * |
|
861 | * | |
863 | */ |
|
862 | */ | |
864 |
|
863 | |||
865 | unsigned int val; |
|
864 | unsigned int val; | |
866 |
|
865 | |||
867 | housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0]; |
|
866 | housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0]; | |
868 | housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1]; |
|
867 | housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1]; | |
869 | housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00; |
|
868 | housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00; | |
870 | housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType; |
|
869 | housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType; | |
871 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00; |
|
870 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00; | |
872 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType; |
|
871 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType; | |
873 | housekeeping_packet.hk_lfr_last_rej_tc_time[0] = time[0]; |
|
872 | housekeeping_packet.hk_lfr_last_rej_tc_time[0] = time[0]; | |
874 | housekeeping_packet.hk_lfr_last_rej_tc_time[1] = time[1]; |
|
873 | housekeeping_packet.hk_lfr_last_rej_tc_time[1] = time[1]; | |
875 | housekeeping_packet.hk_lfr_last_rej_tc_time[2] = time[2]; |
|
874 | housekeeping_packet.hk_lfr_last_rej_tc_time[2] = time[2]; | |
876 | housekeeping_packet.hk_lfr_last_rej_tc_time[3] = time[3]; |
|
875 | housekeeping_packet.hk_lfr_last_rej_tc_time[3] = time[3]; | |
877 | housekeeping_packet.hk_lfr_last_rej_tc_time[4] = time[4]; |
|
876 | housekeeping_packet.hk_lfr_last_rej_tc_time[4] = time[4]; | |
878 | housekeeping_packet.hk_lfr_last_rej_tc_time[5] = time[5]; |
|
877 | housekeeping_packet.hk_lfr_last_rej_tc_time[5] = time[5]; | |
879 |
|
878 | |||
880 | val = housekeeping_packet.hk_lfr_rej_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_rej_tc_cnt[1]; |
|
879 | val = housekeeping_packet.hk_lfr_rej_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_rej_tc_cnt[1]; | |
881 | val++; |
|
880 | val++; | |
882 | housekeeping_packet.hk_lfr_rej_tc_cnt[0] = (unsigned char) (val >> 8); |
|
881 | housekeeping_packet.hk_lfr_rej_tc_cnt[0] = (unsigned char) (val >> 8); | |
883 | housekeeping_packet.hk_lfr_rej_tc_cnt[1] = (unsigned char) (val); |
|
882 | housekeeping_packet.hk_lfr_rej_tc_cnt[1] = (unsigned char) (val); | |
884 | } |
|
883 | } | |
885 |
|
884 | |||
886 | void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id ) |
|
885 | void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id ) | |
887 | { |
|
886 | { | |
888 | /** This function is the last step of the TC execution workflow. |
|
887 | /** This function is the last step of the TC execution workflow. | |
889 | * |
|
888 | * | |
890 | * @param TC points to the TC being processed |
|
889 | * @param TC points to the TC being processed | |
891 | * @param result is the result of the TC execution (LFR_SUCCESSFUL / LFR_DEFAULT) |
|
890 | * @param result is the result of the TC execution (LFR_SUCCESSFUL / LFR_DEFAULT) | |
892 | * @param queue_id is the id of the RTEMS message queue used to send TM packets |
|
891 | * @param queue_id is the id of the RTEMS message queue used to send TM packets | |
893 | * @param time is the time used to date the TC execution |
|
892 | * @param time is the time used to date the TC execution | |
894 | * |
|
893 | * | |
895 | */ |
|
894 | */ | |
896 |
|
895 | |||
897 | unsigned char requestedMode; |
|
896 | unsigned char requestedMode; | |
898 |
|
897 | |||
899 | if (result == LFR_SUCCESSFUL) |
|
898 | if (result == LFR_SUCCESSFUL) | |
900 | { |
|
899 | { | |
901 | if ( !( (TC->serviceType==TC_TYPE_TIME) & (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) ) |
|
900 | if ( !( (TC->serviceType==TC_TYPE_TIME) & (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) ) | |
902 | & |
|
901 | & | |
903 | !( (TC->serviceType==TC_TYPE_GEN) & (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO)) |
|
902 | !( (TC->serviceType==TC_TYPE_GEN) & (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO)) | |
904 | ) |
|
903 | ) | |
905 | { |
|
904 | { | |
906 | send_tm_lfr_tc_exe_success( TC, queue_id ); |
|
905 | send_tm_lfr_tc_exe_success( TC, queue_id ); | |
907 | } |
|
906 | } | |
908 | if ( (TC->serviceType == TC_TYPE_GEN) & (TC->serviceSubType == TC_SUBTYPE_ENTER) ) |
|
907 | if ( (TC->serviceType == TC_TYPE_GEN) & (TC->serviceSubType == TC_SUBTYPE_ENTER) ) | |
909 | { |
|
908 | { | |
910 | //********************************** |
|
909 | //********************************** | |
911 | // UPDATE THE LFRMODE LOCAL VARIABLE |
|
910 | // UPDATE THE LFRMODE LOCAL VARIABLE | |
912 | requestedMode = TC->dataAndCRC[1]; |
|
911 | requestedMode = TC->dataAndCRC[1]; | |
913 | housekeeping_packet.lfr_status_word[0] = (unsigned char) ((requestedMode << 4) + 0x0d); |
|
912 | housekeeping_packet.lfr_status_word[0] = (unsigned char) ((requestedMode << 4) + 0x0d); | |
914 | updateLFRCurrentMode(); |
|
913 | updateLFRCurrentMode(); | |
915 | } |
|
914 | } | |
916 | } |
|
915 | } | |
917 | else if (result == LFR_EXE_ERROR) |
|
916 | else if (result == LFR_EXE_ERROR) | |
918 | { |
|
917 | { | |
919 | send_tm_lfr_tc_exe_error( TC, queue_id ); |
|
918 | send_tm_lfr_tc_exe_error( TC, queue_id ); | |
920 | } |
|
919 | } | |
921 | } |
|
920 | } | |
922 |
|
921 | |||
923 | //*************************** |
|
922 | //*************************** | |
924 | // Interrupt Service Routines |
|
923 | // Interrupt Service Routines | |
925 | rtems_isr commutation_isr1( rtems_vector_number vector ) |
|
924 | rtems_isr commutation_isr1( rtems_vector_number vector ) | |
926 | { |
|
925 | { | |
927 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
926 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { | |
928 | printf("In commutation_isr1 *** Error sending event to DUMB\n"); |
|
927 | printf("In commutation_isr1 *** Error sending event to DUMB\n"); | |
929 | } |
|
928 | } | |
930 | } |
|
929 | } | |
931 |
|
930 | |||
932 | rtems_isr commutation_isr2( rtems_vector_number vector ) |
|
931 | rtems_isr commutation_isr2( rtems_vector_number vector ) | |
933 | { |
|
932 | { | |
934 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
933 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { | |
935 | printf("In commutation_isr2 *** Error sending event to DUMB\n"); |
|
934 | printf("In commutation_isr2 *** Error sending event to DUMB\n"); | |
936 | } |
|
935 | } | |
937 | } |
|
936 | } | |
938 |
|
937 | |||
939 | //**************** |
|
938 | //**************** | |
940 | // OTHER FUNCTIONS |
|
939 | // OTHER FUNCTIONS | |
941 | void updateLFRCurrentMode() |
|
940 | void updateLFRCurrentMode() | |
942 | { |
|
941 | { | |
943 | /** This function updates the value of the global variable lfrCurrentMode. |
|
942 | /** This function updates the value of the global variable lfrCurrentMode. | |
944 | * |
|
943 | * | |
945 | * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running. |
|
944 | * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running. | |
946 | * |
|
945 | * | |
947 | */ |
|
946 | */ | |
948 | // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure |
|
947 | // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure | |
949 | lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
948 | lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
950 | } |
|
949 | } | |
951 |
|
950 |
@@ -1,1347 +1,1348 | |||||
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 *current_ring_node_f0; |
|
30 | ring_node *current_ring_node_f0; | |
31 | ring_node *ring_node_to_send_swf_f0; |
|
31 | ring_node *ring_node_to_send_swf_f0; | |
32 | ring_node *current_ring_node_f1; |
|
32 | ring_node *current_ring_node_f1; | |
33 | ring_node *ring_node_to_send_swf_f1; |
|
33 | ring_node *ring_node_to_send_swf_f1; | |
34 | ring_node *ring_node_to_send_cwf_f1; |
|
34 | ring_node *ring_node_to_send_cwf_f1; | |
35 | ring_node *current_ring_node_f2; |
|
35 | ring_node *current_ring_node_f2; | |
36 | ring_node *ring_node_to_send_swf_f2; |
|
36 | ring_node *ring_node_to_send_swf_f2; | |
37 | ring_node *ring_node_to_send_cwf_f2; |
|
37 | ring_node *ring_node_to_send_cwf_f2; | |
38 |
|
38 | |||
39 | bool extractSWF = false; |
|
39 | bool extractSWF = false; | |
40 | bool swf_f0_ready = false; |
|
40 | bool swf_f0_ready = false; | |
41 | bool swf_f1_ready = false; |
|
41 | bool swf_f1_ready = false; | |
42 | bool swf_f2_ready = false; |
|
42 | bool swf_f2_ready = false; | |
43 |
|
43 | |||
44 | int wf_snap_extracted[ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET ]; |
|
44 | int wf_snap_extracted[ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET ]; | |
45 |
|
45 | |||
46 | //********************* |
|
46 | //********************* | |
47 | // Interrupt SubRoutine |
|
47 | // Interrupt SubRoutine | |
48 |
|
48 | |||
49 | void reset_extractSWF( void ) |
|
49 | void reset_extractSWF( void ) | |
50 | { |
|
50 | { | |
51 | extractSWF = false; |
|
51 | extractSWF = false; | |
52 | swf_f0_ready = false; |
|
52 | swf_f0_ready = false; | |
53 | swf_f1_ready = false; |
|
53 | swf_f1_ready = false; | |
54 | swf_f2_ready = false; |
|
54 | swf_f2_ready = false; | |
55 | } |
|
55 | } | |
56 |
|
56 | |||
57 | rtems_isr waveforms_isr( rtems_vector_number vector ) |
|
57 | rtems_isr waveforms_isr( rtems_vector_number vector ) | |
58 | { |
|
58 | { | |
59 | /** This is the interrupt sub routine called by the waveform picker core. |
|
59 | /** This is the interrupt sub routine called by the waveform picker core. | |
60 | * |
|
60 | * | |
61 | * This ISR launch different actions depending mainly on two pieces of information: |
|
61 | * This ISR launch different actions depending mainly on two pieces of information: | |
62 | * 1. the values read in the registers of the waveform picker. |
|
62 | * 1. the values read in the registers of the waveform picker. | |
63 | * 2. the current LFR mode. |
|
63 | * 2. the current LFR mode. | |
64 | * |
|
64 | * | |
65 | */ |
|
65 | */ | |
66 |
|
66 | |||
67 | rtems_status_code status; |
|
67 | rtems_status_code status; | |
68 |
|
68 | |||
69 | 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 |
|
69 | 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 | |
70 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
70 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) | |
71 | { // in modes other than STANDBY and BURST, send the CWF_F3 data |
|
71 | { // in modes other than STANDBY and BURST, send the CWF_F3 data | |
72 | if ((waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full |
|
72 | if ((waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full | |
73 | // (1) change the receiving buffer for the waveform picker |
|
73 | // (1) change the receiving buffer for the waveform picker | |
74 | if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3_a) { |
|
74 | if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3_a) { | |
75 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_b); |
|
75 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_b); | |
76 | } |
|
76 | } | |
77 | else { |
|
77 | else { | |
78 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a); |
|
78 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a); | |
79 | } |
|
79 | } | |
80 | // (2) send an event for the waveforms transmission |
|
80 | // (2) send an event for the waveforms transmission | |
81 | if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
81 | if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { | |
82 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
82 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
83 | } |
|
83 | } | |
|
84 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2); | |||
84 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff777; // reset f3 bits to 0, [1111 0111 0111 0111] |
|
85 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff777; // reset f3 bits to 0, [1111 0111 0111 0111] | |
85 | } |
|
86 | } | |
86 | } |
|
87 | } | |
87 |
|
88 | |||
88 | switch(lfrCurrentMode) |
|
89 | switch(lfrCurrentMode) | |
89 | { |
|
90 | { | |
90 | //******** |
|
91 | //******** | |
91 | // STANDBY |
|
92 | // STANDBY | |
92 | case(LFR_MODE_STANDBY): |
|
93 | case(LFR_MODE_STANDBY): | |
93 | break; |
|
94 | break; | |
94 |
|
95 | |||
95 | //****** |
|
96 | //****** | |
96 | // NORMAL |
|
97 | // NORMAL | |
97 | case(LFR_MODE_NORMAL): |
|
98 | case(LFR_MODE_NORMAL): | |
98 | if ( (waveform_picker_regs->status & 0xff8) != 0x00) // [1000] check the error bits |
|
99 | if ( (waveform_picker_regs->status & 0xff8) != 0x00) // [1000] check the error bits | |
99 | { |
|
100 | { | |
100 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
101 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
101 | } |
|
102 | } | |
102 | if ( (waveform_picker_regs->status & 0x07) == 0x07) // [0111] check the f2, f1, f0 full bits |
|
103 | if ( (waveform_picker_regs->status & 0x07) == 0x07) // [0111] check the f2, f1, f0 full bits | |
103 | { |
|
104 | { | |
104 | // change F0 ring node |
|
105 | // change F0 ring node | |
105 | ring_node_to_send_swf_f0 = current_ring_node_f0; |
|
106 | ring_node_to_send_swf_f0 = current_ring_node_f0; | |
106 | current_ring_node_f0 = current_ring_node_f0->next; |
|
107 | current_ring_node_f0 = current_ring_node_f0->next; | |
107 | waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address; |
|
108 | waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address; | |
108 | // change F1 ring node |
|
109 | // change F1 ring node | |
109 | ring_node_to_send_swf_f1 = current_ring_node_f1; |
|
110 | ring_node_to_send_swf_f1 = current_ring_node_f1; | |
110 | current_ring_node_f1 = current_ring_node_f1->next; |
|
111 | current_ring_node_f1 = current_ring_node_f1->next; | |
111 | waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; |
|
112 | waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; | |
112 | // change F2 ring node |
|
113 | // change F2 ring node | |
113 | ring_node_to_send_swf_f2 = current_ring_node_f2; |
|
114 | ring_node_to_send_swf_f2 = current_ring_node_f2; | |
114 | current_ring_node_f2 = current_ring_node_f2->next; |
|
115 | current_ring_node_f2 = current_ring_node_f2->next; | |
115 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; |
|
116 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; | |
116 | // |
|
117 | // | |
117 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) |
|
118 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) | |
118 | { |
|
119 | { | |
119 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
120 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
120 | } |
|
121 | } | |
121 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff888; // [1000 1000 1000] |
|
122 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff888; // [1000 1000 1000] | |
122 | } |
|
123 | } | |
123 | break; |
|
124 | break; | |
124 |
|
125 | |||
125 | //****** |
|
126 | //****** | |
126 | // BURST |
|
127 | // BURST | |
127 | case(LFR_MODE_BURST): |
|
128 | case(LFR_MODE_BURST): | |
128 | if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit |
|
129 | if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit | |
129 | // (1) change the receiving buffer for the waveform picker |
|
130 | // (1) change the receiving buffer for the waveform picker | |
130 | ring_node_to_send_cwf_f2 = current_ring_node_f2; |
|
131 | ring_node_to_send_cwf_f2 = current_ring_node_f2; | |
131 | current_ring_node_f2 = current_ring_node_f2->next; |
|
132 | current_ring_node_f2 = current_ring_node_f2->next; | |
132 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; |
|
133 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; | |
133 | // (2) send an event for the waveforms transmission |
|
134 | // (2) send an event for the waveforms transmission | |
134 | if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) { |
|
135 | if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) { | |
135 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
136 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
136 | } |
|
137 | } | |
137 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0 |
|
138 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0 | |
138 | } |
|
139 | } | |
139 | break; |
|
140 | break; | |
140 |
|
141 | |||
141 | //***** |
|
142 | //***** | |
142 | // SBM1 |
|
143 | // SBM1 | |
143 | case(LFR_MODE_SBM1): |
|
144 | case(LFR_MODE_SBM1): | |
144 | if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit |
|
145 | if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit | |
145 | // (1) change the receiving buffer for the waveform picker |
|
146 | // (1) change the receiving buffer for the waveform picker | |
146 | ring_node_to_send_cwf_f1 = current_ring_node_f1; |
|
147 | ring_node_to_send_cwf_f1 = current_ring_node_f1; | |
147 | current_ring_node_f1 = current_ring_node_f1->next; |
|
148 | current_ring_node_f1 = current_ring_node_f1->next; | |
148 | waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; |
|
149 | waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; | |
149 | // (2) send an event for the the CWF1 task for transmission (and snapshot extraction if needed) |
|
150 | // (2) send an event for the the CWF1 task for transmission (and snapshot extraction if needed) | |
150 | status = rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 ); |
|
151 | status = rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 ); | |
151 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bits = 0 |
|
152 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bits = 0 | |
152 | } |
|
153 | } | |
153 | if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit |
|
154 | if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit | |
154 | swf_f0_ready = true; |
|
155 | swf_f0_ready = true; | |
155 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffeee; // [1111 1110 1110 1110] f0 bits = 0 |
|
156 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffeee; // [1111 1110 1110 1110] f0 bits = 0 | |
156 | } |
|
157 | } | |
157 | if ( (waveform_picker_regs->status & 0x04) == 0x04 ) { // [0100] check the f2 full bit |
|
158 | if ( (waveform_picker_regs->status & 0x04) == 0x04 ) { // [0100] check the f2 full bit | |
158 | swf_f2_ready = true; |
|
159 | swf_f2_ready = true; | |
159 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bits = 0 |
|
160 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bits = 0 | |
160 | } |
|
161 | } | |
161 | break; |
|
162 | break; | |
162 |
|
163 | |||
163 | //***** |
|
164 | //***** | |
164 | // SBM2 |
|
165 | // SBM2 | |
165 | case(LFR_MODE_SBM2): |
|
166 | case(LFR_MODE_SBM2): | |
166 | if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit |
|
167 | if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit | |
167 | // (1) change the receiving buffer for the waveform picker |
|
168 | // (1) change the receiving buffer for the waveform picker | |
168 | ring_node_to_send_cwf_f2 = current_ring_node_f2; |
|
169 | ring_node_to_send_cwf_f2 = current_ring_node_f2; | |
169 | current_ring_node_f2 = current_ring_node_f2->next; |
|
170 | current_ring_node_f2 = current_ring_node_f2->next; | |
170 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; |
|
171 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; | |
171 | // (2) send an event for the waveforms transmission |
|
172 | // (2) send an event for the waveforms transmission | |
172 | status = rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 ); |
|
173 | status = rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 ); | |
173 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0 |
|
174 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0 | |
174 | } |
|
175 | } | |
175 | if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit |
|
176 | if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit | |
176 | swf_f0_ready = true; |
|
177 | swf_f0_ready = true; | |
177 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffeee; // [1111 1110 1110 1110] f0 bits = 0 |
|
178 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffeee; // [1111 1110 1110 1110] f0 bits = 0 | |
178 | } |
|
179 | } | |
179 | if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit |
|
180 | if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit | |
180 | swf_f1_ready = true; |
|
181 | swf_f1_ready = true; | |
181 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1, f0 bits = 0 |
|
182 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1, f0 bits = 0 | |
182 | } |
|
183 | } | |
183 | break; |
|
184 | break; | |
184 |
|
185 | |||
185 | //******** |
|
186 | //******** | |
186 | // DEFAULT |
|
187 | // DEFAULT | |
187 | default: |
|
188 | default: | |
188 | break; |
|
189 | break; | |
189 | } |
|
190 | } | |
190 | } |
|
191 | } | |
191 |
|
192 | |||
192 | //************ |
|
193 | //************ | |
193 | // RTEMS TASKS |
|
194 | // RTEMS TASKS | |
194 |
|
195 | |||
195 | rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP |
|
196 | rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP | |
196 | { |
|
197 | { | |
197 | /** This RTEMS task is dedicated to the transmission of snapshots of the NORMAL mode. |
|
198 | /** This RTEMS task is dedicated to the transmission of snapshots of the NORMAL mode. | |
198 | * |
|
199 | * | |
199 | * @param unused is the starting argument of the RTEMS task |
|
200 | * @param unused is the starting argument of the RTEMS task | |
200 | * |
|
201 | * | |
201 | * The following data packets are sent by this task: |
|
202 | * The following data packets are sent by this task: | |
202 | * - TM_LFR_SCIENCE_NORMAL_SWF_F0 |
|
203 | * - TM_LFR_SCIENCE_NORMAL_SWF_F0 | |
203 | * - TM_LFR_SCIENCE_NORMAL_SWF_F1 |
|
204 | * - TM_LFR_SCIENCE_NORMAL_SWF_F1 | |
204 | * - TM_LFR_SCIENCE_NORMAL_SWF_F2 |
|
205 | * - TM_LFR_SCIENCE_NORMAL_SWF_F2 | |
205 | * |
|
206 | * | |
206 | */ |
|
207 | */ | |
207 |
|
208 | |||
208 | rtems_event_set event_out; |
|
209 | rtems_event_set event_out; | |
209 | rtems_id queue_id; |
|
210 | rtems_id queue_id; | |
210 | rtems_status_code status; |
|
211 | rtems_status_code status; | |
211 |
|
212 | |||
212 | init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 ); |
|
213 | init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 ); | |
213 | init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 ); |
|
214 | init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 ); | |
214 | init_header_snapshot_wf_table( SID_NORM_SWF_F2, headerSWF_F2 ); |
|
215 | init_header_snapshot_wf_table( SID_NORM_SWF_F2, headerSWF_F2 ); | |
215 |
|
216 | |||
216 | init_waveforms(); |
|
217 | init_waveforms(); | |
217 |
|
218 | |||
218 | status = get_message_queue_id_send( &queue_id ); |
|
219 | status = get_message_queue_id_send( &queue_id ); | |
219 | if (status != RTEMS_SUCCESSFUL) |
|
220 | if (status != RTEMS_SUCCESSFUL) | |
220 | { |
|
221 | { | |
221 | PRINTF1("in WFRM *** ERR get_message_queue_id_send %d\n", status) |
|
222 | PRINTF1("in WFRM *** ERR get_message_queue_id_send %d\n", status) | |
222 | } |
|
223 | } | |
223 |
|
224 | |||
224 | BOOT_PRINTF("in WFRM ***\n") |
|
225 | BOOT_PRINTF("in WFRM ***\n") | |
225 |
|
226 | |||
226 | while(1){ |
|
227 | while(1){ | |
227 | // wait for an RTEMS_EVENT |
|
228 | // wait for an RTEMS_EVENT | |
228 | rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1 |
|
229 | rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1 | |
229 | | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM, |
|
230 | | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM, | |
230 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
231 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
231 | if (event_out == RTEMS_EVENT_MODE_NORMAL) |
|
232 | if (event_out == RTEMS_EVENT_MODE_NORMAL) | |
232 | { |
|
233 | { | |
233 | DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_NORMAL\n") |
|
234 | DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_NORMAL\n") | |
234 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id); |
|
235 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id); | |
235 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id); |
|
236 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id); | |
236 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id); |
|
237 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id); | |
237 | } |
|
238 | } | |
238 | if (event_out == RTEMS_EVENT_MODE_SBM1) |
|
239 | if (event_out == RTEMS_EVENT_MODE_SBM1) | |
239 | { |
|
240 | { | |
240 | DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM1\n") |
|
241 | DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM1\n") | |
241 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id); |
|
242 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id); | |
242 | send_waveform_SWF((volatile int*) wf_snap_extracted , SID_NORM_SWF_F1, headerSWF_F1, queue_id); |
|
243 | send_waveform_SWF((volatile int*) wf_snap_extracted , SID_NORM_SWF_F1, headerSWF_F1, queue_id); | |
243 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id); |
|
244 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id); | |
244 | } |
|
245 | } | |
245 | if (event_out == RTEMS_EVENT_MODE_SBM2) |
|
246 | if (event_out == RTEMS_EVENT_MODE_SBM2) | |
246 | { |
|
247 | { | |
247 | DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM2\n") |
|
248 | DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM2\n") | |
248 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id); |
|
249 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id); | |
249 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id); |
|
250 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id); | |
250 | send_waveform_SWF((volatile int*) wf_snap_extracted , SID_NORM_SWF_F2, headerSWF_F2, queue_id); |
|
251 | send_waveform_SWF((volatile int*) wf_snap_extracted , SID_NORM_SWF_F2, headerSWF_F2, queue_id); | |
251 | } |
|
252 | } | |
252 | } |
|
253 | } | |
253 | } |
|
254 | } | |
254 |
|
255 | |||
255 | rtems_task cwf3_task(rtems_task_argument argument) //used with the waveform picker VHDL IP |
|
256 | rtems_task cwf3_task(rtems_task_argument argument) //used with the waveform picker VHDL IP | |
256 | { |
|
257 | { | |
257 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f3. |
|
258 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f3. | |
258 | * |
|
259 | * | |
259 | * @param unused is the starting argument of the RTEMS task |
|
260 | * @param unused is the starting argument of the RTEMS task | |
260 | * |
|
261 | * | |
261 | * The following data packet is sent by this task: |
|
262 | * The following data packet is sent by this task: | |
262 | * - TM_LFR_SCIENCE_NORMAL_CWF_F3 |
|
263 | * - TM_LFR_SCIENCE_NORMAL_CWF_F3 | |
263 | * |
|
264 | * | |
264 | */ |
|
265 | */ | |
265 |
|
266 | |||
266 | rtems_event_set event_out; |
|
267 | rtems_event_set event_out; | |
267 | rtems_id queue_id; |
|
268 | rtems_id queue_id; | |
268 | rtems_status_code status; |
|
269 | rtems_status_code status; | |
269 |
|
270 | |||
270 | init_header_continuous_wf_table( SID_NORM_CWF_LONG_F3, headerCWF_F3 ); |
|
271 | init_header_continuous_wf_table( SID_NORM_CWF_LONG_F3, headerCWF_F3 ); | |
271 | init_header_continuous_cwf3_light_table( headerCWF_F3_light ); |
|
272 | init_header_continuous_cwf3_light_table( headerCWF_F3_light ); | |
272 |
|
273 | |||
273 | status = get_message_queue_id_send( &queue_id ); |
|
274 | status = get_message_queue_id_send( &queue_id ); | |
274 | if (status != RTEMS_SUCCESSFUL) |
|
275 | if (status != RTEMS_SUCCESSFUL) | |
275 | { |
|
276 | { | |
276 | PRINTF1("in CWF3 *** ERR get_message_queue_id_send %d\n", status) |
|
277 | PRINTF1("in CWF3 *** ERR get_message_queue_id_send %d\n", status) | |
277 | } |
|
278 | } | |
278 |
|
279 | |||
279 | BOOT_PRINTF("in CWF3 ***\n") |
|
280 | BOOT_PRINTF("in CWF3 ***\n") | |
280 |
|
281 | |||
281 | while(1){ |
|
282 | while(1){ | |
282 | // wait for an RTEMS_EVENT |
|
283 | // wait for an RTEMS_EVENT | |
283 | rtems_event_receive( RTEMS_EVENT_0, |
|
284 | rtems_event_receive( RTEMS_EVENT_0, | |
284 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
285 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
285 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) |
|
286 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) | |
286 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode==LFR_MODE_SBM2) ) |
|
287 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode==LFR_MODE_SBM2) ) | |
287 | { |
|
288 | { | |
288 | if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01) |
|
289 | if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01) | |
289 | { |
|
290 | { | |
290 | PRINTF("send CWF_LONG_F3\n") |
|
291 | PRINTF("send CWF_LONG_F3\n") | |
291 | } |
|
292 | } | |
292 | else |
|
293 | else | |
293 | { |
|
294 | { | |
294 | PRINTF("send CWF_F3 (light)\n") |
|
295 | PRINTF("send CWF_F3 (light)\n") | |
295 | } |
|
296 | } | |
296 | if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3_a) { |
|
297 | if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3_a) { | |
297 | if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01) |
|
298 | if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01) | |
298 | { |
|
299 | { | |
299 | send_waveform_CWF( wf_cont_f3_b, SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id ); |
|
300 | send_waveform_CWF( wf_cont_f3_b, SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id ); | |
300 | } |
|
301 | } | |
301 | else |
|
302 | else | |
302 | { |
|
303 | { | |
303 | send_waveform_CWF3_light( wf_cont_f3_b, headerCWF_F3_light, queue_id ); |
|
304 | send_waveform_CWF3_light( wf_cont_f3_b, headerCWF_F3_light, queue_id ); | |
304 | } |
|
305 | } | |
305 | } |
|
306 | } | |
306 | else |
|
307 | else | |
307 | { |
|
308 | { | |
308 | if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01) |
|
309 | if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01) | |
309 | { |
|
310 | { | |
310 | send_waveform_CWF( wf_cont_f3_a, SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id ); |
|
311 | send_waveform_CWF( wf_cont_f3_a, SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id ); | |
311 | } |
|
312 | } | |
312 | else |
|
313 | else | |
313 | { |
|
314 | { | |
314 | send_waveform_CWF3_light( wf_cont_f3_a, headerCWF_F3_light, queue_id ); |
|
315 | send_waveform_CWF3_light( wf_cont_f3_a, headerCWF_F3_light, queue_id ); | |
315 | } |
|
316 | } | |
316 |
|
317 | |||
317 | } |
|
318 | } | |
318 | } |
|
319 | } | |
319 | else |
|
320 | else | |
320 | { |
|
321 | { | |
321 | PRINTF1("in CWF3 *** lfrCurrentMode is %d, no data will be sent\n", lfrCurrentMode) |
|
322 | PRINTF1("in CWF3 *** lfrCurrentMode is %d, no data will be sent\n", lfrCurrentMode) | |
322 | } |
|
323 | } | |
323 | } |
|
324 | } | |
324 | } |
|
325 | } | |
325 |
|
326 | |||
326 | rtems_task cwf2_task(rtems_task_argument argument) // ONLY USED IN BURST AND SBM2 |
|
327 | rtems_task cwf2_task(rtems_task_argument argument) // ONLY USED IN BURST AND SBM2 | |
327 | { |
|
328 | { | |
328 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f2. |
|
329 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f2. | |
329 | * |
|
330 | * | |
330 | * @param unused is the starting argument of the RTEMS task |
|
331 | * @param unused is the starting argument of the RTEMS task | |
331 | * |
|
332 | * | |
332 | * The following data packet is sent by this function: |
|
333 | * The following data packet is sent by this function: | |
333 | * - TM_LFR_SCIENCE_BURST_CWF_F2 |
|
334 | * - TM_LFR_SCIENCE_BURST_CWF_F2 | |
334 | * - TM_LFR_SCIENCE_SBM2_CWF_F2 |
|
335 | * - TM_LFR_SCIENCE_SBM2_CWF_F2 | |
335 | * |
|
336 | * | |
336 | */ |
|
337 | */ | |
337 |
|
338 | |||
338 | rtems_event_set event_out; |
|
339 | rtems_event_set event_out; | |
339 | rtems_id queue_id; |
|
340 | rtems_id queue_id; | |
340 | rtems_status_code status; |
|
341 | rtems_status_code status; | |
341 |
|
342 | |||
342 | init_header_continuous_wf_table( SID_BURST_CWF_F2, headerCWF_F2_BURST ); |
|
343 | init_header_continuous_wf_table( SID_BURST_CWF_F2, headerCWF_F2_BURST ); | |
343 | init_header_continuous_wf_table( SID_SBM2_CWF_F2, headerCWF_F2_SBM2 ); |
|
344 | init_header_continuous_wf_table( SID_SBM2_CWF_F2, headerCWF_F2_SBM2 ); | |
344 |
|
345 | |||
345 | status = get_message_queue_id_send( &queue_id ); |
|
346 | status = get_message_queue_id_send( &queue_id ); | |
346 | if (status != RTEMS_SUCCESSFUL) |
|
347 | if (status != RTEMS_SUCCESSFUL) | |
347 | { |
|
348 | { | |
348 | PRINTF1("in CWF2 *** ERR get_message_queue_id_send %d\n", status) |
|
349 | PRINTF1("in CWF2 *** ERR get_message_queue_id_send %d\n", status) | |
349 | } |
|
350 | } | |
350 |
|
351 | |||
351 | BOOT_PRINTF("in CWF2 ***\n") |
|
352 | BOOT_PRINTF("in CWF2 ***\n") | |
352 |
|
353 | |||
353 | while(1){ |
|
354 | while(1){ | |
354 | // wait for an RTEMS_EVENT |
|
355 | // wait for an RTEMS_EVENT | |
355 | rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2, |
|
356 | rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2, | |
356 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
357 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
357 | if (event_out == RTEMS_EVENT_MODE_BURST) |
|
358 | if (event_out == RTEMS_EVENT_MODE_BURST) | |
358 | { |
|
359 | { | |
359 | send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id ); |
|
360 | send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id ); | |
360 | } |
|
361 | } | |
361 | if (event_out == RTEMS_EVENT_MODE_SBM2) |
|
362 | if (event_out == RTEMS_EVENT_MODE_SBM2) | |
362 | { |
|
363 | { | |
363 | send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id ); |
|
364 | send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id ); | |
364 | // launch snapshot extraction if needed |
|
365 | // launch snapshot extraction if needed | |
365 | if (extractSWF == true) |
|
366 | if (extractSWF == true) | |
366 | { |
|
367 | { | |
367 | ring_node_to_send_swf_f2 = ring_node_to_send_cwf_f2; |
|
368 | ring_node_to_send_swf_f2 = ring_node_to_send_cwf_f2; | |
368 | // extract the snapshot |
|
369 | // extract the snapshot | |
369 | build_snapshot_from_ring( ring_node_to_send_swf_f2, 2 ); |
|
370 | build_snapshot_from_ring( ring_node_to_send_swf_f2, 2 ); | |
370 | // send the snapshot when built |
|
371 | // send the snapshot when built | |
371 | status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 ); |
|
372 | status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 ); | |
372 | extractSWF = false; |
|
373 | extractSWF = false; | |
373 | } |
|
374 | } | |
374 | if (swf_f0_ready && swf_f1_ready) |
|
375 | if (swf_f0_ready && swf_f1_ready) | |
375 | { |
|
376 | { | |
376 | extractSWF = true; |
|
377 | extractSWF = true; | |
377 | swf_f0_ready = false; |
|
378 | swf_f0_ready = false; | |
378 | swf_f1_ready = false; |
|
379 | swf_f1_ready = false; | |
379 | } |
|
380 | } | |
380 | } |
|
381 | } | |
381 | } |
|
382 | } | |
382 | } |
|
383 | } | |
383 |
|
384 | |||
384 | rtems_task cwf1_task(rtems_task_argument argument) // ONLY USED IN SBM1 |
|
385 | rtems_task cwf1_task(rtems_task_argument argument) // ONLY USED IN SBM1 | |
385 | { |
|
386 | { | |
386 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f1. |
|
387 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f1. | |
387 | * |
|
388 | * | |
388 | * @param unused is the starting argument of the RTEMS task |
|
389 | * @param unused is the starting argument of the RTEMS task | |
389 | * |
|
390 | * | |
390 | * The following data packet is sent by this function: |
|
391 | * The following data packet is sent by this function: | |
391 | * - TM_LFR_SCIENCE_SBM1_CWF_F1 |
|
392 | * - TM_LFR_SCIENCE_SBM1_CWF_F1 | |
392 | * |
|
393 | * | |
393 | */ |
|
394 | */ | |
394 |
|
395 | |||
395 | rtems_event_set event_out; |
|
396 | rtems_event_set event_out; | |
396 | rtems_id queue_id; |
|
397 | rtems_id queue_id; | |
397 | rtems_status_code status; |
|
398 | rtems_status_code status; | |
398 |
|
399 | |||
399 | init_header_continuous_wf_table( SID_SBM1_CWF_F1, headerCWF_F1 ); |
|
400 | init_header_continuous_wf_table( SID_SBM1_CWF_F1, headerCWF_F1 ); | |
400 |
|
401 | |||
401 | status = get_message_queue_id_send( &queue_id ); |
|
402 | status = get_message_queue_id_send( &queue_id ); | |
402 | if (status != RTEMS_SUCCESSFUL) |
|
403 | if (status != RTEMS_SUCCESSFUL) | |
403 | { |
|
404 | { | |
404 | PRINTF1("in CWF1 *** ERR get_message_queue_id_send %d\n", status) |
|
405 | PRINTF1("in CWF1 *** ERR get_message_queue_id_send %d\n", status) | |
405 | } |
|
406 | } | |
406 |
|
407 | |||
407 | BOOT_PRINTF("in CWF1 ***\n") |
|
408 | BOOT_PRINTF("in CWF1 ***\n") | |
408 |
|
409 | |||
409 | while(1){ |
|
410 | while(1){ | |
410 | // wait for an RTEMS_EVENT |
|
411 | // wait for an RTEMS_EVENT | |
411 | rtems_event_receive( RTEMS_EVENT_MODE_SBM1, |
|
412 | rtems_event_receive( RTEMS_EVENT_MODE_SBM1, | |
412 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
413 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
413 | send_waveform_CWF( (volatile int*) ring_node_to_send_cwf_f1->buffer_address, SID_SBM1_CWF_F1, headerCWF_F1, queue_id ); |
|
414 | send_waveform_CWF( (volatile int*) ring_node_to_send_cwf_f1->buffer_address, SID_SBM1_CWF_F1, headerCWF_F1, queue_id ); | |
414 | // launch snapshot extraction if needed |
|
415 | // launch snapshot extraction if needed | |
415 | if (extractSWF == true) |
|
416 | if (extractSWF == true) | |
416 | { |
|
417 | { | |
417 | ring_node_to_send_swf_f1 = ring_node_to_send_cwf_f1; |
|
418 | ring_node_to_send_swf_f1 = ring_node_to_send_cwf_f1; | |
418 | // launch the snapshot extraction |
|
419 | // launch the snapshot extraction | |
419 | status = rtems_event_send( Task_id[TASKID_SWBD], RTEMS_EVENT_MODE_SBM1 ); |
|
420 | status = rtems_event_send( Task_id[TASKID_SWBD], RTEMS_EVENT_MODE_SBM1 ); | |
420 | extractSWF = false; |
|
421 | extractSWF = false; | |
421 | } |
|
422 | } | |
422 | if (swf_f0_ready == true) |
|
423 | if (swf_f0_ready == true) | |
423 | { |
|
424 | { | |
424 | extractSWF = true; |
|
425 | extractSWF = true; | |
425 | swf_f0_ready = false; // this step shall be executed only one time |
|
426 | swf_f0_ready = false; // this step shall be executed only one time | |
426 | } |
|
427 | } | |
427 | if ((swf_f1_ready == true) && (swf_f2_ready == true)) // swf_f1 is ready after the extraction |
|
428 | if ((swf_f1_ready == true) && (swf_f2_ready == true)) // swf_f1 is ready after the extraction | |
428 | { |
|
429 | { | |
429 | status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM1 ); |
|
430 | status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM1 ); | |
430 | swf_f1_ready = false; |
|
431 | swf_f1_ready = false; | |
431 | swf_f2_ready = false; |
|
432 | swf_f2_ready = false; | |
432 | } |
|
433 | } | |
433 | } |
|
434 | } | |
434 | } |
|
435 | } | |
435 |
|
436 | |||
436 | rtems_task swbd_task(rtems_task_argument argument) |
|
437 | rtems_task swbd_task(rtems_task_argument argument) | |
437 | { |
|
438 | { | |
438 | /** This RTEMS task is dedicated to the building of snapshots from different continuous waveforms buffers. |
|
439 | /** This RTEMS task is dedicated to the building of snapshots from different continuous waveforms buffers. | |
439 | * |
|
440 | * | |
440 | * @param unused is the starting argument of the RTEMS task |
|
441 | * @param unused is the starting argument of the RTEMS task | |
441 | * |
|
442 | * | |
442 | */ |
|
443 | */ | |
443 |
|
444 | |||
444 | rtems_event_set event_out; |
|
445 | rtems_event_set event_out; | |
445 |
|
446 | |||
446 | BOOT_PRINTF("in SWBD ***\n") |
|
447 | BOOT_PRINTF("in SWBD ***\n") | |
447 |
|
448 | |||
448 | while(1){ |
|
449 | while(1){ | |
449 | // wait for an RTEMS_EVENT |
|
450 | // wait for an RTEMS_EVENT | |
450 | rtems_event_receive( RTEMS_EVENT_MODE_SBM1 | RTEMS_EVENT_MODE_SBM2, |
|
451 | rtems_event_receive( RTEMS_EVENT_MODE_SBM1 | RTEMS_EVENT_MODE_SBM2, | |
451 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
452 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
452 | if (event_out == RTEMS_EVENT_MODE_SBM1) |
|
453 | if (event_out == RTEMS_EVENT_MODE_SBM1) | |
453 | { |
|
454 | { | |
454 | build_snapshot_from_ring( ring_node_to_send_swf_f1, 1 ); |
|
455 | build_snapshot_from_ring( ring_node_to_send_swf_f1, 1 ); | |
455 | swf_f1_ready = true; // the snapshot has been extracted and is ready to be sent |
|
456 | swf_f1_ready = true; // the snapshot has been extracted and is ready to be sent | |
456 | } |
|
457 | } | |
457 | else |
|
458 | else | |
458 | { |
|
459 | { | |
459 | PRINTF1("in SWBD *** unexpected rtems event received %x\n", (int) event_out) |
|
460 | PRINTF1("in SWBD *** unexpected rtems event received %x\n", (int) event_out) | |
460 | } |
|
461 | } | |
461 | } |
|
462 | } | |
462 | } |
|
463 | } | |
463 |
|
464 | |||
464 | //****************** |
|
465 | //****************** | |
465 | // general functions |
|
466 | // general functions | |
466 | void init_waveforms( void ) |
|
467 | void init_waveforms( void ) | |
467 | { |
|
468 | { | |
468 | int i = 0; |
|
469 | int i = 0; | |
469 |
|
470 | |||
470 | for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++) |
|
471 | for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++) | |
471 | { |
|
472 | { | |
472 | //*** |
|
473 | //*** | |
473 | // F0 |
|
474 | // F0 | |
474 | // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x88887777; // |
|
475 | // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x88887777; // | |
475 | // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; // |
|
476 | // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; // | |
476 | // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x44443333; // |
|
477 | // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x44443333; // | |
477 |
|
478 | |||
478 | //*** |
|
479 | //*** | |
479 | // F1 |
|
480 | // F1 | |
480 | // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x22221111; |
|
481 | // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x22221111; | |
481 | // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x44443333; |
|
482 | // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x44443333; | |
482 | // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000; |
|
483 | // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000; | |
483 |
|
484 | |||
484 | //*** |
|
485 | //*** | |
485 | // F2 |
|
486 | // F2 | |
486 | // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x44443333; |
|
487 | // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x44443333; | |
487 | // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; |
|
488 | // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; | |
488 | // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000; |
|
489 | // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000; | |
489 |
|
490 | |||
490 | //*** |
|
491 | //*** | |
491 | // F3 |
|
492 | // F3 | |
492 | // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 0 ] = val1; |
|
493 | // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 0 ] = val1; | |
493 | // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 1 ] = val2; |
|
494 | // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 1 ] = val2; | |
494 | // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 2 ] = 0xaaaa0000; |
|
495 | // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 2 ] = 0xaaaa0000; | |
495 | } |
|
496 | } | |
496 | } |
|
497 | } | |
497 |
|
498 | |||
498 | void init_waveform_rings( void ) |
|
499 | void init_waveform_rings( void ) | |
499 | { |
|
500 | { | |
500 | unsigned char i; |
|
501 | unsigned char i; | |
501 |
|
502 | |||
502 | // F0 RING |
|
503 | // F0 RING | |
503 | waveform_ring_f0[0].next = (ring_node*) &waveform_ring_f0[1]; |
|
504 | waveform_ring_f0[0].next = (ring_node*) &waveform_ring_f0[1]; | |
504 | waveform_ring_f0[0].previous = (ring_node*) &waveform_ring_f0[NB_RING_NODES_F0-1]; |
|
505 | waveform_ring_f0[0].previous = (ring_node*) &waveform_ring_f0[NB_RING_NODES_F0-1]; | |
505 | waveform_ring_f0[0].buffer_address = (int) &wf_snap_f0[0][0]; |
|
506 | waveform_ring_f0[0].buffer_address = (int) &wf_snap_f0[0][0]; | |
506 |
|
507 | |||
507 | waveform_ring_f0[NB_RING_NODES_F0-1].next = (ring_node*) &waveform_ring_f0[0]; |
|
508 | waveform_ring_f0[NB_RING_NODES_F0-1].next = (ring_node*) &waveform_ring_f0[0]; | |
508 | waveform_ring_f0[NB_RING_NODES_F0-1].previous = (ring_node*) &waveform_ring_f0[NB_RING_NODES_F0-2]; |
|
509 | waveform_ring_f0[NB_RING_NODES_F0-1].previous = (ring_node*) &waveform_ring_f0[NB_RING_NODES_F0-2]; | |
509 | waveform_ring_f0[NB_RING_NODES_F0-1].buffer_address = (int) &wf_snap_f0[NB_RING_NODES_F0-1][0]; |
|
510 | waveform_ring_f0[NB_RING_NODES_F0-1].buffer_address = (int) &wf_snap_f0[NB_RING_NODES_F0-1][0]; | |
510 |
|
511 | |||
511 | for(i=1; i<NB_RING_NODES_F0-1; i++) |
|
512 | for(i=1; i<NB_RING_NODES_F0-1; i++) | |
512 | { |
|
513 | { | |
513 | waveform_ring_f0[i].next = (ring_node*) &waveform_ring_f0[i+1]; |
|
514 | waveform_ring_f0[i].next = (ring_node*) &waveform_ring_f0[i+1]; | |
514 | waveform_ring_f0[i].previous = (ring_node*) &waveform_ring_f0[i-1]; |
|
515 | waveform_ring_f0[i].previous = (ring_node*) &waveform_ring_f0[i-1]; | |
515 | waveform_ring_f0[i].buffer_address = (int) &wf_snap_f0[i][0]; |
|
516 | waveform_ring_f0[i].buffer_address = (int) &wf_snap_f0[i][0]; | |
516 | } |
|
517 | } | |
517 |
|
518 | |||
518 | // F1 RING |
|
519 | // F1 RING | |
519 | waveform_ring_f1[0].next = (ring_node*) &waveform_ring_f1[1]; |
|
520 | waveform_ring_f1[0].next = (ring_node*) &waveform_ring_f1[1]; | |
520 | waveform_ring_f1[0].previous = (ring_node*) &waveform_ring_f1[NB_RING_NODES_F1-1]; |
|
521 | waveform_ring_f1[0].previous = (ring_node*) &waveform_ring_f1[NB_RING_NODES_F1-1]; | |
521 | waveform_ring_f1[0].buffer_address = (int) &wf_snap_f1[0][0]; |
|
522 | waveform_ring_f1[0].buffer_address = (int) &wf_snap_f1[0][0]; | |
522 |
|
523 | |||
523 | waveform_ring_f1[NB_RING_NODES_F1-1].next = (ring_node*) &waveform_ring_f1[0]; |
|
524 | waveform_ring_f1[NB_RING_NODES_F1-1].next = (ring_node*) &waveform_ring_f1[0]; | |
524 | waveform_ring_f1[NB_RING_NODES_F1-1].previous = (ring_node*) &waveform_ring_f1[NB_RING_NODES_F1-2]; |
|
525 | waveform_ring_f1[NB_RING_NODES_F1-1].previous = (ring_node*) &waveform_ring_f1[NB_RING_NODES_F1-2]; | |
525 | waveform_ring_f1[NB_RING_NODES_F1-1].buffer_address = (int) &wf_snap_f1[NB_RING_NODES_F1-1][0]; |
|
526 | waveform_ring_f1[NB_RING_NODES_F1-1].buffer_address = (int) &wf_snap_f1[NB_RING_NODES_F1-1][0]; | |
526 |
|
527 | |||
527 | for(i=1; i<NB_RING_NODES_F1-1; i++) |
|
528 | for(i=1; i<NB_RING_NODES_F1-1; i++) | |
528 | { |
|
529 | { | |
529 | waveform_ring_f1[i].next = (ring_node*) &waveform_ring_f1[i+1]; |
|
530 | waveform_ring_f1[i].next = (ring_node*) &waveform_ring_f1[i+1]; | |
530 | waveform_ring_f1[i].previous = (ring_node*) &waveform_ring_f1[i-1]; |
|
531 | waveform_ring_f1[i].previous = (ring_node*) &waveform_ring_f1[i-1]; | |
531 | waveform_ring_f1[i].buffer_address = (int) &wf_snap_f1[i][0]; |
|
532 | waveform_ring_f1[i].buffer_address = (int) &wf_snap_f1[i][0]; | |
532 | } |
|
533 | } | |
533 |
|
534 | |||
534 | // F2 RING |
|
535 | // F2 RING | |
535 | waveform_ring_f2[0].next = (ring_node*) &waveform_ring_f2[1]; |
|
536 | waveform_ring_f2[0].next = (ring_node*) &waveform_ring_f2[1]; | |
536 | waveform_ring_f2[0].previous = (ring_node*) &waveform_ring_f2[NB_RING_NODES_F2-1]; |
|
537 | waveform_ring_f2[0].previous = (ring_node*) &waveform_ring_f2[NB_RING_NODES_F2-1]; | |
537 | waveform_ring_f2[0].buffer_address = (int) &wf_snap_f2[0][0]; |
|
538 | waveform_ring_f2[0].buffer_address = (int) &wf_snap_f2[0][0]; | |
538 |
|
539 | |||
539 | waveform_ring_f2[NB_RING_NODES_F2-1].next = (ring_node*) &waveform_ring_f2[0]; |
|
540 | waveform_ring_f2[NB_RING_NODES_F2-1].next = (ring_node*) &waveform_ring_f2[0]; | |
540 | waveform_ring_f2[NB_RING_NODES_F2-1].previous = (ring_node*) &waveform_ring_f2[NB_RING_NODES_F2-2]; |
|
541 | waveform_ring_f2[NB_RING_NODES_F2-1].previous = (ring_node*) &waveform_ring_f2[NB_RING_NODES_F2-2]; | |
541 | waveform_ring_f2[NB_RING_NODES_F2-1].buffer_address = (int) &wf_snap_f2[NB_RING_NODES_F2-1][0]; |
|
542 | waveform_ring_f2[NB_RING_NODES_F2-1].buffer_address = (int) &wf_snap_f2[NB_RING_NODES_F2-1][0]; | |
542 |
|
543 | |||
543 | for(i=1; i<NB_RING_NODES_F2-1; i++) |
|
544 | for(i=1; i<NB_RING_NODES_F2-1; i++) | |
544 | { |
|
545 | { | |
545 | waveform_ring_f2[i].next = (ring_node*) &waveform_ring_f2[i+1]; |
|
546 | waveform_ring_f2[i].next = (ring_node*) &waveform_ring_f2[i+1]; | |
546 | waveform_ring_f2[i].previous = (ring_node*) &waveform_ring_f2[i-1]; |
|
547 | waveform_ring_f2[i].previous = (ring_node*) &waveform_ring_f2[i-1]; | |
547 | waveform_ring_f2[i].buffer_address = (int) &wf_snap_f2[i][0]; |
|
548 | waveform_ring_f2[i].buffer_address = (int) &wf_snap_f2[i][0]; | |
548 | } |
|
549 | } | |
549 |
|
550 | |||
550 | DEBUG_PRINTF1("waveform_ring_f0 @%x\n", (unsigned int) waveform_ring_f0) |
|
551 | DEBUG_PRINTF1("waveform_ring_f0 @%x\n", (unsigned int) waveform_ring_f0) | |
551 | DEBUG_PRINTF1("waveform_ring_f1 @%x\n", (unsigned int) waveform_ring_f1) |
|
552 | DEBUG_PRINTF1("waveform_ring_f1 @%x\n", (unsigned int) waveform_ring_f1) | |
552 | DEBUG_PRINTF1("waveform_ring_f2 @%x\n", (unsigned int) waveform_ring_f2) |
|
553 | DEBUG_PRINTF1("waveform_ring_f2 @%x\n", (unsigned int) waveform_ring_f2) | |
553 |
|
554 | |||
554 | } |
|
555 | } | |
555 |
|
556 | |||
556 | void reset_current_ring_nodes( void ) |
|
557 | void reset_current_ring_nodes( void ) | |
557 | { |
|
558 | { | |
558 | current_ring_node_f0 = waveform_ring_f0; |
|
559 | current_ring_node_f0 = waveform_ring_f0; | |
559 | ring_node_to_send_swf_f0 = waveform_ring_f0; |
|
560 | ring_node_to_send_swf_f0 = waveform_ring_f0; | |
560 |
|
561 | |||
561 | current_ring_node_f1 = waveform_ring_f1; |
|
562 | current_ring_node_f1 = waveform_ring_f1; | |
562 | ring_node_to_send_cwf_f1 = waveform_ring_f1; |
|
563 | ring_node_to_send_cwf_f1 = waveform_ring_f1; | |
563 | ring_node_to_send_swf_f1 = waveform_ring_f1; |
|
564 | ring_node_to_send_swf_f1 = waveform_ring_f1; | |
564 |
|
565 | |||
565 | current_ring_node_f2 = waveform_ring_f2; |
|
566 | current_ring_node_f2 = waveform_ring_f2; | |
566 | ring_node_to_send_cwf_f2 = waveform_ring_f2; |
|
567 | ring_node_to_send_cwf_f2 = waveform_ring_f2; | |
567 | ring_node_to_send_swf_f2 = waveform_ring_f2; |
|
568 | ring_node_to_send_swf_f2 = waveform_ring_f2; | |
568 | } |
|
569 | } | |
569 |
|
570 | |||
570 | int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF) |
|
571 | int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF) | |
571 | { |
|
572 | { | |
572 | unsigned char i; |
|
573 | unsigned char i; | |
573 |
|
574 | |||
574 | for (i=0; i<7; i++) |
|
575 | for (i=0; i<7; i++) | |
575 | { |
|
576 | { | |
576 | headerSWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
577 | headerSWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; | |
577 | headerSWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
578 | headerSWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
578 | headerSWF[ i ].reserved = DEFAULT_RESERVED; |
|
579 | headerSWF[ i ].reserved = DEFAULT_RESERVED; | |
579 | headerSWF[ i ].userApplication = CCSDS_USER_APP; |
|
580 | headerSWF[ i ].userApplication = CCSDS_USER_APP; | |
580 | headerSWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8); |
|
581 | headerSWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8); | |
581 | headerSWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST); |
|
582 | headerSWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST); | |
582 | headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
583 | headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
583 | if (i == 6) |
|
584 | if (i == 6) | |
584 | { |
|
585 | { | |
585 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_224 >> 8); |
|
586 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_224 >> 8); | |
586 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_224 ); |
|
587 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_224 ); | |
587 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_224 >> 8); |
|
588 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_224 >> 8); | |
588 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_224 ); |
|
589 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_224 ); | |
589 | } |
|
590 | } | |
590 | else |
|
591 | else | |
591 | { |
|
592 | { | |
592 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_304 >> 8); |
|
593 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_304 >> 8); | |
593 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_304 ); |
|
594 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_304 ); | |
594 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_304 >> 8); |
|
595 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_304 >> 8); | |
595 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_304 ); |
|
596 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_304 ); | |
596 | } |
|
597 | } | |
597 | headerSWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
598 | headerSWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
598 | headerSWF[ i ].pktCnt = DEFAULT_PKTCNT; // PKT_CNT |
|
599 | headerSWF[ i ].pktCnt = DEFAULT_PKTCNT; // PKT_CNT | |
599 | headerSWF[ i ].pktNr = i+1; // PKT_NR |
|
600 | headerSWF[ i ].pktNr = i+1; // PKT_NR | |
600 | // DATA FIELD HEADER |
|
601 | // DATA FIELD HEADER | |
601 | headerSWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
602 | headerSWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
602 | headerSWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
603 | headerSWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
603 | headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
604 | headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
604 | headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; |
|
605 | headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; | |
605 | // AUXILIARY DATA HEADER |
|
606 | // AUXILIARY DATA HEADER | |
606 | headerSWF[ i ].time[0] = 0x00; |
|
607 | headerSWF[ i ].time[0] = 0x00; | |
607 | headerSWF[ i ].time[0] = 0x00; |
|
608 | headerSWF[ i ].time[0] = 0x00; | |
608 | headerSWF[ i ].time[0] = 0x00; |
|
609 | headerSWF[ i ].time[0] = 0x00; | |
609 | headerSWF[ i ].time[0] = 0x00; |
|
610 | headerSWF[ i ].time[0] = 0x00; | |
610 | headerSWF[ i ].time[0] = 0x00; |
|
611 | headerSWF[ i ].time[0] = 0x00; | |
611 | headerSWF[ i ].time[0] = 0x00; |
|
612 | headerSWF[ i ].time[0] = 0x00; | |
612 | headerSWF[ i ].sid = sid; |
|
613 | headerSWF[ i ].sid = sid; | |
613 | headerSWF[ i ].hkBIA = DEFAULT_HKBIA; |
|
614 | headerSWF[ i ].hkBIA = DEFAULT_HKBIA; | |
614 | } |
|
615 | } | |
615 | return LFR_SUCCESSFUL; |
|
616 | return LFR_SUCCESSFUL; | |
616 | } |
|
617 | } | |
617 |
|
618 | |||
618 | int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF ) |
|
619 | int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF ) | |
619 | { |
|
620 | { | |
620 | unsigned int i; |
|
621 | unsigned int i; | |
621 |
|
622 | |||
622 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF; i++) |
|
623 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF; i++) | |
623 | { |
|
624 | { | |
624 | headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
625 | headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; | |
625 | headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
626 | headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
626 | headerCWF[ i ].reserved = DEFAULT_RESERVED; |
|
627 | headerCWF[ i ].reserved = DEFAULT_RESERVED; | |
627 | headerCWF[ i ].userApplication = CCSDS_USER_APP; |
|
628 | headerCWF[ i ].userApplication = CCSDS_USER_APP; | |
628 | if ( (sid == SID_SBM1_CWF_F1) || (sid == SID_SBM2_CWF_F2) ) |
|
629 | if ( (sid == SID_SBM1_CWF_F1) || (sid == SID_SBM2_CWF_F2) ) | |
629 | { |
|
630 | { | |
630 | headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_SBM1_SBM2 >> 8); |
|
631 | headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_SBM1_SBM2 >> 8); | |
631 | headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_SBM1_SBM2); |
|
632 | headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_SBM1_SBM2); | |
632 | } |
|
633 | } | |
633 | else |
|
634 | else | |
634 | { |
|
635 | { | |
635 | headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8); |
|
636 | headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8); | |
636 | headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST); |
|
637 | headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST); | |
637 | } |
|
638 | } | |
638 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
639 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
639 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_336 >> 8); |
|
640 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_336 >> 8); | |
640 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_336 ); |
|
641 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_336 ); | |
641 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF >> 8); |
|
642 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF >> 8); | |
642 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF ); |
|
643 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF ); | |
643 | headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
644 | headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
644 | // DATA FIELD HEADER |
|
645 | // DATA FIELD HEADER | |
645 | headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
646 | headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
646 | headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
647 | headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
647 | headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
648 | headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
648 | headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; |
|
649 | headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; | |
649 | // AUXILIARY DATA HEADER |
|
650 | // AUXILIARY DATA HEADER | |
650 | headerCWF[ i ].sid = sid; |
|
651 | headerCWF[ i ].sid = sid; | |
651 | headerCWF[ i ].hkBIA = DEFAULT_HKBIA; |
|
652 | headerCWF[ i ].hkBIA = DEFAULT_HKBIA; | |
652 | headerCWF[ i ].time[0] = 0x00; |
|
653 | headerCWF[ i ].time[0] = 0x00; | |
653 | headerCWF[ i ].time[0] = 0x00; |
|
654 | headerCWF[ i ].time[0] = 0x00; | |
654 | headerCWF[ i ].time[0] = 0x00; |
|
655 | headerCWF[ i ].time[0] = 0x00; | |
655 | headerCWF[ i ].time[0] = 0x00; |
|
656 | headerCWF[ i ].time[0] = 0x00; | |
656 | headerCWF[ i ].time[0] = 0x00; |
|
657 | headerCWF[ i ].time[0] = 0x00; | |
657 | headerCWF[ i ].time[0] = 0x00; |
|
658 | headerCWF[ i ].time[0] = 0x00; | |
658 | } |
|
659 | } | |
659 | return LFR_SUCCESSFUL; |
|
660 | return LFR_SUCCESSFUL; | |
660 | } |
|
661 | } | |
661 |
|
662 | |||
662 | int init_header_continuous_cwf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF ) |
|
663 | int init_header_continuous_cwf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF ) | |
663 | { |
|
664 | { | |
664 | unsigned int i; |
|
665 | unsigned int i; | |
665 |
|
666 | |||
666 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF_LIGHT; i++) |
|
667 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF_LIGHT; i++) | |
667 | { |
|
668 | { | |
668 | headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
669 | headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; | |
669 | headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
670 | headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
670 | headerCWF[ i ].reserved = DEFAULT_RESERVED; |
|
671 | headerCWF[ i ].reserved = DEFAULT_RESERVED; | |
671 | headerCWF[ i ].userApplication = CCSDS_USER_APP; |
|
672 | headerCWF[ i ].userApplication = CCSDS_USER_APP; | |
672 |
|
673 | |||
673 | headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8); |
|
674 | headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8); | |
674 | headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST); |
|
675 | headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST); | |
675 |
|
676 | |||
676 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
677 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
677 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_672 >> 8); |
|
678 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_672 >> 8); | |
678 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_672 ); |
|
679 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_672 ); | |
679 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF_SHORT_F3 >> 8); |
|
680 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF_SHORT_F3 >> 8); | |
680 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF_SHORT_F3 ); |
|
681 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF_SHORT_F3 ); | |
681 |
|
682 | |||
682 | headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
683 | headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
683 | // DATA FIELD HEADER |
|
684 | // DATA FIELD HEADER | |
684 | headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
685 | headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
685 | headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
686 | headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
686 | headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
687 | headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
687 | headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; |
|
688 | headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; | |
688 | // AUXILIARY DATA HEADER |
|
689 | // AUXILIARY DATA HEADER | |
689 | headerCWF[ i ].sid = SID_NORM_CWF_F3; |
|
690 | headerCWF[ i ].sid = SID_NORM_CWF_F3; | |
690 | headerCWF[ i ].hkBIA = DEFAULT_HKBIA; |
|
691 | headerCWF[ i ].hkBIA = DEFAULT_HKBIA; | |
691 | headerCWF[ i ].time[0] = 0x00; |
|
692 | headerCWF[ i ].time[0] = 0x00; | |
692 | headerCWF[ i ].time[0] = 0x00; |
|
693 | headerCWF[ i ].time[0] = 0x00; | |
693 | headerCWF[ i ].time[0] = 0x00; |
|
694 | headerCWF[ i ].time[0] = 0x00; | |
694 | headerCWF[ i ].time[0] = 0x00; |
|
695 | headerCWF[ i ].time[0] = 0x00; | |
695 | headerCWF[ i ].time[0] = 0x00; |
|
696 | headerCWF[ i ].time[0] = 0x00; | |
696 | headerCWF[ i ].time[0] = 0x00; |
|
697 | headerCWF[ i ].time[0] = 0x00; | |
697 | } |
|
698 | } | |
698 | return LFR_SUCCESSFUL; |
|
699 | return LFR_SUCCESSFUL; | |
699 | } |
|
700 | } | |
700 |
|
701 | |||
701 | int send_waveform_SWF( volatile int *waveform, unsigned int sid, |
|
702 | int send_waveform_SWF( volatile int *waveform, unsigned int sid, | |
702 | Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id ) |
|
703 | Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id ) | |
703 | { |
|
704 | { | |
704 | /** This function sends SWF CCSDS packets (F2, F1 or F0). |
|
705 | /** This function sends SWF CCSDS packets (F2, F1 or F0). | |
705 | * |
|
706 | * | |
706 | * @param waveform points to the buffer containing the data that will be send. |
|
707 | * @param waveform points to the buffer containing the data that will be send. | |
707 | * @param sid is the source identifier of the data that will be sent. |
|
708 | * @param sid is the source identifier of the data that will be sent. | |
708 | * @param headerSWF points to a table of headers that have been prepared for the data transmission. |
|
709 | * @param headerSWF points to a table of headers that have been prepared for the data transmission. | |
709 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures |
|
710 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures | |
710 | * contain information to setup the transmission of the data packets. |
|
711 | * contain information to setup the transmission of the data packets. | |
711 | * |
|
712 | * | |
712 | * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks. |
|
713 | * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks. | |
713 | * |
|
714 | * | |
714 | */ |
|
715 | */ | |
715 |
|
716 | |||
716 | unsigned int i; |
|
717 | unsigned int i; | |
717 | int ret; |
|
718 | int ret; | |
718 | unsigned int coarseTime; |
|
719 | unsigned int coarseTime; | |
719 | unsigned int fineTime; |
|
720 | unsigned int fineTime; | |
720 | rtems_status_code status; |
|
721 | rtems_status_code status; | |
721 | spw_ioctl_pkt_send spw_ioctl_send_SWF; |
|
722 | spw_ioctl_pkt_send spw_ioctl_send_SWF; | |
722 |
|
723 | |||
723 | spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header |
|
724 | spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header | |
724 | spw_ioctl_send_SWF.options = 0; |
|
725 | spw_ioctl_send_SWF.options = 0; | |
725 |
|
726 | |||
726 | ret = LFR_DEFAULT; |
|
727 | ret = LFR_DEFAULT; | |
727 |
|
728 | |||
728 | coarseTime = waveform[0]; |
|
729 | coarseTime = waveform[0]; | |
729 | fineTime = waveform[1]; |
|
730 | fineTime = waveform[1]; | |
730 |
|
731 | |||
731 | for (i=0; i<7; i++) // send waveform |
|
732 | for (i=0; i<7; i++) // send waveform | |
732 | { |
|
733 | { | |
733 | spw_ioctl_send_SWF.data = (char*) &waveform[ (i * BLK_NR_304 * NB_WORDS_SWF_BLK) + TIME_OFFSET]; |
|
734 | spw_ioctl_send_SWF.data = (char*) &waveform[ (i * BLK_NR_304 * NB_WORDS_SWF_BLK) + TIME_OFFSET]; | |
734 | spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ]; |
|
735 | spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ]; | |
735 | // BUILD THE DATA |
|
736 | // BUILD THE DATA | |
736 | if (i==6) { |
|
737 | if (i==6) { | |
737 | spw_ioctl_send_SWF.dlen = BLK_NR_224 * NB_BYTES_SWF_BLK; |
|
738 | spw_ioctl_send_SWF.dlen = BLK_NR_224 * NB_BYTES_SWF_BLK; | |
738 | } |
|
739 | } | |
739 | else { |
|
740 | else { | |
740 | spw_ioctl_send_SWF.dlen = BLK_NR_304 * NB_BYTES_SWF_BLK; |
|
741 | spw_ioctl_send_SWF.dlen = BLK_NR_304 * NB_BYTES_SWF_BLK; | |
741 | } |
|
742 | } | |
742 | // SET PACKET SEQUENCE COUNTER |
|
743 | // SET PACKET SEQUENCE COUNTER | |
743 | increment_seq_counter_source_id( headerSWF[ i ].packetSequenceControl, sid ); |
|
744 | increment_seq_counter_source_id( headerSWF[ i ].packetSequenceControl, sid ); | |
744 | // SET PACKET TIME |
|
745 | // SET PACKET TIME | |
745 | compute_acquisition_time( coarseTime, fineTime, sid, i, headerSWF[ i ].acquisitionTime ); |
|
746 | compute_acquisition_time( coarseTime, fineTime, sid, i, headerSWF[ i ].acquisitionTime ); | |
746 | // |
|
747 | // | |
747 | headerSWF[ i ].time[0] = headerSWF[ i ].acquisitionTime[0]; |
|
748 | headerSWF[ i ].time[0] = headerSWF[ i ].acquisitionTime[0]; | |
748 | headerSWF[ i ].time[1] = headerSWF[ i ].acquisitionTime[1]; |
|
749 | headerSWF[ i ].time[1] = headerSWF[ i ].acquisitionTime[1]; | |
749 | headerSWF[ i ].time[2] = headerSWF[ i ].acquisitionTime[2]; |
|
750 | headerSWF[ i ].time[2] = headerSWF[ i ].acquisitionTime[2]; | |
750 | headerSWF[ i ].time[3] = headerSWF[ i ].acquisitionTime[3]; |
|
751 | headerSWF[ i ].time[3] = headerSWF[ i ].acquisitionTime[3]; | |
751 | headerSWF[ i ].time[4] = headerSWF[ i ].acquisitionTime[4]; |
|
752 | headerSWF[ i ].time[4] = headerSWF[ i ].acquisitionTime[4]; | |
752 | headerSWF[ i ].time[5] = headerSWF[ i ].acquisitionTime[5]; |
|
753 | headerSWF[ i ].time[5] = headerSWF[ i ].acquisitionTime[5]; | |
753 | // SEND PACKET |
|
754 | // SEND PACKET | |
754 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_SWF, ACTION_MSG_SPW_IOCTL_SEND_SIZE); |
|
755 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_SWF, ACTION_MSG_SPW_IOCTL_SEND_SIZE); | |
755 | if (status != RTEMS_SUCCESSFUL) { |
|
756 | if (status != RTEMS_SUCCESSFUL) { | |
756 | printf("%d-%d, ERR %d\n", sid, i, (int) status); |
|
757 | printf("%d-%d, ERR %d\n", sid, i, (int) status); | |
757 | ret = LFR_DEFAULT; |
|
758 | ret = LFR_DEFAULT; | |
758 | } |
|
759 | } | |
759 | rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds |
|
760 | rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds | |
760 | } |
|
761 | } | |
761 |
|
762 | |||
762 | return ret; |
|
763 | return ret; | |
763 | } |
|
764 | } | |
764 |
|
765 | |||
765 | int send_waveform_CWF(volatile int *waveform, unsigned int sid, |
|
766 | int send_waveform_CWF(volatile int *waveform, unsigned int sid, | |
766 | Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id) |
|
767 | Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id) | |
767 | { |
|
768 | { | |
768 | /** This function sends CWF CCSDS packets (F2, F1 or F0). |
|
769 | /** This function sends CWF CCSDS packets (F2, F1 or F0). | |
769 | * |
|
770 | * | |
770 | * @param waveform points to the buffer containing the data that will be send. |
|
771 | * @param waveform points to the buffer containing the data that will be send. | |
771 | * @param sid is the source identifier of the data that will be sent. |
|
772 | * @param sid is the source identifier of the data that will be sent. | |
772 | * @param headerCWF points to a table of headers that have been prepared for the data transmission. |
|
773 | * @param headerCWF points to a table of headers that have been prepared for the data transmission. | |
773 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures |
|
774 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures | |
774 | * contain information to setup the transmission of the data packets. |
|
775 | * contain information to setup the transmission of the data packets. | |
775 | * |
|
776 | * | |
776 | * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks. |
|
777 | * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks. | |
777 | * |
|
778 | * | |
778 | */ |
|
779 | */ | |
779 |
|
780 | |||
780 | unsigned int i; |
|
781 | unsigned int i; | |
781 | int ret; |
|
782 | int ret; | |
782 | unsigned int coarseTime; |
|
783 | unsigned int coarseTime; | |
783 | unsigned int fineTime; |
|
784 | unsigned int fineTime; | |
784 | rtems_status_code status; |
|
785 | rtems_status_code status; | |
785 | spw_ioctl_pkt_send spw_ioctl_send_CWF; |
|
786 | spw_ioctl_pkt_send spw_ioctl_send_CWF; | |
786 |
|
787 | |||
787 | spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header |
|
788 | spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header | |
788 | spw_ioctl_send_CWF.options = 0; |
|
789 | spw_ioctl_send_CWF.options = 0; | |
789 |
|
790 | |||
790 | ret = LFR_DEFAULT; |
|
791 | ret = LFR_DEFAULT; | |
791 |
|
792 | |||
792 | coarseTime = waveform[0]; |
|
793 | coarseTime = waveform[0]; | |
793 | fineTime = waveform[1]; |
|
794 | fineTime = waveform[1]; | |
794 |
|
795 | |||
795 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF; i++) // send waveform |
|
796 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF; i++) // send waveform | |
796 | { |
|
797 | { | |
797 | spw_ioctl_send_CWF.data = (char*) &waveform[ (i * BLK_NR_CWF * NB_WORDS_SWF_BLK) + TIME_OFFSET]; |
|
798 | spw_ioctl_send_CWF.data = (char*) &waveform[ (i * BLK_NR_CWF * NB_WORDS_SWF_BLK) + TIME_OFFSET]; | |
798 | spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ]; |
|
799 | spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ]; | |
799 | // BUILD THE DATA |
|
800 | // BUILD THE DATA | |
800 | spw_ioctl_send_CWF.dlen = BLK_NR_CWF * NB_BYTES_SWF_BLK; |
|
801 | spw_ioctl_send_CWF.dlen = BLK_NR_CWF * NB_BYTES_SWF_BLK; | |
801 | // SET PACKET SEQUENCE COUNTER |
|
802 | // SET PACKET SEQUENCE COUNTER | |
802 | increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, sid ); |
|
803 | increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, sid ); | |
803 | // SET PACKET TIME |
|
804 | // SET PACKET TIME | |
804 | compute_acquisition_time( coarseTime, fineTime, sid, i, headerCWF[ i ].acquisitionTime); |
|
805 | compute_acquisition_time( coarseTime, fineTime, sid, i, headerCWF[ i ].acquisitionTime); | |
805 | // |
|
806 | // | |
806 | headerCWF[ i ].time[0] = headerCWF[ i ].acquisitionTime[0]; |
|
807 | headerCWF[ i ].time[0] = headerCWF[ i ].acquisitionTime[0]; | |
807 | headerCWF[ i ].time[1] = headerCWF[ i ].acquisitionTime[1]; |
|
808 | headerCWF[ i ].time[1] = headerCWF[ i ].acquisitionTime[1]; | |
808 | headerCWF[ i ].time[2] = headerCWF[ i ].acquisitionTime[2]; |
|
809 | headerCWF[ i ].time[2] = headerCWF[ i ].acquisitionTime[2]; | |
809 | headerCWF[ i ].time[3] = headerCWF[ i ].acquisitionTime[3]; |
|
810 | headerCWF[ i ].time[3] = headerCWF[ i ].acquisitionTime[3]; | |
810 | headerCWF[ i ].time[4] = headerCWF[ i ].acquisitionTime[4]; |
|
811 | headerCWF[ i ].time[4] = headerCWF[ i ].acquisitionTime[4]; | |
811 | headerCWF[ i ].time[5] = headerCWF[ i ].acquisitionTime[5]; |
|
812 | headerCWF[ i ].time[5] = headerCWF[ i ].acquisitionTime[5]; | |
812 | // SEND PACKET |
|
813 | // SEND PACKET | |
813 | if (sid == SID_NORM_CWF_LONG_F3) |
|
814 | if (sid == SID_NORM_CWF_LONG_F3) | |
814 | { |
|
815 | { | |
815 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); |
|
816 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); | |
816 | if (status != RTEMS_SUCCESSFUL) { |
|
817 | if (status != RTEMS_SUCCESSFUL) { | |
817 | printf("%d-%d, ERR %d\n", sid, i, (int) status); |
|
818 | printf("%d-%d, ERR %d\n", sid, i, (int) status); | |
818 | ret = LFR_DEFAULT; |
|
819 | ret = LFR_DEFAULT; | |
819 | } |
|
820 | } | |
820 | rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS); |
|
821 | rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS); | |
821 | } |
|
822 | } | |
822 | else |
|
823 | else | |
823 | { |
|
824 | { | |
824 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); |
|
825 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); | |
825 | if (status != RTEMS_SUCCESSFUL) { |
|
826 | if (status != RTEMS_SUCCESSFUL) { | |
826 | printf("%d-%d, ERR %d\n", sid, i, (int) status); |
|
827 | printf("%d-%d, ERR %d\n", sid, i, (int) status); | |
827 | ret = LFR_DEFAULT; |
|
828 | ret = LFR_DEFAULT; | |
828 | } |
|
829 | } | |
829 | } |
|
830 | } | |
830 | } |
|
831 | } | |
831 |
|
832 | |||
832 | return ret; |
|
833 | return ret; | |
833 | } |
|
834 | } | |
834 |
|
835 | |||
835 | int send_waveform_CWF3_light(volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id) |
|
836 | int send_waveform_CWF3_light(volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id) | |
836 | { |
|
837 | { | |
837 | /** This function sends CWF_F3 CCSDS packets without the b1, b2 and b3 data. |
|
838 | /** This function sends CWF_F3 CCSDS packets without the b1, b2 and b3 data. | |
838 | * |
|
839 | * | |
839 | * @param waveform points to the buffer containing the data that will be send. |
|
840 | * @param waveform points to the buffer containing the data that will be send. | |
840 | * @param headerCWF points to a table of headers that have been prepared for the data transmission. |
|
841 | * @param headerCWF points to a table of headers that have been prepared for the data transmission. | |
841 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures |
|
842 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures | |
842 | * contain information to setup the transmission of the data packets. |
|
843 | * contain information to setup the transmission of the data packets. | |
843 | * |
|
844 | * | |
844 | * By default, CWF_F3 packet are send without the b1, b2 and b3 data. This function rebuilds a data buffer |
|
845 | * By default, CWF_F3 packet are send without the b1, b2 and b3 data. This function rebuilds a data buffer | |
845 | * from the incoming data and sends it in 7 packets, 6 containing 340 blocks and 1 one containing 8 blocks. |
|
846 | * from the incoming data and sends it in 7 packets, 6 containing 340 blocks and 1 one containing 8 blocks. | |
846 | * |
|
847 | * | |
847 | */ |
|
848 | */ | |
848 |
|
849 | |||
849 | unsigned int i; |
|
850 | unsigned int i; | |
850 | int ret; |
|
851 | int ret; | |
851 | unsigned int coarseTime; |
|
852 | unsigned int coarseTime; | |
852 | unsigned int fineTime; |
|
853 | unsigned int fineTime; | |
853 | rtems_status_code status; |
|
854 | rtems_status_code status; | |
854 | spw_ioctl_pkt_send spw_ioctl_send_CWF; |
|
855 | spw_ioctl_pkt_send spw_ioctl_send_CWF; | |
855 | char *sample; |
|
856 | char *sample; | |
856 |
|
857 | |||
857 | spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header |
|
858 | spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header | |
858 | spw_ioctl_send_CWF.options = 0; |
|
859 | spw_ioctl_send_CWF.options = 0; | |
859 |
|
860 | |||
860 | ret = LFR_DEFAULT; |
|
861 | ret = LFR_DEFAULT; | |
861 |
|
862 | |||
862 | //********************** |
|
863 | //********************** | |
863 | // BUILD CWF3_light DATA |
|
864 | // BUILD CWF3_light DATA | |
864 | for ( i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++) |
|
865 | for ( i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++) | |
865 | { |
|
866 | { | |
866 | sample = (char*) &waveform[ (i * NB_WORDS_SWF_BLK) + TIME_OFFSET ]; |
|
867 | sample = (char*) &waveform[ (i * NB_WORDS_SWF_BLK) + TIME_OFFSET ]; | |
867 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + TIME_OFFSET_IN_BYTES ] = sample[ 0 ]; |
|
868 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + TIME_OFFSET_IN_BYTES ] = sample[ 0 ]; | |
868 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 + TIME_OFFSET_IN_BYTES ] = sample[ 1 ]; |
|
869 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 + TIME_OFFSET_IN_BYTES ] = sample[ 1 ]; | |
869 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 + TIME_OFFSET_IN_BYTES ] = sample[ 2 ]; |
|
870 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 + TIME_OFFSET_IN_BYTES ] = sample[ 2 ]; | |
870 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 + TIME_OFFSET_IN_BYTES ] = sample[ 3 ]; |
|
871 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 + TIME_OFFSET_IN_BYTES ] = sample[ 3 ]; | |
871 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 + TIME_OFFSET_IN_BYTES ] = sample[ 4 ]; |
|
872 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 + TIME_OFFSET_IN_BYTES ] = sample[ 4 ]; | |
872 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 + TIME_OFFSET_IN_BYTES ] = sample[ 5 ]; |
|
873 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 + TIME_OFFSET_IN_BYTES ] = sample[ 5 ]; | |
873 | } |
|
874 | } | |
874 |
|
875 | |||
875 | coarseTime = waveform[0]; |
|
876 | coarseTime = waveform[0]; | |
876 | fineTime = waveform[1]; |
|
877 | fineTime = waveform[1]; | |
877 |
|
878 | |||
878 | //********************* |
|
879 | //********************* | |
879 | // SEND CWF3_light DATA |
|
880 | // SEND CWF3_light DATA | |
880 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF_LIGHT; i++) // send waveform |
|
881 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF_LIGHT; i++) // send waveform | |
881 | { |
|
882 | { | |
882 | 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]; |
|
883 | 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]; | |
883 | spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ]; |
|
884 | spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ]; | |
884 | // BUILD THE DATA |
|
885 | // BUILD THE DATA | |
885 | spw_ioctl_send_CWF.dlen = BLK_NR_CWF_SHORT_F3 * NB_BYTES_CWF3_LIGHT_BLK; |
|
886 | spw_ioctl_send_CWF.dlen = BLK_NR_CWF_SHORT_F3 * NB_BYTES_CWF3_LIGHT_BLK; | |
886 | // SET PACKET SEQUENCE COUNTER |
|
887 | // SET PACKET SEQUENCE COUNTER | |
887 | increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, SID_NORM_CWF_F3 ); |
|
888 | increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, SID_NORM_CWF_F3 ); | |
888 | // SET PACKET TIME |
|
889 | // SET PACKET TIME | |
889 | compute_acquisition_time( coarseTime, fineTime, SID_NORM_CWF_F3, i, headerCWF[ i ].acquisitionTime ); |
|
890 | compute_acquisition_time( coarseTime, fineTime, SID_NORM_CWF_F3, i, headerCWF[ i ].acquisitionTime ); | |
890 | // |
|
891 | // | |
891 | headerCWF[ i ].time[0] = headerCWF[ i ].acquisitionTime[0]; |
|
892 | headerCWF[ i ].time[0] = headerCWF[ i ].acquisitionTime[0]; | |
892 | headerCWF[ i ].time[1] = headerCWF[ i ].acquisitionTime[1]; |
|
893 | headerCWF[ i ].time[1] = headerCWF[ i ].acquisitionTime[1]; | |
893 | headerCWF[ i ].time[2] = headerCWF[ i ].acquisitionTime[2]; |
|
894 | headerCWF[ i ].time[2] = headerCWF[ i ].acquisitionTime[2]; | |
894 | headerCWF[ i ].time[3] = headerCWF[ i ].acquisitionTime[3]; |
|
895 | headerCWF[ i ].time[3] = headerCWF[ i ].acquisitionTime[3]; | |
895 | headerCWF[ i ].time[4] = headerCWF[ i ].acquisitionTime[4]; |
|
896 | headerCWF[ i ].time[4] = headerCWF[ i ].acquisitionTime[4]; | |
896 | headerCWF[ i ].time[5] = headerCWF[ i ].acquisitionTime[5]; |
|
897 | headerCWF[ i ].time[5] = headerCWF[ i ].acquisitionTime[5]; | |
897 | // SEND PACKET |
|
898 | // SEND PACKET | |
898 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); |
|
899 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); | |
899 | if (status != RTEMS_SUCCESSFUL) { |
|
900 | if (status != RTEMS_SUCCESSFUL) { | |
900 | printf("%d-%d, ERR %d\n", SID_NORM_CWF_F3, i, (int) status); |
|
901 | printf("%d-%d, ERR %d\n", SID_NORM_CWF_F3, i, (int) status); | |
901 | ret = LFR_DEFAULT; |
|
902 | ret = LFR_DEFAULT; | |
902 | } |
|
903 | } | |
903 | rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS); |
|
904 | rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS); | |
904 | } |
|
905 | } | |
905 |
|
906 | |||
906 | return ret; |
|
907 | return ret; | |
907 | } |
|
908 | } | |
908 |
|
909 | |||
909 | void compute_acquisition_time( unsigned int coarseTime, unsigned int fineTime, |
|
910 | void compute_acquisition_time( unsigned int coarseTime, unsigned int fineTime, | |
910 | unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char * acquisitionTime ) |
|
911 | unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char * acquisitionTime ) | |
911 | { |
|
912 | { | |
912 | unsigned long long int acquisitionTimeAsLong; |
|
913 | unsigned long long int acquisitionTimeAsLong; | |
913 | unsigned char localAcquisitionTime[6]; |
|
914 | unsigned char localAcquisitionTime[6]; | |
914 | double deltaT; |
|
915 | double deltaT; | |
915 |
|
916 | |||
916 | deltaT = 0.; |
|
917 | deltaT = 0.; | |
917 |
|
918 | |||
918 | localAcquisitionTime[0] = (unsigned char) ( coarseTime >> 8 ); |
|
919 | localAcquisitionTime[0] = (unsigned char) ( coarseTime >> 8 ); | |
919 | localAcquisitionTime[1] = (unsigned char) ( coarseTime ); |
|
920 | localAcquisitionTime[1] = (unsigned char) ( coarseTime ); | |
920 | localAcquisitionTime[2] = (unsigned char) ( coarseTime >> 24 ); |
|
921 | localAcquisitionTime[2] = (unsigned char) ( coarseTime >> 24 ); | |
921 | localAcquisitionTime[3] = (unsigned char) ( coarseTime >> 16 ); |
|
922 | localAcquisitionTime[3] = (unsigned char) ( coarseTime >> 16 ); | |
922 | localAcquisitionTime[4] = (unsigned char) ( fineTime >> 24 ); |
|
923 | localAcquisitionTime[4] = (unsigned char) ( fineTime >> 24 ); | |
923 | localAcquisitionTime[5] = (unsigned char) ( fineTime >> 16 ); |
|
924 | localAcquisitionTime[5] = (unsigned char) ( fineTime >> 16 ); | |
924 |
|
925 | |||
925 | acquisitionTimeAsLong = ( (unsigned long long int) localAcquisitionTime[0] << 40 ) |
|
926 | acquisitionTimeAsLong = ( (unsigned long long int) localAcquisitionTime[0] << 40 ) | |
926 | + ( (unsigned long long int) localAcquisitionTime[1] << 32 ) |
|
927 | + ( (unsigned long long int) localAcquisitionTime[1] << 32 ) | |
927 | + ( localAcquisitionTime[2] << 24 ) |
|
928 | + ( localAcquisitionTime[2] << 24 ) | |
928 | + ( localAcquisitionTime[3] << 16 ) |
|
929 | + ( localAcquisitionTime[3] << 16 ) | |
929 | + ( localAcquisitionTime[4] << 8 ) |
|
930 | + ( localAcquisitionTime[4] << 8 ) | |
930 | + ( localAcquisitionTime[5] ); |
|
931 | + ( localAcquisitionTime[5] ); | |
931 |
|
932 | |||
932 | switch( sid ) |
|
933 | switch( sid ) | |
933 | { |
|
934 | { | |
934 | case SID_NORM_SWF_F0: |
|
935 | case SID_NORM_SWF_F0: | |
935 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 24576. ; |
|
936 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 24576. ; | |
936 | break; |
|
937 | break; | |
937 |
|
938 | |||
938 | case SID_NORM_SWF_F1: |
|
939 | case SID_NORM_SWF_F1: | |
939 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 4096. ; |
|
940 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 4096. ; | |
940 | break; |
|
941 | break; | |
941 |
|
942 | |||
942 | case SID_NORM_SWF_F2: |
|
943 | case SID_NORM_SWF_F2: | |
943 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 256. ; |
|
944 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 256. ; | |
944 | break; |
|
945 | break; | |
945 |
|
946 | |||
946 | case SID_SBM1_CWF_F1: |
|
947 | case SID_SBM1_CWF_F1: | |
947 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 4096. ; |
|
948 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 4096. ; | |
948 | break; |
|
949 | break; | |
949 |
|
950 | |||
950 | case SID_SBM2_CWF_F2: |
|
951 | case SID_SBM2_CWF_F2: | |
951 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ; |
|
952 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ; | |
952 | break; |
|
953 | break; | |
953 |
|
954 | |||
954 | case SID_BURST_CWF_F2: |
|
955 | case SID_BURST_CWF_F2: | |
955 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ; |
|
956 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ; | |
956 | break; |
|
957 | break; | |
957 |
|
958 | |||
958 | case SID_NORM_CWF_F3: |
|
959 | case SID_NORM_CWF_F3: | |
959 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF_SHORT_F3 * 65536. / 16. ; |
|
960 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF_SHORT_F3 * 65536. / 16. ; | |
960 | break; |
|
961 | break; | |
961 |
|
962 | |||
962 | case SID_NORM_CWF_LONG_F3: |
|
963 | case SID_NORM_CWF_LONG_F3: | |
963 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 16. ; |
|
964 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 16. ; | |
964 | break; |
|
965 | break; | |
965 |
|
966 | |||
966 | default: |
|
967 | default: | |
967 | PRINTF1("in compute_acquisition_time *** ERR unexpected sid %d", sid) |
|
968 | PRINTF1("in compute_acquisition_time *** ERR unexpected sid %d", sid) | |
968 | deltaT = 0.; |
|
969 | deltaT = 0.; | |
969 | break; |
|
970 | break; | |
970 | } |
|
971 | } | |
971 |
|
972 | |||
972 | acquisitionTimeAsLong = acquisitionTimeAsLong + (unsigned long long int) deltaT; |
|
973 | acquisitionTimeAsLong = acquisitionTimeAsLong + (unsigned long long int) deltaT; | |
973 | // |
|
974 | // | |
974 | acquisitionTime[0] = (unsigned char) (acquisitionTimeAsLong >> 40); |
|
975 | acquisitionTime[0] = (unsigned char) (acquisitionTimeAsLong >> 40); | |
975 | acquisitionTime[1] = (unsigned char) (acquisitionTimeAsLong >> 32); |
|
976 | acquisitionTime[1] = (unsigned char) (acquisitionTimeAsLong >> 32); | |
976 | acquisitionTime[2] = (unsigned char) (acquisitionTimeAsLong >> 24); |
|
977 | acquisitionTime[2] = (unsigned char) (acquisitionTimeAsLong >> 24); | |
977 | acquisitionTime[3] = (unsigned char) (acquisitionTimeAsLong >> 16); |
|
978 | acquisitionTime[3] = (unsigned char) (acquisitionTimeAsLong >> 16); | |
978 | acquisitionTime[4] = (unsigned char) (acquisitionTimeAsLong >> 8 ); |
|
979 | acquisitionTime[4] = (unsigned char) (acquisitionTimeAsLong >> 8 ); | |
979 | acquisitionTime[5] = (unsigned char) (acquisitionTimeAsLong ); |
|
980 | acquisitionTime[5] = (unsigned char) (acquisitionTimeAsLong ); | |
980 |
|
981 | |||
981 | } |
|
982 | } | |
982 |
|
983 | |||
983 | void build_snapshot_from_ring( ring_node *ring_node_to_send, unsigned char frequencyChannel ) |
|
984 | void build_snapshot_from_ring( ring_node *ring_node_to_send, unsigned char frequencyChannel ) | |
984 | { |
|
985 | { | |
985 | unsigned int i; |
|
986 | unsigned int i; | |
986 | unsigned long long int centerTime_asLong; |
|
987 | unsigned long long int centerTime_asLong; | |
987 | unsigned long long int acquisitionTimeF0_asLong; |
|
988 | unsigned long long int acquisitionTimeF0_asLong; | |
988 | unsigned long long int acquisitionTime_asLong; |
|
989 | unsigned long long int acquisitionTime_asLong; | |
989 | unsigned long long int bufferAcquisitionTime_asLong; |
|
990 | unsigned long long int bufferAcquisitionTime_asLong; | |
990 | unsigned char *ptr1; |
|
991 | unsigned char *ptr1; | |
991 | unsigned char *ptr2; |
|
992 | unsigned char *ptr2; | |
992 | unsigned char nb_ring_nodes; |
|
993 | unsigned char nb_ring_nodes; | |
993 | unsigned long long int frequency_asLong; |
|
994 | unsigned long long int frequency_asLong; | |
994 | unsigned long long int nbTicksPerSample_asLong; |
|
995 | unsigned long long int nbTicksPerSample_asLong; | |
995 | unsigned long long int nbSamplesPart1_asLong; |
|
996 | unsigned long long int nbSamplesPart1_asLong; | |
996 | unsigned long long int sampleOffset_asLong; |
|
997 | unsigned long long int sampleOffset_asLong; | |
997 |
|
998 | |||
998 | unsigned int deltaT_F0; |
|
999 | unsigned int deltaT_F0; | |
999 | unsigned int deltaT_F1; |
|
1000 | unsigned int deltaT_F1; | |
1000 | unsigned long long int deltaT_F2; |
|
1001 | unsigned long long int deltaT_F2; | |
1001 |
|
1002 | |||
1002 | deltaT_F0 = 2731; // (2048. / 24576. / 2.) * 65536. = 2730.667; |
|
1003 | deltaT_F0 = 2731; // (2048. / 24576. / 2.) * 65536. = 2730.667; | |
1003 | deltaT_F1 = 16384; // (2048. / 4096. / 2.) * 65536. = 16384; |
|
1004 | deltaT_F1 = 16384; // (2048. / 4096. / 2.) * 65536. = 16384; | |
1004 | deltaT_F2 = 262144; // (2048. / 256. / 2.) * 65536. = 262144; |
|
1005 | deltaT_F2 = 262144; // (2048. / 256. / 2.) * 65536. = 262144; | |
1005 | sampleOffset_asLong = 0x00; |
|
1006 | sampleOffset_asLong = 0x00; | |
1006 |
|
1007 | |||
1007 | // (1) get the f0 acquisition time |
|
1008 | // (1) get the f0 acquisition time | |
1008 | build_acquisition_time( &acquisitionTimeF0_asLong, current_ring_node_f0 ); |
|
1009 | build_acquisition_time( &acquisitionTimeF0_asLong, current_ring_node_f0 ); | |
1009 |
|
1010 | |||
1010 | // (2) compute the central reference time |
|
1011 | // (2) compute the central reference time | |
1011 | centerTime_asLong = acquisitionTimeF0_asLong + deltaT_F0; |
|
1012 | centerTime_asLong = acquisitionTimeF0_asLong + deltaT_F0; | |
1012 |
|
1013 | |||
1013 | // (3) compute the acquisition time of the current snapshot |
|
1014 | // (3) compute the acquisition time of the current snapshot | |
1014 | switch(frequencyChannel) |
|
1015 | switch(frequencyChannel) | |
1015 | { |
|
1016 | { | |
1016 | case 1: // 1 is for F1 = 4096 Hz |
|
1017 | case 1: // 1 is for F1 = 4096 Hz | |
1017 | acquisitionTime_asLong = centerTime_asLong - deltaT_F1; |
|
1018 | acquisitionTime_asLong = centerTime_asLong - deltaT_F1; | |
1018 | nb_ring_nodes = NB_RING_NODES_F1; |
|
1019 | nb_ring_nodes = NB_RING_NODES_F1; | |
1019 | frequency_asLong = 4096; |
|
1020 | frequency_asLong = 4096; | |
1020 | nbTicksPerSample_asLong = 16; // 65536 / 4096; |
|
1021 | nbTicksPerSample_asLong = 16; // 65536 / 4096; | |
1021 | break; |
|
1022 | break; | |
1022 | case 2: // 2 is for F2 = 256 Hz |
|
1023 | case 2: // 2 is for F2 = 256 Hz | |
1023 | acquisitionTime_asLong = centerTime_asLong - deltaT_F2; |
|
1024 | acquisitionTime_asLong = centerTime_asLong - deltaT_F2; | |
1024 | nb_ring_nodes = NB_RING_NODES_F2; |
|
1025 | nb_ring_nodes = NB_RING_NODES_F2; | |
1025 | frequency_asLong = 256; |
|
1026 | frequency_asLong = 256; | |
1026 | nbTicksPerSample_asLong = 256; // 65536 / 256; |
|
1027 | nbTicksPerSample_asLong = 256; // 65536 / 256; | |
1027 | break; |
|
1028 | break; | |
1028 | default: |
|
1029 | default: | |
1029 | acquisitionTime_asLong = centerTime_asLong; |
|
1030 | acquisitionTime_asLong = centerTime_asLong; | |
1030 | frequency_asLong = 256; |
|
1031 | frequency_asLong = 256; | |
1031 | nbTicksPerSample_asLong = 256; |
|
1032 | nbTicksPerSample_asLong = 256; | |
1032 | break; |
|
1033 | break; | |
1033 | } |
|
1034 | } | |
1034 |
|
1035 | |||
1035 | //**************************************************************************** |
|
1036 | //**************************************************************************** | |
1036 | // (4) search the ring_node with the acquisition time <= acquisitionTime_asLong |
|
1037 | // (4) search the ring_node with the acquisition time <= acquisitionTime_asLong | |
1037 | for (i=0; i<nb_ring_nodes; i++) |
|
1038 | for (i=0; i<nb_ring_nodes; i++) | |
1038 | { |
|
1039 | { | |
1039 | PRINTF1("%d ... ", i) |
|
1040 | PRINTF1("%d ... ", i) | |
1040 | build_acquisition_time( &bufferAcquisitionTime_asLong, ring_node_to_send ); |
|
1041 | build_acquisition_time( &bufferAcquisitionTime_asLong, ring_node_to_send ); | |
1041 | if (bufferAcquisitionTime_asLong <= acquisitionTime_asLong) |
|
1042 | if (bufferAcquisitionTime_asLong <= acquisitionTime_asLong) | |
1042 | { |
|
1043 | { | |
1043 | PRINTF1("buffer found with acquisition time = %llx\n", bufferAcquisitionTime_asLong) |
|
1044 | PRINTF1("buffer found with acquisition time = %llx\n", bufferAcquisitionTime_asLong) | |
1044 | break; |
|
1045 | break; | |
1045 | } |
|
1046 | } | |
1046 | ring_node_to_send = ring_node_to_send->previous; |
|
1047 | ring_node_to_send = ring_node_to_send->previous; | |
1047 | } |
|
1048 | } | |
1048 |
|
1049 | |||
1049 | // (5) compute the number of samples to take in the current buffer |
|
1050 | // (5) compute the number of samples to take in the current buffer | |
1050 | sampleOffset_asLong = ((acquisitionTime_asLong - bufferAcquisitionTime_asLong) * frequency_asLong ) >> 16; |
|
1051 | sampleOffset_asLong = ((acquisitionTime_asLong - bufferAcquisitionTime_asLong) * frequency_asLong ) >> 16; | |
1051 | nbSamplesPart1_asLong = NB_SAMPLES_PER_SNAPSHOT - sampleOffset_asLong; |
|
1052 | nbSamplesPart1_asLong = NB_SAMPLES_PER_SNAPSHOT - sampleOffset_asLong; | |
1052 | PRINTF2("sampleOffset_asLong = %lld, nbSamplesPart1_asLong = %lld\n", sampleOffset_asLong, nbSamplesPart1_asLong) |
|
1053 | PRINTF2("sampleOffset_asLong = %lld, nbSamplesPart1_asLong = %lld\n", sampleOffset_asLong, nbSamplesPart1_asLong) | |
1053 |
|
1054 | |||
1054 | // (6) compute the final acquisition time |
|
1055 | // (6) compute the final acquisition time | |
1055 | acquisitionTime_asLong = bufferAcquisitionTime_asLong + |
|
1056 | acquisitionTime_asLong = bufferAcquisitionTime_asLong + | |
1056 | sampleOffset_asLong * nbTicksPerSample_asLong; |
|
1057 | sampleOffset_asLong * nbTicksPerSample_asLong; | |
1057 |
|
1058 | |||
1058 | // (7) copy the acquisition time at the beginning of the extrated snapshot |
|
1059 | // (7) copy the acquisition time at the beginning of the extrated snapshot | |
1059 | ptr1 = (unsigned char*) &acquisitionTime_asLong; |
|
1060 | ptr1 = (unsigned char*) &acquisitionTime_asLong; | |
1060 | ptr2 = (unsigned char*) wf_snap_extracted; |
|
1061 | ptr2 = (unsigned char*) wf_snap_extracted; | |
1061 | ptr2[0] = ptr1[ 2 + 2 ]; |
|
1062 | ptr2[0] = ptr1[ 2 + 2 ]; | |
1062 | ptr2[1] = ptr1[ 3 + 2 ]; |
|
1063 | ptr2[1] = ptr1[ 3 + 2 ]; | |
1063 | ptr2[2] = ptr1[ 0 + 2 ]; |
|
1064 | ptr2[2] = ptr1[ 0 + 2 ]; | |
1064 | ptr2[3] = ptr1[ 1 + 2 ]; |
|
1065 | ptr2[3] = ptr1[ 1 + 2 ]; | |
1065 | ptr2[4] = ptr1[ 4 + 2 ]; |
|
1066 | ptr2[4] = ptr1[ 4 + 2 ]; | |
1066 | ptr2[5] = ptr1[ 5 + 2 ]; |
|
1067 | ptr2[5] = ptr1[ 5 + 2 ]; | |
1067 |
|
1068 | |||
1068 | // re set the synchronization bit |
|
1069 | // re set the synchronization bit | |
1069 |
|
1070 | |||
1070 |
|
1071 | |||
1071 | // copy the part 1 of the snapshot in the extracted buffer |
|
1072 | // copy the part 1 of the snapshot in the extracted buffer | |
1072 | for ( i = 0; i < (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i++ ) |
|
1073 | for ( i = 0; i < (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i++ ) | |
1073 | { |
|
1074 | { | |
1074 | wf_snap_extracted[i + TIME_OFFSET] = |
|
1075 | wf_snap_extracted[i + TIME_OFFSET] = | |
1075 | ((int*) ring_node_to_send->buffer_address)[i + (sampleOffset_asLong * NB_WORDS_SWF_BLK) + TIME_OFFSET]; |
|
1076 | ((int*) ring_node_to_send->buffer_address)[i + (sampleOffset_asLong * NB_WORDS_SWF_BLK) + TIME_OFFSET]; | |
1076 | } |
|
1077 | } | |
1077 | // copy the part 2 of the snapshot in the extracted buffer |
|
1078 | // copy the part 2 of the snapshot in the extracted buffer | |
1078 | ring_node_to_send = ring_node_to_send->next; |
|
1079 | ring_node_to_send = ring_node_to_send->next; | |
1079 | for ( i = (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i < (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK); i++ ) |
|
1080 | for ( i = (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i < (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK); i++ ) | |
1080 | { |
|
1081 | { | |
1081 | wf_snap_extracted[i + TIME_OFFSET] = |
|
1082 | wf_snap_extracted[i + TIME_OFFSET] = | |
1082 | ((int*) ring_node_to_send->buffer_address)[(i-(nbSamplesPart1_asLong * NB_WORDS_SWF_BLK)) + TIME_OFFSET]; |
|
1083 | ((int*) ring_node_to_send->buffer_address)[(i-(nbSamplesPart1_asLong * NB_WORDS_SWF_BLK)) + TIME_OFFSET]; | |
1083 | } |
|
1084 | } | |
1084 | } |
|
1085 | } | |
1085 |
|
1086 | |||
1086 | void build_acquisition_time( unsigned long long int *acquisitionTimeAslong, ring_node *current_ring_node ) |
|
1087 | void build_acquisition_time( unsigned long long int *acquisitionTimeAslong, ring_node *current_ring_node ) | |
1087 | { |
|
1088 | { | |
1088 | unsigned char *acquisitionTimeCharPtr; |
|
1089 | unsigned char *acquisitionTimeCharPtr; | |
1089 |
|
1090 | |||
1090 | acquisitionTimeCharPtr = (unsigned char*) current_ring_node->buffer_address; |
|
1091 | acquisitionTimeCharPtr = (unsigned char*) current_ring_node->buffer_address; | |
1091 |
|
1092 | |||
1092 | *acquisitionTimeAslong = 0x00; |
|
1093 | *acquisitionTimeAslong = 0x00; | |
1093 | *acquisitionTimeAslong = ( acquisitionTimeCharPtr[0] << 24 ) |
|
1094 | *acquisitionTimeAslong = ( acquisitionTimeCharPtr[0] << 24 ) | |
1094 | + ( acquisitionTimeCharPtr[1] << 16 ) |
|
1095 | + ( acquisitionTimeCharPtr[1] << 16 ) | |
1095 | + ( (unsigned long long int) (acquisitionTimeCharPtr[2] & 0x7f) << 40 ) // [0111 1111] mask the synchronization bit |
|
1096 | + ( (unsigned long long int) (acquisitionTimeCharPtr[2] & 0x7f) << 40 ) // [0111 1111] mask the synchronization bit | |
1096 | + ( (unsigned long long int) acquisitionTimeCharPtr[3] << 32 ) |
|
1097 | + ( (unsigned long long int) acquisitionTimeCharPtr[3] << 32 ) | |
1097 | + ( acquisitionTimeCharPtr[4] << 8 ) |
|
1098 | + ( acquisitionTimeCharPtr[4] << 8 ) | |
1098 | + ( acquisitionTimeCharPtr[5] ); |
|
1099 | + ( acquisitionTimeCharPtr[5] ); | |
1099 | } |
|
1100 | } | |
1100 |
|
1101 | |||
1101 | //************** |
|
1102 | //************** | |
1102 | // wfp registers |
|
1103 | // wfp registers | |
1103 | void reset_wfp_burst_enable(void) |
|
1104 | void reset_wfp_burst_enable(void) | |
1104 | { |
|
1105 | { | |
1105 | /** This function resets the waveform picker burst_enable register. |
|
1106 | /** This function resets the waveform picker burst_enable register. | |
1106 | * |
|
1107 | * | |
1107 | * The burst bits [f2 f1 f0] and the enable bits [f3 f2 f1 f0] are set to 0. |
|
1108 | * The burst bits [f2 f1 f0] and the enable bits [f3 f2 f1 f0] are set to 0. | |
1108 | * |
|
1109 | * | |
1109 | */ |
|
1110 | */ | |
1110 |
|
1111 | |||
1111 | waveform_picker_regs->run_burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 |
|
1112 | waveform_picker_regs->run_burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 | |
1112 | } |
|
1113 | } | |
1113 |
|
1114 | |||
1114 | void reset_wfp_status( void ) |
|
1115 | void reset_wfp_status( void ) | |
1115 | { |
|
1116 | { | |
1116 | /** This function resets the waveform picker status register. |
|
1117 | /** This function resets the waveform picker status register. | |
1117 | * |
|
1118 | * | |
1118 | * All status bits are set to 0 [new_err full_err full]. |
|
1119 | * All status bits are set to 0 [new_err full_err full]. | |
1119 | * |
|
1120 | * | |
1120 | */ |
|
1121 | */ | |
1121 |
|
1122 | |||
1122 | waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 |
|
1123 | waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 | |
1123 | } |
|
1124 | } | |
1124 |
|
1125 | |||
1125 | void reset_waveform_picker_regs(void) |
|
1126 | void reset_waveform_picker_regs(void) | |
1126 | { |
|
1127 | { | |
1127 | /** This function resets the waveform picker module registers. |
|
1128 | /** This function resets the waveform picker module registers. | |
1128 | * |
|
1129 | * | |
1129 | * The registers affected by this function are located at the following offset addresses: |
|
1130 | * The registers affected by this function are located at the following offset addresses: | |
1130 | * - 0x00 data_shaping |
|
1131 | * - 0x00 data_shaping | |
1131 | * - 0x04 run_burst_enable |
|
1132 | * - 0x04 run_burst_enable | |
1132 | * - 0x08 addr_data_f0 |
|
1133 | * - 0x08 addr_data_f0 | |
1133 | * - 0x0C addr_data_f1 |
|
1134 | * - 0x0C addr_data_f1 | |
1134 | * - 0x10 addr_data_f2 |
|
1135 | * - 0x10 addr_data_f2 | |
1135 | * - 0x14 addr_data_f3 |
|
1136 | * - 0x14 addr_data_f3 | |
1136 | * - 0x18 status |
|
1137 | * - 0x18 status | |
1137 | * - 0x1C delta_snapshot |
|
1138 | * - 0x1C delta_snapshot | |
1138 | * - 0x20 delta_f0 |
|
1139 | * - 0x20 delta_f0 | |
1139 | * - 0x24 delta_f0_2 |
|
1140 | * - 0x24 delta_f0_2 | |
1140 | * - 0x28 delta_f1 |
|
1141 | * - 0x28 delta_f1 | |
1141 | * - 0x2c delta_f2 |
|
1142 | * - 0x2c delta_f2 | |
1142 | * - 0x30 nb_data_by_buffer |
|
1143 | * - 0x30 nb_data_by_buffer | |
1143 | * - 0x34 nb_snapshot_param |
|
1144 | * - 0x34 nb_snapshot_param | |
1144 | * - 0x38 start_date |
|
1145 | * - 0x38 start_date | |
1145 | * - 0x3c nb_word_in_buffer |
|
1146 | * - 0x3c nb_word_in_buffer | |
1146 | * |
|
1147 | * | |
1147 | */ |
|
1148 | */ | |
1148 |
|
1149 | |||
1149 | set_wfp_data_shaping(); // 0x00 *** R1 R0 SP1 SP0 BW |
|
1150 | set_wfp_data_shaping(); // 0x00 *** R1 R0 SP1 SP0 BW | |
1150 | reset_wfp_burst_enable(); // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ] |
|
1151 | reset_wfp_burst_enable(); // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ] | |
1151 | waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address; // 0x08 |
|
1152 | waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address; // 0x08 | |
1152 | waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; // 0x0c |
|
1153 | waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; // 0x0c | |
1153 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; // 0x10 |
|
1154 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; // 0x10 | |
1154 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a); // 0x14 |
|
1155 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a); // 0x14 | |
1155 | reset_wfp_status(); // 0x18 |
|
1156 | reset_wfp_status(); // 0x18 | |
1156 | // |
|
1157 | // | |
1157 | set_wfp_delta_snapshot(); // 0x1c |
|
1158 | set_wfp_delta_snapshot(); // 0x1c | |
1158 | set_wfp_delta_f0_f0_2(); // 0x20, 0x24 |
|
1159 | set_wfp_delta_f0_f0_2(); // 0x20, 0x24 | |
1159 | set_wfp_delta_f1(); // 0x28 |
|
1160 | set_wfp_delta_f1(); // 0x28 | |
1160 | set_wfp_delta_f2(); // 0x2c |
|
1161 | set_wfp_delta_f2(); // 0x2c | |
1161 | DEBUG_PRINTF1("delta_snapshot %x\n", waveform_picker_regs->delta_snapshot) |
|
1162 | DEBUG_PRINTF1("delta_snapshot %x\n", waveform_picker_regs->delta_snapshot) | |
1162 | DEBUG_PRINTF1("delta_f0 %x\n", waveform_picker_regs->delta_f0) |
|
1163 | DEBUG_PRINTF1("delta_f0 %x\n", waveform_picker_regs->delta_f0) | |
1163 | DEBUG_PRINTF1("delta_f0_2 %x\n", waveform_picker_regs->delta_f0_2) |
|
1164 | DEBUG_PRINTF1("delta_f0_2 %x\n", waveform_picker_regs->delta_f0_2) | |
1164 | DEBUG_PRINTF1("delta_f1 %x\n", waveform_picker_regs->delta_f1) |
|
1165 | DEBUG_PRINTF1("delta_f1 %x\n", waveform_picker_regs->delta_f1) | |
1165 | DEBUG_PRINTF1("delta_f2 %x\n", waveform_picker_regs->delta_f2) |
|
1166 | DEBUG_PRINTF1("delta_f2 %x\n", waveform_picker_regs->delta_f2) | |
1166 | // 2688 = 8 * 336 |
|
1167 | // 2688 = 8 * 336 | |
1167 | waveform_picker_regs->nb_data_by_buffer = 0xa7f; // 0x30 *** 2688 - 1 => nb samples -1 |
|
1168 | waveform_picker_regs->nb_data_by_buffer = 0xa7f; // 0x30 *** 2688 - 1 => nb samples -1 | |
1168 | waveform_picker_regs->snapshot_param = 0xa80; // 0x34 *** 2688 => nb samples |
|
1169 | waveform_picker_regs->snapshot_param = 0xa80; // 0x34 *** 2688 => nb samples | |
1169 | waveform_picker_regs->start_date = 0x00; // 0x38 |
|
1170 | waveform_picker_regs->start_date = 0x00; // 0x38 | |
1170 | waveform_picker_regs->nb_word_in_buffer = 0x1f82; // 0x3c *** 2688 * 3 + 2 = 8066 |
|
1171 | waveform_picker_regs->nb_word_in_buffer = 0x1f82; // 0x3c *** 2688 * 3 + 2 = 8066 | |
1171 | } |
|
1172 | } | |
1172 |
|
1173 | |||
1173 | void set_wfp_data_shaping( void ) |
|
1174 | void set_wfp_data_shaping( void ) | |
1174 | { |
|
1175 | { | |
1175 | /** This function sets the data_shaping register of the waveform picker module. |
|
1176 | /** This function sets the data_shaping register of the waveform picker module. | |
1176 | * |
|
1177 | * | |
1177 | * The value is read from one field of the parameter_dump_packet structure:\n |
|
1178 | * The value is read from one field of the parameter_dump_packet structure:\n | |
1178 | * bw_sp0_sp1_r0_r1 |
|
1179 | * bw_sp0_sp1_r0_r1 | |
1179 | * |
|
1180 | * | |
1180 | */ |
|
1181 | */ | |
1181 |
|
1182 | |||
1182 | unsigned char data_shaping; |
|
1183 | unsigned char data_shaping; | |
1183 |
|
1184 | |||
1184 | // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register |
|
1185 | // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register | |
1185 | // waveform picker : [R1 R0 SP1 SP0 BW] |
|
1186 | // waveform picker : [R1 R0 SP1 SP0 BW] | |
1186 |
|
1187 | |||
1187 | data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1; |
|
1188 | data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1; | |
1188 |
|
1189 | |||
1189 | waveform_picker_regs->data_shaping = |
|
1190 | waveform_picker_regs->data_shaping = | |
1190 | ( (data_shaping & 0x10) >> 4 ) // BW |
|
1191 | ( (data_shaping & 0x10) >> 4 ) // BW | |
1191 | + ( (data_shaping & 0x08) >> 2 ) // SP0 |
|
1192 | + ( (data_shaping & 0x08) >> 2 ) // SP0 | |
1192 | + ( (data_shaping & 0x04) ) // SP1 |
|
1193 | + ( (data_shaping & 0x04) ) // SP1 | |
1193 | + ( (data_shaping & 0x02) << 2 ) // R0 |
|
1194 | + ( (data_shaping & 0x02) << 2 ) // R0 | |
1194 | + ( (data_shaping & 0x01) << 4 ); // R1 |
|
1195 | + ( (data_shaping & 0x01) << 4 ); // R1 | |
1195 | } |
|
1196 | } | |
1196 |
|
1197 | |||
1197 | void set_wfp_burst_enable_register( unsigned char mode ) |
|
1198 | void set_wfp_burst_enable_register( unsigned char mode ) | |
1198 | { |
|
1199 | { | |
1199 | /** This function sets the waveform picker burst_enable register depending on the mode. |
|
1200 | /** This function sets the waveform picker burst_enable register depending on the mode. | |
1200 | * |
|
1201 | * | |
1201 | * @param mode is the LFR mode to launch. |
|
1202 | * @param mode is the LFR mode to launch. | |
1202 | * |
|
1203 | * | |
1203 | * The burst bits shall be before the enable bits. |
|
1204 | * The burst bits shall be before the enable bits. | |
1204 | * |
|
1205 | * | |
1205 | */ |
|
1206 | */ | |
1206 |
|
1207 | |||
1207 | // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0 |
|
1208 | // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0 | |
1208 | // the burst bits shall be set first, before the enable bits |
|
1209 | // the burst bits shall be set first, before the enable bits | |
1209 | switch(mode) { |
|
1210 | switch(mode) { | |
1210 | case(LFR_MODE_NORMAL): |
|
1211 | case(LFR_MODE_NORMAL): | |
1211 | waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enable |
|
1212 | waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enable | |
1212 | waveform_picker_regs->run_burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0 |
|
1213 | waveform_picker_regs->run_burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0 | |
1213 | break; |
|
1214 | break; | |
1214 | case(LFR_MODE_BURST): |
|
1215 | case(LFR_MODE_BURST): | |
1215 | waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled |
|
1216 | waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled | |
1216 | // waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x04; // [0100] enable f2 |
|
1217 | // waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x04; // [0100] enable f2 | |
1217 |
waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0 |
|
1218 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0c; // [1100] enable f3 AND f2 | |
1218 | break; |
|
1219 | break; | |
1219 | case(LFR_MODE_SBM1): |
|
1220 | case(LFR_MODE_SBM1): | |
1220 | waveform_picker_regs->run_burst_enable = 0x20; // [0010 0000] f1 burst enabled |
|
1221 | waveform_picker_regs->run_burst_enable = 0x20; // [0010 0000] f1 burst enabled | |
1221 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 |
|
1222 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 | |
1222 | break; |
|
1223 | break; | |
1223 | case(LFR_MODE_SBM2): |
|
1224 | case(LFR_MODE_SBM2): | |
1224 | waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled |
|
1225 | waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled | |
1225 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 |
|
1226 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 | |
1226 | break; |
|
1227 | break; | |
1227 | default: |
|
1228 | default: | |
1228 | waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled |
|
1229 | waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled | |
1229 | break; |
|
1230 | break; | |
1230 | } |
|
1231 | } | |
1231 | } |
|
1232 | } | |
1232 |
|
1233 | |||
1233 | void set_wfp_delta_snapshot( void ) |
|
1234 | void set_wfp_delta_snapshot( void ) | |
1234 | { |
|
1235 | { | |
1235 | /** This function sets the delta_snapshot register of the waveform picker module. |
|
1236 | /** This function sets the delta_snapshot register of the waveform picker module. | |
1236 | * |
|
1237 | * | |
1237 | * The value is read from two (unsigned char) of the parameter_dump_packet structure: |
|
1238 | * The value is read from two (unsigned char) of the parameter_dump_packet structure: | |
1238 | * - sy_lfr_n_swf_p[0] |
|
1239 | * - sy_lfr_n_swf_p[0] | |
1239 | * - sy_lfr_n_swf_p[1] |
|
1240 | * - sy_lfr_n_swf_p[1] | |
1240 | * |
|
1241 | * | |
1241 | */ |
|
1242 | */ | |
1242 |
|
1243 | |||
1243 | unsigned int delta_snapshot; |
|
1244 | unsigned int delta_snapshot; | |
1244 | unsigned int delta_snapshot_in_T2; |
|
1245 | unsigned int delta_snapshot_in_T2; | |
1245 |
|
1246 | |||
1246 | delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256 |
|
1247 | delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256 | |
1247 | + parameter_dump_packet.sy_lfr_n_swf_p[1]; |
|
1248 | + parameter_dump_packet.sy_lfr_n_swf_p[1]; | |
1248 |
|
1249 | |||
1249 | delta_snapshot_in_T2 = delta_snapshot * 256; |
|
1250 | delta_snapshot_in_T2 = delta_snapshot * 256; | |
1250 | waveform_picker_regs->delta_snapshot = delta_snapshot_in_T2; // max 4 bytes |
|
1251 | waveform_picker_regs->delta_snapshot = delta_snapshot_in_T2; // max 4 bytes | |
1251 | } |
|
1252 | } | |
1252 |
|
1253 | |||
1253 | void set_wfp_delta_f0_f0_2( void ) |
|
1254 | void set_wfp_delta_f0_f0_2( void ) | |
1254 | { |
|
1255 | { | |
1255 | unsigned int delta_snapshot; |
|
1256 | unsigned int delta_snapshot; | |
1256 | unsigned int nb_samples_per_snapshot; |
|
1257 | unsigned int nb_samples_per_snapshot; | |
1257 | float delta_f0_in_float; |
|
1258 | float delta_f0_in_float; | |
1258 |
|
1259 | |||
1259 | delta_snapshot = waveform_picker_regs->delta_snapshot; |
|
1260 | delta_snapshot = waveform_picker_regs->delta_snapshot; | |
1260 | nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1]; |
|
1261 | nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1]; | |
1261 | delta_f0_in_float =nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 24576.) * 256.; |
|
1262 | delta_f0_in_float =nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 24576.) * 256.; | |
1262 |
|
1263 | |||
1263 | waveform_picker_regs->delta_f0 = delta_snapshot - floor( delta_f0_in_float ); |
|
1264 | waveform_picker_regs->delta_f0 = delta_snapshot - floor( delta_f0_in_float ); | |
1264 | waveform_picker_regs->delta_f0_2 = 0x7; // max 7 bits |
|
1265 | waveform_picker_regs->delta_f0_2 = 0x7; // max 7 bits | |
1265 | } |
|
1266 | } | |
1266 |
|
1267 | |||
1267 | void set_wfp_delta_f1( void ) |
|
1268 | void set_wfp_delta_f1( void ) | |
1268 | { |
|
1269 | { | |
1269 | unsigned int delta_snapshot; |
|
1270 | unsigned int delta_snapshot; | |
1270 | unsigned int nb_samples_per_snapshot; |
|
1271 | unsigned int nb_samples_per_snapshot; | |
1271 | float delta_f1_in_float; |
|
1272 | float delta_f1_in_float; | |
1272 |
|
1273 | |||
1273 | delta_snapshot = waveform_picker_regs->delta_snapshot; |
|
1274 | delta_snapshot = waveform_picker_regs->delta_snapshot; | |
1274 | nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1]; |
|
1275 | nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1]; | |
1275 | delta_f1_in_float = nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 4096.) * 256.; |
|
1276 | delta_f1_in_float = nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 4096.) * 256.; | |
1276 |
|
1277 | |||
1277 | waveform_picker_regs->delta_f1 = delta_snapshot - floor( delta_f1_in_float ); |
|
1278 | waveform_picker_regs->delta_f1 = delta_snapshot - floor( delta_f1_in_float ); | |
1278 | } |
|
1279 | } | |
1279 |
|
1280 | |||
1280 | void set_wfp_delta_f2() |
|
1281 | void set_wfp_delta_f2() | |
1281 | { |
|
1282 | { | |
1282 | unsigned int delta_snapshot; |
|
1283 | unsigned int delta_snapshot; | |
1283 | unsigned int nb_samples_per_snapshot; |
|
1284 | unsigned int nb_samples_per_snapshot; | |
1284 |
|
1285 | |||
1285 | delta_snapshot = waveform_picker_regs->delta_snapshot; |
|
1286 | delta_snapshot = waveform_picker_regs->delta_snapshot; | |
1286 | nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1]; |
|
1287 | nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1]; | |
1287 |
|
1288 | |||
1288 | waveform_picker_regs->delta_f2 = delta_snapshot - nb_samples_per_snapshot / 2; |
|
1289 | waveform_picker_regs->delta_f2 = delta_snapshot - nb_samples_per_snapshot / 2; | |
1289 | } |
|
1290 | } | |
1290 |
|
1291 | |||
1291 | //***************** |
|
1292 | //***************** | |
1292 | // local parameters |
|
1293 | // local parameters | |
1293 | void set_local_nb_interrupt_f0_MAX( void ) |
|
1294 | void set_local_nb_interrupt_f0_MAX( void ) | |
1294 | { |
|
1295 | { | |
1295 | /** This function sets the value of the nb_interrupt_f0_MAX local parameter. |
|
1296 | /** This function sets the value of the nb_interrupt_f0_MAX local parameter. | |
1296 | * |
|
1297 | * | |
1297 | * This parameter is used for the SM validation only.\n |
|
1298 | * This parameter is used for the SM validation only.\n | |
1298 | * The software waits param_local.local_nb_interrupt_f0_MAX interruptions from the spectral matrices |
|
1299 | * The software waits param_local.local_nb_interrupt_f0_MAX interruptions from the spectral matrices | |
1299 | * module before launching a basic processing. |
|
1300 | * module before launching a basic processing. | |
1300 | * |
|
1301 | * | |
1301 | */ |
|
1302 | */ | |
1302 |
|
1303 | |||
1303 | param_local.local_nb_interrupt_f0_MAX = ( (parameter_dump_packet.sy_lfr_n_asm_p[0]) * 256 |
|
1304 | param_local.local_nb_interrupt_f0_MAX = ( (parameter_dump_packet.sy_lfr_n_asm_p[0]) * 256 | |
1304 | + parameter_dump_packet.sy_lfr_n_asm_p[1] ) * 100; |
|
1305 | + parameter_dump_packet.sy_lfr_n_asm_p[1] ) * 100; | |
1305 | } |
|
1306 | } | |
1306 |
|
1307 | |||
1307 | void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid ) |
|
1308 | void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid ) | |
1308 | { |
|
1309 | { | |
1309 | unsigned short *sequence_cnt; |
|
1310 | unsigned short *sequence_cnt; | |
1310 | unsigned short segmentation_grouping_flag; |
|
1311 | unsigned short segmentation_grouping_flag; | |
1311 | unsigned short new_packet_sequence_control; |
|
1312 | unsigned short new_packet_sequence_control; | |
1312 |
|
1313 | |||
1313 | if ( (sid ==SID_NORM_SWF_F0) || (sid ==SID_NORM_SWF_F1) || (sid ==SID_NORM_SWF_F2) |
|
1314 | if ( (sid ==SID_NORM_SWF_F0) || (sid ==SID_NORM_SWF_F1) || (sid ==SID_NORM_SWF_F2) | |
1314 | || (sid ==SID_NORM_CWF_F3) || (sid==SID_NORM_CWF_LONG_F3) || (sid ==SID_BURST_CWF_F2) ) |
|
1315 | || (sid ==SID_NORM_CWF_F3) || (sid==SID_NORM_CWF_LONG_F3) || (sid ==SID_BURST_CWF_F2) ) | |
1315 | { |
|
1316 | { | |
1316 | sequence_cnt = (unsigned short *) &sequenceCounters_SCIENCE_NORMAL_BURST; |
|
1317 | sequence_cnt = (unsigned short *) &sequenceCounters_SCIENCE_NORMAL_BURST; | |
1317 | } |
|
1318 | } | |
1318 | else if ( (sid ==SID_SBM1_CWF_F1) || (sid ==SID_SBM2_CWF_F2) ) |
|
1319 | else if ( (sid ==SID_SBM1_CWF_F1) || (sid ==SID_SBM2_CWF_F2) ) | |
1319 | { |
|
1320 | { | |
1320 | sequence_cnt = (unsigned short *) &sequenceCounters_SCIENCE_SBM1_SBM2; |
|
1321 | sequence_cnt = (unsigned short *) &sequenceCounters_SCIENCE_SBM1_SBM2; | |
1321 | } |
|
1322 | } | |
1322 | else |
|
1323 | else | |
1323 | { |
|
1324 | { | |
1324 | sequence_cnt = (unsigned short *) NULL; |
|
1325 | sequence_cnt = (unsigned short *) NULL; | |
1325 | PRINTF1("in increment_seq_counter_source_id *** ERR apid_destid %d not known\n", sid) |
|
1326 | PRINTF1("in increment_seq_counter_source_id *** ERR apid_destid %d not known\n", sid) | |
1326 | } |
|
1327 | } | |
1327 |
|
1328 | |||
1328 | if (sequence_cnt != NULL) |
|
1329 | if (sequence_cnt != NULL) | |
1329 | { |
|
1330 | { | |
1330 | // increment the sequence counter |
|
1331 | // increment the sequence counter | |
1331 | if ( *sequence_cnt < SEQ_CNT_MAX) |
|
1332 | if ( *sequence_cnt < SEQ_CNT_MAX) | |
1332 | { |
|
1333 | { | |
1333 | *sequence_cnt = *sequence_cnt + 1; |
|
1334 | *sequence_cnt = *sequence_cnt + 1; | |
1334 | } |
|
1335 | } | |
1335 | else |
|
1336 | else | |
1336 | { |
|
1337 | { | |
1337 | *sequence_cnt = 0; |
|
1338 | *sequence_cnt = 0; | |
1338 | } |
|
1339 | } | |
1339 | segmentation_grouping_flag = TM_PACKET_SEQ_CTRL_STANDALONE << 8; |
|
1340 | segmentation_grouping_flag = TM_PACKET_SEQ_CTRL_STANDALONE << 8; | |
1340 | *sequence_cnt = (*sequence_cnt) & 0x3fff; |
|
1341 | *sequence_cnt = (*sequence_cnt) & 0x3fff; | |
1341 |
|
1342 | |||
1342 | new_packet_sequence_control = segmentation_grouping_flag | (*sequence_cnt) ; |
|
1343 | new_packet_sequence_control = segmentation_grouping_flag | (*sequence_cnt) ; | |
1343 |
|
1344 | |||
1344 | packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8); |
|
1345 | packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8); | |
1345 | packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control ); |
|
1346 | packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control ); | |
1346 | } |
|
1347 | } | |
1347 | } |
|
1348 | } |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now