##// END OF EJS Templates
waveform buffers declaration modified...
paul -
r131:4a63795e87ea VHDLib206
parent child
Show More
@@ -0,0 +1,70
1 #ifndef FSW_PARAMS_PROCESSING_H
2 #define FSW_PARAMS_PROCESSING_H
3
4 #define NB_BINS_PER_SM 128
5 #define NB_VALUES_PER_SM 25
6 #define TOTAL_SIZE_SM 3200 // 25 * 128
7 #define TOTAL_SIZE_NORM_BP1_F0 99 // 11 * 9 = 99
8 #define TOTAL_SIZE_NORM_BP1_F1 117 // 13 * 9 = 117
9 #define TOTAL_SIZE_NORM_BP1_F2 108 // 12 * 9 = 108
10 #define TOTAL_SIZE_SBM1_BP1_F0 198 // 22 * 9 = 198
11 //
12 #define NB_RING_NODES_SM_F0 12 // AT LEAST 3
13 #define NB_RING_NODES_ASM_BURST_SBM_F0 10 // AT LEAST 3
14 #define NB_RING_NODES_ASM_NORM_F0 10 // AT LEAST 3
15 #define NB_RING_NODES_SM_F1 3 // AT LEAST 3
16 #define NB_RING_NODES_ASM_BURST_SBM_F1 5 // AT LEAST 3
17 #define NB_RING_NODES_ASM_NORM_F1 5 // AT LEAST 3
18 #define NB_RING_NODES_SM_F2 3 // AT LEAST 3
19 #define NB_RING_NODES_ASM_BURST_SBM_F2 3 // AT LEAST 3
20 #define NB_RING_NODES_ASM_NORM_F2 3 // AT LEAST 3
21 //
22 #define NB_BINS_PER_ASM_F0 88
23 #define NB_BINS_PER_PKT_ASM_F0 44
24 #define TOTAL_SIZE_ASM_F0_IN_BYTES 4400 // 25 * 88 * 2
25 #define ASM_F0_INDICE_START 17 // 88 bins
26 #define ASM_F0_INDICE_STOP 104 // 2 packets of 44 bins
27 //
28 #define NB_BINS_PER_ASM_F1 104
29 #define NB_BINS_PER_PKT_ASM_F1 52
30 #define TOTAL_SIZE_ASM_F1_IN_BYTES 5200 // 25 * 104 * 2
31 #define ASM_F1_INDICE_START 6 // 104 bins
32 #define ASM_F1_INDICE_STOP 109 // 2 packets of 52 bins
33 //
34 #define NB_BINS_PER_ASM_F2 96
35 #define NB_BINS_PER_PKT_ASM_F2 48
36 #define TOTAL_SIZE_ASM_F2_IN_BYTES 4800 // 25 * 96 * 2
37 #define ASM_F2_INDICE_START 7 // 96 bins
38 #define ASM_F2_INDICE_STOP 102 // 2 packets of 48 bins
39 //
40 #define NB_BINS_COMPRESSED_SM_F0 11
41 #define NB_BINS_COMPRESSED_SM_F1 13
42 #define NB_BINS_COMPRESSED_SM_F2 12
43 #define NB_BINS_COMPRESSED_SM_SBM_F0 22
44 #define NB_BINS_COMPRESSED_SM_SBM_F1 26
45 #define NB_BINS_COMPRESSED_SM_SBM_F2 24
46 //
47 #define NB_BYTES_PER_BP1 9
48 //
49 #define NB_BINS_TO_AVERAGE_ASM_F0 8
50 #define NB_BINS_TO_AVERAGE_ASM_F1 8
51 #define NB_BINS_TO_AVERAGE_ASM_F2 8
52 #define NB_BINS_TO_AVERAGE_ASM_SBM_F0 4
53 #define NB_BINS_TO_AVERAGE_ASM_SBM_F1 4
54 #define NB_BINS_TO_AVERAGE_ASM_SBM_F2 4
55 //
56 #define TOTAL_SIZE_COMPRESSED_ASM_NORM_F0 275 // 11 * 25 WORDS
57 #define TOTAL_SIZE_COMPRESSED_ASM_NORM_F1 325 // 13 * 25 WORDS
58 #define TOTAL_SIZE_COMPRESSED_ASM_NORM_F2 300 // 12 * 25 WORDS
59 #define TOTAL_SIZE_COMPRESSED_ASM_SBM_F0 550 // 22 * 25 WORDS
60 #define TOTAL_SIZE_COMPRESSED_ASM_SBM_F1 650 // 26 * 25 WORDS
61 #define TOTAL_SIZE_COMPRESSED_ASM_SBM_F2 600 // 24 * 25 WORDS
62 #define TOTAL_SIZE_BP1_NORM_F0 99 // 9 * 11 UNSIGNED CHAR
63 #define TOTAL_SIZE_BP1_SBM_F0 198 // 9 * 22 UNSIGNED CHAR
64 // GENERAL
65 #define NB_SM_BEFORE_AVF0 8 // must be 8 due to the SM_average() function
66 #define NB_SM_BEFORE_AVF1 8 // must be 8 due to the SM_average() function
67 #define NB_SM_BEFORE_AVF2 1 // must be 1 due to the SM_average_f2() function
68
69 #endif // FSW_PARAMS_PROCESSING_H
70
@@ -0,0 +1,8
1 #ifndef FSW_PARAMS_WF_HANDLER_H
2 #define FSW_PARAMS_WF_HANDLER_H
3
4 #define WFRM_BUFFER 8128 // (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 62
5 // (2688 * 3 ) + 2 + 62 = 8128 = 0X1FC0
6 // 8128 * 4 = 32512 = 0x7F00
7
8 #endif // FSW_PARAMS_WF_HANDLER_H
@@ -1,268 +1,268
1 #############################################################################
1 #############################################################################
2 # Makefile for building: bin/fsw
2 # Makefile for building: bin/fsw
3 # Generated by qmake (2.01a) (Qt 4.8.6) on: Tue May 6 15:49:26 2014
3 # Generated by qmake (2.01a) (Qt 4.8.6) on: Tue May 13 07:12:26 2014
4 # Project: fsw-qt.pro
4 # Project: fsw-qt.pro
5 # Template: app
5 # Template: app
6 # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
6 # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
7 #############################################################################
7 #############################################################################
8
8
9 ####### Compiler, tools and options
9 ####### Compiler, tools and options
10
10
11 CC = sparc-rtems-gcc
11 CC = sparc-rtems-gcc
12 CXX = sparc-rtems-g++
12 CXX = sparc-rtems-g++
13 DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=7 -DPRINT_MESSAGES_ON_CONSOLE -DPRINT_TASK_STATISTICS
13 DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=7 -DPRINT_MESSAGES_ON_CONSOLE -DPRINT_TASK_STATISTICS
14 CFLAGS = -pipe -O3 -Wall $(DEFINES)
14 CFLAGS = -pipe -O3 -Wall $(DEFINES)
15 CXXFLAGS = -pipe -O3 -Wall $(DEFINES)
15 CXXFLAGS = -pipe -O3 -Wall $(DEFINES)
16 INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header -I../header/processing -I../src/basic_parameters
16 INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header -I../header/processing -I../src/basic_parameters
17 LINK = sparc-rtems-g++
17 LINK = sparc-rtems-g++
18 LFLAGS =
18 LFLAGS =
19 LIBS = $(SUBLIBS)
19 LIBS = $(SUBLIBS)
20 AR = sparc-rtems-ar rcs
20 AR = sparc-rtems-ar rcs
21 RANLIB =
21 RANLIB =
22 QMAKE = /usr/bin/qmake-qt4
22 QMAKE = /usr/bin/qmake-qt4
23 TAR = tar -cf
23 TAR = tar -cf
24 COMPRESS = gzip -9f
24 COMPRESS = gzip -9f
25 COPY = cp -f
25 COPY = cp -f
26 SED = sed
26 SED = sed
27 COPY_FILE = $(COPY)
27 COPY_FILE = $(COPY)
28 COPY_DIR = $(COPY) -r
28 COPY_DIR = $(COPY) -r
29 STRIP = sparc-rtems-strip
29 STRIP = sparc-rtems-strip
30 INSTALL_FILE = install -m 644 -p
30 INSTALL_FILE = install -m 644 -p
31 INSTALL_DIR = $(COPY_DIR)
31 INSTALL_DIR = $(COPY_DIR)
32 INSTALL_PROGRAM = install -m 755 -p
32 INSTALL_PROGRAM = install -m 755 -p
33 DEL_FILE = rm -f
33 DEL_FILE = rm -f
34 SYMLINK = ln -f -s
34 SYMLINK = ln -f -s
35 DEL_DIR = rmdir
35 DEL_DIR = rmdir
36 MOVE = mv -f
36 MOVE = mv -f
37 CHK_DIR_EXISTS= test -d
37 CHK_DIR_EXISTS= test -d
38 MKDIR = mkdir -p
38 MKDIR = mkdir -p
39
39
40 ####### Output directory
40 ####### Output directory
41
41
42 OBJECTS_DIR = obj/
42 OBJECTS_DIR = obj/
43
43
44 ####### Files
44 ####### Files
45
45
46 SOURCES = ../src/wf_handler.c \
46 SOURCES = ../src/wf_handler.c \
47 ../src/tc_handler.c \
47 ../src/tc_handler.c \
48 ../src/fsw_misc.c \
48 ../src/fsw_misc.c \
49 ../src/fsw_init.c \
49 ../src/fsw_init.c \
50 ../src/fsw_globals.c \
50 ../src/fsw_globals.c \
51 ../src/fsw_spacewire.c \
51 ../src/fsw_spacewire.c \
52 ../src/tc_load_dump_parameters.c \
52 ../src/tc_load_dump_parameters.c \
53 ../src/tm_lfr_tc_exe.c \
53 ../src/tm_lfr_tc_exe.c \
54 ../src/tc_acceptance.c \
54 ../src/tc_acceptance.c \
55 ../src/basic_parameters/basic_parameters.c \
55 ../src/basic_parameters/basic_parameters.c \
56 ../src/processing/fsw_processing.c \
56 ../src/processing/fsw_processing.c \
57 ../src/processing/avf0_prc0.c \
57 ../src/processing/avf0_prc0.c \
58 ../src/processing/avf1_prc1.c \
58 ../src/processing/avf1_prc1.c \
59 ../src/processing/avf2_prc2.c
59 ../src/processing/avf2_prc2.c
60 OBJECTS = obj/wf_handler.o \
60 OBJECTS = obj/wf_handler.o \
61 obj/tc_handler.o \
61 obj/tc_handler.o \
62 obj/fsw_misc.o \
62 obj/fsw_misc.o \
63 obj/fsw_init.o \
63 obj/fsw_init.o \
64 obj/fsw_globals.o \
64 obj/fsw_globals.o \
65 obj/fsw_spacewire.o \
65 obj/fsw_spacewire.o \
66 obj/tc_load_dump_parameters.o \
66 obj/tc_load_dump_parameters.o \
67 obj/tm_lfr_tc_exe.o \
67 obj/tm_lfr_tc_exe.o \
68 obj/tc_acceptance.o \
68 obj/tc_acceptance.o \
69 obj/basic_parameters.o \
69 obj/basic_parameters.o \
70 obj/fsw_processing.o \
70 obj/fsw_processing.o \
71 obj/avf0_prc0.o \
71 obj/avf0_prc0.o \
72 obj/avf1_prc1.o \
72 obj/avf1_prc1.o \
73 obj/avf2_prc2.o
73 obj/avf2_prc2.o
74 DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \
74 DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \
75 /usr/lib64/qt4/mkspecs/common/linux.conf \
75 /usr/lib64/qt4/mkspecs/common/linux.conf \
76 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
76 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
77 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
77 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
78 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
78 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
79 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
79 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
80 /usr/lib64/qt4/mkspecs/qconfig.pri \
80 /usr/lib64/qt4/mkspecs/qconfig.pri \
81 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
81 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
82 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
82 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
83 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
83 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
84 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
84 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
85 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
85 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
86 sparc.pri \
86 sparc.pri \
87 /usr/lib64/qt4/mkspecs/features/release.prf \
87 /usr/lib64/qt4/mkspecs/features/release.prf \
88 /usr/lib64/qt4/mkspecs/features/default_post.prf \
88 /usr/lib64/qt4/mkspecs/features/default_post.prf \
89 /usr/lib64/qt4/mkspecs/features/shared.prf \
89 /usr/lib64/qt4/mkspecs/features/shared.prf \
90 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
90 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
91 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
91 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
92 /usr/lib64/qt4/mkspecs/features/resources.prf \
92 /usr/lib64/qt4/mkspecs/features/resources.prf \
93 /usr/lib64/qt4/mkspecs/features/uic.prf \
93 /usr/lib64/qt4/mkspecs/features/uic.prf \
94 /usr/lib64/qt4/mkspecs/features/yacc.prf \
94 /usr/lib64/qt4/mkspecs/features/yacc.prf \
95 /usr/lib64/qt4/mkspecs/features/lex.prf \
95 /usr/lib64/qt4/mkspecs/features/lex.prf \
96 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \
96 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \
97 fsw-qt.pro
97 fsw-qt.pro
98 QMAKE_TARGET = fsw
98 QMAKE_TARGET = fsw
99 DESTDIR = bin/
99 DESTDIR = bin/
100 TARGET = bin/fsw
100 TARGET = bin/fsw
101
101
102 first: all
102 first: all
103 ####### Implicit rules
103 ####### Implicit rules
104
104
105 .SUFFIXES: .o .c .cpp .cc .cxx .C
105 .SUFFIXES: .o .c .cpp .cc .cxx .C
106
106
107 .cpp.o:
107 .cpp.o:
108 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
108 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
109
109
110 .cc.o:
110 .cc.o:
111 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
111 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
112
112
113 .cxx.o:
113 .cxx.o:
114 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
114 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
115
115
116 .C.o:
116 .C.o:
117 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
117 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
118
118
119 .c.o:
119 .c.o:
120 $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
120 $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
121
121
122 ####### Build rules
122 ####### Build rules
123
123
124 all: Makefile $(TARGET)
124 all: Makefile $(TARGET)
125
125
126 $(TARGET): $(OBJECTS)
126 $(TARGET): $(OBJECTS)
127 @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/
127 @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/
128 $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
128 $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
129
129
130 Makefile: fsw-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \
130 Makefile: fsw-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \
131 /usr/lib64/qt4/mkspecs/common/linux.conf \
131 /usr/lib64/qt4/mkspecs/common/linux.conf \
132 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
132 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
133 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
133 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
134 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
134 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
135 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
135 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
136 /usr/lib64/qt4/mkspecs/qconfig.pri \
136 /usr/lib64/qt4/mkspecs/qconfig.pri \
137 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
137 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
138 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
138 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
139 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
139 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
140 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
140 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
141 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
141 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
142 sparc.pri \
142 sparc.pri \
143 /usr/lib64/qt4/mkspecs/features/release.prf \
143 /usr/lib64/qt4/mkspecs/features/release.prf \
144 /usr/lib64/qt4/mkspecs/features/default_post.prf \
144 /usr/lib64/qt4/mkspecs/features/default_post.prf \
145 /usr/lib64/qt4/mkspecs/features/shared.prf \
145 /usr/lib64/qt4/mkspecs/features/shared.prf \
146 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
146 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
147 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
147 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
148 /usr/lib64/qt4/mkspecs/features/resources.prf \
148 /usr/lib64/qt4/mkspecs/features/resources.prf \
149 /usr/lib64/qt4/mkspecs/features/uic.prf \
149 /usr/lib64/qt4/mkspecs/features/uic.prf \
150 /usr/lib64/qt4/mkspecs/features/yacc.prf \
150 /usr/lib64/qt4/mkspecs/features/yacc.prf \
151 /usr/lib64/qt4/mkspecs/features/lex.prf \
151 /usr/lib64/qt4/mkspecs/features/lex.prf \
152 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf
152 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf
153 $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
153 $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
154 /usr/lib64/qt4/mkspecs/common/unix.conf:
154 /usr/lib64/qt4/mkspecs/common/unix.conf:
155 /usr/lib64/qt4/mkspecs/common/linux.conf:
155 /usr/lib64/qt4/mkspecs/common/linux.conf:
156 /usr/lib64/qt4/mkspecs/common/gcc-base.conf:
156 /usr/lib64/qt4/mkspecs/common/gcc-base.conf:
157 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf:
157 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf:
158 /usr/lib64/qt4/mkspecs/common/g++-base.conf:
158 /usr/lib64/qt4/mkspecs/common/g++-base.conf:
159 /usr/lib64/qt4/mkspecs/common/g++-unix.conf:
159 /usr/lib64/qt4/mkspecs/common/g++-unix.conf:
160 /usr/lib64/qt4/mkspecs/qconfig.pri:
160 /usr/lib64/qt4/mkspecs/qconfig.pri:
161 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri:
161 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri:
162 /usr/lib64/qt4/mkspecs/features/qt_functions.prf:
162 /usr/lib64/qt4/mkspecs/features/qt_functions.prf:
163 /usr/lib64/qt4/mkspecs/features/qt_config.prf:
163 /usr/lib64/qt4/mkspecs/features/qt_config.prf:
164 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf:
164 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf:
165 /usr/lib64/qt4/mkspecs/features/default_pre.prf:
165 /usr/lib64/qt4/mkspecs/features/default_pre.prf:
166 sparc.pri:
166 sparc.pri:
167 /usr/lib64/qt4/mkspecs/features/release.prf:
167 /usr/lib64/qt4/mkspecs/features/release.prf:
168 /usr/lib64/qt4/mkspecs/features/default_post.prf:
168 /usr/lib64/qt4/mkspecs/features/default_post.prf:
169 /usr/lib64/qt4/mkspecs/features/shared.prf:
169 /usr/lib64/qt4/mkspecs/features/shared.prf:
170 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf:
170 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf:
171 /usr/lib64/qt4/mkspecs/features/warn_on.prf:
171 /usr/lib64/qt4/mkspecs/features/warn_on.prf:
172 /usr/lib64/qt4/mkspecs/features/resources.prf:
172 /usr/lib64/qt4/mkspecs/features/resources.prf:
173 /usr/lib64/qt4/mkspecs/features/uic.prf:
173 /usr/lib64/qt4/mkspecs/features/uic.prf:
174 /usr/lib64/qt4/mkspecs/features/yacc.prf:
174 /usr/lib64/qt4/mkspecs/features/yacc.prf:
175 /usr/lib64/qt4/mkspecs/features/lex.prf:
175 /usr/lib64/qt4/mkspecs/features/lex.prf:
176 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf:
176 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf:
177 qmake: FORCE
177 qmake: FORCE
178 @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
178 @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
179
179
180 dist:
180 dist:
181 @$(CHK_DIR_EXISTS) obj/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0
181 @$(CHK_DIR_EXISTS) obj/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0
182 $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/fsw1.0.0/ && (cd `dirname obj/fsw1.0.0` && $(TAR) fsw1.0.0.tar fsw1.0.0 && $(COMPRESS) fsw1.0.0.tar) && $(MOVE) `dirname obj/fsw1.0.0`/fsw1.0.0.tar.gz . && $(DEL_FILE) -r obj/fsw1.0.0
182 $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/fsw1.0.0/ && (cd `dirname obj/fsw1.0.0` && $(TAR) fsw1.0.0.tar fsw1.0.0 && $(COMPRESS) fsw1.0.0.tar) && $(MOVE) `dirname obj/fsw1.0.0`/fsw1.0.0.tar.gz . && $(DEL_FILE) -r obj/fsw1.0.0
183
183
184
184
185 clean:compiler_clean
185 clean:compiler_clean
186 -$(DEL_FILE) $(OBJECTS)
186 -$(DEL_FILE) $(OBJECTS)
187 -$(DEL_FILE) *~ core *.core
187 -$(DEL_FILE) *~ core *.core
188
188
189
189
190 ####### Sub-libraries
190 ####### Sub-libraries
191
191
192 distclean: clean
192 distclean: clean
193 -$(DEL_FILE) $(TARGET)
193 -$(DEL_FILE) $(TARGET)
194 -$(DEL_FILE) Makefile
194 -$(DEL_FILE) Makefile
195
195
196
196
197 grmon:
197 grmon:
198 cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u
198 cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u
199
199
200 check: first
200 check: first
201
201
202 compiler_rcc_make_all:
202 compiler_rcc_make_all:
203 compiler_rcc_clean:
203 compiler_rcc_clean:
204 compiler_uic_make_all:
204 compiler_uic_make_all:
205 compiler_uic_clean:
205 compiler_uic_clean:
206 compiler_image_collection_make_all: qmake_image_collection.cpp
206 compiler_image_collection_make_all: qmake_image_collection.cpp
207 compiler_image_collection_clean:
207 compiler_image_collection_clean:
208 -$(DEL_FILE) qmake_image_collection.cpp
208 -$(DEL_FILE) qmake_image_collection.cpp
209 compiler_yacc_decl_make_all:
209 compiler_yacc_decl_make_all:
210 compiler_yacc_decl_clean:
210 compiler_yacc_decl_clean:
211 compiler_yacc_impl_make_all:
211 compiler_yacc_impl_make_all:
212 compiler_yacc_impl_clean:
212 compiler_yacc_impl_clean:
213 compiler_lex_make_all:
213 compiler_lex_make_all:
214 compiler_lex_clean:
214 compiler_lex_clean:
215 compiler_clean:
215 compiler_clean:
216
216
217 ####### Compile
217 ####### Compile
218
218
219 obj/wf_handler.o: ../src/wf_handler.c
219 obj/wf_handler.o: ../src/wf_handler.c
220 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/wf_handler.o ../src/wf_handler.c
220 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/wf_handler.o ../src/wf_handler.c
221
221
222 obj/tc_handler.o: ../src/tc_handler.c
222 obj/tc_handler.o: ../src/tc_handler.c
223 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o ../src/tc_handler.c
223 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o ../src/tc_handler.c
224
224
225 obj/fsw_misc.o: ../src/fsw_misc.c
225 obj/fsw_misc.o: ../src/fsw_misc.c
226 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c
226 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c
227
227
228 obj/fsw_init.o: ../src/fsw_init.c ../src/fsw_config.c
228 obj/fsw_init.o: ../src/fsw_init.c ../src/fsw_config.c
229 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o ../src/fsw_init.c
229 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o ../src/fsw_init.c
230
230
231 obj/fsw_globals.o: ../src/fsw_globals.c
231 obj/fsw_globals.o: ../src/fsw_globals.c
232 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c
232 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c
233
233
234 obj/fsw_spacewire.o: ../src/fsw_spacewire.c
234 obj/fsw_spacewire.o: ../src/fsw_spacewire.c
235 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spacewire.o ../src/fsw_spacewire.c
235 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spacewire.o ../src/fsw_spacewire.c
236
236
237 obj/tc_load_dump_parameters.o: ../src/tc_load_dump_parameters.c
237 obj/tc_load_dump_parameters.o: ../src/tc_load_dump_parameters.c
238 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_load_dump_parameters.o ../src/tc_load_dump_parameters.c
238 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_load_dump_parameters.o ../src/tc_load_dump_parameters.c
239
239
240 obj/tm_lfr_tc_exe.o: ../src/tm_lfr_tc_exe.c
240 obj/tm_lfr_tc_exe.o: ../src/tm_lfr_tc_exe.c
241 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tm_lfr_tc_exe.o ../src/tm_lfr_tc_exe.c
241 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tm_lfr_tc_exe.o ../src/tm_lfr_tc_exe.c
242
242
243 obj/tc_acceptance.o: ../src/tc_acceptance.c
243 obj/tc_acceptance.o: ../src/tc_acceptance.c
244 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_acceptance.o ../src/tc_acceptance.c
244 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_acceptance.o ../src/tc_acceptance.c
245
245
246 obj/basic_parameters.o: ../src/basic_parameters/basic_parameters.c ../src/basic_parameters/basic_parameters.h
246 obj/basic_parameters.o: ../src/basic_parameters/basic_parameters.c ../src/basic_parameters/basic_parameters.h
247 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/basic_parameters.o ../src/basic_parameters/basic_parameters.c
247 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/basic_parameters.o ../src/basic_parameters/basic_parameters.c
248
248
249 obj/fsw_processing.o: ../src/processing/fsw_processing.c
249 obj/fsw_processing.o: ../src/processing/fsw_processing.c
250 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/processing/fsw_processing.c
250 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/processing/fsw_processing.c
251
251
252 obj/avf0_prc0.o: ../src/processing/avf0_prc0.c
252 obj/avf0_prc0.o: ../src/processing/avf0_prc0.c
253 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf0_prc0.o ../src/processing/avf0_prc0.c
253 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf0_prc0.o ../src/processing/avf0_prc0.c
254
254
255 obj/avf1_prc1.o: ../src/processing/avf1_prc1.c
255 obj/avf1_prc1.o: ../src/processing/avf1_prc1.c
256 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf1_prc1.o ../src/processing/avf1_prc1.c
256 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf1_prc1.o ../src/processing/avf1_prc1.c
257
257
258 obj/avf2_prc2.o: ../src/processing/avf2_prc2.c
258 obj/avf2_prc2.o: ../src/processing/avf2_prc2.c
259 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf2_prc2.o ../src/processing/avf2_prc2.c
259 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf2_prc2.o ../src/processing/avf2_prc2.c
260
260
261 ####### Install
261 ####### Install
262
262
263 install: FORCE
263 install: FORCE
264
264
265 uninstall: FORCE
265 uninstall: FORCE
266
266
267 FORCE:
267 FORCE:
268
268
@@ -1,91 +1,92
1 TEMPLATE = app
1 TEMPLATE = app
2 # CONFIG += console v8 sim
2 # CONFIG += console v8 sim
3 # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** vhdl_dev *** debug_tch
3 # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** vhdl_dev *** debug_tch
4 CONFIG += console verbose cpu_usage_report
4 CONFIG += console verbose cpu_usage_report
5 CONFIG -= qt
5 CONFIG -= qt
6
6
7 include(./sparc.pri)
7 include(./sparc.pri)
8
8
9 # flight software version
9 # flight software version
10 SWVERSION=-1-0
10 SWVERSION=-1-0
11 DEFINES += SW_VERSION_N1=1 # major
11 DEFINES += SW_VERSION_N1=1 # major
12 DEFINES += SW_VERSION_N2=0 # minor
12 DEFINES += SW_VERSION_N2=0 # minor
13 DEFINES += SW_VERSION_N3=0 # patch
13 DEFINES += SW_VERSION_N3=0 # patch
14 DEFINES += SW_VERSION_N4=7 # internal
14 DEFINES += SW_VERSION_N4=7 # internal
15
15
16 contains( CONFIG, debug_tch ) {
16 contains( CONFIG, debug_tch ) {
17 DEFINES += DEBUG_TCH
17 DEFINES += DEBUG_TCH
18 }
18 }
19
19
20 contains( CONFIG, vhdl_dev ) {
20 contains( CONFIG, vhdl_dev ) {
21 DEFINES += VHDL_DEV
21 DEFINES += VHDL_DEV
22 }
22 }
23
23
24 contains( CONFIG, verbose ) {
24 contains( CONFIG, verbose ) {
25 DEFINES += PRINT_MESSAGES_ON_CONSOLE
25 DEFINES += PRINT_MESSAGES_ON_CONSOLE
26 }
26 }
27
27
28 contains( CONFIG, debug_messages ) {
28 contains( CONFIG, debug_messages ) {
29 DEFINES += DEBUG_MESSAGES
29 DEFINES += DEBUG_MESSAGES
30 }
30 }
31
31
32 contains( CONFIG, cpu_usage_report ) {
32 contains( CONFIG, cpu_usage_report ) {
33 DEFINES += PRINT_TASK_STATISTICS
33 DEFINES += PRINT_TASK_STATISTICS
34 }
34 }
35
35
36 contains( CONFIG, stack_report ) {
36 contains( CONFIG, stack_report ) {
37 DEFINES += PRINT_STACK_REPORT
37 DEFINES += PRINT_STACK_REPORT
38 }
38 }
39
39
40 contains( CONFIG, boot_messages ) {
40 contains( CONFIG, boot_messages ) {
41 DEFINES += BOOT_MESSAGES
41 DEFINES += BOOT_MESSAGES
42 }
42 }
43
43
44 #doxygen.target = doxygen
44 #doxygen.target = doxygen
45 #doxygen.commands = doxygen ../doc/Doxyfile
45 #doxygen.commands = doxygen ../doc/Doxyfile
46 #QMAKE_EXTRA_TARGETS += doxygen
46 #QMAKE_EXTRA_TARGETS += doxygen
47
47
48 TARGET = fsw
48 TARGET = fsw
49
49
50 INCLUDEPATH += \
50 INCLUDEPATH += \
51 ../src \
51 ../src \
52 ../header \
52 ../header \
53 ../header/processing \
53 ../header/processing \
54 ../src/basic_parameters
54 ../src/basic_parameters
55
55
56 SOURCES += \
56 SOURCES += \
57 ../src/wf_handler.c \
57 ../src/wf_handler.c \
58 ../src/tc_handler.c \
58 ../src/tc_handler.c \
59 ../src/fsw_misc.c \
59 ../src/fsw_misc.c \
60 ../src/fsw_init.c \
60 ../src/fsw_init.c \
61 ../src/fsw_globals.c \
61 ../src/fsw_globals.c \
62 ../src/fsw_spacewire.c \
62 ../src/fsw_spacewire.c \
63 ../src/tc_load_dump_parameters.c \
63 ../src/tc_load_dump_parameters.c \
64 ../src/tm_lfr_tc_exe.c \
64 ../src/tm_lfr_tc_exe.c \
65 ../src/tc_acceptance.c \
65 ../src/tc_acceptance.c \
66 ../src/basic_parameters/basic_parameters.c \
66 ../src/basic_parameters/basic_parameters.c \
67 ../src/processing/fsw_processing.c \
67 ../src/processing/fsw_processing.c \
68 ../src/processing/avf0_prc0.c \
68 ../src/processing/avf0_prc0.c \
69 ../src/processing/avf1_prc1.c \
69 ../src/processing/avf1_prc1.c \
70 ../src/processing/avf2_prc2.c
70 ../src/processing/avf2_prc2.c
71
71
72 HEADERS += \
72 HEADERS += \
73 ../header/wf_handler.h \
73 ../header/wf_handler.h \
74 ../header/tc_handler.h \
74 ../header/tc_handler.h \
75 ../header/grlib_regs.h \
75 ../header/grlib_regs.h \
76 ../header/fsw_params.h \
76 ../header/fsw_params.h \
77 ../header/fsw_misc.h \
77 ../header/fsw_misc.h \
78 ../header/fsw_init.h \
78 ../header/fsw_init.h \
79 ../header/ccsds_types.h \
79 ../header/ccsds_types.h \
80 ../header/fsw_spacewire.h \
80 ../header/fsw_spacewire.h \
81 ../header/tc_load_dump_parameters.h \
81 ../header/tc_load_dump_parameters.h \
82 ../header/tm_lfr_tc_exe.h \
82 ../header/tm_lfr_tc_exe.h \
83 ../header/tc_acceptance.h \
83 ../header/tc_acceptance.h \
84 ../header/fsw_params_nb_bytes.h \
84 ../header/fsw_params_nb_bytes.h \
85 ../src/basic_parameters/basic_parameters.h \
85 ../src/basic_parameters/basic_parameters.h \
86 ../header/fsw_params_processing.h \
86 ../header/fsw_params_processing.h \
87 ../header/processing/fsw_processing.h \
87 ../header/processing/fsw_processing.h \
88 ../header/processing/avf0_prc0.h \
88 ../header/processing/avf0_prc0.h \
89 ../header/processing/avf1_prc1.h \
89 ../header/processing/avf1_prc1.h \
90 ../header/processing/avf2_prc2.h
90 ../header/processing/avf2_prc2.h \
91 ../header/fsw_params_wf_handler.h
91
92
@@ -1,201 +1,201
1 <?xml version="1.0" encoding="UTF-8"?>
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE QtCreatorProject>
2 <!DOCTYPE QtCreatorProject>
3 <!-- Written by QtCreator 3.0.1, 2014-05-12T06:56:36. -->
3 <!-- Written by QtCreator 3.0.1, 2014-05-13T07:49:30. -->
4 <qtcreator>
4 <qtcreator>
5 <data>
5 <data>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
7 <value type="int">0</value>
7 <value type="int">0</value>
8 </data>
8 </data>
9 <data>
9 <data>
10 <variable>ProjectExplorer.Project.EditorSettings</variable>
10 <variable>ProjectExplorer.Project.EditorSettings</variable>
11 <valuemap type="QVariantMap">
11 <valuemap type="QVariantMap">
12 <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
12 <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
13 <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
13 <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
14 <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
14 <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
15 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
15 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
16 <value type="QString" key="language">Cpp</value>
16 <value type="QString" key="language">Cpp</value>
17 <valuemap type="QVariantMap" key="value">
17 <valuemap type="QVariantMap" key="value">
18 <value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
18 <value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
19 </valuemap>
19 </valuemap>
20 </valuemap>
20 </valuemap>
21 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
21 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
22 <value type="QString" key="language">QmlJS</value>
22 <value type="QString" key="language">QmlJS</value>
23 <valuemap type="QVariantMap" key="value">
23 <valuemap type="QVariantMap" key="value">
24 <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
24 <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
25 </valuemap>
25 </valuemap>
26 </valuemap>
26 </valuemap>
27 <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
27 <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
28 <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
28 <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
29 <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
29 <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
30 <value type="int" key="EditorConfiguration.IndentSize">4</value>
30 <value type="int" key="EditorConfiguration.IndentSize">4</value>
31 <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
31 <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
32 <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
32 <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
33 <value type="int" key="EditorConfiguration.PaddingMode">1</value>
33 <value type="int" key="EditorConfiguration.PaddingMode">1</value>
34 <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
34 <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
35 <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
35 <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
36 <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
36 <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
37 <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
37 <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
38 <value type="int" key="EditorConfiguration.TabSize">8</value>
38 <value type="int" key="EditorConfiguration.TabSize">8</value>
39 <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
39 <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
40 <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
40 <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
41 <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
41 <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
42 <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
42 <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
43 <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
43 <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
44 <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
44 <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
45 </valuemap>
45 </valuemap>
46 </data>
46 </data>
47 <data>
47 <data>
48 <variable>ProjectExplorer.Project.PluginSettings</variable>
48 <variable>ProjectExplorer.Project.PluginSettings</variable>
49 <valuemap type="QVariantMap"/>
49 <valuemap type="QVariantMap"/>
50 </data>
50 </data>
51 <data>
51 <data>
52 <variable>ProjectExplorer.Project.Target.0</variable>
52 <variable>ProjectExplorer.Project.Target.0</variable>
53 <valuemap type="QVariantMap">
53 <valuemap type="QVariantMap">
54 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.2 in PATH (System)</value>
54 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.3 in PATH (System)</value>
55 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.2 in PATH (System)</value>
55 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.3 in PATH (System)</value>
56 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{5289e843-9ef2-45ce-88c6-ad27d8e08def}</value>
56 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{be73cf6a-f9d8-4d5a-8adf-adc2d83e2e44}</value>
57 <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
57 <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
58 <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
58 <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
59 <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
59 <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
60 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
60 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
61 <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory"></value>
61 <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory"></value>
62 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
62 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
63 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
63 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
64 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
64 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
65 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
65 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
66 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
66 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
67 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
67 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
68 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
68 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
69 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value>
69 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value>
70 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
70 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
71 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
71 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
72 </valuemap>
72 </valuemap>
73 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
73 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
74 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
74 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
75 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
75 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
76 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
76 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
77 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
77 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
78 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
78 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
79 <value type="QString">-w</value>
79 <value type="QString">-w</value>
80 <value type="QString">-r</value>
80 <value type="QString">-r</value>
81 </valuelist>
81 </valuelist>
82 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
82 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
83 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
83 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
84 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
84 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
85 </valuemap>
85 </valuemap>
86 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
86 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
87 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
87 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
88 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
88 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
89 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
89 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
90 </valuemap>
90 </valuemap>
91 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
91 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
92 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
92 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
93 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
93 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
94 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
94 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
95 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
95 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
96 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
96 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
97 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
97 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
98 <value type="QString">-w</value>
98 <value type="QString">-w</value>
99 <value type="QString">-r</value>
99 <value type="QString">-r</value>
100 </valuelist>
100 </valuelist>
101 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
101 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
102 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
102 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
103 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
103 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
104 </valuemap>
104 </valuemap>
105 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
105 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
106 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
106 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
107 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
107 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
108 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
108 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
109 </valuemap>
109 </valuemap>
110 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
110 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
111 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
111 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
112 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
112 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
113 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
113 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
114 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
114 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
115 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
115 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
116 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
116 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
117 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
117 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
118 </valuemap>
118 </valuemap>
119 <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value>
119 <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value>
120 <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
120 <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
121 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
121 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
122 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
122 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
123 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
123 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
124 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
124 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
125 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
125 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
126 </valuemap>
126 </valuemap>
127 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
127 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
128 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
128 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
129 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
129 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
130 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
130 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
131 </valuemap>
131 </valuemap>
132 <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
132 <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
133 <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
133 <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
134 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
134 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
135 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
135 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
136 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
136 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
137 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
137 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
138 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
138 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
139 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
139 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
140 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
140 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
141 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
141 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
142 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
142 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
143 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
143 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
144 <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
144 <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
145 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
145 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
146 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
146 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
147 <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
147 <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
148 <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
148 <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
149 <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
149 <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
150 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
150 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
151 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
151 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
152 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
152 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
153 <value type="int">0</value>
153 <value type="int">0</value>
154 <value type="int">1</value>
154 <value type="int">1</value>
155 <value type="int">2</value>
155 <value type="int">2</value>
156 <value type="int">3</value>
156 <value type="int">3</value>
157 <value type="int">4</value>
157 <value type="int">4</value>
158 <value type="int">5</value>
158 <value type="int">5</value>
159 <value type="int">6</value>
159 <value type="int">6</value>
160 <value type="int">7</value>
160 <value type="int">7</value>
161 <value type="int">8</value>
161 <value type="int">8</value>
162 <value type="int">9</value>
162 <value type="int">9</value>
163 <value type="int">10</value>
163 <value type="int">10</value>
164 <value type="int">11</value>
164 <value type="int">11</value>
165 <value type="int">12</value>
165 <value type="int">12</value>
166 <value type="int">13</value>
166 <value type="int">13</value>
167 <value type="int">14</value>
167 <value type="int">14</value>
168 </valuelist>
168 </valuelist>
169 <value type="int" key="PE.EnvironmentAspect.Base">2</value>
169 <value type="int" key="PE.EnvironmentAspect.Base">2</value>
170 <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
170 <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
171 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value>
171 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value>
172 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
172 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
173 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value>
173 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value>
174 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
174 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
175 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value>
175 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value>
176 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
176 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
177 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>
177 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>
178 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
178 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
179 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
179 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
180 <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
180 <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
181 <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
181 <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
182 <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
182 <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
183 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
183 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
184 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
184 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
185 </valuemap>
185 </valuemap>
186 <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
186 <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
187 </valuemap>
187 </valuemap>
188 </data>
188 </data>
189 <data>
189 <data>
190 <variable>ProjectExplorer.Project.TargetCount</variable>
190 <variable>ProjectExplorer.Project.TargetCount</variable>
191 <value type="int">1</value>
191 <value type="int">1</value>
192 </data>
192 </data>
193 <data>
193 <data>
194 <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
194 <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
195 <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value>
195 <value type="QByteArray">{cdbf9cdc-1e84-406e-889b-c4feef49e75c}</value>
196 </data>
196 </data>
197 <data>
197 <data>
198 <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
198 <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
199 <value type="int">15</value>
199 <value type="int">15</value>
200 </data>
200 </data>
201 </qtcreator>
201 </qtcreator>
@@ -1,250 +1,251
1 #ifndef FSW_PARAMS_H_INCLUDED
1 #ifndef FSW_PARAMS_H_INCLUDED
2 #define FSW_PARAMS_H_INCLUDED
2 #define FSW_PARAMS_H_INCLUDED
3
3
4 #include "grlib_regs.h"
4 #include "grlib_regs.h"
5 #include "fsw_params_processing.h"
5 #include "fsw_params_processing.h"
6 #include "fsw_params_nb_bytes.h"
6 #include "fsw_params_nb_bytes.h"
7 #include "tm_byte_positions.h"
7 #include "tm_byte_positions.h"
8 #include "ccsds_types.h"
8 #include "ccsds_types.h"
9
9
10 #define GRSPW_DEVICE_NAME "/dev/grspw0"
10 #define GRSPW_DEVICE_NAME "/dev/grspw0"
11 #define UART_DEVICE_NAME "/dev/console"
11 #define UART_DEVICE_NAME "/dev/console"
12
12
13 typedef struct ring_node
13 typedef struct ring_node
14 {
14 {
15 struct ring_node *previous;
15 struct ring_node *previous;
16 int buffer_address;
16 int buffer_address;
17 struct ring_node *next;
17 struct ring_node *next;
18 unsigned int status;
18 unsigned int status;
19 } ring_node;
19 } ring_node;
20
20
21 //************************
21 //************************
22 // flight software version
22 // flight software version
23 // this parameters is handled by the Qt project options
23 // this parameters is handled by the Qt project options
24
24
25 #define NB_PACKETS_PER_GROUP_OF_CWF 8 // 8 packets containing 336 blk
25 #define NB_PACKETS_PER_GROUP_OF_CWF 8 // 8 packets containing 336 blk
26 #define NB_PACKETS_PER_GROUP_OF_CWF_LIGHT 4 // 4 packets containing 672 blk
26 #define NB_PACKETS_PER_GROUP_OF_CWF_LIGHT 4 // 4 packets containing 672 blk
27 #define NB_SAMPLES_PER_SNAPSHOT 2688 // 336 * 8 = 672 * 4 = 2688
27 #define NB_SAMPLES_PER_SNAPSHOT 2688 // 336 * 8 = 672 * 4 = 2688
28 #define TIME_OFFSET 2
28 #define TIME_OFFSET 2
29 #define TIME_OFFSET_IN_BYTES 8
29 #define TIME_OFFSET_IN_BYTES 8
30 #define WAVEFORM_EXTENDED_HEADER_OFFSET 22
30 #define WAVEFORM_EXTENDED_HEADER_OFFSET 22
31 #define NB_BYTES_SWF_BLK (2 * 6)
31 #define NB_BYTES_SWF_BLK (2 * 6)
32 #define NB_WORDS_SWF_BLK 3
32 #define NB_WORDS_SWF_BLK 3
33 #define NB_BYTES_CWF3_LIGHT_BLK 6
33 #define NB_BYTES_CWF3_LIGHT_BLK 6
34 #define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8
34 #define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8
35 #define NB_RING_NODES_F0 3 // AT LEAST 3
35 #define NB_RING_NODES_F0 3 // AT LEAST 3
36 #define NB_RING_NODES_F1 5 // AT LEAST 3
36 #define NB_RING_NODES_F1 5 // AT LEAST 3
37 #define NB_RING_NODES_F2 5 // AT LEAST 3
37 #define NB_RING_NODES_F2 5 // AT LEAST 3
38 #define NB_RING_NODES_F3 3 // AT LEAST 3
38
39
39 //**********
40 //**********
40 // LFR MODES
41 // LFR MODES
41 #define LFR_MODE_STANDBY 0
42 #define LFR_MODE_STANDBY 0
42 #define LFR_MODE_NORMAL 1
43 #define LFR_MODE_NORMAL 1
43 #define LFR_MODE_BURST 2
44 #define LFR_MODE_BURST 2
44 #define LFR_MODE_SBM1 3
45 #define LFR_MODE_SBM1 3
45 #define LFR_MODE_SBM2 4
46 #define LFR_MODE_SBM2 4
46
47
47 #define TDS_MODE_LFM 5
48 #define TDS_MODE_LFM 5
48 #define TDS_MODE_STANDBY 0
49 #define TDS_MODE_STANDBY 0
49 #define TDS_MODE_NORMAL 1
50 #define TDS_MODE_NORMAL 1
50 #define TDS_MODE_BURST 2
51 #define TDS_MODE_BURST 2
51 #define TDS_MODE_SBM1 3
52 #define TDS_MODE_SBM1 3
52 #define TDS_MODE_SBM2 4
53 #define TDS_MODE_SBM2 4
53
54
54 #define THR_MODE_STANDBY 0
55 #define THR_MODE_STANDBY 0
55 #define THR_MODE_NORMAL 1
56 #define THR_MODE_NORMAL 1
56 #define THR_MODE_BURST 2
57 #define THR_MODE_BURST 2
57
58
58 #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0
59 #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0
59 #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1
60 #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1
60 #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2
61 #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2
61 #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3
62 #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3
62 #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4
63 #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4
63 #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5
64 #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5
64 #define RTEMS_EVENT_NORM_BP1_F0 RTEMS_EVENT_6
65 #define RTEMS_EVENT_NORM_BP1_F0 RTEMS_EVENT_6
65 #define RTEMS_EVENT_NORM_BP2_F0 RTEMS_EVENT_7
66 #define RTEMS_EVENT_NORM_BP2_F0 RTEMS_EVENT_7
66 #define RTEMS_EVENT_NORM_ASM_F0 RTEMS_EVENT_8 // ASM only in NORM mode
67 #define RTEMS_EVENT_NORM_ASM_F0 RTEMS_EVENT_8 // ASM only in NORM mode
67 #define RTEMS_EVENT_NORM_BP1_F1 RTEMS_EVENT_9
68 #define RTEMS_EVENT_NORM_BP1_F1 RTEMS_EVENT_9
68 #define RTEMS_EVENT_NORM_BP2_F1 RTEMS_EVENT_10
69 #define RTEMS_EVENT_NORM_BP2_F1 RTEMS_EVENT_10
69 #define RTEMS_EVENT_NORM_ASM_F1 RTEMS_EVENT_11 // ASM only in NORM mode
70 #define RTEMS_EVENT_NORM_ASM_F1 RTEMS_EVENT_11 // ASM only in NORM mode
70 #define RTEMS_EVENT_NORM_BP1_F2 RTEMS_EVENT_12
71 #define RTEMS_EVENT_NORM_BP1_F2 RTEMS_EVENT_12
71 #define RTEMS_EVENT_NORM_BP2_F2 RTEMS_EVENT_13
72 #define RTEMS_EVENT_NORM_BP2_F2 RTEMS_EVENT_13
72 #define RTEMS_EVENT_NORM_ASM_F2 RTEMS_EVENT_14 // ASM only in NORM mode
73 #define RTEMS_EVENT_NORM_ASM_F2 RTEMS_EVENT_14 // ASM only in NORM mode
73 #define RTEMS_EVENT_BURST_SBM_BP1_F0 RTEMS_EVENT_15
74 #define RTEMS_EVENT_BURST_SBM_BP1_F0 RTEMS_EVENT_15
74 #define RTEMS_EVENT_BURST_SBM_BP2_F0 RTEMS_EVENT_16
75 #define RTEMS_EVENT_BURST_SBM_BP2_F0 RTEMS_EVENT_16
75 #define RTEMS_EVENT_BURST_SBM_BP1_F1 RTEMS_EVENT_17
76 #define RTEMS_EVENT_BURST_SBM_BP1_F1 RTEMS_EVENT_17
76 #define RTEMS_EVENT_BURST_SBM_BP2_F1 RTEMS_EVENT_18
77 #define RTEMS_EVENT_BURST_SBM_BP2_F1 RTEMS_EVENT_18
77
78
78 //****************************
79 //****************************
79 // LFR DEFAULT MODE PARAMETERS
80 // LFR DEFAULT MODE PARAMETERS
80 // COMMON
81 // COMMON
81 #define DEFAULT_SY_LFR_COMMON0 0x00
82 #define DEFAULT_SY_LFR_COMMON0 0x00
82 #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0
83 #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0
83 // NORM
84 // NORM
84 #define SY_LFR_N_SWF_L 2048 // nb sample
85 #define SY_LFR_N_SWF_L 2048 // nb sample
85 #define SY_LFR_N_SWF_P 300 // sec
86 #define SY_LFR_N_SWF_P 300 // sec
86 #define SY_LFR_N_ASM_P 3600 // sec
87 #define SY_LFR_N_ASM_P 3600 // sec
87 #define SY_LFR_N_BP_P0 4 // sec
88 #define SY_LFR_N_BP_P0 4 // sec
88 #define SY_LFR_N_BP_P1 20 // sec
89 #define SY_LFR_N_BP_P1 20 // sec
89 #define SY_LFR_N_CWF_LONG_F3 0 // 0 => production of light continuous waveforms at f3
90 #define SY_LFR_N_CWF_LONG_F3 0 // 0 => production of light continuous waveforms at f3
90 #define MIN_DELTA_SNAPSHOT 16 // sec
91 #define MIN_DELTA_SNAPSHOT 16 // sec
91 // BURST
92 // BURST
92 #define DEFAULT_SY_LFR_B_BP_P0 1 // sec
93 #define DEFAULT_SY_LFR_B_BP_P0 1 // sec
93 #define DEFAULT_SY_LFR_B_BP_P1 5 // sec
94 #define DEFAULT_SY_LFR_B_BP_P1 5 // sec
94 // SBM1
95 // SBM1
95 #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec
96 #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec
96 #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec
97 #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec
97 // SBM2
98 // SBM2
98 #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec
99 #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec
99 #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec
100 #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec
100 // ADDITIONAL PARAMETERS
101 // ADDITIONAL PARAMETERS
101 #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms
102 #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms
102 #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s
103 #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s
103 // STATUS WORD
104 // STATUS WORD
104 #define DEFAULT_STATUS_WORD_BYTE0 0x0d // [0000] [1] [101] mode 4 bits / SPW enabled 1 bit / state is run 3 bits
105 #define DEFAULT_STATUS_WORD_BYTE0 0x0d // [0000] [1] [101] mode 4 bits / SPW enabled 1 bit / state is run 3 bits
105 #define DEFAULT_STATUS_WORD_BYTE1 0x00
106 #define DEFAULT_STATUS_WORD_BYTE1 0x00
106 //
107 //
107 #define SY_LFR_DPU_CONNECT_TIMEOUT 100 // 100 * 10 ms = 1 s
108 #define SY_LFR_DPU_CONNECT_TIMEOUT 100 // 100 * 10 ms = 1 s
108 #define SY_LFR_DPU_CONNECT_ATTEMPT 3
109 #define SY_LFR_DPU_CONNECT_ATTEMPT 3
109 //****************************
110 //****************************
110
111
111 //*****************************
112 //*****************************
112 // APB REGISTERS BASE ADDRESSES
113 // APB REGISTERS BASE ADDRESSES
113 #define REGS_ADDR_APBUART 0x80000100
114 #define REGS_ADDR_APBUART 0x80000100
114 #define REGS_ADDR_GPTIMER 0x80000300
115 #define REGS_ADDR_GPTIMER 0x80000300
115 #define REGS_ADDR_GRSPW 0x80000500
116 #define REGS_ADDR_GRSPW 0x80000500
116 #define REGS_ADDR_TIME_MANAGEMENT 0x80000600
117 #define REGS_ADDR_TIME_MANAGEMENT 0x80000600
117 #define REGS_ADDR_GRGPIO 0x80000b00
118 #define REGS_ADDR_GRGPIO 0x80000b00
118
119
119 #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00
120 #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00
120 #define REGS_ADDR_WAVEFORM_PICKER 0x80000f40
121 #define REGS_ADDR_WAVEFORM_PICKER 0x80000f40
121
122
122 #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff
123 #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff
123 #define APBUART_CTRL_REG_MASK_TE 0x00000002
124 #define APBUART_CTRL_REG_MASK_TE 0x00000002
124 #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50)
125 #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50)
125
126
126 //**********
127 //**********
127 // IRQ LINES
128 // IRQ LINES
128 #define IRQ_SM_SIMULATOR 9
129 #define IRQ_SM_SIMULATOR 9
129 #define IRQ_SPARC_SM_SIMULATOR 0x19 // see sparcv8.pdf p.76 for interrupt levels
130 #define IRQ_SPARC_SM_SIMULATOR 0x19 // see sparcv8.pdf p.76 for interrupt levels
130 #define IRQ_WAVEFORM_PICKER 14
131 #define IRQ_WAVEFORM_PICKER 14
131 #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels
132 #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels
132 #define IRQ_SPECTRAL_MATRIX 6
133 #define IRQ_SPECTRAL_MATRIX 6
133 #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels
134 #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels
134
135
135 //*****
136 //*****
136 // TIME
137 // TIME
137 #define CLKDIV_SM_SIMULATOR (10416 - 1) // 10 ms => nominal is 1/96 = 0.010416667, 10417 - 1 = 10416
138 #define CLKDIV_SM_SIMULATOR (10416 - 1) // 10 ms => nominal is 1/96 = 0.010416667, 10417 - 1 = 10416
138 #define TIMER_SM_SIMULATOR 1
139 #define TIMER_SM_SIMULATOR 1
139 #define HK_PERIOD 100 // 100 * 10ms => 1s
140 #define HK_PERIOD 100 // 100 * 10ms => 1s
140 #define SY_LFR_TIME_SYN_TIMEOUT_in_ms 2000
141 #define SY_LFR_TIME_SYN_TIMEOUT_in_ms 2000
141 #define SY_LFR_TIME_SYN_TIMEOUT_in_ticks 200 // 200 * 10 ms = 2 s
142 #define SY_LFR_TIME_SYN_TIMEOUT_in_ticks 200 // 200 * 10 ms = 2 s
142
143
143 //**********
144 //**********
144 // LPP CODES
145 // LPP CODES
145 #define LFR_SUCCESSFUL 0
146 #define LFR_SUCCESSFUL 0
146 #define LFR_DEFAULT 1
147 #define LFR_DEFAULT 1
147 #define LFR_EXE_ERROR 2
148 #define LFR_EXE_ERROR 2
148
149
149 //******
150 //******
150 // RTEMS
151 // RTEMS
151 #define TASKID_RECV 1
152 #define TASKID_RECV 1
152 #define TASKID_ACTN 2
153 #define TASKID_ACTN 2
153 #define TASKID_SPIQ 3
154 #define TASKID_SPIQ 3
154 #define TASKID_STAT 4
155 #define TASKID_STAT 4
155 #define TASKID_AVF0 5
156 #define TASKID_AVF0 5
156 #define TASKID_SWBD 6
157 #define TASKID_SWBD 6
157 #define TASKID_WFRM 7
158 #define TASKID_WFRM 7
158 #define TASKID_DUMB 8
159 #define TASKID_DUMB 8
159 #define TASKID_HOUS 9
160 #define TASKID_HOUS 9
160 #define TASKID_PRC0 10
161 #define TASKID_PRC0 10
161 #define TASKID_CWF3 11
162 #define TASKID_CWF3 11
162 #define TASKID_CWF2 12
163 #define TASKID_CWF2 12
163 #define TASKID_CWF1 13
164 #define TASKID_CWF1 13
164 #define TASKID_SEND 14
165 #define TASKID_SEND 14
165 #define TASKID_WTDG 15
166 #define TASKID_WTDG 15
166 #define TASKID_AVF1 16
167 #define TASKID_AVF1 16
167 #define TASKID_PRC1 17
168 #define TASKID_PRC1 17
168 #define TASKID_AVF2 18
169 #define TASKID_AVF2 18
169 #define TASKID_PRC2 19
170 #define TASKID_PRC2 19
170
171
171 #define TASK_PRIORITY_SPIQ 5
172 #define TASK_PRIORITY_SPIQ 5
172 #define TASK_PRIORITY_WTDG 20
173 #define TASK_PRIORITY_WTDG 20
173 #define TASK_PRIORITY_HOUS 30
174 #define TASK_PRIORITY_HOUS 30
174 #define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together
175 #define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together
175 #define TASK_PRIORITY_CWF2 35 //
176 #define TASK_PRIORITY_CWF2 35 //
176 #define TASK_PRIORITY_SWBD 37 // SWBD has a lower priority than WFRM, this is to extract the snapshot before sending it
177 #define TASK_PRIORITY_SWBD 37 // SWBD has a lower priority than WFRM, this is to extract the snapshot before sending it
177 #define TASK_PRIORITY_WFRM 40
178 #define TASK_PRIORITY_WFRM 40
178 #define TASK_PRIORITY_CWF3 40 // there is a printf in this function, be careful with its priority wrt CWF1
179 #define TASK_PRIORITY_CWF3 40 // there is a printf in this function, be careful with its priority wrt CWF1
179 #define TASK_PRIORITY_SEND 45
180 #define TASK_PRIORITY_SEND 45
180 #define TASK_PRIORITY_RECV 50
181 #define TASK_PRIORITY_RECV 50
181 #define TASK_PRIORITY_ACTN 50
182 #define TASK_PRIORITY_ACTN 50
182 #define TASK_PRIORITY_AVF0 60
183 #define TASK_PRIORITY_AVF0 60
183 #define TASK_PRIORITY_AVF1 70
184 #define TASK_PRIORITY_AVF1 70
184 #define TASK_PRIORITY_PRC0 100
185 #define TASK_PRIORITY_PRC0 100
185 #define TASK_PRIORITY_PRC1 100
186 #define TASK_PRIORITY_PRC1 100
186 #define TASK_PRIORITY_AVF2 110
187 #define TASK_PRIORITY_AVF2 110
187 #define TASK_PRIORITY_PRC2 110
188 #define TASK_PRIORITY_PRC2 110
188 #define TASK_PRIORITY_STAT 200
189 #define TASK_PRIORITY_STAT 200
189 #define TASK_PRIORITY_DUMB 200
190 #define TASK_PRIORITY_DUMB 200
190
191
191 #define MSG_QUEUE_COUNT_RECV 10
192 #define MSG_QUEUE_COUNT_RECV 10
192 #define MSG_QUEUE_COUNT_SEND 50
193 #define MSG_QUEUE_COUNT_SEND 50
193 #define MSG_QUEUE_COUNT_PRC0 10
194 #define MSG_QUEUE_COUNT_PRC0 10
194 #define MSG_QUEUE_COUNT_PRC1 10
195 #define MSG_QUEUE_COUNT_PRC1 10
195 #define MSG_QUEUE_COUNT_PRC2 5
196 #define MSG_QUEUE_COUNT_PRC2 5
196 #define MSG_QUEUE_SIZE_SEND 810 // 806 + 4 => TM_LFR_SCIENCE_BURST_BP2_F1
197 #define MSG_QUEUE_SIZE_SEND 810 // 806 + 4 => TM_LFR_SCIENCE_BURST_BP2_F1
197 #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options
198 #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options
198 #define MSG_QUEUE_SIZE_PRC0 20 // two pointers and one rtems_event + 2 integers
199 #define MSG_QUEUE_SIZE_PRC0 20 // two pointers and one rtems_event + 2 integers
199 #define MSG_QUEUE_SIZE_PRC1 20 // two pointers and one rtems_event + 2 integers
200 #define MSG_QUEUE_SIZE_PRC1 20 // two pointers and one rtems_event + 2 integers
200 #define MSG_QUEUE_SIZE_PRC2 20 // two pointers and one rtems_event + 2 integers
201 #define MSG_QUEUE_SIZE_PRC2 20 // two pointers and one rtems_event + 2 integers
201
202
202 #define QUEUE_RECV 0
203 #define QUEUE_RECV 0
203 #define QUEUE_SEND 1
204 #define QUEUE_SEND 1
204 #define QUEUE_PRC0 2
205 #define QUEUE_PRC0 2
205 #define QUEUE_PRC1 3
206 #define QUEUE_PRC1 3
206 #define QUEUE_PRC2 4
207 #define QUEUE_PRC2 4
207
208
208 //*******
209 //*******
209 // MACROS
210 // MACROS
210 #ifdef PRINT_MESSAGES_ON_CONSOLE
211 #ifdef PRINT_MESSAGES_ON_CONSOLE
211 #define PRINTF(x) printf(x);
212 #define PRINTF(x) printf(x);
212 #define PRINTF1(x,y) printf(x,y);
213 #define PRINTF1(x,y) printf(x,y);
213 #define PRINTF2(x,y,z) printf(x,y,z);
214 #define PRINTF2(x,y,z) printf(x,y,z);
214 #else
215 #else
215 #define PRINTF(x) ;
216 #define PRINTF(x) ;
216 #define PRINTF1(x,y) ;
217 #define PRINTF1(x,y) ;
217 #define PRINTF2(x,y,z) ;
218 #define PRINTF2(x,y,z) ;
218 #endif
219 #endif
219
220
220 #ifdef BOOT_MESSAGES
221 #ifdef BOOT_MESSAGES
221 #define BOOT_PRINTF(x) printf(x);
222 #define BOOT_PRINTF(x) printf(x);
222 #define BOOT_PRINTF1(x,y) printf(x,y);
223 #define BOOT_PRINTF1(x,y) printf(x,y);
223 #define BOOT_PRINTF2(x,y,z) printf(x,y,z);
224 #define BOOT_PRINTF2(x,y,z) printf(x,y,z);
224 #else
225 #else
225 #define BOOT_PRINTF(x) ;
226 #define BOOT_PRINTF(x) ;
226 #define BOOT_PRINTF1(x,y) ;
227 #define BOOT_PRINTF1(x,y) ;
227 #define BOOT_PRINTF2(x,y,z) ;
228 #define BOOT_PRINTF2(x,y,z) ;
228 #endif
229 #endif
229
230
230 #ifdef DEBUG_MESSAGES
231 #ifdef DEBUG_MESSAGES
231 #define DEBUG_PRINTF(x) printf(x);
232 #define DEBUG_PRINTF(x) printf(x);
232 #define DEBUG_PRINTF1(x,y) printf(x,y);
233 #define DEBUG_PRINTF1(x,y) printf(x,y);
233 #define DEBUG_PRINTF2(x,y,z) printf(x,y,z);
234 #define DEBUG_PRINTF2(x,y,z) printf(x,y,z);
234 #else
235 #else
235 #define DEBUG_PRINTF(x) ;
236 #define DEBUG_PRINTF(x) ;
236 #define DEBUG_PRINTF1(x,y) ;
237 #define DEBUG_PRINTF1(x,y) ;
237 #define DEBUG_PRINTF2(x,y,z) ;
238 #define DEBUG_PRINTF2(x,y,z) ;
238 #endif
239 #endif
239
240
240 #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period
241 #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period
241
242
242 struct param_local_str{
243 struct param_local_str{
243 unsigned int local_sbm1_nb_cwf_sent;
244 unsigned int local_sbm1_nb_cwf_sent;
244 unsigned int local_sbm1_nb_cwf_max;
245 unsigned int local_sbm1_nb_cwf_max;
245 unsigned int local_sbm2_nb_cwf_sent;
246 unsigned int local_sbm2_nb_cwf_sent;
246 unsigned int local_sbm2_nb_cwf_max;
247 unsigned int local_sbm2_nb_cwf_max;
247 unsigned int local_nb_interrupt_f0_MAX;
248 unsigned int local_nb_interrupt_f0_MAX;
248 };
249 };
249
250
250 #endif // FSW_PARAMS_H_INCLUDED
251 #endif // FSW_PARAMS_H_INCLUDED
@@ -1,98 +1,95
1 #ifndef WF_HANDLER_H_INCLUDED
1 #ifndef WF_HANDLER_H_INCLUDED
2 #define WF_HANDLER_H_INCLUDED
2 #define WF_HANDLER_H_INCLUDED
3
3
4 #include <rtems.h>
4 #include <rtems.h>
5 #include <grspw.h>
5 #include <grspw.h>
6 #include <stdio.h>
6 #include <stdio.h>
7 #include <math.h>
7 #include <math.h>
8
8
9 #include "fsw_params.h"
9 #include "fsw_params.h"
10 #include "fsw_spacewire.h"
10 #include "fsw_spacewire.h"
11 #include "fsw_misc.h"
11 #include "fsw_misc.h"
12 #include "fsw_params_wf_handler.h"
12
13
13 #define pi 3.1415
14 #define pi 3.1415
14
15
15 extern int fdSPW;
16 extern int fdSPW;
16
17
17 //*****************
18 //*****************
18 // waveform buffers
19 // waveform buffers
19 // F0
20 extern volatile int wf_snap_f0[ ];
20 //extern volatile int wf_snap_f0[ ];
21 extern volatile int wf_snap_f1[ ];
21 // F1 F2
22 extern volatile int wf_snap_f2[ ];
22 extern volatile int wf_snap_f0[ ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 62 ];
23 extern volatile int wf_cont_f3[ ];
23 extern volatile int wf_snap_f1[ ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 62 ];
24 extern volatile int wf_snap_f2[ ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 62 ];
25 // F3
26 extern volatile int wf_cont_f3_a[ ];
27 extern volatile int wf_cont_f3_b[ ];
28 extern char wf_cont_f3_light[ ];
24 extern char wf_cont_f3_light[ ];
29
25
30 extern waveform_picker_regs_new_t *waveform_picker_regs;
26 extern waveform_picker_regs_new_t *waveform_picker_regs;
31 extern time_management_regs_t *time_management_regs;
27 extern time_management_regs_t *time_management_regs;
32 extern Packet_TM_LFR_HK_t housekeeping_packet;
28 extern Packet_TM_LFR_HK_t housekeeping_packet;
33 extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
29 extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
34 extern struct param_local_str param_local;
30 extern struct param_local_str param_local;
35
31
36 extern unsigned short sequenceCounters_SCIENCE_NORMAL_BURST;
32 extern unsigned short sequenceCounters_SCIENCE_NORMAL_BURST;
37 extern unsigned short sequenceCounters_SCIENCE_SBM1_SBM2;
33 extern unsigned short sequenceCounters_SCIENCE_SBM1_SBM2;
38
34
39 extern rtems_id Task_id[20]; /* array of task ids */
35 extern rtems_id Task_id[20]; /* array of task ids */
40
36
41 extern unsigned char lfrCurrentMode;
37 extern unsigned char lfrCurrentMode;
42
38
43 //**********
39 //**********
44 // RTEMS_ISR
40 // RTEMS_ISR
45 void reset_extractSWF( void );
41 void reset_extractSWF( void );
46 rtems_isr waveforms_isr( rtems_vector_number vector );
42 rtems_isr waveforms_isr( rtems_vector_number vector );
47
43
48 //***********
44 //***********
49 // RTEMS_TASK
45 // RTEMS_TASK
50 rtems_task wfrm_task( rtems_task_argument argument );
46 rtems_task wfrm_task( rtems_task_argument argument );
51 rtems_task cwf3_task( rtems_task_argument argument );
47 rtems_task cwf3_task( rtems_task_argument argument );
52 rtems_task cwf2_task( rtems_task_argument argument );
48 rtems_task cwf2_task( rtems_task_argument argument );
53 rtems_task cwf1_task( rtems_task_argument argument );
49 rtems_task cwf1_task( rtems_task_argument argument );
54 rtems_task swbd_task( rtems_task_argument argument );
50 rtems_task swbd_task( rtems_task_argument argument );
55
51
56 //******************
52 //******************
57 // general functions
53 // general functions
58 void init_waveforms( void );
54 void init_waveforms( void );
59 void init_waveform_rings( void );
55 void init_waveform_rings( void );
56 void init_waveform_ring( ring_node waveform_ring[], unsigned char nbNodes, volatile int wfrm[] );
60 void reset_current_ring_nodes( void );
57 void reset_current_ring_nodes( void );
61 //
58 //
62 int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF );
59 int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF );
63 int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF );
60 int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF );
64 int init_header_continuous_cwf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF );
61 int init_header_continuous_cwf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF );
65 //
62 //
66 int send_waveform_SWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id );
63 int send_waveform_SWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id );
67 int send_waveform_CWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
64 int send_waveform_CWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
68 int send_waveform_CWF3( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
65 int send_waveform_CWF3( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
69 int send_waveform_CWF3_light( volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
66 int send_waveform_CWF3_light( volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
70 //
67 //
71 void compute_acquisition_time(unsigned int coarseTime, unsigned int fineTime,
68 void compute_acquisition_time(unsigned int coarseTime, unsigned int fineTime,
72 unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char *acquisitionTime );
69 unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char *acquisitionTime );
73 void build_snapshot_from_ring(ring_node *ring_node_to_send , unsigned char frequencyChannel );
70 void build_snapshot_from_ring(ring_node *ring_node_to_send , unsigned char frequencyChannel );
74 void build_acquisition_time( unsigned long long int * acquisitionTimeAslong, ring_node *current_ring_node );
71 void build_acquisition_time( unsigned long long int * acquisitionTimeAslong, ring_node *current_ring_node );
75 //
72 //
76 rtems_id get_pkts_queue_id( void );
73 rtems_id get_pkts_queue_id( void );
77
74
78 //**************
75 //**************
79 // wfp registers
76 // wfp registers
80 // RESET
77 // RESET
81 void reset_wfp_burst_enable( void );
78 void reset_wfp_burst_enable( void );
82 void reset_wfp_status(void);
79 void reset_wfp_status(void);
83 void reset_waveform_picker_regs( void );
80 void reset_waveform_picker_regs( void );
84 // SET
81 // SET
85 void set_wfp_data_shaping(void);
82 void set_wfp_data_shaping(void);
86 void set_wfp_burst_enable_register( unsigned char mode );
83 void set_wfp_burst_enable_register( unsigned char mode );
87 void set_wfp_delta_snapshot( void );
84 void set_wfp_delta_snapshot( void );
88 void set_wfp_delta_f0_f0_2( void );
85 void set_wfp_delta_f0_f0_2( void );
89 void set_wfp_delta_f1( void );
86 void set_wfp_delta_f1( void );
90 void set_wfp_delta_f2( void );
87 void set_wfp_delta_f2( void );
91
88
92 //*****************
89 //*****************
93 // local parameters
90 // local parameters
94 void set_local_nb_interrupt_f0_MAX( void );
91 void set_local_nb_interrupt_f0_MAX( void );
95
92
96 void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid );
93 void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid );
97
94
98 #endif // WF_HANDLER_H_INCLUDED
95 #endif // WF_HANDLER_H_INCLUDED
@@ -1,75 +1,73
1 /** Global variables of the LFR flight software.
1 /** Global variables of the LFR flight software.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * Among global variables, there are:
6 * Among global variables, there are:
7 * - RTEMS names and id.
7 * - RTEMS names and id.
8 * - APB configuration registers.
8 * - APB configuration registers.
9 * - waveforms global buffers, used by the waveform picker hardware module to store data.
9 * - waveforms global buffers, used by the waveform picker hardware module to store data.
10 * - spectral matrices buffesr, used by the hardware module to store data.
10 * - spectral matrices buffesr, used by the hardware module to store data.
11 * - variable related to LFR modes parameters.
11 * - variable related to LFR modes parameters.
12 * - the global HK packet buffer.
12 * - the global HK packet buffer.
13 * - the global dump parameter buffer.
13 * - the global dump parameter buffer.
14 *
14 *
15 */
15 */
16
16
17 #include <rtems.h>
17 #include <rtems.h>
18 #include <grspw.h>
18 #include <grspw.h>
19
19
20 #include "ccsds_types.h"
20 #include "ccsds_types.h"
21 #include "grlib_regs.h"
21 #include "grlib_regs.h"
22 #include "fsw_params.h"
22 #include "fsw_params.h"
23 #include "fsw_params_wf_handler.h"
23
24
24 // RTEMS GLOBAL VARIABLES
25 // RTEMS GLOBAL VARIABLES
25 rtems_name misc_name[5];
26 rtems_name misc_name[5];
26 rtems_id misc_id[5];
27 rtems_id misc_id[5];
27 rtems_name Task_name[20]; /* array of task names */
28 rtems_name Task_name[20]; /* array of task names */
28 rtems_id Task_id[20]; /* array of task ids */
29 rtems_id Task_id[20]; /* array of task ids */
29 unsigned int maxCount;
30 unsigned int maxCount;
30 int fdSPW = 0;
31 int fdSPW = 0;
31 int fdUART = 0;
32 int fdUART = 0;
32 unsigned char lfrCurrentMode;
33 unsigned char lfrCurrentMode;
33
34
34 // WAVEFORMS GLOBAL VARIABLES // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes = 24584
35 // WAVEFORMS GLOBAL VARIABLES // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes = 24584
35 // 97 * 256 = 24832 => delta = 248 bytes = 62 words
36 // 97 * 256 = 24832 => delta = 248 bytes = 62 words
36 // WAVEFORMS GLOBAL VARIABLES // 2688 * 3 * 4 + 2 * 4 = 32256 + 8 bytes = 32264
37 // WAVEFORMS GLOBAL VARIABLES // 2688 * 3 * 4 + 2 * 4 = 32256 + 8 bytes = 32264
37 // 127 * 256 = 32512 => delta = 248 bytes = 62 words
38 // 127 * 256 = 32512 => delta = 248 bytes = 62 words
38 // F0
39 // F0 F1 F2 F3
39 volatile int wf_snap_f0[ NB_RING_NODES_F0 ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 62 ] __attribute__((aligned(0x100)));
40 volatile int wf_snap_f0[ NB_RING_NODES_F0 * WFRM_BUFFER ] __attribute__((aligned(0x100)));
40 // F1 F2
41 volatile int wf_snap_f1[ NB_RING_NODES_F1 * WFRM_BUFFER ] __attribute__((aligned(0x100)));
41 volatile int wf_snap_f1[ NB_RING_NODES_F1 ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 62 ] __attribute__((aligned(0x100)));
42 volatile int wf_snap_f2[ NB_RING_NODES_F2 * WFRM_BUFFER ] __attribute__((aligned(0x100)));
42 volatile int wf_snap_f2[ NB_RING_NODES_F2 ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 62 ] __attribute__((aligned(0x100)));
43 volatile int wf_cont_f3[ NB_RING_NODES_F3 * WFRM_BUFFER ] __attribute__((aligned(0x100)));
43 // F3
44 volatile int wf_cont_f3_a [ (NB_SAMPLES_PER_SNAPSHOT) * NB_WORDS_SWF_BLK + TIME_OFFSET ] __attribute__((aligned(0x100)));
45 volatile int wf_cont_f3_b [ (NB_SAMPLES_PER_SNAPSHOT) * NB_WORDS_SWF_BLK + TIME_OFFSET ] __attribute__((aligned(0x100)));
46 char wf_cont_f3_light[ (NB_SAMPLES_PER_SNAPSHOT) * NB_BYTES_CWF3_LIGHT_BLK + TIME_OFFSET_IN_BYTES ] __attribute__((aligned(0x100)));
44 char wf_cont_f3_light[ (NB_SAMPLES_PER_SNAPSHOT) * NB_BYTES_CWF3_LIGHT_BLK + TIME_OFFSET_IN_BYTES ] __attribute__((aligned(0x100)));
47
45
48 //***********************************
46 //***********************************
49 // SPECTRAL MATRICES GLOBAL VARIABLES
47 // SPECTRAL MATRICES GLOBAL VARIABLES
50
48
51 // alignment constraints for the spectral matrices buffers => the first data after the time (8 bytes) shall be aligned on 0x00
49 // alignment constraints for the spectral matrices buffers => the first data after the time (8 bytes) shall be aligned on 0x00
52 volatile int sm_f0[ NB_RING_NODES_SM_F0 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100)));
50 volatile int sm_f0[ NB_RING_NODES_SM_F0 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100)));
53 volatile int sm_f1[ NB_RING_NODES_SM_F1 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100)));
51 volatile int sm_f1[ NB_RING_NODES_SM_F1 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100)));
54 volatile int sm_f2[ NB_RING_NODES_SM_F2 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100)));
52 volatile int sm_f2[ NB_RING_NODES_SM_F2 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100)));
55
53
56 // APB CONFIGURATION REGISTERS
54 // APB CONFIGURATION REGISTERS
57 time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT;
55 time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT;
58 gptimer_regs_t *gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER;
56 gptimer_regs_t *gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER;
59 waveform_picker_regs_new_t *waveform_picker_regs = (waveform_picker_regs_new_t*) REGS_ADDR_WAVEFORM_PICKER;
57 waveform_picker_regs_new_t *waveform_picker_regs = (waveform_picker_regs_new_t*) REGS_ADDR_WAVEFORM_PICKER;
60 spectral_matrix_regs_t *spectral_matrix_regs = (spectral_matrix_regs_t*) REGS_ADDR_SPECTRAL_MATRIX;
58 spectral_matrix_regs_t *spectral_matrix_regs = (spectral_matrix_regs_t*) REGS_ADDR_SPECTRAL_MATRIX;
61
59
62 // MODE PARAMETERS
60 // MODE PARAMETERS
63 Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
61 Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
64 struct param_local_str param_local;
62 struct param_local_str param_local;
65
63
66 // HK PACKETS
64 // HK PACKETS
67 Packet_TM_LFR_HK_t housekeeping_packet;
65 Packet_TM_LFR_HK_t housekeeping_packet;
68 // sequence counters are incremented by APID (PID + CAT) and destination ID
66 // sequence counters are incremented by APID (PID + CAT) and destination ID
69 unsigned short sequenceCounters_SCIENCE_NORMAL_BURST;
67 unsigned short sequenceCounters_SCIENCE_NORMAL_BURST;
70 unsigned short sequenceCounters_SCIENCE_SBM1_SBM2;
68 unsigned short sequenceCounters_SCIENCE_SBM1_SBM2;
71 unsigned short sequenceCounters_TC_EXE[SEQ_CNT_NB_DEST_ID];
69 unsigned short sequenceCounters_TC_EXE[SEQ_CNT_NB_DEST_ID];
72 spw_stats spacewire_stats;
70 spw_stats spacewire_stats;
73 spw_stats spacewire_stats_backup;
71 spw_stats spacewire_stats_backup;
74
72
75
73
@@ -1,366 +1,366
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 "avf0_prc0.h"
10 #include "avf0_prc0.h"
11 #include "fsw_processing.h"
11 #include "fsw_processing.h"
12
12
13 nb_sm_before_bp_asm_f0 nb_sm_before_f0;
13 nb_sm_before_bp_asm_f0 nb_sm_before_f0;
14
14
15 //***
15 //***
16 // F0
16 // F0
17 ring_node_asm asm_ring_norm_f0 [ NB_RING_NODES_ASM_NORM_F0 ];
17 ring_node_asm asm_ring_norm_f0 [ NB_RING_NODES_ASM_NORM_F0 ];
18 ring_node_asm asm_ring_burst_sbm_f0[ NB_RING_NODES_ASM_BURST_SBM_F0 ];
18 ring_node_asm asm_ring_burst_sbm_f0[ NB_RING_NODES_ASM_BURST_SBM_F0 ];
19
19
20 float asm_f0_reorganized [ TOTAL_SIZE_SM ];
20 float asm_f0_reorganized [ TOTAL_SIZE_SM ];
21 char asm_f0_char [ TIME_OFFSET_IN_BYTES + (TOTAL_SIZE_SM * 2) ];
21 char asm_f0_char [ TIME_OFFSET_IN_BYTES + (TOTAL_SIZE_SM * 2) ];
22 float compressed_sm_norm_f0[ TOTAL_SIZE_COMPRESSED_ASM_NORM_F0];
22 float compressed_sm_norm_f0[ TOTAL_SIZE_COMPRESSED_ASM_NORM_F0];
23 float compressed_sm_sbm_f0 [ TOTAL_SIZE_COMPRESSED_ASM_SBM_F0 ];
23 float compressed_sm_sbm_f0 [ TOTAL_SIZE_COMPRESSED_ASM_SBM_F0 ];
24 unsigned char bp1_norm_f0 [ TOTAL_SIZE_BP1_NORM_F0 ];
24 //unsigned char bp1_norm_f0 [ TOTAL_SIZE_BP1_NORM_F0 ];
25 unsigned char bp1_sbm_f0 [ TOTAL_SIZE_BP1_SBM_F0 ];
25 //unsigned char bp1_sbm_f0 [ TOTAL_SIZE_BP1_SBM_F0 ];
26
26
27 //************
27 //************
28 // RTEMS TASKS
28 // RTEMS TASKS
29
29
30 rtems_task avf0_task( rtems_task_argument lfrRequestedMode )
30 rtems_task avf0_task( rtems_task_argument lfrRequestedMode )
31 {
31 {
32 int i;
32 int i;
33
33
34 rtems_event_set event_out;
34 rtems_event_set event_out;
35 rtems_status_code status;
35 rtems_status_code status;
36 rtems_id queue_id_prc0;
36 rtems_id queue_id_prc0;
37 asm_msg msgForMATR;
37 asm_msg msgForMATR;
38 ring_node_sm *ring_node_tab[8];
38 ring_node_sm *ring_node_tab[8];
39 ring_node_asm *current_ring_node_asm_burst_sbm_f0;
39 ring_node_asm *current_ring_node_asm_burst_sbm_f0;
40 ring_node_asm *current_ring_node_asm_norm_f0;
40 ring_node_asm *current_ring_node_asm_norm_f0;
41
41
42 unsigned int nb_norm_bp1;
42 unsigned int nb_norm_bp1;
43 unsigned int nb_norm_bp2;
43 unsigned int nb_norm_bp2;
44 unsigned int nb_norm_asm;
44 unsigned int nb_norm_asm;
45 unsigned int nb_sbm_bp1;
45 unsigned int nb_sbm_bp1;
46 unsigned int nb_sbm_bp2;
46 unsigned int nb_sbm_bp2;
47
47
48 nb_norm_bp1 = 0;
48 nb_norm_bp1 = 0;
49 nb_norm_bp2 = 0;
49 nb_norm_bp2 = 0;
50 nb_norm_asm = 0;
50 nb_norm_asm = 0;
51 nb_sbm_bp1 = 0;
51 nb_sbm_bp1 = 0;
52 nb_sbm_bp2 = 0;
52 nb_sbm_bp2 = 0;
53
53
54 reset_nb_sm_f0( lfrRequestedMode ); // reset the sm counters that drive the BP and ASM computations / transmissions
54 reset_nb_sm_f0( lfrRequestedMode ); // reset the sm counters that drive the BP and ASM computations / transmissions
55 ASM_generic_init_ring( asm_ring_norm_f0, NB_RING_NODES_ASM_NORM_F0 );
55 ASM_generic_init_ring( asm_ring_norm_f0, NB_RING_NODES_ASM_NORM_F0 );
56 ASM_generic_init_ring( asm_ring_burst_sbm_f0, NB_RING_NODES_ASM_BURST_SBM_F0 );
56 ASM_generic_init_ring( asm_ring_burst_sbm_f0, NB_RING_NODES_ASM_BURST_SBM_F0 );
57 current_ring_node_asm_norm_f0 = asm_ring_norm_f0;
57 current_ring_node_asm_norm_f0 = asm_ring_norm_f0;
58 current_ring_node_asm_burst_sbm_f0 = asm_ring_burst_sbm_f0;
58 current_ring_node_asm_burst_sbm_f0 = asm_ring_burst_sbm_f0;
59
59
60 BOOT_PRINTF1("in AVFO *** lfrRequestedMode = %d\n", (int) lfrRequestedMode)
60 BOOT_PRINTF1("in AVFO *** lfrRequestedMode = %d\n", (int) lfrRequestedMode)
61
61
62 status = get_message_queue_id_prc0( &queue_id_prc0 );
62 status = get_message_queue_id_prc0( &queue_id_prc0 );
63 if (status != RTEMS_SUCCESSFUL)
63 if (status != RTEMS_SUCCESSFUL)
64 {
64 {
65 PRINTF1("in MATR *** ERR get_message_queue_id_prc0 %d\n", status)
65 PRINTF1("in MATR *** ERR get_message_queue_id_prc0 %d\n", status)
66 }
66 }
67
67
68 while(1){
68 while(1){
69 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
69 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
70 ring_node_tab[NB_SM_BEFORE_AVF0-1] = ring_node_for_averaging_sm_f0;
70 ring_node_tab[NB_SM_BEFORE_AVF0-1] = ring_node_for_averaging_sm_f0;
71 for ( i = 2; i < (NB_SM_BEFORE_AVF0+1); i++ )
71 for ( i = 2; i < (NB_SM_BEFORE_AVF0+1); i++ )
72 {
72 {
73 ring_node_for_averaging_sm_f0 = ring_node_for_averaging_sm_f0->previous;
73 ring_node_for_averaging_sm_f0 = ring_node_for_averaging_sm_f0->previous;
74 ring_node_tab[NB_SM_BEFORE_AVF0-i] = ring_node_for_averaging_sm_f0;
74 ring_node_tab[NB_SM_BEFORE_AVF0-i] = ring_node_for_averaging_sm_f0;
75 }
75 }
76
76
77 // compute the average and store it in the averaged_sm_f1 buffer
77 // compute the average and store it in the averaged_sm_f1 buffer
78 SM_average( current_ring_node_asm_norm_f0->matrix,
78 SM_average( current_ring_node_asm_norm_f0->matrix,
79 current_ring_node_asm_burst_sbm_f0->matrix,
79 current_ring_node_asm_burst_sbm_f0->matrix,
80 ring_node_tab,
80 ring_node_tab,
81 nb_norm_bp1, nb_sbm_bp1 );
81 nb_norm_bp1, nb_sbm_bp1 );
82
82
83 // update nb_average
83 // update nb_average
84 nb_norm_bp1 = nb_norm_bp1 + NB_SM_BEFORE_AVF0;
84 nb_norm_bp1 = nb_norm_bp1 + NB_SM_BEFORE_AVF0;
85 nb_norm_bp2 = nb_norm_bp2 + NB_SM_BEFORE_AVF0;
85 nb_norm_bp2 = nb_norm_bp2 + NB_SM_BEFORE_AVF0;
86 nb_norm_asm = nb_norm_asm + NB_SM_BEFORE_AVF0;
86 nb_norm_asm = nb_norm_asm + NB_SM_BEFORE_AVF0;
87 nb_sbm_bp1 = nb_sbm_bp1 + NB_SM_BEFORE_AVF0;
87 nb_sbm_bp1 = nb_sbm_bp1 + NB_SM_BEFORE_AVF0;
88 nb_sbm_bp2 = nb_sbm_bp2 + NB_SM_BEFORE_AVF0;
88 nb_sbm_bp2 = nb_sbm_bp2 + NB_SM_BEFORE_AVF0;
89
89
90 //****************************************
90 //****************************************
91 // initialize the mesage for the MATR task
91 // initialize the mesage for the MATR task
92 msgForMATR.event = 0x00; // this composite event will be sent to the MATR task
92 msgForMATR.event = 0x00; // this composite event will be sent to the MATR task
93 msgForMATR.burst_sbm = current_ring_node_asm_burst_sbm_f0;
93 msgForMATR.burst_sbm = current_ring_node_asm_burst_sbm_f0;
94 msgForMATR.norm = current_ring_node_asm_norm_f0;
94 msgForMATR.norm = current_ring_node_asm_norm_f0;
95 // msgForMATR.coarseTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[0];
95 // msgForMATR.coarseTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[0];
96 // msgForMATR.fineTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[1];
96 // msgForMATR.fineTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[1];
97 msgForMATR.coarseTime = time_management_regs->coarse_time;
97 msgForMATR.coarseTime = time_management_regs->coarse_time;
98 msgForMATR.fineTime = time_management_regs->fine_time;
98 msgForMATR.fineTime = time_management_regs->fine_time;
99
99
100 if (nb_sbm_bp1 == nb_sm_before_f0.burst_sbm_bp1)
100 if (nb_sbm_bp1 == nb_sm_before_f0.burst_sbm_bp1)
101 {
101 {
102 nb_sbm_bp1 = 0;
102 nb_sbm_bp1 = 0;
103 // set another ring for the ASM storage
103 // set another ring for the ASM storage
104 current_ring_node_asm_burst_sbm_f0 = current_ring_node_asm_burst_sbm_f0->next;
104 current_ring_node_asm_burst_sbm_f0 = current_ring_node_asm_burst_sbm_f0->next;
105 if ( (lfrCurrentMode == LFR_MODE_BURST)
105 if ( (lfrCurrentMode == LFR_MODE_BURST)
106 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
106 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
107 {
107 {
108 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_SBM_BP1_F0;
108 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_SBM_BP1_F0;
109 }
109 }
110 }
110 }
111
111
112 if (nb_sbm_bp2 == nb_sm_before_f0.burst_sbm_bp2)
112 if (nb_sbm_bp2 == nb_sm_before_f0.burst_sbm_bp2)
113 {
113 {
114 nb_sbm_bp2 = 0;
114 nb_sbm_bp2 = 0;
115 if ( (lfrCurrentMode == LFR_MODE_BURST)
115 if ( (lfrCurrentMode == LFR_MODE_BURST)
116 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
116 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
117 {
117 {
118 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_SBM_BP2_F0;
118 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_SBM_BP2_F0;
119 }
119 }
120 }
120 }
121
121
122 if (nb_norm_bp1 == nb_sm_before_f0.norm_bp1)
122 if (nb_norm_bp1 == nb_sm_before_f0.norm_bp1)
123 {
123 {
124 nb_norm_bp1 = 0;
124 nb_norm_bp1 = 0;
125 // set another ring for the ASM storage
125 // set another ring for the ASM storage
126 current_ring_node_asm_norm_f0 = current_ring_node_asm_norm_f0->next;
126 current_ring_node_asm_norm_f0 = current_ring_node_asm_norm_f0->next;
127 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
127 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
128 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
128 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
129 {
129 {
130 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP1_F0;
130 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP1_F0;
131 }
131 }
132 }
132 }
133
133
134 if (nb_norm_bp2 == nb_sm_before_f0.norm_bp2)
134 if (nb_norm_bp2 == nb_sm_before_f0.norm_bp2)
135 {
135 {
136 nb_norm_bp2 = 0;
136 nb_norm_bp2 = 0;
137 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
137 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
138 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
138 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
139 {
139 {
140 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP2_F0;
140 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP2_F0;
141 }
141 }
142 }
142 }
143
143
144 if (nb_norm_asm == nb_sm_before_f0.norm_asm)
144 if (nb_norm_asm == nb_sm_before_f0.norm_asm)
145 {
145 {
146 nb_norm_asm = 0;
146 nb_norm_asm = 0;
147 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
147 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
148 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
148 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
149 {
149 {
150 // PRINTF1("%lld\n", localTime)
150 // PRINTF1("%lld\n", localTime)
151 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_ASM_F0;
151 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_ASM_F0;
152 }
152 }
153 }
153 }
154
154
155 //*************************
155 //*************************
156 // send the message to MATR
156 // send the message to MATR
157 if (msgForMATR.event != 0x00)
157 if (msgForMATR.event != 0x00)
158 {
158 {
159 status = rtems_message_queue_send( queue_id_prc0, (char *) &msgForMATR, MSG_QUEUE_SIZE_PRC0);
159 status = rtems_message_queue_send( queue_id_prc0, (char *) &msgForMATR, MSG_QUEUE_SIZE_PRC0);
160 }
160 }
161
161
162 if (status != RTEMS_SUCCESSFUL) {
162 if (status != RTEMS_SUCCESSFUL) {
163 printf("in AVF0 *** Error sending message to MATR, code %d\n", status);
163 printf("in AVF0 *** Error sending message to MATR, code %d\n", status);
164 }
164 }
165 }
165 }
166 }
166 }
167
167
168 rtems_task prc0_task( rtems_task_argument lfrRequestedMode )
168 rtems_task prc0_task( rtems_task_argument lfrRequestedMode )
169 {
169 {
170 char incomingData[MSG_QUEUE_SIZE_SEND]; // incoming data buffer
170 char incomingData[MSG_QUEUE_SIZE_SEND]; // incoming data buffer
171 size_t size; // size of the incoming TC packet
171 size_t size; // size of the incoming TC packet
172 asm_msg *incomingMsg;
172 asm_msg *incomingMsg;
173 //
173 //
174 spw_ioctl_pkt_send spw_ioctl_send_ASM;
174 spw_ioctl_pkt_send spw_ioctl_send_ASM;
175 rtems_status_code status;
175 rtems_status_code status;
176 rtems_id queue_id;
176 rtems_id queue_id;
177 rtems_id queue_id_q_p0;
177 rtems_id queue_id_q_p0;
178 Header_TM_LFR_SCIENCE_ASM_t headerASM;
178 Header_TM_LFR_SCIENCE_ASM_t headerASM;
179 bp_packet_with_spare packet_norm_bp1_f0;
179 bp_packet_with_spare packet_norm_bp1_f0;
180 bp_packet packet_norm_bp2_f0;
180 bp_packet packet_norm_bp2_f0;
181 bp_packet packet_sbm_bp1_f0;
181 bp_packet packet_sbm_bp1_f0;
182 bp_packet packet_sbm_bp2_f0;
182 bp_packet packet_sbm_bp2_f0;
183
183
184 unsigned long long int localTime;
184 unsigned long long int localTime;
185
185
186 ASM_init_header( &headerASM );
186 ASM_init_header( &headerASM );
187
187
188 //*************
188 //*************
189 // NORM headers
189 // NORM headers
190 BP_init_header_with_spare( &packet_norm_bp1_f0.header,
190 BP_init_header_with_spare( &packet_norm_bp1_f0.header,
191 APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F0,
191 APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F0,
192 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0, NB_BINS_COMPRESSED_SM_F0 );
192 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0, NB_BINS_COMPRESSED_SM_F0 );
193 BP_init_header( &packet_norm_bp2_f0.header,
193 BP_init_header( &packet_norm_bp2_f0.header,
194 APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP2_F0,
194 APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP2_F0,
195 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0, NB_BINS_COMPRESSED_SM_F0);
195 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0, NB_BINS_COMPRESSED_SM_F0);
196
196
197 //****************************
197 //****************************
198 // BURST SBM1 and SBM2 headers
198 // BURST SBM1 and SBM2 headers
199 if ( lfrRequestedMode == LFR_MODE_BURST )
199 if ( lfrRequestedMode == LFR_MODE_BURST )
200 {
200 {
201 BP_init_header( &packet_sbm_bp1_f0.header,
201 BP_init_header( &packet_sbm_bp1_f0.header,
202 APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP1_F0,
202 APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP1_F0,
203 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
203 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
204 BP_init_header( &packet_sbm_bp2_f0.header,
204 BP_init_header( &packet_sbm_bp2_f0.header,
205 APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP2_F0,
205 APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP2_F0,
206 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
206 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
207 }
207 }
208 else if ( lfrRequestedMode == LFR_MODE_SBM1 )
208 else if ( lfrRequestedMode == LFR_MODE_SBM1 )
209 {
209 {
210 BP_init_header( &packet_sbm_bp1_f0.header,
210 BP_init_header( &packet_sbm_bp1_f0.header,
211 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP1_F0,
211 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP1_F0,
212 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
212 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
213 BP_init_header( &packet_sbm_bp2_f0.header,
213 BP_init_header( &packet_sbm_bp2_f0.header,
214 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP2_F0,
214 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP2_F0,
215 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
215 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
216 }
216 }
217 else if ( lfrRequestedMode == LFR_MODE_SBM2 )
217 else if ( lfrRequestedMode == LFR_MODE_SBM2 )
218 {
218 {
219 BP_init_header( &packet_sbm_bp1_f0.header,
219 BP_init_header( &packet_sbm_bp1_f0.header,
220 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP1_F0,
220 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP1_F0,
221 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
221 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
222 BP_init_header( &packet_sbm_bp2_f0.header,
222 BP_init_header( &packet_sbm_bp2_f0.header,
223 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP2_F0,
223 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP2_F0,
224 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
224 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
225 }
225 }
226 else
226 else
227 {
227 {
228 PRINTF1("in PRC0 *** lfrRequestedMode is %d, several headers not initialized\n", (unsigned int) lfrRequestedMode)
228 PRINTF1("in PRC0 *** lfrRequestedMode is %d, several headers not initialized\n", (unsigned int) lfrRequestedMode)
229 }
229 }
230
230
231 status = get_message_queue_id_send( &queue_id );
231 status = get_message_queue_id_send( &queue_id );
232 if (status != RTEMS_SUCCESSFUL)
232 if (status != RTEMS_SUCCESSFUL)
233 {
233 {
234 PRINTF1("in PRC0 *** ERR get_message_queue_id_send %d\n", status)
234 PRINTF1("in PRC0 *** ERR get_message_queue_id_send %d\n", status)
235 }
235 }
236 status = get_message_queue_id_prc0( &queue_id_q_p0);
236 status = get_message_queue_id_prc0( &queue_id_q_p0);
237 if (status != RTEMS_SUCCESSFUL)
237 if (status != RTEMS_SUCCESSFUL)
238 {
238 {
239 PRINTF1("in PRC0 *** ERR get_message_queue_id_prc0 %d\n", status)
239 PRINTF1("in PRC0 *** ERR get_message_queue_id_prc0 %d\n", status)
240 }
240 }
241
241
242 BOOT_PRINTF1("in PRC0 *** lfrRequestedMode = %d\n", (int) lfrRequestedMode)
242 BOOT_PRINTF1("in PRC0 *** lfrRequestedMode = %d\n", (int) lfrRequestedMode)
243
243
244 while(1){
244 while(1){
245 status = rtems_message_queue_receive( queue_id_q_p0, incomingData, &size, //************************************
245 status = rtems_message_queue_receive( queue_id_q_p0, incomingData, &size, //************************************
246 RTEMS_WAIT, RTEMS_NO_TIMEOUT ); // wait for a message coming from AVF0
246 RTEMS_WAIT, RTEMS_NO_TIMEOUT ); // wait for a message coming from AVF0
247
247
248 incomingMsg = (asm_msg*) incomingData;
248 incomingMsg = (asm_msg*) incomingData;
249
249
250 localTime = getTimeAsUnsignedLongLongInt( );
250 localTime = getTimeAsUnsignedLongLongInt( );
251 //****************
251 //****************
252 //****************
252 //****************
253 // BURST SBM1 SBM2
253 // BURST SBM1 SBM2
254 //****************
254 //****************
255 //****************
255 //****************
256 if (incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP1_F0 )
256 if (incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP1_F0 )
257 {
257 {
258 // 1) compress the matrix for Basic Parameters calculation
258 // 1) compress the matrix for Basic Parameters calculation
259 ASM_compress_reorganize_and_divide( incomingMsg->burst_sbm->matrix, compressed_sm_sbm_f0,
259 ASM_compress_reorganize_and_divide( incomingMsg->burst_sbm->matrix, compressed_sm_sbm_f0,
260 nb_sm_before_f0.burst_sbm_bp1,
260 nb_sm_before_f0.burst_sbm_bp1,
261 NB_BINS_COMPRESSED_SM_SBM_F0, NB_BINS_TO_AVERAGE_ASM_SBM_F0,
261 NB_BINS_COMPRESSED_SM_SBM_F0, NB_BINS_TO_AVERAGE_ASM_SBM_F0,
262 ASM_F0_INDICE_START);
262 ASM_F0_INDICE_START);
263 // 2) compute the BP1 set
263 // 2) compute the BP1 set
264 // BP1_set( compressed_sm_norm_f0, NB_BINS_COMPRESSED_SM_SBM_F0, bp1_sbm_f0 );
264 // BP1_set( compressed_sm_norm_f0, NB_BINS_COMPRESSED_SM_SBM_F0, bp1_sbm_f0 );
265 // 3) send the BP1 set
265 // 3) send the BP1 set
266 set_time( packet_sbm_bp1_f0.header.time, (unsigned char *) &incomingMsg->coarseTime );
266 set_time( packet_sbm_bp1_f0.header.time, (unsigned char *) &incomingMsg->coarseTime );
267 set_time( packet_sbm_bp1_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
267 set_time( packet_sbm_bp1_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
268 BP_send( (char *) &packet_sbm_bp1_f0.header, queue_id,
268 BP_send( (char *) &packet_sbm_bp1_f0.header, queue_id,
269 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0 + PACKET_LENGTH_DELTA);
269 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0 + PACKET_LENGTH_DELTA);
270 // 4) compute the BP2 set if needed
270 // 4) compute the BP2 set if needed
271 if ( incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP2_F0 )
271 if ( incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP2_F0 )
272 {
272 {
273 // 1) compute the BP2 set
273 // 1) compute the BP2 set
274
274
275 // 2) send the BP2 set
275 // 2) send the BP2 set
276 set_time( packet_sbm_bp2_f0.header.time, (unsigned char *) &incomingMsg->coarseTime );
276 set_time( packet_sbm_bp2_f0.header.time, (unsigned char *) &incomingMsg->coarseTime );
277 set_time( packet_sbm_bp2_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
277 set_time( packet_sbm_bp2_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
278 BP_send( (char *) &packet_sbm_bp2_f0.header, queue_id,
278 BP_send( (char *) &packet_sbm_bp2_f0.header, queue_id,
279 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0 + PACKET_LENGTH_DELTA);
279 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0 + PACKET_LENGTH_DELTA);
280 }
280 }
281 }
281 }
282
282
283 //*****
283 //*****
284 //*****
284 //*****
285 // NORM
285 // NORM
286 //*****
286 //*****
287 //*****
287 //*****
288 if (incomingMsg->event & RTEMS_EVENT_NORM_BP1_F0)
288 if (incomingMsg->event & RTEMS_EVENT_NORM_BP1_F0)
289 {
289 {
290 // 1) compress the matrix for Basic Parameters calculation
290 // 1) compress the matrix for Basic Parameters calculation
291 ASM_compress_reorganize_and_divide( incomingMsg->norm->matrix, compressed_sm_norm_f0,
291 ASM_compress_reorganize_and_divide( incomingMsg->norm->matrix, compressed_sm_norm_f0,
292 nb_sm_before_f0.norm_bp1,
292 nb_sm_before_f0.norm_bp1,
293 NB_BINS_COMPRESSED_SM_F0, NB_BINS_TO_AVERAGE_ASM_F0,
293 NB_BINS_COMPRESSED_SM_F0, NB_BINS_TO_AVERAGE_ASM_F0,
294 ASM_F0_INDICE_START );
294 ASM_F0_INDICE_START );
295 // 2) compute the BP1 set
295 // 2) compute the BP1 set
296 // BP1_set( compressed_sm_norm_f0, NB_BINS_COMPRESSED_SM_F0, bp1_norm_f0 );
296 // BP1_set( compressed_sm_norm_f0, NB_BINS_COMPRESSED_SM_F0, bp1_norm_f0 );
297 // 3) send the BP1 set
297 // 3) send the BP1 set
298 set_time( packet_norm_bp1_f0.header.time, (unsigned char *) &incomingMsg->coarseTime );
298 set_time( packet_norm_bp1_f0.header.time, (unsigned char *) &incomingMsg->coarseTime );
299 set_time( packet_norm_bp1_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
299 set_time( packet_norm_bp1_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
300 BP_send( (char *) &packet_norm_bp1_f0.header, queue_id,
300 BP_send( (char *) &packet_norm_bp1_f0.header, queue_id,
301 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 + PACKET_LENGTH_DELTA);
301 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 + PACKET_LENGTH_DELTA);
302 if (incomingMsg->event & RTEMS_EVENT_NORM_BP2_F0)
302 if (incomingMsg->event & RTEMS_EVENT_NORM_BP2_F0)
303 {
303 {
304 // 1) compute the BP2 set using the same ASM as the one used for BP1
304 // 1) compute the BP2 set using the same ASM as the one used for BP1
305
305
306 // 2) send the BP2 set
306 // 2) send the BP2 set
307 set_time( packet_norm_bp2_f0.header.time, (unsigned char *) &incomingMsg->coarseTime );
307 set_time( packet_norm_bp2_f0.header.time, (unsigned char *) &incomingMsg->coarseTime );
308 set_time( packet_norm_bp2_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
308 set_time( packet_norm_bp2_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
309 BP_send( (char *) &packet_norm_bp2_f0.header, queue_id,
309 BP_send( (char *) &packet_norm_bp2_f0.header, queue_id,
310 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0 + PACKET_LENGTH_DELTA);
310 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0 + PACKET_LENGTH_DELTA);
311 }
311 }
312 }
312 }
313
313
314 if (incomingMsg->event & RTEMS_EVENT_NORM_ASM_F0)
314 if (incomingMsg->event & RTEMS_EVENT_NORM_ASM_F0)
315 {
315 {
316 // 1) reorganize the ASM and divide
316 // 1) reorganize the ASM and divide
317 ASM_reorganize_and_divide( incomingMsg->norm->matrix,
317 ASM_reorganize_and_divide( incomingMsg->norm->matrix,
318 asm_f0_reorganized,
318 asm_f0_reorganized,
319 nb_sm_before_f0.norm_bp1 );
319 nb_sm_before_f0.norm_bp1 );
320 // 2) convert the float array in a char array
320 // 2) convert the float array in a char array
321 ASM_convert( asm_f0_reorganized, asm_f0_char);
321 ASM_convert( asm_f0_reorganized, asm_f0_char);
322 // 3) send the spectral matrix packets
322 // 3) send the spectral matrix packets
323 set_time( headerASM.time , (unsigned char *) &incomingMsg->coarseTime );
323 set_time( headerASM.time , (unsigned char *) &incomingMsg->coarseTime );
324 set_time( headerASM.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime );
324 set_time( headerASM.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime );
325 ASM_send( &headerASM, asm_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id);
325 ASM_send( &headerASM, asm_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id);
326 }
326 }
327
327
328 }
328 }
329 }
329 }
330
330
331 //**********
331 //**********
332 // FUNCTIONS
332 // FUNCTIONS
333
333
334 void reset_nb_sm_f0( unsigned char lfrMode )
334 void reset_nb_sm_f0( unsigned char lfrMode )
335 {
335 {
336 nb_sm_before_f0.norm_bp1 = parameter_dump_packet.sy_lfr_n_bp_p0 * 96;
336 nb_sm_before_f0.norm_bp1 = parameter_dump_packet.sy_lfr_n_bp_p0 * 96;
337 nb_sm_before_f0.norm_bp2 = parameter_dump_packet.sy_lfr_n_bp_p1 * 96;
337 nb_sm_before_f0.norm_bp2 = parameter_dump_packet.sy_lfr_n_bp_p1 * 96;
338 nb_sm_before_f0.norm_asm = (parameter_dump_packet.sy_lfr_n_asm_p[0] * 256 + parameter_dump_packet.sy_lfr_n_asm_p[1]) * 96;
338 nb_sm_before_f0.norm_asm = (parameter_dump_packet.sy_lfr_n_asm_p[0] * 256 + parameter_dump_packet.sy_lfr_n_asm_p[1]) * 96;
339 nb_sm_before_f0.sbm1_bp1 = parameter_dump_packet.sy_lfr_s1_bp_p0 * 24;
339 nb_sm_before_f0.sbm1_bp1 = parameter_dump_packet.sy_lfr_s1_bp_p0 * 24;
340 nb_sm_before_f0.sbm1_bp2 = parameter_dump_packet.sy_lfr_s1_bp_p1 * 96;
340 nb_sm_before_f0.sbm1_bp2 = parameter_dump_packet.sy_lfr_s1_bp_p1 * 96;
341 nb_sm_before_f0.sbm2_bp1 = parameter_dump_packet.sy_lfr_s2_bp_p0 * 96;
341 nb_sm_before_f0.sbm2_bp1 = parameter_dump_packet.sy_lfr_s2_bp_p0 * 96;
342 nb_sm_before_f0.sbm2_bp2 = parameter_dump_packet.sy_lfr_s2_bp_p1 * 96;
342 nb_sm_before_f0.sbm2_bp2 = parameter_dump_packet.sy_lfr_s2_bp_p1 * 96;
343 nb_sm_before_f0.burst_bp1 = parameter_dump_packet.sy_lfr_b_bp_p0 * 96;
343 nb_sm_before_f0.burst_bp1 = parameter_dump_packet.sy_lfr_b_bp_p0 * 96;
344 nb_sm_before_f0.burst_bp2 = parameter_dump_packet.sy_lfr_b_bp_p1 * 96;
344 nb_sm_before_f0.burst_bp2 = parameter_dump_packet.sy_lfr_b_bp_p1 * 96;
345
345
346 if (lfrMode == LFR_MODE_SBM1)
346 if (lfrMode == LFR_MODE_SBM1)
347 {
347 {
348 nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.sbm1_bp1;
348 nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.sbm1_bp1;
349 nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.sbm1_bp2;
349 nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.sbm1_bp2;
350 }
350 }
351 else if (lfrMode == LFR_MODE_SBM2)
351 else if (lfrMode == LFR_MODE_SBM2)
352 {
352 {
353 nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.sbm2_bp1;
353 nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.sbm2_bp1;
354 nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.sbm2_bp2;
354 nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.sbm2_bp2;
355 }
355 }
356 else if (lfrMode == LFR_MODE_BURST)
356 else if (lfrMode == LFR_MODE_BURST)
357 {
357 {
358 nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.burst_bp1;
358 nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.burst_bp1;
359 nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.burst_bp2;
359 nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.burst_bp2;
360 }
360 }
361 else
361 else
362 {
362 {
363 nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.burst_bp1;
363 nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.burst_bp1;
364 nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.burst_bp2;
364 nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.burst_bp2;
365 }
365 }
366 }
366 }
@@ -1,1348 +1,1315
1 /** Functions and tasks related to waveform packet generation.
1 /** Functions and tasks related to waveform packet generation.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * A group of functions to handle waveforms, in snapshot or continuous format.\n
6 * A group of functions to handle waveforms, in snapshot or continuous format.\n
7 *
7 *
8 */
8 */
9
9
10 #include "wf_handler.h"
10 #include "wf_handler.h"
11
11
12 //*****************
12 //*****************
13 // waveform headers
13 // waveform headers
14 // SWF
14 // SWF
15 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F0[7];
15 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F0[7];
16 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F1[7];
16 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F1[7];
17 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F2[7];
17 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F2[7];
18 // CWF
18 // CWF
19 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F1[ NB_PACKETS_PER_GROUP_OF_CWF ];
19 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F1[ NB_PACKETS_PER_GROUP_OF_CWF ];
20 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_BURST[ NB_PACKETS_PER_GROUP_OF_CWF ];
20 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_BURST[ NB_PACKETS_PER_GROUP_OF_CWF ];
21 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_SBM2[ NB_PACKETS_PER_GROUP_OF_CWF ];
21 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_SBM2[ NB_PACKETS_PER_GROUP_OF_CWF ];
22 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3[ NB_PACKETS_PER_GROUP_OF_CWF ];
22 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3[ NB_PACKETS_PER_GROUP_OF_CWF ];
23 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3_light[ NB_PACKETS_PER_GROUP_OF_CWF_LIGHT ];
23 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3_light[ NB_PACKETS_PER_GROUP_OF_CWF_LIGHT ];
24
24
25 //**************
25 //**************
26 // waveform ring
26 // waveform ring
27 ring_node waveform_ring_f0[NB_RING_NODES_F0];
27 ring_node waveform_ring_f0[NB_RING_NODES_F0];
28 ring_node waveform_ring_f1[NB_RING_NODES_F1];
28 ring_node waveform_ring_f1[NB_RING_NODES_F1];
29 ring_node waveform_ring_f2[NB_RING_NODES_F2];
29 ring_node waveform_ring_f2[NB_RING_NODES_F2];
30 ring_node waveform_ring_f3[NB_RING_NODES_F3];
30 ring_node *current_ring_node_f0;
31 ring_node *current_ring_node_f0;
31 ring_node *ring_node_to_send_swf_f0;
32 ring_node *ring_node_to_send_swf_f0;
32 ring_node *current_ring_node_f1;
33 ring_node *current_ring_node_f1;
33 ring_node *ring_node_to_send_swf_f1;
34 ring_node *ring_node_to_send_swf_f1;
34 ring_node *ring_node_to_send_cwf_f1;
35 ring_node *ring_node_to_send_cwf_f1;
35 ring_node *current_ring_node_f2;
36 ring_node *current_ring_node_f2;
36 ring_node *ring_node_to_send_swf_f2;
37 ring_node *ring_node_to_send_swf_f2;
37 ring_node *ring_node_to_send_cwf_f2;
38 ring_node *ring_node_to_send_cwf_f2;
39 ring_node *current_ring_node_f3;
40 ring_node *ring_node_to_send_cwf_f3;
38
41
39 bool extractSWF = false;
42 bool extractSWF = false;
40 bool swf_f0_ready = false;
43 bool swf_f0_ready = false;
41 bool swf_f1_ready = false;
44 bool swf_f1_ready = false;
42 bool swf_f2_ready = false;
45 bool swf_f2_ready = false;
43
46
44 int wf_snap_extracted[ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET ];
47 int wf_snap_extracted[ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET ];
45
48
46 //*********************
49 //*********************
47 // Interrupt SubRoutine
50 // Interrupt SubRoutine
48
51
49 void reset_extractSWF( void )
52 void reset_extractSWF( void )
50 {
53 {
51 extractSWF = false;
54 extractSWF = false;
52 swf_f0_ready = false;
55 swf_f0_ready = false;
53 swf_f1_ready = false;
56 swf_f1_ready = false;
54 swf_f2_ready = false;
57 swf_f2_ready = false;
55 }
58 }
56
59
57 rtems_isr waveforms_isr( rtems_vector_number vector )
60 rtems_isr waveforms_isr( rtems_vector_number vector )
58 {
61 {
59 /** This is the interrupt sub routine called by the waveform picker core.
62 /** This is the interrupt sub routine called by the waveform picker core.
60 *
63 *
61 * This ISR launch different actions depending mainly on two pieces of information:
64 * This ISR launch different actions depending mainly on two pieces of information:
62 * 1. the values read in the registers of the waveform picker.
65 * 1. the values read in the registers of the waveform picker.
63 * 2. the current LFR mode.
66 * 2. the current LFR mode.
64 *
67 *
65 */
68 */
66
69
67 rtems_status_code status;
70 rtems_status_code status;
68
71
69 if ( (lfrCurrentMode == LFR_MODE_NORMAL) || (lfrCurrentMode == LFR_MODE_BURST) // in BURST the data are used to place v, e1 and e2 in the HK packet
72 if ( (lfrCurrentMode == LFR_MODE_NORMAL) || (lfrCurrentMode == LFR_MODE_BURST) // in BURST the data are used to place v, e1 and e2 in the HK packet
70 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
73 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
71 { // in modes other than STANDBY and BURST, send the CWF_F3 data
74 { // in modes other than STANDBY and BURST, send the CWF_F3 data
72 if ((waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full
75 if ((waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full
73 // (1) change the receiving buffer for the waveform picker
76 // (1) change the receiving buffer for the waveform picker
74 if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3_a) {
77 ring_node_to_send_cwf_f3 = current_ring_node_f3;
75 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_b);
78 current_ring_node_f3 = current_ring_node_f3->next;
76 }
79 waveform_picker_regs->addr_data_f3 = current_ring_node_f3->buffer_address;
77 else {
78 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a);
79 }
80 // (2) send an event for the waveforms transmission
80 // (2) send an event for the waveforms transmission
81 if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
81 if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
82 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
82 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
83 }
83 }
84 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2);
84 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2);
85 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff777; // reset f3 bits to 0, [1111 0111 0111 0111]
85 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff777; // reset f3 bits to 0, [1111 0111 0111 0111]
86 }
86 }
87 }
87 }
88
88
89 switch(lfrCurrentMode)
89 switch(lfrCurrentMode)
90 {
90 {
91 //********
91 //********
92 // STANDBY
92 // STANDBY
93 case(LFR_MODE_STANDBY):
93 case(LFR_MODE_STANDBY):
94 break;
94 break;
95
95
96 //******
96 //******
97 // NORMAL
97 // NORMAL
98 case(LFR_MODE_NORMAL):
98 case(LFR_MODE_NORMAL):
99 if ( (waveform_picker_regs->status & 0xff8) != 0x00) // [1000] check the error bits
99 if ( (waveform_picker_regs->status & 0xff8) != 0x00) // [1000] check the error bits
100 {
100 {
101 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
101 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
102 }
102 }
103 if ( (waveform_picker_regs->status & 0x07) == 0x07) // [0111] check the f2, f1, f0 full bits
103 if ( (waveform_picker_regs->status & 0x07) == 0x07) // [0111] check the f2, f1, f0 full bits
104 {
104 {
105 // change F0 ring node
105 // change F0 ring node
106 ring_node_to_send_swf_f0 = current_ring_node_f0;
106 ring_node_to_send_swf_f0 = current_ring_node_f0;
107 current_ring_node_f0 = current_ring_node_f0->next;
107 current_ring_node_f0 = current_ring_node_f0->next;
108 waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address;
108 waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address;
109 // change F1 ring node
109 // change F1 ring node
110 ring_node_to_send_swf_f1 = current_ring_node_f1;
110 ring_node_to_send_swf_f1 = current_ring_node_f1;
111 current_ring_node_f1 = current_ring_node_f1->next;
111 current_ring_node_f1 = current_ring_node_f1->next;
112 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address;
112 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address;
113 // change F2 ring node
113 // change F2 ring node
114 ring_node_to_send_swf_f2 = current_ring_node_f2;
114 ring_node_to_send_swf_f2 = current_ring_node_f2;
115 current_ring_node_f2 = current_ring_node_f2->next;
115 current_ring_node_f2 = current_ring_node_f2->next;
116 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
116 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
117 //
117 //
118 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL)
118 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL)
119 {
119 {
120 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
120 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
121 }
121 }
122 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff888; // [1000 1000 1000]
122 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff888; // [1000 1000 1000]
123 }
123 }
124 break;
124 break;
125
125
126 //******
126 //******
127 // BURST
127 // BURST
128 case(LFR_MODE_BURST):
128 case(LFR_MODE_BURST):
129 if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit
129 if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit
130 // (1) change the receiving buffer for the waveform picker
130 // (1) change the receiving buffer for the waveform picker
131 ring_node_to_send_cwf_f2 = current_ring_node_f2;
131 ring_node_to_send_cwf_f2 = current_ring_node_f2;
132 current_ring_node_f2 = current_ring_node_f2->next;
132 current_ring_node_f2 = current_ring_node_f2->next;
133 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
133 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
134 // (2) send an event for the waveforms transmission
134 // (2) send an event for the waveforms transmission
135 if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) {
135 if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) {
136 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
136 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
137 }
137 }
138 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0
138 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0
139 }
139 }
140 break;
140 break;
141
141
142 //*****
142 //*****
143 // SBM1
143 // SBM1
144 case(LFR_MODE_SBM1):
144 case(LFR_MODE_SBM1):
145 if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit
145 if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit
146 // (1) change the receiving buffer for the waveform picker
146 // (1) change the receiving buffer for the waveform picker
147 ring_node_to_send_cwf_f1 = current_ring_node_f1;
147 ring_node_to_send_cwf_f1 = current_ring_node_f1;
148 current_ring_node_f1 = current_ring_node_f1->next;
148 current_ring_node_f1 = current_ring_node_f1->next;
149 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address;
149 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address;
150 // (2) send an event for the the CWF1 task for transmission (and snapshot extraction if needed)
150 // (2) send an event for the the CWF1 task for transmission (and snapshot extraction if needed)
151 status = rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 );
151 status = rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 );
152 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bits = 0
152 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bits = 0
153 }
153 }
154 if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit
154 if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit
155 swf_f0_ready = true;
155 swf_f0_ready = true;
156 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffeee; // [1111 1110 1110 1110] f0 bits = 0
156 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffeee; // [1111 1110 1110 1110] f0 bits = 0
157 }
157 }
158 if ( (waveform_picker_regs->status & 0x04) == 0x04 ) { // [0100] check the f2 full bit
158 if ( (waveform_picker_regs->status & 0x04) == 0x04 ) { // [0100] check the f2 full bit
159 swf_f2_ready = true;
159 swf_f2_ready = true;
160 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bits = 0
160 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bits = 0
161 }
161 }
162 break;
162 break;
163
163
164 //*****
164 //*****
165 // SBM2
165 // SBM2
166 case(LFR_MODE_SBM2):
166 case(LFR_MODE_SBM2):
167 if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit
167 if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit
168 // (1) change the receiving buffer for the waveform picker
168 // (1) change the receiving buffer for the waveform picker
169 ring_node_to_send_cwf_f2 = current_ring_node_f2;
169 ring_node_to_send_cwf_f2 = current_ring_node_f2;
170 current_ring_node_f2 = current_ring_node_f2->next;
170 current_ring_node_f2 = current_ring_node_f2->next;
171 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
171 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
172 // (2) send an event for the waveforms transmission
172 // (2) send an event for the waveforms transmission
173 status = rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 );
173 status = rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 );
174 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0
174 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0
175 }
175 }
176 if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit
176 if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit
177 swf_f0_ready = true;
177 swf_f0_ready = true;
178 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffeee; // [1111 1110 1110 1110] f0 bits = 0
178 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffeee; // [1111 1110 1110 1110] f0 bits = 0
179 }
179 }
180 if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit
180 if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit
181 swf_f1_ready = true;
181 swf_f1_ready = true;
182 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1, f0 bits = 0
182 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1, f0 bits = 0
183 }
183 }
184 break;
184 break;
185
185
186 //********
186 //********
187 // DEFAULT
187 // DEFAULT
188 default:
188 default:
189 break;
189 break;
190 }
190 }
191 }
191 }
192
192
193 //************
193 //************
194 // RTEMS TASKS
194 // RTEMS TASKS
195
195
196 rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
196 rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
197 {
197 {
198 /** This RTEMS task is dedicated to the transmission of snapshots of the NORMAL mode.
198 /** This RTEMS task is dedicated to the transmission of snapshots of the NORMAL mode.
199 *
199 *
200 * @param unused is the starting argument of the RTEMS task
200 * @param unused is the starting argument of the RTEMS task
201 *
201 *
202 * The following data packets are sent by this task:
202 * The following data packets are sent by this task:
203 * - TM_LFR_SCIENCE_NORMAL_SWF_F0
203 * - TM_LFR_SCIENCE_NORMAL_SWF_F0
204 * - TM_LFR_SCIENCE_NORMAL_SWF_F1
204 * - TM_LFR_SCIENCE_NORMAL_SWF_F1
205 * - TM_LFR_SCIENCE_NORMAL_SWF_F2
205 * - TM_LFR_SCIENCE_NORMAL_SWF_F2
206 *
206 *
207 */
207 */
208
208
209 rtems_event_set event_out;
209 rtems_event_set event_out;
210 rtems_id queue_id;
210 rtems_id queue_id;
211 rtems_status_code status;
211 rtems_status_code status;
212
212
213 init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 );
213 init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 );
214 init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 );
214 init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 );
215 init_header_snapshot_wf_table( SID_NORM_SWF_F2, headerSWF_F2 );
215 init_header_snapshot_wf_table( SID_NORM_SWF_F2, headerSWF_F2 );
216
216
217 init_waveforms();
217 init_waveforms();
218
218
219 status = get_message_queue_id_send( &queue_id );
219 status = get_message_queue_id_send( &queue_id );
220 if (status != RTEMS_SUCCESSFUL)
220 if (status != RTEMS_SUCCESSFUL)
221 {
221 {
222 PRINTF1("in WFRM *** ERR get_message_queue_id_send %d\n", status)
222 PRINTF1("in WFRM *** ERR get_message_queue_id_send %d\n", status)
223 }
223 }
224
224
225 BOOT_PRINTF("in WFRM ***\n")
225 BOOT_PRINTF("in WFRM ***\n")
226
226
227 while(1){
227 while(1){
228 // wait for an RTEMS_EVENT
228 // wait for an RTEMS_EVENT
229 rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1
229 rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1
230 | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM,
230 | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM,
231 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
231 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
232 if (event_out == RTEMS_EVENT_MODE_NORMAL)
232 if (event_out == RTEMS_EVENT_MODE_NORMAL)
233 {
233 {
234 DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_NORMAL\n")
234 DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_NORMAL\n")
235 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
235 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
236 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
236 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
237 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
237 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
238 }
238 }
239 if (event_out == RTEMS_EVENT_MODE_SBM1)
239 if (event_out == RTEMS_EVENT_MODE_SBM1)
240 {
240 {
241 DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM1\n")
241 DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM1\n")
242 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
242 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
243 send_waveform_SWF((volatile int*) wf_snap_extracted , SID_NORM_SWF_F1, headerSWF_F1, queue_id);
243 send_waveform_SWF((volatile int*) wf_snap_extracted , SID_NORM_SWF_F1, headerSWF_F1, queue_id);
244 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
244 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
245 }
245 }
246 if (event_out == RTEMS_EVENT_MODE_SBM2)
246 if (event_out == RTEMS_EVENT_MODE_SBM2)
247 {
247 {
248 DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM2\n")
248 DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM2\n")
249 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
249 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
250 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
250 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
251 send_waveform_SWF((volatile int*) wf_snap_extracted , SID_NORM_SWF_F2, headerSWF_F2, queue_id);
251 send_waveform_SWF((volatile int*) wf_snap_extracted , SID_NORM_SWF_F2, headerSWF_F2, queue_id);
252 }
252 }
253 }
253 }
254 }
254 }
255
255
256 rtems_task cwf3_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
256 rtems_task cwf3_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
257 {
257 {
258 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f3.
258 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f3.
259 *
259 *
260 * @param unused is the starting argument of the RTEMS task
260 * @param unused is the starting argument of the RTEMS task
261 *
261 *
262 * The following data packet is sent by this task:
262 * The following data packet is sent by this task:
263 * - TM_LFR_SCIENCE_NORMAL_CWF_F3
263 * - TM_LFR_SCIENCE_NORMAL_CWF_F3
264 *
264 *
265 */
265 */
266
266
267 rtems_event_set event_out;
267 rtems_event_set event_out;
268 rtems_id queue_id;
268 rtems_id queue_id;
269 rtems_status_code status;
269 rtems_status_code status;
270
270
271 init_header_continuous_wf_table( SID_NORM_CWF_LONG_F3, headerCWF_F3 );
271 init_header_continuous_wf_table( SID_NORM_CWF_LONG_F3, headerCWF_F3 );
272 init_header_continuous_cwf3_light_table( headerCWF_F3_light );
272 init_header_continuous_cwf3_light_table( headerCWF_F3_light );
273
273
274 status = get_message_queue_id_send( &queue_id );
274 status = get_message_queue_id_send( &queue_id );
275 if (status != RTEMS_SUCCESSFUL)
275 if (status != RTEMS_SUCCESSFUL)
276 {
276 {
277 PRINTF1("in CWF3 *** ERR get_message_queue_id_send %d\n", status)
277 PRINTF1("in CWF3 *** ERR get_message_queue_id_send %d\n", status)
278 }
278 }
279
279
280 BOOT_PRINTF("in CWF3 ***\n")
280 BOOT_PRINTF("in CWF3 ***\n")
281
281
282 while(1){
282 while(1){
283 // wait for an RTEMS_EVENT
283 // wait for an RTEMS_EVENT
284 rtems_event_receive( RTEMS_EVENT_0,
284 rtems_event_receive( RTEMS_EVENT_0,
285 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
285 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
286 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
286 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
287 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode==LFR_MODE_SBM2) )
287 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode==LFR_MODE_SBM2) )
288 {
288 {
289 if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01)
289 if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01)
290 {
290 {
291 PRINTF("send CWF_LONG_F3\n")
291 PRINTF("send CWF_LONG_F3\n")
292 send_waveform_CWF(
293 (volatile int*) current_ring_node_f3->buffer_address,
294 SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id );
292 }
295 }
293 else
296 else
294 {
297 {
295 PRINTF("send CWF_F3 (light)\n")
298 PRINTF("send CWF_F3 (light)\n")
296 }
299 send_waveform_CWF3_light(
297 if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3_a) {
300 (volatile int*) current_ring_node_f3->buffer_address,
298 if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01)
301 headerCWF_F3_light, queue_id );
299 {
300 send_waveform_CWF( wf_cont_f3_b, SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id );
301 }
302 else
303 {
304 send_waveform_CWF3_light( wf_cont_f3_b, headerCWF_F3_light, queue_id );
305 }
306 }
302 }
307 else
308 {
309 if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01)
310 {
311 send_waveform_CWF( wf_cont_f3_a, SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id );
312 }
313 else
314 {
315 send_waveform_CWF3_light( wf_cont_f3_a, headerCWF_F3_light, queue_id );
316 }
317
303
318 }
319 }
304 }
320 else
305 else
321 {
306 {
322 PRINTF1("in CWF3 *** lfrCurrentMode is %d, no data will be sent\n", lfrCurrentMode)
307 PRINTF1("in CWF3 *** lfrCurrentMode is %d, no data will be sent\n", lfrCurrentMode)
323 }
308 }
324 }
309 }
325 }
310 }
326
311
327 rtems_task cwf2_task(rtems_task_argument argument) // ONLY USED IN BURST AND SBM2
312 rtems_task cwf2_task(rtems_task_argument argument) // ONLY USED IN BURST AND SBM2
328 {
313 {
329 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f2.
314 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f2.
330 *
315 *
331 * @param unused is the starting argument of the RTEMS task
316 * @param unused is the starting argument of the RTEMS task
332 *
317 *
333 * The following data packet is sent by this function:
318 * The following data packet is sent by this function:
334 * - TM_LFR_SCIENCE_BURST_CWF_F2
319 * - TM_LFR_SCIENCE_BURST_CWF_F2
335 * - TM_LFR_SCIENCE_SBM2_CWF_F2
320 * - TM_LFR_SCIENCE_SBM2_CWF_F2
336 *
321 *
337 */
322 */
338
323
339 rtems_event_set event_out;
324 rtems_event_set event_out;
340 rtems_id queue_id;
325 rtems_id queue_id;
341 rtems_status_code status;
326 rtems_status_code status;
342
327
343 init_header_continuous_wf_table( SID_BURST_CWF_F2, headerCWF_F2_BURST );
328 init_header_continuous_wf_table( SID_BURST_CWF_F2, headerCWF_F2_BURST );
344 init_header_continuous_wf_table( SID_SBM2_CWF_F2, headerCWF_F2_SBM2 );
329 init_header_continuous_wf_table( SID_SBM2_CWF_F2, headerCWF_F2_SBM2 );
345
330
346 status = get_message_queue_id_send( &queue_id );
331 status = get_message_queue_id_send( &queue_id );
347 if (status != RTEMS_SUCCESSFUL)
332 if (status != RTEMS_SUCCESSFUL)
348 {
333 {
349 PRINTF1("in CWF2 *** ERR get_message_queue_id_send %d\n", status)
334 PRINTF1("in CWF2 *** ERR get_message_queue_id_send %d\n", status)
350 }
335 }
351
336
352 BOOT_PRINTF("in CWF2 ***\n")
337 BOOT_PRINTF("in CWF2 ***\n")
353
338
354 while(1){
339 while(1){
355 // wait for an RTEMS_EVENT
340 // wait for an RTEMS_EVENT
356 rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2,
341 rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2,
357 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
342 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
358 if (event_out == RTEMS_EVENT_MODE_BURST)
343 if (event_out == RTEMS_EVENT_MODE_BURST)
359 {
344 {
360 send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id );
345 send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id );
361 }
346 }
362 if (event_out == RTEMS_EVENT_MODE_SBM2)
347 if (event_out == RTEMS_EVENT_MODE_SBM2)
363 {
348 {
364 send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id );
349 send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id );
365 // launch snapshot extraction if needed
350 // launch snapshot extraction if needed
366 if (extractSWF == true)
351 if (extractSWF == true)
367 {
352 {
368 ring_node_to_send_swf_f2 = ring_node_to_send_cwf_f2;
353 ring_node_to_send_swf_f2 = ring_node_to_send_cwf_f2;
369 // extract the snapshot
354 // extract the snapshot
370 build_snapshot_from_ring( ring_node_to_send_swf_f2, 2 );
355 build_snapshot_from_ring( ring_node_to_send_swf_f2, 2 );
371 // send the snapshot when built
356 // send the snapshot when built
372 status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 );
357 status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 );
373 extractSWF = false;
358 extractSWF = false;
374 }
359 }
375 if (swf_f0_ready && swf_f1_ready)
360 if (swf_f0_ready && swf_f1_ready)
376 {
361 {
377 extractSWF = true;
362 extractSWF = true;
378 swf_f0_ready = false;
363 swf_f0_ready = false;
379 swf_f1_ready = false;
364 swf_f1_ready = false;
380 }
365 }
381 }
366 }
382 }
367 }
383 }
368 }
384
369
385 rtems_task cwf1_task(rtems_task_argument argument) // ONLY USED IN SBM1
370 rtems_task cwf1_task(rtems_task_argument argument) // ONLY USED IN SBM1
386 {
371 {
387 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f1.
372 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f1.
388 *
373 *
389 * @param unused is the starting argument of the RTEMS task
374 * @param unused is the starting argument of the RTEMS task
390 *
375 *
391 * The following data packet is sent by this function:
376 * The following data packet is sent by this function:
392 * - TM_LFR_SCIENCE_SBM1_CWF_F1
377 * - TM_LFR_SCIENCE_SBM1_CWF_F1
393 *
378 *
394 */
379 */
395
380
396 rtems_event_set event_out;
381 rtems_event_set event_out;
397 rtems_id queue_id;
382 rtems_id queue_id;
398 rtems_status_code status;
383 rtems_status_code status;
399
384
400 init_header_continuous_wf_table( SID_SBM1_CWF_F1, headerCWF_F1 );
385 init_header_continuous_wf_table( SID_SBM1_CWF_F1, headerCWF_F1 );
401
386
402 status = get_message_queue_id_send( &queue_id );
387 status = get_message_queue_id_send( &queue_id );
403 if (status != RTEMS_SUCCESSFUL)
388 if (status != RTEMS_SUCCESSFUL)
404 {
389 {
405 PRINTF1("in CWF1 *** ERR get_message_queue_id_send %d\n", status)
390 PRINTF1("in CWF1 *** ERR get_message_queue_id_send %d\n", status)
406 }
391 }
407
392
408 BOOT_PRINTF("in CWF1 ***\n")
393 BOOT_PRINTF("in CWF1 ***\n")
409
394
410 while(1){
395 while(1){
411 // wait for an RTEMS_EVENT
396 // wait for an RTEMS_EVENT
412 rtems_event_receive( RTEMS_EVENT_MODE_SBM1,
397 rtems_event_receive( RTEMS_EVENT_MODE_SBM1,
413 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
398 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
414 send_waveform_CWF( (volatile int*) ring_node_to_send_cwf_f1->buffer_address, SID_SBM1_CWF_F1, headerCWF_F1, queue_id );
399 send_waveform_CWF( (volatile int*) ring_node_to_send_cwf_f1->buffer_address, SID_SBM1_CWF_F1, headerCWF_F1, queue_id );
415 // launch snapshot extraction if needed
400 // launch snapshot extraction if needed
416 if (extractSWF == true)
401 if (extractSWF == true)
417 {
402 {
418 ring_node_to_send_swf_f1 = ring_node_to_send_cwf_f1;
403 ring_node_to_send_swf_f1 = ring_node_to_send_cwf_f1;
419 // launch the snapshot extraction
404 // launch the snapshot extraction
420 status = rtems_event_send( Task_id[TASKID_SWBD], RTEMS_EVENT_MODE_SBM1 );
405 status = rtems_event_send( Task_id[TASKID_SWBD], RTEMS_EVENT_MODE_SBM1 );
421 extractSWF = false;
406 extractSWF = false;
422 }
407 }
423 if (swf_f0_ready == true)
408 if (swf_f0_ready == true)
424 {
409 {
425 extractSWF = true;
410 extractSWF = true;
426 swf_f0_ready = false; // this step shall be executed only one time
411 swf_f0_ready = false; // this step shall be executed only one time
427 }
412 }
428 if ((swf_f1_ready == true) && (swf_f2_ready == true)) // swf_f1 is ready after the extraction
413 if ((swf_f1_ready == true) && (swf_f2_ready == true)) // swf_f1 is ready after the extraction
429 {
414 {
430 status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM1 );
415 status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM1 );
431 swf_f1_ready = false;
416 swf_f1_ready = false;
432 swf_f2_ready = false;
417 swf_f2_ready = false;
433 }
418 }
434 }
419 }
435 }
420 }
436
421
437 rtems_task swbd_task(rtems_task_argument argument)
422 rtems_task swbd_task(rtems_task_argument argument)
438 {
423 {
439 /** This RTEMS task is dedicated to the building of snapshots from different continuous waveforms buffers.
424 /** This RTEMS task is dedicated to the building of snapshots from different continuous waveforms buffers.
440 *
425 *
441 * @param unused is the starting argument of the RTEMS task
426 * @param unused is the starting argument of the RTEMS task
442 *
427 *
443 */
428 */
444
429
445 rtems_event_set event_out;
430 rtems_event_set event_out;
446
431
447 BOOT_PRINTF("in SWBD ***\n")
432 BOOT_PRINTF("in SWBD ***\n")
448
433
449 while(1){
434 while(1){
450 // wait for an RTEMS_EVENT
435 // wait for an RTEMS_EVENT
451 rtems_event_receive( RTEMS_EVENT_MODE_SBM1 | RTEMS_EVENT_MODE_SBM2,
436 rtems_event_receive( RTEMS_EVENT_MODE_SBM1 | RTEMS_EVENT_MODE_SBM2,
452 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
437 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
453 if (event_out == RTEMS_EVENT_MODE_SBM1)
438 if (event_out == RTEMS_EVENT_MODE_SBM1)
454 {
439 {
455 build_snapshot_from_ring( ring_node_to_send_swf_f1, 1 );
440 build_snapshot_from_ring( ring_node_to_send_swf_f1, 1 );
456 swf_f1_ready = true; // the snapshot has been extracted and is ready to be sent
441 swf_f1_ready = true; // the snapshot has been extracted and is ready to be sent
457 }
442 }
458 else
443 else
459 {
444 {
460 PRINTF1("in SWBD *** unexpected rtems event received %x\n", (int) event_out)
445 PRINTF1("in SWBD *** unexpected rtems event received %x\n", (int) event_out)
461 }
446 }
462 }
447 }
463 }
448 }
464
449
465 //******************
450 //******************
466 // general functions
451 // general functions
467 void init_waveforms( void )
452 void init_waveforms( void )
468 {
453 {
469 int i = 0;
454 int i = 0;
470
455
471 for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
456 for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
472 {
457 {
473 //***
458 //***
474 // F0
459 // F0
475 // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x88887777; //
460 // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x88887777; //
476 // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; //
461 // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; //
477 // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x44443333; //
462 // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x44443333; //
478
463
479 //***
464 //***
480 // F1
465 // F1
481 // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x22221111;
466 // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x22221111;
482 // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x44443333;
467 // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x44443333;
483 // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
468 // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
484
469
485 //***
470 //***
486 // F2
471 // F2
487 // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x44443333;
472 // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x44443333;
488 // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111;
473 // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111;
489 // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
474 // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
490
475
491 //***
476 //***
492 // F3
477 // F3
493 // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 0 ] = val1;
478 // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 0 ] = val1;
494 // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 1 ] = val2;
479 // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 1 ] = val2;
495 // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 2 ] = 0xaaaa0000;
480 // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 2 ] = 0xaaaa0000;
496 }
481 }
497 }
482 }
498
483
499 void init_waveform_rings( void )
484 void init_waveform_rings( void )
500 {
485 {
501 unsigned char i;
502
503 // F0 RING
486 // F0 RING
504 waveform_ring_f0[0].next = (ring_node*) &waveform_ring_f0[1];
487 init_waveform_ring( waveform_ring_f0, NB_RING_NODES_F0, wf_snap_f0 );
505 waveform_ring_f0[0].previous = (ring_node*) &waveform_ring_f0[NB_RING_NODES_F0-1];
506 waveform_ring_f0[0].buffer_address = (int) &wf_snap_f0[0][0];
507
508 waveform_ring_f0[NB_RING_NODES_F0-1].next = (ring_node*) &waveform_ring_f0[0];
509 waveform_ring_f0[NB_RING_NODES_F0-1].previous = (ring_node*) &waveform_ring_f0[NB_RING_NODES_F0-2];
510 waveform_ring_f0[NB_RING_NODES_F0-1].buffer_address = (int) &wf_snap_f0[NB_RING_NODES_F0-1][0];
511
512 for(i=1; i<NB_RING_NODES_F0-1; i++)
513 {
514 waveform_ring_f0[i].next = (ring_node*) &waveform_ring_f0[i+1];
515 waveform_ring_f0[i].previous = (ring_node*) &waveform_ring_f0[i-1];
516 waveform_ring_f0[i].buffer_address = (int) &wf_snap_f0[i][0];
517 }
518
519 // F1 RING
488 // F1 RING
520 waveform_ring_f1[0].next = (ring_node*) &waveform_ring_f1[1];
489 init_waveform_ring( waveform_ring_f1, NB_RING_NODES_F1, wf_snap_f1 );
521 waveform_ring_f1[0].previous = (ring_node*) &waveform_ring_f1[NB_RING_NODES_F1-1];
522 waveform_ring_f1[0].buffer_address = (int) &wf_snap_f1[0][0];
523
524 waveform_ring_f1[NB_RING_NODES_F1-1].next = (ring_node*) &waveform_ring_f1[0];
525 waveform_ring_f1[NB_RING_NODES_F1-1].previous = (ring_node*) &waveform_ring_f1[NB_RING_NODES_F1-2];
526 waveform_ring_f1[NB_RING_NODES_F1-1].buffer_address = (int) &wf_snap_f1[NB_RING_NODES_F1-1][0];
527
528 for(i=1; i<NB_RING_NODES_F1-1; i++)
529 {
530 waveform_ring_f1[i].next = (ring_node*) &waveform_ring_f1[i+1];
531 waveform_ring_f1[i].previous = (ring_node*) &waveform_ring_f1[i-1];
532 waveform_ring_f1[i].buffer_address = (int) &wf_snap_f1[i][0];
533 }
534
535 // F2 RING
490 // F2 RING
536 waveform_ring_f2[0].next = (ring_node*) &waveform_ring_f2[1];
491 init_waveform_ring( waveform_ring_f2, NB_RING_NODES_F2, wf_snap_f2 );
537 waveform_ring_f2[0].previous = (ring_node*) &waveform_ring_f2[NB_RING_NODES_F2-1];
492 // F3 RING
538 waveform_ring_f2[0].buffer_address = (int) &wf_snap_f2[0][0];
493 init_waveform_ring( waveform_ring_f3, NB_RING_NODES_F3, wf_cont_f3 );
539
540 waveform_ring_f2[NB_RING_NODES_F2-1].next = (ring_node*) &waveform_ring_f2[0];
541 waveform_ring_f2[NB_RING_NODES_F2-1].previous = (ring_node*) &waveform_ring_f2[NB_RING_NODES_F2-2];
542 waveform_ring_f2[NB_RING_NODES_F2-1].buffer_address = (int) &wf_snap_f2[NB_RING_NODES_F2-1][0];
543
544 for(i=1; i<NB_RING_NODES_F2-1; i++)
545 {
546 waveform_ring_f2[i].next = (ring_node*) &waveform_ring_f2[i+1];
547 waveform_ring_f2[i].previous = (ring_node*) &waveform_ring_f2[i-1];
548 waveform_ring_f2[i].buffer_address = (int) &wf_snap_f2[i][0];
549 }
550
494
551 DEBUG_PRINTF1("waveform_ring_f0 @%x\n", (unsigned int) waveform_ring_f0)
495 DEBUG_PRINTF1("waveform_ring_f0 @%x\n", (unsigned int) waveform_ring_f0)
552 DEBUG_PRINTF1("waveform_ring_f1 @%x\n", (unsigned int) waveform_ring_f1)
496 DEBUG_PRINTF1("waveform_ring_f1 @%x\n", (unsigned int) waveform_ring_f1)
553 DEBUG_PRINTF1("waveform_ring_f2 @%x\n", (unsigned int) waveform_ring_f2)
497 DEBUG_PRINTF1("waveform_ring_f2 @%x\n", (unsigned int) waveform_ring_f2)
498 DEBUG_PRINTF1("waveform_ring_f3 @%x\n", (unsigned int) waveform_ring_f3)
499 }
554
500
501 void init_waveform_ring(ring_node waveform_ring[], unsigned char nbNodes, volatile int wfrm[] )
502 {
503 unsigned char i;
504
505 waveform_ring[0].next = (ring_node*) &waveform_ring[ 1 ];
506 waveform_ring[0].previous = (ring_node*) &waveform_ring[ nbNodes - 1 ];
507 waveform_ring[0].buffer_address = (int) &wfrm[0];
508
509 waveform_ring[nbNodes-1].next = (ring_node*) &waveform_ring[ 0 ];
510 waveform_ring[nbNodes-1].previous = (ring_node*) &waveform_ring[ nbNodes - 2 ];
511 waveform_ring[nbNodes-1].buffer_address = (int) &wfrm[ (nbNodes-1) * WFRM_BUFFER ];
512
513 for(i=1; i<nbNodes-1; i++)
514 {
515 waveform_ring[i].next = (ring_node*) &waveform_ring[ i + 1 ];
516 waveform_ring[i].previous = (ring_node*) &waveform_ring[ i - 1 ];
517 waveform_ring[i].buffer_address = (int) &wfrm[ i * WFRM_BUFFER ];
518 }
555 }
519 }
556
520
557 void reset_current_ring_nodes( void )
521 void reset_current_ring_nodes( void )
558 {
522 {
559 current_ring_node_f0 = waveform_ring_f0;
523 current_ring_node_f0 = waveform_ring_f0;
560 ring_node_to_send_swf_f0 = waveform_ring_f0;
524 ring_node_to_send_swf_f0 = waveform_ring_f0;
561
525
562 current_ring_node_f1 = waveform_ring_f1;
526 current_ring_node_f1 = waveform_ring_f1;
563 ring_node_to_send_cwf_f1 = waveform_ring_f1;
527 ring_node_to_send_cwf_f1 = waveform_ring_f1;
564 ring_node_to_send_swf_f1 = waveform_ring_f1;
528 ring_node_to_send_swf_f1 = waveform_ring_f1;
565
529
566 current_ring_node_f2 = waveform_ring_f2;
530 current_ring_node_f2 = waveform_ring_f2;
567 ring_node_to_send_cwf_f2 = waveform_ring_f2;
531 ring_node_to_send_cwf_f2 = waveform_ring_f2;
568 ring_node_to_send_swf_f2 = waveform_ring_f2;
532 ring_node_to_send_swf_f2 = waveform_ring_f2;
533
534 current_ring_node_f3 = waveform_ring_f3;
535 ring_node_to_send_cwf_f3 = waveform_ring_f3;
569 }
536 }
570
537
571 int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF)
538 int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF)
572 {
539 {
573 unsigned char i;
540 unsigned char i;
574
541
575 for (i=0; i<7; i++)
542 for (i=0; i<7; i++)
576 {
543 {
577 headerSWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
544 headerSWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
578 headerSWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
545 headerSWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
579 headerSWF[ i ].reserved = DEFAULT_RESERVED;
546 headerSWF[ i ].reserved = DEFAULT_RESERVED;
580 headerSWF[ i ].userApplication = CCSDS_USER_APP;
547 headerSWF[ i ].userApplication = CCSDS_USER_APP;
581 headerSWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8);
548 headerSWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8);
582 headerSWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST);
549 headerSWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST);
583 headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
550 headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
584 if (i == 6)
551 if (i == 6)
585 {
552 {
586 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_224 >> 8);
553 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_224 >> 8);
587 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_224 );
554 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_224 );
588 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_224 >> 8);
555 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_224 >> 8);
589 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_224 );
556 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_224 );
590 }
557 }
591 else
558 else
592 {
559 {
593 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_304 >> 8);
560 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_304 >> 8);
594 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_304 );
561 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_304 );
595 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_304 >> 8);
562 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_304 >> 8);
596 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_304 );
563 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_304 );
597 }
564 }
598 headerSWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
565 headerSWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
599 headerSWF[ i ].pktCnt = DEFAULT_PKTCNT; // PKT_CNT
566 headerSWF[ i ].pktCnt = DEFAULT_PKTCNT; // PKT_CNT
600 headerSWF[ i ].pktNr = i+1; // PKT_NR
567 headerSWF[ i ].pktNr = i+1; // PKT_NR
601 // DATA FIELD HEADER
568 // DATA FIELD HEADER
602 headerSWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
569 headerSWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
603 headerSWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
570 headerSWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
604 headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
571 headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
605 headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
572 headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
606 // AUXILIARY DATA HEADER
573 // AUXILIARY DATA HEADER
607 headerSWF[ i ].time[0] = 0x00;
574 headerSWF[ i ].time[0] = 0x00;
608 headerSWF[ i ].time[0] = 0x00;
575 headerSWF[ i ].time[0] = 0x00;
609 headerSWF[ i ].time[0] = 0x00;
576 headerSWF[ i ].time[0] = 0x00;
610 headerSWF[ i ].time[0] = 0x00;
577 headerSWF[ i ].time[0] = 0x00;
611 headerSWF[ i ].time[0] = 0x00;
578 headerSWF[ i ].time[0] = 0x00;
612 headerSWF[ i ].time[0] = 0x00;
579 headerSWF[ i ].time[0] = 0x00;
613 headerSWF[ i ].sid = sid;
580 headerSWF[ i ].sid = sid;
614 headerSWF[ i ].hkBIA = DEFAULT_HKBIA;
581 headerSWF[ i ].hkBIA = DEFAULT_HKBIA;
615 }
582 }
616 return LFR_SUCCESSFUL;
583 return LFR_SUCCESSFUL;
617 }
584 }
618
585
619 int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF )
586 int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF )
620 {
587 {
621 unsigned int i;
588 unsigned int i;
622
589
623 for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF; i++)
590 for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF; i++)
624 {
591 {
625 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
592 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
626 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
593 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
627 headerCWF[ i ].reserved = DEFAULT_RESERVED;
594 headerCWF[ i ].reserved = DEFAULT_RESERVED;
628 headerCWF[ i ].userApplication = CCSDS_USER_APP;
595 headerCWF[ i ].userApplication = CCSDS_USER_APP;
629 if ( (sid == SID_SBM1_CWF_F1) || (sid == SID_SBM2_CWF_F2) )
596 if ( (sid == SID_SBM1_CWF_F1) || (sid == SID_SBM2_CWF_F2) )
630 {
597 {
631 headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_SBM1_SBM2 >> 8);
598 headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_SBM1_SBM2 >> 8);
632 headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_SBM1_SBM2);
599 headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_SBM1_SBM2);
633 }
600 }
634 else
601 else
635 {
602 {
636 headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8);
603 headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8);
637 headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST);
604 headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST);
638 }
605 }
639 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
606 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
640 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_336 >> 8);
607 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_336 >> 8);
641 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_336 );
608 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_336 );
642 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF >> 8);
609 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF >> 8);
643 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF );
610 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF );
644 headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
611 headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
645 // DATA FIELD HEADER
612 // DATA FIELD HEADER
646 headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
613 headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
647 headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
614 headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
648 headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
615 headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
649 headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
616 headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
650 // AUXILIARY DATA HEADER
617 // AUXILIARY DATA HEADER
651 headerCWF[ i ].sid = sid;
618 headerCWF[ i ].sid = sid;
652 headerCWF[ i ].hkBIA = DEFAULT_HKBIA;
619 headerCWF[ i ].hkBIA = DEFAULT_HKBIA;
653 headerCWF[ i ].time[0] = 0x00;
620 headerCWF[ i ].time[0] = 0x00;
654 headerCWF[ i ].time[0] = 0x00;
621 headerCWF[ i ].time[0] = 0x00;
655 headerCWF[ i ].time[0] = 0x00;
622 headerCWF[ i ].time[0] = 0x00;
656 headerCWF[ i ].time[0] = 0x00;
623 headerCWF[ i ].time[0] = 0x00;
657 headerCWF[ i ].time[0] = 0x00;
624 headerCWF[ i ].time[0] = 0x00;
658 headerCWF[ i ].time[0] = 0x00;
625 headerCWF[ i ].time[0] = 0x00;
659 }
626 }
660 return LFR_SUCCESSFUL;
627 return LFR_SUCCESSFUL;
661 }
628 }
662
629
663 int init_header_continuous_cwf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF )
630 int init_header_continuous_cwf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF )
664 {
631 {
665 unsigned int i;
632 unsigned int i;
666
633
667 for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF_LIGHT; i++)
634 for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF_LIGHT; i++)
668 {
635 {
669 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
636 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
670 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
637 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
671 headerCWF[ i ].reserved = DEFAULT_RESERVED;
638 headerCWF[ i ].reserved = DEFAULT_RESERVED;
672 headerCWF[ i ].userApplication = CCSDS_USER_APP;
639 headerCWF[ i ].userApplication = CCSDS_USER_APP;
673
640
674 headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8);
641 headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8);
675 headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST);
642 headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST);
676
643
677 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
644 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
678 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_672 >> 8);
645 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_672 >> 8);
679 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_672 );
646 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_672 );
680 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF_SHORT_F3 >> 8);
647 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF_SHORT_F3 >> 8);
681 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF_SHORT_F3 );
648 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF_SHORT_F3 );
682
649
683 headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
650 headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
684 // DATA FIELD HEADER
651 // DATA FIELD HEADER
685 headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
652 headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
686 headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
653 headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
687 headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
654 headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
688 headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
655 headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
689 // AUXILIARY DATA HEADER
656 // AUXILIARY DATA HEADER
690 headerCWF[ i ].sid = SID_NORM_CWF_F3;
657 headerCWF[ i ].sid = SID_NORM_CWF_F3;
691 headerCWF[ i ].hkBIA = DEFAULT_HKBIA;
658 headerCWF[ i ].hkBIA = DEFAULT_HKBIA;
692 headerCWF[ i ].time[0] = 0x00;
659 headerCWF[ i ].time[0] = 0x00;
693 headerCWF[ i ].time[0] = 0x00;
660 headerCWF[ i ].time[0] = 0x00;
694 headerCWF[ i ].time[0] = 0x00;
661 headerCWF[ i ].time[0] = 0x00;
695 headerCWF[ i ].time[0] = 0x00;
662 headerCWF[ i ].time[0] = 0x00;
696 headerCWF[ i ].time[0] = 0x00;
663 headerCWF[ i ].time[0] = 0x00;
697 headerCWF[ i ].time[0] = 0x00;
664 headerCWF[ i ].time[0] = 0x00;
698 }
665 }
699 return LFR_SUCCESSFUL;
666 return LFR_SUCCESSFUL;
700 }
667 }
701
668
702 int send_waveform_SWF( volatile int *waveform, unsigned int sid,
669 int send_waveform_SWF( volatile int *waveform, unsigned int sid,
703 Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id )
670 Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id )
704 {
671 {
705 /** This function sends SWF CCSDS packets (F2, F1 or F0).
672 /** This function sends SWF CCSDS packets (F2, F1 or F0).
706 *
673 *
707 * @param waveform points to the buffer containing the data that will be send.
674 * @param waveform points to the buffer containing the data that will be send.
708 * @param sid is the source identifier of the data that will be sent.
675 * @param sid is the source identifier of the data that will be sent.
709 * @param headerSWF points to a table of headers that have been prepared for the data transmission.
676 * @param headerSWF points to a table of headers that have been prepared for the data transmission.
710 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
677 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
711 * contain information to setup the transmission of the data packets.
678 * contain information to setup the transmission of the data packets.
712 *
679 *
713 * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks.
680 * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks.
714 *
681 *
715 */
682 */
716
683
717 unsigned int i;
684 unsigned int i;
718 int ret;
685 int ret;
719 unsigned int coarseTime;
686 unsigned int coarseTime;
720 unsigned int fineTime;
687 unsigned int fineTime;
721 rtems_status_code status;
688 rtems_status_code status;
722 spw_ioctl_pkt_send spw_ioctl_send_SWF;
689 spw_ioctl_pkt_send spw_ioctl_send_SWF;
723
690
724 spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header
691 spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header
725 spw_ioctl_send_SWF.options = 0;
692 spw_ioctl_send_SWF.options = 0;
726
693
727 ret = LFR_DEFAULT;
694 ret = LFR_DEFAULT;
728
695
729 coarseTime = waveform[0];
696 coarseTime = waveform[0];
730 fineTime = waveform[1];
697 fineTime = waveform[1];
731
698
732 for (i=0; i<7; i++) // send waveform
699 for (i=0; i<7; i++) // send waveform
733 {
700 {
734 spw_ioctl_send_SWF.data = (char*) &waveform[ (i * BLK_NR_304 * NB_WORDS_SWF_BLK) + TIME_OFFSET];
701 spw_ioctl_send_SWF.data = (char*) &waveform[ (i * BLK_NR_304 * NB_WORDS_SWF_BLK) + TIME_OFFSET];
735 spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ];
702 spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ];
736 // BUILD THE DATA
703 // BUILD THE DATA
737 if (i==6) {
704 if (i==6) {
738 spw_ioctl_send_SWF.dlen = BLK_NR_224 * NB_BYTES_SWF_BLK;
705 spw_ioctl_send_SWF.dlen = BLK_NR_224 * NB_BYTES_SWF_BLK;
739 }
706 }
740 else {
707 else {
741 spw_ioctl_send_SWF.dlen = BLK_NR_304 * NB_BYTES_SWF_BLK;
708 spw_ioctl_send_SWF.dlen = BLK_NR_304 * NB_BYTES_SWF_BLK;
742 }
709 }
743 // SET PACKET SEQUENCE COUNTER
710 // SET PACKET SEQUENCE COUNTER
744 increment_seq_counter_source_id( headerSWF[ i ].packetSequenceControl, sid );
711 increment_seq_counter_source_id( headerSWF[ i ].packetSequenceControl, sid );
745 // SET PACKET TIME
712 // SET PACKET TIME
746 compute_acquisition_time( coarseTime, fineTime, sid, i, headerSWF[ i ].acquisitionTime );
713 compute_acquisition_time( coarseTime, fineTime, sid, i, headerSWF[ i ].acquisitionTime );
747 //
714 //
748 headerSWF[ i ].time[0] = headerSWF[ i ].acquisitionTime[0];
715 headerSWF[ i ].time[0] = headerSWF[ i ].acquisitionTime[0];
749 headerSWF[ i ].time[1] = headerSWF[ i ].acquisitionTime[1];
716 headerSWF[ i ].time[1] = headerSWF[ i ].acquisitionTime[1];
750 headerSWF[ i ].time[2] = headerSWF[ i ].acquisitionTime[2];
717 headerSWF[ i ].time[2] = headerSWF[ i ].acquisitionTime[2];
751 headerSWF[ i ].time[3] = headerSWF[ i ].acquisitionTime[3];
718 headerSWF[ i ].time[3] = headerSWF[ i ].acquisitionTime[3];
752 headerSWF[ i ].time[4] = headerSWF[ i ].acquisitionTime[4];
719 headerSWF[ i ].time[4] = headerSWF[ i ].acquisitionTime[4];
753 headerSWF[ i ].time[5] = headerSWF[ i ].acquisitionTime[5];
720 headerSWF[ i ].time[5] = headerSWF[ i ].acquisitionTime[5];
754 // SEND PACKET
721 // SEND PACKET
755 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_SWF, ACTION_MSG_SPW_IOCTL_SEND_SIZE);
722 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_SWF, ACTION_MSG_SPW_IOCTL_SEND_SIZE);
756 if (status != RTEMS_SUCCESSFUL) {
723 if (status != RTEMS_SUCCESSFUL) {
757 printf("%d-%d, ERR %d\n", sid, i, (int) status);
724 printf("%d-%d, ERR %d\n", sid, i, (int) status);
758 ret = LFR_DEFAULT;
725 ret = LFR_DEFAULT;
759 }
726 }
760 rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds
727 rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds
761 }
728 }
762
729
763 return ret;
730 return ret;
764 }
731 }
765
732
766 int send_waveform_CWF(volatile int *waveform, unsigned int sid,
733 int send_waveform_CWF(volatile int *waveform, unsigned int sid,
767 Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id)
734 Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id)
768 {
735 {
769 /** This function sends CWF CCSDS packets (F2, F1 or F0).
736 /** This function sends CWF CCSDS packets (F2, F1 or F0).
770 *
737 *
771 * @param waveform points to the buffer containing the data that will be send.
738 * @param waveform points to the buffer containing the data that will be send.
772 * @param sid is the source identifier of the data that will be sent.
739 * @param sid is the source identifier of the data that will be sent.
773 * @param headerCWF points to a table of headers that have been prepared for the data transmission.
740 * @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
741 * @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.
742 * contain information to setup the transmission of the data packets.
776 *
743 *
777 * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks.
744 * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks.
778 *
745 *
779 */
746 */
780
747
781 unsigned int i;
748 unsigned int i;
782 int ret;
749 int ret;
783 unsigned int coarseTime;
750 unsigned int coarseTime;
784 unsigned int fineTime;
751 unsigned int fineTime;
785 rtems_status_code status;
752 rtems_status_code status;
786 spw_ioctl_pkt_send spw_ioctl_send_CWF;
753 spw_ioctl_pkt_send spw_ioctl_send_CWF;
787
754
788 spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
755 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.options = 0;
756 spw_ioctl_send_CWF.options = 0;
790
757
791 ret = LFR_DEFAULT;
758 ret = LFR_DEFAULT;
792
759
793 coarseTime = waveform[0];
760 coarseTime = waveform[0];
794 fineTime = waveform[1];
761 fineTime = waveform[1];
795
762
796 for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF; i++) // send waveform
763 for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF; i++) // send waveform
797 {
764 {
798 spw_ioctl_send_CWF.data = (char*) &waveform[ (i * BLK_NR_CWF * NB_WORDS_SWF_BLK) + TIME_OFFSET];
765 spw_ioctl_send_CWF.data = (char*) &waveform[ (i * BLK_NR_CWF * NB_WORDS_SWF_BLK) + TIME_OFFSET];
799 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
766 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
800 // BUILD THE DATA
767 // BUILD THE DATA
801 spw_ioctl_send_CWF.dlen = BLK_NR_CWF * NB_BYTES_SWF_BLK;
768 spw_ioctl_send_CWF.dlen = BLK_NR_CWF * NB_BYTES_SWF_BLK;
802 // SET PACKET SEQUENCE COUNTER
769 // SET PACKET SEQUENCE COUNTER
803 increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, sid );
770 increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, sid );
804 // SET PACKET TIME
771 // SET PACKET TIME
805 compute_acquisition_time( coarseTime, fineTime, sid, i, headerCWF[ i ].acquisitionTime);
772 compute_acquisition_time( coarseTime, fineTime, sid, i, headerCWF[ i ].acquisitionTime);
806 //
773 //
807 headerCWF[ i ].time[0] = headerCWF[ i ].acquisitionTime[0];
774 headerCWF[ i ].time[0] = headerCWF[ i ].acquisitionTime[0];
808 headerCWF[ i ].time[1] = headerCWF[ i ].acquisitionTime[1];
775 headerCWF[ i ].time[1] = headerCWF[ i ].acquisitionTime[1];
809 headerCWF[ i ].time[2] = headerCWF[ i ].acquisitionTime[2];
776 headerCWF[ i ].time[2] = headerCWF[ i ].acquisitionTime[2];
810 headerCWF[ i ].time[3] = headerCWF[ i ].acquisitionTime[3];
777 headerCWF[ i ].time[3] = headerCWF[ i ].acquisitionTime[3];
811 headerCWF[ i ].time[4] = headerCWF[ i ].acquisitionTime[4];
778 headerCWF[ i ].time[4] = headerCWF[ i ].acquisitionTime[4];
812 headerCWF[ i ].time[5] = headerCWF[ i ].acquisitionTime[5];
779 headerCWF[ i ].time[5] = headerCWF[ i ].acquisitionTime[5];
813 // SEND PACKET
780 // SEND PACKET
814 if (sid == SID_NORM_CWF_LONG_F3)
781 if (sid == SID_NORM_CWF_LONG_F3)
815 {
782 {
816 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
783 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
817 if (status != RTEMS_SUCCESSFUL) {
784 if (status != RTEMS_SUCCESSFUL) {
818 printf("%d-%d, ERR %d\n", sid, i, (int) status);
785 printf("%d-%d, ERR %d\n", sid, i, (int) status);
819 ret = LFR_DEFAULT;
786 ret = LFR_DEFAULT;
820 }
787 }
821 rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS);
788 rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS);
822 }
789 }
823 else
790 else
824 {
791 {
825 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
792 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
826 if (status != RTEMS_SUCCESSFUL) {
793 if (status != RTEMS_SUCCESSFUL) {
827 printf("%d-%d, ERR %d\n", sid, i, (int) status);
794 printf("%d-%d, ERR %d\n", sid, i, (int) status);
828 ret = LFR_DEFAULT;
795 ret = LFR_DEFAULT;
829 }
796 }
830 }
797 }
831 }
798 }
832
799
833 return ret;
800 return ret;
834 }
801 }
835
802
836 int send_waveform_CWF3_light(volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id)
803 int send_waveform_CWF3_light(volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id)
837 {
804 {
838 /** This function sends CWF_F3 CCSDS packets without the b1, b2 and b3 data.
805 /** This function sends CWF_F3 CCSDS packets without the b1, b2 and b3 data.
839 *
806 *
840 * @param waveform points to the buffer containing the data that will be send.
807 * @param waveform points to the buffer containing the data that will be send.
841 * @param headerCWF points to a table of headers that have been prepared for the data transmission.
808 * @param headerCWF points to a table of headers that have been prepared for the data transmission.
842 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
809 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
843 * contain information to setup the transmission of the data packets.
810 * contain information to setup the transmission of the data packets.
844 *
811 *
845 * By default, CWF_F3 packet are send without the b1, b2 and b3 data. This function rebuilds a data buffer
812 * By default, CWF_F3 packet are send without the b1, b2 and b3 data. This function rebuilds a data buffer
846 * from the incoming data and sends it in 7 packets, 6 containing 340 blocks and 1 one containing 8 blocks.
813 * from the incoming data and sends it in 7 packets, 6 containing 340 blocks and 1 one containing 8 blocks.
847 *
814 *
848 */
815 */
849
816
850 unsigned int i;
817 unsigned int i;
851 int ret;
818 int ret;
852 unsigned int coarseTime;
819 unsigned int coarseTime;
853 unsigned int fineTime;
820 unsigned int fineTime;
854 rtems_status_code status;
821 rtems_status_code status;
855 spw_ioctl_pkt_send spw_ioctl_send_CWF;
822 spw_ioctl_pkt_send spw_ioctl_send_CWF;
856 char *sample;
823 char *sample;
857
824
858 spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
825 spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
859 spw_ioctl_send_CWF.options = 0;
826 spw_ioctl_send_CWF.options = 0;
860
827
861 ret = LFR_DEFAULT;
828 ret = LFR_DEFAULT;
862
829
863 //**********************
830 //**********************
864 // BUILD CWF3_light DATA
831 // BUILD CWF3_light DATA
865 for ( i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
832 for ( i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
866 {
833 {
867 sample = (char*) &waveform[ (i * NB_WORDS_SWF_BLK) + TIME_OFFSET ];
834 sample = (char*) &waveform[ (i * NB_WORDS_SWF_BLK) + TIME_OFFSET ];
868 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + TIME_OFFSET_IN_BYTES ] = sample[ 0 ];
835 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + TIME_OFFSET_IN_BYTES ] = sample[ 0 ];
869 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 + TIME_OFFSET_IN_BYTES ] = sample[ 1 ];
836 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 + TIME_OFFSET_IN_BYTES ] = sample[ 1 ];
870 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 + TIME_OFFSET_IN_BYTES ] = sample[ 2 ];
837 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 + TIME_OFFSET_IN_BYTES ] = sample[ 2 ];
871 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 + TIME_OFFSET_IN_BYTES ] = sample[ 3 ];
838 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 + TIME_OFFSET_IN_BYTES ] = sample[ 3 ];
872 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 + TIME_OFFSET_IN_BYTES ] = sample[ 4 ];
839 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 + TIME_OFFSET_IN_BYTES ] = sample[ 4 ];
873 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 + TIME_OFFSET_IN_BYTES ] = sample[ 5 ];
840 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 + TIME_OFFSET_IN_BYTES ] = sample[ 5 ];
874 }
841 }
875
842
876 coarseTime = waveform[0];
843 coarseTime = waveform[0];
877 fineTime = waveform[1];
844 fineTime = waveform[1];
878
845
879 //*********************
846 //*********************
880 // SEND CWF3_light DATA
847 // SEND CWF3_light DATA
881 for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF_LIGHT; i++) // send waveform
848 for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF_LIGHT; i++) // send waveform
882 {
849 {
883 spw_ioctl_send_CWF.data = (char*) &wf_cont_f3_light[ (i * BLK_NR_CWF_SHORT_F3 * NB_BYTES_CWF3_LIGHT_BLK) + TIME_OFFSET_IN_BYTES];
850 spw_ioctl_send_CWF.data = (char*) &wf_cont_f3_light[ (i * BLK_NR_CWF_SHORT_F3 * NB_BYTES_CWF3_LIGHT_BLK) + TIME_OFFSET_IN_BYTES];
884 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
851 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
885 // BUILD THE DATA
852 // BUILD THE DATA
886 spw_ioctl_send_CWF.dlen = BLK_NR_CWF_SHORT_F3 * NB_BYTES_CWF3_LIGHT_BLK;
853 spw_ioctl_send_CWF.dlen = BLK_NR_CWF_SHORT_F3 * NB_BYTES_CWF3_LIGHT_BLK;
887 // SET PACKET SEQUENCE COUNTER
854 // SET PACKET SEQUENCE COUNTER
888 increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, SID_NORM_CWF_F3 );
855 increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, SID_NORM_CWF_F3 );
889 // SET PACKET TIME
856 // SET PACKET TIME
890 compute_acquisition_time( coarseTime, fineTime, SID_NORM_CWF_F3, i, headerCWF[ i ].acquisitionTime );
857 compute_acquisition_time( coarseTime, fineTime, SID_NORM_CWF_F3, i, headerCWF[ i ].acquisitionTime );
891 //
858 //
892 headerCWF[ i ].time[0] = headerCWF[ i ].acquisitionTime[0];
859 headerCWF[ i ].time[0] = headerCWF[ i ].acquisitionTime[0];
893 headerCWF[ i ].time[1] = headerCWF[ i ].acquisitionTime[1];
860 headerCWF[ i ].time[1] = headerCWF[ i ].acquisitionTime[1];
894 headerCWF[ i ].time[2] = headerCWF[ i ].acquisitionTime[2];
861 headerCWF[ i ].time[2] = headerCWF[ i ].acquisitionTime[2];
895 headerCWF[ i ].time[3] = headerCWF[ i ].acquisitionTime[3];
862 headerCWF[ i ].time[3] = headerCWF[ i ].acquisitionTime[3];
896 headerCWF[ i ].time[4] = headerCWF[ i ].acquisitionTime[4];
863 headerCWF[ i ].time[4] = headerCWF[ i ].acquisitionTime[4];
897 headerCWF[ i ].time[5] = headerCWF[ i ].acquisitionTime[5];
864 headerCWF[ i ].time[5] = headerCWF[ i ].acquisitionTime[5];
898 // SEND PACKET
865 // SEND PACKET
899 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
866 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
900 if (status != RTEMS_SUCCESSFUL) {
867 if (status != RTEMS_SUCCESSFUL) {
901 printf("%d-%d, ERR %d\n", SID_NORM_CWF_F3, i, (int) status);
868 printf("%d-%d, ERR %d\n", SID_NORM_CWF_F3, i, (int) status);
902 ret = LFR_DEFAULT;
869 ret = LFR_DEFAULT;
903 }
870 }
904 rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS);
871 rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS);
905 }
872 }
906
873
907 return ret;
874 return ret;
908 }
875 }
909
876
910 void compute_acquisition_time( unsigned int coarseTime, unsigned int fineTime,
877 void compute_acquisition_time( unsigned int coarseTime, unsigned int fineTime,
911 unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char * acquisitionTime )
878 unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char * acquisitionTime )
912 {
879 {
913 unsigned long long int acquisitionTimeAsLong;
880 unsigned long long int acquisitionTimeAsLong;
914 unsigned char localAcquisitionTime[6];
881 unsigned char localAcquisitionTime[6];
915 double deltaT;
882 double deltaT;
916
883
917 deltaT = 0.;
884 deltaT = 0.;
918
885
919 localAcquisitionTime[0] = (unsigned char) ( coarseTime >> 8 );
886 localAcquisitionTime[0] = (unsigned char) ( coarseTime >> 8 );
920 localAcquisitionTime[1] = (unsigned char) ( coarseTime );
887 localAcquisitionTime[1] = (unsigned char) ( coarseTime );
921 localAcquisitionTime[2] = (unsigned char) ( coarseTime >> 24 );
888 localAcquisitionTime[2] = (unsigned char) ( coarseTime >> 24 );
922 localAcquisitionTime[3] = (unsigned char) ( coarseTime >> 16 );
889 localAcquisitionTime[3] = (unsigned char) ( coarseTime >> 16 );
923 localAcquisitionTime[4] = (unsigned char) ( fineTime >> 24 );
890 localAcquisitionTime[4] = (unsigned char) ( fineTime >> 24 );
924 localAcquisitionTime[5] = (unsigned char) ( fineTime >> 16 );
891 localAcquisitionTime[5] = (unsigned char) ( fineTime >> 16 );
925
892
926 acquisitionTimeAsLong = ( (unsigned long long int) localAcquisitionTime[0] << 40 )
893 acquisitionTimeAsLong = ( (unsigned long long int) localAcquisitionTime[0] << 40 )
927 + ( (unsigned long long int) localAcquisitionTime[1] << 32 )
894 + ( (unsigned long long int) localAcquisitionTime[1] << 32 )
928 + ( localAcquisitionTime[2] << 24 )
895 + ( localAcquisitionTime[2] << 24 )
929 + ( localAcquisitionTime[3] << 16 )
896 + ( localAcquisitionTime[3] << 16 )
930 + ( localAcquisitionTime[4] << 8 )
897 + ( localAcquisitionTime[4] << 8 )
931 + ( localAcquisitionTime[5] );
898 + ( localAcquisitionTime[5] );
932
899
933 switch( sid )
900 switch( sid )
934 {
901 {
935 case SID_NORM_SWF_F0:
902 case SID_NORM_SWF_F0:
936 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 24576. ;
903 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 24576. ;
937 break;
904 break;
938
905
939 case SID_NORM_SWF_F1:
906 case SID_NORM_SWF_F1:
940 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 4096. ;
907 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 4096. ;
941 break;
908 break;
942
909
943 case SID_NORM_SWF_F2:
910 case SID_NORM_SWF_F2:
944 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 256. ;
911 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 256. ;
945 break;
912 break;
946
913
947 case SID_SBM1_CWF_F1:
914 case SID_SBM1_CWF_F1:
948 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 4096. ;
915 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 4096. ;
949 break;
916 break;
950
917
951 case SID_SBM2_CWF_F2:
918 case SID_SBM2_CWF_F2:
952 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ;
919 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ;
953 break;
920 break;
954
921
955 case SID_BURST_CWF_F2:
922 case SID_BURST_CWF_F2:
956 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ;
923 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ;
957 break;
924 break;
958
925
959 case SID_NORM_CWF_F3:
926 case SID_NORM_CWF_F3:
960 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF_SHORT_F3 * 65536. / 16. ;
927 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF_SHORT_F3 * 65536. / 16. ;
961 break;
928 break;
962
929
963 case SID_NORM_CWF_LONG_F3:
930 case SID_NORM_CWF_LONG_F3:
964 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 16. ;
931 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 16. ;
965 break;
932 break;
966
933
967 default:
934 default:
968 PRINTF1("in compute_acquisition_time *** ERR unexpected sid %d", sid)
935 PRINTF1("in compute_acquisition_time *** ERR unexpected sid %d", sid)
969 deltaT = 0.;
936 deltaT = 0.;
970 break;
937 break;
971 }
938 }
972
939
973 acquisitionTimeAsLong = acquisitionTimeAsLong + (unsigned long long int) deltaT;
940 acquisitionTimeAsLong = acquisitionTimeAsLong + (unsigned long long int) deltaT;
974 //
941 //
975 acquisitionTime[0] = (unsigned char) (acquisitionTimeAsLong >> 40);
942 acquisitionTime[0] = (unsigned char) (acquisitionTimeAsLong >> 40);
976 acquisitionTime[1] = (unsigned char) (acquisitionTimeAsLong >> 32);
943 acquisitionTime[1] = (unsigned char) (acquisitionTimeAsLong >> 32);
977 acquisitionTime[2] = (unsigned char) (acquisitionTimeAsLong >> 24);
944 acquisitionTime[2] = (unsigned char) (acquisitionTimeAsLong >> 24);
978 acquisitionTime[3] = (unsigned char) (acquisitionTimeAsLong >> 16);
945 acquisitionTime[3] = (unsigned char) (acquisitionTimeAsLong >> 16);
979 acquisitionTime[4] = (unsigned char) (acquisitionTimeAsLong >> 8 );
946 acquisitionTime[4] = (unsigned char) (acquisitionTimeAsLong >> 8 );
980 acquisitionTime[5] = (unsigned char) (acquisitionTimeAsLong );
947 acquisitionTime[5] = (unsigned char) (acquisitionTimeAsLong );
981
948
982 }
949 }
983
950
984 void build_snapshot_from_ring( ring_node *ring_node_to_send, unsigned char frequencyChannel )
951 void build_snapshot_from_ring( ring_node *ring_node_to_send, unsigned char frequencyChannel )
985 {
952 {
986 unsigned int i;
953 unsigned int i;
987 unsigned long long int centerTime_asLong;
954 unsigned long long int centerTime_asLong;
988 unsigned long long int acquisitionTimeF0_asLong;
955 unsigned long long int acquisitionTimeF0_asLong;
989 unsigned long long int acquisitionTime_asLong;
956 unsigned long long int acquisitionTime_asLong;
990 unsigned long long int bufferAcquisitionTime_asLong;
957 unsigned long long int bufferAcquisitionTime_asLong;
991 unsigned char *ptr1;
958 unsigned char *ptr1;
992 unsigned char *ptr2;
959 unsigned char *ptr2;
993 unsigned char nb_ring_nodes;
960 unsigned char nb_ring_nodes;
994 unsigned long long int frequency_asLong;
961 unsigned long long int frequency_asLong;
995 unsigned long long int nbTicksPerSample_asLong;
962 unsigned long long int nbTicksPerSample_asLong;
996 unsigned long long int nbSamplesPart1_asLong;
963 unsigned long long int nbSamplesPart1_asLong;
997 unsigned long long int sampleOffset_asLong;
964 unsigned long long int sampleOffset_asLong;
998
965
999 unsigned int deltaT_F0;
966 unsigned int deltaT_F0;
1000 unsigned int deltaT_F1;
967 unsigned int deltaT_F1;
1001 unsigned long long int deltaT_F2;
968 unsigned long long int deltaT_F2;
1002
969
1003 deltaT_F0 = 2731; // (2048. / 24576. / 2.) * 65536. = 2730.667;
970 deltaT_F0 = 2731; // (2048. / 24576. / 2.) * 65536. = 2730.667;
1004 deltaT_F1 = 16384; // (2048. / 4096. / 2.) * 65536. = 16384;
971 deltaT_F1 = 16384; // (2048. / 4096. / 2.) * 65536. = 16384;
1005 deltaT_F2 = 262144; // (2048. / 256. / 2.) * 65536. = 262144;
972 deltaT_F2 = 262144; // (2048. / 256. / 2.) * 65536. = 262144;
1006 sampleOffset_asLong = 0x00;
973 sampleOffset_asLong = 0x00;
1007
974
1008 // (1) get the f0 acquisition time
975 // (1) get the f0 acquisition time
1009 build_acquisition_time( &acquisitionTimeF0_asLong, current_ring_node_f0 );
976 build_acquisition_time( &acquisitionTimeF0_asLong, current_ring_node_f0 );
1010
977
1011 // (2) compute the central reference time
978 // (2) compute the central reference time
1012 centerTime_asLong = acquisitionTimeF0_asLong + deltaT_F0;
979 centerTime_asLong = acquisitionTimeF0_asLong + deltaT_F0;
1013
980
1014 // (3) compute the acquisition time of the current snapshot
981 // (3) compute the acquisition time of the current snapshot
1015 switch(frequencyChannel)
982 switch(frequencyChannel)
1016 {
983 {
1017 case 1: // 1 is for F1 = 4096 Hz
984 case 1: // 1 is for F1 = 4096 Hz
1018 acquisitionTime_asLong = centerTime_asLong - deltaT_F1;
985 acquisitionTime_asLong = centerTime_asLong - deltaT_F1;
1019 nb_ring_nodes = NB_RING_NODES_F1;
986 nb_ring_nodes = NB_RING_NODES_F1;
1020 frequency_asLong = 4096;
987 frequency_asLong = 4096;
1021 nbTicksPerSample_asLong = 16; // 65536 / 4096;
988 nbTicksPerSample_asLong = 16; // 65536 / 4096;
1022 break;
989 break;
1023 case 2: // 2 is for F2 = 256 Hz
990 case 2: // 2 is for F2 = 256 Hz
1024 acquisitionTime_asLong = centerTime_asLong - deltaT_F2;
991 acquisitionTime_asLong = centerTime_asLong - deltaT_F2;
1025 nb_ring_nodes = NB_RING_NODES_F2;
992 nb_ring_nodes = NB_RING_NODES_F2;
1026 frequency_asLong = 256;
993 frequency_asLong = 256;
1027 nbTicksPerSample_asLong = 256; // 65536 / 256;
994 nbTicksPerSample_asLong = 256; // 65536 / 256;
1028 break;
995 break;
1029 default:
996 default:
1030 acquisitionTime_asLong = centerTime_asLong;
997 acquisitionTime_asLong = centerTime_asLong;
1031 frequency_asLong = 256;
998 frequency_asLong = 256;
1032 nbTicksPerSample_asLong = 256;
999 nbTicksPerSample_asLong = 256;
1033 break;
1000 break;
1034 }
1001 }
1035
1002
1036 //****************************************************************************
1003 //****************************************************************************
1037 // (4) search the ring_node with the acquisition time <= acquisitionTime_asLong
1004 // (4) search the ring_node with the acquisition time <= acquisitionTime_asLong
1038 for (i=0; i<nb_ring_nodes; i++)
1005 for (i=0; i<nb_ring_nodes; i++)
1039 {
1006 {
1040 PRINTF1("%d ... ", i)
1007 PRINTF1("%d ... ", i)
1041 build_acquisition_time( &bufferAcquisitionTime_asLong, ring_node_to_send );
1008 build_acquisition_time( &bufferAcquisitionTime_asLong, ring_node_to_send );
1042 if (bufferAcquisitionTime_asLong <= acquisitionTime_asLong)
1009 if (bufferAcquisitionTime_asLong <= acquisitionTime_asLong)
1043 {
1010 {
1044 PRINTF1("buffer found with acquisition time = %llx\n", bufferAcquisitionTime_asLong)
1011 PRINTF1("buffer found with acquisition time = %llx\n", bufferAcquisitionTime_asLong)
1045 break;
1012 break;
1046 }
1013 }
1047 ring_node_to_send = ring_node_to_send->previous;
1014 ring_node_to_send = ring_node_to_send->previous;
1048 }
1015 }
1049
1016
1050 // (5) compute the number of samples to take in the current buffer
1017 // (5) compute the number of samples to take in the current buffer
1051 sampleOffset_asLong = ((acquisitionTime_asLong - bufferAcquisitionTime_asLong) * frequency_asLong ) >> 16;
1018 sampleOffset_asLong = ((acquisitionTime_asLong - bufferAcquisitionTime_asLong) * frequency_asLong ) >> 16;
1052 nbSamplesPart1_asLong = NB_SAMPLES_PER_SNAPSHOT - sampleOffset_asLong;
1019 nbSamplesPart1_asLong = NB_SAMPLES_PER_SNAPSHOT - sampleOffset_asLong;
1053 PRINTF2("sampleOffset_asLong = %lld, nbSamplesPart1_asLong = %lld\n", sampleOffset_asLong, nbSamplesPart1_asLong)
1020 PRINTF2("sampleOffset_asLong = %lld, nbSamplesPart1_asLong = %lld\n", sampleOffset_asLong, nbSamplesPart1_asLong)
1054
1021
1055 // (6) compute the final acquisition time
1022 // (6) compute the final acquisition time
1056 acquisitionTime_asLong = bufferAcquisitionTime_asLong +
1023 acquisitionTime_asLong = bufferAcquisitionTime_asLong +
1057 sampleOffset_asLong * nbTicksPerSample_asLong;
1024 sampleOffset_asLong * nbTicksPerSample_asLong;
1058
1025
1059 // (7) copy the acquisition time at the beginning of the extrated snapshot
1026 // (7) copy the acquisition time at the beginning of the extrated snapshot
1060 ptr1 = (unsigned char*) &acquisitionTime_asLong;
1027 ptr1 = (unsigned char*) &acquisitionTime_asLong;
1061 ptr2 = (unsigned char*) wf_snap_extracted;
1028 ptr2 = (unsigned char*) wf_snap_extracted;
1062 ptr2[0] = ptr1[ 2 + 2 ];
1029 ptr2[0] = ptr1[ 2 + 2 ];
1063 ptr2[1] = ptr1[ 3 + 2 ];
1030 ptr2[1] = ptr1[ 3 + 2 ];
1064 ptr2[2] = ptr1[ 0 + 2 ];
1031 ptr2[2] = ptr1[ 0 + 2 ];
1065 ptr2[3] = ptr1[ 1 + 2 ];
1032 ptr2[3] = ptr1[ 1 + 2 ];
1066 ptr2[4] = ptr1[ 4 + 2 ];
1033 ptr2[4] = ptr1[ 4 + 2 ];
1067 ptr2[5] = ptr1[ 5 + 2 ];
1034 ptr2[5] = ptr1[ 5 + 2 ];
1068
1035
1069 // re set the synchronization bit
1036 // re set the synchronization bit
1070
1037
1071
1038
1072 // copy the part 1 of the snapshot in the extracted buffer
1039 // copy the part 1 of the snapshot in the extracted buffer
1073 for ( i = 0; i < (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i++ )
1040 for ( i = 0; i < (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i++ )
1074 {
1041 {
1075 wf_snap_extracted[i + TIME_OFFSET] =
1042 wf_snap_extracted[i + TIME_OFFSET] =
1076 ((int*) ring_node_to_send->buffer_address)[i + (sampleOffset_asLong * NB_WORDS_SWF_BLK) + TIME_OFFSET];
1043 ((int*) ring_node_to_send->buffer_address)[i + (sampleOffset_asLong * NB_WORDS_SWF_BLK) + TIME_OFFSET];
1077 }
1044 }
1078 // copy the part 2 of the snapshot in the extracted buffer
1045 // copy the part 2 of the snapshot in the extracted buffer
1079 ring_node_to_send = ring_node_to_send->next;
1046 ring_node_to_send = ring_node_to_send->next;
1080 for ( i = (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i < (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK); i++ )
1047 for ( i = (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i < (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK); i++ )
1081 {
1048 {
1082 wf_snap_extracted[i + TIME_OFFSET] =
1049 wf_snap_extracted[i + TIME_OFFSET] =
1083 ((int*) ring_node_to_send->buffer_address)[(i-(nbSamplesPart1_asLong * NB_WORDS_SWF_BLK)) + TIME_OFFSET];
1050 ((int*) ring_node_to_send->buffer_address)[(i-(nbSamplesPart1_asLong * NB_WORDS_SWF_BLK)) + TIME_OFFSET];
1084 }
1051 }
1085 }
1052 }
1086
1053
1087 void build_acquisition_time( unsigned long long int *acquisitionTimeAslong, ring_node *current_ring_node )
1054 void build_acquisition_time( unsigned long long int *acquisitionTimeAslong, ring_node *current_ring_node )
1088 {
1055 {
1089 unsigned char *acquisitionTimeCharPtr;
1056 unsigned char *acquisitionTimeCharPtr;
1090
1057
1091 acquisitionTimeCharPtr = (unsigned char*) current_ring_node->buffer_address;
1058 acquisitionTimeCharPtr = (unsigned char*) current_ring_node->buffer_address;
1092
1059
1093 *acquisitionTimeAslong = 0x00;
1060 *acquisitionTimeAslong = 0x00;
1094 *acquisitionTimeAslong = ( acquisitionTimeCharPtr[0] << 24 )
1061 *acquisitionTimeAslong = ( acquisitionTimeCharPtr[0] << 24 )
1095 + ( acquisitionTimeCharPtr[1] << 16 )
1062 + ( acquisitionTimeCharPtr[1] << 16 )
1096 + ( (unsigned long long int) (acquisitionTimeCharPtr[2] & 0x7f) << 40 ) // [0111 1111] mask the synchronization bit
1063 + ( (unsigned long long int) (acquisitionTimeCharPtr[2] & 0x7f) << 40 ) // [0111 1111] mask the synchronization bit
1097 + ( (unsigned long long int) acquisitionTimeCharPtr[3] << 32 )
1064 + ( (unsigned long long int) acquisitionTimeCharPtr[3] << 32 )
1098 + ( acquisitionTimeCharPtr[4] << 8 )
1065 + ( acquisitionTimeCharPtr[4] << 8 )
1099 + ( acquisitionTimeCharPtr[5] );
1066 + ( acquisitionTimeCharPtr[5] );
1100 }
1067 }
1101
1068
1102 //**************
1069 //**************
1103 // wfp registers
1070 // wfp registers
1104 void reset_wfp_burst_enable(void)
1071 void reset_wfp_burst_enable(void)
1105 {
1072 {
1106 /** This function resets the waveform picker burst_enable register.
1073 /** This function resets the waveform picker burst_enable register.
1107 *
1074 *
1108 * The burst bits [f2 f1 f0] and the enable bits [f3 f2 f1 f0] are set to 0.
1075 * The burst bits [f2 f1 f0] and the enable bits [f3 f2 f1 f0] are set to 0.
1109 *
1076 *
1110 */
1077 */
1111
1078
1112 waveform_picker_regs->run_burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
1079 waveform_picker_regs->run_burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
1113 }
1080 }
1114
1081
1115 void reset_wfp_status( void )
1082 void reset_wfp_status( void )
1116 {
1083 {
1117 /** This function resets the waveform picker status register.
1084 /** This function resets the waveform picker status register.
1118 *
1085 *
1119 * All status bits are set to 0 [new_err full_err full].
1086 * All status bits are set to 0 [new_err full_err full].
1120 *
1087 *
1121 */
1088 */
1122
1089
1123 waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
1090 waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
1124 }
1091 }
1125
1092
1126 void reset_waveform_picker_regs(void)
1093 void reset_waveform_picker_regs(void)
1127 {
1094 {
1128 /** This function resets the waveform picker module registers.
1095 /** This function resets the waveform picker module registers.
1129 *
1096 *
1130 * The registers affected by this function are located at the following offset addresses:
1097 * The registers affected by this function are located at the following offset addresses:
1131 * - 0x00 data_shaping
1098 * - 0x00 data_shaping
1132 * - 0x04 run_burst_enable
1099 * - 0x04 run_burst_enable
1133 * - 0x08 addr_data_f0
1100 * - 0x08 addr_data_f0
1134 * - 0x0C addr_data_f1
1101 * - 0x0C addr_data_f1
1135 * - 0x10 addr_data_f2
1102 * - 0x10 addr_data_f2
1136 * - 0x14 addr_data_f3
1103 * - 0x14 addr_data_f3
1137 * - 0x18 status
1104 * - 0x18 status
1138 * - 0x1C delta_snapshot
1105 * - 0x1C delta_snapshot
1139 * - 0x20 delta_f0
1106 * - 0x20 delta_f0
1140 * - 0x24 delta_f0_2
1107 * - 0x24 delta_f0_2
1141 * - 0x28 delta_f1
1108 * - 0x28 delta_f1
1142 * - 0x2c delta_f2
1109 * - 0x2c delta_f2
1143 * - 0x30 nb_data_by_buffer
1110 * - 0x30 nb_data_by_buffer
1144 * - 0x34 nb_snapshot_param
1111 * - 0x34 nb_snapshot_param
1145 * - 0x38 start_date
1112 * - 0x38 start_date
1146 * - 0x3c nb_word_in_buffer
1113 * - 0x3c nb_word_in_buffer
1147 *
1114 *
1148 */
1115 */
1149
1116
1150 set_wfp_data_shaping(); // 0x00 *** R1 R0 SP1 SP0 BW
1117 set_wfp_data_shaping(); // 0x00 *** R1 R0 SP1 SP0 BW
1151 reset_wfp_burst_enable(); // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ]
1118 reset_wfp_burst_enable(); // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ]
1152 waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address; // 0x08
1119 waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address; // 0x08
1153 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; // 0x0c
1120 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; // 0x0c
1154 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; // 0x10
1121 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; // 0x10
1155 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a); // 0x14
1122 waveform_picker_regs->addr_data_f3 = current_ring_node_f3->buffer_address; // 0x14
1156 reset_wfp_status(); // 0x18
1123 reset_wfp_status(); // 0x18
1157 //
1124 //
1158 set_wfp_delta_snapshot(); // 0x1c
1125 set_wfp_delta_snapshot(); // 0x1c
1159 set_wfp_delta_f0_f0_2(); // 0x20, 0x24
1126 set_wfp_delta_f0_f0_2(); // 0x20, 0x24
1160 set_wfp_delta_f1(); // 0x28
1127 set_wfp_delta_f1(); // 0x28
1161 set_wfp_delta_f2(); // 0x2c
1128 set_wfp_delta_f2(); // 0x2c
1162 DEBUG_PRINTF1("delta_snapshot %x\n", waveform_picker_regs->delta_snapshot)
1129 DEBUG_PRINTF1("delta_snapshot %x\n", waveform_picker_regs->delta_snapshot)
1163 DEBUG_PRINTF1("delta_f0 %x\n", waveform_picker_regs->delta_f0)
1130 DEBUG_PRINTF1("delta_f0 %x\n", waveform_picker_regs->delta_f0)
1164 DEBUG_PRINTF1("delta_f0_2 %x\n", waveform_picker_regs->delta_f0_2)
1131 DEBUG_PRINTF1("delta_f0_2 %x\n", waveform_picker_regs->delta_f0_2)
1165 DEBUG_PRINTF1("delta_f1 %x\n", waveform_picker_regs->delta_f1)
1132 DEBUG_PRINTF1("delta_f1 %x\n", waveform_picker_regs->delta_f1)
1166 DEBUG_PRINTF1("delta_f2 %x\n", waveform_picker_regs->delta_f2)
1133 DEBUG_PRINTF1("delta_f2 %x\n", waveform_picker_regs->delta_f2)
1167 // 2688 = 8 * 336
1134 // 2688 = 8 * 336
1168 waveform_picker_regs->nb_data_by_buffer = 0xa7f; // 0x30 *** 2688 - 1 => nb samples -1
1135 waveform_picker_regs->nb_data_by_buffer = 0xa7f; // 0x30 *** 2688 - 1 => nb samples -1
1169 waveform_picker_regs->snapshot_param = 0xa80; // 0x34 *** 2688 => nb samples
1136 waveform_picker_regs->snapshot_param = 0xa80; // 0x34 *** 2688 => nb samples
1170 waveform_picker_regs->start_date = 0x00; // 0x38
1137 waveform_picker_regs->start_date = 0x00; // 0x38
1171 waveform_picker_regs->nb_word_in_buffer = 0x1f82; // 0x3c *** 2688 * 3 + 2 = 8066
1138 waveform_picker_regs->nb_word_in_buffer = 0x1f82; // 0x3c *** 2688 * 3 + 2 = 8066
1172 }
1139 }
1173
1140
1174 void set_wfp_data_shaping( void )
1141 void set_wfp_data_shaping( void )
1175 {
1142 {
1176 /** This function sets the data_shaping register of the waveform picker module.
1143 /** This function sets the data_shaping register of the waveform picker module.
1177 *
1144 *
1178 * The value is read from one field of the parameter_dump_packet structure:\n
1145 * The value is read from one field of the parameter_dump_packet structure:\n
1179 * bw_sp0_sp1_r0_r1
1146 * bw_sp0_sp1_r0_r1
1180 *
1147 *
1181 */
1148 */
1182
1149
1183 unsigned char data_shaping;
1150 unsigned char data_shaping;
1184
1151
1185 // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register
1152 // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register
1186 // waveform picker : [R1 R0 SP1 SP0 BW]
1153 // waveform picker : [R1 R0 SP1 SP0 BW]
1187
1154
1188 data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1;
1155 data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1;
1189
1156
1190 waveform_picker_regs->data_shaping =
1157 waveform_picker_regs->data_shaping =
1191 ( (data_shaping & 0x10) >> 4 ) // BW
1158 ( (data_shaping & 0x10) >> 4 ) // BW
1192 + ( (data_shaping & 0x08) >> 2 ) // SP0
1159 + ( (data_shaping & 0x08) >> 2 ) // SP0
1193 + ( (data_shaping & 0x04) ) // SP1
1160 + ( (data_shaping & 0x04) ) // SP1
1194 + ( (data_shaping & 0x02) << 2 ) // R0
1161 + ( (data_shaping & 0x02) << 2 ) // R0
1195 + ( (data_shaping & 0x01) << 4 ); // R1
1162 + ( (data_shaping & 0x01) << 4 ); // R1
1196 }
1163 }
1197
1164
1198 void set_wfp_burst_enable_register( unsigned char mode )
1165 void set_wfp_burst_enable_register( unsigned char mode )
1199 {
1166 {
1200 /** This function sets the waveform picker burst_enable register depending on the mode.
1167 /** This function sets the waveform picker burst_enable register depending on the mode.
1201 *
1168 *
1202 * @param mode is the LFR mode to launch.
1169 * @param mode is the LFR mode to launch.
1203 *
1170 *
1204 * The burst bits shall be before the enable bits.
1171 * The burst bits shall be before the enable bits.
1205 *
1172 *
1206 */
1173 */
1207
1174
1208 // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0
1175 // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0
1209 // the burst bits shall be set first, before the enable bits
1176 // the burst bits shall be set first, before the enable bits
1210 switch(mode) {
1177 switch(mode) {
1211 case(LFR_MODE_NORMAL):
1178 case(LFR_MODE_NORMAL):
1212 waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enable
1179 waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enable
1213 waveform_picker_regs->run_burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0
1180 waveform_picker_regs->run_burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0
1214 break;
1181 break;
1215 case(LFR_MODE_BURST):
1182 case(LFR_MODE_BURST):
1216 waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled
1183 waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled
1217 // waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x04; // [0100] enable f2
1184 // waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x04; // [0100] enable f2
1218 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0c; // [1100] enable f3 AND f2
1185 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0c; // [1100] enable f3 AND f2
1219 break;
1186 break;
1220 case(LFR_MODE_SBM1):
1187 case(LFR_MODE_SBM1):
1221 waveform_picker_regs->run_burst_enable = 0x20; // [0010 0000] f1 burst enabled
1188 waveform_picker_regs->run_burst_enable = 0x20; // [0010 0000] f1 burst enabled
1222 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
1189 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
1223 break;
1190 break;
1224 case(LFR_MODE_SBM2):
1191 case(LFR_MODE_SBM2):
1225 waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled
1192 waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled
1226 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
1193 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
1227 break;
1194 break;
1228 default:
1195 default:
1229 waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled
1196 waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled
1230 break;
1197 break;
1231 }
1198 }
1232 }
1199 }
1233
1200
1234 void set_wfp_delta_snapshot( void )
1201 void set_wfp_delta_snapshot( void )
1235 {
1202 {
1236 /** This function sets the delta_snapshot register of the waveform picker module.
1203 /** This function sets the delta_snapshot register of the waveform picker module.
1237 *
1204 *
1238 * The value is read from two (unsigned char) of the parameter_dump_packet structure:
1205 * The value is read from two (unsigned char) of the parameter_dump_packet structure:
1239 * - sy_lfr_n_swf_p[0]
1206 * - sy_lfr_n_swf_p[0]
1240 * - sy_lfr_n_swf_p[1]
1207 * - sy_lfr_n_swf_p[1]
1241 *
1208 *
1242 */
1209 */
1243
1210
1244 unsigned int delta_snapshot;
1211 unsigned int delta_snapshot;
1245 unsigned int delta_snapshot_in_T2;
1212 unsigned int delta_snapshot_in_T2;
1246
1213
1247 delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256
1214 delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256
1248 + parameter_dump_packet.sy_lfr_n_swf_p[1];
1215 + parameter_dump_packet.sy_lfr_n_swf_p[1];
1249
1216
1250 delta_snapshot_in_T2 = delta_snapshot * 256;
1217 delta_snapshot_in_T2 = delta_snapshot * 256;
1251 waveform_picker_regs->delta_snapshot = delta_snapshot_in_T2; // max 4 bytes
1218 waveform_picker_regs->delta_snapshot = delta_snapshot_in_T2; // max 4 bytes
1252 }
1219 }
1253
1220
1254 void set_wfp_delta_f0_f0_2( void )
1221 void set_wfp_delta_f0_f0_2( void )
1255 {
1222 {
1256 unsigned int delta_snapshot;
1223 unsigned int delta_snapshot;
1257 unsigned int nb_samples_per_snapshot;
1224 unsigned int nb_samples_per_snapshot;
1258 float delta_f0_in_float;
1225 float delta_f0_in_float;
1259
1226
1260 delta_snapshot = waveform_picker_regs->delta_snapshot;
1227 delta_snapshot = waveform_picker_regs->delta_snapshot;
1261 nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1];
1228 nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1];
1262 delta_f0_in_float =nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 24576.) * 256.;
1229 delta_f0_in_float =nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 24576.) * 256.;
1263
1230
1264 waveform_picker_regs->delta_f0 = delta_snapshot - floor( delta_f0_in_float );
1231 waveform_picker_regs->delta_f0 = delta_snapshot - floor( delta_f0_in_float );
1265 waveform_picker_regs->delta_f0_2 = 0x7; // max 7 bits
1232 waveform_picker_regs->delta_f0_2 = 0x7; // max 7 bits
1266 }
1233 }
1267
1234
1268 void set_wfp_delta_f1( void )
1235 void set_wfp_delta_f1( void )
1269 {
1236 {
1270 unsigned int delta_snapshot;
1237 unsigned int delta_snapshot;
1271 unsigned int nb_samples_per_snapshot;
1238 unsigned int nb_samples_per_snapshot;
1272 float delta_f1_in_float;
1239 float delta_f1_in_float;
1273
1240
1274 delta_snapshot = waveform_picker_regs->delta_snapshot;
1241 delta_snapshot = waveform_picker_regs->delta_snapshot;
1275 nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1];
1242 nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1];
1276 delta_f1_in_float = nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 4096.) * 256.;
1243 delta_f1_in_float = nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 4096.) * 256.;
1277
1244
1278 waveform_picker_regs->delta_f1 = delta_snapshot - floor( delta_f1_in_float );
1245 waveform_picker_regs->delta_f1 = delta_snapshot - floor( delta_f1_in_float );
1279 }
1246 }
1280
1247
1281 void set_wfp_delta_f2()
1248 void set_wfp_delta_f2()
1282 {
1249 {
1283 unsigned int delta_snapshot;
1250 unsigned int delta_snapshot;
1284 unsigned int nb_samples_per_snapshot;
1251 unsigned int nb_samples_per_snapshot;
1285
1252
1286 delta_snapshot = waveform_picker_regs->delta_snapshot;
1253 delta_snapshot = waveform_picker_regs->delta_snapshot;
1287 nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1];
1254 nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1];
1288
1255
1289 waveform_picker_regs->delta_f2 = delta_snapshot - nb_samples_per_snapshot / 2;
1256 waveform_picker_regs->delta_f2 = delta_snapshot - nb_samples_per_snapshot / 2;
1290 }
1257 }
1291
1258
1292 //*****************
1259 //*****************
1293 // local parameters
1260 // local parameters
1294 void set_local_nb_interrupt_f0_MAX( void )
1261 void set_local_nb_interrupt_f0_MAX( void )
1295 {
1262 {
1296 /** This function sets the value of the nb_interrupt_f0_MAX local parameter.
1263 /** This function sets the value of the nb_interrupt_f0_MAX local parameter.
1297 *
1264 *
1298 * This parameter is used for the SM validation only.\n
1265 * This parameter is used for the SM validation only.\n
1299 * The software waits param_local.local_nb_interrupt_f0_MAX interruptions from the spectral matrices
1266 * The software waits param_local.local_nb_interrupt_f0_MAX interruptions from the spectral matrices
1300 * module before launching a basic processing.
1267 * module before launching a basic processing.
1301 *
1268 *
1302 */
1269 */
1303
1270
1304 param_local.local_nb_interrupt_f0_MAX = ( (parameter_dump_packet.sy_lfr_n_asm_p[0]) * 256
1271 param_local.local_nb_interrupt_f0_MAX = ( (parameter_dump_packet.sy_lfr_n_asm_p[0]) * 256
1305 + parameter_dump_packet.sy_lfr_n_asm_p[1] ) * 100;
1272 + parameter_dump_packet.sy_lfr_n_asm_p[1] ) * 100;
1306 }
1273 }
1307
1274
1308 void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid )
1275 void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid )
1309 {
1276 {
1310 unsigned short *sequence_cnt;
1277 unsigned short *sequence_cnt;
1311 unsigned short segmentation_grouping_flag;
1278 unsigned short segmentation_grouping_flag;
1312 unsigned short new_packet_sequence_control;
1279 unsigned short new_packet_sequence_control;
1313
1280
1314 if ( (sid ==SID_NORM_SWF_F0) || (sid ==SID_NORM_SWF_F1) || (sid ==SID_NORM_SWF_F2)
1281 if ( (sid ==SID_NORM_SWF_F0) || (sid ==SID_NORM_SWF_F1) || (sid ==SID_NORM_SWF_F2)
1315 || (sid ==SID_NORM_CWF_F3) || (sid==SID_NORM_CWF_LONG_F3) || (sid ==SID_BURST_CWF_F2) )
1282 || (sid ==SID_NORM_CWF_F3) || (sid==SID_NORM_CWF_LONG_F3) || (sid ==SID_BURST_CWF_F2) )
1316 {
1283 {
1317 sequence_cnt = (unsigned short *) &sequenceCounters_SCIENCE_NORMAL_BURST;
1284 sequence_cnt = (unsigned short *) &sequenceCounters_SCIENCE_NORMAL_BURST;
1318 }
1285 }
1319 else if ( (sid ==SID_SBM1_CWF_F1) || (sid ==SID_SBM2_CWF_F2) )
1286 else if ( (sid ==SID_SBM1_CWF_F1) || (sid ==SID_SBM2_CWF_F2) )
1320 {
1287 {
1321 sequence_cnt = (unsigned short *) &sequenceCounters_SCIENCE_SBM1_SBM2;
1288 sequence_cnt = (unsigned short *) &sequenceCounters_SCIENCE_SBM1_SBM2;
1322 }
1289 }
1323 else
1290 else
1324 {
1291 {
1325 sequence_cnt = (unsigned short *) NULL;
1292 sequence_cnt = (unsigned short *) NULL;
1326 PRINTF1("in increment_seq_counter_source_id *** ERR apid_destid %d not known\n", sid)
1293 PRINTF1("in increment_seq_counter_source_id *** ERR apid_destid %d not known\n", sid)
1327 }
1294 }
1328
1295
1329 if (sequence_cnt != NULL)
1296 if (sequence_cnt != NULL)
1330 {
1297 {
1331 // increment the sequence counter
1298 // increment the sequence counter
1332 if ( *sequence_cnt < SEQ_CNT_MAX)
1299 if ( *sequence_cnt < SEQ_CNT_MAX)
1333 {
1300 {
1334 *sequence_cnt = *sequence_cnt + 1;
1301 *sequence_cnt = *sequence_cnt + 1;
1335 }
1302 }
1336 else
1303 else
1337 {
1304 {
1338 *sequence_cnt = 0;
1305 *sequence_cnt = 0;
1339 }
1306 }
1340 segmentation_grouping_flag = TM_PACKET_SEQ_CTRL_STANDALONE << 8;
1307 segmentation_grouping_flag = TM_PACKET_SEQ_CTRL_STANDALONE << 8;
1341 *sequence_cnt = (*sequence_cnt) & 0x3fff;
1308 *sequence_cnt = (*sequence_cnt) & 0x3fff;
1342
1309
1343 new_packet_sequence_control = segmentation_grouping_flag | (*sequence_cnt) ;
1310 new_packet_sequence_control = segmentation_grouping_flag | (*sequence_cnt) ;
1344
1311
1345 packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8);
1312 packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8);
1346 packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control );
1313 packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control );
1347 }
1314 }
1348 }
1315 }
General Comments 0
You need to be logged in to leave comments. Login now