@@ -0,0 +1,2 | |||||
|
1 | header/common_lfr_headers = https://hephaistos.lpp.polytechnique.fr/rhodecode/HG_REPOSITORIES/LPP/INSTRUMENTATION/SOLO_LFR/lfr_common_headers | |||
|
2 |
@@ -0,0 +1,1 | |||||
|
1 | 0000000000000000000000000000000000000000 header/common_lfr_headers |
1 | NO CONTENT: new file 100644, binary diff hidden |
|
NO CONTENT: new file 100644, binary diff hidden |
1 | NO CONTENT: new file 100644, binary diff hidden |
|
NO CONTENT: new file 100644, binary diff hidden |
1 | NO CONTENT: new file 100644, binary diff hidden |
|
NO CONTENT: new file 100644, binary diff hidden |
@@ -1,14 +1,14 | |||||
1 | syntax: glob |
|
1 | syntax: glob | |
2 |
|
2 | |||
3 | *~ |
|
3 | *~ | |
4 | *.o |
|
4 | *.o | |
5 | *.gcno |
|
5 | *.gcno | |
6 | *.gcda |
|
6 | *.gcda | |
7 | *.html |
|
7 | *.html | |
8 | *.zip |
|
8 | *.zip | |
9 | tests/*.err |
|
9 | tests/*.err | |
10 | doc |
|
10 | doc | |
11 | *.srec |
|
11 | *.srec | |
12 | FSW-qt/bin/fsw |
|
12 | FSW-qt/bin/fsw | |
13 | src/LFR_basic-parameters |
|
13 | src/LFR_basic-parameters | |
14 |
|
14 | *.pro.user.* |
@@ -1,273 +1,273 | |||||
1 | ############################################################################# |
|
1 | ############################################################################# | |
2 | # Makefile for building: bin/fsw |
|
2 | # Makefile for building: bin/fsw | |
3 |
# Generated by qmake (2.01a) (Qt 4.8.6) on: |
|
3 | # Generated by qmake (2.01a) (Qt 4.8.6) on: Wed Nov 26 13:14:53 2014 | |
4 | # Project: fsw-qt.pro |
|
4 | # Project: fsw-qt.pro | |
5 | # Template: app |
|
5 | # Template: app | |
6 | # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro |
|
6 | # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro | |
7 | ############################################################################# |
|
7 | ############################################################################# | |
8 |
|
8 | |||
9 | ####### Compiler, tools and options |
|
9 | ####### Compiler, tools and options | |
10 |
|
10 | |||
11 | CC = sparc-rtems-gcc |
|
11 | CC = sparc-rtems-gcc | |
12 | CXX = sparc-rtems-g++ |
|
12 | CXX = sparc-rtems-g++ | |
13 | DEFINES = -DSW_VERSION_N1=2 -DSW_VERSION_N2=0 -DSW_VERSION_N3=1 -DSW_VERSION_N4=1 -DLPP_DPU_DESTID -DPRINT_MESSAGES_ON_CONSOLE |
|
13 | DEFINES = -DSW_VERSION_N1=2 -DSW_VERSION_N2=0 -DSW_VERSION_N3=1 -DSW_VERSION_N4=1 -DLPP_DPU_DESTID -DPRINT_MESSAGES_ON_CONSOLE | |
14 | CFLAGS = -pipe -O3 -Wall $(DEFINES) |
|
14 | CFLAGS = -pipe -O3 -Wall $(DEFINES) | |
15 | CXXFLAGS = -pipe -O3 -Wall $(DEFINES) |
|
15 | CXXFLAGS = -pipe -O3 -Wall $(DEFINES) | |
16 | INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header -I../header/processing -I../src/LFR_basic-parameters |
|
16 | INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header -I../header/processing -I../src/LFR_basic-parameters | |
17 | LINK = sparc-rtems-g++ |
|
17 | LINK = sparc-rtems-g++ | |
18 | LFLAGS = |
|
18 | LFLAGS = | |
19 | LIBS = $(SUBLIBS) |
|
19 | LIBS = $(SUBLIBS) | |
20 | AR = sparc-rtems-ar rcs |
|
20 | AR = sparc-rtems-ar rcs | |
21 | RANLIB = |
|
21 | RANLIB = | |
22 | QMAKE = /usr/bin/qmake-qt4 |
|
22 | QMAKE = /usr/bin/qmake-qt4 | |
23 | TAR = tar -cf |
|
23 | TAR = tar -cf | |
24 | COMPRESS = gzip -9f |
|
24 | COMPRESS = gzip -9f | |
25 | COPY = cp -f |
|
25 | COPY = cp -f | |
26 | SED = sed |
|
26 | SED = sed | |
27 | COPY_FILE = $(COPY) |
|
27 | COPY_FILE = $(COPY) | |
28 | COPY_DIR = $(COPY) -r |
|
28 | COPY_DIR = $(COPY) -r | |
29 | STRIP = sparc-rtems-strip |
|
29 | STRIP = sparc-rtems-strip | |
30 | INSTALL_FILE = install -m 644 -p |
|
30 | INSTALL_FILE = install -m 644 -p | |
31 | INSTALL_DIR = $(COPY_DIR) |
|
31 | INSTALL_DIR = $(COPY_DIR) | |
32 | INSTALL_PROGRAM = install -m 755 -p |
|
32 | INSTALL_PROGRAM = install -m 755 -p | |
33 | DEL_FILE = rm -f |
|
33 | DEL_FILE = rm -f | |
34 | SYMLINK = ln -f -s |
|
34 | SYMLINK = ln -f -s | |
35 | DEL_DIR = rmdir |
|
35 | DEL_DIR = rmdir | |
36 | MOVE = mv -f |
|
36 | MOVE = mv -f | |
37 | CHK_DIR_EXISTS= test -d |
|
37 | CHK_DIR_EXISTS= test -d | |
38 | MKDIR = mkdir -p |
|
38 | MKDIR = mkdir -p | |
39 |
|
39 | |||
40 | ####### Output directory |
|
40 | ####### Output directory | |
41 |
|
41 | |||
42 | OBJECTS_DIR = obj/ |
|
42 | OBJECTS_DIR = obj/ | |
43 |
|
43 | |||
44 | ####### Files |
|
44 | ####### Files | |
45 |
|
45 | |||
46 | SOURCES = ../src/wf_handler.c \ |
|
46 | SOURCES = ../src/wf_handler.c \ | |
47 | ../src/tc_handler.c \ |
|
47 | ../src/tc_handler.c \ | |
48 | ../src/fsw_misc.c \ |
|
48 | ../src/fsw_misc.c \ | |
49 | ../src/fsw_init.c \ |
|
49 | ../src/fsw_init.c \ | |
50 | ../src/fsw_globals.c \ |
|
50 | ../src/fsw_globals.c \ | |
51 | ../src/fsw_spacewire.c \ |
|
51 | ../src/fsw_spacewire.c \ | |
52 | ../src/tc_load_dump_parameters.c \ |
|
52 | ../src/tc_load_dump_parameters.c \ | |
53 | ../src/tm_lfr_tc_exe.c \ |
|
53 | ../src/tm_lfr_tc_exe.c \ | |
54 | ../src/tc_acceptance.c \ |
|
54 | ../src/tc_acceptance.c \ | |
55 | ../src/processing/fsw_processing.c \ |
|
55 | ../src/processing/fsw_processing.c \ | |
56 | ../src/processing/avf0_prc0.c \ |
|
56 | ../src/processing/avf0_prc0.c \ | |
57 | ../src/processing/avf1_prc1.c \ |
|
57 | ../src/processing/avf1_prc1.c \ | |
58 | ../src/processing/avf2_prc2.c \ |
|
58 | ../src/processing/avf2_prc2.c \ | |
59 | ../src/lfr_cpu_usage_report.c \ |
|
59 | ../src/lfr_cpu_usage_report.c \ | |
60 | ../src/LFR_basic-parameters/basic_parameters.c |
|
60 | ../src/LFR_basic-parameters/basic_parameters.c | |
61 | OBJECTS = obj/wf_handler.o \ |
|
61 | OBJECTS = obj/wf_handler.o \ | |
62 | obj/tc_handler.o \ |
|
62 | obj/tc_handler.o \ | |
63 | obj/fsw_misc.o \ |
|
63 | obj/fsw_misc.o \ | |
64 | obj/fsw_init.o \ |
|
64 | obj/fsw_init.o \ | |
65 | obj/fsw_globals.o \ |
|
65 | obj/fsw_globals.o \ | |
66 | obj/fsw_spacewire.o \ |
|
66 | obj/fsw_spacewire.o \ | |
67 | obj/tc_load_dump_parameters.o \ |
|
67 | obj/tc_load_dump_parameters.o \ | |
68 | obj/tm_lfr_tc_exe.o \ |
|
68 | obj/tm_lfr_tc_exe.o \ | |
69 | obj/tc_acceptance.o \ |
|
69 | obj/tc_acceptance.o \ | |
70 | obj/fsw_processing.o \ |
|
70 | obj/fsw_processing.o \ | |
71 | obj/avf0_prc0.o \ |
|
71 | obj/avf0_prc0.o \ | |
72 | obj/avf1_prc1.o \ |
|
72 | obj/avf1_prc1.o \ | |
73 | obj/avf2_prc2.o \ |
|
73 | obj/avf2_prc2.o \ | |
74 | obj/lfr_cpu_usage_report.o \ |
|
74 | obj/lfr_cpu_usage_report.o \ | |
75 | obj/basic_parameters.o |
|
75 | obj/basic_parameters.o | |
76 | DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \ |
|
76 | DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \ | |
77 | /usr/lib64/qt4/mkspecs/common/linux.conf \ |
|
77 | /usr/lib64/qt4/mkspecs/common/linux.conf \ | |
78 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ |
|
78 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ | |
79 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ |
|
79 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ | |
80 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ |
|
80 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ | |
81 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ |
|
81 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ | |
82 | /usr/lib64/qt4/mkspecs/qconfig.pri \ |
|
82 | /usr/lib64/qt4/mkspecs/qconfig.pri \ | |
83 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ |
|
83 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ | |
84 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ |
|
84 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ | |
85 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ |
|
85 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ | |
86 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ |
|
86 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ | |
87 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ |
|
87 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ | |
88 | sparc.pri \ |
|
88 | sparc.pri \ | |
89 | /usr/lib64/qt4/mkspecs/features/release.prf \ |
|
89 | /usr/lib64/qt4/mkspecs/features/release.prf \ | |
90 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ |
|
90 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ | |
91 | /usr/lib64/qt4/mkspecs/features/shared.prf \ |
|
91 | /usr/lib64/qt4/mkspecs/features/shared.prf \ | |
92 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ |
|
92 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ | |
93 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ |
|
93 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ | |
94 | /usr/lib64/qt4/mkspecs/features/resources.prf \ |
|
94 | /usr/lib64/qt4/mkspecs/features/resources.prf \ | |
95 | /usr/lib64/qt4/mkspecs/features/uic.prf \ |
|
95 | /usr/lib64/qt4/mkspecs/features/uic.prf \ | |
96 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ |
|
96 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ | |
97 | /usr/lib64/qt4/mkspecs/features/lex.prf \ |
|
97 | /usr/lib64/qt4/mkspecs/features/lex.prf \ | |
98 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \ |
|
98 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \ | |
99 | fsw-qt.pro |
|
99 | fsw-qt.pro | |
100 | QMAKE_TARGET = fsw |
|
100 | QMAKE_TARGET = fsw | |
101 | DESTDIR = bin/ |
|
101 | DESTDIR = bin/ | |
102 | TARGET = bin/fsw |
|
102 | TARGET = bin/fsw | |
103 |
|
103 | |||
104 | first: all |
|
104 | first: all | |
105 | ####### Implicit rules |
|
105 | ####### Implicit rules | |
106 |
|
106 | |||
107 | .SUFFIXES: .o .c .cpp .cc .cxx .C |
|
107 | .SUFFIXES: .o .c .cpp .cc .cxx .C | |
108 |
|
108 | |||
109 | .cpp.o: |
|
109 | .cpp.o: | |
110 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
110 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" | |
111 |
|
111 | |||
112 | .cc.o: |
|
112 | .cc.o: | |
113 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
113 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" | |
114 |
|
114 | |||
115 | .cxx.o: |
|
115 | .cxx.o: | |
116 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
116 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" | |
117 |
|
117 | |||
118 | .C.o: |
|
118 | .C.o: | |
119 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
119 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" | |
120 |
|
120 | |||
121 | .c.o: |
|
121 | .c.o: | |
122 | $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<" |
|
122 | $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<" | |
123 |
|
123 | |||
124 | ####### Build rules |
|
124 | ####### Build rules | |
125 |
|
125 | |||
126 | all: Makefile $(TARGET) |
|
126 | all: Makefile $(TARGET) | |
127 |
|
127 | |||
128 | $(TARGET): $(OBJECTS) |
|
128 | $(TARGET): $(OBJECTS) | |
129 | @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/ |
|
129 | @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/ | |
130 | $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) |
|
130 | $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) | |
131 |
|
131 | |||
132 | Makefile: fsw-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \ |
|
132 | Makefile: fsw-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \ | |
133 | /usr/lib64/qt4/mkspecs/common/linux.conf \ |
|
133 | /usr/lib64/qt4/mkspecs/common/linux.conf \ | |
134 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ |
|
134 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ | |
135 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ |
|
135 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ | |
136 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ |
|
136 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ | |
137 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ |
|
137 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ | |
138 | /usr/lib64/qt4/mkspecs/qconfig.pri \ |
|
138 | /usr/lib64/qt4/mkspecs/qconfig.pri \ | |
139 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ |
|
139 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ | |
140 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ |
|
140 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ | |
141 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ |
|
141 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ | |
142 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ |
|
142 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ | |
143 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ |
|
143 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ | |
144 | sparc.pri \ |
|
144 | sparc.pri \ | |
145 | /usr/lib64/qt4/mkspecs/features/release.prf \ |
|
145 | /usr/lib64/qt4/mkspecs/features/release.prf \ | |
146 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ |
|
146 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ | |
147 | /usr/lib64/qt4/mkspecs/features/shared.prf \ |
|
147 | /usr/lib64/qt4/mkspecs/features/shared.prf \ | |
148 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ |
|
148 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ | |
149 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ |
|
149 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ | |
150 | /usr/lib64/qt4/mkspecs/features/resources.prf \ |
|
150 | /usr/lib64/qt4/mkspecs/features/resources.prf \ | |
151 | /usr/lib64/qt4/mkspecs/features/uic.prf \ |
|
151 | /usr/lib64/qt4/mkspecs/features/uic.prf \ | |
152 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ |
|
152 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ | |
153 | /usr/lib64/qt4/mkspecs/features/lex.prf \ |
|
153 | /usr/lib64/qt4/mkspecs/features/lex.prf \ | |
154 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf |
|
154 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf | |
155 | $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro |
|
155 | $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro | |
156 | /usr/lib64/qt4/mkspecs/common/unix.conf: |
|
156 | /usr/lib64/qt4/mkspecs/common/unix.conf: | |
157 | /usr/lib64/qt4/mkspecs/common/linux.conf: |
|
157 | /usr/lib64/qt4/mkspecs/common/linux.conf: | |
158 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf: |
|
158 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf: | |
159 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf: |
|
159 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf: | |
160 | /usr/lib64/qt4/mkspecs/common/g++-base.conf: |
|
160 | /usr/lib64/qt4/mkspecs/common/g++-base.conf: | |
161 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf: |
|
161 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf: | |
162 | /usr/lib64/qt4/mkspecs/qconfig.pri: |
|
162 | /usr/lib64/qt4/mkspecs/qconfig.pri: | |
163 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri: |
|
163 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri: | |
164 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf: |
|
164 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf: | |
165 | /usr/lib64/qt4/mkspecs/features/qt_config.prf: |
|
165 | /usr/lib64/qt4/mkspecs/features/qt_config.prf: | |
166 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf: |
|
166 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf: | |
167 | /usr/lib64/qt4/mkspecs/features/default_pre.prf: |
|
167 | /usr/lib64/qt4/mkspecs/features/default_pre.prf: | |
168 | sparc.pri: |
|
168 | sparc.pri: | |
169 | /usr/lib64/qt4/mkspecs/features/release.prf: |
|
169 | /usr/lib64/qt4/mkspecs/features/release.prf: | |
170 | /usr/lib64/qt4/mkspecs/features/default_post.prf: |
|
170 | /usr/lib64/qt4/mkspecs/features/default_post.prf: | |
171 | /usr/lib64/qt4/mkspecs/features/shared.prf: |
|
171 | /usr/lib64/qt4/mkspecs/features/shared.prf: | |
172 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf: |
|
172 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf: | |
173 | /usr/lib64/qt4/mkspecs/features/warn_on.prf: |
|
173 | /usr/lib64/qt4/mkspecs/features/warn_on.prf: | |
174 | /usr/lib64/qt4/mkspecs/features/resources.prf: |
|
174 | /usr/lib64/qt4/mkspecs/features/resources.prf: | |
175 | /usr/lib64/qt4/mkspecs/features/uic.prf: |
|
175 | /usr/lib64/qt4/mkspecs/features/uic.prf: | |
176 | /usr/lib64/qt4/mkspecs/features/yacc.prf: |
|
176 | /usr/lib64/qt4/mkspecs/features/yacc.prf: | |
177 | /usr/lib64/qt4/mkspecs/features/lex.prf: |
|
177 | /usr/lib64/qt4/mkspecs/features/lex.prf: | |
178 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf: |
|
178 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf: | |
179 | qmake: FORCE |
|
179 | qmake: FORCE | |
180 | @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro |
|
180 | @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro | |
181 |
|
181 | |||
182 | dist: |
|
182 | dist: | |
183 | @$(CHK_DIR_EXISTS) obj/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0 |
|
183 | @$(CHK_DIR_EXISTS) obj/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0 | |
184 | $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/fsw1.0.0/ && (cd `dirname obj/fsw1.0.0` && $(TAR) fsw1.0.0.tar fsw1.0.0 && $(COMPRESS) fsw1.0.0.tar) && $(MOVE) `dirname obj/fsw1.0.0`/fsw1.0.0.tar.gz . && $(DEL_FILE) -r obj/fsw1.0.0 |
|
184 | $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/fsw1.0.0/ && (cd `dirname obj/fsw1.0.0` && $(TAR) fsw1.0.0.tar fsw1.0.0 && $(COMPRESS) fsw1.0.0.tar) && $(MOVE) `dirname obj/fsw1.0.0`/fsw1.0.0.tar.gz . && $(DEL_FILE) -r obj/fsw1.0.0 | |
185 |
|
185 | |||
186 |
|
186 | |||
187 | clean:compiler_clean |
|
187 | clean:compiler_clean | |
188 | -$(DEL_FILE) $(OBJECTS) |
|
188 | -$(DEL_FILE) $(OBJECTS) | |
189 | -$(DEL_FILE) *~ core *.core |
|
189 | -$(DEL_FILE) *~ core *.core | |
190 |
|
190 | |||
191 |
|
191 | |||
192 | ####### Sub-libraries |
|
192 | ####### Sub-libraries | |
193 |
|
193 | |||
194 | distclean: clean |
|
194 | distclean: clean | |
195 | -$(DEL_FILE) $(TARGET) |
|
195 | -$(DEL_FILE) $(TARGET) | |
196 | -$(DEL_FILE) Makefile |
|
196 | -$(DEL_FILE) Makefile | |
197 |
|
197 | |||
198 |
|
198 | |||
199 | grmon: |
|
199 | grmon: | |
200 | cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u |
|
200 | cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u | |
201 |
|
201 | |||
202 | check: first |
|
202 | check: first | |
203 |
|
203 | |||
204 | compiler_rcc_make_all: |
|
204 | compiler_rcc_make_all: | |
205 | compiler_rcc_clean: |
|
205 | compiler_rcc_clean: | |
206 | compiler_uic_make_all: |
|
206 | compiler_uic_make_all: | |
207 | compiler_uic_clean: |
|
207 | compiler_uic_clean: | |
208 | compiler_image_collection_make_all: qmake_image_collection.cpp |
|
208 | compiler_image_collection_make_all: qmake_image_collection.cpp | |
209 | compiler_image_collection_clean: |
|
209 | compiler_image_collection_clean: | |
210 | -$(DEL_FILE) qmake_image_collection.cpp |
|
210 | -$(DEL_FILE) qmake_image_collection.cpp | |
211 | compiler_yacc_decl_make_all: |
|
211 | compiler_yacc_decl_make_all: | |
212 | compiler_yacc_decl_clean: |
|
212 | compiler_yacc_decl_clean: | |
213 | compiler_yacc_impl_make_all: |
|
213 | compiler_yacc_impl_make_all: | |
214 | compiler_yacc_impl_clean: |
|
214 | compiler_yacc_impl_clean: | |
215 | compiler_lex_make_all: |
|
215 | compiler_lex_make_all: | |
216 | compiler_lex_clean: |
|
216 | compiler_lex_clean: | |
217 | compiler_clean: |
|
217 | compiler_clean: | |
218 |
|
218 | |||
219 | ####### Compile |
|
219 | ####### Compile | |
220 |
|
220 | |||
221 | obj/wf_handler.o: ../src/wf_handler.c |
|
221 | obj/wf_handler.o: ../src/wf_handler.c | |
222 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/wf_handler.o ../src/wf_handler.c |
|
222 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/wf_handler.o ../src/wf_handler.c | |
223 |
|
223 | |||
224 | obj/tc_handler.o: ../src/tc_handler.c |
|
224 | obj/tc_handler.o: ../src/tc_handler.c | |
225 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o ../src/tc_handler.c |
|
225 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o ../src/tc_handler.c | |
226 |
|
226 | |||
227 | obj/fsw_misc.o: ../src/fsw_misc.c |
|
227 | obj/fsw_misc.o: ../src/fsw_misc.c | |
228 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c |
|
228 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c | |
229 |
|
229 | |||
230 | obj/fsw_init.o: ../src/fsw_init.c ../src/fsw_config.c |
|
230 | obj/fsw_init.o: ../src/fsw_init.c ../src/fsw_config.c | |
231 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o ../src/fsw_init.c |
|
231 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o ../src/fsw_init.c | |
232 |
|
232 | |||
233 | obj/fsw_globals.o: ../src/fsw_globals.c |
|
233 | obj/fsw_globals.o: ../src/fsw_globals.c | |
234 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c |
|
234 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c | |
235 |
|
235 | |||
236 | obj/fsw_spacewire.o: ../src/fsw_spacewire.c |
|
236 | obj/fsw_spacewire.o: ../src/fsw_spacewire.c | |
237 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spacewire.o ../src/fsw_spacewire.c |
|
237 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spacewire.o ../src/fsw_spacewire.c | |
238 |
|
238 | |||
239 | obj/tc_load_dump_parameters.o: ../src/tc_load_dump_parameters.c |
|
239 | obj/tc_load_dump_parameters.o: ../src/tc_load_dump_parameters.c | |
240 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_load_dump_parameters.o ../src/tc_load_dump_parameters.c |
|
240 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_load_dump_parameters.o ../src/tc_load_dump_parameters.c | |
241 |
|
241 | |||
242 | obj/tm_lfr_tc_exe.o: ../src/tm_lfr_tc_exe.c |
|
242 | obj/tm_lfr_tc_exe.o: ../src/tm_lfr_tc_exe.c | |
243 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tm_lfr_tc_exe.o ../src/tm_lfr_tc_exe.c |
|
243 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tm_lfr_tc_exe.o ../src/tm_lfr_tc_exe.c | |
244 |
|
244 | |||
245 | obj/tc_acceptance.o: ../src/tc_acceptance.c |
|
245 | obj/tc_acceptance.o: ../src/tc_acceptance.c | |
246 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_acceptance.o ../src/tc_acceptance.c |
|
246 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_acceptance.o ../src/tc_acceptance.c | |
247 |
|
247 | |||
248 | obj/fsw_processing.o: ../src/processing/fsw_processing.c |
|
248 | obj/fsw_processing.o: ../src/processing/fsw_processing.c | |
249 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/processing/fsw_processing.c |
|
249 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/processing/fsw_processing.c | |
250 |
|
250 | |||
251 | obj/avf0_prc0.o: ../src/processing/avf0_prc0.c |
|
251 | obj/avf0_prc0.o: ../src/processing/avf0_prc0.c | |
252 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf0_prc0.o ../src/processing/avf0_prc0.c |
|
252 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf0_prc0.o ../src/processing/avf0_prc0.c | |
253 |
|
253 | |||
254 | obj/avf1_prc1.o: ../src/processing/avf1_prc1.c |
|
254 | obj/avf1_prc1.o: ../src/processing/avf1_prc1.c | |
255 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf1_prc1.o ../src/processing/avf1_prc1.c |
|
255 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf1_prc1.o ../src/processing/avf1_prc1.c | |
256 |
|
256 | |||
257 | obj/avf2_prc2.o: ../src/processing/avf2_prc2.c |
|
257 | obj/avf2_prc2.o: ../src/processing/avf2_prc2.c | |
258 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf2_prc2.o ../src/processing/avf2_prc2.c |
|
258 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf2_prc2.o ../src/processing/avf2_prc2.c | |
259 |
|
259 | |||
260 | obj/lfr_cpu_usage_report.o: ../src/lfr_cpu_usage_report.c |
|
260 | obj/lfr_cpu_usage_report.o: ../src/lfr_cpu_usage_report.c | |
261 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/lfr_cpu_usage_report.o ../src/lfr_cpu_usage_report.c |
|
261 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/lfr_cpu_usage_report.o ../src/lfr_cpu_usage_report.c | |
262 |
|
262 | |||
263 | obj/basic_parameters.o: ../src/LFR_basic-parameters/basic_parameters.c |
|
263 | obj/basic_parameters.o: ../src/LFR_basic-parameters/basic_parameters.c | |
264 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/basic_parameters.o ../src/LFR_basic-parameters/basic_parameters.c |
|
264 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/basic_parameters.o ../src/LFR_basic-parameters/basic_parameters.c | |
265 |
|
265 | |||
266 | ####### Install |
|
266 | ####### Install | |
267 |
|
267 | |||
268 | install: FORCE |
|
268 | install: FORCE | |
269 |
|
269 | |||
270 | uninstall: FORCE |
|
270 | uninstall: FORCE | |
271 |
|
271 | |||
272 | FORCE: |
|
272 | FORCE: | |
273 |
|
273 |
@@ -1,208 +1,208 | |||||
1 | <?xml version="1.0" encoding="UTF-8"?> |
|
1 | <?xml version="1.0" encoding="UTF-8"?> | |
2 | <!DOCTYPE QtCreatorProject> |
|
2 | <!DOCTYPE QtCreatorProject> | |
3 |
<!-- Written by QtCreator 3.2.1, 2014-1 |
|
3 | <!-- Written by QtCreator 3.2.1, 2014-12-10T17:20:49. --> | |
4 | <qtcreator> |
|
4 | <qtcreator> | |
5 | <data> |
|
5 | <data> | |
6 | <variable>EnvironmentId</variable> |
|
6 | <variable>EnvironmentId</variable> | |
7 | <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value> |
|
7 | <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value> | |
8 | </data> |
|
8 | </data> | |
9 | <data> |
|
9 | <data> | |
10 | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
|
10 | <variable>ProjectExplorer.Project.ActiveTarget</variable> | |
11 | <value type="int">0</value> |
|
11 | <value type="int">0</value> | |
12 | </data> |
|
12 | </data> | |
13 | <data> |
|
13 | <data> | |
14 | <variable>ProjectExplorer.Project.EditorSettings</variable> |
|
14 | <variable>ProjectExplorer.Project.EditorSettings</variable> | |
15 | <valuemap type="QVariantMap"> |
|
15 | <valuemap type="QVariantMap"> | |
16 | <value type="bool" key="EditorConfiguration.AutoIndent">true</value> |
|
16 | <value type="bool" key="EditorConfiguration.AutoIndent">true</value> | |
17 | <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value> |
|
17 | <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value> | |
18 | <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value> |
|
18 | <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value> | |
19 | <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0"> |
|
19 | <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0"> | |
20 | <value type="QString" key="language">Cpp</value> |
|
20 | <value type="QString" key="language">Cpp</value> | |
21 | <valuemap type="QVariantMap" key="value"> |
|
21 | <valuemap type="QVariantMap" key="value"> | |
22 | <value type="QByteArray" key="CurrentPreferences">CppGlobal</value> |
|
22 | <value type="QByteArray" key="CurrentPreferences">CppGlobal</value> | |
23 | </valuemap> |
|
23 | </valuemap> | |
24 | </valuemap> |
|
24 | </valuemap> | |
25 | <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1"> |
|
25 | <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1"> | |
26 | <value type="QString" key="language">QmlJS</value> |
|
26 | <value type="QString" key="language">QmlJS</value> | |
27 | <valuemap type="QVariantMap" key="value"> |
|
27 | <valuemap type="QVariantMap" key="value"> | |
28 | <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value> |
|
28 | <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value> | |
29 | </valuemap> |
|
29 | </valuemap> | |
30 | </valuemap> |
|
30 | </valuemap> | |
31 | <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value> |
|
31 | <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value> | |
32 | <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value> |
|
32 | <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value> | |
33 | <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value> |
|
33 | <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value> | |
34 | <value type="int" key="EditorConfiguration.IndentSize">4</value> |
|
34 | <value type="int" key="EditorConfiguration.IndentSize">4</value> | |
35 | <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value> |
|
35 | <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value> | |
36 | <value type="int" key="EditorConfiguration.MarginColumn">80</value> |
|
36 | <value type="int" key="EditorConfiguration.MarginColumn">80</value> | |
37 | <value type="bool" key="EditorConfiguration.MouseHiding">true</value> |
|
37 | <value type="bool" key="EditorConfiguration.MouseHiding">true</value> | |
38 | <value type="bool" key="EditorConfiguration.MouseNavigation">true</value> |
|
38 | <value type="bool" key="EditorConfiguration.MouseNavigation">true</value> | |
39 | <value type="int" key="EditorConfiguration.PaddingMode">1</value> |
|
39 | <value type="int" key="EditorConfiguration.PaddingMode">1</value> | |
40 | <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value> |
|
40 | <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value> | |
41 | <value type="bool" key="EditorConfiguration.ShowMargin">false</value> |
|
41 | <value type="bool" key="EditorConfiguration.ShowMargin">false</value> | |
42 | <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value> |
|
42 | <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value> | |
43 | <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value> |
|
43 | <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value> | |
44 | <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value> |
|
44 | <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value> | |
45 | <value type="int" key="EditorConfiguration.TabSize">8</value> |
|
45 | <value type="int" key="EditorConfiguration.TabSize">8</value> | |
46 | <value type="bool" key="EditorConfiguration.UseGlobal">true</value> |
|
46 | <value type="bool" key="EditorConfiguration.UseGlobal">true</value> | |
47 | <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value> |
|
47 | <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value> | |
48 | <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value> |
|
48 | <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value> | |
49 | <value type="bool" key="EditorConfiguration.cleanIndentation">true</value> |
|
49 | <value type="bool" key="EditorConfiguration.cleanIndentation">true</value> | |
50 | <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value> |
|
50 | <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value> | |
51 | <value type="bool" key="EditorConfiguration.inEntireDocument">false</value> |
|
51 | <value type="bool" key="EditorConfiguration.inEntireDocument">false</value> | |
52 | </valuemap> |
|
52 | </valuemap> | |
53 | </data> |
|
53 | </data> | |
54 | <data> |
|
54 | <data> | |
55 | <variable>ProjectExplorer.Project.PluginSettings</variable> |
|
55 | <variable>ProjectExplorer.Project.PluginSettings</variable> | |
56 | <valuemap type="QVariantMap"/> |
|
56 | <valuemap type="QVariantMap"/> | |
57 | </data> |
|
57 | </data> | |
58 | <data> |
|
58 | <data> | |
59 | <variable>ProjectExplorer.Project.Target.0</variable> |
|
59 | <variable>ProjectExplorer.Project.Target.0</variable> | |
60 | <valuemap type="QVariantMap"> |
|
60 | <valuemap type="QVariantMap"> | |
61 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.2 in PATH (System)</value> |
|
61 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.2 in PATH (System)</value> | |
62 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.2 in PATH (System)</value> |
|
62 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.2 in PATH (System)</value> | |
63 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{5289e843-9ef2-45ce-88c6-ad27d8e08def}</value> |
|
63 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{5289e843-9ef2-45ce-88c6-ad27d8e08def}</value> | |
64 | <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value> |
|
64 | <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value> | |
65 | <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> |
|
65 | <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> | |
66 | <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> |
|
66 | <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> | |
67 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> |
|
67 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> | |
68 | <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory"></value> |
|
68 | <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory"></value> | |
69 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|
69 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> | |
70 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
70 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> | |
71 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
71 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> | |
72 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> |
|
72 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> | |
73 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
73 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
74 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> |
|
74 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> | |
75 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> |
|
75 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> | |
76 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value> |
|
76 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value> | |
77 | <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> |
|
77 | <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> | |
78 | <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> |
|
78 | <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> | |
79 | </valuemap> |
|
79 | </valuemap> | |
80 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> |
|
80 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> | |
81 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
81 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> | |
82 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
82 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> | |
83 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
83 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
84 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
84 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> | |
85 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
85 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> | |
86 | <value type="QString">-w</value> |
|
86 | <value type="QString">-w</value> | |
87 | <value type="QString">-r</value> |
|
87 | <value type="QString">-r</value> | |
88 | </valuelist> |
|
88 | </valuelist> | |
89 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> |
|
89 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> | |
90 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> |
|
90 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> | |
91 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
91 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> | |
92 | </valuemap> |
|
92 | </valuemap> | |
93 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> |
|
93 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> | |
94 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> |
|
94 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</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">ProjectExplorer.BuildSteps.Build</value> |
|
96 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> | |
97 | </valuemap> |
|
97 | </valuemap> | |
98 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> |
|
98 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> | |
99 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
99 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> | |
100 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
100 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> | |
101 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
101 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> | |
102 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
102 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
103 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
103 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> | |
104 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
104 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> | |
105 | <value type="QString">-w</value> |
|
105 | <value type="QString">-w</value> | |
106 | <value type="QString">-r</value> |
|
106 | <value type="QString">-r</value> | |
107 | </valuelist> |
|
107 | </valuelist> | |
108 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> |
|
108 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> | |
109 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> |
|
109 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> | |
110 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
110 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> | |
111 | </valuemap> |
|
111 | </valuemap> | |
112 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> |
|
112 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> | |
113 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> |
|
113 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</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">ProjectExplorer.BuildSteps.Clean</value> |
|
115 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> | |
116 | </valuemap> |
|
116 | </valuemap> | |
117 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> |
|
117 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> | |
118 | <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> |
|
118 | <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> | |
119 | <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> |
|
119 | <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> | |
120 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value> |
|
120 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value> | |
121 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
121 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
122 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> |
|
122 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> | |
123 | <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> |
|
123 | <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> | |
124 | <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> |
|
124 | <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> | |
125 | </valuemap> |
|
125 | </valuemap> | |
126 | <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value> |
|
126 | <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value> | |
127 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0"> |
|
127 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0"> | |
128 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|
128 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> | |
129 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value> |
|
129 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value> | |
130 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value> |
|
130 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value> | |
131 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
131 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
132 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value> |
|
132 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value> | |
133 | </valuemap> |
|
133 | </valuemap> | |
134 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value> |
|
134 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value> | |
135 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value> |
|
135 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value> | |
136 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
136 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
137 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value> |
|
137 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value> | |
138 | </valuemap> |
|
138 | </valuemap> | |
139 | <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> |
|
139 | <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> | |
140 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/> |
|
140 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/> | |
141 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> |
|
141 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> | |
142 | <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> |
|
142 | <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> | |
143 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> |
|
143 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> | |
144 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> |
|
144 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> | |
145 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> |
|
145 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> | |
146 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> |
|
146 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> | |
147 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> |
|
147 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> | |
148 | <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> |
|
148 | <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> | |
149 | <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> |
|
149 | <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> | |
150 | <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> |
|
150 | <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> | |
151 | <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value> |
|
151 | <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value> | |
152 | <value type="int" key="Analyzer.Valgrind.NumCallers">25</value> |
|
152 | <value type="int" key="Analyzer.Valgrind.NumCallers">25</value> | |
153 | <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> |
|
153 | <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> | |
154 | <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value> |
|
154 | <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value> | |
155 | <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value> |
|
155 | <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value> | |
156 | <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value> |
|
156 | <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value> | |
157 | <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> |
|
157 | <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> | |
158 | <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> |
|
158 | <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> | |
159 | <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> |
|
159 | <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> | |
160 | <value type="int">0</value> |
|
160 | <value type="int">0</value> | |
161 | <value type="int">1</value> |
|
161 | <value type="int">1</value> | |
162 | <value type="int">2</value> |
|
162 | <value type="int">2</value> | |
163 | <value type="int">3</value> |
|
163 | <value type="int">3</value> | |
164 | <value type="int">4</value> |
|
164 | <value type="int">4</value> | |
165 | <value type="int">5</value> |
|
165 | <value type="int">5</value> | |
166 | <value type="int">6</value> |
|
166 | <value type="int">6</value> | |
167 | <value type="int">7</value> |
|
167 | <value type="int">7</value> | |
168 | <value type="int">8</value> |
|
168 | <value type="int">8</value> | |
169 | <value type="int">9</value> |
|
169 | <value type="int">9</value> | |
170 | <value type="int">10</value> |
|
170 | <value type="int">10</value> | |
171 | <value type="int">11</value> |
|
171 | <value type="int">11</value> | |
172 | <value type="int">12</value> |
|
172 | <value type="int">12</value> | |
173 | <value type="int">13</value> |
|
173 | <value type="int">13</value> | |
174 | <value type="int">14</value> |
|
174 | <value type="int">14</value> | |
175 | </valuelist> |
|
175 | </valuelist> | |
176 | <value type="int" key="PE.EnvironmentAspect.Base">2</value> |
|
176 | <value type="int" key="PE.EnvironmentAspect.Base">2</value> | |
177 | <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> |
|
177 | <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> | |
178 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value> |
|
178 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value> | |
179 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
179 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
180 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value> |
|
180 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value> | |
181 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value> |
|
181 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value> | |
182 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value> |
|
182 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value> | |
183 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value> |
|
183 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value> | |
184 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value> |
|
184 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value> | |
185 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value> |
|
185 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value> | |
186 | <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> |
|
186 | <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> | |
187 | <value type="bool" key="RunConfiguration.UseCppDebugger">true</value> |
|
187 | <value type="bool" key="RunConfiguration.UseCppDebugger">true</value> | |
188 | <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value> |
|
188 | <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value> | |
189 | <value type="bool" key="RunConfiguration.UseMultiProcess">false</value> |
|
189 | <value type="bool" key="RunConfiguration.UseMultiProcess">false</value> | |
190 | <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> |
|
190 | <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> | |
191 | <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> |
|
191 | <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> | |
192 | </valuemap> |
|
192 | </valuemap> | |
193 | <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value> |
|
193 | <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value> | |
194 | </valuemap> |
|
194 | </valuemap> | |
195 | </data> |
|
195 | </data> | |
196 | <data> |
|
196 | <data> | |
197 | <variable>ProjectExplorer.Project.TargetCount</variable> |
|
197 | <variable>ProjectExplorer.Project.TargetCount</variable> | |
198 | <value type="int">1</value> |
|
198 | <value type="int">1</value> | |
199 | </data> |
|
199 | </data> | |
200 | <data> |
|
200 | <data> | |
201 | <variable>ProjectExplorer.Project.Updater.FileVersion</variable> |
|
201 | <variable>ProjectExplorer.Project.Updater.FileVersion</variable> | |
202 | <value type="int">16</value> |
|
202 | <value type="int">16</value> | |
203 | </data> |
|
203 | </data> | |
204 | <data> |
|
204 | <data> | |
205 | <variable>Version</variable> |
|
205 | <variable>Version</variable> | |
206 | <value type="int">16</value> |
|
206 | <value type="int">16</value> | |
207 | </data> |
|
207 | </data> | |
208 | </qtcreator> |
|
208 | </qtcreator> |
@@ -1,574 +1,574 | |||||
1 | /** General usage functions and RTEMS tasks. |
|
1 | /** General usage functions and RTEMS tasks. | |
2 | * |
|
2 | * | |
3 | * @file |
|
3 | * @file | |
4 | * @author P. LEROY |
|
4 | * @author P. LEROY | |
5 | * |
|
5 | * | |
6 | */ |
|
6 | */ | |
7 |
|
7 | |||
8 | #include "fsw_misc.h" |
|
8 | #include "fsw_misc.h" | |
9 |
|
9 | |||
10 | void configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider, |
|
10 | void configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider, | |
11 | unsigned char interrupt_level, rtems_isr (*timer_isr)() ) |
|
11 | unsigned char interrupt_level, rtems_isr (*timer_isr)() ) | |
12 | { |
|
12 | { | |
13 | /** This function configures a GPTIMER timer instantiated in the VHDL design. |
|
13 | /** This function configures a GPTIMER timer instantiated in the VHDL design. | |
14 | * |
|
14 | * | |
15 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. |
|
15 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. | |
16 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). |
|
16 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). | |
17 | * @param clock_divider is the divider of the 1 MHz clock that will be configured. |
|
17 | * @param clock_divider is the divider of the 1 MHz clock that will be configured. | |
18 | * @param interrupt_level is the interrupt level that the timer drives. |
|
18 | * @param interrupt_level is the interrupt level that the timer drives. | |
19 | * @param timer_isr is the interrupt subroutine that will be attached to the IRQ driven by the timer. |
|
19 | * @param timer_isr is the interrupt subroutine that will be attached to the IRQ driven by the timer. | |
20 | * |
|
20 | * | |
21 | * Interrupt levels are described in the SPARC documentation sparcv8.pdf p.76 |
|
21 | * Interrupt levels are described in the SPARC documentation sparcv8.pdf p.76 | |
22 | * |
|
22 | * | |
23 | */ |
|
23 | */ | |
24 |
|
24 | |||
25 | rtems_status_code status; |
|
25 | rtems_status_code status; | |
26 | rtems_isr_entry old_isr_handler; |
|
26 | rtems_isr_entry old_isr_handler; | |
27 |
|
27 | |||
28 | gptimer_regs->timer[timer].ctrl = 0x00; // reset the control register |
|
28 | gptimer_regs->timer[timer].ctrl = 0x00; // reset the control register | |
29 |
|
29 | |||
30 | status = rtems_interrupt_catch( timer_isr, interrupt_level, &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels |
|
30 | status = rtems_interrupt_catch( timer_isr, interrupt_level, &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels | |
31 | if (status!=RTEMS_SUCCESSFUL) |
|
31 | if (status!=RTEMS_SUCCESSFUL) | |
32 | { |
|
32 | { | |
33 | PRINTF("in configure_timer *** ERR rtems_interrupt_catch\n") |
|
33 | PRINTF("in configure_timer *** ERR rtems_interrupt_catch\n") | |
34 | } |
|
34 | } | |
35 |
|
35 | |||
36 | timer_set_clock_divider( gptimer_regs, timer, clock_divider); |
|
36 | timer_set_clock_divider( gptimer_regs, timer, clock_divider); | |
37 | } |
|
37 | } | |
38 |
|
38 | |||
39 | void timer_start(gptimer_regs_t *gptimer_regs, unsigned char timer) |
|
39 | void timer_start(gptimer_regs_t *gptimer_regs, unsigned char timer) | |
40 | { |
|
40 | { | |
41 | /** This function starts a GPTIMER timer. |
|
41 | /** This function starts a GPTIMER timer. | |
42 | * |
|
42 | * | |
43 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. |
|
43 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. | |
44 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). |
|
44 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). | |
45 | * |
|
45 | * | |
46 | */ |
|
46 | */ | |
47 |
|
47 | |||
48 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any |
|
48 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any | |
49 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000004; // LD load value from the reload register |
|
49 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000004; // LD load value from the reload register | |
50 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000001; // EN enable the timer |
|
50 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000001; // EN enable the timer | |
51 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000002; // RS restart |
|
51 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000002; // RS restart | |
52 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000008; // IE interrupt enable |
|
52 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000008; // IE interrupt enable | |
53 | } |
|
53 | } | |
54 |
|
54 | |||
55 | void timer_stop(gptimer_regs_t *gptimer_regs, unsigned char timer) |
|
55 | void timer_stop(gptimer_regs_t *gptimer_regs, unsigned char timer) | |
56 | { |
|
56 | { | |
57 | /** This function stops a GPTIMER timer. |
|
57 | /** This function stops a GPTIMER timer. | |
58 | * |
|
58 | * | |
59 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. |
|
59 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. | |
60 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). |
|
60 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). | |
61 | * |
|
61 | * | |
62 | */ |
|
62 | */ | |
63 |
|
63 | |||
64 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xfffffffe; // EN enable the timer |
|
64 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xfffffffe; // EN enable the timer | |
65 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xffffffef; // IE interrupt enable |
|
65 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xffffffef; // IE interrupt enable | |
66 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any |
|
66 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any | |
67 | } |
|
67 | } | |
68 |
|
68 | |||
69 | void timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider) |
|
69 | void timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider) | |
70 | { |
|
70 | { | |
71 | /** This function sets the clock divider of a GPTIMER timer. |
|
71 | /** This function sets the clock divider of a GPTIMER timer. | |
72 | * |
|
72 | * | |
73 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. |
|
73 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. | |
74 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). |
|
74 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). | |
75 | * @param clock_divider is the divider of the 1 MHz clock that will be configured. |
|
75 | * @param clock_divider is the divider of the 1 MHz clock that will be configured. | |
76 | * |
|
76 | * | |
77 | */ |
|
77 | */ | |
78 |
|
78 | |||
79 | gptimer_regs->timer[timer].reload = clock_divider; // base clock frequency is 1 MHz |
|
79 | gptimer_regs->timer[timer].reload = clock_divider; // base clock frequency is 1 MHz | |
80 | } |
|
80 | } | |
81 |
|
81 | |||
82 | int send_console_outputs_on_apbuart_port( void ) // Send the console outputs on the apbuart port |
|
82 | int send_console_outputs_on_apbuart_port( void ) // Send the console outputs on the apbuart port | |
83 | { |
|
83 | { | |
84 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART; |
|
84 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART; | |
85 |
|
85 | |||
86 | apbuart_regs->ctrl = APBUART_CTRL_REG_MASK_TE; |
|
86 | apbuart_regs->ctrl = APBUART_CTRL_REG_MASK_TE; | |
87 |
|
87 | |||
88 | return 0; |
|
88 | return 0; | |
89 | } |
|
89 | } | |
90 |
|
90 | |||
91 | int enable_apbuart_transmitter( void ) // set the bit 1, TE Transmitter Enable to 1 in the APBUART control register |
|
91 | int enable_apbuart_transmitter( void ) // set the bit 1, TE Transmitter Enable to 1 in the APBUART control register | |
92 | { |
|
92 | { | |
93 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART; |
|
93 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART; | |
94 |
|
94 | |||
95 | apbuart_regs->ctrl = apbuart_regs->ctrl | APBUART_CTRL_REG_MASK_TE; |
|
95 | apbuart_regs->ctrl = apbuart_regs->ctrl | APBUART_CTRL_REG_MASK_TE; | |
96 |
|
96 | |||
97 | return 0; |
|
97 | return 0; | |
98 | } |
|
98 | } | |
99 |
|
99 | |||
100 | void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value) |
|
100 | void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value) | |
101 | { |
|
101 | { | |
102 | /** This function sets the scaler reload register of the apbuart module |
|
102 | /** This function sets the scaler reload register of the apbuart module | |
103 | * |
|
103 | * | |
104 | * @param regs is the address of the apbuart registers in memory |
|
104 | * @param regs is the address of the apbuart registers in memory | |
105 | * @param value is the value that will be stored in the scaler register |
|
105 | * @param value is the value that will be stored in the scaler register | |
106 | * |
|
106 | * | |
107 | * The value shall be set by the software to get data on the serial interface. |
|
107 | * The value shall be set by the software to get data on the serial interface. | |
108 | * |
|
108 | * | |
109 | */ |
|
109 | */ | |
110 |
|
110 | |||
111 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) regs; |
|
111 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) regs; | |
112 |
|
112 | |||
113 | apbuart_regs->scaler = value; |
|
113 | apbuart_regs->scaler = value; | |
114 | BOOT_PRINTF1("OK *** apbuart port scaler reload register set to 0x%x\n", value) |
|
114 | BOOT_PRINTF1("OK *** apbuart port scaler reload register set to 0x%x\n", value) | |
115 | } |
|
115 | } | |
116 |
|
116 | |||
117 | //************ |
|
117 | //************ | |
118 | // RTEMS TASKS |
|
118 | // RTEMS TASKS | |
119 |
|
119 | |||
120 | rtems_task stat_task(rtems_task_argument argument) |
|
120 | rtems_task stat_task(rtems_task_argument argument) | |
121 | { |
|
121 | { | |
122 | int i; |
|
122 | int i; | |
123 | int j; |
|
123 | int j; | |
124 | i = 0; |
|
124 | i = 0; | |
125 | j = 0; |
|
125 | j = 0; | |
126 | BOOT_PRINTF("in STAT *** \n") |
|
126 | BOOT_PRINTF("in STAT *** \n") | |
127 | while(1){ |
|
127 | while(1){ | |
128 | rtems_task_wake_after(1000); |
|
128 | rtems_task_wake_after(1000); | |
129 | PRINTF1("%d\n", j) |
|
129 | PRINTF1("%d\n", j) | |
130 | if (i == CPU_USAGE_REPORT_PERIOD) { |
|
130 | if (i == CPU_USAGE_REPORT_PERIOD) { | |
131 | // #ifdef PRINT_TASK_STATISTICS |
|
131 | // #ifdef PRINT_TASK_STATISTICS | |
132 | // rtems_cpu_usage_report(); |
|
132 | // rtems_cpu_usage_report(); | |
133 | // rtems_cpu_usage_reset(); |
|
133 | // rtems_cpu_usage_reset(); | |
134 | // #endif |
|
134 | // #endif | |
135 | i = 0; |
|
135 | i = 0; | |
136 | } |
|
136 | } | |
137 | else i++; |
|
137 | else i++; | |
138 | j++; |
|
138 | j++; | |
139 | } |
|
139 | } | |
140 | } |
|
140 | } | |
141 |
|
141 | |||
142 | rtems_task hous_task(rtems_task_argument argument) |
|
142 | rtems_task hous_task(rtems_task_argument argument) | |
143 | { |
|
143 | { | |
144 | rtems_status_code status; |
|
144 | rtems_status_code status; | |
145 | rtems_status_code spare_status; |
|
145 | rtems_status_code spare_status; | |
146 | rtems_id queue_id; |
|
146 | rtems_id queue_id; | |
147 | rtems_rate_monotonic_period_status period_status; |
|
147 | rtems_rate_monotonic_period_status period_status; | |
148 |
|
148 | |||
149 | status = get_message_queue_id_send( &queue_id ); |
|
149 | status = get_message_queue_id_send( &queue_id ); | |
150 | if (status != RTEMS_SUCCESSFUL) |
|
150 | if (status != RTEMS_SUCCESSFUL) | |
151 | { |
|
151 | { | |
152 | PRINTF1("in HOUS *** ERR get_message_queue_id_send %d\n", status) |
|
152 | PRINTF1("in HOUS *** ERR get_message_queue_id_send %d\n", status) | |
153 | } |
|
153 | } | |
154 |
|
154 | |||
155 | BOOT_PRINTF("in HOUS ***\n") |
|
155 | BOOT_PRINTF("in HOUS ***\n") | |
156 |
|
156 | |||
157 | if (rtems_rate_monotonic_ident( name_hk_rate_monotonic, &HK_id) != RTEMS_SUCCESSFUL) { |
|
157 | if (rtems_rate_monotonic_ident( name_hk_rate_monotonic, &HK_id) != RTEMS_SUCCESSFUL) { | |
158 | status = rtems_rate_monotonic_create( name_hk_rate_monotonic, &HK_id ); |
|
158 | status = rtems_rate_monotonic_create( name_hk_rate_monotonic, &HK_id ); | |
159 | if( status != RTEMS_SUCCESSFUL ) { |
|
159 | if( status != RTEMS_SUCCESSFUL ) { | |
160 | PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status ) |
|
160 | PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status ) | |
161 | } |
|
161 | } | |
162 | } |
|
162 | } | |
163 |
|
163 | |||
164 | housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
164 | housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; | |
165 | housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
165 | housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
166 | housekeeping_packet.reserved = DEFAULT_RESERVED; |
|
166 | housekeeping_packet.reserved = DEFAULT_RESERVED; | |
167 | housekeeping_packet.userApplication = CCSDS_USER_APP; |
|
167 | housekeeping_packet.userApplication = CCSDS_USER_APP; | |
168 | housekeeping_packet.packetID[0] = (unsigned char) (APID_TM_HK >> 8); |
|
168 | housekeeping_packet.packetID[0] = (unsigned char) (APID_TM_HK >> 8); | |
169 | housekeeping_packet.packetID[1] = (unsigned char) (APID_TM_HK); |
|
169 | housekeeping_packet.packetID[1] = (unsigned char) (APID_TM_HK); | |
170 | housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
170 | housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
171 | housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
171 | housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
172 | housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8); |
|
172 | housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8); | |
173 | housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK ); |
|
173 | housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK ); | |
174 | housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
174 | housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
175 | housekeeping_packet.serviceType = TM_TYPE_HK; |
|
175 | housekeeping_packet.serviceType = TM_TYPE_HK; | |
176 | housekeeping_packet.serviceSubType = TM_SUBTYPE_HK; |
|
176 | housekeeping_packet.serviceSubType = TM_SUBTYPE_HK; | |
177 | housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND; |
|
177 | housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND; | |
178 | housekeeping_packet.sid = SID_HK; |
|
178 | housekeeping_packet.sid = SID_HK; | |
179 |
|
179 | |||
180 | status = rtems_rate_monotonic_cancel(HK_id); |
|
180 | status = rtems_rate_monotonic_cancel(HK_id); | |
181 | if( status != RTEMS_SUCCESSFUL ) { |
|
181 | if( status != RTEMS_SUCCESSFUL ) { | |
182 | PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status ) |
|
182 | PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status ) | |
183 | } |
|
183 | } | |
184 | else { |
|
184 | else { | |
185 | DEBUG_PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n") |
|
185 | DEBUG_PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n") | |
186 | } |
|
186 | } | |
187 |
|
187 | |||
188 | // startup phase |
|
188 | // startup phase | |
189 | status = rtems_rate_monotonic_period( HK_id, SY_LFR_TIME_SYN_TIMEOUT_in_ticks ); |
|
189 | status = rtems_rate_monotonic_period( HK_id, SY_LFR_TIME_SYN_TIMEOUT_in_ticks ); | |
190 | status = rtems_rate_monotonic_get_status( HK_id, &period_status ); |
|
190 | status = rtems_rate_monotonic_get_status( HK_id, &period_status ); | |
191 | DEBUG_PRINTF1("startup HK, HK_id status = %d\n", period_status.state) |
|
191 | DEBUG_PRINTF1("startup HK, HK_id status = %d\n", period_status.state) | |
192 | while(period_status.state != RATE_MONOTONIC_EXPIRED ) // after SY_LFR_TIME_SYN_TIMEOUT ms, starts HK anyway |
|
192 | while(period_status.state != RATE_MONOTONIC_EXPIRED ) // after SY_LFR_TIME_SYN_TIMEOUT ms, starts HK anyway | |
193 | { |
|
193 | { | |
194 | if ((time_management_regs->coarse_time & 0x80000000) == 0x00000000) // check time synchronization |
|
194 | if ((time_management_regs->coarse_time & 0x80000000) == 0x00000000) // check time synchronization | |
195 | { |
|
195 | { | |
196 | break; // break if LFR is synchronized |
|
196 | break; // break if LFR is synchronized | |
197 | } |
|
197 | } | |
198 | else |
|
198 | else | |
199 | { |
|
199 | { | |
200 | status = rtems_rate_monotonic_get_status( HK_id, &period_status ); |
|
200 | status = rtems_rate_monotonic_get_status( HK_id, &period_status ); | |
201 | // sched_yield(); |
|
201 | // sched_yield(); | |
202 | status = rtems_task_wake_after( 10 ); // wait SY_LFR_DPU_CONNECT_TIMEOUT 100 ms = 10 * 10 ms |
|
202 | status = rtems_task_wake_after( 10 ); // wait SY_LFR_DPU_CONNECT_TIMEOUT 100 ms = 10 * 10 ms | |
203 | } |
|
203 | } | |
204 | } |
|
204 | } | |
205 | status = rtems_rate_monotonic_cancel(HK_id); |
|
205 | status = rtems_rate_monotonic_cancel(HK_id); | |
206 | DEBUG_PRINTF1("startup HK, HK_id status = %d\n", period_status.state) |
|
206 | DEBUG_PRINTF1("startup HK, HK_id status = %d\n", period_status.state) | |
207 |
|
207 | |||
208 | while(1){ // launch the rate monotonic task |
|
208 | while(1){ // launch the rate monotonic task | |
209 | status = rtems_rate_monotonic_period( HK_id, HK_PERIOD ); |
|
209 | status = rtems_rate_monotonic_period( HK_id, HK_PERIOD ); | |
210 | if ( status != RTEMS_SUCCESSFUL ) { |
|
210 | if ( status != RTEMS_SUCCESSFUL ) { | |
211 | PRINTF1( "in HOUS *** ERR period: %d\n", status); |
|
211 | PRINTF1( "in HOUS *** ERR period: %d\n", status); | |
212 | spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_6 ); |
|
212 | spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_6 ); | |
213 | } |
|
213 | } | |
214 | else { |
|
214 | else { | |
215 | housekeeping_packet.packetSequenceControl[0] = (unsigned char) (sequenceCounterHK >> 8); |
|
215 | housekeeping_packet.packetSequenceControl[0] = (unsigned char) (sequenceCounterHK >> 8); | |
216 | housekeeping_packet.packetSequenceControl[1] = (unsigned char) (sequenceCounterHK ); |
|
216 | housekeeping_packet.packetSequenceControl[1] = (unsigned char) (sequenceCounterHK ); | |
217 | increment_seq_counter( &sequenceCounterHK ); |
|
217 | increment_seq_counter( &sequenceCounterHK ); | |
218 |
|
218 | |||
219 | housekeeping_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
219 | housekeeping_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
220 | housekeeping_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
220 | housekeeping_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
221 | housekeeping_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
221 | housekeeping_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
222 | housekeeping_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
222 | housekeeping_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); | |
223 | housekeeping_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
223 | housekeeping_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
224 | housekeeping_packet.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
224 | housekeeping_packet.time[5] = (unsigned char) (time_management_regs->fine_time); | |
225 |
|
225 | |||
226 | spacewire_update_statistics(); |
|
226 | spacewire_update_statistics(); | |
227 |
|
227 | |||
228 | // get_v_e1_e2_f3( housekeeping_packet.hk_lfr_sc_v_f3 ); |
|
228 | // get_v_e1_e2_f3( housekeeping_packet.hk_lfr_sc_v_f3 ); | |
229 | get_cpu_load( (unsigned char *) &housekeeping_packet.hk_lfr_cpu_load ); |
|
229 | get_cpu_load( (unsigned char *) &housekeeping_packet.hk_lfr_cpu_load ); | |
230 |
|
230 | |||
231 | // SEND PACKET |
|
231 | // SEND PACKET | |
232 | status = rtems_message_queue_send( queue_id, &housekeeping_packet, |
|
232 | status = rtems_message_queue_send( queue_id, &housekeeping_packet, | |
233 | PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES); |
|
233 | PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES); | |
234 | if (status != RTEMS_SUCCESSFUL) { |
|
234 | if (status != RTEMS_SUCCESSFUL) { | |
235 | PRINTF1("in HOUS *** ERR send: %d\n", status) |
|
235 | PRINTF1("in HOUS *** ERR send: %d\n", status) | |
236 | } |
|
236 | } | |
237 | } |
|
237 | } | |
238 | } |
|
238 | } | |
239 |
|
239 | |||
240 | PRINTF("in HOUS *** deleting task\n") |
|
240 | PRINTF("in HOUS *** deleting task\n") | |
241 |
|
241 | |||
242 | status = rtems_task_delete( RTEMS_SELF ); // should not return |
|
242 | status = rtems_task_delete( RTEMS_SELF ); // should not return | |
243 | printf( "rtems_task_delete returned with status of %d.\n", status ); |
|
243 | printf( "rtems_task_delete returned with status of %d.\n", status ); | |
244 | return; |
|
244 | return; | |
245 | } |
|
245 | } | |
246 |
|
246 | |||
247 | rtems_task dumb_task( rtems_task_argument unused ) |
|
247 | rtems_task dumb_task( rtems_task_argument unused ) | |
248 | { |
|
248 | { | |
249 | /** This RTEMS taks is used to print messages without affecting the general behaviour of the software. |
|
249 | /** This RTEMS taks is used to print messages without affecting the general behaviour of the software. | |
250 | * |
|
250 | * | |
251 | * @param unused is the starting argument of the RTEMS task |
|
251 | * @param unused is the starting argument of the RTEMS task | |
252 | * |
|
252 | * | |
253 | * The DUMB taks waits for RTEMS events and print messages depending on the incoming events. |
|
253 | * The DUMB taks waits for RTEMS events and print messages depending on the incoming events. | |
254 | * |
|
254 | * | |
255 | */ |
|
255 | */ | |
256 |
|
256 | |||
257 | unsigned int i; |
|
257 | unsigned int i; | |
258 | unsigned int intEventOut; |
|
258 | unsigned int intEventOut; | |
259 | unsigned int coarse_time = 0; |
|
259 | unsigned int coarse_time = 0; | |
260 | unsigned int fine_time = 0; |
|
260 | unsigned int fine_time = 0; | |
261 | rtems_event_set event_out; |
|
261 | rtems_event_set event_out; | |
262 |
|
262 | |||
263 | char *DumbMessages[12] = {"in DUMB *** default", // RTEMS_EVENT_0 |
|
263 | char *DumbMessages[12] = {"in DUMB *** default", // RTEMS_EVENT_0 | |
264 | "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1 |
|
264 | "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1 | |
265 | "in DUMB *** f3 buffer changed", // RTEMS_EVENT_2 |
|
265 | "in DUMB *** f3 buffer changed", // RTEMS_EVENT_2 | |
266 | "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3 |
|
266 | "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3 | |
267 | "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4 |
|
267 | "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4 | |
268 | "in DUMB *** waveforms_simulator_isr", // RTEMS_EVENT_5 |
|
268 | "in DUMB *** waveforms_simulator_isr", // RTEMS_EVENT_5 | |
269 |
" |
|
269 | "VHDL SM *** two buffers f0 ready", // RTEMS_EVENT_6 | |
270 | "ready for dump", // RTEMS_EVENT_7 |
|
270 | "ready for dump", // RTEMS_EVENT_7 | |
271 | "VHDL ERR *** spectral matrix", // RTEMS_EVENT_8 |
|
271 | "VHDL ERR *** spectral matrix", // RTEMS_EVENT_8 | |
272 | "tick", // RTEMS_EVENT_9 |
|
272 | "tick", // RTEMS_EVENT_9 | |
273 | "VHDL ERR *** waveform picker", // RTEMS_EVENT_10 |
|
273 | "VHDL ERR *** waveform picker", // RTEMS_EVENT_10 | |
274 | "VHDL ERR *** unexpected ready matrix values" // RTEMS_EVENT_11 |
|
274 | "VHDL ERR *** unexpected ready matrix values" // RTEMS_EVENT_11 | |
275 | }; |
|
275 | }; | |
276 |
|
276 | |||
277 | BOOT_PRINTF("in DUMB *** \n") |
|
277 | BOOT_PRINTF("in DUMB *** \n") | |
278 |
|
278 | |||
279 | while(1){ |
|
279 | while(1){ | |
280 | rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3 |
|
280 | rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3 | |
281 | | RTEMS_EVENT_4 | RTEMS_EVENT_5 | RTEMS_EVENT_6 | RTEMS_EVENT_7 |
|
281 | | RTEMS_EVENT_4 | RTEMS_EVENT_5 | RTEMS_EVENT_6 | RTEMS_EVENT_7 | |
282 | | RTEMS_EVENT_8 | RTEMS_EVENT_9, |
|
282 | | RTEMS_EVENT_8 | RTEMS_EVENT_9, | |
283 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT |
|
283 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT | |
284 | intEventOut = (unsigned int) event_out; |
|
284 | intEventOut = (unsigned int) event_out; | |
285 | for ( i=0; i<32; i++) |
|
285 | for ( i=0; i<32; i++) | |
286 | { |
|
286 | { | |
287 | if ( ((intEventOut >> i) & 0x0001) != 0) |
|
287 | if ( ((intEventOut >> i) & 0x0001) != 0) | |
288 | { |
|
288 | { | |
289 | coarse_time = time_management_regs->coarse_time; |
|
289 | coarse_time = time_management_regs->coarse_time; | |
290 | fine_time = time_management_regs->fine_time; |
|
290 | fine_time = time_management_regs->fine_time; | |
291 | printf("in DUMB *** coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]); |
|
291 | printf("in DUMB *** coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]); | |
292 | if (i==8) |
|
292 | if (i==8) | |
293 | { |
|
293 | { | |
294 | } |
|
294 | } | |
295 | if (i==10) |
|
295 | if (i==10) | |
296 | { |
|
296 | { | |
297 | } |
|
297 | } | |
298 | } |
|
298 | } | |
299 | } |
|
299 | } | |
300 | } |
|
300 | } | |
301 | } |
|
301 | } | |
302 |
|
302 | |||
303 | //***************************** |
|
303 | //***************************** | |
304 | // init housekeeping parameters |
|
304 | // init housekeeping parameters | |
305 |
|
305 | |||
306 | void init_housekeeping_parameters( void ) |
|
306 | void init_housekeeping_parameters( void ) | |
307 | { |
|
307 | { | |
308 | /** This function initialize the housekeeping_packet global variable with default values. |
|
308 | /** This function initialize the housekeeping_packet global variable with default values. | |
309 | * |
|
309 | * | |
310 | */ |
|
310 | */ | |
311 |
|
311 | |||
312 | unsigned int i = 0; |
|
312 | unsigned int i = 0; | |
313 | unsigned char *parameters; |
|
313 | unsigned char *parameters; | |
314 |
|
314 | |||
315 | parameters = (unsigned char*) &housekeeping_packet.lfr_status_word; |
|
315 | parameters = (unsigned char*) &housekeeping_packet.lfr_status_word; | |
316 | for(i = 0; i< SIZE_HK_PARAMETERS; i++) |
|
316 | for(i = 0; i< SIZE_HK_PARAMETERS; i++) | |
317 | { |
|
317 | { | |
318 | parameters[i] = 0x00; |
|
318 | parameters[i] = 0x00; | |
319 | } |
|
319 | } | |
320 | // init status word |
|
320 | // init status word | |
321 | housekeeping_packet.lfr_status_word[0] = DEFAULT_STATUS_WORD_BYTE0; |
|
321 | housekeeping_packet.lfr_status_word[0] = DEFAULT_STATUS_WORD_BYTE0; | |
322 | housekeeping_packet.lfr_status_word[1] = DEFAULT_STATUS_WORD_BYTE1; |
|
322 | housekeeping_packet.lfr_status_word[1] = DEFAULT_STATUS_WORD_BYTE1; | |
323 | // init software version |
|
323 | // init software version | |
324 | housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1; |
|
324 | housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1; | |
325 | housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2; |
|
325 | housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2; | |
326 | housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3; |
|
326 | housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3; | |
327 | housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4; |
|
327 | housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4; | |
328 | // init fpga version |
|
328 | // init fpga version | |
329 | parameters = (unsigned char *) (REGS_ADDR_VHDL_VERSION); |
|
329 | parameters = (unsigned char *) (REGS_ADDR_VHDL_VERSION); | |
330 | housekeeping_packet.lfr_fpga_version[0] = parameters[1]; // n1 |
|
330 | housekeeping_packet.lfr_fpga_version[0] = parameters[1]; // n1 | |
331 | housekeeping_packet.lfr_fpga_version[1] = parameters[2]; // n2 |
|
331 | housekeeping_packet.lfr_fpga_version[1] = parameters[2]; // n2 | |
332 | housekeeping_packet.lfr_fpga_version[2] = parameters[3]; // n3 |
|
332 | housekeeping_packet.lfr_fpga_version[2] = parameters[3]; // n3 | |
333 | } |
|
333 | } | |
334 |
|
334 | |||
335 | void increment_seq_counter( unsigned short *packetSequenceControl ) |
|
335 | void increment_seq_counter( unsigned short *packetSequenceControl ) | |
336 | { |
|
336 | { | |
337 | /** This function increment the sequence counter psased in argument. |
|
337 | /** This function increment the sequence counter psased in argument. | |
338 | * |
|
338 | * | |
339 | * The increment does not affect the grouping flag. In case of an overflow, the counter is reset to 0. |
|
339 | * The increment does not affect the grouping flag. In case of an overflow, the counter is reset to 0. | |
340 | * |
|
340 | * | |
341 | */ |
|
341 | */ | |
342 |
|
342 | |||
343 | unsigned short segmentation_grouping_flag; |
|
343 | unsigned short segmentation_grouping_flag; | |
344 | unsigned short sequence_cnt; |
|
344 | unsigned short sequence_cnt; | |
345 |
|
345 | |||
346 | segmentation_grouping_flag = TM_PACKET_SEQ_CTRL_STANDALONE << 8; // keep bits 7 downto 6 |
|
346 | segmentation_grouping_flag = TM_PACKET_SEQ_CTRL_STANDALONE << 8; // keep bits 7 downto 6 | |
347 | sequence_cnt = (*packetSequenceControl) & 0x3fff; // [0011 1111 1111 1111] |
|
347 | sequence_cnt = (*packetSequenceControl) & 0x3fff; // [0011 1111 1111 1111] | |
348 |
|
348 | |||
349 | if ( sequence_cnt < SEQ_CNT_MAX) |
|
349 | if ( sequence_cnt < SEQ_CNT_MAX) | |
350 | { |
|
350 | { | |
351 | sequence_cnt = sequence_cnt + 1; |
|
351 | sequence_cnt = sequence_cnt + 1; | |
352 | } |
|
352 | } | |
353 | else |
|
353 | else | |
354 | { |
|
354 | { | |
355 | sequence_cnt = 0; |
|
355 | sequence_cnt = 0; | |
356 | } |
|
356 | } | |
357 |
|
357 | |||
358 | *packetSequenceControl = segmentation_grouping_flag | sequence_cnt ; |
|
358 | *packetSequenceControl = segmentation_grouping_flag | sequence_cnt ; | |
359 | } |
|
359 | } | |
360 |
|
360 | |||
361 | void getTime( unsigned char *time) |
|
361 | void getTime( unsigned char *time) | |
362 | { |
|
362 | { | |
363 | /** This function write the current local time in the time buffer passed in argument. |
|
363 | /** This function write the current local time in the time buffer passed in argument. | |
364 | * |
|
364 | * | |
365 | */ |
|
365 | */ | |
366 |
|
366 | |||
367 | time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
367 | time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
368 | time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
368 | time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
369 | time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
369 | time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
370 | time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
370 | time[3] = (unsigned char) (time_management_regs->coarse_time); | |
371 | time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
371 | time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
372 | time[5] = (unsigned char) (time_management_regs->fine_time); |
|
372 | time[5] = (unsigned char) (time_management_regs->fine_time); | |
373 | } |
|
373 | } | |
374 |
|
374 | |||
375 | unsigned long long int getTimeAsUnsignedLongLongInt( ) |
|
375 | unsigned long long int getTimeAsUnsignedLongLongInt( ) | |
376 | { |
|
376 | { | |
377 | /** This function write the current local time in the time buffer passed in argument. |
|
377 | /** This function write the current local time in the time buffer passed in argument. | |
378 | * |
|
378 | * | |
379 | */ |
|
379 | */ | |
380 | unsigned long long int time; |
|
380 | unsigned long long int time; | |
381 |
|
381 | |||
382 | time = ( (unsigned long long int) (time_management_regs->coarse_time & 0x7fffffff) << 16 ) |
|
382 | time = ( (unsigned long long int) (time_management_regs->coarse_time & 0x7fffffff) << 16 ) | |
383 | + time_management_regs->fine_time; |
|
383 | + time_management_regs->fine_time; | |
384 |
|
384 | |||
385 | return time; |
|
385 | return time; | |
386 | } |
|
386 | } | |
387 |
|
387 | |||
388 | void send_dumb_hk( void ) |
|
388 | void send_dumb_hk( void ) | |
389 | { |
|
389 | { | |
390 | Packet_TM_LFR_HK_t dummy_hk_packet; |
|
390 | Packet_TM_LFR_HK_t dummy_hk_packet; | |
391 | unsigned char *parameters; |
|
391 | unsigned char *parameters; | |
392 | unsigned int i; |
|
392 | unsigned int i; | |
393 | rtems_id queue_id; |
|
393 | rtems_id queue_id; | |
394 |
|
394 | |||
395 | dummy_hk_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
395 | dummy_hk_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; | |
396 | dummy_hk_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
396 | dummy_hk_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
397 | dummy_hk_packet.reserved = DEFAULT_RESERVED; |
|
397 | dummy_hk_packet.reserved = DEFAULT_RESERVED; | |
398 | dummy_hk_packet.userApplication = CCSDS_USER_APP; |
|
398 | dummy_hk_packet.userApplication = CCSDS_USER_APP; | |
399 | dummy_hk_packet.packetID[0] = (unsigned char) (APID_TM_HK >> 8); |
|
399 | dummy_hk_packet.packetID[0] = (unsigned char) (APID_TM_HK >> 8); | |
400 | dummy_hk_packet.packetID[1] = (unsigned char) (APID_TM_HK); |
|
400 | dummy_hk_packet.packetID[1] = (unsigned char) (APID_TM_HK); | |
401 | dummy_hk_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
401 | dummy_hk_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
402 | dummy_hk_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
402 | dummy_hk_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
403 | dummy_hk_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8); |
|
403 | dummy_hk_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8); | |
404 | dummy_hk_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK ); |
|
404 | dummy_hk_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK ); | |
405 | dummy_hk_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
405 | dummy_hk_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
406 | dummy_hk_packet.serviceType = TM_TYPE_HK; |
|
406 | dummy_hk_packet.serviceType = TM_TYPE_HK; | |
407 | dummy_hk_packet.serviceSubType = TM_SUBTYPE_HK; |
|
407 | dummy_hk_packet.serviceSubType = TM_SUBTYPE_HK; | |
408 | dummy_hk_packet.destinationID = TM_DESTINATION_ID_GROUND; |
|
408 | dummy_hk_packet.destinationID = TM_DESTINATION_ID_GROUND; | |
409 | dummy_hk_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
409 | dummy_hk_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
410 | dummy_hk_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
410 | dummy_hk_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
411 | dummy_hk_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
411 | dummy_hk_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
412 | dummy_hk_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
412 | dummy_hk_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); | |
413 | dummy_hk_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
413 | dummy_hk_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
414 | dummy_hk_packet.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
414 | dummy_hk_packet.time[5] = (unsigned char) (time_management_regs->fine_time); | |
415 | dummy_hk_packet.sid = SID_HK; |
|
415 | dummy_hk_packet.sid = SID_HK; | |
416 |
|
416 | |||
417 | // init status word |
|
417 | // init status word | |
418 | dummy_hk_packet.lfr_status_word[0] = 0xff; |
|
418 | dummy_hk_packet.lfr_status_word[0] = 0xff; | |
419 | dummy_hk_packet.lfr_status_word[1] = 0xff; |
|
419 | dummy_hk_packet.lfr_status_word[1] = 0xff; | |
420 | // init software version |
|
420 | // init software version | |
421 | dummy_hk_packet.lfr_sw_version[0] = SW_VERSION_N1; |
|
421 | dummy_hk_packet.lfr_sw_version[0] = SW_VERSION_N1; | |
422 | dummy_hk_packet.lfr_sw_version[1] = SW_VERSION_N2; |
|
422 | dummy_hk_packet.lfr_sw_version[1] = SW_VERSION_N2; | |
423 | dummy_hk_packet.lfr_sw_version[2] = SW_VERSION_N3; |
|
423 | dummy_hk_packet.lfr_sw_version[2] = SW_VERSION_N3; | |
424 | dummy_hk_packet.lfr_sw_version[3] = SW_VERSION_N4; |
|
424 | dummy_hk_packet.lfr_sw_version[3] = SW_VERSION_N4; | |
425 | // init fpga version |
|
425 | // init fpga version | |
426 | parameters = (unsigned char *) (REGS_ADDR_WAVEFORM_PICKER + 0xb0); |
|
426 | parameters = (unsigned char *) (REGS_ADDR_WAVEFORM_PICKER + 0xb0); | |
427 | dummy_hk_packet.lfr_fpga_version[0] = parameters[1]; // n1 |
|
427 | dummy_hk_packet.lfr_fpga_version[0] = parameters[1]; // n1 | |
428 | dummy_hk_packet.lfr_fpga_version[1] = parameters[2]; // n2 |
|
428 | dummy_hk_packet.lfr_fpga_version[1] = parameters[2]; // n2 | |
429 | dummy_hk_packet.lfr_fpga_version[2] = parameters[3]; // n3 |
|
429 | dummy_hk_packet.lfr_fpga_version[2] = parameters[3]; // n3 | |
430 |
|
430 | |||
431 | parameters = (unsigned char *) &dummy_hk_packet.hk_lfr_cpu_load; |
|
431 | parameters = (unsigned char *) &dummy_hk_packet.hk_lfr_cpu_load; | |
432 |
|
432 | |||
433 | for (i=0; i<100; i++) |
|
433 | for (i=0; i<100; i++) | |
434 | { |
|
434 | { | |
435 | parameters[i] = 0xff; |
|
435 | parameters[i] = 0xff; | |
436 | } |
|
436 | } | |
437 |
|
437 | |||
438 | get_message_queue_id_send( &queue_id ); |
|
438 | get_message_queue_id_send( &queue_id ); | |
439 |
|
439 | |||
440 | rtems_message_queue_send( queue_id, &dummy_hk_packet, |
|
440 | rtems_message_queue_send( queue_id, &dummy_hk_packet, | |
441 | PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES); |
|
441 | PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES); | |
442 | } |
|
442 | } | |
443 |
|
443 | |||
444 | void get_v_e1_e2_f3( unsigned char *spacecraft_potential ) |
|
444 | void get_v_e1_e2_f3( unsigned char *spacecraft_potential ) | |
445 | { |
|
445 | { | |
446 | unsigned long long int localTime_asLong; |
|
446 | unsigned long long int localTime_asLong; | |
447 | unsigned long long int f3_0_AcquisitionTime_asLong; |
|
447 | unsigned long long int f3_0_AcquisitionTime_asLong; | |
448 | unsigned long long int f3_1_AcquisitionTime_asLong; |
|
448 | unsigned long long int f3_1_AcquisitionTime_asLong; | |
449 | unsigned long long int deltaT; |
|
449 | unsigned long long int deltaT; | |
450 | unsigned long long int deltaT_f3_0; |
|
450 | unsigned long long int deltaT_f3_0; | |
451 | unsigned long long int deltaT_f3_1; |
|
451 | unsigned long long int deltaT_f3_1; | |
452 | unsigned char *bufferPtr; |
|
452 | unsigned char *bufferPtr; | |
453 |
|
453 | |||
454 | unsigned int offset_in_samples; |
|
454 | unsigned int offset_in_samples; | |
455 | unsigned int offset_in_bytes; |
|
455 | unsigned int offset_in_bytes; | |
456 | unsigned char f3; |
|
456 | unsigned char f3; | |
457 |
|
457 | |||
458 | bufferPtr = NULL; |
|
458 | bufferPtr = NULL; | |
459 | deltaT = 0; |
|
459 | deltaT = 0; | |
460 | deltaT_f3_0 = 0xffffffff; |
|
460 | deltaT_f3_0 = 0xffffffff; | |
461 | deltaT_f3_1 = 0xffffffff; |
|
461 | deltaT_f3_1 = 0xffffffff; | |
462 | f3 = 16; // v, e1 and e2 will be picked up each second, f3 = 16 Hz |
|
462 | f3 = 16; // v, e1 and e2 will be picked up each second, f3 = 16 Hz | |
463 |
|
463 | |||
464 | if (lfrCurrentMode == LFR_MODE_STANDBY) |
|
464 | if (lfrCurrentMode == LFR_MODE_STANDBY) | |
465 | { |
|
465 | { | |
466 | spacecraft_potential[0] = 0x00; |
|
466 | spacecraft_potential[0] = 0x00; | |
467 | spacecraft_potential[1] = 0x00; |
|
467 | spacecraft_potential[1] = 0x00; | |
468 | spacecraft_potential[2] = 0x00; |
|
468 | spacecraft_potential[2] = 0x00; | |
469 | spacecraft_potential[3] = 0x00; |
|
469 | spacecraft_potential[3] = 0x00; | |
470 | spacecraft_potential[4] = 0x00; |
|
470 | spacecraft_potential[4] = 0x00; | |
471 | spacecraft_potential[5] = 0x00; |
|
471 | spacecraft_potential[5] = 0x00; | |
472 | } |
|
472 | } | |
473 | else |
|
473 | else | |
474 | { |
|
474 | { | |
475 | localTime_asLong = get_acquisition_time( (unsigned char *) &time_management_regs->coarse_time ); |
|
475 | localTime_asLong = get_acquisition_time( (unsigned char *) &time_management_regs->coarse_time ); | |
476 | f3_0_AcquisitionTime_asLong = get_acquisition_time( (unsigned char *) &waveform_picker_regs->f3_0_coarse_time ); |
|
476 | f3_0_AcquisitionTime_asLong = get_acquisition_time( (unsigned char *) &waveform_picker_regs->f3_0_coarse_time ); | |
477 | f3_1_AcquisitionTime_asLong = get_acquisition_time( (unsigned char *) &waveform_picker_regs->f3_1_coarse_time ); |
|
477 | f3_1_AcquisitionTime_asLong = get_acquisition_time( (unsigned char *) &waveform_picker_regs->f3_1_coarse_time ); | |
478 | printf("localTime 0x%llx, f3_0 0x%llx, f3_1 0x%llx\n", |
|
478 | printf("localTime 0x%llx, f3_0 0x%llx, f3_1 0x%llx\n", | |
479 | localTime_asLong, |
|
479 | localTime_asLong, | |
480 | f3_0_AcquisitionTime_asLong, |
|
480 | f3_0_AcquisitionTime_asLong, | |
481 | f3_1_AcquisitionTime_asLong); |
|
481 | f3_1_AcquisitionTime_asLong); | |
482 |
|
482 | |||
483 | if ( localTime_asLong >= f3_0_AcquisitionTime_asLong ) |
|
483 | if ( localTime_asLong >= f3_0_AcquisitionTime_asLong ) | |
484 | { |
|
484 | { | |
485 | deltaT_f3_0 = localTime_asLong - f3_0_AcquisitionTime_asLong; |
|
485 | deltaT_f3_0 = localTime_asLong - f3_0_AcquisitionTime_asLong; | |
486 | } |
|
486 | } | |
487 |
|
487 | |||
488 | if ( localTime_asLong > f3_1_AcquisitionTime_asLong ) |
|
488 | if ( localTime_asLong > f3_1_AcquisitionTime_asLong ) | |
489 | { |
|
489 | { | |
490 | deltaT_f3_1 = localTime_asLong - f3_1_AcquisitionTime_asLong; |
|
490 | deltaT_f3_1 = localTime_asLong - f3_1_AcquisitionTime_asLong; | |
491 | } |
|
491 | } | |
492 |
|
492 | |||
493 | if ( (deltaT_f3_0 != 0xffffffff) && (deltaT_f3_1 != 0xffffffff) ) |
|
493 | if ( (deltaT_f3_0 != 0xffffffff) && (deltaT_f3_1 != 0xffffffff) ) | |
494 | { |
|
494 | { | |
495 | if ( deltaT_f3_0 > deltaT_f3_1 ) |
|
495 | if ( deltaT_f3_0 > deltaT_f3_1 ) | |
496 | { |
|
496 | { | |
497 | deltaT = deltaT_f3_1; |
|
497 | deltaT = deltaT_f3_1; | |
498 | bufferPtr = (unsigned char*) waveform_picker_regs->addr_data_f3_1; |
|
498 | bufferPtr = (unsigned char*) waveform_picker_regs->addr_data_f3_1; | |
499 | } |
|
499 | } | |
500 | else |
|
500 | else | |
501 | { |
|
501 | { | |
502 | deltaT = deltaT_f3_0; |
|
502 | deltaT = deltaT_f3_0; | |
503 | bufferPtr = (unsigned char*) waveform_picker_regs->addr_data_f3_0; |
|
503 | bufferPtr = (unsigned char*) waveform_picker_regs->addr_data_f3_0; | |
504 | } |
|
504 | } | |
505 | } |
|
505 | } | |
506 | else if ( (deltaT_f3_0 == 0xffffffff) && (deltaT_f3_1 != 0xffffffff) ) |
|
506 | else if ( (deltaT_f3_0 == 0xffffffff) && (deltaT_f3_1 != 0xffffffff) ) | |
507 | { |
|
507 | { | |
508 | deltaT = deltaT_f3_1; |
|
508 | deltaT = deltaT_f3_1; | |
509 | bufferPtr = (unsigned char*) waveform_picker_regs->addr_data_f3_1; |
|
509 | bufferPtr = (unsigned char*) waveform_picker_regs->addr_data_f3_1; | |
510 | } |
|
510 | } | |
511 | else if ( (deltaT_f3_0 != 0xffffffff) && (deltaT_f3_1 == 0xffffffff) ) |
|
511 | else if ( (deltaT_f3_0 != 0xffffffff) && (deltaT_f3_1 == 0xffffffff) ) | |
512 | { |
|
512 | { | |
513 | deltaT = deltaT_f3_0; |
|
513 | deltaT = deltaT_f3_0; | |
514 | bufferPtr = (unsigned char*) waveform_picker_regs->addr_data_f3_1; |
|
514 | bufferPtr = (unsigned char*) waveform_picker_regs->addr_data_f3_1; | |
515 | } |
|
515 | } | |
516 | else |
|
516 | else | |
517 | { |
|
517 | { | |
518 | deltaT = 0xffffffff; |
|
518 | deltaT = 0xffffffff; | |
519 | } |
|
519 | } | |
520 |
|
520 | |||
521 | if ( deltaT == 0xffffffff ) |
|
521 | if ( deltaT == 0xffffffff ) | |
522 | { |
|
522 | { | |
523 | spacecraft_potential[0] = 0x00; |
|
523 | spacecraft_potential[0] = 0x00; | |
524 | spacecraft_potential[1] = 0x00; |
|
524 | spacecraft_potential[1] = 0x00; | |
525 | spacecraft_potential[2] = 0x00; |
|
525 | spacecraft_potential[2] = 0x00; | |
526 | spacecraft_potential[3] = 0x00; |
|
526 | spacecraft_potential[3] = 0x00; | |
527 | spacecraft_potential[4] = 0x00; |
|
527 | spacecraft_potential[4] = 0x00; | |
528 | spacecraft_potential[5] = 0x00; |
|
528 | spacecraft_potential[5] = 0x00; | |
529 | } |
|
529 | } | |
530 | else |
|
530 | else | |
531 | { |
|
531 | { | |
532 | offset_in_samples = ( (double) deltaT ) / 65536. * f3; |
|
532 | offset_in_samples = ( (double) deltaT ) / 65536. * f3; | |
533 | if ( offset_in_samples > (NB_SAMPLES_PER_SNAPSHOT - 1) ) |
|
533 | if ( offset_in_samples > (NB_SAMPLES_PER_SNAPSHOT - 1) ) | |
534 | { |
|
534 | { | |
535 | PRINTF1("ERR *** in get_v_e1_e2_f3 *** trying to read out of the buffer, counter = %d\n", offset_in_samples) |
|
535 | PRINTF1("ERR *** in get_v_e1_e2_f3 *** trying to read out of the buffer, counter = %d\n", offset_in_samples) | |
536 | offset_in_samples = NB_SAMPLES_PER_SNAPSHOT - 1; |
|
536 | offset_in_samples = NB_SAMPLES_PER_SNAPSHOT - 1; | |
537 | } |
|
537 | } | |
538 | offset_in_bytes = offset_in_samples * NB_WORDS_SWF_BLK * 4; |
|
538 | offset_in_bytes = offset_in_samples * NB_WORDS_SWF_BLK * 4; | |
539 | spacecraft_potential[0] = bufferPtr[ offset_in_bytes + 0]; |
|
539 | spacecraft_potential[0] = bufferPtr[ offset_in_bytes + 0]; | |
540 | spacecraft_potential[1] = bufferPtr[ offset_in_bytes + 1]; |
|
540 | spacecraft_potential[1] = bufferPtr[ offset_in_bytes + 1]; | |
541 | spacecraft_potential[2] = bufferPtr[ offset_in_bytes + 2]; |
|
541 | spacecraft_potential[2] = bufferPtr[ offset_in_bytes + 2]; | |
542 | spacecraft_potential[3] = bufferPtr[ offset_in_bytes + 3]; |
|
542 | spacecraft_potential[3] = bufferPtr[ offset_in_bytes + 3]; | |
543 | spacecraft_potential[4] = bufferPtr[ offset_in_bytes + 4]; |
|
543 | spacecraft_potential[4] = bufferPtr[ offset_in_bytes + 4]; | |
544 | spacecraft_potential[5] = bufferPtr[ offset_in_bytes + 5]; |
|
544 | spacecraft_potential[5] = bufferPtr[ offset_in_bytes + 5]; | |
545 | } |
|
545 | } | |
546 | } |
|
546 | } | |
547 | } |
|
547 | } | |
548 |
|
548 | |||
549 | void get_cpu_load( unsigned char *resource_statistics ) |
|
549 | void get_cpu_load( unsigned char *resource_statistics ) | |
550 | { |
|
550 | { | |
551 | unsigned char cpu_load; |
|
551 | unsigned char cpu_load; | |
552 |
|
552 | |||
553 | cpu_load = lfr_rtems_cpu_usage_report(); |
|
553 | cpu_load = lfr_rtems_cpu_usage_report(); | |
554 |
|
554 | |||
555 | // HK_LFR_CPU_LOAD |
|
555 | // HK_LFR_CPU_LOAD | |
556 | resource_statistics[0] = cpu_load; |
|
556 | resource_statistics[0] = cpu_load; | |
557 |
|
557 | |||
558 | // HK_LFR_CPU_LOAD_MAX |
|
558 | // HK_LFR_CPU_LOAD_MAX | |
559 | if (cpu_load > resource_statistics[1]) |
|
559 | if (cpu_load > resource_statistics[1]) | |
560 | { |
|
560 | { | |
561 | resource_statistics[1] = cpu_load; |
|
561 | resource_statistics[1] = cpu_load; | |
562 | } |
|
562 | } | |
563 |
|
563 | |||
564 | // CPU_LOAD_AVE |
|
564 | // CPU_LOAD_AVE | |
565 | resource_statistics[2] = 0; |
|
565 | resource_statistics[2] = 0; | |
566 |
|
566 | |||
567 | #ifndef PRINT_TASK_STATISTICS |
|
567 | #ifndef PRINT_TASK_STATISTICS | |
568 | rtems_cpu_usage_reset(); |
|
568 | rtems_cpu_usage_reset(); | |
569 | #endif |
|
569 | #endif | |
570 |
|
570 | |||
571 | } |
|
571 | } | |
572 |
|
572 | |||
573 |
|
573 | |||
574 |
|
574 |
@@ -1,519 +1,523 | |||||
1 | /** Functions related to data processing. |
|
1 | /** Functions related to data processing. | |
2 | * |
|
2 | * | |
3 | * @file |
|
3 | * @file | |
4 | * @author P. LEROY |
|
4 | * @author P. LEROY | |
5 | * |
|
5 | * | |
6 | * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation. |
|
6 | * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation. | |
7 | * |
|
7 | * | |
8 | */ |
|
8 | */ | |
9 |
|
9 | |||
10 | #include "fsw_processing.h" |
|
10 | #include "fsw_processing.h" | |
11 | #include "fsw_processing_globals.c" |
|
11 | #include "fsw_processing_globals.c" | |
12 |
|
12 | |||
13 | unsigned int nb_sm_f0; |
|
13 | unsigned int nb_sm_f0; | |
14 | unsigned int nb_sm_f0_aux_f1; |
|
14 | unsigned int nb_sm_f0_aux_f1; | |
15 | unsigned int nb_sm_f1; |
|
15 | unsigned int nb_sm_f1; | |
16 | unsigned int nb_sm_f0_aux_f2; |
|
16 | unsigned int nb_sm_f0_aux_f2; | |
17 |
|
17 | |||
18 | //************************ |
|
18 | //************************ | |
19 | // spectral matrices rings |
|
19 | // spectral matrices rings | |
20 | ring_node sm_ring_f0[ NB_RING_NODES_SM_F0 ]; |
|
20 | ring_node sm_ring_f0[ NB_RING_NODES_SM_F0 ]; | |
21 | ring_node sm_ring_f1[ NB_RING_NODES_SM_F1 ]; |
|
21 | ring_node sm_ring_f1[ NB_RING_NODES_SM_F1 ]; | |
22 | ring_node sm_ring_f2[ NB_RING_NODES_SM_F2 ]; |
|
22 | ring_node sm_ring_f2[ NB_RING_NODES_SM_F2 ]; | |
23 | ring_node *current_ring_node_sm_f0; |
|
23 | ring_node *current_ring_node_sm_f0; | |
24 | ring_node *current_ring_node_sm_f1; |
|
24 | ring_node *current_ring_node_sm_f1; | |
25 | ring_node *current_ring_node_sm_f2; |
|
25 | ring_node *current_ring_node_sm_f2; | |
26 | ring_node *ring_node_for_averaging_sm_f0; |
|
26 | ring_node *ring_node_for_averaging_sm_f0; | |
27 | ring_node *ring_node_for_averaging_sm_f1; |
|
27 | ring_node *ring_node_for_averaging_sm_f1; | |
28 | ring_node *ring_node_for_averaging_sm_f2; |
|
28 | ring_node *ring_node_for_averaging_sm_f2; | |
29 |
|
29 | |||
30 | //*********************************************************** |
|
30 | //*********************************************************** | |
31 | // Interrupt Service Routine for spectral matrices processing |
|
31 | // Interrupt Service Routine for spectral matrices processing | |
32 |
|
32 | |||
33 | void spectral_matrices_isr_f0( void ) |
|
33 | void spectral_matrices_isr_f0( void ) | |
34 | { |
|
34 | { | |
35 | unsigned char status; |
|
35 | unsigned char status; | |
36 | unsigned long long int time_0; |
|
36 | unsigned long long int time_0; | |
37 | unsigned long long int time_1; |
|
37 | unsigned long long int time_1; | |
38 | unsigned long long int syncBit0; |
|
38 | unsigned long long int syncBit0; | |
39 | unsigned long long int syncBit1; |
|
39 | unsigned long long int syncBit1; | |
40 |
|
40 | |||
41 | status = spectral_matrix_regs->status & 0x03; // [0011] get the status_ready_matrix_f0_x bits |
|
41 | status = spectral_matrix_regs->status & 0x03; // [0011] get the status_ready_matrix_f0_x bits | |
42 |
|
42 | |||
43 | time_0 = get_acquisition_time( (unsigned char *) &spectral_matrix_regs->f0_0_coarse_time ); |
|
43 | time_0 = get_acquisition_time( (unsigned char *) &spectral_matrix_regs->f0_0_coarse_time ); | |
44 | time_1 = get_acquisition_time( (unsigned char *) &spectral_matrix_regs->f0_1_coarse_time ); |
|
44 | time_1 = get_acquisition_time( (unsigned char *) &spectral_matrix_regs->f0_1_coarse_time ); | |
45 | syncBit0 = ( (unsigned long long int) (spectral_matrix_regs->f0_0_coarse_time & 0x80000000) ) << 16; |
|
45 | syncBit0 = ( (unsigned long long int) (spectral_matrix_regs->f0_0_coarse_time & 0x80000000) ) << 16; | |
46 | syncBit1 = ( (unsigned long long int) (spectral_matrix_regs->f0_1_coarse_time & 0x80000000) ) << 16; |
|
46 | syncBit1 = ( (unsigned long long int) (spectral_matrix_regs->f0_1_coarse_time & 0x80000000) ) << 16; | |
47 |
|
47 | |||
48 | switch(status) |
|
48 | switch(status) | |
49 | { |
|
49 | { | |
50 | case 0: |
|
50 | case 0: | |
51 | break; |
|
51 | break; | |
52 | case 3: |
|
52 | case 3: | |
|
53 | // send a message if two buffers are ready | |||
|
54 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_6 ); | |||
53 | if ( time_0 < time_1 ) |
|
55 | if ( time_0 < time_1 ) | |
54 | { |
|
56 | { | |
55 | close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], |
|
57 | close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], | |
56 | ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_0 | syncBit0); |
|
58 | ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_0 | syncBit0); | |
57 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; |
|
59 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; | |
58 | spectral_matrix_regs->f0_0_address = current_ring_node_sm_f0->buffer_address; |
|
60 | spectral_matrix_regs->f0_0_address = current_ring_node_sm_f0->buffer_address; | |
59 | close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], |
|
61 | close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], | |
60 | ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_1 | syncBit1); |
|
62 | ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_1 | syncBit1); | |
61 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; |
|
63 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; | |
62 | spectral_matrix_regs->f0_1_address = current_ring_node_sm_f0->buffer_address; |
|
64 | spectral_matrix_regs->f0_1_address = current_ring_node_sm_f0->buffer_address; | |
63 | } |
|
65 | } | |
64 | else |
|
66 | else | |
65 | { |
|
67 | { | |
66 | close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], |
|
68 | close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], | |
67 | ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_1 | syncBit1); |
|
69 | ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_1 | syncBit1); | |
68 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; |
|
70 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; | |
69 | spectral_matrix_regs->f0_1_address = current_ring_node_sm_f0->buffer_address; |
|
71 | spectral_matrix_regs->f0_1_address = current_ring_node_sm_f0->buffer_address; | |
70 | close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], |
|
72 | close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], | |
71 | ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_0 | syncBit0); |
|
73 | ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_0 | syncBit0); | |
72 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; |
|
74 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; | |
73 | spectral_matrix_regs->f0_0_address = current_ring_node_sm_f0->buffer_address; |
|
75 | spectral_matrix_regs->f0_0_address = current_ring_node_sm_f0->buffer_address; | |
74 | } |
|
76 | } | |
75 | spectral_matrix_regs->status = 0x03; // [0011] |
|
77 | spectral_matrix_regs->status = 0x03; // [0011] | |
76 | break; |
|
78 | break; | |
77 | case 1: |
|
79 | case 1: | |
78 | close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], |
|
80 | close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], | |
79 | ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_0 | syncBit0); |
|
81 | ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_0 | syncBit0); | |
80 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; |
|
82 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; | |
81 | spectral_matrix_regs->f0_0_address = current_ring_node_sm_f0->buffer_address; |
|
83 | spectral_matrix_regs->f0_0_address = current_ring_node_sm_f0->buffer_address; | |
82 | spectral_matrix_regs->status = 0x01; // [0001] |
|
84 | spectral_matrix_regs->status = 0x01; // [0001] | |
83 | break; |
|
85 | break; | |
84 | case 2: |
|
86 | case 2: | |
85 | close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], |
|
87 | close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], | |
86 | ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_1 | syncBit1); |
|
88 | ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_1 | syncBit1); | |
87 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; |
|
89 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; | |
88 | spectral_matrix_regs->f0_1_address = current_ring_node_sm_f0->buffer_address; |
|
90 | spectral_matrix_regs->f0_1_address = current_ring_node_sm_f0->buffer_address; | |
89 | spectral_matrix_regs->status = 0x02; // [0010] |
|
91 | spectral_matrix_regs->status = 0x02; // [0010] | |
90 | break; |
|
92 | break; | |
91 | } |
|
93 | } | |
92 | } |
|
94 | } | |
93 |
|
95 | |||
94 | void spectral_matrices_isr_f1( void ) |
|
96 | void spectral_matrices_isr_f1( void ) | |
95 | { |
|
97 | { | |
96 | unsigned char status; |
|
98 | unsigned char status; | |
97 | unsigned long long int time; |
|
99 | unsigned long long int time; | |
98 | unsigned long long int syncBit; |
|
100 | unsigned long long int syncBit; | |
99 | rtems_status_code status_code; |
|
101 | rtems_status_code status_code; | |
100 |
|
102 | |||
101 | status = (spectral_matrix_regs->status & 0x0c) >> 2; // [1100] get the status_ready_matrix_f0_x bits |
|
103 | status = (spectral_matrix_regs->status & 0x0c) >> 2; // [1100] get the status_ready_matrix_f0_x bits | |
102 |
|
104 | |||
103 | switch(status) |
|
105 | switch(status) | |
104 | { |
|
106 | { | |
105 | case 0: |
|
107 | case 0: | |
106 | break; |
|
108 | break; | |
107 | case 3: |
|
109 | case 3: | |
108 | // UNEXPECTED VALUE |
|
110 | // UNEXPECTED VALUE | |
109 | spectral_matrix_regs->status = 0xc0; // [1100] |
|
111 | spectral_matrix_regs->status = 0xc0; // [1100] | |
110 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_11 ); |
|
112 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_11 ); | |
111 | break; |
|
113 | break; | |
112 | case 1: |
|
114 | case 1: | |
113 | time = get_acquisition_time( (unsigned char *) &spectral_matrix_regs->f1_0_coarse_time ); |
|
115 | time = get_acquisition_time( (unsigned char *) &spectral_matrix_regs->f1_0_coarse_time ); | |
114 | syncBit = ( (unsigned long long int) (spectral_matrix_regs->f1_0_coarse_time & 0x80000000) ) << 16; |
|
116 | syncBit = ( (unsigned long long int) (spectral_matrix_regs->f1_0_coarse_time & 0x80000000) ) << 16; | |
115 | close_matrix_actions( &nb_sm_f1, NB_SM_BEFORE_AVF1, Task_id[TASKID_AVF1], |
|
117 | close_matrix_actions( &nb_sm_f1, NB_SM_BEFORE_AVF1, Task_id[TASKID_AVF1], | |
116 | ring_node_for_averaging_sm_f1, current_ring_node_sm_f1, time | syncBit); |
|
118 | ring_node_for_averaging_sm_f1, current_ring_node_sm_f1, time | syncBit); | |
117 | current_ring_node_sm_f1 = current_ring_node_sm_f1->next; |
|
119 | current_ring_node_sm_f1 = current_ring_node_sm_f1->next; | |
118 | spectral_matrix_regs->f1_0_address = current_ring_node_sm_f1->buffer_address; |
|
120 | spectral_matrix_regs->f1_0_address = current_ring_node_sm_f1->buffer_address; | |
119 | spectral_matrix_regs->status = 0x04; // [0100] |
|
121 | spectral_matrix_regs->status = 0x04; // [0100] | |
120 | break; |
|
122 | break; | |
121 | case 2: |
|
123 | case 2: | |
122 | time = get_acquisition_time( (unsigned char *) &spectral_matrix_regs->f1_1_coarse_time ); |
|
124 | time = get_acquisition_time( (unsigned char *) &spectral_matrix_regs->f1_1_coarse_time ); | |
123 | syncBit = ( (unsigned long long int) (spectral_matrix_regs->f1_1_coarse_time & 0x80000000) ) << 16; |
|
125 | syncBit = ( (unsigned long long int) (spectral_matrix_regs->f1_1_coarse_time & 0x80000000) ) << 16; | |
124 | close_matrix_actions( &nb_sm_f1, NB_SM_BEFORE_AVF1, Task_id[TASKID_AVF1], |
|
126 | close_matrix_actions( &nb_sm_f1, NB_SM_BEFORE_AVF1, Task_id[TASKID_AVF1], | |
125 | ring_node_for_averaging_sm_f1, current_ring_node_sm_f1, time | syncBit); |
|
127 | ring_node_for_averaging_sm_f1, current_ring_node_sm_f1, time | syncBit); | |
126 | current_ring_node_sm_f1 = current_ring_node_sm_f1->next; |
|
128 | current_ring_node_sm_f1 = current_ring_node_sm_f1->next; | |
127 | spectral_matrix_regs->f1_1_address = current_ring_node_sm_f1->buffer_address; |
|
129 | spectral_matrix_regs->f1_1_address = current_ring_node_sm_f1->buffer_address; | |
128 | spectral_matrix_regs->status = 0x08; // [1000] |
|
130 | spectral_matrix_regs->status = 0x08; // [1000] | |
129 | break; |
|
131 | break; | |
130 | } |
|
132 | } | |
131 | } |
|
133 | } | |
132 |
|
134 | |||
133 | void spectral_matrices_isr_f2( void ) |
|
135 | void spectral_matrices_isr_f2( void ) | |
134 | { |
|
136 | { | |
135 | unsigned char status; |
|
137 | unsigned char status; | |
136 | rtems_status_code status_code; |
|
138 | rtems_status_code status_code; | |
137 |
|
139 | |||
138 | status = (spectral_matrix_regs->status & 0x30) >> 4; // [0011 0000] get the status_ready_matrix_f0_x bits |
|
140 | status = (spectral_matrix_regs->status & 0x30) >> 4; // [0011 0000] get the status_ready_matrix_f0_x bits | |
139 |
|
141 | |||
140 | ring_node_for_averaging_sm_f2 = current_ring_node_sm_f2; |
|
142 | ring_node_for_averaging_sm_f2 = current_ring_node_sm_f2; | |
141 |
|
143 | |||
142 | current_ring_node_sm_f2 = current_ring_node_sm_f2->next; |
|
144 | current_ring_node_sm_f2 = current_ring_node_sm_f2->next; | |
143 |
|
145 | |||
144 | switch(status) |
|
146 | switch(status) | |
145 | { |
|
147 | { | |
146 | case 0: |
|
148 | case 0: | |
147 | break; |
|
149 | break; | |
148 | case 3: |
|
150 | case 3: | |
149 | // UNEXPECTED VALUE |
|
151 | // UNEXPECTED VALUE | |
150 | spectral_matrix_regs->status = 0x30; // [0011 0000] |
|
152 | spectral_matrix_regs->status = 0x30; // [0011 0000] | |
151 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_11 ); |
|
153 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_11 ); | |
152 | break; |
|
154 | break; | |
153 | case 1: |
|
155 | case 1: | |
154 | ring_node_for_averaging_sm_f2->coarseTime = spectral_matrix_regs->f2_0_coarse_time; |
|
156 | ring_node_for_averaging_sm_f2->coarseTime = spectral_matrix_regs->f2_0_coarse_time; | |
155 | ring_node_for_averaging_sm_f2->fineTime = spectral_matrix_regs->f2_0_fine_time; |
|
157 | ring_node_for_averaging_sm_f2->fineTime = spectral_matrix_regs->f2_0_fine_time; | |
156 | spectral_matrix_regs->f2_0_address = current_ring_node_sm_f2->buffer_address; |
|
158 | spectral_matrix_regs->f2_0_address = current_ring_node_sm_f2->buffer_address; | |
157 | spectral_matrix_regs->status = 0x10; // [0001 0000] |
|
159 | spectral_matrix_regs->status = 0x10; // [0001 0000] | |
158 | if (rtems_event_send( Task_id[TASKID_AVF2], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
160 | if (rtems_event_send( Task_id[TASKID_AVF2], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |
159 | { |
|
161 | { | |
160 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
162 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |
161 | } |
|
163 | } | |
162 | break; |
|
164 | break; | |
163 | case 2: |
|
165 | case 2: | |
164 | ring_node_for_averaging_sm_f2->coarseTime = spectral_matrix_regs->f2_1_coarse_time; |
|
166 | ring_node_for_averaging_sm_f2->coarseTime = spectral_matrix_regs->f2_1_coarse_time; | |
165 | ring_node_for_averaging_sm_f2->fineTime = spectral_matrix_regs->f2_1_fine_time; |
|
167 | ring_node_for_averaging_sm_f2->fineTime = spectral_matrix_regs->f2_1_fine_time; | |
166 | spectral_matrix_regs->f2_1_address = current_ring_node_sm_f2->buffer_address; |
|
168 | spectral_matrix_regs->f2_1_address = current_ring_node_sm_f2->buffer_address; | |
167 | spectral_matrix_regs->status = 0x20; // [0010 0000] |
|
169 | spectral_matrix_regs->status = 0x20; // [0010 0000] | |
168 | if (rtems_event_send( Task_id[TASKID_AVF2], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
170 | if (rtems_event_send( Task_id[TASKID_AVF2], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |
169 | { |
|
171 | { | |
170 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
172 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |
171 | } |
|
173 | } | |
172 | break; |
|
174 | break; | |
173 | } |
|
175 | } | |
174 | } |
|
176 | } | |
175 |
|
177 | |||
176 | void spectral_matrix_isr_error_handler( void ) |
|
178 | void spectral_matrix_isr_error_handler( void ) | |
177 | { |
|
179 | { | |
178 | rtems_status_code status_code; |
|
180 | // rtems_status_code status_code; | |
179 |
|
181 | |||
180 | if (spectral_matrix_regs->status & 0x7c0) // [0111 1100 0000] |
|
182 | // if (spectral_matrix_regs->status & 0x7c0) // [0111 1100 0000] | |
181 | { |
|
183 | // { | |
182 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); |
|
184 | // status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); | |
183 | } |
|
185 | // } | |
|
186 | ||||
|
187 | // spectral_matrix_regs->status = spectral_matrix_regs->status & 0x7c0; | |||
184 | } |
|
188 | } | |
185 |
|
189 | |||
186 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ) |
|
190 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ) | |
187 | { |
|
191 | { | |
188 | // STATUS REGISTER |
|
192 | // STATUS REGISTER | |
189 | // input_fifo_write(2) *** input_fifo_write(1) *** input_fifo_write(0) |
|
193 | // input_fifo_write(2) *** input_fifo_write(1) *** input_fifo_write(0) | |
190 | // 10 9 8 |
|
194 | // 10 9 8 | |
191 | // buffer_full ** bad_component_err ** f2_1 ** f2_0 ** f1_1 ** f1_0 ** f0_1 ** f0_0 |
|
195 | // buffer_full ** bad_component_err ** f2_1 ** f2_0 ** f1_1 ** f1_0 ** f0_1 ** f0_0 | |
192 | // 7 6 5 4 3 2 1 0 |
|
196 | // 7 6 5 4 3 2 1 0 | |
193 |
|
197 | |||
194 | spectral_matrices_isr_f0(); |
|
198 | spectral_matrices_isr_f0(); | |
195 |
|
199 | |||
196 | spectral_matrices_isr_f1(); |
|
200 | spectral_matrices_isr_f1(); | |
197 |
|
201 | |||
198 | spectral_matrices_isr_f2(); |
|
202 | spectral_matrices_isr_f2(); | |
199 |
|
203 | |||
200 |
|
|
204 | spectral_matrix_isr_error_handler(); | |
201 | } |
|
205 | } | |
202 |
|
206 | |||
203 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ) |
|
207 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ) | |
204 | { |
|
208 | { | |
205 | rtems_status_code status_code; |
|
209 | rtems_status_code status_code; | |
206 |
|
210 | |||
207 | //*** |
|
211 | //*** | |
208 | // F0 |
|
212 | // F0 | |
209 | nb_sm_f0 = nb_sm_f0 + 1; |
|
213 | nb_sm_f0 = nb_sm_f0 + 1; | |
210 | if (nb_sm_f0 == NB_SM_BEFORE_AVF0 ) |
|
214 | if (nb_sm_f0 == NB_SM_BEFORE_AVF0 ) | |
211 | { |
|
215 | { | |
212 | ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0; |
|
216 | ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0; | |
213 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
217 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |
214 | { |
|
218 | { | |
215 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
219 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |
216 | } |
|
220 | } | |
217 | nb_sm_f0 = 0; |
|
221 | nb_sm_f0 = 0; | |
218 | } |
|
222 | } | |
219 |
|
223 | |||
220 | //*** |
|
224 | //*** | |
221 | // F1 |
|
225 | // F1 | |
222 | nb_sm_f0_aux_f1 = nb_sm_f0_aux_f1 + 1; |
|
226 | nb_sm_f0_aux_f1 = nb_sm_f0_aux_f1 + 1; | |
223 | if (nb_sm_f0_aux_f1 == 6) |
|
227 | if (nb_sm_f0_aux_f1 == 6) | |
224 | { |
|
228 | { | |
225 | nb_sm_f0_aux_f1 = 0; |
|
229 | nb_sm_f0_aux_f1 = 0; | |
226 | nb_sm_f1 = nb_sm_f1 + 1; |
|
230 | nb_sm_f1 = nb_sm_f1 + 1; | |
227 | } |
|
231 | } | |
228 | if (nb_sm_f1 == NB_SM_BEFORE_AVF1 ) |
|
232 | if (nb_sm_f1 == NB_SM_BEFORE_AVF1 ) | |
229 | { |
|
233 | { | |
230 | ring_node_for_averaging_sm_f1 = current_ring_node_sm_f1; |
|
234 | ring_node_for_averaging_sm_f1 = current_ring_node_sm_f1; | |
231 | if (rtems_event_send( Task_id[TASKID_AVF1], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
235 | if (rtems_event_send( Task_id[TASKID_AVF1], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |
232 | { |
|
236 | { | |
233 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
237 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |
234 | } |
|
238 | } | |
235 | nb_sm_f1 = 0; |
|
239 | nb_sm_f1 = 0; | |
236 | } |
|
240 | } | |
237 |
|
241 | |||
238 | //*** |
|
242 | //*** | |
239 | // F2 |
|
243 | // F2 | |
240 | nb_sm_f0_aux_f2 = nb_sm_f0_aux_f2 + 1; |
|
244 | nb_sm_f0_aux_f2 = nb_sm_f0_aux_f2 + 1; | |
241 | if (nb_sm_f0_aux_f2 == 96) |
|
245 | if (nb_sm_f0_aux_f2 == 96) | |
242 | { |
|
246 | { | |
243 | nb_sm_f0_aux_f2 = 0; |
|
247 | nb_sm_f0_aux_f2 = 0; | |
244 | ring_node_for_averaging_sm_f2 = current_ring_node_sm_f2; |
|
248 | ring_node_for_averaging_sm_f2 = current_ring_node_sm_f2; | |
245 | if (rtems_event_send( Task_id[TASKID_AVF2], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
249 | if (rtems_event_send( Task_id[TASKID_AVF2], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |
246 | { |
|
250 | { | |
247 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
251 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |
248 | } |
|
252 | } | |
249 | } |
|
253 | } | |
250 | } |
|
254 | } | |
251 |
|
255 | |||
252 | //****************** |
|
256 | //****************** | |
253 | // Spectral Matrices |
|
257 | // Spectral Matrices | |
254 |
|
258 | |||
255 | void reset_nb_sm( void ) |
|
259 | void reset_nb_sm( void ) | |
256 | { |
|
260 | { | |
257 | nb_sm_f0 = 0; |
|
261 | nb_sm_f0 = 0; | |
258 | nb_sm_f0_aux_f1 = 0; |
|
262 | nb_sm_f0_aux_f1 = 0; | |
259 | nb_sm_f0_aux_f2 = 0; |
|
263 | nb_sm_f0_aux_f2 = 0; | |
260 |
|
264 | |||
261 | nb_sm_f1 = 0; |
|
265 | nb_sm_f1 = 0; | |
262 | } |
|
266 | } | |
263 |
|
267 | |||
264 | void SM_init_rings( void ) |
|
268 | void SM_init_rings( void ) | |
265 | { |
|
269 | { | |
266 | init_ring( sm_ring_f0, NB_RING_NODES_SM_F0, sm_f0, TOTAL_SIZE_SM ); |
|
270 | init_ring( sm_ring_f0, NB_RING_NODES_SM_F0, sm_f0, TOTAL_SIZE_SM ); | |
267 | init_ring( sm_ring_f1, NB_RING_NODES_SM_F1, sm_f1, TOTAL_SIZE_SM ); |
|
271 | init_ring( sm_ring_f1, NB_RING_NODES_SM_F1, sm_f1, TOTAL_SIZE_SM ); | |
268 | init_ring( sm_ring_f2, NB_RING_NODES_SM_F2, sm_f2, TOTAL_SIZE_SM ); |
|
272 | init_ring( sm_ring_f2, NB_RING_NODES_SM_F2, sm_f2, TOTAL_SIZE_SM ); | |
269 |
|
273 | |||
270 | DEBUG_PRINTF1("sm_ring_f0 @%x\n", (unsigned int) sm_ring_f0) |
|
274 | DEBUG_PRINTF1("sm_ring_f0 @%x\n", (unsigned int) sm_ring_f0) | |
271 | DEBUG_PRINTF1("sm_ring_f1 @%x\n", (unsigned int) sm_ring_f1) |
|
275 | DEBUG_PRINTF1("sm_ring_f1 @%x\n", (unsigned int) sm_ring_f1) | |
272 | DEBUG_PRINTF1("sm_ring_f2 @%x\n", (unsigned int) sm_ring_f2) |
|
276 | DEBUG_PRINTF1("sm_ring_f2 @%x\n", (unsigned int) sm_ring_f2) | |
273 | DEBUG_PRINTF1("sm_f0 @%x\n", (unsigned int) sm_f0) |
|
277 | DEBUG_PRINTF1("sm_f0 @%x\n", (unsigned int) sm_f0) | |
274 | DEBUG_PRINTF1("sm_f1 @%x\n", (unsigned int) sm_f1) |
|
278 | DEBUG_PRINTF1("sm_f1 @%x\n", (unsigned int) sm_f1) | |
275 | DEBUG_PRINTF1("sm_f2 @%x\n", (unsigned int) sm_f2) |
|
279 | DEBUG_PRINTF1("sm_f2 @%x\n", (unsigned int) sm_f2) | |
276 | } |
|
280 | } | |
277 |
|
281 | |||
278 | void ASM_generic_init_ring( ring_node_asm *ring, unsigned char nbNodes ) |
|
282 | void ASM_generic_init_ring( ring_node_asm *ring, unsigned char nbNodes ) | |
279 | { |
|
283 | { | |
280 | unsigned char i; |
|
284 | unsigned char i; | |
281 |
|
285 | |||
282 | ring[ nbNodes - 1 ].next |
|
286 | ring[ nbNodes - 1 ].next | |
283 | = (ring_node_asm*) &ring[ 0 ]; |
|
287 | = (ring_node_asm*) &ring[ 0 ]; | |
284 |
|
288 | |||
285 | for(i=0; i<nbNodes-1; i++) |
|
289 | for(i=0; i<nbNodes-1; i++) | |
286 | { |
|
290 | { | |
287 | ring[ i ].next = (ring_node_asm*) &ring[ i + 1 ]; |
|
291 | ring[ i ].next = (ring_node_asm*) &ring[ i + 1 ]; | |
288 | } |
|
292 | } | |
289 | } |
|
293 | } | |
290 |
|
294 | |||
291 | void SM_reset_current_ring_nodes( void ) |
|
295 | void SM_reset_current_ring_nodes( void ) | |
292 | { |
|
296 | { | |
293 | current_ring_node_sm_f0 = sm_ring_f0[0].next; |
|
297 | current_ring_node_sm_f0 = sm_ring_f0[0].next; | |
294 | current_ring_node_sm_f1 = sm_ring_f1[0].next; |
|
298 | current_ring_node_sm_f1 = sm_ring_f1[0].next; | |
295 | current_ring_node_sm_f2 = sm_ring_f2[0].next; |
|
299 | current_ring_node_sm_f2 = sm_ring_f2[0].next; | |
296 |
|
300 | |||
297 | ring_node_for_averaging_sm_f0 = sm_ring_f0; |
|
301 | ring_node_for_averaging_sm_f0 = sm_ring_f0; | |
298 | ring_node_for_averaging_sm_f1 = sm_ring_f1; |
|
302 | ring_node_for_averaging_sm_f1 = sm_ring_f1; | |
299 | ring_node_for_averaging_sm_f2 = sm_ring_f2; |
|
303 | ring_node_for_averaging_sm_f2 = sm_ring_f2; | |
300 | } |
|
304 | } | |
301 |
|
305 | |||
302 | //***************** |
|
306 | //***************** | |
303 | // Basic Parameters |
|
307 | // Basic Parameters | |
304 |
|
308 | |||
305 | void BP_init_header( Header_TM_LFR_SCIENCE_BP_t *header, |
|
309 | void BP_init_header( Header_TM_LFR_SCIENCE_BP_t *header, | |
306 | unsigned int apid, unsigned char sid, |
|
310 | unsigned int apid, unsigned char sid, | |
307 | unsigned int packetLength, unsigned char blkNr ) |
|
311 | unsigned int packetLength, unsigned char blkNr ) | |
308 | { |
|
312 | { | |
309 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
313 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; | |
310 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
314 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
311 | header->reserved = 0x00; |
|
315 | header->reserved = 0x00; | |
312 | header->userApplication = CCSDS_USER_APP; |
|
316 | header->userApplication = CCSDS_USER_APP; | |
313 | header->packetID[0] = (unsigned char) (apid >> 8); |
|
317 | header->packetID[0] = (unsigned char) (apid >> 8); | |
314 | header->packetID[1] = (unsigned char) (apid); |
|
318 | header->packetID[1] = (unsigned char) (apid); | |
315 | header->packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
319 | header->packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
316 | header->packetSequenceControl[1] = 0x00; |
|
320 | header->packetSequenceControl[1] = 0x00; | |
317 | header->packetLength[0] = (unsigned char) (packetLength >> 8); |
|
321 | header->packetLength[0] = (unsigned char) (packetLength >> 8); | |
318 | header->packetLength[1] = (unsigned char) (packetLength); |
|
322 | header->packetLength[1] = (unsigned char) (packetLength); | |
319 | // DATA FIELD HEADER |
|
323 | // DATA FIELD HEADER | |
320 | header->spare1_pusVersion_spare2 = 0x10; |
|
324 | header->spare1_pusVersion_spare2 = 0x10; | |
321 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
325 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
322 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
326 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
323 | header->destinationID = TM_DESTINATION_ID_GROUND; |
|
327 | header->destinationID = TM_DESTINATION_ID_GROUND; | |
324 | // AUXILIARY DATA HEADER |
|
328 | // AUXILIARY DATA HEADER | |
325 | header->sid = sid; |
|
329 | header->sid = sid; | |
326 | header->biaStatusInfo = 0x00; |
|
330 | header->biaStatusInfo = 0x00; | |
327 | header->time[0] = 0x00; |
|
331 | header->time[0] = 0x00; | |
328 | header->time[0] = 0x00; |
|
332 | header->time[0] = 0x00; | |
329 | header->time[0] = 0x00; |
|
333 | header->time[0] = 0x00; | |
330 | header->time[0] = 0x00; |
|
334 | header->time[0] = 0x00; | |
331 | header->time[0] = 0x00; |
|
335 | header->time[0] = 0x00; | |
332 | header->time[0] = 0x00; |
|
336 | header->time[0] = 0x00; | |
333 | header->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB |
|
337 | header->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB | |
334 | header->pa_lfr_bp_blk_nr[1] = blkNr; // BLK_NR LSB |
|
338 | header->pa_lfr_bp_blk_nr[1] = blkNr; // BLK_NR LSB | |
335 | } |
|
339 | } | |
336 |
|
340 | |||
337 | void BP_init_header_with_spare(Header_TM_LFR_SCIENCE_BP_with_spare_t *header, |
|
341 | void BP_init_header_with_spare(Header_TM_LFR_SCIENCE_BP_with_spare_t *header, | |
338 | unsigned int apid, unsigned char sid, |
|
342 | unsigned int apid, unsigned char sid, | |
339 | unsigned int packetLength , unsigned char blkNr) |
|
343 | unsigned int packetLength , unsigned char blkNr) | |
340 | { |
|
344 | { | |
341 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
345 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; | |
342 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
346 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
343 | header->reserved = 0x00; |
|
347 | header->reserved = 0x00; | |
344 | header->userApplication = CCSDS_USER_APP; |
|
348 | header->userApplication = CCSDS_USER_APP; | |
345 | header->packetID[0] = (unsigned char) (apid >> 8); |
|
349 | header->packetID[0] = (unsigned char) (apid >> 8); | |
346 | header->packetID[1] = (unsigned char) (apid); |
|
350 | header->packetID[1] = (unsigned char) (apid); | |
347 | header->packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
351 | header->packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
348 | header->packetSequenceControl[1] = 0x00; |
|
352 | header->packetSequenceControl[1] = 0x00; | |
349 | header->packetLength[0] = (unsigned char) (packetLength >> 8); |
|
353 | header->packetLength[0] = (unsigned char) (packetLength >> 8); | |
350 | header->packetLength[1] = (unsigned char) (packetLength); |
|
354 | header->packetLength[1] = (unsigned char) (packetLength); | |
351 | // DATA FIELD HEADER |
|
355 | // DATA FIELD HEADER | |
352 | header->spare1_pusVersion_spare2 = 0x10; |
|
356 | header->spare1_pusVersion_spare2 = 0x10; | |
353 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
357 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
354 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
358 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
355 | header->destinationID = TM_DESTINATION_ID_GROUND; |
|
359 | header->destinationID = TM_DESTINATION_ID_GROUND; | |
356 | // AUXILIARY DATA HEADER |
|
360 | // AUXILIARY DATA HEADER | |
357 | header->sid = sid; |
|
361 | header->sid = sid; | |
358 | header->biaStatusInfo = 0x00; |
|
362 | header->biaStatusInfo = 0x00; | |
359 | header->time[0] = 0x00; |
|
363 | header->time[0] = 0x00; | |
360 | header->time[0] = 0x00; |
|
364 | header->time[0] = 0x00; | |
361 | header->time[0] = 0x00; |
|
365 | header->time[0] = 0x00; | |
362 | header->time[0] = 0x00; |
|
366 | header->time[0] = 0x00; | |
363 | header->time[0] = 0x00; |
|
367 | header->time[0] = 0x00; | |
364 | header->time[0] = 0x00; |
|
368 | header->time[0] = 0x00; | |
365 | header->source_data_spare = 0x00; |
|
369 | header->source_data_spare = 0x00; | |
366 | header->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB |
|
370 | header->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB | |
367 | header->pa_lfr_bp_blk_nr[1] = blkNr; // BLK_NR LSB |
|
371 | header->pa_lfr_bp_blk_nr[1] = blkNr; // BLK_NR LSB | |
368 | } |
|
372 | } | |
369 |
|
373 | |||
370 | void BP_send(char *data, rtems_id queue_id, unsigned int nbBytesToSend, unsigned int sid ) |
|
374 | void BP_send(char *data, rtems_id queue_id, unsigned int nbBytesToSend, unsigned int sid ) | |
371 | { |
|
375 | { | |
372 | rtems_status_code status; |
|
376 | rtems_status_code status; | |
373 |
|
377 | |||
374 | // SET THE SEQUENCE_CNT PARAMETER |
|
378 | // SET THE SEQUENCE_CNT PARAMETER | |
375 | increment_seq_counter_source_id( (unsigned char*) &data[ PACKET_POS_SEQUENCE_CNT ], sid ); |
|
379 | increment_seq_counter_source_id( (unsigned char*) &data[ PACKET_POS_SEQUENCE_CNT ], sid ); | |
376 | // SEND PACKET |
|
380 | // SEND PACKET | |
377 | status = rtems_message_queue_send( queue_id, data, nbBytesToSend); |
|
381 | status = rtems_message_queue_send( queue_id, data, nbBytesToSend); | |
378 | if (status != RTEMS_SUCCESSFUL) |
|
382 | if (status != RTEMS_SUCCESSFUL) | |
379 | { |
|
383 | { | |
380 | printf("ERR *** in BP_send *** ERR %d\n", (int) status); |
|
384 | printf("ERR *** in BP_send *** ERR %d\n", (int) status); | |
381 | } |
|
385 | } | |
382 | } |
|
386 | } | |
383 |
|
387 | |||
384 | //****************** |
|
388 | //****************** | |
385 | // general functions |
|
389 | // general functions | |
386 |
|
390 | |||
387 | void reset_sm_status( void ) |
|
391 | void reset_sm_status( void ) | |
388 | { |
|
392 | { | |
389 | // error |
|
393 | // error | |
390 | // 10 --------------- 9 ---------------- 8 ---------------- 7 --------- |
|
394 | // 10 --------------- 9 ---------------- 8 ---------------- 7 --------- | |
391 | // input_fif0_write_2 input_fifo_write_1 input_fifo_write_0 buffer_full |
|
395 | // input_fif0_write_2 input_fifo_write_1 input_fifo_write_0 buffer_full | |
392 | // ---------- 5 -- 4 -- 3 -- 2 -- 1 -- 0 -- |
|
396 | // ---------- 5 -- 4 -- 3 -- 2 -- 1 -- 0 -- | |
393 | // ready bits f2_1 f2_0 f1_1 f1_1 f0_1 f0_0 |
|
397 | // ready bits f2_1 f2_0 f1_1 f1_1 f0_1 f0_0 | |
394 |
|
398 | |||
395 | spectral_matrix_regs->status = 0x7ff; // [0111 1111 1111] |
|
399 | spectral_matrix_regs->status = 0x7ff; // [0111 1111 1111] | |
396 | } |
|
400 | } | |
397 |
|
401 | |||
398 | void reset_spectral_matrix_regs( void ) |
|
402 | void reset_spectral_matrix_regs( void ) | |
399 | { |
|
403 | { | |
400 | /** This function resets the spectral matrices module registers. |
|
404 | /** This function resets the spectral matrices module registers. | |
401 | * |
|
405 | * | |
402 | * The registers affected by this function are located at the following offset addresses: |
|
406 | * The registers affected by this function are located at the following offset addresses: | |
403 | * |
|
407 | * | |
404 | * - 0x00 config |
|
408 | * - 0x00 config | |
405 | * - 0x04 status |
|
409 | * - 0x04 status | |
406 | * - 0x08 matrixF0_Address0 |
|
410 | * - 0x08 matrixF0_Address0 | |
407 | * - 0x10 matrixFO_Address1 |
|
411 | * - 0x10 matrixFO_Address1 | |
408 | * - 0x14 matrixF1_Address |
|
412 | * - 0x14 matrixF1_Address | |
409 | * - 0x18 matrixF2_Address |
|
413 | * - 0x18 matrixF2_Address | |
410 | * |
|
414 | * | |
411 | */ |
|
415 | */ | |
412 |
|
416 | |||
413 | set_sm_irq_onError( 0 ); |
|
417 | set_sm_irq_onError( 0 ); | |
414 |
|
418 | |||
415 | set_sm_irq_onNewMatrix( 0 ); |
|
419 | set_sm_irq_onNewMatrix( 0 ); | |
416 |
|
420 | |||
417 | reset_sm_status(); |
|
421 | reset_sm_status(); | |
418 |
|
422 | |||
419 | spectral_matrix_regs->f0_0_address = current_ring_node_sm_f0->previous->buffer_address; |
|
423 | spectral_matrix_regs->f0_0_address = current_ring_node_sm_f0->previous->buffer_address; | |
420 | spectral_matrix_regs->f0_1_address = current_ring_node_sm_f0->buffer_address; |
|
424 | spectral_matrix_regs->f0_1_address = current_ring_node_sm_f0->buffer_address; | |
421 | spectral_matrix_regs->f1_0_address = current_ring_node_sm_f1->previous->buffer_address; |
|
425 | spectral_matrix_regs->f1_0_address = current_ring_node_sm_f1->previous->buffer_address; | |
422 | spectral_matrix_regs->f1_1_address = current_ring_node_sm_f1->buffer_address; |
|
426 | spectral_matrix_regs->f1_1_address = current_ring_node_sm_f1->buffer_address; | |
423 | spectral_matrix_regs->f2_0_address = current_ring_node_sm_f2->previous->buffer_address; |
|
427 | spectral_matrix_regs->f2_0_address = current_ring_node_sm_f2->previous->buffer_address; | |
424 | spectral_matrix_regs->f2_1_address = current_ring_node_sm_f2->buffer_address; |
|
428 | spectral_matrix_regs->f2_1_address = current_ring_node_sm_f2->buffer_address; | |
425 |
|
429 | |||
426 | spectral_matrix_regs->matrix_length = 0xc8; // 25 * 128 / 16 = 200 = 0xc8 |
|
430 | spectral_matrix_regs->matrix_length = 0xc8; // 25 * 128 / 16 = 200 = 0xc8 | |
427 | } |
|
431 | } | |
428 |
|
432 | |||
429 | void set_time( unsigned char *time, unsigned char * timeInBuffer ) |
|
433 | void set_time( unsigned char *time, unsigned char * timeInBuffer ) | |
430 | { |
|
434 | { | |
431 | time[0] = timeInBuffer[0]; |
|
435 | time[0] = timeInBuffer[0]; | |
432 | time[1] = timeInBuffer[1]; |
|
436 | time[1] = timeInBuffer[1]; | |
433 | time[2] = timeInBuffer[2]; |
|
437 | time[2] = timeInBuffer[2]; | |
434 | time[3] = timeInBuffer[3]; |
|
438 | time[3] = timeInBuffer[3]; | |
435 | time[4] = timeInBuffer[6]; |
|
439 | time[4] = timeInBuffer[6]; | |
436 | time[5] = timeInBuffer[7]; |
|
440 | time[5] = timeInBuffer[7]; | |
437 | } |
|
441 | } | |
438 |
|
442 | |||
439 | unsigned long long int get_acquisition_time( unsigned char *timePtr ) |
|
443 | unsigned long long int get_acquisition_time( unsigned char *timePtr ) | |
440 | { |
|
444 | { | |
441 | unsigned long long int acquisitionTimeAslong; |
|
445 | unsigned long long int acquisitionTimeAslong; | |
442 | acquisitionTimeAslong = 0x00; |
|
446 | acquisitionTimeAslong = 0x00; | |
443 | acquisitionTimeAslong = ( (unsigned long long int) (timePtr[0] & 0x7f) << 40 ) // [0111 1111] mask the synchronization bit |
|
447 | acquisitionTimeAslong = ( (unsigned long long int) (timePtr[0] & 0x7f) << 40 ) // [0111 1111] mask the synchronization bit | |
444 | + ( (unsigned long long int) timePtr[1] << 32 ) |
|
448 | + ( (unsigned long long int) timePtr[1] << 32 ) | |
445 | + ( (unsigned long long int) timePtr[2] << 24 ) |
|
449 | + ( (unsigned long long int) timePtr[2] << 24 ) | |
446 | + ( (unsigned long long int) timePtr[3] << 16 ) |
|
450 | + ( (unsigned long long int) timePtr[3] << 16 ) | |
447 | + ( (unsigned long long int) timePtr[6] << 8 ) |
|
451 | + ( (unsigned long long int) timePtr[6] << 8 ) | |
448 | + ( (unsigned long long int) timePtr[7] ); |
|
452 | + ( (unsigned long long int) timePtr[7] ); | |
449 | return acquisitionTimeAslong; |
|
453 | return acquisitionTimeAslong; | |
450 | } |
|
454 | } | |
451 |
|
455 | |||
452 | void close_matrix_actions(unsigned int *nb_sm, unsigned int nb_sm_before_avf, rtems_id avf_task_id, |
|
456 | void close_matrix_actions(unsigned int *nb_sm, unsigned int nb_sm_before_avf, rtems_id avf_task_id, | |
453 | ring_node *node_for_averaging, ring_node *ringNode, |
|
457 | ring_node *node_for_averaging, ring_node *ringNode, | |
454 | unsigned long long int time ) |
|
458 | unsigned long long int time ) | |
455 | { |
|
459 | { | |
456 | unsigned char *timePtr; |
|
460 | unsigned char *timePtr; | |
457 | unsigned char *coarseTimePtr; |
|
461 | unsigned char *coarseTimePtr; | |
458 | unsigned char *fineTimePtr; |
|
462 | unsigned char *fineTimePtr; | |
459 | rtems_status_code status_code; |
|
463 | rtems_status_code status_code; | |
460 |
|
464 | |||
461 | timePtr = (unsigned char *) &time; |
|
465 | timePtr = (unsigned char *) &time; | |
462 | coarseTimePtr = (unsigned char *) &node_for_averaging->coarseTime; |
|
466 | coarseTimePtr = (unsigned char *) &node_for_averaging->coarseTime; | |
463 | fineTimePtr = (unsigned char *) &node_for_averaging->fineTime; |
|
467 | fineTimePtr = (unsigned char *) &node_for_averaging->fineTime; | |
464 |
|
468 | |||
465 | *nb_sm = *nb_sm + 1; |
|
469 | *nb_sm = *nb_sm + 1; | |
466 | if (*nb_sm == nb_sm_before_avf) |
|
470 | if (*nb_sm == nb_sm_before_avf) | |
467 | { |
|
471 | { | |
468 | node_for_averaging = ringNode; |
|
472 | node_for_averaging = ringNode; | |
469 | coarseTimePtr[0] = timePtr[2]; |
|
473 | coarseTimePtr[0] = timePtr[2]; | |
470 | coarseTimePtr[1] = timePtr[3]; |
|
474 | coarseTimePtr[1] = timePtr[3]; | |
471 | coarseTimePtr[2] = timePtr[4]; |
|
475 | coarseTimePtr[2] = timePtr[4]; | |
472 | coarseTimePtr[3] = timePtr[5]; |
|
476 | coarseTimePtr[3] = timePtr[5]; | |
473 | fineTimePtr[2] = timePtr[6]; |
|
477 | fineTimePtr[2] = timePtr[6]; | |
474 | fineTimePtr[3] = timePtr[7]; |
|
478 | fineTimePtr[3] = timePtr[7]; | |
475 | if (rtems_event_send( avf_task_id, RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
479 | if (rtems_event_send( avf_task_id, RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |
476 | { |
|
480 | { | |
477 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
481 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |
478 | } |
|
482 | } | |
479 | *nb_sm = 0; |
|
483 | *nb_sm = 0; | |
480 | } |
|
484 | } | |
481 | } |
|
485 | } | |
482 |
|
486 | |||
483 | unsigned char getSID( rtems_event_set event ) |
|
487 | unsigned char getSID( rtems_event_set event ) | |
484 | { |
|
488 | { | |
485 | unsigned char sid; |
|
489 | unsigned char sid; | |
486 |
|
490 | |||
487 | rtems_event_set eventSetBURST; |
|
491 | rtems_event_set eventSetBURST; | |
488 | rtems_event_set eventSetSBM; |
|
492 | rtems_event_set eventSetSBM; | |
489 |
|
493 | |||
490 | //****** |
|
494 | //****** | |
491 | // BURST |
|
495 | // BURST | |
492 | eventSetBURST = RTEMS_EVENT_BURST_BP1_F0 |
|
496 | eventSetBURST = RTEMS_EVENT_BURST_BP1_F0 | |
493 | | RTEMS_EVENT_BURST_BP1_F1 |
|
497 | | RTEMS_EVENT_BURST_BP1_F1 | |
494 | | RTEMS_EVENT_BURST_BP2_F0 |
|
498 | | RTEMS_EVENT_BURST_BP2_F0 | |
495 | | RTEMS_EVENT_BURST_BP2_F1; |
|
499 | | RTEMS_EVENT_BURST_BP2_F1; | |
496 |
|
500 | |||
497 | //**** |
|
501 | //**** | |
498 | // SBM |
|
502 | // SBM | |
499 | eventSetSBM = RTEMS_EVENT_SBM_BP1_F0 |
|
503 | eventSetSBM = RTEMS_EVENT_SBM_BP1_F0 | |
500 | | RTEMS_EVENT_SBM_BP1_F1 |
|
504 | | RTEMS_EVENT_SBM_BP1_F1 | |
501 | | RTEMS_EVENT_SBM_BP2_F0 |
|
505 | | RTEMS_EVENT_SBM_BP2_F0 | |
502 | | RTEMS_EVENT_SBM_BP2_F1; |
|
506 | | RTEMS_EVENT_SBM_BP2_F1; | |
503 |
|
507 | |||
504 | if (event & eventSetBURST) |
|
508 | if (event & eventSetBURST) | |
505 | { |
|
509 | { | |
506 | sid = SID_BURST_BP1_F0; |
|
510 | sid = SID_BURST_BP1_F0; | |
507 | } |
|
511 | } | |
508 | else if (event & eventSetSBM) |
|
512 | else if (event & eventSetSBM) | |
509 | { |
|
513 | { | |
510 | sid = SID_SBM1_BP1_F0; |
|
514 | sid = SID_SBM1_BP1_F0; | |
511 | } |
|
515 | } | |
512 | else |
|
516 | else | |
513 | { |
|
517 | { | |
514 | sid = 0; |
|
518 | sid = 0; | |
515 | } |
|
519 | } | |
516 |
|
520 | |||
517 | return sid; |
|
521 | return sid; | |
518 | } |
|
522 | } | |
519 |
|
523 |
@@ -1,1347 +1,1347 | |||||
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 rings |
|
13 | // waveform rings | |
14 | // F0 |
|
14 | // F0 | |
15 | ring_node waveform_ring_f0[NB_RING_NODES_F0]; |
|
15 | ring_node waveform_ring_f0[NB_RING_NODES_F0]; | |
16 | ring_node *current_ring_node_f0; |
|
16 | ring_node *current_ring_node_f0; | |
17 | ring_node *ring_node_to_send_swf_f0; |
|
17 | ring_node *ring_node_to_send_swf_f0; | |
18 | // F1 |
|
18 | // F1 | |
19 | ring_node waveform_ring_f1[NB_RING_NODES_F1]; |
|
19 | ring_node waveform_ring_f1[NB_RING_NODES_F1]; | |
20 | ring_node *current_ring_node_f1; |
|
20 | ring_node *current_ring_node_f1; | |
21 | ring_node *ring_node_to_send_swf_f1; |
|
21 | ring_node *ring_node_to_send_swf_f1; | |
22 | ring_node *ring_node_to_send_cwf_f1; |
|
22 | ring_node *ring_node_to_send_cwf_f1; | |
23 | // F2 |
|
23 | // F2 | |
24 | ring_node waveform_ring_f2[NB_RING_NODES_F2]; |
|
24 | ring_node waveform_ring_f2[NB_RING_NODES_F2]; | |
25 | ring_node *current_ring_node_f2; |
|
25 | ring_node *current_ring_node_f2; | |
26 | ring_node *ring_node_to_send_swf_f2; |
|
26 | ring_node *ring_node_to_send_swf_f2; | |
27 | ring_node *ring_node_to_send_cwf_f2; |
|
27 | ring_node *ring_node_to_send_cwf_f2; | |
28 | // F3 |
|
28 | // F3 | |
29 | ring_node waveform_ring_f3[NB_RING_NODES_F3]; |
|
29 | ring_node waveform_ring_f3[NB_RING_NODES_F3]; | |
30 | ring_node *current_ring_node_f3; |
|
30 | ring_node *current_ring_node_f3; | |
31 | ring_node *ring_node_to_send_cwf_f3; |
|
31 | ring_node *ring_node_to_send_cwf_f3; | |
32 |
|
32 | |||
33 | bool extractSWF = false; |
|
33 | bool extractSWF = false; | |
34 | bool swf_f0_ready = false; |
|
34 | bool swf_f0_ready = false; | |
35 | bool swf_f1_ready = false; |
|
35 | bool swf_f1_ready = false; | |
36 | bool swf_f2_ready = false; |
|
36 | bool swf_f2_ready = false; | |
37 |
|
37 | |||
38 | int wf_snap_extracted[ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) ]; |
|
38 | int wf_snap_extracted[ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) ]; | |
39 | ring_node ring_node_wf_snap_extracted; |
|
39 | ring_node ring_node_wf_snap_extracted; | |
40 |
|
40 | |||
41 | //********************* |
|
41 | //********************* | |
42 | // Interrupt SubRoutine |
|
42 | // Interrupt SubRoutine | |
43 |
|
43 | |||
44 | void reset_extractSWF( void ) |
|
44 | void reset_extractSWF( void ) | |
45 | { |
|
45 | { | |
46 | extractSWF = false; |
|
46 | extractSWF = false; | |
47 | swf_f0_ready = false; |
|
47 | swf_f0_ready = false; | |
48 | swf_f1_ready = false; |
|
48 | swf_f1_ready = false; | |
49 | swf_f2_ready = false; |
|
49 | swf_f2_ready = false; | |
50 | } |
|
50 | } | |
51 |
|
51 | |||
52 | inline void waveforms_isr_f3( void ) |
|
52 | inline void waveforms_isr_f3( void ) | |
53 | { |
|
53 | { | |
54 | rtems_status_code spare_status; |
|
54 | rtems_status_code spare_status; | |
55 |
|
55 | |||
56 | 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 |
|
56 | 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 | |
57 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
57 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) | |
58 | { // in modes other than STANDBY and BURST, send the CWF_F3 data |
|
58 | { // in modes other than STANDBY and BURST, send the CWF_F3 data | |
59 | //*** |
|
59 | //*** | |
60 | // F3 |
|
60 | // F3 | |
61 | if ( (waveform_picker_regs->status & 0xc0) != 0x00 ) { // [1100 0000] check the f3 full bits |
|
61 | if ( (waveform_picker_regs->status & 0xc0) != 0x00 ) { // [1100 0000] check the f3 full bits | |
62 | ring_node_to_send_cwf_f3 = current_ring_node_f3->previous; |
|
62 | ring_node_to_send_cwf_f3 = current_ring_node_f3->previous; | |
63 | current_ring_node_f3 = current_ring_node_f3->next; |
|
63 | current_ring_node_f3 = current_ring_node_f3->next; | |
64 | if ((waveform_picker_regs->status & 0x40) == 0x40){ // [0100 0000] f3 buffer 0 is full |
|
64 | if ((waveform_picker_regs->status & 0x40) == 0x40){ // [0100 0000] f3 buffer 0 is full | |
65 | ring_node_to_send_cwf_f3->coarseTime = waveform_picker_regs->f3_0_coarse_time; |
|
65 | ring_node_to_send_cwf_f3->coarseTime = waveform_picker_regs->f3_0_coarse_time; | |
66 | ring_node_to_send_cwf_f3->fineTime = waveform_picker_regs->f3_0_fine_time; |
|
66 | ring_node_to_send_cwf_f3->fineTime = waveform_picker_regs->f3_0_fine_time; | |
67 | waveform_picker_regs->addr_data_f3_0 = current_ring_node_f3->buffer_address; |
|
67 | waveform_picker_regs->addr_data_f3_0 = current_ring_node_f3->buffer_address; | |
68 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00008840; // [1000 1000 0100 0000] |
|
68 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00008840; // [1000 1000 0100 0000] | |
69 | } |
|
69 | } | |
70 | else if ((waveform_picker_regs->status & 0x80) == 0x80){ // [1000 0000] f3 buffer 1 is full |
|
70 | else if ((waveform_picker_regs->status & 0x80) == 0x80){ // [1000 0000] f3 buffer 1 is full | |
71 | ring_node_to_send_cwf_f3->coarseTime = waveform_picker_regs->f3_1_coarse_time; |
|
71 | ring_node_to_send_cwf_f3->coarseTime = waveform_picker_regs->f3_1_coarse_time; | |
72 | ring_node_to_send_cwf_f3->fineTime = waveform_picker_regs->f3_1_fine_time; |
|
72 | ring_node_to_send_cwf_f3->fineTime = waveform_picker_regs->f3_1_fine_time; | |
73 | waveform_picker_regs->addr_data_f3_1 = current_ring_node_f3->buffer_address; |
|
73 | waveform_picker_regs->addr_data_f3_1 = current_ring_node_f3->buffer_address; | |
74 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00008880; // [1000 1000 1000 0000] |
|
74 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00008880; // [1000 1000 1000 0000] | |
75 | } |
|
75 | } | |
76 | if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
76 | if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { | |
77 | spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ); |
|
77 | spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ); | |
78 | } |
|
78 | } | |
79 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2); |
|
79 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2); | |
80 | } |
|
80 | } | |
81 | } |
|
81 | } | |
82 | } |
|
82 | } | |
83 |
|
83 | |||
84 | inline void waveforms_isr_normal( void ) |
|
84 | inline void waveforms_isr_normal( void ) | |
85 | { |
|
85 | { | |
86 | rtems_status_code status; |
|
86 | rtems_status_code status; | |
87 |
|
87 | |||
88 | if ( ( (waveform_picker_regs->status & 0x30) != 0x00 ) // [0011 0000] check the f2 full bits |
|
88 | if ( ( (waveform_picker_regs->status & 0x30) != 0x00 ) // [0011 0000] check the f2 full bits | |
89 | && ( (waveform_picker_regs->status & 0x0c) != 0x00 ) // [0000 1100] check the f1 full bits |
|
89 | && ( (waveform_picker_regs->status & 0x0c) != 0x00 ) // [0000 1100] check the f1 full bits | |
90 | && ( (waveform_picker_regs->status & 0x03) != 0x00 )) // [0000 0011] check the f0 full bits |
|
90 | && ( (waveform_picker_regs->status & 0x03) != 0x00 )) // [0000 0011] check the f0 full bits | |
91 | { |
|
91 | { | |
92 | //*** |
|
92 | //*** | |
93 | // F0 |
|
93 | // F0 | |
94 | ring_node_to_send_swf_f0 = current_ring_node_f0->previous; |
|
94 | ring_node_to_send_swf_f0 = current_ring_node_f0->previous; | |
95 | current_ring_node_f0 = current_ring_node_f0->next; |
|
95 | current_ring_node_f0 = current_ring_node_f0->next; | |
96 | if ( (waveform_picker_regs->status & 0x01) == 0x01) |
|
96 | if ( (waveform_picker_regs->status & 0x01) == 0x01) | |
97 | { |
|
97 | { | |
98 |
|
98 | |||
99 | ring_node_to_send_swf_f0->coarseTime = waveform_picker_regs->f0_0_coarse_time; |
|
99 | ring_node_to_send_swf_f0->coarseTime = waveform_picker_regs->f0_0_coarse_time; | |
100 | ring_node_to_send_swf_f0->fineTime = waveform_picker_regs->f0_0_fine_time; |
|
100 | ring_node_to_send_swf_f0->fineTime = waveform_picker_regs->f0_0_fine_time; | |
101 | waveform_picker_regs->addr_data_f0_0 = current_ring_node_f0->buffer_address; |
|
101 | waveform_picker_regs->addr_data_f0_0 = current_ring_node_f0->buffer_address; | |
102 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00001101; // [0001 0001 0000 0001] |
|
102 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00001101; // [0001 0001 0000 0001] | |
103 | } |
|
103 | } | |
104 | else if ( (waveform_picker_regs->status & 0x02) == 0x02) |
|
104 | else if ( (waveform_picker_regs->status & 0x02) == 0x02) | |
105 | { |
|
105 | { | |
106 | ring_node_to_send_swf_f0->coarseTime = waveform_picker_regs->f0_1_coarse_time; |
|
106 | ring_node_to_send_swf_f0->coarseTime = waveform_picker_regs->f0_1_coarse_time; | |
107 | ring_node_to_send_swf_f0->fineTime = waveform_picker_regs->f0_1_fine_time; |
|
107 | ring_node_to_send_swf_f0->fineTime = waveform_picker_regs->f0_1_fine_time; | |
108 | waveform_picker_regs->addr_data_f0_1 = current_ring_node_f0->buffer_address; |
|
108 | waveform_picker_regs->addr_data_f0_1 = current_ring_node_f0->buffer_address; | |
109 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00001102; // [0001 0001 0000 0010] |
|
109 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00001102; // [0001 0001 0000 0010] | |
110 | } |
|
110 | } | |
111 |
|
111 | |||
112 | //*** |
|
112 | //*** | |
113 | // F1 |
|
113 | // F1 | |
114 | ring_node_to_send_swf_f1 = current_ring_node_f1->previous; |
|
114 | ring_node_to_send_swf_f1 = current_ring_node_f1->previous; | |
115 | current_ring_node_f1 = current_ring_node_f1->next; |
|
115 | current_ring_node_f1 = current_ring_node_f1->next; | |
116 | if ( (waveform_picker_regs->status & 0x04) == 0x04) |
|
116 | if ( (waveform_picker_regs->status & 0x04) == 0x04) | |
117 | { |
|
117 | { | |
118 | ring_node_to_send_swf_f1->coarseTime = waveform_picker_regs->f1_0_coarse_time; |
|
118 | ring_node_to_send_swf_f1->coarseTime = waveform_picker_regs->f1_0_coarse_time; | |
119 | ring_node_to_send_swf_f1->fineTime = waveform_picker_regs->f1_0_fine_time; |
|
119 | ring_node_to_send_swf_f1->fineTime = waveform_picker_regs->f1_0_fine_time; | |
120 | waveform_picker_regs->addr_data_f1_0 = current_ring_node_f1->buffer_address; |
|
120 | waveform_picker_regs->addr_data_f1_0 = current_ring_node_f1->buffer_address; | |
121 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00002204; // [0010 0010 0000 0100] f1 bits = 0 |
|
121 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00002204; // [0010 0010 0000 0100] f1 bits = 0 | |
122 | } |
|
122 | } | |
123 | else if ( (waveform_picker_regs->status & 0x08) == 0x08) |
|
123 | else if ( (waveform_picker_regs->status & 0x08) == 0x08) | |
124 | { |
|
124 | { | |
125 | ring_node_to_send_swf_f1->coarseTime = waveform_picker_regs->f1_1_coarse_time; |
|
125 | ring_node_to_send_swf_f1->coarseTime = waveform_picker_regs->f1_1_coarse_time; | |
126 | ring_node_to_send_swf_f1->fineTime = waveform_picker_regs->f1_1_fine_time; |
|
126 | ring_node_to_send_swf_f1->fineTime = waveform_picker_regs->f1_1_fine_time; | |
127 | waveform_picker_regs->addr_data_f1_1 = current_ring_node_f1->buffer_address; |
|
127 | waveform_picker_regs->addr_data_f1_1 = current_ring_node_f1->buffer_address; | |
128 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00002208; // [0010 0010 0000 1000] f1 bits = 0 |
|
128 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00002208; // [0010 0010 0000 1000] f1 bits = 0 | |
129 | } |
|
129 | } | |
130 |
|
130 | |||
131 | //*** |
|
131 | //*** | |
132 | // F2 |
|
132 | // F2 | |
133 | ring_node_to_send_swf_f2 = current_ring_node_f2->previous; |
|
133 | ring_node_to_send_swf_f2 = current_ring_node_f2->previous; | |
134 | current_ring_node_f2 = current_ring_node_f2->next; |
|
134 | current_ring_node_f2 = current_ring_node_f2->next; | |
135 | if ( (waveform_picker_regs->status & 0x10) == 0x10) |
|
135 | if ( (waveform_picker_regs->status & 0x10) == 0x10) | |
136 | { |
|
136 | { | |
137 | ring_node_to_send_swf_f2->coarseTime = waveform_picker_regs->f2_0_coarse_time; |
|
137 | ring_node_to_send_swf_f2->coarseTime = waveform_picker_regs->f2_0_coarse_time; | |
138 | ring_node_to_send_swf_f2->fineTime = waveform_picker_regs->f2_0_fine_time; |
|
138 | ring_node_to_send_swf_f2->fineTime = waveform_picker_regs->f2_0_fine_time; | |
139 | waveform_picker_regs->addr_data_f2_0 = current_ring_node_f2->buffer_address; |
|
139 | waveform_picker_regs->addr_data_f2_0 = current_ring_node_f2->buffer_address; | |
140 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00004410; // [0100 0100 0001 0000] |
|
140 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00004410; // [0100 0100 0001 0000] | |
141 | } |
|
141 | } | |
142 | else if ( (waveform_picker_regs->status & 0x20) == 0x20) |
|
142 | else if ( (waveform_picker_regs->status & 0x20) == 0x20) | |
143 | { |
|
143 | { | |
144 | ring_node_to_send_swf_f2->coarseTime = waveform_picker_regs->f2_1_coarse_time; |
|
144 | ring_node_to_send_swf_f2->coarseTime = waveform_picker_regs->f2_1_coarse_time; | |
145 | ring_node_to_send_swf_f2->fineTime = waveform_picker_regs->f2_1_fine_time; |
|
145 | ring_node_to_send_swf_f2->fineTime = waveform_picker_regs->f2_1_fine_time; | |
146 | waveform_picker_regs->addr_data_f2_1 = current_ring_node_f2->buffer_address; |
|
146 | waveform_picker_regs->addr_data_f2_1 = current_ring_node_f2->buffer_address; | |
147 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00004420; // [0100 0100 0010 0000] |
|
147 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00004420; // [0100 0100 0010 0000] | |
148 | } |
|
148 | } | |
149 | // |
|
149 | // | |
150 | status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ); |
|
150 | status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ); | |
151 | if ( status != RTEMS_SUCCESSFUL) |
|
151 | if ( status != RTEMS_SUCCESSFUL) | |
152 | { |
|
152 | { | |
153 | status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ); |
|
153 | status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ); | |
154 | } |
|
154 | } | |
155 | } |
|
155 | } | |
156 | } |
|
156 | } | |
157 |
|
157 | |||
158 | inline void waveforms_isr_burst( void ) |
|
158 | inline void waveforms_isr_burst( void ) | |
159 | { |
|
159 | { | |
160 | rtems_status_code spare_status; |
|
160 | rtems_status_code spare_status; | |
161 |
|
161 | |||
162 | if ( (waveform_picker_regs->status & 0x30) != 0 ){ // [0100] check the f2 full bit |
|
162 | if ( (waveform_picker_regs->status & 0x30) != 0 ){ // [0100] check the f2 full bit | |
163 | // (1) change the receiving buffer for the waveform picker |
|
163 | // (1) change the receiving buffer for the waveform picker | |
164 | ring_node_to_send_cwf_f2 = current_ring_node_f2->previous; |
|
164 | ring_node_to_send_cwf_f2 = current_ring_node_f2->previous; | |
165 | current_ring_node_f2 = current_ring_node_f2->next; |
|
165 | current_ring_node_f2 = current_ring_node_f2->next; | |
166 | if ( (waveform_picker_regs->status & 0x10) == 0x10) |
|
166 | if ( (waveform_picker_regs->status & 0x10) == 0x10) | |
167 | { |
|
167 | { | |
168 | ring_node_to_send_cwf_f2->coarseTime = waveform_picker_regs->f2_0_coarse_time; |
|
168 | ring_node_to_send_cwf_f2->coarseTime = waveform_picker_regs->f2_0_coarse_time; | |
169 | ring_node_to_send_cwf_f2->fineTime = waveform_picker_regs->f2_0_fine_time; |
|
169 | ring_node_to_send_cwf_f2->fineTime = waveform_picker_regs->f2_0_fine_time; | |
170 | waveform_picker_regs->addr_data_f2_0 = current_ring_node_f2->buffer_address; |
|
170 | waveform_picker_regs->addr_data_f2_0 = current_ring_node_f2->buffer_address; | |
171 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00004410; // [0100 0100 0001 0000] |
|
171 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00004410; // [0100 0100 0001 0000] | |
172 | } |
|
172 | } | |
173 | else if ( (waveform_picker_regs->status & 0x20) == 0x20) |
|
173 | else if ( (waveform_picker_regs->status & 0x20) == 0x20) | |
174 | { |
|
174 | { | |
175 | ring_node_to_send_cwf_f2->coarseTime = waveform_picker_regs->f2_1_coarse_time; |
|
175 | ring_node_to_send_cwf_f2->coarseTime = waveform_picker_regs->f2_1_coarse_time; | |
176 | ring_node_to_send_cwf_f2->fineTime = waveform_picker_regs->f2_1_fine_time; |
|
176 | ring_node_to_send_cwf_f2->fineTime = waveform_picker_regs->f2_1_fine_time; | |
177 | waveform_picker_regs->addr_data_f2_1 = current_ring_node_f2->buffer_address; |
|
177 | waveform_picker_regs->addr_data_f2_1 = current_ring_node_f2->buffer_address; | |
178 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00004420; // [0100 0100 0010 0000] |
|
178 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00004420; // [0100 0100 0010 0000] | |
179 | } |
|
179 | } | |
180 | // (2) send an event for the waveforms transmission |
|
180 | // (2) send an event for the waveforms transmission | |
181 | if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) { |
|
181 | if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) { | |
182 | spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ); |
|
182 | spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ); | |
183 | } |
|
183 | } | |
184 | } |
|
184 | } | |
185 | } |
|
185 | } | |
186 |
|
186 | |||
187 | inline void waveforms_isr_sbm1( void ) |
|
187 | inline void waveforms_isr_sbm1( void ) | |
188 | { |
|
188 | { | |
189 | rtems_status_code status; |
|
189 | rtems_status_code status; | |
190 |
|
190 | |||
191 | //*** |
|
191 | //*** | |
192 | // F1 |
|
192 | // F1 | |
193 | if ( (waveform_picker_regs->status & 0x0c) != 0x00 ) { // [0000 1100] check the f1 full bits |
|
193 | if ( (waveform_picker_regs->status & 0x0c) != 0x00 ) { // [0000 1100] check the f1 full bits | |
194 | // (1) change the receiving buffer for the waveform picker |
|
194 | // (1) change the receiving buffer for the waveform picker | |
195 | ring_node_to_send_cwf_f1 = current_ring_node_f1->previous; |
|
195 | ring_node_to_send_cwf_f1 = current_ring_node_f1->previous; | |
196 | current_ring_node_f1 = current_ring_node_f1->next; |
|
196 | current_ring_node_f1 = current_ring_node_f1->next; | |
197 | if ( (waveform_picker_regs->status & 0x04) == 0x04) |
|
197 | if ( (waveform_picker_regs->status & 0x04) == 0x04) | |
198 | { |
|
198 | { | |
199 | ring_node_to_send_cwf_f1->coarseTime = waveform_picker_regs->f1_0_coarse_time; |
|
199 | ring_node_to_send_cwf_f1->coarseTime = waveform_picker_regs->f1_0_coarse_time; | |
200 | ring_node_to_send_cwf_f1->fineTime = waveform_picker_regs->f1_0_fine_time; |
|
200 | ring_node_to_send_cwf_f1->fineTime = waveform_picker_regs->f1_0_fine_time; | |
201 | waveform_picker_regs->addr_data_f1_0 = current_ring_node_f1->buffer_address; |
|
201 | waveform_picker_regs->addr_data_f1_0 = current_ring_node_f1->buffer_address; | |
202 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00002204; // [0010 0010 0000 0100] f1 bits = 0 |
|
202 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00002204; // [0010 0010 0000 0100] f1 bits = 0 | |
203 | } |
|
203 | } | |
204 | else if ( (waveform_picker_regs->status & 0x08) == 0x08) |
|
204 | else if ( (waveform_picker_regs->status & 0x08) == 0x08) | |
205 | { |
|
205 | { | |
206 | ring_node_to_send_cwf_f1->coarseTime = waveform_picker_regs->f1_1_coarse_time; |
|
206 | ring_node_to_send_cwf_f1->coarseTime = waveform_picker_regs->f1_1_coarse_time; | |
207 | ring_node_to_send_cwf_f1->fineTime = waveform_picker_regs->f1_1_fine_time; |
|
207 | ring_node_to_send_cwf_f1->fineTime = waveform_picker_regs->f1_1_fine_time; | |
208 | waveform_picker_regs->addr_data_f1_1 = current_ring_node_f1->buffer_address; |
|
208 | waveform_picker_regs->addr_data_f1_1 = current_ring_node_f1->buffer_address; | |
209 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00002208; // [0010 0010 0000 1000] f1 bits = 0 |
|
209 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00002208; // [0010 0010 0000 1000] f1 bits = 0 | |
210 | } |
|
210 | } | |
211 | // (2) send an event for the the CWF1 task for transmission (and snapshot extraction if needed) |
|
211 | // (2) send an event for the the CWF1 task for transmission (and snapshot extraction if needed) | |
212 | status = rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 ); |
|
212 | status = rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 ); | |
213 | } |
|
213 | } | |
214 |
|
214 | |||
215 | //*** |
|
215 | //*** | |
216 | // F0 |
|
216 | // F0 | |
217 | if ( (waveform_picker_regs->status & 0x03) != 0x00 ) { // [0000 0011] check the f0 full bits |
|
217 | if ( (waveform_picker_regs->status & 0x03) != 0x00 ) { // [0000 0011] check the f0 full bits | |
218 | swf_f0_ready = true; |
|
218 | swf_f0_ready = true; | |
219 | // change f0 buffer |
|
219 | // change f0 buffer | |
220 | ring_node_to_send_swf_f0 = current_ring_node_f0->previous; |
|
220 | ring_node_to_send_swf_f0 = current_ring_node_f0->previous; | |
221 | current_ring_node_f0 = current_ring_node_f0->next; |
|
221 | current_ring_node_f0 = current_ring_node_f0->next; | |
222 | if ( (waveform_picker_regs->status & 0x01) == 0x01) |
|
222 | if ( (waveform_picker_regs->status & 0x01) == 0x01) | |
223 | { |
|
223 | { | |
224 |
|
224 | |||
225 | ring_node_to_send_swf_f0->coarseTime = waveform_picker_regs->f0_0_coarse_time; |
|
225 | ring_node_to_send_swf_f0->coarseTime = waveform_picker_regs->f0_0_coarse_time; | |
226 | ring_node_to_send_swf_f0->fineTime = waveform_picker_regs->f0_0_fine_time; |
|
226 | ring_node_to_send_swf_f0->fineTime = waveform_picker_regs->f0_0_fine_time; | |
227 | waveform_picker_regs->addr_data_f0_0 = current_ring_node_f0->buffer_address; |
|
227 | waveform_picker_regs->addr_data_f0_0 = current_ring_node_f0->buffer_address; | |
228 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00001101; // [0001 0001 0000 0001] |
|
228 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00001101; // [0001 0001 0000 0001] | |
229 | } |
|
229 | } | |
230 | else if ( (waveform_picker_regs->status & 0x02) == 0x02) |
|
230 | else if ( (waveform_picker_regs->status & 0x02) == 0x02) | |
231 | { |
|
231 | { | |
232 | ring_node_to_send_swf_f0->coarseTime = waveform_picker_regs->f0_1_coarse_time; |
|
232 | ring_node_to_send_swf_f0->coarseTime = waveform_picker_regs->f0_1_coarse_time; | |
233 | ring_node_to_send_swf_f0->fineTime = waveform_picker_regs->f0_1_fine_time; |
|
233 | ring_node_to_send_swf_f0->fineTime = waveform_picker_regs->f0_1_fine_time; | |
234 | waveform_picker_regs->addr_data_f0_1 = current_ring_node_f0->buffer_address; |
|
234 | waveform_picker_regs->addr_data_f0_1 = current_ring_node_f0->buffer_address; | |
235 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00001102; // [0001 0001 0000 0010] |
|
235 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00001102; // [0001 0001 0000 0010] | |
236 | } |
|
236 | } | |
237 | } |
|
237 | } | |
238 |
|
238 | |||
239 | //*** |
|
239 | //*** | |
240 | // F2 |
|
240 | // F2 | |
241 | if ( (waveform_picker_regs->status & 0x30) != 0x00 ) { // [0011 0000] check the f2 full bits |
|
241 | if ( (waveform_picker_regs->status & 0x30) != 0x00 ) { // [0011 0000] check the f2 full bits | |
242 | swf_f2_ready = true; |
|
242 | swf_f2_ready = true; | |
243 | // change f2 buffer |
|
243 | // change f2 buffer | |
244 | ring_node_to_send_swf_f2 = current_ring_node_f2->previous; |
|
244 | ring_node_to_send_swf_f2 = current_ring_node_f2->previous; | |
245 | current_ring_node_f2 = current_ring_node_f2->next; |
|
245 | current_ring_node_f2 = current_ring_node_f2->next; | |
246 | if ( (waveform_picker_regs->status & 0x10) == 0x10) |
|
246 | if ( (waveform_picker_regs->status & 0x10) == 0x10) | |
247 | { |
|
247 | { | |
248 | ring_node_to_send_swf_f2->coarseTime = waveform_picker_regs->f2_0_coarse_time; |
|
248 | ring_node_to_send_swf_f2->coarseTime = waveform_picker_regs->f2_0_coarse_time; | |
249 | ring_node_to_send_swf_f2->fineTime = waveform_picker_regs->f2_0_fine_time; |
|
249 | ring_node_to_send_swf_f2->fineTime = waveform_picker_regs->f2_0_fine_time; | |
250 | waveform_picker_regs->addr_data_f2_0 = current_ring_node_f2->buffer_address; |
|
250 | waveform_picker_regs->addr_data_f2_0 = current_ring_node_f2->buffer_address; | |
251 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00004410; // [0100 0100 0001 0000] |
|
251 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00004410; // [0100 0100 0001 0000] | |
252 | } |
|
252 | } | |
253 | else if ( (waveform_picker_regs->status & 0x20) == 0x20) |
|
253 | else if ( (waveform_picker_regs->status & 0x20) == 0x20) | |
254 | { |
|
254 | { | |
255 | ring_node_to_send_swf_f2->coarseTime = waveform_picker_regs->f2_1_coarse_time; |
|
255 | ring_node_to_send_swf_f2->coarseTime = waveform_picker_regs->f2_1_coarse_time; | |
256 | ring_node_to_send_swf_f2->fineTime = waveform_picker_regs->f2_1_fine_time; |
|
256 | ring_node_to_send_swf_f2->fineTime = waveform_picker_regs->f2_1_fine_time; | |
257 | waveform_picker_regs->addr_data_f2_1 = current_ring_node_f2->buffer_address; |
|
257 | waveform_picker_regs->addr_data_f2_1 = current_ring_node_f2->buffer_address; | |
258 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00004420; // [0100 0100 0010 0000] |
|
258 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00004420; // [0100 0100 0010 0000] | |
259 | } |
|
259 | } | |
260 | } |
|
260 | } | |
261 | } |
|
261 | } | |
262 |
|
262 | |||
263 | inline void waveforms_isr_sbm2( void ) |
|
263 | inline void waveforms_isr_sbm2( void ) | |
264 | { |
|
264 | { | |
265 | rtems_status_code status; |
|
265 | rtems_status_code status; | |
266 |
|
266 | |||
267 | //*** |
|
267 | //*** | |
268 | // F2 |
|
268 | // F2 | |
269 | if ( (waveform_picker_regs->status & 0x30) != 0x00 ) { // [0011 0000] check the f2 full bit |
|
269 | if ( (waveform_picker_regs->status & 0x30) != 0x00 ) { // [0011 0000] check the f2 full bit | |
270 | // (1) change the receiving buffer for the waveform picker |
|
270 | // (1) change the receiving buffer for the waveform picker | |
271 | ring_node_to_send_cwf_f2 = current_ring_node_f2->previous; |
|
271 | ring_node_to_send_cwf_f2 = current_ring_node_f2->previous; | |
272 | current_ring_node_f2 = current_ring_node_f2->next; |
|
272 | current_ring_node_f2 = current_ring_node_f2->next; | |
273 | if ( (waveform_picker_regs->status & 0x10) == 0x10) |
|
273 | if ( (waveform_picker_regs->status & 0x10) == 0x10) | |
274 | { |
|
274 | { | |
275 | ring_node_to_send_cwf_f2->coarseTime = waveform_picker_regs->f2_0_coarse_time; |
|
275 | ring_node_to_send_cwf_f2->coarseTime = waveform_picker_regs->f2_0_coarse_time; | |
276 | ring_node_to_send_cwf_f2->fineTime = waveform_picker_regs->f2_0_fine_time; |
|
276 | ring_node_to_send_cwf_f2->fineTime = waveform_picker_regs->f2_0_fine_time; | |
277 | waveform_picker_regs->addr_data_f2_0 = current_ring_node_f2->buffer_address; |
|
277 | waveform_picker_regs->addr_data_f2_0 = current_ring_node_f2->buffer_address; | |
278 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00004410; // [0100 0100 0001 0000] |
|
278 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00004410; // [0100 0100 0001 0000] | |
279 | } |
|
279 | } | |
280 | else if ( (waveform_picker_regs->status & 0x20) == 0x20) |
|
280 | else if ( (waveform_picker_regs->status & 0x20) == 0x20) | |
281 | { |
|
281 | { | |
282 | ring_node_to_send_cwf_f2->coarseTime = waveform_picker_regs->f2_1_coarse_time; |
|
282 | ring_node_to_send_cwf_f2->coarseTime = waveform_picker_regs->f2_1_coarse_time; | |
283 | ring_node_to_send_cwf_f2->fineTime = waveform_picker_regs->f2_1_fine_time; |
|
283 | ring_node_to_send_cwf_f2->fineTime = waveform_picker_regs->f2_1_fine_time; | |
284 | waveform_picker_regs->addr_data_f2_1 = current_ring_node_f2->buffer_address; |
|
284 | waveform_picker_regs->addr_data_f2_1 = current_ring_node_f2->buffer_address; | |
285 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00004420; // [0100 0100 0010 0000] |
|
285 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00004420; // [0100 0100 0010 0000] | |
286 | } |
|
286 | } | |
287 | // (2) send an event for the waveforms transmission |
|
287 | // (2) send an event for the waveforms transmission | |
288 | status = rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 ); |
|
288 | status = rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 ); | |
289 | } |
|
289 | } | |
290 |
|
290 | |||
291 | //*** |
|
291 | //*** | |
292 | // F0 |
|
292 | // F0 | |
293 | if ( (waveform_picker_regs->status & 0x03) != 0x00 ) { // [0000 0011] check the f0 full bit |
|
293 | if ( (waveform_picker_regs->status & 0x03) != 0x00 ) { // [0000 0011] check the f0 full bit | |
294 | swf_f0_ready = true; |
|
294 | swf_f0_ready = true; | |
295 | // change f0 buffer |
|
295 | // change f0 buffer | |
296 | ring_node_to_send_swf_f0 = current_ring_node_f0->previous; |
|
296 | ring_node_to_send_swf_f0 = current_ring_node_f0->previous; | |
297 | current_ring_node_f0 = current_ring_node_f0->next; |
|
297 | current_ring_node_f0 = current_ring_node_f0->next; | |
298 | if ( (waveform_picker_regs->status & 0x01) == 0x01) |
|
298 | if ( (waveform_picker_regs->status & 0x01) == 0x01) | |
299 | { |
|
299 | { | |
300 |
|
300 | |||
301 | ring_node_to_send_swf_f0->coarseTime = waveform_picker_regs->f0_0_coarse_time; |
|
301 | ring_node_to_send_swf_f0->coarseTime = waveform_picker_regs->f0_0_coarse_time; | |
302 | ring_node_to_send_swf_f0->fineTime = waveform_picker_regs->f0_0_fine_time; |
|
302 | ring_node_to_send_swf_f0->fineTime = waveform_picker_regs->f0_0_fine_time; | |
303 | waveform_picker_regs->addr_data_f0_0 = current_ring_node_f0->buffer_address; |
|
303 | waveform_picker_regs->addr_data_f0_0 = current_ring_node_f0->buffer_address; | |
304 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00001101; // [0001 0001 0000 0001] |
|
304 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00001101; // [0001 0001 0000 0001] | |
305 | } |
|
305 | } | |
306 | else if ( (waveform_picker_regs->status & 0x02) == 0x02) |
|
306 | else if ( (waveform_picker_regs->status & 0x02) == 0x02) | |
307 | { |
|
307 | { | |
308 | ring_node_to_send_swf_f0->coarseTime = waveform_picker_regs->f0_1_coarse_time; |
|
308 | ring_node_to_send_swf_f0->coarseTime = waveform_picker_regs->f0_1_coarse_time; | |
309 | ring_node_to_send_swf_f0->fineTime = waveform_picker_regs->f0_1_fine_time; |
|
309 | ring_node_to_send_swf_f0->fineTime = waveform_picker_regs->f0_1_fine_time; | |
310 | waveform_picker_regs->addr_data_f0_1 = current_ring_node_f0->buffer_address; |
|
310 | waveform_picker_regs->addr_data_f0_1 = current_ring_node_f0->buffer_address; | |
311 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00001102; // [0001 0001 0000 0010] |
|
311 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00001102; // [0001 0001 0000 0010] | |
312 | } |
|
312 | } | |
313 | } |
|
313 | } | |
314 |
|
314 | |||
315 | //*** |
|
315 | //*** | |
316 | // F1 |
|
316 | // F1 | |
317 | if ( (waveform_picker_regs->status & 0x0c) != 0x00 ) { // [0000 1100] check the f1 full bit |
|
317 | if ( (waveform_picker_regs->status & 0x0c) != 0x00 ) { // [0000 1100] check the f1 full bit | |
318 | swf_f1_ready = true; |
|
318 | swf_f1_ready = true; | |
319 | ring_node_to_send_swf_f1 = current_ring_node_f1->previous; |
|
319 | ring_node_to_send_swf_f1 = current_ring_node_f1->previous; | |
320 | current_ring_node_f1 = current_ring_node_f1->next; |
|
320 | current_ring_node_f1 = current_ring_node_f1->next; | |
321 | if ( (waveform_picker_regs->status & 0x04) == 0x04) |
|
321 | if ( (waveform_picker_regs->status & 0x04) == 0x04) | |
322 | { |
|
322 | { | |
323 | ring_node_to_send_swf_f1->coarseTime = waveform_picker_regs->f1_0_coarse_time; |
|
323 | ring_node_to_send_swf_f1->coarseTime = waveform_picker_regs->f1_0_coarse_time; | |
324 | ring_node_to_send_swf_f1->fineTime = waveform_picker_regs->f1_0_fine_time; |
|
324 | ring_node_to_send_swf_f1->fineTime = waveform_picker_regs->f1_0_fine_time; | |
325 | waveform_picker_regs->addr_data_f1_0 = current_ring_node_f1->buffer_address; |
|
325 | waveform_picker_regs->addr_data_f1_0 = current_ring_node_f1->buffer_address; | |
326 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00002204; // [0010 0010 0000 0100] f1 bits = 0 |
|
326 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00002204; // [0010 0010 0000 0100] f1 bits = 0 | |
327 | } |
|
327 | } | |
328 | else if ( (waveform_picker_regs->status & 0x08) == 0x08) |
|
328 | else if ( (waveform_picker_regs->status & 0x08) == 0x08) | |
329 | { |
|
329 | { | |
330 | ring_node_to_send_swf_f1->coarseTime = waveform_picker_regs->f1_1_coarse_time; |
|
330 | ring_node_to_send_swf_f1->coarseTime = waveform_picker_regs->f1_1_coarse_time; | |
331 | ring_node_to_send_swf_f1->fineTime = waveform_picker_regs->f1_1_fine_time; |
|
331 | ring_node_to_send_swf_f1->fineTime = waveform_picker_regs->f1_1_fine_time; | |
332 | waveform_picker_regs->addr_data_f1_1 = current_ring_node_f1->buffer_address; |
|
332 | waveform_picker_regs->addr_data_f1_1 = current_ring_node_f1->buffer_address; | |
333 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00002208; // [0010 0010 0000 1000] f1 bits = 0 |
|
333 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00002208; // [0010 0010 0000 1000] f1 bits = 0 | |
334 | } |
|
334 | } | |
335 | } |
|
335 | } | |
336 | } |
|
336 | } | |
337 |
|
337 | |||
338 | rtems_isr waveforms_isr( rtems_vector_number vector ) |
|
338 | rtems_isr waveforms_isr( rtems_vector_number vector ) | |
339 | { |
|
339 | { | |
340 | /** This is the interrupt sub routine called by the waveform picker core. |
|
340 | /** This is the interrupt sub routine called by the waveform picker core. | |
341 | * |
|
341 | * | |
342 | * This ISR launch different actions depending mainly on two pieces of information: |
|
342 | * This ISR launch different actions depending mainly on two pieces of information: | |
343 | * 1. the values read in the registers of the waveform picker. |
|
343 | * 1. the values read in the registers of the waveform picker. | |
344 | * 2. the current LFR mode. |
|
344 | * 2. the current LFR mode. | |
345 | * |
|
345 | * | |
346 | */ |
|
346 | */ | |
347 |
|
347 | |||
348 | // STATUS |
|
348 | // STATUS | |
349 | // new error error buffer full |
|
349 | // new error error buffer full | |
350 | // 15 14 13 12 11 10 9 8 |
|
350 | // 15 14 13 12 11 10 9 8 | |
351 | // f3 f2 f1 f0 f3 f2 f1 f0 |
|
351 | // f3 f2 f1 f0 f3 f2 f1 f0 | |
352 | // |
|
352 | // | |
353 | // ready buffer |
|
353 | // ready buffer | |
354 | // 7 6 5 4 3 2 1 0 |
|
354 | // 7 6 5 4 3 2 1 0 | |
355 | // f3_1 f3_0 f2_1 f2_0 f1_1 f1_0 f0_1 f0_0 |
|
355 | // f3_1 f3_0 f2_1 f2_0 f1_1 f1_0 f0_1 f0_0 | |
356 |
|
356 | |||
357 | rtems_status_code spare_status; |
|
357 | rtems_status_code spare_status; | |
358 |
|
358 | |||
359 | waveforms_isr_f3(); |
|
359 | waveforms_isr_f3(); | |
360 |
|
360 | |||
361 | if ( (waveform_picker_regs->status & 0xff00) != 0x00) // [1111 1111 0000 0000] check the error bits |
|
361 | if ( (waveform_picker_regs->status & 0xff00) != 0x00) // [1111 1111 0000 0000] check the error bits | |
362 | { |
|
362 | { | |
363 | spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_10 ); |
|
363 | spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_10 ); | |
364 | } |
|
364 | } | |
365 |
|
365 | |||
366 | switch(lfrCurrentMode) |
|
366 | switch(lfrCurrentMode) | |
367 | { |
|
367 | { | |
368 | //******** |
|
368 | //******** | |
369 | // STANDBY |
|
369 | // STANDBY | |
370 | case(LFR_MODE_STANDBY): |
|
370 | case(LFR_MODE_STANDBY): | |
371 | break; |
|
371 | break; | |
372 |
|
372 | |||
373 | //****** |
|
373 | //****** | |
374 | // NORMAL |
|
374 | // NORMAL | |
375 | case(LFR_MODE_NORMAL): |
|
375 | case(LFR_MODE_NORMAL): | |
376 | waveforms_isr_normal(); |
|
376 | waveforms_isr_normal(); | |
377 | break; |
|
377 | break; | |
378 |
|
378 | |||
379 | //****** |
|
379 | //****** | |
380 | // BURST |
|
380 | // BURST | |
381 | case(LFR_MODE_BURST): |
|
381 | case(LFR_MODE_BURST): | |
382 | waveforms_isr_burst(); |
|
382 | waveforms_isr_burst(); | |
383 | break; |
|
383 | break; | |
384 |
|
384 | |||
385 | //***** |
|
385 | //***** | |
386 | // SBM1 |
|
386 | // SBM1 | |
387 | case(LFR_MODE_SBM1): |
|
387 | case(LFR_MODE_SBM1): | |
388 | waveforms_isr_sbm1(); |
|
388 | waveforms_isr_sbm1(); | |
389 | break; |
|
389 | break; | |
390 |
|
390 | |||
391 | //***** |
|
391 | //***** | |
392 | // SBM2 |
|
392 | // SBM2 | |
393 | case(LFR_MODE_SBM2): |
|
393 | case(LFR_MODE_SBM2): | |
394 | waveforms_isr_sbm2(); |
|
394 | waveforms_isr_sbm2(); | |
395 | break; |
|
395 | break; | |
396 |
|
396 | |||
397 | //******** |
|
397 | //******** | |
398 | // DEFAULT |
|
398 | // DEFAULT | |
399 | default: |
|
399 | default: | |
400 | break; |
|
400 | break; | |
401 | } |
|
401 | } | |
402 | } |
|
402 | } | |
403 |
|
403 | |||
404 | //************ |
|
404 | //************ | |
405 | // RTEMS TASKS |
|
405 | // RTEMS TASKS | |
406 |
|
406 | |||
407 | rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP |
|
407 | rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP | |
408 | { |
|
408 | { | |
409 | /** This RTEMS task is dedicated to the transmission of snapshots of the NORMAL mode. |
|
409 | /** This RTEMS task is dedicated to the transmission of snapshots of the NORMAL mode. | |
410 | * |
|
410 | * | |
411 | * @param unused is the starting argument of the RTEMS task |
|
411 | * @param unused is the starting argument of the RTEMS task | |
412 | * |
|
412 | * | |
413 | * The following data packets are sent by this task: |
|
413 | * The following data packets are sent by this task: | |
414 | * - TM_LFR_SCIENCE_NORMAL_SWF_F0 |
|
414 | * - TM_LFR_SCIENCE_NORMAL_SWF_F0 | |
415 | * - TM_LFR_SCIENCE_NORMAL_SWF_F1 |
|
415 | * - TM_LFR_SCIENCE_NORMAL_SWF_F1 | |
416 | * - TM_LFR_SCIENCE_NORMAL_SWF_F2 |
|
416 | * - TM_LFR_SCIENCE_NORMAL_SWF_F2 | |
417 | * |
|
417 | * | |
418 | */ |
|
418 | */ | |
419 |
|
419 | |||
420 | rtems_event_set event_out; |
|
420 | rtems_event_set event_out; | |
421 | rtems_id queue_id; |
|
421 | rtems_id queue_id; | |
422 | rtems_status_code status; |
|
422 | rtems_status_code status; | |
423 | bool resynchronisationEngaged; |
|
423 | bool resynchronisationEngaged; | |
424 | ring_node *ring_node_wf_snap_extracted_ptr; |
|
424 | ring_node *ring_node_wf_snap_extracted_ptr; | |
425 |
|
425 | |||
426 | ring_node_wf_snap_extracted_ptr = (ring_node *) &ring_node_wf_snap_extracted; |
|
426 | ring_node_wf_snap_extracted_ptr = (ring_node *) &ring_node_wf_snap_extracted; | |
427 |
|
427 | |||
428 | resynchronisationEngaged = false; |
|
428 | resynchronisationEngaged = false; | |
429 |
|
429 | |||
430 | status = get_message_queue_id_send( &queue_id ); |
|
430 | status = get_message_queue_id_send( &queue_id ); | |
431 | if (status != RTEMS_SUCCESSFUL) |
|
431 | if (status != RTEMS_SUCCESSFUL) | |
432 | { |
|
432 | { | |
433 | PRINTF1("in WFRM *** ERR get_message_queue_id_send %d\n", status) |
|
433 | PRINTF1("in WFRM *** ERR get_message_queue_id_send %d\n", status) | |
434 | } |
|
434 | } | |
435 |
|
435 | |||
436 | BOOT_PRINTF("in WFRM ***\n") |
|
436 | BOOT_PRINTF("in WFRM ***\n") | |
437 |
|
437 | |||
438 | while(1){ |
|
438 | while(1){ | |
439 | // wait for an RTEMS_EVENT |
|
439 | // wait for an RTEMS_EVENT | |
440 | rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1 |
|
440 | rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1 | |
441 | | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM, |
|
441 | | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM, | |
442 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
442 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
443 | if(resynchronisationEngaged == false) |
|
443 | if(resynchronisationEngaged == false) | |
444 | { // engage resynchronisation |
|
444 | { // engage resynchronisation | |
445 | snapshot_resynchronization( (unsigned char *) ring_node_to_send_swf_f0->coarseTime ); |
|
445 | // snapshot_resynchronization( (unsigned char *) ring_node_to_send_swf_f0->coarseTime ); | |
446 | resynchronisationEngaged = true; |
|
446 | resynchronisationEngaged = true; | |
447 | } |
|
447 | } | |
448 | else |
|
448 | else | |
449 | { // reset delta_snapshot to the nominal value |
|
449 | { // reset delta_snapshot to the nominal value | |
450 | PRINTF("no resynchronisation, reset delta_snapshot to the nominal value\n") |
|
450 | PRINTF("no resynchronisation, reset delta_snapshot to the nominal value\n") | |
451 | set_wfp_delta_snapshot(); |
|
451 | // set_wfp_delta_snapshot(); | |
452 | resynchronisationEngaged = false; |
|
452 | resynchronisationEngaged = false; | |
453 | } |
|
453 | } | |
454 | // |
|
454 | // | |
455 |
|
455 | |||
456 | if (event_out == RTEMS_EVENT_MODE_NORMAL) |
|
456 | if (event_out == RTEMS_EVENT_MODE_NORMAL) | |
457 | { |
|
457 | { | |
458 | DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_NORMAL\n") |
|
458 | DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_NORMAL\n") | |
459 | ring_node_to_send_swf_f0->sid = SID_NORM_SWF_F0; |
|
459 | ring_node_to_send_swf_f0->sid = SID_NORM_SWF_F0; | |
460 | ring_node_to_send_swf_f1->sid = SID_NORM_SWF_F1; |
|
460 | ring_node_to_send_swf_f1->sid = SID_NORM_SWF_F1; | |
461 | ring_node_to_send_swf_f2->sid = SID_NORM_SWF_F2; |
|
461 | ring_node_to_send_swf_f2->sid = SID_NORM_SWF_F2; | |
462 | status = rtems_message_queue_send( queue_id, &ring_node_to_send_swf_f0, sizeof( ring_node* ) ); |
|
462 | status = rtems_message_queue_send( queue_id, &ring_node_to_send_swf_f0, sizeof( ring_node* ) ); | |
463 | status = rtems_message_queue_send( queue_id, &ring_node_to_send_swf_f1, sizeof( ring_node* ) ); |
|
463 | status = rtems_message_queue_send( queue_id, &ring_node_to_send_swf_f1, sizeof( ring_node* ) ); | |
464 | status = rtems_message_queue_send( queue_id, &ring_node_to_send_swf_f2, sizeof( ring_node* ) ); |
|
464 | status = rtems_message_queue_send( queue_id, &ring_node_to_send_swf_f2, sizeof( ring_node* ) ); | |
465 | } |
|
465 | } | |
466 | if (event_out == RTEMS_EVENT_MODE_SBM1) |
|
466 | if (event_out == RTEMS_EVENT_MODE_SBM1) | |
467 | { |
|
467 | { | |
468 | DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM1\n") |
|
468 | DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM1\n") | |
469 | ring_node_to_send_swf_f0->sid = SID_NORM_SWF_F0; |
|
469 | ring_node_to_send_swf_f0->sid = SID_NORM_SWF_F0; | |
470 | ring_node_wf_snap_extracted_ptr->sid = SID_NORM_SWF_F1; |
|
470 | ring_node_wf_snap_extracted_ptr->sid = SID_NORM_SWF_F1; | |
471 | ring_node_to_send_swf_f2->sid = SID_NORM_SWF_F2; |
|
471 | ring_node_to_send_swf_f2->sid = SID_NORM_SWF_F2; | |
472 | status = rtems_message_queue_send( queue_id, &ring_node_to_send_swf_f0, sizeof( ring_node* ) ); |
|
472 | status = rtems_message_queue_send( queue_id, &ring_node_to_send_swf_f0, sizeof( ring_node* ) ); | |
473 | status = rtems_message_queue_send( queue_id, &ring_node_wf_snap_extracted_ptr, sizeof( ring_node* ) ); |
|
473 | status = rtems_message_queue_send( queue_id, &ring_node_wf_snap_extracted_ptr, sizeof( ring_node* ) ); | |
474 | status = rtems_message_queue_send( queue_id, &ring_node_to_send_swf_f2, sizeof( ring_node* ) ); |
|
474 | status = rtems_message_queue_send( queue_id, &ring_node_to_send_swf_f2, sizeof( ring_node* ) ); | |
475 | } |
|
475 | } | |
476 | if (event_out == RTEMS_EVENT_MODE_SBM2) |
|
476 | if (event_out == RTEMS_EVENT_MODE_SBM2) | |
477 | { |
|
477 | { | |
478 | DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM2\n") |
|
478 | DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM2\n") | |
479 | ring_node_to_send_swf_f0->sid = SID_NORM_SWF_F0; |
|
479 | ring_node_to_send_swf_f0->sid = SID_NORM_SWF_F0; | |
480 | ring_node_to_send_swf_f1->sid = SID_NORM_SWF_F1; |
|
480 | ring_node_to_send_swf_f1->sid = SID_NORM_SWF_F1; | |
481 | ring_node_wf_snap_extracted_ptr->sid = SID_NORM_SWF_F2; |
|
481 | ring_node_wf_snap_extracted_ptr->sid = SID_NORM_SWF_F2; | |
482 | status = rtems_message_queue_send( queue_id, &ring_node_to_send_swf_f0, sizeof( ring_node* ) ); |
|
482 | status = rtems_message_queue_send( queue_id, &ring_node_to_send_swf_f0, sizeof( ring_node* ) ); | |
483 | status = rtems_message_queue_send( queue_id, &ring_node_to_send_swf_f1, sizeof( ring_node* ) ); |
|
483 | status = rtems_message_queue_send( queue_id, &ring_node_to_send_swf_f1, sizeof( ring_node* ) ); | |
484 | status = rtems_message_queue_send( queue_id, &ring_node_wf_snap_extracted_ptr, sizeof( ring_node* ) ); |
|
484 | status = rtems_message_queue_send( queue_id, &ring_node_wf_snap_extracted_ptr, sizeof( ring_node* ) ); | |
485 | } |
|
485 | } | |
486 | } |
|
486 | } | |
487 | } |
|
487 | } | |
488 |
|
488 | |||
489 | rtems_task cwf3_task(rtems_task_argument argument) //used with the waveform picker VHDL IP |
|
489 | rtems_task cwf3_task(rtems_task_argument argument) //used with the waveform picker VHDL IP | |
490 | { |
|
490 | { | |
491 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f3. |
|
491 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f3. | |
492 | * |
|
492 | * | |
493 | * @param unused is the starting argument of the RTEMS task |
|
493 | * @param unused is the starting argument of the RTEMS task | |
494 | * |
|
494 | * | |
495 | * The following data packet is sent by this task: |
|
495 | * The following data packet is sent by this task: | |
496 | * - TM_LFR_SCIENCE_NORMAL_CWF_F3 |
|
496 | * - TM_LFR_SCIENCE_NORMAL_CWF_F3 | |
497 | * |
|
497 | * | |
498 | */ |
|
498 | */ | |
499 |
|
499 | |||
500 | rtems_event_set event_out; |
|
500 | rtems_event_set event_out; | |
501 | rtems_id queue_id; |
|
501 | rtems_id queue_id; | |
502 | rtems_status_code status; |
|
502 | rtems_status_code status; | |
503 | ring_node ring_node_cwf3_light; |
|
503 | ring_node ring_node_cwf3_light; | |
504 |
|
504 | |||
505 | status = get_message_queue_id_send( &queue_id ); |
|
505 | status = get_message_queue_id_send( &queue_id ); | |
506 | if (status != RTEMS_SUCCESSFUL) |
|
506 | if (status != RTEMS_SUCCESSFUL) | |
507 | { |
|
507 | { | |
508 | PRINTF1("in CWF3 *** ERR get_message_queue_id_send %d\n", status) |
|
508 | PRINTF1("in CWF3 *** ERR get_message_queue_id_send %d\n", status) | |
509 | } |
|
509 | } | |
510 |
|
510 | |||
511 | ring_node_to_send_cwf_f3->sid = SID_NORM_CWF_LONG_F3; |
|
511 | ring_node_to_send_cwf_f3->sid = SID_NORM_CWF_LONG_F3; | |
512 |
|
512 | |||
513 | // init the ring_node_cwf3_light structure |
|
513 | // init the ring_node_cwf3_light structure | |
514 | ring_node_cwf3_light.buffer_address = (int) wf_cont_f3_light; |
|
514 | ring_node_cwf3_light.buffer_address = (int) wf_cont_f3_light; | |
515 | ring_node_cwf3_light.coarseTime = 0x00; |
|
515 | ring_node_cwf3_light.coarseTime = 0x00; | |
516 | ring_node_cwf3_light.fineTime = 0x00; |
|
516 | ring_node_cwf3_light.fineTime = 0x00; | |
517 | ring_node_cwf3_light.next = NULL; |
|
517 | ring_node_cwf3_light.next = NULL; | |
518 | ring_node_cwf3_light.previous = NULL; |
|
518 | ring_node_cwf3_light.previous = NULL; | |
519 | ring_node_cwf3_light.sid = SID_NORM_CWF_F3; |
|
519 | ring_node_cwf3_light.sid = SID_NORM_CWF_F3; | |
520 | ring_node_cwf3_light.status = 0x00; |
|
520 | ring_node_cwf3_light.status = 0x00; | |
521 |
|
521 | |||
522 | BOOT_PRINTF("in CWF3 ***\n") |
|
522 | BOOT_PRINTF("in CWF3 ***\n") | |
523 |
|
523 | |||
524 | while(1){ |
|
524 | while(1){ | |
525 | // wait for an RTEMS_EVENT |
|
525 | // wait for an RTEMS_EVENT | |
526 | rtems_event_receive( RTEMS_EVENT_0, |
|
526 | rtems_event_receive( RTEMS_EVENT_0, | |
527 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
527 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
528 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) |
|
528 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) | |
529 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode==LFR_MODE_SBM2) ) |
|
529 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode==LFR_MODE_SBM2) ) | |
530 | { |
|
530 | { | |
531 | if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01) |
|
531 | if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01) | |
532 | { |
|
532 | { | |
533 | PRINTF("send CWF_LONG_F3\n") |
|
533 | PRINTF("send CWF_LONG_F3\n") | |
534 | ring_node_to_send_cwf_f3->sid = SID_NORM_CWF_LONG_F3; |
|
534 | ring_node_to_send_cwf_f3->sid = SID_NORM_CWF_LONG_F3; | |
535 | status = rtems_message_queue_send( queue_id, &ring_node_to_send_cwf_f2, sizeof( ring_node* ) ); |
|
535 | status = rtems_message_queue_send( queue_id, &ring_node_to_send_cwf_f2, sizeof( ring_node* ) ); | |
536 | } |
|
536 | } | |
537 | else |
|
537 | else | |
538 | { |
|
538 | { | |
539 | PRINTF("send CWF_F3 (light)\n") |
|
539 | PRINTF("send CWF_F3 (light)\n") | |
540 | ring_node_to_send_cwf_f3->sid = SID_NORM_CWF_F3; |
|
540 | ring_node_to_send_cwf_f3->sid = SID_NORM_CWF_F3; | |
541 | send_waveform_CWF3_light( ring_node_to_send_cwf_f3, &ring_node_cwf3_light, queue_id ); |
|
541 | send_waveform_CWF3_light( ring_node_to_send_cwf_f3, &ring_node_cwf3_light, queue_id ); | |
542 | } |
|
542 | } | |
543 |
|
543 | |||
544 | } |
|
544 | } | |
545 | else |
|
545 | else | |
546 | { |
|
546 | { | |
547 | PRINTF1("in CWF3 *** lfrCurrentMode is %d, no data will be sent\n", lfrCurrentMode) |
|
547 | PRINTF1("in CWF3 *** lfrCurrentMode is %d, no data will be sent\n", lfrCurrentMode) | |
548 | } |
|
548 | } | |
549 | } |
|
549 | } | |
550 | } |
|
550 | } | |
551 |
|
551 | |||
552 | rtems_task cwf2_task(rtems_task_argument argument) // ONLY USED IN BURST AND SBM2 |
|
552 | rtems_task cwf2_task(rtems_task_argument argument) // ONLY USED IN BURST AND SBM2 | |
553 | { |
|
553 | { | |
554 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f2. |
|
554 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f2. | |
555 | * |
|
555 | * | |
556 | * @param unused is the starting argument of the RTEMS task |
|
556 | * @param unused is the starting argument of the RTEMS task | |
557 | * |
|
557 | * | |
558 | * The following data packet is sent by this function: |
|
558 | * The following data packet is sent by this function: | |
559 | * - TM_LFR_SCIENCE_BURST_CWF_F2 |
|
559 | * - TM_LFR_SCIENCE_BURST_CWF_F2 | |
560 | * - TM_LFR_SCIENCE_SBM2_CWF_F2 |
|
560 | * - TM_LFR_SCIENCE_SBM2_CWF_F2 | |
561 | * |
|
561 | * | |
562 | */ |
|
562 | */ | |
563 |
|
563 | |||
564 | rtems_event_set event_out; |
|
564 | rtems_event_set event_out; | |
565 | rtems_id queue_id; |
|
565 | rtems_id queue_id; | |
566 | rtems_status_code status; |
|
566 | rtems_status_code status; | |
567 |
|
567 | |||
568 | status = get_message_queue_id_send( &queue_id ); |
|
568 | status = get_message_queue_id_send( &queue_id ); | |
569 | if (status != RTEMS_SUCCESSFUL) |
|
569 | if (status != RTEMS_SUCCESSFUL) | |
570 | { |
|
570 | { | |
571 | PRINTF1("in CWF2 *** ERR get_message_queue_id_send %d\n", status) |
|
571 | PRINTF1("in CWF2 *** ERR get_message_queue_id_send %d\n", status) | |
572 | } |
|
572 | } | |
573 |
|
573 | |||
574 | BOOT_PRINTF("in CWF2 ***\n") |
|
574 | BOOT_PRINTF("in CWF2 ***\n") | |
575 |
|
575 | |||
576 | while(1){ |
|
576 | while(1){ | |
577 | // wait for an RTEMS_EVENT |
|
577 | // wait for an RTEMS_EVENT | |
578 | rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2, |
|
578 | rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2, | |
579 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
579 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
580 | if (event_out == RTEMS_EVENT_MODE_BURST) |
|
580 | if (event_out == RTEMS_EVENT_MODE_BURST) | |
581 | { |
|
581 | { | |
582 | // send_waveform_CWF( ring_node_to_send_cwf_f2, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id ); |
|
582 | // send_waveform_CWF( ring_node_to_send_cwf_f2, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id ); | |
583 | ring_node_to_send_cwf_f2->sid = SID_BURST_CWF_F2; |
|
583 | ring_node_to_send_cwf_f2->sid = SID_BURST_CWF_F2; | |
584 | status = rtems_message_queue_send( queue_id, &ring_node_to_send_cwf_f2, sizeof( ring_node* ) ); |
|
584 | status = rtems_message_queue_send( queue_id, &ring_node_to_send_cwf_f2, sizeof( ring_node* ) ); | |
585 | } |
|
585 | } | |
586 | if (event_out == RTEMS_EVENT_MODE_SBM2) |
|
586 | if (event_out == RTEMS_EVENT_MODE_SBM2) | |
587 | { |
|
587 | { | |
588 | // send_waveform_CWF( ring_node_to_send_cwf_f2, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id ); |
|
588 | // send_waveform_CWF( ring_node_to_send_cwf_f2, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id ); | |
589 | ring_node_to_send_cwf_f2->sid = SID_SBM2_CWF_F2; |
|
589 | ring_node_to_send_cwf_f2->sid = SID_SBM2_CWF_F2; | |
590 | status = rtems_message_queue_send( queue_id, &ring_node_to_send_cwf_f2, sizeof( ring_node* ) ); |
|
590 | status = rtems_message_queue_send( queue_id, &ring_node_to_send_cwf_f2, sizeof( ring_node* ) ); | |
591 | // launch snapshot extraction if needed |
|
591 | // launch snapshot extraction if needed | |
592 | if (extractSWF == true) |
|
592 | if (extractSWF == true) | |
593 | { |
|
593 | { | |
594 | ring_node_to_send_swf_f2 = ring_node_to_send_cwf_f2; |
|
594 | ring_node_to_send_swf_f2 = ring_node_to_send_cwf_f2; | |
595 | // extract the snapshot |
|
595 | // extract the snapshot | |
596 | build_snapshot_from_ring( ring_node_to_send_swf_f2, 2 ); |
|
596 | build_snapshot_from_ring( ring_node_to_send_swf_f2, 2 ); | |
597 | // send the snapshot when built |
|
597 | // send the snapshot when built | |
598 | status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 ); |
|
598 | status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 ); | |
599 | extractSWF = false; |
|
599 | extractSWF = false; | |
600 | } |
|
600 | } | |
601 | if (swf_f0_ready && swf_f1_ready) |
|
601 | if (swf_f0_ready && swf_f1_ready) | |
602 | { |
|
602 | { | |
603 | extractSWF = true; |
|
603 | extractSWF = true; | |
604 | swf_f0_ready = false; |
|
604 | swf_f0_ready = false; | |
605 | swf_f1_ready = false; |
|
605 | swf_f1_ready = false; | |
606 | } |
|
606 | } | |
607 | } |
|
607 | } | |
608 | } |
|
608 | } | |
609 | } |
|
609 | } | |
610 |
|
610 | |||
611 | rtems_task cwf1_task(rtems_task_argument argument) // ONLY USED IN SBM1 |
|
611 | rtems_task cwf1_task(rtems_task_argument argument) // ONLY USED IN SBM1 | |
612 | { |
|
612 | { | |
613 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f1. |
|
613 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f1. | |
614 | * |
|
614 | * | |
615 | * @param unused is the starting argument of the RTEMS task |
|
615 | * @param unused is the starting argument of the RTEMS task | |
616 | * |
|
616 | * | |
617 | * The following data packet is sent by this function: |
|
617 | * The following data packet is sent by this function: | |
618 | * - TM_LFR_SCIENCE_SBM1_CWF_F1 |
|
618 | * - TM_LFR_SCIENCE_SBM1_CWF_F1 | |
619 | * |
|
619 | * | |
620 | */ |
|
620 | */ | |
621 |
|
621 | |||
622 | rtems_event_set event_out; |
|
622 | rtems_event_set event_out; | |
623 | rtems_id queue_id; |
|
623 | rtems_id queue_id; | |
624 | rtems_status_code status; |
|
624 | rtems_status_code status; | |
625 |
|
625 | |||
626 | // init_header_continuous_wf_table( SID_SBM1_CWF_F1, headerCWF_F1 ); |
|
626 | // init_header_continuous_wf_table( SID_SBM1_CWF_F1, headerCWF_F1 ); | |
627 |
|
627 | |||
628 | status = get_message_queue_id_send( &queue_id ); |
|
628 | status = get_message_queue_id_send( &queue_id ); | |
629 | if (status != RTEMS_SUCCESSFUL) |
|
629 | if (status != RTEMS_SUCCESSFUL) | |
630 | { |
|
630 | { | |
631 | PRINTF1("in CWF1 *** ERR get_message_queue_id_send %d\n", status) |
|
631 | PRINTF1("in CWF1 *** ERR get_message_queue_id_send %d\n", status) | |
632 | } |
|
632 | } | |
633 |
|
633 | |||
634 | BOOT_PRINTF("in CWF1 ***\n") |
|
634 | BOOT_PRINTF("in CWF1 ***\n") | |
635 |
|
635 | |||
636 | while(1){ |
|
636 | while(1){ | |
637 | // wait for an RTEMS_EVENT |
|
637 | // wait for an RTEMS_EVENT | |
638 | rtems_event_receive( RTEMS_EVENT_MODE_SBM1, |
|
638 | rtems_event_receive( RTEMS_EVENT_MODE_SBM1, | |
639 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
639 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
640 | ring_node_to_send_cwf_f1->sid = SID_SBM1_CWF_F1; |
|
640 | ring_node_to_send_cwf_f1->sid = SID_SBM1_CWF_F1; | |
641 | status = rtems_message_queue_send( queue_id, &ring_node_to_send_cwf_f1, sizeof( ring_node* ) ); |
|
641 | status = rtems_message_queue_send( queue_id, &ring_node_to_send_cwf_f1, sizeof( ring_node* ) ); | |
642 | // launch snapshot extraction if needed |
|
642 | // launch snapshot extraction if needed | |
643 | if (extractSWF == true) |
|
643 | if (extractSWF == true) | |
644 | { |
|
644 | { | |
645 | ring_node_to_send_swf_f1 = ring_node_to_send_cwf_f1; |
|
645 | ring_node_to_send_swf_f1 = ring_node_to_send_cwf_f1; | |
646 | // launch the snapshot extraction |
|
646 | // launch the snapshot extraction | |
647 | status = rtems_event_send( Task_id[TASKID_SWBD], RTEMS_EVENT_MODE_SBM1 ); |
|
647 | status = rtems_event_send( Task_id[TASKID_SWBD], RTEMS_EVENT_MODE_SBM1 ); | |
648 | extractSWF = false; |
|
648 | extractSWF = false; | |
649 | } |
|
649 | } | |
650 | if (swf_f0_ready == true) |
|
650 | if (swf_f0_ready == true) | |
651 | { |
|
651 | { | |
652 | extractSWF = true; |
|
652 | extractSWF = true; | |
653 | swf_f0_ready = false; // this step shall be executed only one time |
|
653 | swf_f0_ready = false; // this step shall be executed only one time | |
654 | } |
|
654 | } | |
655 | if ((swf_f1_ready == true) && (swf_f2_ready == true)) // swf_f1 is ready after the extraction |
|
655 | if ((swf_f1_ready == true) && (swf_f2_ready == true)) // swf_f1 is ready after the extraction | |
656 | { |
|
656 | { | |
657 | status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM1 ); |
|
657 | status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM1 ); | |
658 | swf_f1_ready = false; |
|
658 | swf_f1_ready = false; | |
659 | swf_f2_ready = false; |
|
659 | swf_f2_ready = false; | |
660 | } |
|
660 | } | |
661 | } |
|
661 | } | |
662 | } |
|
662 | } | |
663 |
|
663 | |||
664 | rtems_task swbd_task(rtems_task_argument argument) |
|
664 | rtems_task swbd_task(rtems_task_argument argument) | |
665 | { |
|
665 | { | |
666 | /** This RTEMS task is dedicated to the building of snapshots from different continuous waveforms buffers. |
|
666 | /** This RTEMS task is dedicated to the building of snapshots from different continuous waveforms buffers. | |
667 | * |
|
667 | * | |
668 | * @param unused is the starting argument of the RTEMS task |
|
668 | * @param unused is the starting argument of the RTEMS task | |
669 | * |
|
669 | * | |
670 | */ |
|
670 | */ | |
671 |
|
671 | |||
672 | rtems_event_set event_out; |
|
672 | rtems_event_set event_out; | |
673 |
|
673 | |||
674 | BOOT_PRINTF("in SWBD ***\n") |
|
674 | BOOT_PRINTF("in SWBD ***\n") | |
675 |
|
675 | |||
676 | while(1){ |
|
676 | while(1){ | |
677 | // wait for an RTEMS_EVENT |
|
677 | // wait for an RTEMS_EVENT | |
678 | rtems_event_receive( RTEMS_EVENT_MODE_SBM1 | RTEMS_EVENT_MODE_SBM2, |
|
678 | rtems_event_receive( RTEMS_EVENT_MODE_SBM1 | RTEMS_EVENT_MODE_SBM2, | |
679 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
679 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
680 | if (event_out == RTEMS_EVENT_MODE_SBM1) |
|
680 | if (event_out == RTEMS_EVENT_MODE_SBM1) | |
681 | { |
|
681 | { | |
682 | build_snapshot_from_ring( ring_node_to_send_swf_f1, 1 ); |
|
682 | build_snapshot_from_ring( ring_node_to_send_swf_f1, 1 ); | |
683 | swf_f1_ready = true; // the snapshot has been extracted and is ready to be sent |
|
683 | swf_f1_ready = true; // the snapshot has been extracted and is ready to be sent | |
684 | } |
|
684 | } | |
685 | else |
|
685 | else | |
686 | { |
|
686 | { | |
687 | PRINTF1("in SWBD *** unexpected rtems event received %x\n", (int) event_out) |
|
687 | PRINTF1("in SWBD *** unexpected rtems event received %x\n", (int) event_out) | |
688 | } |
|
688 | } | |
689 | } |
|
689 | } | |
690 | } |
|
690 | } | |
691 |
|
691 | |||
692 | //****************** |
|
692 | //****************** | |
693 | // general functions |
|
693 | // general functions | |
694 |
|
694 | |||
695 | void WFP_init_rings( void ) |
|
695 | void WFP_init_rings( void ) | |
696 | { |
|
696 | { | |
697 | // F0 RING |
|
697 | // F0 RING | |
698 | init_ring( waveform_ring_f0, NB_RING_NODES_F0, wf_buffer_f0, WFRM_BUFFER ); |
|
698 | init_ring( waveform_ring_f0, NB_RING_NODES_F0, wf_buffer_f0, WFRM_BUFFER ); | |
699 | // F1 RING |
|
699 | // F1 RING | |
700 | init_ring( waveform_ring_f1, NB_RING_NODES_F1, wf_buffer_f1, WFRM_BUFFER ); |
|
700 | init_ring( waveform_ring_f1, NB_RING_NODES_F1, wf_buffer_f1, WFRM_BUFFER ); | |
701 | // F2 RING |
|
701 | // F2 RING | |
702 | init_ring( waveform_ring_f2, NB_RING_NODES_F2, wf_buffer_f2, WFRM_BUFFER ); |
|
702 | init_ring( waveform_ring_f2, NB_RING_NODES_F2, wf_buffer_f2, WFRM_BUFFER ); | |
703 | // F3 RING |
|
703 | // F3 RING | |
704 | init_ring( waveform_ring_f3, NB_RING_NODES_F3, wf_buffer_f3, WFRM_BUFFER ); |
|
704 | init_ring( waveform_ring_f3, NB_RING_NODES_F3, wf_buffer_f3, WFRM_BUFFER ); | |
705 |
|
705 | |||
706 | ring_node_wf_snap_extracted.buffer_address = (int) wf_snap_extracted; |
|
706 | ring_node_wf_snap_extracted.buffer_address = (int) wf_snap_extracted; | |
707 |
|
707 | |||
708 | DEBUG_PRINTF1("waveform_ring_f0 @%x\n", (unsigned int) waveform_ring_f0) |
|
708 | DEBUG_PRINTF1("waveform_ring_f0 @%x\n", (unsigned int) waveform_ring_f0) | |
709 | DEBUG_PRINTF1("waveform_ring_f1 @%x\n", (unsigned int) waveform_ring_f1) |
|
709 | DEBUG_PRINTF1("waveform_ring_f1 @%x\n", (unsigned int) waveform_ring_f1) | |
710 | DEBUG_PRINTF1("waveform_ring_f2 @%x\n", (unsigned int) waveform_ring_f2) |
|
710 | DEBUG_PRINTF1("waveform_ring_f2 @%x\n", (unsigned int) waveform_ring_f2) | |
711 | DEBUG_PRINTF1("waveform_ring_f3 @%x\n", (unsigned int) waveform_ring_f3) |
|
711 | DEBUG_PRINTF1("waveform_ring_f3 @%x\n", (unsigned int) waveform_ring_f3) | |
712 | DEBUG_PRINTF1("wf_buffer_f0 @%x\n", (unsigned int) wf_buffer_f0) |
|
712 | DEBUG_PRINTF1("wf_buffer_f0 @%x\n", (unsigned int) wf_buffer_f0) | |
713 | DEBUG_PRINTF1("wf_buffer_f1 @%x\n", (unsigned int) wf_buffer_f1) |
|
713 | DEBUG_PRINTF1("wf_buffer_f1 @%x\n", (unsigned int) wf_buffer_f1) | |
714 | DEBUG_PRINTF1("wf_buffer_f2 @%x\n", (unsigned int) wf_buffer_f2) |
|
714 | DEBUG_PRINTF1("wf_buffer_f2 @%x\n", (unsigned int) wf_buffer_f2) | |
715 | DEBUG_PRINTF1("wf_buffer_f3 @%x\n", (unsigned int) wf_buffer_f3) |
|
715 | DEBUG_PRINTF1("wf_buffer_f3 @%x\n", (unsigned int) wf_buffer_f3) | |
716 |
|
716 | |||
717 | } |
|
717 | } | |
718 |
|
718 | |||
719 | void init_ring(ring_node ring[], unsigned char nbNodes, volatile int buffer[], unsigned int bufferSize ) |
|
719 | void init_ring(ring_node ring[], unsigned char nbNodes, volatile int buffer[], unsigned int bufferSize ) | |
720 | { |
|
720 | { | |
721 | unsigned char i; |
|
721 | unsigned char i; | |
722 |
|
722 | |||
723 | //*************** |
|
723 | //*************** | |
724 | // BUFFER ADDRESS |
|
724 | // BUFFER ADDRESS | |
725 | for(i=0; i<nbNodes; i++) |
|
725 | for(i=0; i<nbNodes; i++) | |
726 | { |
|
726 | { | |
727 | ring[i].coarseTime = 0x00; |
|
727 | ring[i].coarseTime = 0x00; | |
728 | ring[i].fineTime = 0x00; |
|
728 | ring[i].fineTime = 0x00; | |
729 | ring[i].sid = 0x00; |
|
729 | ring[i].sid = 0x00; | |
730 | ring[i].status = 0x00; |
|
730 | ring[i].status = 0x00; | |
731 | ring[i].buffer_address = (int) &buffer[ i * bufferSize ]; |
|
731 | ring[i].buffer_address = (int) &buffer[ i * bufferSize ]; | |
732 | } |
|
732 | } | |
733 |
|
733 | |||
734 | //***** |
|
734 | //***** | |
735 | // NEXT |
|
735 | // NEXT | |
736 | ring[nbNodes-1].next = (ring_node*) &ring[ 0 ]; |
|
736 | ring[nbNodes-1].next = (ring_node*) &ring[ 0 ]; | |
737 | for(i=0; i<nbNodes-1; i++) |
|
737 | for(i=0; i<nbNodes-1; i++) | |
738 | { |
|
738 | { | |
739 | ring[i].next = (ring_node*) &ring[ i + 1 ]; |
|
739 | ring[i].next = (ring_node*) &ring[ i + 1 ]; | |
740 | } |
|
740 | } | |
741 |
|
741 | |||
742 | //********* |
|
742 | //********* | |
743 | // PREVIOUS |
|
743 | // PREVIOUS | |
744 | ring[0].previous = (ring_node*) &ring[ nbNodes - 1 ]; |
|
744 | ring[0].previous = (ring_node*) &ring[ nbNodes - 1 ]; | |
745 | for(i=1; i<nbNodes; i++) |
|
745 | for(i=1; i<nbNodes; i++) | |
746 | { |
|
746 | { | |
747 | ring[i].previous = (ring_node*) &ring[ i - 1 ]; |
|
747 | ring[i].previous = (ring_node*) &ring[ i - 1 ]; | |
748 | } |
|
748 | } | |
749 | } |
|
749 | } | |
750 |
|
750 | |||
751 | void WFP_reset_current_ring_nodes( void ) |
|
751 | void WFP_reset_current_ring_nodes( void ) | |
752 | { |
|
752 | { | |
753 | current_ring_node_f0 = waveform_ring_f0; |
|
753 | current_ring_node_f0 = waveform_ring_f0; | |
754 | ring_node_to_send_swf_f0 = waveform_ring_f0; |
|
754 | ring_node_to_send_swf_f0 = waveform_ring_f0; | |
755 |
|
755 | |||
756 | current_ring_node_f1 = waveform_ring_f1; |
|
756 | current_ring_node_f1 = waveform_ring_f1; | |
757 | ring_node_to_send_cwf_f1 = waveform_ring_f1; |
|
757 | ring_node_to_send_cwf_f1 = waveform_ring_f1; | |
758 | ring_node_to_send_swf_f1 = waveform_ring_f1; |
|
758 | ring_node_to_send_swf_f1 = waveform_ring_f1; | |
759 |
|
759 | |||
760 | current_ring_node_f2 = waveform_ring_f2; |
|
760 | current_ring_node_f2 = waveform_ring_f2; | |
761 | ring_node_to_send_cwf_f2 = waveform_ring_f2; |
|
761 | ring_node_to_send_cwf_f2 = waveform_ring_f2; | |
762 | ring_node_to_send_swf_f2 = waveform_ring_f2; |
|
762 | ring_node_to_send_swf_f2 = waveform_ring_f2; | |
763 |
|
763 | |||
764 | current_ring_node_f3 = waveform_ring_f3; |
|
764 | current_ring_node_f3 = waveform_ring_f3; | |
765 | ring_node_to_send_cwf_f3 = waveform_ring_f3; |
|
765 | ring_node_to_send_cwf_f3 = waveform_ring_f3; | |
766 | } |
|
766 | } | |
767 |
|
767 | |||
768 | int send_waveform_CWF3_light( ring_node *ring_node_to_send, ring_node *ring_node_cwf3_light, rtems_id queue_id ) |
|
768 | int send_waveform_CWF3_light( ring_node *ring_node_to_send, ring_node *ring_node_cwf3_light, rtems_id queue_id ) | |
769 | { |
|
769 | { | |
770 | /** This function sends CWF_F3 CCSDS packets without the b1, b2 and b3 data. |
|
770 | /** This function sends CWF_F3 CCSDS packets without the b1, b2 and b3 data. | |
771 | * |
|
771 | * | |
772 | * @param waveform points to the buffer containing the data that will be send. |
|
772 | * @param waveform points to the buffer containing the data that will be send. | |
773 | * @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. | |
774 | * @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 | |
775 | * contain information to setup the transmission of the data packets. |
|
775 | * contain information to setup the transmission of the data packets. | |
776 | * |
|
776 | * | |
777 | * By default, CWF_F3 packet are send without the b1, b2 and b3 data. This function rebuilds a data buffer |
|
777 | * By default, CWF_F3 packet are send without the b1, b2 and b3 data. This function rebuilds a data buffer | |
778 | * from the incoming data and sends it in 7 packets, 6 containing 340 blocks and 1 one containing 8 blocks. |
|
778 | * from the incoming data and sends it in 7 packets, 6 containing 340 blocks and 1 one containing 8 blocks. | |
779 | * |
|
779 | * | |
780 | */ |
|
780 | */ | |
781 |
|
781 | |||
782 | unsigned int i; |
|
782 | unsigned int i; | |
783 | int ret; |
|
783 | int ret; | |
784 | rtems_status_code status; |
|
784 | rtems_status_code status; | |
785 | spw_ioctl_pkt_send spw_ioctl_send_CWF; |
|
785 | spw_ioctl_pkt_send spw_ioctl_send_CWF; | |
786 | char *sample; |
|
786 | char *sample; | |
787 | int *dataPtr; |
|
787 | int *dataPtr; | |
788 |
|
788 | |||
789 | spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header |
|
789 | spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header | |
790 | spw_ioctl_send_CWF.options = 0; |
|
790 | spw_ioctl_send_CWF.options = 0; | |
791 |
|
791 | |||
792 | ret = LFR_DEFAULT; |
|
792 | ret = LFR_DEFAULT; | |
793 |
|
793 | |||
794 | dataPtr = (int*) ring_node_to_send->buffer_address; |
|
794 | dataPtr = (int*) ring_node_to_send->buffer_address; | |
795 |
|
795 | |||
796 | ring_node_cwf3_light->coarseTime = ring_node_to_send->coarseTime; |
|
796 | ring_node_cwf3_light->coarseTime = ring_node_to_send->coarseTime; | |
797 | ring_node_cwf3_light->fineTime = ring_node_to_send->fineTime; |
|
797 | ring_node_cwf3_light->fineTime = ring_node_to_send->fineTime; | |
798 |
|
798 | |||
799 | //********************** |
|
799 | //********************** | |
800 | // BUILD CWF3_light DATA |
|
800 | // BUILD CWF3_light DATA | |
801 | for ( i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++) |
|
801 | for ( i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++) | |
802 | { |
|
802 | { | |
803 | sample = (char*) &dataPtr[ (i * NB_WORDS_SWF_BLK) ]; |
|
803 | sample = (char*) &dataPtr[ (i * NB_WORDS_SWF_BLK) ]; | |
804 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) ] = sample[ 0 ]; |
|
804 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) ] = sample[ 0 ]; | |
805 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 ] = sample[ 1 ]; |
|
805 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 ] = sample[ 1 ]; | |
806 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 ] = sample[ 2 ]; |
|
806 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 ] = sample[ 2 ]; | |
807 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 ] = sample[ 3 ]; |
|
807 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 ] = sample[ 3 ]; | |
808 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 ] = sample[ 4 ]; |
|
808 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 ] = sample[ 4 ]; | |
809 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 ] = sample[ 5 ]; |
|
809 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 ] = sample[ 5 ]; | |
810 | } |
|
810 | } | |
811 |
|
811 | |||
812 | // SEND PACKET |
|
812 | // SEND PACKET | |
813 | status = rtems_message_queue_send( queue_id, &ring_node_cwf3_light, sizeof( ring_node* ) ); |
|
813 | status = rtems_message_queue_send( queue_id, &ring_node_cwf3_light, sizeof( ring_node* ) ); | |
814 | if (status != RTEMS_SUCCESSFUL) { |
|
814 | if (status != RTEMS_SUCCESSFUL) { | |
815 | printf("%d-%d, ERR %d\n", SID_NORM_CWF_F3, i, (int) status); |
|
815 | printf("%d-%d, ERR %d\n", SID_NORM_CWF_F3, i, (int) status); | |
816 | ret = LFR_DEFAULT; |
|
816 | ret = LFR_DEFAULT; | |
817 | } |
|
817 | } | |
818 |
|
818 | |||
819 | return ret; |
|
819 | return ret; | |
820 | } |
|
820 | } | |
821 |
|
821 | |||
822 | void compute_acquisition_time( unsigned int coarseTime, unsigned int fineTime, |
|
822 | void compute_acquisition_time( unsigned int coarseTime, unsigned int fineTime, | |
823 | unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char * acquisitionTime ) |
|
823 | unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char * acquisitionTime ) | |
824 | { |
|
824 | { | |
825 | unsigned long long int acquisitionTimeAsLong; |
|
825 | unsigned long long int acquisitionTimeAsLong; | |
826 | unsigned char localAcquisitionTime[6]; |
|
826 | unsigned char localAcquisitionTime[6]; | |
827 | double deltaT; |
|
827 | double deltaT; | |
828 |
|
828 | |||
829 | deltaT = 0.; |
|
829 | deltaT = 0.; | |
830 |
|
830 | |||
831 | localAcquisitionTime[0] = (unsigned char) ( coarseTime >> 24 ); |
|
831 | localAcquisitionTime[0] = (unsigned char) ( coarseTime >> 24 ); | |
832 | localAcquisitionTime[1] = (unsigned char) ( coarseTime >> 16 ); |
|
832 | localAcquisitionTime[1] = (unsigned char) ( coarseTime >> 16 ); | |
833 | localAcquisitionTime[2] = (unsigned char) ( coarseTime >> 8 ); |
|
833 | localAcquisitionTime[2] = (unsigned char) ( coarseTime >> 8 ); | |
834 | localAcquisitionTime[3] = (unsigned char) ( coarseTime ); |
|
834 | localAcquisitionTime[3] = (unsigned char) ( coarseTime ); | |
835 | localAcquisitionTime[4] = (unsigned char) ( fineTime >> 8 ); |
|
835 | localAcquisitionTime[4] = (unsigned char) ( fineTime >> 8 ); | |
836 | localAcquisitionTime[5] = (unsigned char) ( fineTime ); |
|
836 | localAcquisitionTime[5] = (unsigned char) ( fineTime ); | |
837 |
|
837 | |||
838 | acquisitionTimeAsLong = ( (unsigned long long int) localAcquisitionTime[0] << 40 ) |
|
838 | acquisitionTimeAsLong = ( (unsigned long long int) localAcquisitionTime[0] << 40 ) | |
839 | + ( (unsigned long long int) localAcquisitionTime[1] << 32 ) |
|
839 | + ( (unsigned long long int) localAcquisitionTime[1] << 32 ) | |
840 | + ( (unsigned long long int) localAcquisitionTime[2] << 24 ) |
|
840 | + ( (unsigned long long int) localAcquisitionTime[2] << 24 ) | |
841 | + ( (unsigned long long int) localAcquisitionTime[3] << 16 ) |
|
841 | + ( (unsigned long long int) localAcquisitionTime[3] << 16 ) | |
842 | + ( (unsigned long long int) localAcquisitionTime[4] << 8 ) |
|
842 | + ( (unsigned long long int) localAcquisitionTime[4] << 8 ) | |
843 | + ( (unsigned long long int) localAcquisitionTime[5] ); |
|
843 | + ( (unsigned long long int) localAcquisitionTime[5] ); | |
844 |
|
844 | |||
845 | switch( sid ) |
|
845 | switch( sid ) | |
846 | { |
|
846 | { | |
847 | case SID_NORM_SWF_F0: |
|
847 | case SID_NORM_SWF_F0: | |
848 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 24576. ; |
|
848 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 24576. ; | |
849 | break; |
|
849 | break; | |
850 |
|
850 | |||
851 | case SID_NORM_SWF_F1: |
|
851 | case SID_NORM_SWF_F1: | |
852 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 4096. ; |
|
852 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 4096. ; | |
853 | break; |
|
853 | break; | |
854 |
|
854 | |||
855 | case SID_NORM_SWF_F2: |
|
855 | case SID_NORM_SWF_F2: | |
856 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 256. ; |
|
856 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 256. ; | |
857 | break; |
|
857 | break; | |
858 |
|
858 | |||
859 | case SID_SBM1_CWF_F1: |
|
859 | case SID_SBM1_CWF_F1: | |
860 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 4096. ; |
|
860 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 4096. ; | |
861 | break; |
|
861 | break; | |
862 |
|
862 | |||
863 | case SID_SBM2_CWF_F2: |
|
863 | case SID_SBM2_CWF_F2: | |
864 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ; |
|
864 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ; | |
865 | break; |
|
865 | break; | |
866 |
|
866 | |||
867 | case SID_BURST_CWF_F2: |
|
867 | case SID_BURST_CWF_F2: | |
868 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ; |
|
868 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ; | |
869 | break; |
|
869 | break; | |
870 |
|
870 | |||
871 | case SID_NORM_CWF_F3: |
|
871 | case SID_NORM_CWF_F3: | |
872 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF_SHORT_F3 * 65536. / 16. ; |
|
872 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF_SHORT_F3 * 65536. / 16. ; | |
873 | break; |
|
873 | break; | |
874 |
|
874 | |||
875 | case SID_NORM_CWF_LONG_F3: |
|
875 | case SID_NORM_CWF_LONG_F3: | |
876 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 16. ; |
|
876 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 16. ; | |
877 | break; |
|
877 | break; | |
878 |
|
878 | |||
879 | default: |
|
879 | default: | |
880 | PRINTF1("in compute_acquisition_time *** ERR unexpected sid %d\n", sid) |
|
880 | PRINTF1("in compute_acquisition_time *** ERR unexpected sid %d\n", sid) | |
881 | deltaT = 0.; |
|
881 | deltaT = 0.; | |
882 | break; |
|
882 | break; | |
883 | } |
|
883 | } | |
884 |
|
884 | |||
885 | acquisitionTimeAsLong = acquisitionTimeAsLong + (unsigned long long int) deltaT; |
|
885 | acquisitionTimeAsLong = acquisitionTimeAsLong + (unsigned long long int) deltaT; | |
886 | // |
|
886 | // | |
887 | acquisitionTime[0] = (unsigned char) (acquisitionTimeAsLong >> 40); |
|
887 | acquisitionTime[0] = (unsigned char) (acquisitionTimeAsLong >> 40); | |
888 | acquisitionTime[1] = (unsigned char) (acquisitionTimeAsLong >> 32); |
|
888 | acquisitionTime[1] = (unsigned char) (acquisitionTimeAsLong >> 32); | |
889 | acquisitionTime[2] = (unsigned char) (acquisitionTimeAsLong >> 24); |
|
889 | acquisitionTime[2] = (unsigned char) (acquisitionTimeAsLong >> 24); | |
890 | acquisitionTime[3] = (unsigned char) (acquisitionTimeAsLong >> 16); |
|
890 | acquisitionTime[3] = (unsigned char) (acquisitionTimeAsLong >> 16); | |
891 | acquisitionTime[4] = (unsigned char) (acquisitionTimeAsLong >> 8 ); |
|
891 | acquisitionTime[4] = (unsigned char) (acquisitionTimeAsLong >> 8 ); | |
892 | acquisitionTime[5] = (unsigned char) (acquisitionTimeAsLong ); |
|
892 | acquisitionTime[5] = (unsigned char) (acquisitionTimeAsLong ); | |
893 |
|
893 | |||
894 | } |
|
894 | } | |
895 |
|
895 | |||
896 | void build_snapshot_from_ring( ring_node *ring_node_to_send, unsigned char frequencyChannel ) |
|
896 | void build_snapshot_from_ring( ring_node *ring_node_to_send, unsigned char frequencyChannel ) | |
897 | { |
|
897 | { | |
898 | unsigned int i; |
|
898 | unsigned int i; | |
899 | unsigned long long int centerTime_asLong; |
|
899 | unsigned long long int centerTime_asLong; | |
900 | unsigned long long int acquisitionTimeF0_asLong; |
|
900 | unsigned long long int acquisitionTimeF0_asLong; | |
901 | unsigned long long int acquisitionTime_asLong; |
|
901 | unsigned long long int acquisitionTime_asLong; | |
902 | unsigned long long int bufferAcquisitionTime_asLong; |
|
902 | unsigned long long int bufferAcquisitionTime_asLong; | |
903 | unsigned char *ptr1; |
|
903 | unsigned char *ptr1; | |
904 | unsigned char *ptr2; |
|
904 | unsigned char *ptr2; | |
905 | unsigned char *timeCharPtr; |
|
905 | unsigned char *timeCharPtr; | |
906 | unsigned char nb_ring_nodes; |
|
906 | unsigned char nb_ring_nodes; | |
907 | unsigned long long int frequency_asLong; |
|
907 | unsigned long long int frequency_asLong; | |
908 | unsigned long long int nbTicksPerSample_asLong; |
|
908 | unsigned long long int nbTicksPerSample_asLong; | |
909 | unsigned long long int nbSamplesPart1_asLong; |
|
909 | unsigned long long int nbSamplesPart1_asLong; | |
910 | unsigned long long int sampleOffset_asLong; |
|
910 | unsigned long long int sampleOffset_asLong; | |
911 |
|
911 | |||
912 | unsigned int deltaT_F0; |
|
912 | unsigned int deltaT_F0; | |
913 | unsigned int deltaT_F1; |
|
913 | unsigned int deltaT_F1; | |
914 | unsigned long long int deltaT_F2; |
|
914 | unsigned long long int deltaT_F2; | |
915 |
|
915 | |||
916 | deltaT_F0 = 2731; // (2048. / 24576. / 2.) * 65536. = 2730.667; |
|
916 | deltaT_F0 = 2731; // (2048. / 24576. / 2.) * 65536. = 2730.667; | |
917 | deltaT_F1 = 16384; // (2048. / 4096. / 2.) * 65536. = 16384; |
|
917 | deltaT_F1 = 16384; // (2048. / 4096. / 2.) * 65536. = 16384; | |
918 | deltaT_F2 = 262144; // (2048. / 256. / 2.) * 65536. = 262144; |
|
918 | deltaT_F2 = 262144; // (2048. / 256. / 2.) * 65536. = 262144; | |
919 | sampleOffset_asLong = 0x00; |
|
919 | sampleOffset_asLong = 0x00; | |
920 |
|
920 | |||
921 | // (1) get the f0 acquisition time |
|
921 | // (1) get the f0 acquisition time | |
922 | acquisitionTimeF0_asLong = get_acquisition_time( (unsigned char *) &ring_node_to_send->coarseTime ); |
|
922 | acquisitionTimeF0_asLong = get_acquisition_time( (unsigned char *) &ring_node_to_send->coarseTime ); | |
923 |
|
923 | |||
924 | // (2) compute the central reference time |
|
924 | // (2) compute the central reference time | |
925 | centerTime_asLong = acquisitionTimeF0_asLong + deltaT_F0; |
|
925 | centerTime_asLong = acquisitionTimeF0_asLong + deltaT_F0; | |
926 |
|
926 | |||
927 | // (3) compute the acquisition time of the current snapshot |
|
927 | // (3) compute the acquisition time of the current snapshot | |
928 | switch(frequencyChannel) |
|
928 | switch(frequencyChannel) | |
929 | { |
|
929 | { | |
930 | case 1: // 1 is for F1 = 4096 Hz |
|
930 | case 1: // 1 is for F1 = 4096 Hz | |
931 | acquisitionTime_asLong = centerTime_asLong - deltaT_F1; |
|
931 | acquisitionTime_asLong = centerTime_asLong - deltaT_F1; | |
932 | nb_ring_nodes = NB_RING_NODES_F1; |
|
932 | nb_ring_nodes = NB_RING_NODES_F1; | |
933 | frequency_asLong = 4096; |
|
933 | frequency_asLong = 4096; | |
934 | nbTicksPerSample_asLong = 16; // 65536 / 4096; |
|
934 | nbTicksPerSample_asLong = 16; // 65536 / 4096; | |
935 | break; |
|
935 | break; | |
936 | case 2: // 2 is for F2 = 256 Hz |
|
936 | case 2: // 2 is for F2 = 256 Hz | |
937 | acquisitionTime_asLong = centerTime_asLong - deltaT_F2; |
|
937 | acquisitionTime_asLong = centerTime_asLong - deltaT_F2; | |
938 | nb_ring_nodes = NB_RING_NODES_F2; |
|
938 | nb_ring_nodes = NB_RING_NODES_F2; | |
939 | frequency_asLong = 256; |
|
939 | frequency_asLong = 256; | |
940 | nbTicksPerSample_asLong = 256; // 65536 / 256; |
|
940 | nbTicksPerSample_asLong = 256; // 65536 / 256; | |
941 | break; |
|
941 | break; | |
942 | default: |
|
942 | default: | |
943 | acquisitionTime_asLong = centerTime_asLong; |
|
943 | acquisitionTime_asLong = centerTime_asLong; | |
944 | frequency_asLong = 256; |
|
944 | frequency_asLong = 256; | |
945 | nbTicksPerSample_asLong = 256; |
|
945 | nbTicksPerSample_asLong = 256; | |
946 | break; |
|
946 | break; | |
947 | } |
|
947 | } | |
948 |
|
948 | |||
949 | //**************************************************************************** |
|
949 | //**************************************************************************** | |
950 | // (4) search the ring_node with the acquisition time <= acquisitionTime_asLong |
|
950 | // (4) search the ring_node with the acquisition time <= acquisitionTime_asLong | |
951 | for (i=0; i<nb_ring_nodes; i++) |
|
951 | for (i=0; i<nb_ring_nodes; i++) | |
952 | { |
|
952 | { | |
953 | PRINTF1("%d ... ", i) |
|
953 | PRINTF1("%d ... ", i) | |
954 | bufferAcquisitionTime_asLong = get_acquisition_time( (unsigned char *) ring_node_to_send->coarseTime ); |
|
954 | bufferAcquisitionTime_asLong = get_acquisition_time( (unsigned char *) ring_node_to_send->coarseTime ); | |
955 | if (bufferAcquisitionTime_asLong <= acquisitionTime_asLong) |
|
955 | if (bufferAcquisitionTime_asLong <= acquisitionTime_asLong) | |
956 | { |
|
956 | { | |
957 | PRINTF1("buffer found with acquisition time = %llx\n", bufferAcquisitionTime_asLong) |
|
957 | PRINTF1("buffer found with acquisition time = %llx\n", bufferAcquisitionTime_asLong) | |
958 | break; |
|
958 | break; | |
959 | } |
|
959 | } | |
960 | ring_node_to_send = ring_node_to_send->previous; |
|
960 | ring_node_to_send = ring_node_to_send->previous; | |
961 | } |
|
961 | } | |
962 |
|
962 | |||
963 | // (5) compute the number of samples to take in the current buffer |
|
963 | // (5) compute the number of samples to take in the current buffer | |
964 | sampleOffset_asLong = ((acquisitionTime_asLong - bufferAcquisitionTime_asLong) * frequency_asLong ) >> 16; |
|
964 | sampleOffset_asLong = ((acquisitionTime_asLong - bufferAcquisitionTime_asLong) * frequency_asLong ) >> 16; | |
965 | nbSamplesPart1_asLong = NB_SAMPLES_PER_SNAPSHOT - sampleOffset_asLong; |
|
965 | nbSamplesPart1_asLong = NB_SAMPLES_PER_SNAPSHOT - sampleOffset_asLong; | |
966 | PRINTF2("sampleOffset_asLong = %llx, nbSamplesPart1_asLong = %llx\n", sampleOffset_asLong, nbSamplesPart1_asLong) |
|
966 | PRINTF2("sampleOffset_asLong = %llx, nbSamplesPart1_asLong = %llx\n", sampleOffset_asLong, nbSamplesPart1_asLong) | |
967 |
|
967 | |||
968 | // (6) compute the final acquisition time |
|
968 | // (6) compute the final acquisition time | |
969 | acquisitionTime_asLong = bufferAcquisitionTime_asLong + |
|
969 | acquisitionTime_asLong = bufferAcquisitionTime_asLong + | |
970 | sampleOffset_asLong * nbTicksPerSample_asLong; |
|
970 | sampleOffset_asLong * nbTicksPerSample_asLong; | |
971 |
|
971 | |||
972 | // (7) copy the acquisition time at the beginning of the extrated snapshot |
|
972 | // (7) copy the acquisition time at the beginning of the extrated snapshot | |
973 | ptr1 = (unsigned char*) &acquisitionTime_asLong; |
|
973 | ptr1 = (unsigned char*) &acquisitionTime_asLong; | |
974 | // fine time |
|
974 | // fine time | |
975 | ptr2 = (unsigned char*) &ring_node_wf_snap_extracted.fineTime; |
|
975 | ptr2 = (unsigned char*) &ring_node_wf_snap_extracted.fineTime; | |
976 | ptr2[2] = ptr1[ 4 + 2 ]; |
|
976 | ptr2[2] = ptr1[ 4 + 2 ]; | |
977 | ptr2[3] = ptr1[ 5 + 2 ]; |
|
977 | ptr2[3] = ptr1[ 5 + 2 ]; | |
978 | // coarse time |
|
978 | // coarse time | |
979 | ptr2 = (unsigned char*) &ring_node_wf_snap_extracted.coarseTime; |
|
979 | ptr2 = (unsigned char*) &ring_node_wf_snap_extracted.coarseTime; | |
980 | ptr2[0] = ptr1[ 0 + 2 ]; |
|
980 | ptr2[0] = ptr1[ 0 + 2 ]; | |
981 | ptr2[1] = ptr1[ 1 + 2 ]; |
|
981 | ptr2[1] = ptr1[ 1 + 2 ]; | |
982 | ptr2[2] = ptr1[ 2 + 2 ]; |
|
982 | ptr2[2] = ptr1[ 2 + 2 ]; | |
983 | ptr2[3] = ptr1[ 3 + 2 ]; |
|
983 | ptr2[3] = ptr1[ 3 + 2 ]; | |
984 |
|
984 | |||
985 | // re set the synchronization bit |
|
985 | // re set the synchronization bit | |
986 | timeCharPtr = (unsigned char*) &ring_node_to_send->coarseTime; |
|
986 | timeCharPtr = (unsigned char*) &ring_node_to_send->coarseTime; | |
987 | ptr2[0] = ptr2[0] | (timeCharPtr[0] & 0x80); // [1000 0000] |
|
987 | ptr2[0] = ptr2[0] | (timeCharPtr[0] & 0x80); // [1000 0000] | |
988 |
|
988 | |||
989 | if ( (nbSamplesPart1_asLong >= NB_SAMPLES_PER_SNAPSHOT) | (nbSamplesPart1_asLong < 0) ) |
|
989 | if ( (nbSamplesPart1_asLong >= NB_SAMPLES_PER_SNAPSHOT) | (nbSamplesPart1_asLong < 0) ) | |
990 | { |
|
990 | { | |
991 | nbSamplesPart1_asLong = 0; |
|
991 | nbSamplesPart1_asLong = 0; | |
992 | } |
|
992 | } | |
993 | // copy the part 1 of the snapshot in the extracted buffer |
|
993 | // copy the part 1 of the snapshot in the extracted buffer | |
994 | for ( i = 0; i < (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i++ ) |
|
994 | for ( i = 0; i < (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i++ ) | |
995 | { |
|
995 | { | |
996 | wf_snap_extracted[i] = |
|
996 | wf_snap_extracted[i] = | |
997 | ((int*) ring_node_to_send->buffer_address)[ i + (sampleOffset_asLong * NB_WORDS_SWF_BLK) ]; |
|
997 | ((int*) ring_node_to_send->buffer_address)[ i + (sampleOffset_asLong * NB_WORDS_SWF_BLK) ]; | |
998 | } |
|
998 | } | |
999 | // copy the part 2 of the snapshot in the extracted buffer |
|
999 | // copy the part 2 of the snapshot in the extracted buffer | |
1000 | ring_node_to_send = ring_node_to_send->next; |
|
1000 | ring_node_to_send = ring_node_to_send->next; | |
1001 | for ( i = (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i < (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK); i++ ) |
|
1001 | for ( i = (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i < (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK); i++ ) | |
1002 | { |
|
1002 | { | |
1003 | wf_snap_extracted[i] = |
|
1003 | wf_snap_extracted[i] = | |
1004 | ((int*) ring_node_to_send->buffer_address)[ (i-(nbSamplesPart1_asLong * NB_WORDS_SWF_BLK)) ]; |
|
1004 | ((int*) ring_node_to_send->buffer_address)[ (i-(nbSamplesPart1_asLong * NB_WORDS_SWF_BLK)) ]; | |
1005 | } |
|
1005 | } | |
1006 | } |
|
1006 | } | |
1007 |
|
1007 | |||
1008 | void snapshot_resynchronization( unsigned char *timePtr ) |
|
1008 | void snapshot_resynchronization( unsigned char *timePtr ) | |
1009 | { |
|
1009 | { | |
1010 | unsigned long long int acquisitionTime; |
|
1010 | unsigned long long int acquisitionTime; | |
1011 | unsigned long long int centerTime; |
|
1011 | unsigned long long int centerTime; | |
1012 | unsigned long long int previousTick; |
|
1012 | unsigned long long int previousTick; | |
1013 | unsigned long long int nextTick; |
|
1013 | unsigned long long int nextTick; | |
1014 | unsigned long long int deltaPreviousTick; |
|
1014 | unsigned long long int deltaPreviousTick; | |
1015 | unsigned long long int deltaNextTick; |
|
1015 | unsigned long long int deltaNextTick; | |
1016 | unsigned int deltaTickInF2; |
|
1016 | unsigned int deltaTickInF2; | |
1017 | double deltaPrevious; |
|
1017 | double deltaPrevious; | |
1018 | double deltaNext; |
|
1018 | double deltaNext; | |
1019 |
|
1019 | |||
1020 | acquisitionTime = get_acquisition_time( timePtr ); |
|
1020 | acquisitionTime = get_acquisition_time( timePtr ); | |
1021 |
|
1021 | |||
1022 | // compute center time |
|
1022 | // compute center time | |
1023 | centerTime = acquisitionTime + 2731; // (2048. / 24576. / 2.) * 65536. = 2730.667; |
|
1023 | centerTime = acquisitionTime + 2731; // (2048. / 24576. / 2.) * 65536. = 2730.667; | |
1024 | previousTick = centerTime - (centerTime & 0xffff); |
|
1024 | previousTick = centerTime - (centerTime & 0xffff); | |
1025 | nextTick = previousTick + 65536; |
|
1025 | nextTick = previousTick + 65536; | |
1026 |
|
1026 | |||
1027 | deltaPreviousTick = centerTime - previousTick; |
|
1027 | deltaPreviousTick = centerTime - previousTick; | |
1028 | deltaNextTick = nextTick - centerTime; |
|
1028 | deltaNextTick = nextTick - centerTime; | |
1029 |
|
1029 | |||
1030 | deltaPrevious = ((double) deltaPreviousTick) / 65536. * 1000.; |
|
1030 | deltaPrevious = ((double) deltaPreviousTick) / 65536. * 1000.; | |
1031 | deltaNext = ((double) deltaNextTick) / 65536. * 1000.; |
|
1031 | deltaNext = ((double) deltaNextTick) / 65536. * 1000.; | |
1032 |
|
1032 | |||
1033 | printf("delta previous = %f ms, delta next = %f ms\n", deltaPrevious, deltaNext); |
|
1033 | printf("delta previous = %f ms, delta next = %f ms\n", deltaPrevious, deltaNext); | |
1034 | printf("delta previous = %llu, delta next = %llu\n", deltaPreviousTick, deltaNextTick); |
|
1034 | printf("delta previous = %llu, delta next = %llu\n", deltaPreviousTick, deltaNextTick); | |
1035 |
|
1035 | |||
1036 | // which tick is the closest |
|
1036 | // which tick is the closest | |
1037 | if (deltaPreviousTick > deltaNextTick) |
|
1037 | if (deltaPreviousTick > deltaNextTick) | |
1038 | { |
|
1038 | { | |
1039 | deltaTickInF2 = floor( (deltaNext * 256. / 1000.) ); // the division by 2 is important here |
|
1039 | deltaTickInF2 = floor( (deltaNext * 256. / 1000.) ); // the division by 2 is important here | |
1040 | waveform_picker_regs->delta_snapshot = waveform_picker_regs->delta_snapshot + deltaTickInF2; |
|
1040 | waveform_picker_regs->delta_snapshot = waveform_picker_regs->delta_snapshot + deltaTickInF2; | |
1041 | printf("correction of = + %u\n", deltaTickInF2); |
|
1041 | printf("correction of = + %u\n", deltaTickInF2); | |
1042 | } |
|
1042 | } | |
1043 | else |
|
1043 | else | |
1044 | { |
|
1044 | { | |
1045 | deltaTickInF2 = floor( (deltaPrevious * 256. / 1000.) ); // the division by 2 is important here |
|
1045 | deltaTickInF2 = floor( (deltaPrevious * 256. / 1000.) ); // the division by 2 is important here | |
1046 | waveform_picker_regs->delta_snapshot = waveform_picker_regs->delta_snapshot - deltaTickInF2; |
|
1046 | waveform_picker_regs->delta_snapshot = waveform_picker_regs->delta_snapshot - deltaTickInF2; | |
1047 | printf("correction of = - %u\n", deltaTickInF2); |
|
1047 | printf("correction of = - %u\n", deltaTickInF2); | |
1048 | } |
|
1048 | } | |
1049 | } |
|
1049 | } | |
1050 |
|
1050 | |||
1051 | //************** |
|
1051 | //************** | |
1052 | // wfp registers |
|
1052 | // wfp registers | |
1053 | void reset_wfp_burst_enable( void ) |
|
1053 | void reset_wfp_burst_enable( void ) | |
1054 | { |
|
1054 | { | |
1055 | /** This function resets the waveform picker burst_enable register. |
|
1055 | /** This function resets the waveform picker burst_enable register. | |
1056 | * |
|
1056 | * | |
1057 | * The burst bits [f2 f1 f0] and the enable bits [f3 f2 f1 f0] are set to 0. |
|
1057 | * The burst bits [f2 f1 f0] and the enable bits [f3 f2 f1 f0] are set to 0. | |
1058 | * |
|
1058 | * | |
1059 | */ |
|
1059 | */ | |
1060 |
|
1060 | |||
1061 | // [1000 000] burst f2, f1, f0 enable f3, f2, f1, f0 |
|
1061 | // [1000 000] burst f2, f1, f0 enable f3, f2, f1, f0 | |
1062 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable & 0x80; |
|
1062 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable & 0x80; | |
1063 | } |
|
1063 | } | |
1064 |
|
1064 | |||
1065 | void reset_wfp_status( void ) |
|
1065 | void reset_wfp_status( void ) | |
1066 | { |
|
1066 | { | |
1067 | /** This function resets the waveform picker status register. |
|
1067 | /** This function resets the waveform picker status register. | |
1068 | * |
|
1068 | * | |
1069 | * All status bits are set to 0 [new_err full_err full]. |
|
1069 | * All status bits are set to 0 [new_err full_err full]. | |
1070 | * |
|
1070 | * | |
1071 | */ |
|
1071 | */ | |
1072 |
|
1072 | |||
1073 | waveform_picker_regs->status = 0xffff; |
|
1073 | waveform_picker_regs->status = 0xffff; | |
1074 | } |
|
1074 | } | |
1075 |
|
1075 | |||
1076 | void reset_wfp_buffer_addresses( void ) |
|
1076 | void reset_wfp_buffer_addresses( void ) | |
1077 | { |
|
1077 | { | |
1078 | // F0 |
|
1078 | // F0 | |
1079 | waveform_picker_regs->addr_data_f0_0 = current_ring_node_f0->buffer_address; // 0x08 |
|
1079 | waveform_picker_regs->addr_data_f0_0 = current_ring_node_f0->buffer_address; // 0x08 | |
1080 | current_ring_node_f0 = current_ring_node_f0->next; |
|
1080 | current_ring_node_f0 = current_ring_node_f0->next; | |
1081 | waveform_picker_regs->addr_data_f0_1 = current_ring_node_f0->buffer_address; // 0x0c |
|
1081 | waveform_picker_regs->addr_data_f0_1 = current_ring_node_f0->buffer_address; // 0x0c | |
1082 | // F1 |
|
1082 | // F1 | |
1083 | waveform_picker_regs->addr_data_f1_0 = current_ring_node_f1->buffer_address; // 0x10 |
|
1083 | waveform_picker_regs->addr_data_f1_0 = current_ring_node_f1->buffer_address; // 0x10 | |
1084 | current_ring_node_f1 = current_ring_node_f1->next; |
|
1084 | current_ring_node_f1 = current_ring_node_f1->next; | |
1085 | waveform_picker_regs->addr_data_f1_1 = current_ring_node_f1->buffer_address; // 0x14 |
|
1085 | waveform_picker_regs->addr_data_f1_1 = current_ring_node_f1->buffer_address; // 0x14 | |
1086 | // F2 |
|
1086 | // F2 | |
1087 | waveform_picker_regs->addr_data_f2_0 = current_ring_node_f2->buffer_address; // 0x18 |
|
1087 | waveform_picker_regs->addr_data_f2_0 = current_ring_node_f2->buffer_address; // 0x18 | |
1088 | current_ring_node_f2 = current_ring_node_f2->next; |
|
1088 | current_ring_node_f2 = current_ring_node_f2->next; | |
1089 | waveform_picker_regs->addr_data_f2_1 = current_ring_node_f2->buffer_address; // 0x1c |
|
1089 | waveform_picker_regs->addr_data_f2_1 = current_ring_node_f2->buffer_address; // 0x1c | |
1090 | // F3 |
|
1090 | // F3 | |
1091 | waveform_picker_regs->addr_data_f3_0 = current_ring_node_f3->buffer_address; // 0x20 |
|
1091 | waveform_picker_regs->addr_data_f3_0 = current_ring_node_f3->buffer_address; // 0x20 | |
1092 | current_ring_node_f3 = current_ring_node_f3->next; |
|
1092 | current_ring_node_f3 = current_ring_node_f3->next; | |
1093 | waveform_picker_regs->addr_data_f3_1 = current_ring_node_f3->buffer_address; // 0x24 |
|
1093 | waveform_picker_regs->addr_data_f3_1 = current_ring_node_f3->buffer_address; // 0x24 | |
1094 | } |
|
1094 | } | |
1095 |
|
1095 | |||
1096 | void reset_waveform_picker_regs( void ) |
|
1096 | void reset_waveform_picker_regs( void ) | |
1097 | { |
|
1097 | { | |
1098 | /** This function resets the waveform picker module registers. |
|
1098 | /** This function resets the waveform picker module registers. | |
1099 | * |
|
1099 | * | |
1100 | * The registers affected by this function are located at the following offset addresses: |
|
1100 | * The registers affected by this function are located at the following offset addresses: | |
1101 | * - 0x00 data_shaping |
|
1101 | * - 0x00 data_shaping | |
1102 | * - 0x04 run_burst_enable |
|
1102 | * - 0x04 run_burst_enable | |
1103 | * - 0x08 addr_data_f0 |
|
1103 | * - 0x08 addr_data_f0 | |
1104 | * - 0x0C addr_data_f1 |
|
1104 | * - 0x0C addr_data_f1 | |
1105 | * - 0x10 addr_data_f2 |
|
1105 | * - 0x10 addr_data_f2 | |
1106 | * - 0x14 addr_data_f3 |
|
1106 | * - 0x14 addr_data_f3 | |
1107 | * - 0x18 status |
|
1107 | * - 0x18 status | |
1108 | * - 0x1C delta_snapshot |
|
1108 | * - 0x1C delta_snapshot | |
1109 | * - 0x20 delta_f0 |
|
1109 | * - 0x20 delta_f0 | |
1110 | * - 0x24 delta_f0_2 |
|
1110 | * - 0x24 delta_f0_2 | |
1111 | * - 0x28 delta_f1 |
|
1111 | * - 0x28 delta_f1 | |
1112 | * - 0x2c delta_f2 |
|
1112 | * - 0x2c delta_f2 | |
1113 | * - 0x30 nb_data_by_buffer |
|
1113 | * - 0x30 nb_data_by_buffer | |
1114 | * - 0x34 nb_snapshot_param |
|
1114 | * - 0x34 nb_snapshot_param | |
1115 | * - 0x38 start_date |
|
1115 | * - 0x38 start_date | |
1116 | * - 0x3c nb_word_in_buffer |
|
1116 | * - 0x3c nb_word_in_buffer | |
1117 | * |
|
1117 | * | |
1118 | */ |
|
1118 | */ | |
1119 |
|
1119 | |||
1120 | set_wfp_data_shaping(); // 0x00 *** R1 R0 SP1 SP0 BW |
|
1120 | set_wfp_data_shaping(); // 0x00 *** R1 R0 SP1 SP0 BW | |
1121 |
|
1121 | |||
1122 | reset_wfp_burst_enable(); // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ] |
|
1122 | reset_wfp_burst_enable(); // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ] | |
1123 |
|
1123 | |||
1124 | reset_wfp_buffer_addresses(); |
|
1124 | reset_wfp_buffer_addresses(); | |
1125 |
|
1125 | |||
1126 | reset_wfp_status(); // 0x18 |
|
1126 | reset_wfp_status(); // 0x18 | |
1127 |
|
1127 | |||
1128 | set_wfp_delta_snapshot(); // 0x1c *** 300 s => 0x12bff |
|
1128 | set_wfp_delta_snapshot(); // 0x1c *** 300 s => 0x12bff | |
1129 |
|
1129 | |||
1130 | set_wfp_delta_f0_f0_2(); // 0x20, 0x24 |
|
1130 | set_wfp_delta_f0_f0_2(); // 0x20, 0x24 | |
1131 |
|
1131 | |||
1132 | set_wfp_delta_f1(); // 0x28 |
|
1132 | set_wfp_delta_f1(); // 0x28 | |
1133 |
|
1133 | |||
1134 | set_wfp_delta_f2(); // 0x2c |
|
1134 | set_wfp_delta_f2(); // 0x2c | |
1135 |
|
1135 | |||
1136 | DEBUG_PRINTF1("delta_snapshot %x\n", waveform_picker_regs->delta_snapshot) |
|
1136 | DEBUG_PRINTF1("delta_snapshot %x\n", waveform_picker_regs->delta_snapshot) | |
1137 | DEBUG_PRINTF1("delta_f0 %x\n", waveform_picker_regs->delta_f0) |
|
1137 | DEBUG_PRINTF1("delta_f0 %x\n", waveform_picker_regs->delta_f0) | |
1138 | DEBUG_PRINTF1("delta_f0_2 %x\n", waveform_picker_regs->delta_f0_2) |
|
1138 | DEBUG_PRINTF1("delta_f0_2 %x\n", waveform_picker_regs->delta_f0_2) | |
1139 | DEBUG_PRINTF1("delta_f1 %x\n", waveform_picker_regs->delta_f1) |
|
1139 | DEBUG_PRINTF1("delta_f1 %x\n", waveform_picker_regs->delta_f1) | |
1140 | DEBUG_PRINTF1("delta_f2 %x\n", waveform_picker_regs->delta_f2) |
|
1140 | DEBUG_PRINTF1("delta_f2 %x\n", waveform_picker_regs->delta_f2) | |
1141 | // 2688 = 8 * 336 |
|
1141 | // 2688 = 8 * 336 | |
1142 | waveform_picker_regs->nb_data_by_buffer = 0xa7f; // 0x30 *** 2688 - 1 => nb samples -1 |
|
1142 | waveform_picker_regs->nb_data_by_buffer = 0xa7f; // 0x30 *** 2688 - 1 => nb samples -1 | |
1143 | waveform_picker_regs->snapshot_param = 0xa80; // 0x34 *** 2688 => nb samples |
|
1143 | waveform_picker_regs->snapshot_param = 0xa80; // 0x34 *** 2688 => nb samples | |
1144 | waveform_picker_regs->start_date = 0x7fffffff; // 0x38 |
|
1144 | waveform_picker_regs->start_date = 0x7fffffff; // 0x38 | |
1145 | // |
|
1145 | // | |
1146 | // coarse time and fine time registers are not initialized, they are volatile |
|
1146 | // coarse time and fine time registers are not initialized, they are volatile | |
1147 | // |
|
1147 | // | |
1148 | waveform_picker_regs->buffer_length = 0x1f8;// buffer length in burst = 3 * 2688 / 16 = 504 = 0x1f8 |
|
1148 | waveform_picker_regs->buffer_length = 0x1f8;// buffer length in burst = 3 * 2688 / 16 = 504 = 0x1f8 | |
1149 | } |
|
1149 | } | |
1150 |
|
1150 | |||
1151 | void set_wfp_data_shaping( void ) |
|
1151 | void set_wfp_data_shaping( void ) | |
1152 | { |
|
1152 | { | |
1153 | /** This function sets the data_shaping register of the waveform picker module. |
|
1153 | /** This function sets the data_shaping register of the waveform picker module. | |
1154 | * |
|
1154 | * | |
1155 | * The value is read from one field of the parameter_dump_packet structure:\n |
|
1155 | * The value is read from one field of the parameter_dump_packet structure:\n | |
1156 | * bw_sp0_sp1_r0_r1 |
|
1156 | * bw_sp0_sp1_r0_r1 | |
1157 | * |
|
1157 | * | |
1158 | */ |
|
1158 | */ | |
1159 |
|
1159 | |||
1160 | unsigned char data_shaping; |
|
1160 | unsigned char data_shaping; | |
1161 |
|
1161 | |||
1162 | // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register |
|
1162 | // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register | |
1163 | // waveform picker : [R1 R0 SP1 SP0 BW] |
|
1163 | // waveform picker : [R1 R0 SP1 SP0 BW] | |
1164 |
|
1164 | |||
1165 | data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1; |
|
1165 | data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1; | |
1166 |
|
1166 | |||
1167 | waveform_picker_regs->data_shaping = |
|
1167 | waveform_picker_regs->data_shaping = | |
1168 | ( (data_shaping & 0x10) >> 4 ) // BW |
|
1168 | ( (data_shaping & 0x10) >> 4 ) // BW | |
1169 | + ( (data_shaping & 0x08) >> 2 ) // SP0 |
|
1169 | + ( (data_shaping & 0x08) >> 2 ) // SP0 | |
1170 | + ( (data_shaping & 0x04) ) // SP1 |
|
1170 | + ( (data_shaping & 0x04) ) // SP1 | |
1171 | + ( (data_shaping & 0x02) << 2 ) // R0 |
|
1171 | + ( (data_shaping & 0x02) << 2 ) // R0 | |
1172 | + ( (data_shaping & 0x01) << 4 ); // R1 |
|
1172 | + ( (data_shaping & 0x01) << 4 ); // R1 | |
1173 | } |
|
1173 | } | |
1174 |
|
1174 | |||
1175 | void set_wfp_burst_enable_register( unsigned char mode ) |
|
1175 | void set_wfp_burst_enable_register( unsigned char mode ) | |
1176 | { |
|
1176 | { | |
1177 | /** This function sets the waveform picker burst_enable register depending on the mode. |
|
1177 | /** This function sets the waveform picker burst_enable register depending on the mode. | |
1178 | * |
|
1178 | * | |
1179 | * @param mode is the LFR mode to launch. |
|
1179 | * @param mode is the LFR mode to launch. | |
1180 | * |
|
1180 | * | |
1181 | * The burst bits shall be before the enable bits. |
|
1181 | * The burst bits shall be before the enable bits. | |
1182 | * |
|
1182 | * | |
1183 | */ |
|
1183 | */ | |
1184 |
|
1184 | |||
1185 | // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0 |
|
1185 | // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0 | |
1186 | // the burst bits shall be set first, before the enable bits |
|
1186 | // the burst bits shall be set first, before the enable bits | |
1187 | switch(mode) { |
|
1187 | switch(mode) { | |
1188 | case(LFR_MODE_NORMAL): |
|
1188 | case(LFR_MODE_NORMAL): | |
1189 | waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enable |
|
1189 | waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enable | |
1190 | waveform_picker_regs->run_burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0 |
|
1190 | waveform_picker_regs->run_burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0 | |
1191 | break; |
|
1191 | break; | |
1192 | case(LFR_MODE_BURST): |
|
1192 | case(LFR_MODE_BURST): | |
1193 | waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled |
|
1193 | waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled | |
1194 | // waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x04; // [0100] enable f2 |
|
1194 | // waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x04; // [0100] enable f2 | |
1195 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0c; // [1100] enable f3 AND f2 |
|
1195 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0c; // [1100] enable f3 AND f2 | |
1196 | break; |
|
1196 | break; | |
1197 | case(LFR_MODE_SBM1): |
|
1197 | case(LFR_MODE_SBM1): | |
1198 | waveform_picker_regs->run_burst_enable = 0x20; // [0010 0000] f1 burst enabled |
|
1198 | waveform_picker_regs->run_burst_enable = 0x20; // [0010 0000] f1 burst enabled | |
1199 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 |
|
1199 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 | |
1200 | break; |
|
1200 | break; | |
1201 | case(LFR_MODE_SBM2): |
|
1201 | case(LFR_MODE_SBM2): | |
1202 | waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled |
|
1202 | waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled | |
1203 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 |
|
1203 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 | |
1204 | break; |
|
1204 | break; | |
1205 | default: |
|
1205 | default: | |
1206 | waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled |
|
1206 | waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled | |
1207 | break; |
|
1207 | break; | |
1208 | } |
|
1208 | } | |
1209 | } |
|
1209 | } | |
1210 |
|
1210 | |||
1211 | void set_wfp_delta_snapshot( void ) |
|
1211 | void set_wfp_delta_snapshot( void ) | |
1212 | { |
|
1212 | { | |
1213 | /** This function sets the delta_snapshot register of the waveform picker module. |
|
1213 | /** This function sets the delta_snapshot register of the waveform picker module. | |
1214 | * |
|
1214 | * | |
1215 | * The value is read from two (unsigned char) of the parameter_dump_packet structure: |
|
1215 | * The value is read from two (unsigned char) of the parameter_dump_packet structure: | |
1216 | * - sy_lfr_n_swf_p[0] |
|
1216 | * - sy_lfr_n_swf_p[0] | |
1217 | * - sy_lfr_n_swf_p[1] |
|
1217 | * - sy_lfr_n_swf_p[1] | |
1218 | * |
|
1218 | * | |
1219 | */ |
|
1219 | */ | |
1220 |
|
1220 | |||
1221 | unsigned int delta_snapshot; |
|
1221 | unsigned int delta_snapshot; | |
1222 | unsigned int delta_snapshot_in_T2; |
|
1222 | unsigned int delta_snapshot_in_T2; | |
1223 |
|
1223 | |||
1224 | delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256 |
|
1224 | delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256 | |
1225 | + parameter_dump_packet.sy_lfr_n_swf_p[1]; |
|
1225 | + parameter_dump_packet.sy_lfr_n_swf_p[1]; | |
1226 |
|
1226 | |||
1227 | delta_snapshot_in_T2 = delta_snapshot * 256; |
|
1227 | delta_snapshot_in_T2 = delta_snapshot * 256; | |
1228 | waveform_picker_regs->delta_snapshot = delta_snapshot_in_T2 - 1; // max 4 bytes |
|
1228 | waveform_picker_regs->delta_snapshot = delta_snapshot_in_T2 - 1; // max 4 bytes | |
1229 | } |
|
1229 | } | |
1230 |
|
1230 | |||
1231 | void set_wfp_delta_f0_f0_2( void ) |
|
1231 | void set_wfp_delta_f0_f0_2( void ) | |
1232 | { |
|
1232 | { | |
1233 | unsigned int delta_snapshot; |
|
1233 | unsigned int delta_snapshot; | |
1234 | unsigned int nb_samples_per_snapshot; |
|
1234 | unsigned int nb_samples_per_snapshot; | |
1235 | float delta_f0_in_float; |
|
1235 | float delta_f0_in_float; | |
1236 |
|
1236 | |||
1237 | delta_snapshot = waveform_picker_regs->delta_snapshot; |
|
1237 | delta_snapshot = waveform_picker_regs->delta_snapshot; | |
1238 | nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1]; |
|
1238 | nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1]; | |
1239 | delta_f0_in_float =nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 24576.) * 256.; |
|
1239 | delta_f0_in_float =nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 24576.) * 256.; | |
1240 |
|
1240 | |||
1241 | waveform_picker_regs->delta_f0 = delta_snapshot - floor( delta_f0_in_float ); |
|
1241 | waveform_picker_regs->delta_f0 = delta_snapshot - floor( delta_f0_in_float ); | |
1242 | waveform_picker_regs->delta_f0_2 = 0x7; // max 7 bits |
|
1242 | waveform_picker_regs->delta_f0_2 = 0x7; // max 7 bits | |
1243 | } |
|
1243 | } | |
1244 |
|
1244 | |||
1245 | void set_wfp_delta_f1( void ) |
|
1245 | void set_wfp_delta_f1( void ) | |
1246 | { |
|
1246 | { | |
1247 | unsigned int delta_snapshot; |
|
1247 | unsigned int delta_snapshot; | |
1248 | unsigned int nb_samples_per_snapshot; |
|
1248 | unsigned int nb_samples_per_snapshot; | |
1249 | float delta_f1_in_float; |
|
1249 | float delta_f1_in_float; | |
1250 |
|
1250 | |||
1251 | delta_snapshot = waveform_picker_regs->delta_snapshot; |
|
1251 | delta_snapshot = waveform_picker_regs->delta_snapshot; | |
1252 | nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1]; |
|
1252 | nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1]; | |
1253 | delta_f1_in_float = nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 4096.) * 256.; |
|
1253 | delta_f1_in_float = nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 4096.) * 256.; | |
1254 |
|
1254 | |||
1255 | waveform_picker_regs->delta_f1 = delta_snapshot - floor( delta_f1_in_float ); |
|
1255 | waveform_picker_regs->delta_f1 = delta_snapshot - floor( delta_f1_in_float ); | |
1256 | } |
|
1256 | } | |
1257 |
|
1257 | |||
1258 | void set_wfp_delta_f2() |
|
1258 | void set_wfp_delta_f2() | |
1259 | { |
|
1259 | { | |
1260 | unsigned int delta_snapshot; |
|
1260 | unsigned int delta_snapshot; | |
1261 | unsigned int nb_samples_per_snapshot; |
|
1261 | unsigned int nb_samples_per_snapshot; | |
1262 |
|
1262 | |||
1263 | delta_snapshot = waveform_picker_regs->delta_snapshot; |
|
1263 | delta_snapshot = waveform_picker_regs->delta_snapshot; | |
1264 | nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1]; |
|
1264 | nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1]; | |
1265 |
|
1265 | |||
1266 | waveform_picker_regs->delta_f2 = delta_snapshot - nb_samples_per_snapshot / 2; |
|
1266 | waveform_picker_regs->delta_f2 = delta_snapshot - nb_samples_per_snapshot / 2; | |
1267 | } |
|
1267 | } | |
1268 |
|
1268 | |||
1269 | //***************** |
|
1269 | //***************** | |
1270 | // local parameters |
|
1270 | // local parameters | |
1271 |
|
1271 | |||
1272 | void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid ) |
|
1272 | void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid ) | |
1273 | { |
|
1273 | { | |
1274 | /** This function increments the parameter "sequence_cnt" depending on the sid passed in argument. |
|
1274 | /** This function increments the parameter "sequence_cnt" depending on the sid passed in argument. | |
1275 | * |
|
1275 | * | |
1276 | * @param packet_sequence_control is a pointer toward the parameter sequence_cnt to update. |
|
1276 | * @param packet_sequence_control is a pointer toward the parameter sequence_cnt to update. | |
1277 | * @param sid is the source identifier of the packet being updated. |
|
1277 | * @param sid is the source identifier of the packet being updated. | |
1278 | * |
|
1278 | * | |
1279 | * REQ-LFR-SRS-5240 / SSS-CP-FS-590 |
|
1279 | * REQ-LFR-SRS-5240 / SSS-CP-FS-590 | |
1280 | * The sequence counters shall wrap around from 2^14 to zero. |
|
1280 | * The sequence counters shall wrap around from 2^14 to zero. | |
1281 | * The sequence counter shall start at zero at startup. |
|
1281 | * The sequence counter shall start at zero at startup. | |
1282 | * |
|
1282 | * | |
1283 | * REQ-LFR-SRS-5239 / SSS-CP-FS-580 |
|
1283 | * REQ-LFR-SRS-5239 / SSS-CP-FS-580 | |
1284 | * All TM_LFR_SCIENCE_ packets are sent to ground, i.e. destination id = 0 |
|
1284 | * All TM_LFR_SCIENCE_ packets are sent to ground, i.e. destination id = 0 | |
1285 | * |
|
1285 | * | |
1286 | */ |
|
1286 | */ | |
1287 |
|
1287 | |||
1288 | unsigned short *sequence_cnt; |
|
1288 | unsigned short *sequence_cnt; | |
1289 | unsigned short segmentation_grouping_flag; |
|
1289 | unsigned short segmentation_grouping_flag; | |
1290 | unsigned short new_packet_sequence_control; |
|
1290 | unsigned short new_packet_sequence_control; | |
1291 | rtems_mode initial_mode_set; |
|
1291 | rtems_mode initial_mode_set; | |
1292 | rtems_mode current_mode_set; |
|
1292 | rtems_mode current_mode_set; | |
1293 | rtems_status_code status; |
|
1293 | rtems_status_code status; | |
1294 |
|
1294 | |||
1295 | //****************************************** |
|
1295 | //****************************************** | |
1296 | // CHANGE THE MODE OF THE CALLING RTEMS TASK |
|
1296 | // CHANGE THE MODE OF THE CALLING RTEMS TASK | |
1297 | status = rtems_task_mode( RTEMS_NO_PREEMPT, RTEMS_PREEMPT_MASK, &initial_mode_set ); |
|
1297 | status = rtems_task_mode( RTEMS_NO_PREEMPT, RTEMS_PREEMPT_MASK, &initial_mode_set ); | |
1298 |
|
1298 | |||
1299 | if ( (sid == SID_NORM_SWF_F0) || (sid == SID_NORM_SWF_F1) || (sid == SID_NORM_SWF_F2) |
|
1299 | if ( (sid == SID_NORM_SWF_F0) || (sid == SID_NORM_SWF_F1) || (sid == SID_NORM_SWF_F2) | |
1300 | || (sid == SID_NORM_CWF_F3) || (sid == SID_NORM_CWF_LONG_F3) |
|
1300 | || (sid == SID_NORM_CWF_F3) || (sid == SID_NORM_CWF_LONG_F3) | |
1301 | || (sid == SID_BURST_CWF_F2) |
|
1301 | || (sid == SID_BURST_CWF_F2) | |
1302 | || (sid == SID_NORM_ASM_F0) || (sid == SID_NORM_ASM_F1) || (sid == SID_NORM_ASM_F2) |
|
1302 | || (sid == SID_NORM_ASM_F0) || (sid == SID_NORM_ASM_F1) || (sid == SID_NORM_ASM_F2) | |
1303 | || (sid == SID_NORM_BP1_F0) || (sid == SID_NORM_BP1_F1) || (sid == SID_NORM_BP1_F2) |
|
1303 | || (sid == SID_NORM_BP1_F0) || (sid == SID_NORM_BP1_F1) || (sid == SID_NORM_BP1_F2) | |
1304 | || (sid == SID_NORM_BP2_F0) || (sid == SID_NORM_BP2_F1) || (sid == SID_NORM_BP2_F2) |
|
1304 | || (sid == SID_NORM_BP2_F0) || (sid == SID_NORM_BP2_F1) || (sid == SID_NORM_BP2_F2) | |
1305 | || (sid == SID_BURST_BP1_F0) || (sid == SID_BURST_BP2_F0) |
|
1305 | || (sid == SID_BURST_BP1_F0) || (sid == SID_BURST_BP2_F0) | |
1306 | || (sid == SID_BURST_BP1_F1) || (sid == SID_BURST_BP2_F1) ) |
|
1306 | || (sid == SID_BURST_BP1_F1) || (sid == SID_BURST_BP2_F1) ) | |
1307 | { |
|
1307 | { | |
1308 | sequence_cnt = (unsigned short *) &sequenceCounters_SCIENCE_NORMAL_BURST; |
|
1308 | sequence_cnt = (unsigned short *) &sequenceCounters_SCIENCE_NORMAL_BURST; | |
1309 | } |
|
1309 | } | |
1310 | else if ( (sid ==SID_SBM1_CWF_F1) || (sid ==SID_SBM2_CWF_F2) |
|
1310 | else if ( (sid ==SID_SBM1_CWF_F1) || (sid ==SID_SBM2_CWF_F2) | |
1311 | || (sid == SID_SBM1_BP1_F0) || (sid == SID_SBM1_BP2_F0) |
|
1311 | || (sid == SID_SBM1_BP1_F0) || (sid == SID_SBM1_BP2_F0) | |
1312 | || (sid == SID_SBM2_BP1_F0) || (sid == SID_SBM2_BP2_F0) |
|
1312 | || (sid == SID_SBM2_BP1_F0) || (sid == SID_SBM2_BP2_F0) | |
1313 | || (sid == SID_SBM2_BP1_F1) || (sid == SID_SBM2_BP2_F1) ) |
|
1313 | || (sid == SID_SBM2_BP1_F1) || (sid == SID_SBM2_BP2_F1) ) | |
1314 | { |
|
1314 | { | |
1315 | sequence_cnt = (unsigned short *) &sequenceCounters_SCIENCE_SBM1_SBM2; |
|
1315 | sequence_cnt = (unsigned short *) &sequenceCounters_SCIENCE_SBM1_SBM2; | |
1316 | } |
|
1316 | } | |
1317 | else |
|
1317 | else | |
1318 | { |
|
1318 | { | |
1319 | sequence_cnt = (unsigned short *) NULL; |
|
1319 | sequence_cnt = (unsigned short *) NULL; | |
1320 | PRINTF1("in increment_seq_counter_source_id *** ERR apid_destid %d not known\n", sid) |
|
1320 | PRINTF1("in increment_seq_counter_source_id *** ERR apid_destid %d not known\n", sid) | |
1321 | } |
|
1321 | } | |
1322 |
|
1322 | |||
1323 | if (sequence_cnt != NULL) |
|
1323 | if (sequence_cnt != NULL) | |
1324 | { |
|
1324 | { | |
1325 | segmentation_grouping_flag = TM_PACKET_SEQ_CTRL_STANDALONE << 8; |
|
1325 | segmentation_grouping_flag = TM_PACKET_SEQ_CTRL_STANDALONE << 8; | |
1326 | *sequence_cnt = (*sequence_cnt) & 0x3fff; |
|
1326 | *sequence_cnt = (*sequence_cnt) & 0x3fff; | |
1327 |
|
1327 | |||
1328 | new_packet_sequence_control = segmentation_grouping_flag | (*sequence_cnt) ; |
|
1328 | new_packet_sequence_control = segmentation_grouping_flag | (*sequence_cnt) ; | |
1329 |
|
1329 | |||
1330 | packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8); |
|
1330 | packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8); | |
1331 | packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control ); |
|
1331 | packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control ); | |
1332 |
|
1332 | |||
1333 | // increment the sequence counter |
|
1333 | // increment the sequence counter | |
1334 | if ( *sequence_cnt < SEQ_CNT_MAX) |
|
1334 | if ( *sequence_cnt < SEQ_CNT_MAX) | |
1335 | { |
|
1335 | { | |
1336 | *sequence_cnt = *sequence_cnt + 1; |
|
1336 | *sequence_cnt = *sequence_cnt + 1; | |
1337 | } |
|
1337 | } | |
1338 | else |
|
1338 | else | |
1339 | { |
|
1339 | { | |
1340 | *sequence_cnt = 0; |
|
1340 | *sequence_cnt = 0; | |
1341 | } |
|
1341 | } | |
1342 | } |
|
1342 | } | |
1343 |
|
1343 | |||
1344 | //*********************************** |
|
1344 | //*********************************** | |
1345 | // RESET THE MODE OF THE CALLING TASK |
|
1345 | // RESET THE MODE OF THE CALLING TASK | |
1346 | status = rtems_task_mode( initial_mode_set, RTEMS_PREEMPT_MASK, ¤t_mode_set ); |
|
1346 | status = rtems_task_mode( initial_mode_set, RTEMS_PREEMPT_MASK, ¤t_mode_set ); | |
1347 | } |
|
1347 | } |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed | ||
This diff has been collapsed as it changes many lines, (670 lines changed) Show them Hide them |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
General Comments 0
You need to be logged in to leave comments.
Login now