@@ -0,0 +1,22 | |||||
|
1 | #ifndef TM_BYTE_POSITIONS_H | |||
|
2 | #define TM_BYTE_POSITIONS_H | |||
|
3 | ||||
|
4 | #define BYTE_POS_CP_LFR_MODE 11 | |||
|
5 | ||||
|
6 | // TC_LFR_LOAD_COMMON_PAR | |||
|
7 | ||||
|
8 | // TC_LFR_LOAD_NORMAL_PAR | |||
|
9 | #define BYTE_POS_SY_LFR_N_SWF_L 0 | |||
|
10 | #define BYTE_POS_SY_LFR_N_SWF_P 2 | |||
|
11 | #define BYTE_POS_SY_LFR_N_ASM_P 4 | |||
|
12 | #define BYTE_POS_SY_LFR_N_BP_P0 6 | |||
|
13 | #define BYTE_POS_SY_LFR_N_BP_P1 7 | |||
|
14 | ||||
|
15 | // TC_LFR_LOAD_BURST_PAR | |||
|
16 | ||||
|
17 | // TC_LFR_LOAD_SBM1_PAR | |||
|
18 | ||||
|
19 | // TC_LFR_LOAD_SBM2_PAR | |||
|
20 | ||||
|
21 | ||||
|
22 | #endif // TM_BYTE_POSITIONS_H |
@@ -1,248 +1,248 | |||||
1 | ############################################################################# |
|
1 | ############################################################################# | |
2 | # Makefile for building: bin/fsw |
|
2 | # Makefile for building: bin/fsw | |
3 |
# Generated by qmake (2.01a) (Qt 4.8.5) on: |
|
3 | # Generated by qmake (2.01a) (Qt 4.8.5) on: Fri Nov 15 07:55:16 2013 | |
4 | # Project: fsw-qt.pro |
|
4 | # Project: fsw-qt.pro | |
5 | # Template: app |
|
5 | # Template: app | |
6 | # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro |
|
6 | # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro | |
7 | ############################################################################# |
|
7 | ############################################################################# | |
8 |
|
8 | |||
9 | ####### Compiler, tools and options |
|
9 | ####### Compiler, tools and options | |
10 |
|
10 | |||
11 | CC = sparc-rtems-gcc |
|
11 | CC = sparc-rtems-gcc | |
12 | CXX = sparc-rtems-g++ |
|
12 | CXX = sparc-rtems-g++ | |
13 |
DEFINES = -DSW_VERSION_N1=0 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=2 |
|
13 | DEFINES = -DSW_VERSION_N1=0 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=24 -DPRINT_MESSAGES_ON_CONSOLE | |
14 | CFLAGS = -pipe -O3 -Wall $(DEFINES) |
|
14 | CFLAGS = -pipe -O3 -Wall $(DEFINES) | |
15 | CXXFLAGS = -pipe -O3 -Wall $(DEFINES) |
|
15 | CXXFLAGS = -pipe -O3 -Wall $(DEFINES) | |
16 | INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header |
|
16 | INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header | |
17 | LINK = sparc-rtems-g++ |
|
17 | LINK = sparc-rtems-g++ | |
18 | LFLAGS = |
|
18 | LFLAGS = | |
19 | LIBS = $(SUBLIBS) |
|
19 | LIBS = $(SUBLIBS) | |
20 | AR = sparc-rtems-ar rcs |
|
20 | AR = sparc-rtems-ar rcs | |
21 | RANLIB = |
|
21 | RANLIB = | |
22 | QMAKE = /usr/bin/qmake-qt4 |
|
22 | QMAKE = /usr/bin/qmake-qt4 | |
23 | TAR = tar -cf |
|
23 | TAR = tar -cf | |
24 | COMPRESS = gzip -9f |
|
24 | COMPRESS = gzip -9f | |
25 | COPY = cp -f |
|
25 | COPY = cp -f | |
26 | SED = sed |
|
26 | SED = sed | |
27 | COPY_FILE = $(COPY) |
|
27 | COPY_FILE = $(COPY) | |
28 | COPY_DIR = $(COPY) -r |
|
28 | COPY_DIR = $(COPY) -r | |
29 | STRIP = sparc-rtems-strip |
|
29 | STRIP = sparc-rtems-strip | |
30 | INSTALL_FILE = install -m 644 -p |
|
30 | INSTALL_FILE = install -m 644 -p | |
31 | INSTALL_DIR = $(COPY_DIR) |
|
31 | INSTALL_DIR = $(COPY_DIR) | |
32 | INSTALL_PROGRAM = install -m 755 -p |
|
32 | INSTALL_PROGRAM = install -m 755 -p | |
33 | DEL_FILE = rm -f |
|
33 | DEL_FILE = rm -f | |
34 | SYMLINK = ln -f -s |
|
34 | SYMLINK = ln -f -s | |
35 | DEL_DIR = rmdir |
|
35 | DEL_DIR = rmdir | |
36 | MOVE = mv -f |
|
36 | MOVE = mv -f | |
37 | CHK_DIR_EXISTS= test -d |
|
37 | CHK_DIR_EXISTS= test -d | |
38 | MKDIR = mkdir -p |
|
38 | MKDIR = mkdir -p | |
39 |
|
39 | |||
40 | ####### Output directory |
|
40 | ####### Output directory | |
41 |
|
41 | |||
42 | OBJECTS_DIR = obj/ |
|
42 | OBJECTS_DIR = obj/ | |
43 |
|
43 | |||
44 | ####### Files |
|
44 | ####### Files | |
45 |
|
45 | |||
46 | SOURCES = ../src/wf_handler.c \ |
|
46 | SOURCES = ../src/wf_handler.c \ | |
47 | ../src/tc_handler.c \ |
|
47 | ../src/tc_handler.c \ | |
48 | ../src/fsw_processing.c \ |
|
48 | ../src/fsw_processing.c \ | |
49 | ../src/fsw_misc.c \ |
|
49 | ../src/fsw_misc.c \ | |
50 | ../src/fsw_init.c \ |
|
50 | ../src/fsw_init.c \ | |
51 | ../src/fsw_globals.c \ |
|
51 | ../src/fsw_globals.c \ | |
52 | ../src/fsw_spacewire.c \ |
|
52 | ../src/fsw_spacewire.c \ | |
53 | ../src/tc_load_dump_parameters.c \ |
|
53 | ../src/tc_load_dump_parameters.c \ | |
54 | ../src/tm_lfr_tc_exe.c \ |
|
54 | ../src/tm_lfr_tc_exe.c \ | |
55 | ../src/tc_acceptance.c |
|
55 | ../src/tc_acceptance.c | |
56 | OBJECTS = obj/wf_handler.o \ |
|
56 | OBJECTS = obj/wf_handler.o \ | |
57 | obj/tc_handler.o \ |
|
57 | obj/tc_handler.o \ | |
58 | obj/fsw_processing.o \ |
|
58 | obj/fsw_processing.o \ | |
59 | obj/fsw_misc.o \ |
|
59 | obj/fsw_misc.o \ | |
60 | obj/fsw_init.o \ |
|
60 | obj/fsw_init.o \ | |
61 | obj/fsw_globals.o \ |
|
61 | obj/fsw_globals.o \ | |
62 | obj/fsw_spacewire.o \ |
|
62 | obj/fsw_spacewire.o \ | |
63 | obj/tc_load_dump_parameters.o \ |
|
63 | obj/tc_load_dump_parameters.o \ | |
64 | obj/tm_lfr_tc_exe.o \ |
|
64 | obj/tm_lfr_tc_exe.o \ | |
65 | obj/tc_acceptance.o |
|
65 | obj/tc_acceptance.o | |
66 | DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \ |
|
66 | DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \ | |
67 | /usr/lib64/qt4/mkspecs/common/linux.conf \ |
|
67 | /usr/lib64/qt4/mkspecs/common/linux.conf \ | |
68 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ |
|
68 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ | |
69 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ |
|
69 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ | |
70 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ |
|
70 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ | |
71 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ |
|
71 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ | |
72 | /usr/lib64/qt4/mkspecs/qconfig.pri \ |
|
72 | /usr/lib64/qt4/mkspecs/qconfig.pri \ | |
73 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ |
|
73 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ | |
74 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ |
|
74 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ | |
75 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ |
|
75 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ | |
76 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ |
|
76 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ | |
77 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ |
|
77 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ | |
78 | sparc.pri \ |
|
78 | sparc.pri \ | |
79 | /usr/lib64/qt4/mkspecs/features/release.prf \ |
|
79 | /usr/lib64/qt4/mkspecs/features/release.prf \ | |
80 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ |
|
80 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ | |
81 | /usr/lib64/qt4/mkspecs/features/shared.prf \ |
|
81 | /usr/lib64/qt4/mkspecs/features/shared.prf \ | |
82 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ |
|
82 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ | |
83 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ |
|
83 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ | |
84 | /usr/lib64/qt4/mkspecs/features/resources.prf \ |
|
84 | /usr/lib64/qt4/mkspecs/features/resources.prf \ | |
85 | /usr/lib64/qt4/mkspecs/features/uic.prf \ |
|
85 | /usr/lib64/qt4/mkspecs/features/uic.prf \ | |
86 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ |
|
86 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ | |
87 | /usr/lib64/qt4/mkspecs/features/lex.prf \ |
|
87 | /usr/lib64/qt4/mkspecs/features/lex.prf \ | |
88 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \ |
|
88 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \ | |
89 | fsw-qt.pro |
|
89 | fsw-qt.pro | |
90 | QMAKE_TARGET = fsw |
|
90 | QMAKE_TARGET = fsw | |
91 | DESTDIR = bin/ |
|
91 | DESTDIR = bin/ | |
92 | TARGET = bin/fsw |
|
92 | TARGET = bin/fsw | |
93 |
|
93 | |||
94 | first: all |
|
94 | first: all | |
95 | ####### Implicit rules |
|
95 | ####### Implicit rules | |
96 |
|
96 | |||
97 | .SUFFIXES: .o .c .cpp .cc .cxx .C |
|
97 | .SUFFIXES: .o .c .cpp .cc .cxx .C | |
98 |
|
98 | |||
99 | .cpp.o: |
|
99 | .cpp.o: | |
100 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
100 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" | |
101 |
|
101 | |||
102 | .cc.o: |
|
102 | .cc.o: | |
103 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
103 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" | |
104 |
|
104 | |||
105 | .cxx.o: |
|
105 | .cxx.o: | |
106 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
106 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" | |
107 |
|
107 | |||
108 | .C.o: |
|
108 | .C.o: | |
109 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
109 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" | |
110 |
|
110 | |||
111 | .c.o: |
|
111 | .c.o: | |
112 | $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<" |
|
112 | $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<" | |
113 |
|
113 | |||
114 | ####### Build rules |
|
114 | ####### Build rules | |
115 |
|
115 | |||
116 | all: Makefile $(TARGET) |
|
116 | all: Makefile $(TARGET) | |
117 |
|
117 | |||
118 | $(TARGET): $(OBJECTS) |
|
118 | $(TARGET): $(OBJECTS) | |
119 | @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/ |
|
119 | @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/ | |
120 | $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) |
|
120 | $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) | |
121 |
|
121 | |||
122 | Makefile: fsw-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \ |
|
122 | Makefile: fsw-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \ | |
123 | /usr/lib64/qt4/mkspecs/common/linux.conf \ |
|
123 | /usr/lib64/qt4/mkspecs/common/linux.conf \ | |
124 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ |
|
124 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ | |
125 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ |
|
125 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ | |
126 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ |
|
126 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ | |
127 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ |
|
127 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ | |
128 | /usr/lib64/qt4/mkspecs/qconfig.pri \ |
|
128 | /usr/lib64/qt4/mkspecs/qconfig.pri \ | |
129 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ |
|
129 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ | |
130 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ |
|
130 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ | |
131 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ |
|
131 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ | |
132 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ |
|
132 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ | |
133 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ |
|
133 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ | |
134 | sparc.pri \ |
|
134 | sparc.pri \ | |
135 | /usr/lib64/qt4/mkspecs/features/release.prf \ |
|
135 | /usr/lib64/qt4/mkspecs/features/release.prf \ | |
136 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ |
|
136 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ | |
137 | /usr/lib64/qt4/mkspecs/features/shared.prf \ |
|
137 | /usr/lib64/qt4/mkspecs/features/shared.prf \ | |
138 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ |
|
138 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ | |
139 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ |
|
139 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ | |
140 | /usr/lib64/qt4/mkspecs/features/resources.prf \ |
|
140 | /usr/lib64/qt4/mkspecs/features/resources.prf \ | |
141 | /usr/lib64/qt4/mkspecs/features/uic.prf \ |
|
141 | /usr/lib64/qt4/mkspecs/features/uic.prf \ | |
142 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ |
|
142 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ | |
143 | /usr/lib64/qt4/mkspecs/features/lex.prf \ |
|
143 | /usr/lib64/qt4/mkspecs/features/lex.prf \ | |
144 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf |
|
144 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf | |
145 | $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro |
|
145 | $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro | |
146 | /usr/lib64/qt4/mkspecs/common/unix.conf: |
|
146 | /usr/lib64/qt4/mkspecs/common/unix.conf: | |
147 | /usr/lib64/qt4/mkspecs/common/linux.conf: |
|
147 | /usr/lib64/qt4/mkspecs/common/linux.conf: | |
148 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf: |
|
148 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf: | |
149 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf: |
|
149 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf: | |
150 | /usr/lib64/qt4/mkspecs/common/g++-base.conf: |
|
150 | /usr/lib64/qt4/mkspecs/common/g++-base.conf: | |
151 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf: |
|
151 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf: | |
152 | /usr/lib64/qt4/mkspecs/qconfig.pri: |
|
152 | /usr/lib64/qt4/mkspecs/qconfig.pri: | |
153 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri: |
|
153 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri: | |
154 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf: |
|
154 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf: | |
155 | /usr/lib64/qt4/mkspecs/features/qt_config.prf: |
|
155 | /usr/lib64/qt4/mkspecs/features/qt_config.prf: | |
156 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf: |
|
156 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf: | |
157 | /usr/lib64/qt4/mkspecs/features/default_pre.prf: |
|
157 | /usr/lib64/qt4/mkspecs/features/default_pre.prf: | |
158 | sparc.pri: |
|
158 | sparc.pri: | |
159 | /usr/lib64/qt4/mkspecs/features/release.prf: |
|
159 | /usr/lib64/qt4/mkspecs/features/release.prf: | |
160 | /usr/lib64/qt4/mkspecs/features/default_post.prf: |
|
160 | /usr/lib64/qt4/mkspecs/features/default_post.prf: | |
161 | /usr/lib64/qt4/mkspecs/features/shared.prf: |
|
161 | /usr/lib64/qt4/mkspecs/features/shared.prf: | |
162 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf: |
|
162 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf: | |
163 | /usr/lib64/qt4/mkspecs/features/warn_on.prf: |
|
163 | /usr/lib64/qt4/mkspecs/features/warn_on.prf: | |
164 | /usr/lib64/qt4/mkspecs/features/resources.prf: |
|
164 | /usr/lib64/qt4/mkspecs/features/resources.prf: | |
165 | /usr/lib64/qt4/mkspecs/features/uic.prf: |
|
165 | /usr/lib64/qt4/mkspecs/features/uic.prf: | |
166 | /usr/lib64/qt4/mkspecs/features/yacc.prf: |
|
166 | /usr/lib64/qt4/mkspecs/features/yacc.prf: | |
167 | /usr/lib64/qt4/mkspecs/features/lex.prf: |
|
167 | /usr/lib64/qt4/mkspecs/features/lex.prf: | |
168 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf: |
|
168 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf: | |
169 | qmake: FORCE |
|
169 | qmake: FORCE | |
170 | @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro |
|
170 | @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro | |
171 |
|
171 | |||
172 | dist: |
|
172 | dist: | |
173 | @$(CHK_DIR_EXISTS) obj/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0 |
|
173 | @$(CHK_DIR_EXISTS) obj/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0 | |
174 | $(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 |
|
174 | $(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 | |
175 |
|
175 | |||
176 |
|
176 | |||
177 | clean:compiler_clean |
|
177 | clean:compiler_clean | |
178 | -$(DEL_FILE) $(OBJECTS) |
|
178 | -$(DEL_FILE) $(OBJECTS) | |
179 | -$(DEL_FILE) *~ core *.core |
|
179 | -$(DEL_FILE) *~ core *.core | |
180 |
|
180 | |||
181 |
|
181 | |||
182 | ####### Sub-libraries |
|
182 | ####### Sub-libraries | |
183 |
|
183 | |||
184 | distclean: clean |
|
184 | distclean: clean | |
185 | -$(DEL_FILE) $(TARGET) |
|
185 | -$(DEL_FILE) $(TARGET) | |
186 | -$(DEL_FILE) Makefile |
|
186 | -$(DEL_FILE) Makefile | |
187 |
|
187 | |||
188 |
|
188 | |||
189 | grmon: |
|
189 | grmon: | |
190 | cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u |
|
190 | cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u | |
191 |
|
191 | |||
192 | check: first |
|
192 | check: first | |
193 |
|
193 | |||
194 | compiler_rcc_make_all: |
|
194 | compiler_rcc_make_all: | |
195 | compiler_rcc_clean: |
|
195 | compiler_rcc_clean: | |
196 | compiler_uic_make_all: |
|
196 | compiler_uic_make_all: | |
197 | compiler_uic_clean: |
|
197 | compiler_uic_clean: | |
198 | compiler_image_collection_make_all: qmake_image_collection.cpp |
|
198 | compiler_image_collection_make_all: qmake_image_collection.cpp | |
199 | compiler_image_collection_clean: |
|
199 | compiler_image_collection_clean: | |
200 | -$(DEL_FILE) qmake_image_collection.cpp |
|
200 | -$(DEL_FILE) qmake_image_collection.cpp | |
201 | compiler_yacc_decl_make_all: |
|
201 | compiler_yacc_decl_make_all: | |
202 | compiler_yacc_decl_clean: |
|
202 | compiler_yacc_decl_clean: | |
203 | compiler_yacc_impl_make_all: |
|
203 | compiler_yacc_impl_make_all: | |
204 | compiler_yacc_impl_clean: |
|
204 | compiler_yacc_impl_clean: | |
205 | compiler_lex_make_all: |
|
205 | compiler_lex_make_all: | |
206 | compiler_lex_clean: |
|
206 | compiler_lex_clean: | |
207 | compiler_clean: |
|
207 | compiler_clean: | |
208 |
|
208 | |||
209 | ####### Compile |
|
209 | ####### Compile | |
210 |
|
210 | |||
211 | obj/wf_handler.o: ../src/wf_handler.c |
|
211 | obj/wf_handler.o: ../src/wf_handler.c | |
212 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/wf_handler.o ../src/wf_handler.c |
|
212 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/wf_handler.o ../src/wf_handler.c | |
213 |
|
213 | |||
214 | obj/tc_handler.o: ../src/tc_handler.c |
|
214 | obj/tc_handler.o: ../src/tc_handler.c | |
215 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o ../src/tc_handler.c |
|
215 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o ../src/tc_handler.c | |
216 |
|
216 | |||
217 | obj/fsw_processing.o: ../src/fsw_processing.c ../src/fsw_processing_globals.c |
|
217 | obj/fsw_processing.o: ../src/fsw_processing.c ../src/fsw_processing_globals.c | |
218 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/fsw_processing.c |
|
218 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/fsw_processing.c | |
219 |
|
219 | |||
220 | obj/fsw_misc.o: ../src/fsw_misc.c |
|
220 | obj/fsw_misc.o: ../src/fsw_misc.c | |
221 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c |
|
221 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c | |
222 |
|
222 | |||
223 | obj/fsw_init.o: ../src/fsw_init.c ../src/fsw_config.c |
|
223 | obj/fsw_init.o: ../src/fsw_init.c ../src/fsw_config.c | |
224 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o ../src/fsw_init.c |
|
224 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o ../src/fsw_init.c | |
225 |
|
225 | |||
226 | obj/fsw_globals.o: ../src/fsw_globals.c |
|
226 | obj/fsw_globals.o: ../src/fsw_globals.c | |
227 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c |
|
227 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c | |
228 |
|
228 | |||
229 | obj/fsw_spacewire.o: ../src/fsw_spacewire.c |
|
229 | obj/fsw_spacewire.o: ../src/fsw_spacewire.c | |
230 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spacewire.o ../src/fsw_spacewire.c |
|
230 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spacewire.o ../src/fsw_spacewire.c | |
231 |
|
231 | |||
232 | obj/tc_load_dump_parameters.o: ../src/tc_load_dump_parameters.c |
|
232 | obj/tc_load_dump_parameters.o: ../src/tc_load_dump_parameters.c | |
233 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_load_dump_parameters.o ../src/tc_load_dump_parameters.c |
|
233 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_load_dump_parameters.o ../src/tc_load_dump_parameters.c | |
234 |
|
234 | |||
235 | obj/tm_lfr_tc_exe.o: ../src/tm_lfr_tc_exe.c |
|
235 | obj/tm_lfr_tc_exe.o: ../src/tm_lfr_tc_exe.c | |
236 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tm_lfr_tc_exe.o ../src/tm_lfr_tc_exe.c |
|
236 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tm_lfr_tc_exe.o ../src/tm_lfr_tc_exe.c | |
237 |
|
237 | |||
238 | obj/tc_acceptance.o: ../src/tc_acceptance.c |
|
238 | obj/tc_acceptance.o: ../src/tc_acceptance.c | |
239 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_acceptance.o ../src/tc_acceptance.c |
|
239 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_acceptance.o ../src/tc_acceptance.c | |
240 |
|
240 | |||
241 | ####### Install |
|
241 | ####### Install | |
242 |
|
242 | |||
243 | install: FORCE |
|
243 | install: FORCE | |
244 |
|
244 | |||
245 | uninstall: FORCE |
|
245 | uninstall: FORCE | |
246 |
|
246 | |||
247 | FORCE: |
|
247 | FORCE: | |
248 |
|
248 |
@@ -1,78 +1,79 | |||||
1 | TEMPLATE = app |
|
1 | TEMPLATE = app | |
2 | # CONFIG += console v8 sim |
|
2 | # CONFIG += console v8 sim | |
3 | # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** gsa |
|
3 | # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** gsa | |
4 | CONFIG += console verbose |
|
4 | CONFIG += console verbose | |
5 | CONFIG -= qt |
|
5 | CONFIG -= qt | |
6 |
|
6 | |||
7 | include(./sparc.pri) |
|
7 | include(./sparc.pri) | |
8 |
|
8 | |||
9 | # flight software version |
|
9 | # flight software version | |
10 |
SWVERSION=-0-2 |
|
10 | SWVERSION=-0-24 | |
11 | DEFINES += SW_VERSION_N1=0 |
|
11 | DEFINES += SW_VERSION_N1=0 | |
12 | DEFINES += SW_VERSION_N2=0 |
|
12 | DEFINES += SW_VERSION_N2=0 | |
13 | DEFINES += SW_VERSION_N3=0 |
|
13 | DEFINES += SW_VERSION_N3=0 | |
14 |
DEFINES += SW_VERSION_N4=2 |
|
14 | DEFINES += SW_VERSION_N4=24 | |
15 |
|
15 | |||
16 | contains( CONFIG, verbose ) { |
|
16 | contains( CONFIG, verbose ) { | |
17 | DEFINES += PRINT_MESSAGES_ON_CONSOLE |
|
17 | DEFINES += PRINT_MESSAGES_ON_CONSOLE | |
18 | } |
|
18 | } | |
19 |
|
19 | |||
20 | contains( CONFIG, debug_messages ) { |
|
20 | contains( CONFIG, debug_messages ) { | |
21 | DEFINES += DEBUG_MESSAGES |
|
21 | DEFINES += DEBUG_MESSAGES | |
22 | } |
|
22 | } | |
23 |
|
23 | |||
24 | contains( CONFIG, cpu_usage_report ) { |
|
24 | contains( CONFIG, cpu_usage_report ) { | |
25 | DEFINES += PRINT_TASK_STATISTICS |
|
25 | DEFINES += PRINT_TASK_STATISTICS | |
26 | } |
|
26 | } | |
27 |
|
27 | |||
28 | contains( CONFIG, stack_report ) { |
|
28 | contains( CONFIG, stack_report ) { | |
29 | DEFINES += PRINT_STACK_REPORT |
|
29 | DEFINES += PRINT_STACK_REPORT | |
30 | } |
|
30 | } | |
31 |
|
31 | |||
32 | contains( CONFIG, boot_messages ) { |
|
32 | contains( CONFIG, boot_messages ) { | |
33 | DEFINES += BOOT_MESSAGES |
|
33 | DEFINES += BOOT_MESSAGES | |
34 | } |
|
34 | } | |
35 |
|
35 | |||
36 | #doxygen.target = doxygen |
|
36 | #doxygen.target = doxygen | |
37 | #doxygen.commands = doxygen ../doc/Doxyfile |
|
37 | #doxygen.commands = doxygen ../doc/Doxyfile | |
38 | #QMAKE_EXTRA_TARGETS += doxygen |
|
38 | #QMAKE_EXTRA_TARGETS += doxygen | |
39 |
|
39 | |||
40 | TARGET = fsw |
|
40 | TARGET = fsw | |
41 | contains( CONFIG, gsa ) { |
|
41 | contains( CONFIG, gsa ) { | |
42 | DEFINES += GSA |
|
42 | DEFINES += GSA | |
43 | TARGET = fsw-gsa |
|
43 | TARGET = fsw-gsa | |
44 | } |
|
44 | } | |
45 |
|
45 | |||
46 | INCLUDEPATH += \ |
|
46 | INCLUDEPATH += \ | |
47 | ../src \ |
|
47 | ../src \ | |
48 | ../header |
|
48 | ../header | |
49 |
|
49 | |||
50 | SOURCES += \ |
|
50 | SOURCES += \ | |
51 | ../src/wf_handler.c \ |
|
51 | ../src/wf_handler.c \ | |
52 | ../src/tc_handler.c \ |
|
52 | ../src/tc_handler.c \ | |
53 | ../src/fsw_processing.c \ |
|
53 | ../src/fsw_processing.c \ | |
54 | ../src/fsw_misc.c \ |
|
54 | ../src/fsw_misc.c \ | |
55 | ../src/fsw_init.c \ |
|
55 | ../src/fsw_init.c \ | |
56 | ../src/fsw_globals.c \ |
|
56 | ../src/fsw_globals.c \ | |
57 | ../src/fsw_spacewire.c \ |
|
57 | ../src/fsw_spacewire.c \ | |
58 | ../src/tc_load_dump_parameters.c \ |
|
58 | ../src/tc_load_dump_parameters.c \ | |
59 | ../src/tm_lfr_tc_exe.c \ |
|
59 | ../src/tm_lfr_tc_exe.c \ | |
60 | ../src/tc_acceptance.c |
|
60 | ../src/tc_acceptance.c | |
61 |
|
61 | |||
62 |
|
62 | |||
63 | HEADERS += \ |
|
63 | HEADERS += \ | |
64 | ../header/wf_handler.h \ |
|
64 | ../header/wf_handler.h \ | |
65 | ../header/tc_handler.h \ |
|
65 | ../header/tc_handler.h \ | |
66 | ../header/grlib_regs.h \ |
|
66 | ../header/grlib_regs.h \ | |
67 | ../header/fsw_processing.h \ |
|
67 | ../header/fsw_processing.h \ | |
68 | ../header/fsw_params.h \ |
|
68 | ../header/fsw_params.h \ | |
69 | ../header/fsw_misc.h \ |
|
69 | ../header/fsw_misc.h \ | |
70 | ../header/fsw_init.h \ |
|
70 | ../header/fsw_init.h \ | |
71 | ../header/ccsds_types.h \ |
|
71 | ../header/ccsds_types.h \ | |
72 | ../header/fsw_params_processing.h \ |
|
72 | ../header/fsw_params_processing.h \ | |
73 | ../header/fsw_spacewire.h \ |
|
73 | ../header/fsw_spacewire.h \ | |
74 | ../header/tm_byte_positions.h \ |
|
74 | ../header/tm_byte_positions.h \ | |
75 | ../header/tc_load_dump_parameters.h \ |
|
75 | ../header/tc_load_dump_parameters.h \ | |
76 | ../header/tm_lfr_tc_exe.h \ |
|
76 | ../header/tm_lfr_tc_exe.h \ | |
77 | ../header/tc_acceptance.h |
|
77 | ../header/tc_acceptance.h \ | |
|
78 | ../header/fsw_params_nb_bytes.h | |||
78 |
|
79 |
@@ -1,305 +1,198 | |||||
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 2.8.1, 2013-11-1 |
|
3 | <!-- Written by QtCreator 2.8.1, 2013-11-15T09:52:17. --> | |
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="QString" key="CurrentPreferences">CppGlobal</value> |
|
18 | <value type="QString" 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="QString" key="CurrentPreferences">QmlJSGlobal</value> |
|
24 | <value type="QString" 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">System</value> |
|
28 | <value type="QByteArray" key="EditorConfiguration.Codec">System</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. |
|
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. |
|
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">{ |
|
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"> |
|
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 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|
61 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> | |
62 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
62 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> | |
63 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
63 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> | |
64 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> |
|
64 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> | |
65 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
65 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
66 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> |
|
66 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> | |
67 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> |
|
67 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> | |
68 |
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto"> |
|
68 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value> | |
69 | <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> |
|
69 | <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> | |
70 | <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> |
|
70 | <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> | |
71 | </valuemap> |
|
71 | </valuemap> | |
72 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> |
|
72 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> | |
73 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
73 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> | |
74 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
74 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> | |
75 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
75 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
76 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
76 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> | |
77 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
77 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> | |
78 | <value type="QString">-w</value> |
|
78 | <value type="QString">-w</value> | |
79 | <value type="QString">-r</value> |
|
79 | <value type="QString">-r</value> | |
80 | </valuelist> |
|
80 | </valuelist> | |
81 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> |
|
81 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> | |
82 |
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"> |
|
82 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> | |
83 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
83 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> | |
84 | </valuemap> |
|
84 | </valuemap> | |
85 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> |
|
85 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> | |
86 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> |
|
86 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> | |
87 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
87 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
88 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> |
|
88 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> | |
89 | </valuemap> |
|
89 | </valuemap> | |
90 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> |
|
90 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> | |
91 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
91 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> | |
92 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
92 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> | |
93 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
93 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> | |
94 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
94 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
95 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
95 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> | |
96 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
96 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> | |
97 | <value type="QString">-w</value> |
|
97 | <value type="QString">-w</value> | |
98 | <value type="QString">-r</value> |
|
98 | <value type="QString">-r</value> | |
99 | </valuelist> |
|
99 | </valuelist> | |
100 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> |
|
100 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> | |
101 |
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"> |
|
101 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> | |
102 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
102 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> | |
103 | </valuemap> |
|
103 | </valuemap> | |
104 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> |
|
104 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> | |
105 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> |
|
105 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> | |
106 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
106 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
107 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> |
|
107 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> | |
108 | </valuemap> |
|
108 | </valuemap> | |
109 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> |
|
109 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> | |
110 | <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> |
|
110 | <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> | |
111 | <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> |
|
111 | <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> | |
112 |
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName"> |
|
112 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value> | |
113 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
113 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
114 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> |
|
114 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> | |
115 | <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> |
|
115 | <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> | |
116 | <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/DEV_PLE/FSW-qt</value> |
|
116 | <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/home/admin/opt/DEV_PLE/FSW-qt</value> | |
117 | <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value> |
|
117 | <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value> | |
118 | </valuemap> |
|
118 | </valuemap> | |
119 |
<value |
|
119 | <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value> | |
120 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|
|||
121 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
|||
122 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
|||
123 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> |
|
|||
124 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
|||
125 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> |
|
|||
126 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> |
|
|||
127 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value> |
|
|||
128 | <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> |
|
|||
129 | <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> |
|
|||
130 | </valuemap> |
|
|||
131 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> |
|
|||
132 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
|||
133 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
|||
134 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
|||
135 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
|||
136 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
|||
137 | <value type="QString">-w</value> |
|
|||
138 | <value type="QString">-r</value> |
|
|||
139 | </valuelist> |
|
|||
140 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> |
|
|||
141 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w </value> |
|
|||
142 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
|||
143 | </valuemap> |
|
|||
144 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> |
|
|||
145 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> |
|
|||
146 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
|||
147 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> |
|
|||
148 | </valuemap> |
|
|||
149 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> |
|
|||
150 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
|||
151 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
|||
152 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
|||
153 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
|||
154 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
|||
155 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
|||
156 | <value type="QString">-w</value> |
|
|||
157 | <value type="QString">-r</value> |
|
|||
158 | </valuelist> |
|
|||
159 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> |
|
|||
160 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w clean</value> |
|
|||
161 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
|||
162 | </valuemap> |
|
|||
163 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> |
|
|||
164 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> |
|
|||
165 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
|||
166 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> |
|
|||
167 | </valuemap> |
|
|||
168 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> |
|
|||
169 | <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> |
|
|||
170 | <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> |
|
|||
171 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 4.8.2 in PATH (System) Debug</value> |
|
|||
172 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
|||
173 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> |
|
|||
174 | <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value> |
|
|||
175 | <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/DEV_PLE/FSW-qt</value> |
|
|||
176 | <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value> |
|
|||
177 | </valuemap> |
|
|||
178 | <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value> |
|
|||
179 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0"> |
|
120 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0"> | |
180 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|
121 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> | |
181 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value> |
|
122 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value> | |
182 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value> |
|
123 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value> | |
183 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
124 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
184 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value> |
|
125 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value> | |
185 | </valuemap> |
|
126 | </valuemap> | |
186 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value> |
|
127 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value> | |
187 |
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName"> |
|
128 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value> | |
188 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
129 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
189 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value> |
|
130 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value> | |
190 | </valuemap> |
|
131 | </valuemap> | |
191 | <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> |
|
132 | <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> | |
192 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/> |
|
133 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/> | |
193 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> |
|
134 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> | |
194 | <value type="bool" key="Analyzer.Project.UseGlobal">true</value> |
|
135 | <value type="bool" key="Analyzer.Project.UseGlobal">true</value> | |
195 | <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> |
|
136 | <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> | |
196 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> |
|
137 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> | |
197 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> |
|
138 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> | |
198 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> |
|
139 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> | |
199 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> |
|
140 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> | |
200 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> |
|
141 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> | |
201 | <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> |
|
142 | <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> | |
202 | <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> |
|
143 | <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> | |
203 | <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> |
|
144 | <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> | |
204 | <value type="int" key="Analyzer.Valgrind.NumCallers">25</value> |
|
145 | <value type="int" key="Analyzer.Valgrind.NumCallers">25</value> | |
205 | <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> |
|
146 | <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> | |
206 | <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> |
|
147 | <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> | |
207 | <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> |
|
148 | <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> | |
208 | <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> |
|
149 | <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> | |
209 | <value type="int">0</value> |
|
150 | <value type="int">0</value> | |
210 | <value type="int">1</value> |
|
151 | <value type="int">1</value> | |
211 | <value type="int">2</value> |
|
152 | <value type="int">2</value> | |
212 | <value type="int">3</value> |
|
153 | <value type="int">3</value> | |
213 | <value type="int">4</value> |
|
154 | <value type="int">4</value> | |
214 | <value type="int">5</value> |
|
155 | <value type="int">5</value> | |
215 | <value type="int">6</value> |
|
156 | <value type="int">6</value> | |
216 | <value type="int">7</value> |
|
157 | <value type="int">7</value> | |
217 | <value type="int">8</value> |
|
158 | <value type="int">8</value> | |
218 | <value type="int">9</value> |
|
159 | <value type="int">9</value> | |
219 | <value type="int">10</value> |
|
160 | <value type="int">10</value> | |
220 | <value type="int">11</value> |
|
161 | <value type="int">11</value> | |
221 | <value type="int">12</value> |
|
162 | <value type="int">12</value> | |
222 | <value type="int">13</value> |
|
163 | <value type="int">13</value> | |
223 | <value type="int">14</value> |
|
164 | <value type="int">14</value> | |
224 | </valuelist> |
|
165 | </valuelist> | |
225 | <value type="int" key="PE.EnvironmentAspect.Base">2</value> |
|
166 | <value type="int" key="PE.EnvironmentAspect.Base">2</value> | |
226 | <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> |
|
167 | <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> | |
227 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value> |
|
168 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value> | |
228 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
169 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
229 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value> |
|
170 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/admin/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value> | |
230 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value> |
|
171 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value> | |
231 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value> |
|
172 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value> | |
232 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value> |
|
173 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value> | |
233 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value> |
|
174 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value> | |
234 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value> |
|
175 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value> | |
235 | <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> |
|
176 | <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> | |
236 | <value type="bool" key="RunConfiguration.UseCppDebugger">true</value> |
|
177 | <value type="bool" key="RunConfiguration.UseCppDebugger">true</value> | |
237 | <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value> |
|
178 | <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value> | |
238 | <value type="bool" key="RunConfiguration.UseMultiProcess">false</value> |
|
179 | <value type="bool" key="RunConfiguration.UseMultiProcess">false</value> | |
239 | <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> |
|
180 | <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> | |
240 | <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">false</value> |
|
|||
241 | </valuemap> |
|
|||
242 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.1"> |
|
|||
243 | <value type="bool" key="Analyzer.Project.UseGlobal">true</value> |
|
|||
244 | <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> |
|
|||
245 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> |
|
|||
246 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> |
|
|||
247 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> |
|
|||
248 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> |
|
|||
249 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> |
|
|||
250 | <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> |
|
|||
251 | <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> |
|
|||
252 | <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> |
|
|||
253 | <value type="int" key="Analyzer.Valgrind.NumCallers">25</value> |
|
|||
254 | <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> |
|
|||
255 | <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> |
|
|||
256 | <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> |
|
|||
257 | <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> |
|
|||
258 | <value type="int">0</value> |
|
|||
259 | <value type="int">1</value> |
|
|||
260 | <value type="int">2</value> |
|
|||
261 | <value type="int">3</value> |
|
|||
262 | <value type="int">4</value> |
|
|||
263 | <value type="int">5</value> |
|
|||
264 | <value type="int">6</value> |
|
|||
265 | <value type="int">7</value> |
|
|||
266 | <value type="int">8</value> |
|
|||
267 | <value type="int">9</value> |
|
|||
268 | <value type="int">10</value> |
|
|||
269 | <value type="int">11</value> |
|
|||
270 | <value type="int">12</value> |
|
|||
271 | <value type="int">13</value> |
|
|||
272 | <value type="int">14</value> |
|
|||
273 | </valuelist> |
|
|||
274 | <value type="int" key="PE.EnvironmentAspect.Base">2</value> |
|
|||
275 | <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> |
|
|||
276 | <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value> |
|
|||
277 | <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">doxygen</value> |
|
|||
278 | <value type="bool" key="ProjectExplorer.CustomExecutableRunConfiguration.UseTerminal">true</value> |
|
|||
279 | <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">/opt/DEV_PLE/doc</value> |
|
|||
280 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Run doxygen</value> |
|
|||
281 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
|||
282 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value> |
|
|||
283 | <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> |
|
|||
284 | <value type="bool" key="RunConfiguration.UseCppDebugger">true</value> |
|
|||
285 | <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value> |
|
|||
286 | <value type="bool" key="RunConfiguration.UseMultiProcess">false</value> |
|
|||
287 | <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> |
|
|||
288 | <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> |
|
181 | <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> | |
289 | </valuemap> |
|
182 | </valuemap> | |
290 |
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount"> |
|
183 | <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value> | |
291 | </valuemap> |
|
184 | </valuemap> | |
292 | </data> |
|
185 | </data> | |
293 | <data> |
|
186 | <data> | |
294 | <variable>ProjectExplorer.Project.TargetCount</variable> |
|
187 | <variable>ProjectExplorer.Project.TargetCount</variable> | |
295 | <value type="int">1</value> |
|
188 | <value type="int">1</value> | |
296 | </data> |
|
189 | </data> | |
297 | <data> |
|
190 | <data> | |
298 | <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable> |
|
191 | <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable> | |
299 |
<value type="QByteArray">{ |
|
192 | <value type="QByteArray">{cdbf9cdc-1e84-406e-889b-c4feef49e75c}</value> | |
300 | </data> |
|
193 | </data> | |
301 | <data> |
|
194 | <data> | |
302 | <variable>ProjectExplorer.Project.Updater.FileVersion</variable> |
|
195 | <variable>ProjectExplorer.Project.Updater.FileVersion</variable> | |
303 | <value type="int">14</value> |
|
196 | <value type="int">14</value> | |
304 | </data> |
|
197 | </data> | |
305 | </qtcreator> |
|
198 | </qtcreator> |
@@ -1,661 +1,600 | |||||
1 | #ifndef CCSDS_TYPES_H_INCLUDED |
|
1 | #ifndef CCSDS_TYPES_H_INCLUDED | |
2 | #define CCSDS_TYPES_H_INCLUDED |
|
2 | #define CCSDS_TYPES_H_INCLUDED | |
3 |
|
3 | |||
4 | #define CCSDS_PROTOCOLE_EXTRA_BYTES 4 |
|
4 | #define CCSDS_PROTOCOLE_EXTRA_BYTES 4 | |
5 | #define CCSDS_TELEMETRY_HEADER_LENGTH 16+4 |
|
5 | #define CCSDS_TELEMETRY_HEADER_LENGTH 16+4 | |
6 | #define CCSDS_TM_PKT_MAX_SIZE 4412 |
|
6 | #define CCSDS_TM_PKT_MAX_SIZE 4412 | |
7 | #define CCSDS_TELECOMMAND_HEADER_LENGTH 10+4 |
|
7 | #define CCSDS_TELECOMMAND_HEADER_LENGTH 10+4 | |
8 | #define CCSDS_TC_PKT_MAX_SIZE 256 |
|
8 | #define CCSDS_TC_PKT_MAX_SIZE 256 | |
9 | #define CCSDS_TC_PKT_MIN_SIZE 16 |
|
9 | #define CCSDS_TC_PKT_MIN_SIZE 16 | |
10 | #define CCSDS_TC_TM_PACKET_OFFSET 7 |
|
10 | #define CCSDS_TC_TM_PACKET_OFFSET 7 | |
11 | #define CCSDS_PROCESS_ID 76 |
|
11 | #define CCSDS_PROCESS_ID 76 | |
12 | #define CCSDS_PACKET_CATEGORY 12 |
|
12 | #define CCSDS_PACKET_CATEGORY 12 | |
13 | #define CCSDS_NODE_ADDRESS 0xfe |
|
13 | #define CCSDS_NODE_ADDRESS 0xfe | |
14 | #define CCSDS_USER_APP 0x00 |
|
14 | #define CCSDS_USER_APP 0x00 | |
15 |
|
15 | |||
16 | #define DEFAULT_SPARE1_PUSVERSION_SPARE2 0x10 |
|
16 | #define DEFAULT_SPARE1_PUSVERSION_SPARE2 0x10 | |
17 | #define DEFAULT_RESERVED 0x00 |
|
17 | #define DEFAULT_RESERVED 0x00 | |
18 | #define DEFAULT_HKBIA 0x1e // 0001 1110 |
|
18 | #define DEFAULT_HKBIA 0x1e // 0001 1110 | |
19 |
|
19 | |||
20 | // PACKET ID |
|
20 | // PACKET ID | |
21 | #define TM_PACKET_ID_TC_EXE 0x0cc1 // PID 76 CAT 1 |
|
21 | #define TM_PACKET_ID_TC_EXE 0x0cc1 // PID 76 CAT 1 | |
22 | #define TM_PACKET_ID_HK 0x0cc4 // PID 76 CAT 4 |
|
22 | #define TM_PACKET_ID_HK 0x0cc4 // PID 76 CAT 4 | |
23 | #define TM_PACKET_ID_PARAMETER_DUMP 0x0cc9 // PID 76 CAT 9 |
|
23 | #define TM_PACKET_ID_PARAMETER_DUMP 0x0cc9 // PID 76 CAT 9 | |
24 | #define TM_PACKET_ID_SCIENCE_NORMAL_BURST 0x0ccc // PID 76 CAT 12 |
|
24 | #define TM_PACKET_ID_SCIENCE_NORMAL_BURST 0x0ccc // PID 76 CAT 12 | |
25 | #define TM_PACKET_ID_SCIENCE_SBM1_SBM2 0x0cfc // PID 79 CAT 12 |
|
25 | #define TM_PACKET_ID_SCIENCE_SBM1_SBM2 0x0cfc // PID 79 CAT 12 | |
26 | #define TM_PACKET_PID_DEFAULT 76 |
|
26 | #define TM_PACKET_PID_DEFAULT 76 | |
27 | #define TM_PACKET_PID_BURST_SBM1_SBM2 79 |
|
27 | #define TM_PACKET_PID_BURST_SBM1_SBM2 79 | |
28 | #define TM_PACKET_CAT_TC_EXE 1 |
|
28 | #define TM_PACKET_CAT_TC_EXE 1 | |
29 | #define TM_PACKET_CAT_HK 4 |
|
29 | #define TM_PACKET_CAT_HK 4 | |
30 | #define TM_PACKET_CAT_PARAMETER_DUMP 9 |
|
30 | #define TM_PACKET_CAT_PARAMETER_DUMP 9 | |
31 | #define TM_PACKET_CAT_SCIENCE 12 |
|
31 | #define TM_PACKET_CAT_SCIENCE 12 | |
32 |
|
32 | |||
33 | // PACKET SEQUENCE CONTROL |
|
33 | // PACKET SEQUENCE CONTROL | |
34 | #define TM_PACKET_SEQ_CTRL_CONTINUATION 0x00 // [0000 0000] |
|
34 | #define TM_PACKET_SEQ_CTRL_CONTINUATION 0x00 // [0000 0000] | |
35 | #define TM_PACKET_SEQ_CTRL_FIRST 0x40 // [0100 0000] |
|
35 | #define TM_PACKET_SEQ_CTRL_FIRST 0x40 // [0100 0000] | |
36 | #define TM_PACKET_SEQ_CTRL_LAST 0x80 // [1000 0000] |
|
36 | #define TM_PACKET_SEQ_CTRL_LAST 0x80 // [1000 0000] | |
37 | #define TM_PACKET_SEQ_CTRL_STANDALONE 0xc0 // [1100 0000] |
|
37 | #define TM_PACKET_SEQ_CTRL_STANDALONE 0xc0 // [1100 0000] | |
38 | #define TM_PACKET_SEQ_CNT_DEFAULT 0x00 // [0000 0000] |
|
38 | #define TM_PACKET_SEQ_CNT_DEFAULT 0x00 // [0000 0000] | |
39 |
|
39 | |||
40 | // DESTINATION ID |
|
40 | // DESTINATION ID | |
41 | #define TM_DESTINATION_ID_GROUND 0 |
|
41 | #define TM_DESTINATION_ID_GROUND 0 | |
42 | #define TM_DESTINATION_ID_MISSION_TIMELINE 110 |
|
42 | #define TM_DESTINATION_ID_MISSION_TIMELINE 110 | |
43 | #define TM_DESTINATION_ID_TC_SEQUENCES 111 |
|
43 | #define TM_DESTINATION_ID_TC_SEQUENCES 111 | |
44 | #define TM_DESTINATION_ID_RECOVERY_ACTION_COMMAND 112 |
|
44 | #define TM_DESTINATION_ID_RECOVERY_ACTION_COMMAND 112 | |
45 | #define TM_DESTINATION_ID_BACKUP_MISSION_TIMELINE 113 |
|
45 | #define TM_DESTINATION_ID_BACKUP_MISSION_TIMELINE 113 | |
46 | #define TM_DESTINATION_ID_DIRECT_CMD 120 |
|
46 | #define TM_DESTINATION_ID_DIRECT_CMD 120 | |
47 | #define TM_DESTINATION_ID_SPARE_GRD_SRC1 121 |
|
47 | #define TM_DESTINATION_ID_SPARE_GRD_SRC1 121 | |
48 | #define TM_DESTINATION_ID_SPARE_GRD_SRC2 122 |
|
48 | #define TM_DESTINATION_ID_SPARE_GRD_SRC2 122 | |
49 | #define TM_DESTINATION_ID_OBCP 15 |
|
49 | #define TM_DESTINATION_ID_OBCP 15 | |
50 | #define TM_DESTINATION_ID_SYSTEM_CONTROL 14 |
|
50 | #define TM_DESTINATION_ID_SYSTEM_CONTROL 14 | |
51 | #define TM_DESTINATION_ID_AOCS 11 |
|
51 | #define TM_DESTINATION_ID_AOCS 11 | |
52 |
|
52 | |||
53 | #define CCSDS_DESTINATION_ID 0x01 |
|
53 | #define CCSDS_DESTINATION_ID 0x01 | |
54 | #define CCSDS_PROTOCOLE_ID 0x02 |
|
54 | #define CCSDS_PROTOCOLE_ID 0x02 | |
55 | #define CCSDS_RESERVED 0x00 |
|
55 | #define CCSDS_RESERVED 0x00 | |
56 | #define CCSDS_USER_APP 0x00 |
|
56 | #define CCSDS_USER_APP 0x00 | |
57 |
|
57 | |||
58 | #define SIZE_TM_LFR_TC_EXE_NOT_IMPLEMENTED 24 |
|
58 | #define SIZE_TM_LFR_TC_EXE_NOT_IMPLEMENTED 24 | |
59 | #define SIZE_TM_LFR_TC_EXE_CORRUPTED 32 |
|
59 | #define SIZE_TM_LFR_TC_EXE_CORRUPTED 32 | |
60 | #define SIZE_HK_PARAMETERS 112 |
|
60 | #define SIZE_HK_PARAMETERS 112 | |
61 |
|
61 | |||
62 | // TC TYPES |
|
62 | // TC TYPES | |
63 | #define TC_TYPE_GEN 181 |
|
63 | #define TC_TYPE_GEN 181 | |
64 | #define TC_TYPE_TIME 9 |
|
64 | #define TC_TYPE_TIME 9 | |
65 |
|
65 | |||
66 | // TC SUBTYPES |
|
66 | // TC SUBTYPES | |
67 | #define TC_SUBTYPE_RESET 1 |
|
67 | #define TC_SUBTYPE_RESET 1 | |
68 | #define TC_SUBTYPE_LOAD_COMM 11 |
|
68 | #define TC_SUBTYPE_LOAD_COMM 11 | |
69 | #define TC_SUBTYPE_LOAD_NORM 13 |
|
69 | #define TC_SUBTYPE_LOAD_NORM 13 | |
70 | #define TC_SUBTYPE_LOAD_BURST 19 |
|
70 | #define TC_SUBTYPE_LOAD_BURST 19 | |
71 | #define TC_SUBTYPE_LOAD_SBM1 25 |
|
71 | #define TC_SUBTYPE_LOAD_SBM1 25 | |
72 | #define TC_SUBTYPE_LOAD_SBM2 27 |
|
72 | #define TC_SUBTYPE_LOAD_SBM2 27 | |
73 | #define TC_SUBTYPE_DUMP 31 |
|
73 | #define TC_SUBTYPE_DUMP 31 | |
74 | #define TC_SUBTYPE_ENTER 41 |
|
74 | #define TC_SUBTYPE_ENTER 41 | |
75 | #define TC_SUBTYPE_UPDT_INFO 51 |
|
75 | #define TC_SUBTYPE_UPDT_INFO 51 | |
76 | #define TC_SUBTYPE_EN_CAL 61 |
|
76 | #define TC_SUBTYPE_EN_CAL 61 | |
77 | #define TC_SUBTYPE_DIS_CAL 63 |
|
77 | #define TC_SUBTYPE_DIS_CAL 63 | |
78 | #define TC_SUBTYPE_UPDT_TIME 129 |
|
78 | #define TC_SUBTYPE_UPDT_TIME 129 | |
79 |
|
79 | |||
80 | // TC LEN |
|
80 | // TC LEN | |
81 | #define TC_LEN_RESET 12 |
|
81 | #define TC_LEN_RESET 12 | |
82 | #define TC_LEN_LOAD_COMM 14 |
|
82 | #define TC_LEN_LOAD_COMM 14 | |
83 | #define TC_LEN_LOAD_NORM 20 |
|
83 | #define TC_LEN_LOAD_NORM 20 | |
84 | #define TC_LEN_LOAD_BURST 14 |
|
84 | #define TC_LEN_LOAD_BURST 14 | |
85 | #define TC_LEN_LOAD_SBM1 14 |
|
85 | #define TC_LEN_LOAD_SBM1 14 | |
86 | #define TC_LEN_LOAD_SBM2 14 |
|
86 | #define TC_LEN_LOAD_SBM2 14 | |
87 | #define TC_LEN_DUMP 12 |
|
87 | #define TC_LEN_DUMP 12 | |
88 | #define TC_LEN_ENTER 20 |
|
88 | #define TC_LEN_ENTER 20 | |
89 | #define TC_LEN_UPDT_INFO 48 |
|
89 | #define TC_LEN_UPDT_INFO 48 | |
90 | #define TC_LEN_EN_CAL 12 |
|
90 | #define TC_LEN_EN_CAL 12 | |
91 | #define TC_LEN_DIS_CAL 12 |
|
91 | #define TC_LEN_DIS_CAL 12 | |
92 | #define TC_LEN_UPDT_TIME 18 |
|
92 | #define TC_LEN_UPDT_TIME 18 | |
93 |
|
93 | |||
94 | // TM TYPES |
|
94 | // TM TYPES | |
95 | #define TM_TYPE_TC_EXE 1 |
|
95 | #define TM_TYPE_TC_EXE 1 | |
96 | #define TM_TYPE_HK 3 |
|
96 | #define TM_TYPE_HK 3 | |
97 | #define TM_TYPE_PARAMETER_DUMP 3 |
|
97 | #define TM_TYPE_PARAMETER_DUMP 3 | |
98 | #define TM_TYPE_LFR_SCIENCE 21 |
|
98 | #define TM_TYPE_LFR_SCIENCE 21 | |
99 |
|
99 | |||
100 | // TM SUBTYPES |
|
100 | // TM SUBTYPES | |
101 | #define TM_SUBTYPE_EXE_OK 7 |
|
101 | #define TM_SUBTYPE_EXE_OK 7 | |
102 | #define TM_SUBTYPE_EXE_NOK 8 |
|
102 | #define TM_SUBTYPE_EXE_NOK 8 | |
103 | #define TM_SUBTYPE_HK 25 |
|
103 | #define TM_SUBTYPE_HK 25 | |
104 | #define TM_SUBTYPE_PARAMETER_DUMP 25 |
|
104 | #define TM_SUBTYPE_PARAMETER_DUMP 25 | |
105 | #define TM_SUBTYPE_SCIENCE 3 |
|
105 | #define TM_SUBTYPE_SCIENCE 3 | |
106 | #define TM_SUBTYPE_LFR_SCIENCE 3 |
|
106 | #define TM_SUBTYPE_LFR_SCIENCE 3 | |
107 |
|
107 | |||
108 | // FAILURE CODES |
|
108 | // FAILURE CODES | |
109 | #define ILLEGAL_APID 0 |
|
109 | #define ILLEGAL_APID 0 | |
110 | #define WRONG_LEN_PKT 1 |
|
110 | #define WRONG_LEN_PKT 1 | |
111 | #define INCOR_CHECKSUM 2 |
|
111 | #define INCOR_CHECKSUM 2 | |
112 | #define ILL_TYPE 3 |
|
112 | #define ILL_TYPE 3 | |
113 | #define ILL_SUBTYPE 4 |
|
113 | #define ILL_SUBTYPE 4 | |
114 | #define WRONG_APP_DATA 5 // 0x00 0x05 |
|
114 | #define WRONG_APP_DATA 5 // 0x00 0x05 | |
115 | #define TC_NOT_EXE 42000 // 0xa4 0x10 |
|
115 | #define TC_NOT_EXE 42000 // 0xa4 0x10 | |
116 | #define WRONG_SRC_ID 42001 // 0xa4 0x11 |
|
116 | #define WRONG_SRC_ID 42001 // 0xa4 0x11 | |
117 | #define FUNCT_NOT_IMPL 42002 // 0xa4 0x12 |
|
117 | #define FUNCT_NOT_IMPL 42002 // 0xa4 0x12 | |
118 | #define FAIL_DETECTED 42003 // 0xa4 0x13 |
|
118 | #define FAIL_DETECTED 42003 // 0xa4 0x13 | |
119 | #define NOT_ALLOWED 42004 // 0xa4 0x14 |
|
119 | #define NOT_ALLOWED 42004 // 0xa4 0x14 | |
120 | #define CORRUPTED 42005 // 0xa4 0x15 |
|
120 | #define CORRUPTED 42005 // 0xa4 0x15 | |
121 | #define CCSDS_TM_VALID 7 |
|
121 | #define CCSDS_TM_VALID 7 | |
122 |
|
122 | |||
123 | // TC SID |
|
123 | // TC SID | |
124 | #define SID_TC_GROUND 0 |
|
124 | #define SID_TC_GROUND 0 | |
125 | #define SID_TC_MISSION_TIMELINE 110 |
|
125 | #define SID_TC_MISSION_TIMELINE 110 | |
126 | #define SID_TC_TC_SEQUENCES 111 |
|
126 | #define SID_TC_TC_SEQUENCES 111 | |
127 | #define SID_TC_RECOVERY_ACTION_CMD 112 |
|
127 | #define SID_TC_RECOVERY_ACTION_CMD 112 | |
128 | #define SID_TC_BACKUP_MISSION_TIMELINE 113 |
|
128 | #define SID_TC_BACKUP_MISSION_TIMELINE 113 | |
129 | #define SID_TC_DIRECT_CMD 120 |
|
129 | #define SID_TC_DIRECT_CMD 120 | |
130 | #define SID_TC_SPARE_GRD_SRC1 121 |
|
130 | #define SID_TC_SPARE_GRD_SRC1 121 | |
131 | #define SID_TC_SPARE_GRD_SRC2 122 |
|
131 | #define SID_TC_SPARE_GRD_SRC2 122 | |
132 | #define SID_TC_OBCP 15 |
|
132 | #define SID_TC_OBCP 15 | |
133 | #define SID_TC_SYSTEM_CONTROL 14 |
|
133 | #define SID_TC_SYSTEM_CONTROL 14 | |
134 | #define SID_TC_AOCS 11 |
|
134 | #define SID_TC_AOCS 11 | |
135 | #define SID_TC_RPW_INTERNAL 254 |
|
135 | #define SID_TC_RPW_INTERNAL 254 | |
136 |
|
136 | |||
137 | enum apid_destid{ |
|
137 | enum apid_destid{ | |
138 | GROUND, |
|
138 | GROUND, | |
139 | MISSION_TIMELINE, |
|
139 | MISSION_TIMELINE, | |
140 | TC_SEQUENCES, |
|
140 | TC_SEQUENCES, | |
141 | RECOVERY_ACTION_CMD, |
|
141 | RECOVERY_ACTION_CMD, | |
142 | BACKUP_MISSION_TIMELINE, |
|
142 | BACKUP_MISSION_TIMELINE, | |
143 | DIRECT_CMD, |
|
143 | DIRECT_CMD, | |
144 | SPARE_GRD_SRC1, |
|
144 | SPARE_GRD_SRC1, | |
145 | SPARE_GRD_SRC2, |
|
145 | SPARE_GRD_SRC2, | |
146 | OBCP, |
|
146 | OBCP, | |
147 | SYSTEM_CONTROL, |
|
147 | SYSTEM_CONTROL, | |
148 | AOCS, |
|
148 | AOCS, | |
149 | RPW_INTERNAL, |
|
149 | RPW_INTERNAL, | |
150 | UNKNOWN |
|
150 | UNKNOWN | |
151 | }; |
|
151 | }; | |
152 | // SEQUENCE COUNTERS |
|
152 | // SEQUENCE COUNTERS | |
153 | #define SEQ_CNT_MAX 16383 |
|
153 | #define SEQ_CNT_MAX 16383 | |
154 | #define SEQ_CNT_NB_DEST_ID 12 |
|
154 | #define SEQ_CNT_NB_DEST_ID 12 | |
155 |
|
155 | |||
156 | // TM SID |
|
156 | // TM SID | |
157 | #define SID_HK 1 |
|
157 | #define SID_HK 1 | |
158 | #define SID_PARAMETER_DUMP 10 |
|
158 | #define SID_PARAMETER_DUMP 10 | |
159 |
|
159 | |||
160 | #define SID_NORM_SWF_F0 3 |
|
160 | #define SID_NORM_SWF_F0 3 | |
161 | #define SID_NORM_SWF_F1 4 |
|
161 | #define SID_NORM_SWF_F1 4 | |
162 | #define SID_NORM_SWF_F2 5 |
|
162 | #define SID_NORM_SWF_F2 5 | |
163 | #define SID_NORM_CWF_F3 1 |
|
163 | #define SID_NORM_CWF_F3 1 | |
164 | #define SID_BURST_CWF_F2 2 |
|
164 | #define SID_BURST_CWF_F2 2 | |
165 | #define SID_SBM1_CWF_F1 24 |
|
165 | #define SID_SBM1_CWF_F1 24 | |
166 | #define SID_SBM2_CWF_F2 25 |
|
166 | #define SID_SBM2_CWF_F2 25 | |
167 | #define SID_NORM_ASM_F0 11 |
|
167 | #define SID_NORM_ASM_F0 11 | |
168 | #define SID_NORM_ASM_F1 12 |
|
168 | #define SID_NORM_ASM_F1 12 | |
169 | #define SID_NORM_ASM_F2 13 |
|
169 | #define SID_NORM_ASM_F2 13 | |
170 | #define SID_NORM_BP1_F0 14 |
|
170 | #define SID_NORM_BP1_F0 14 | |
171 | #define SID_NORM_BP1_F1 15 |
|
171 | #define SID_NORM_BP1_F1 15 | |
172 | #define SID_NORM_BP1_F2 16 |
|
172 | #define SID_NORM_BP1_F2 16 | |
173 | #define SID_NORM_BP2_F0 19 |
|
173 | #define SID_NORM_BP2_F0 19 | |
174 | #define SID_NORM_BP2_F1 20 |
|
174 | #define SID_NORM_BP2_F1 20 | |
175 | #define SID_NORM_BP2_F2 21 |
|
175 | #define SID_NORM_BP2_F2 21 | |
176 | #define SID_BURST_BP1_F0 17 |
|
176 | #define SID_BURST_BP1_F0 17 | |
177 | #define SID_BURST_BP2_F0 22 |
|
177 | #define SID_BURST_BP2_F0 22 | |
178 | #define SID_BURST_BP1_F1 18 |
|
178 | #define SID_BURST_BP1_F1 18 | |
179 | #define SID_BURST_BP2_F1 23 |
|
179 | #define SID_BURST_BP2_F1 23 | |
180 | #define SID_SBM1_BP1_F0 28 |
|
180 | #define SID_SBM1_BP1_F0 28 | |
181 | #define SID_SBM1_BP2_F0 31 |
|
181 | #define SID_SBM1_BP2_F0 31 | |
182 | #define SID_SBM2_BP1_F0 29 |
|
182 | #define SID_SBM2_BP1_F0 29 | |
183 | #define SID_SBM2_BP2_F0 32 |
|
183 | #define SID_SBM2_BP2_F0 32 | |
184 | #define SID_SBM2_BP1_F1 30 |
|
184 | #define SID_SBM2_BP1_F1 30 | |
185 | #define SID_SBM2_BP2_F1 33 |
|
185 | #define SID_SBM2_BP2_F1 33 | |
186 |
|
186 | |||
187 | // LENGTH (BYTES) |
|
187 | // LENGTH (BYTES) | |
188 | #define LENGTH_TM_LFR_TC_EXE_MAX 32 |
|
188 | #define LENGTH_TM_LFR_TC_EXE_MAX 32 | |
189 | #define LENGTH_TM_LFR_HK 126 |
|
189 | #define LENGTH_TM_LFR_HK 126 | |
190 |
|
190 | |||
191 | // HEADER_LENGTH |
|
191 | // HEADER_LENGTH | |
192 | #define TM_HEADER_LEN 16 |
|
192 | #define TM_HEADER_LEN 16 | |
193 | #define HEADER_LENGTH_TM_LFR_SCIENCE_ASM 28 |
|
193 | #define HEADER_LENGTH_TM_LFR_SCIENCE_ASM 28 | |
194 | // PACKET_LENGTH |
|
194 | // PACKET_LENGTH | |
195 | #define PACKET_LENGTH_TC_EXE_SUCCESS (20 - CCSDS_TC_TM_PACKET_OFFSET) |
|
195 | #define PACKET_LENGTH_TC_EXE_SUCCESS (20 - CCSDS_TC_TM_PACKET_OFFSET) | |
196 | #define PACKET_LENGTH_TC_EXE_INCONSISTENT (26 - CCSDS_TC_TM_PACKET_OFFSET) |
|
196 | #define PACKET_LENGTH_TC_EXE_INCONSISTENT (26 - CCSDS_TC_TM_PACKET_OFFSET) | |
197 | #define PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE (26 - CCSDS_TC_TM_PACKET_OFFSET) |
|
197 | #define PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE (26 - CCSDS_TC_TM_PACKET_OFFSET) | |
198 | #define PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED (24 - CCSDS_TC_TM_PACKET_OFFSET) |
|
198 | #define PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED (24 - CCSDS_TC_TM_PACKET_OFFSET) | |
199 | #define PACKET_LENGTH_TC_EXE_ERROR (24 - CCSDS_TC_TM_PACKET_OFFSET) |
|
199 | #define PACKET_LENGTH_TC_EXE_ERROR (24 - CCSDS_TC_TM_PACKET_OFFSET) | |
200 | #define PACKET_LENGTH_TC_EXE_CORRUPTED (32 - CCSDS_TC_TM_PACKET_OFFSET) |
|
200 | #define PACKET_LENGTH_TC_EXE_CORRUPTED (32 - CCSDS_TC_TM_PACKET_OFFSET) | |
201 | #define PACKET_LENGTH_HK (126 - CCSDS_TC_TM_PACKET_OFFSET) |
|
201 | #define PACKET_LENGTH_HK (126 - CCSDS_TC_TM_PACKET_OFFSET) | |
202 | #define PACKET_LENGTH_PARAMETER_DUMP (34 - CCSDS_TC_TM_PACKET_OFFSET) |
|
202 | #define PACKET_LENGTH_PARAMETER_DUMP (34 - CCSDS_TC_TM_PACKET_OFFSET) | |
203 | #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM (TOTAL_SIZE_SM + HEADER_LENGTH_TM_LFR_SCIENCE_ASM - CCSDS_TC_TM_PACKET_OFFSET) |
|
203 | #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM (TOTAL_SIZE_SM + HEADER_LENGTH_TM_LFR_SCIENCE_ASM - CCSDS_TC_TM_PACKET_OFFSET) | |
204 |
|
204 | |||
205 | #define SPARE1_PUSVERSION_SPARE2 0x10 |
|
205 | #define SPARE1_PUSVERSION_SPARE2 0x10 | |
206 |
|
206 | |||
207 | #define LEN_TM_LFR_HK 130 // 126 + 4 |
|
207 | #define LEN_TM_LFR_HK 130 // 126 + 4 | |
208 | #define LEN_TM_LFR_TC_EXE_NOT_IMP 28 // 24 + 4 |
|
208 | #define LEN_TM_LFR_TC_EXE_NOT_IMP 28 // 24 + 4 | |
209 |
|
209 | |||
210 | #define TM_LEN_SCI_SWF_340 4101 // 340 * 12 + 10 + 12 - 1 |
|
210 | #define TM_LEN_SCI_SWF_340 4101 // 340 * 12 + 10 + 12 - 1 | |
211 | #define TM_LEN_SCI_SWF_8 117 // 8 * 12 + 10 + 12 - 1 |
|
211 | #define TM_LEN_SCI_SWF_8 117 // 8 * 12 + 10 + 12 - 1 | |
212 | #define TM_LEN_SCI_CWF_340 4099 // 340 * 12 + 10 + 10 - 1 |
|
212 | #define TM_LEN_SCI_CWF_340 4099 // 340 * 12 + 10 + 10 - 1 | |
213 | #define TM_LEN_SCI_CWF_8 115 // 8 * 12 + 10 + 10 - 1 |
|
213 | #define TM_LEN_SCI_CWF_8 115 // 8 * 12 + 10 + 10 - 1 | |
214 | #define TM_LEN_SCI_CWF3_LIGHT_340 2059 // 340 * 6 + 10 + 10 - 1 |
|
214 | #define TM_LEN_SCI_CWF3_LIGHT_340 2059 // 340 * 6 + 10 + 10 - 1 | |
215 | #define TM_LEN_SCI_CWF3_LIGHT_8 67 // 8 * 6 + 10 + 10 - 1 |
|
215 | #define TM_LEN_SCI_CWF3_LIGHT_8 67 // 8 * 6 + 10 + 10 - 1 | |
216 | #define DEFAULT_PKTCNT 0x07 |
|
216 | #define DEFAULT_PKTCNT 0x07 | |
217 | #define BLK_NR_340 0x0154 |
|
217 | #define BLK_NR_340 0x0154 | |
218 | #define BLK_NR_8 0x0008 |
|
218 | #define BLK_NR_8 0x0008 | |
219 |
|
219 | |||
220 | enum TM_TYPE{ |
|
220 | enum TM_TYPE{ | |
221 | TM_LFR_TC_EXE_OK, |
|
221 | TM_LFR_TC_EXE_OK, | |
222 | TM_LFR_TC_EXE_ERR, |
|
222 | TM_LFR_TC_EXE_ERR, | |
223 | TM_LFR_HK, |
|
223 | TM_LFR_HK, | |
224 | TM_LFR_SCI, |
|
224 | TM_LFR_SCI, | |
225 | TM_LFR_SCI_SBM, |
|
225 | TM_LFR_SCI_SBM, | |
226 | TM_LFR_PAR_DUMP |
|
226 | TM_LFR_PAR_DUMP | |
227 | }; |
|
227 | }; | |
228 |
|
228 | |||
229 | struct TMHeader_str |
|
229 | typedef struct { | |
230 | { |
|
|||
231 | unsigned char targetLogicalAddress; |
|
|||
232 | unsigned char protocolIdentifier; |
|
|||
233 | unsigned char reserved; |
|
|||
234 | unsigned char userApplication; |
|
|||
235 | unsigned char packetID[2]; |
|
|||
236 | unsigned char packetSequenceControl[2]; |
|
|||
237 | unsigned char packetLength[2]; |
|
|||
238 | // DATA FIELD HEADER |
|
|||
239 | unsigned char spare1_pusVersion_spare2; |
|
|||
240 | unsigned char serviceType; |
|
|||
241 | unsigned char serviceSubType; |
|
|||
242 | unsigned char destinationID; |
|
|||
243 | unsigned char time[6]; |
|
|||
244 | }; |
|
|||
245 | typedef struct TMHeader_str TMHeader_t; |
|
|||
246 |
|
||||
247 | struct Packet_TM_LFR_TC_EXE_str |
|
|||
248 | { |
|
|||
249 | unsigned char targetLogicalAddress; |
|
|||
250 | unsigned char protocolIdentifier; |
|
|||
251 | unsigned char reserved; |
|
|||
252 | unsigned char userApplication; |
|
|||
253 | unsigned char packetID[2]; |
|
|||
254 | unsigned char packetSequenceControl[2]; |
|
|||
255 | unsigned char packetLength[2]; |
|
|||
256 | // DATA FIELD HEADER |
|
|||
257 | unsigned char spare1_pusVersion_spare2; |
|
|||
258 | unsigned char serviceType; |
|
|||
259 | unsigned char serviceSubType; |
|
|||
260 | unsigned char destinationID; |
|
|||
261 | unsigned char time[6]; |
|
|||
262 | unsigned char data[LENGTH_TM_LFR_TC_EXE_MAX - 10 + 1]; |
|
|||
263 | }; |
|
|||
264 | typedef struct Packet_TM_LFR_TC_EXE_str Packet_TM_LFR_TC_EXE_t; |
|
|||
265 |
|
||||
266 | struct Packet_TM_LFR_TC_EXE_SUCCESS_str |
|
|||
267 | { |
|
|||
268 | unsigned char targetLogicalAddress; |
|
230 | unsigned char targetLogicalAddress; | |
269 | unsigned char protocolIdentifier; |
|
231 | unsigned char protocolIdentifier; | |
270 | unsigned char reserved; |
|
232 | unsigned char reserved; | |
271 | unsigned char userApplication; |
|
233 | unsigned char userApplication; | |
272 | // PACKET HEADER |
|
234 | // PACKET HEADER | |
273 | unsigned char packetID[2]; |
|
235 | unsigned char packetID[2]; | |
274 | unsigned char packetSequenceControl[2]; |
|
236 | unsigned char packetSequenceControl[2]; | |
275 | unsigned char packetLength[2]; |
|
237 | unsigned char packetLength[2]; | |
276 | // DATA FIELD HEADER |
|
238 | // DATA FIELD HEADER | |
277 | unsigned char spare1_pusVersion_spare2; |
|
239 | unsigned char spare1_pusVersion_spare2; | |
278 | unsigned char serviceType; |
|
240 | unsigned char serviceType; | |
279 | unsigned char serviceSubType; |
|
241 | unsigned char serviceSubType; | |
280 | unsigned char destinationID; |
|
242 | unsigned char destinationID; | |
281 | unsigned char time[6]; |
|
243 | unsigned char time[6]; | |
282 | // |
|
244 | // | |
283 | unsigned char telecommand_pkt_id[2]; |
|
245 | unsigned char telecommand_pkt_id[2]; | |
284 | unsigned char pkt_seq_control[2]; |
|
246 | unsigned char pkt_seq_control[2]; | |
285 | }; |
|
247 | } Packet_TM_LFR_TC_EXE_SUCCESS_t; | |
286 | typedef struct Packet_TM_LFR_TC_EXE_SUCCESS_str Packet_TM_LFR_TC_EXE_SUCCESS_t; |
|
|||
287 |
|
248 | |||
288 | struct Packet_TM_LFR_TC_EXE_INCONSISTENT_str |
|
249 | typedef struct { | |
289 | { |
|
|||
290 | unsigned char targetLogicalAddress; |
|
250 | unsigned char targetLogicalAddress; | |
291 | unsigned char protocolIdentifier; |
|
251 | unsigned char protocolIdentifier; | |
292 | unsigned char reserved; |
|
252 | unsigned char reserved; | |
293 | unsigned char userApplication; |
|
253 | unsigned char userApplication; | |
294 | // PACKET HEADER |
|
254 | // PACKET HEADER | |
295 | unsigned char packetID[2]; |
|
255 | unsigned char packetID[2]; | |
296 | unsigned char packetSequenceControl[2]; |
|
256 | unsigned char packetSequenceControl[2]; | |
297 | unsigned char packetLength[2]; |
|
257 | unsigned char packetLength[2]; | |
298 | // DATA FIELD HEADER |
|
258 | // DATA FIELD HEADER | |
299 | unsigned char spare1_pusVersion_spare2; |
|
259 | unsigned char spare1_pusVersion_spare2; | |
300 | unsigned char serviceType; |
|
260 | unsigned char serviceType; | |
301 | unsigned char serviceSubType; |
|
261 | unsigned char serviceSubType; | |
302 | unsigned char destinationID; |
|
262 | unsigned char destinationID; | |
303 | unsigned char time[6]; |
|
263 | unsigned char time[6]; | |
304 | // |
|
264 | // | |
305 | unsigned char tc_failure_code[2]; |
|
265 | unsigned char tc_failure_code[2]; | |
306 | unsigned char telecommand_pkt_id[2]; |
|
266 | unsigned char telecommand_pkt_id[2]; | |
307 | unsigned char pkt_seq_control[2]; |
|
267 | unsigned char pkt_seq_control[2]; | |
308 | unsigned char tc_service; |
|
268 | unsigned char tc_service; | |
309 | unsigned char tc_subtype; |
|
269 | unsigned char tc_subtype; | |
310 | unsigned char byte_position; |
|
270 | unsigned char byte_position; | |
311 | unsigned char rcv_value; |
|
271 | unsigned char rcv_value; | |
312 | }; |
|
272 | } Packet_TM_LFR_TC_EXE_INCONSISTENT_t; | |
313 | typedef struct Packet_TM_LFR_TC_EXE_INCONSISTENT_str Packet_TM_LFR_TC_EXE_INCONSISTENT_t; |
|
|||
314 |
|
273 | |||
315 | struct Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_str |
|
274 | typedef struct { | |
316 | { |
|
|||
317 | unsigned char targetLogicalAddress; |
|
275 | unsigned char targetLogicalAddress; | |
318 | unsigned char protocolIdentifier; |
|
276 | unsigned char protocolIdentifier; | |
319 | unsigned char reserved; |
|
277 | unsigned char reserved; | |
320 | unsigned char userApplication; |
|
278 | unsigned char userApplication; | |
321 | // PACKET HEADER |
|
279 | // PACKET HEADER | |
322 | unsigned char packetID[2]; |
|
280 | unsigned char packetID[2]; | |
323 | unsigned char packetSequenceControl[2]; |
|
281 | unsigned char packetSequenceControl[2]; | |
324 | unsigned char packetLength[2]; |
|
282 | unsigned char packetLength[2]; | |
325 | // DATA FIELD HEADER |
|
283 | // DATA FIELD HEADER | |
326 | unsigned char spare1_pusVersion_spare2; |
|
284 | unsigned char spare1_pusVersion_spare2; | |
327 | unsigned char serviceType; |
|
285 | unsigned char serviceType; | |
328 | unsigned char serviceSubType; |
|
286 | unsigned char serviceSubType; | |
329 | unsigned char destinationID; |
|
287 | unsigned char destinationID; | |
330 | unsigned char time[6]; |
|
288 | unsigned char time[6]; | |
331 | // |
|
289 | // | |
332 | unsigned char tc_failure_code[2]; |
|
290 | unsigned char tc_failure_code[2]; | |
333 | unsigned char telecommand_pkt_id[2]; |
|
291 | unsigned char telecommand_pkt_id[2]; | |
334 | unsigned char pkt_seq_control[2]; |
|
292 | unsigned char pkt_seq_control[2]; | |
335 | unsigned char tc_service; |
|
293 | unsigned char tc_service; | |
336 | unsigned char tc_subtype; |
|
294 | unsigned char tc_subtype; | |
337 | unsigned char lfr_status_word[2]; |
|
295 | unsigned char lfr_status_word[2]; | |
338 | }; |
|
296 | } Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t; | |
339 | typedef struct Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_str Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t; |
|
|||
340 |
|
297 | |||
341 | struct Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_str |
|
298 | typedef struct { | |
342 | { |
|
|||
343 | unsigned char targetLogicalAddress; |
|
299 | unsigned char targetLogicalAddress; | |
344 | unsigned char protocolIdentifier; |
|
300 | unsigned char protocolIdentifier; | |
345 | unsigned char reserved; |
|
301 | unsigned char reserved; | |
346 | unsigned char userApplication; |
|
302 | unsigned char userApplication; | |
347 | // PACKET HEADER |
|
303 | // PACKET HEADER | |
348 | unsigned char packetID[2]; |
|
304 | unsigned char packetID[2]; | |
349 | unsigned char packetSequenceControl[2]; |
|
305 | unsigned char packetSequenceControl[2]; | |
350 | unsigned char packetLength[2]; |
|
306 | unsigned char packetLength[2]; | |
351 | // DATA FIELD HEADER |
|
307 | // DATA FIELD HEADER | |
352 | unsigned char spare1_pusVersion_spare2; |
|
308 | unsigned char spare1_pusVersion_spare2; | |
353 | unsigned char serviceType; |
|
309 | unsigned char serviceType; | |
354 | unsigned char serviceSubType; |
|
310 | unsigned char serviceSubType; | |
355 | unsigned char destinationID; |
|
311 | unsigned char destinationID; | |
356 | unsigned char time[6]; |
|
312 | unsigned char time[6]; | |
357 | // |
|
313 | // | |
358 | unsigned char tc_failure_code[2]; |
|
314 | unsigned char tc_failure_code[2]; | |
359 | unsigned char telecommand_pkt_id[2]; |
|
315 | unsigned char telecommand_pkt_id[2]; | |
360 | unsigned char pkt_seq_control[2]; |
|
316 | unsigned char pkt_seq_control[2]; | |
361 | unsigned char tc_service; |
|
317 | unsigned char tc_service; | |
362 | unsigned char tc_subtype; |
|
318 | unsigned char tc_subtype; | |
363 | }; |
|
319 | } Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t; | |
364 | typedef struct Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_str Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t; |
|
|||
365 |
|
320 | |||
366 | struct Packet_TM_LFR_TC_EXE_ERROR_str |
|
321 | typedef struct { | |
367 | { |
|
|||
368 | unsigned char targetLogicalAddress; |
|
322 | unsigned char targetLogicalAddress; | |
369 | unsigned char protocolIdentifier; |
|
323 | unsigned char protocolIdentifier; | |
370 | unsigned char reserved; |
|
324 | unsigned char reserved; | |
371 | unsigned char userApplication; |
|
325 | unsigned char userApplication; | |
372 | // PACKET HEADER |
|
326 | // PACKET HEADER | |
373 | unsigned char packetID[2]; |
|
327 | unsigned char packetID[2]; | |
374 | unsigned char packetSequenceControl[2]; |
|
328 | unsigned char packetSequenceControl[2]; | |
375 | unsigned char packetLength[2]; |
|
329 | unsigned char packetLength[2]; | |
376 | // DATA FIELD HEADER |
|
330 | // DATA FIELD HEADER | |
377 | unsigned char spare1_pusVersion_spare2; |
|
331 | unsigned char spare1_pusVersion_spare2; | |
378 | unsigned char serviceType; |
|
332 | unsigned char serviceType; | |
379 | unsigned char serviceSubType; |
|
333 | unsigned char serviceSubType; | |
380 | unsigned char destinationID; |
|
334 | unsigned char destinationID; | |
381 | unsigned char time[6]; |
|
335 | unsigned char time[6]; | |
382 | // |
|
336 | // | |
383 | unsigned char tc_failure_code[2]; |
|
337 | unsigned char tc_failure_code[2]; | |
384 | unsigned char telecommand_pkt_id[2]; |
|
338 | unsigned char telecommand_pkt_id[2]; | |
385 | unsigned char pkt_seq_control[2]; |
|
339 | unsigned char pkt_seq_control[2]; | |
386 | unsigned char tc_service; |
|
340 | unsigned char tc_service; | |
387 | unsigned char tc_subtype; |
|
341 | unsigned char tc_subtype; | |
388 | }; |
|
342 | } Packet_TM_LFR_TC_EXE_ERROR_t; | |
389 | typedef struct Packet_TM_LFR_TC_EXE_ERROR_str Packet_TM_LFR_TC_EXE_ERROR_t; |
|
|||
390 |
|
343 | |||
391 | struct Packet_TM_LFR_TC_EXE_CORRUPTED_str |
|
344 | typedef struct { | |
392 | { |
|
|||
393 | unsigned char targetLogicalAddress; |
|
345 | unsigned char targetLogicalAddress; | |
394 | unsigned char protocolIdentifier; |
|
346 | unsigned char protocolIdentifier; | |
395 | unsigned char reserved; |
|
347 | unsigned char reserved; | |
396 | unsigned char userApplication; |
|
348 | unsigned char userApplication; | |
397 | // PACKET HEADER |
|
349 | // PACKET HEADER | |
398 | unsigned char packetID[2]; |
|
350 | unsigned char packetID[2]; | |
399 | unsigned char packetSequenceControl[2]; |
|
351 | unsigned char packetSequenceControl[2]; | |
400 | unsigned char packetLength[2]; |
|
352 | unsigned char packetLength[2]; | |
401 | // DATA FIELD HEADER |
|
353 | // DATA FIELD HEADER | |
402 | unsigned char spare1_pusVersion_spare2; |
|
354 | unsigned char spare1_pusVersion_spare2; | |
403 | unsigned char serviceType; |
|
355 | unsigned char serviceType; | |
404 | unsigned char serviceSubType; |
|
356 | unsigned char serviceSubType; | |
405 | unsigned char destinationID; |
|
357 | unsigned char destinationID; | |
406 | unsigned char time[6]; |
|
358 | unsigned char time[6]; | |
407 | // |
|
359 | // | |
408 | unsigned char tc_failure_code[2]; |
|
360 | unsigned char tc_failure_code[2]; | |
409 | unsigned char telecommand_pkt_id[2]; |
|
361 | unsigned char telecommand_pkt_id[2]; | |
410 | unsigned char pkt_seq_control[2]; |
|
362 | unsigned char pkt_seq_control[2]; | |
411 | unsigned char tc_service; |
|
363 | unsigned char tc_service; | |
412 | unsigned char tc_subtype; |
|
364 | unsigned char tc_subtype; | |
413 | unsigned char pkt_len_rcv_value[2]; |
|
365 | unsigned char pkt_len_rcv_value[2]; | |
414 | unsigned char pkt_datafieldsize_cnt[2]; |
|
366 | unsigned char pkt_datafieldsize_cnt[2]; | |
415 | unsigned char rcv_crc[2]; |
|
367 | unsigned char rcv_crc[2]; | |
416 | unsigned char computed_crc[2]; |
|
368 | unsigned char computed_crc[2]; | |
417 | }; |
|
369 | } Packet_TM_LFR_TC_EXE_CORRUPTED_t; | |
418 | typedef struct Packet_TM_LFR_TC_EXE_CORRUPTED_str Packet_TM_LFR_TC_EXE_CORRUPTED_t; |
|
|||
419 |
|
370 | |||
420 | struct Header_TM_LFR_SCIENCE_SWF_str |
|
371 | typedef struct { | |
421 | { |
|
|||
422 | unsigned char targetLogicalAddress; |
|
372 | unsigned char targetLogicalAddress; | |
423 | unsigned char protocolIdentifier; |
|
373 | unsigned char protocolIdentifier; | |
424 | unsigned char reserved; |
|
374 | unsigned char reserved; | |
425 | unsigned char userApplication; |
|
375 | unsigned char userApplication; | |
426 | unsigned char packetID[2]; |
|
376 | unsigned char packetID[2]; | |
427 | unsigned char packetSequenceControl[2]; |
|
377 | unsigned char packetSequenceControl[2]; | |
428 | unsigned char packetLength[2]; |
|
378 | unsigned char packetLength[2]; | |
429 | // DATA FIELD HEADER |
|
379 | // DATA FIELD HEADER | |
430 | unsigned char spare1_pusVersion_spare2; |
|
380 | unsigned char spare1_pusVersion_spare2; | |
431 | unsigned char serviceType; |
|
381 | unsigned char serviceType; | |
432 | unsigned char serviceSubType; |
|
382 | unsigned char serviceSubType; | |
433 | unsigned char destinationID; |
|
383 | unsigned char destinationID; | |
434 | unsigned char time[6]; |
|
384 | unsigned char time[6]; | |
435 | // AUXILIARY HEADER |
|
385 | // AUXILIARY HEADER | |
436 | unsigned char sid; |
|
386 | unsigned char sid; | |
437 | unsigned char hkBIA; |
|
387 | unsigned char hkBIA; | |
438 | unsigned char pktCnt; |
|
388 | unsigned char pktCnt; | |
439 | unsigned char pktNr; |
|
389 | unsigned char pktNr; | |
440 | unsigned char acquisitionTime[6]; |
|
390 | unsigned char acquisitionTime[6]; | |
441 | unsigned char blkNr[2]; |
|
391 | unsigned char blkNr[2]; | |
442 | }; |
|
392 | } Header_TM_LFR_SCIENCE_SWF_t; | |
443 | typedef struct Header_TM_LFR_SCIENCE_SWF_str Header_TM_LFR_SCIENCE_SWF_t; |
|
|||
444 |
|
393 | |||
445 | struct Header_TM_LFR_SCIENCE_CWF_str |
|
394 | typedef struct { | |
446 | { |
|
|||
447 | unsigned char targetLogicalAddress; |
|
395 | unsigned char targetLogicalAddress; | |
448 | unsigned char protocolIdentifier; |
|
396 | unsigned char protocolIdentifier; | |
449 | unsigned char reserved; |
|
397 | unsigned char reserved; | |
450 | unsigned char userApplication; |
|
398 | unsigned char userApplication; | |
451 | unsigned char packetID[2]; |
|
399 | unsigned char packetID[2]; | |
452 | unsigned char packetSequenceControl[2]; |
|
400 | unsigned char packetSequenceControl[2]; | |
453 | unsigned char packetLength[2]; |
|
401 | unsigned char packetLength[2]; | |
454 | // DATA FIELD HEADER |
|
402 | // DATA FIELD HEADER | |
455 | unsigned char spare1_pusVersion_spare2; |
|
403 | unsigned char spare1_pusVersion_spare2; | |
456 | unsigned char serviceType; |
|
404 | unsigned char serviceType; | |
457 | unsigned char serviceSubType; |
|
405 | unsigned char serviceSubType; | |
458 | unsigned char destinationID; |
|
406 | unsigned char destinationID; | |
459 | unsigned char time[6]; |
|
407 | unsigned char time[6]; | |
460 | // AUXILIARY DATA HEADER |
|
408 | // AUXILIARY DATA HEADER | |
461 | unsigned char sid; |
|
409 | unsigned char sid; | |
462 | unsigned char hkBIA; |
|
410 | unsigned char hkBIA; | |
463 | unsigned char acquisitionTime[6]; |
|
411 | unsigned char acquisitionTime[6]; | |
464 | unsigned char blkNr[2]; |
|
412 | unsigned char blkNr[2]; | |
465 | }; |
|
413 | } Header_TM_LFR_SCIENCE_CWF_t; | |
466 | typedef struct Header_TM_LFR_SCIENCE_CWF_str Header_TM_LFR_SCIENCE_CWF_t; |
|
|||
467 |
|
414 | |||
468 | struct Header_TM_LFR_SCIENCE_ASM_str |
|
415 | typedef struct { | |
469 | { |
|
|||
470 | unsigned char targetLogicalAddress; |
|
416 | unsigned char targetLogicalAddress; | |
471 | unsigned char protocolIdentifier; |
|
417 | unsigned char protocolIdentifier; | |
472 | unsigned char reserved; |
|
418 | unsigned char reserved; | |
473 | unsigned char userApplication; |
|
419 | unsigned char userApplication; | |
474 | unsigned char packetID[2]; |
|
420 | unsigned char packetID[2]; | |
475 | unsigned char packetSequenceControl[2]; |
|
421 | unsigned char packetSequenceControl[2]; | |
476 | unsigned char packetLength[2]; |
|
422 | unsigned char packetLength[2]; | |
477 | // DATA FIELD HEADER |
|
423 | // DATA FIELD HEADER | |
478 | unsigned char spare1_pusVersion_spare2; |
|
424 | unsigned char spare1_pusVersion_spare2; | |
479 | unsigned char serviceType; |
|
425 | unsigned char serviceType; | |
480 | unsigned char serviceSubType; |
|
426 | unsigned char serviceSubType; | |
481 | unsigned char destinationID; |
|
427 | unsigned char destinationID; | |
482 | unsigned char time[6]; |
|
428 | unsigned char time[6]; | |
483 | // AUXILIARY HEADER |
|
429 | // AUXILIARY HEADER | |
484 | unsigned char sid; |
|
430 | unsigned char sid; | |
485 | unsigned char biaStatusInfo; |
|
431 | unsigned char biaStatusInfo; | |
486 | unsigned char cntASM; |
|
432 | unsigned char cntASM; | |
487 | unsigned char nrASM; |
|
433 | unsigned char nrASM; | |
488 | unsigned char acquisitionTime[6]; |
|
434 | unsigned char acquisitionTime[6]; | |
489 | unsigned char blkNr[2]; |
|
435 | unsigned char blkNr[2]; | |
490 | }; |
|
436 | } Header_TM_LFR_SCIENCE_ASM_t; | |
491 | typedef struct Header_TM_LFR_SCIENCE_ASM_str Header_TM_LFR_SCIENCE_ASM_t; |
|
|||
492 |
|
437 | |||
493 | struct ccsdsTelecommandPacket_str |
|
438 | typedef struct { | |
494 | { |
|
439 | //targetLogicalAddress is removed by the grspw module | |
495 | //unsigned char targetLogicalAddress; // removed by the grspw module |
|
|||
496 | unsigned char protocolIdentifier; |
|
440 | unsigned char protocolIdentifier; | |
497 | unsigned char reserved; |
|
441 | unsigned char reserved; | |
498 | unsigned char userApplication; |
|
442 | unsigned char userApplication; | |
499 | unsigned char packetID[2]; |
|
443 | unsigned char packetID[2]; | |
500 | unsigned char packetSequenceControl[2]; |
|
444 | unsigned char packetSequenceControl[2]; | |
501 | unsigned char packetLength[2]; |
|
445 | unsigned char packetLength[2]; | |
502 | // DATA FIELD HEADER |
|
446 | // DATA FIELD HEADER | |
503 | unsigned char headerFlag_pusVersion_Ack; |
|
447 | unsigned char headerFlag_pusVersion_Ack; | |
504 | unsigned char serviceType; |
|
448 | unsigned char serviceType; | |
505 | unsigned char serviceSubType; |
|
449 | unsigned char serviceSubType; | |
506 | unsigned char sourceID; |
|
450 | unsigned char sourceID; | |
507 | unsigned char dataAndCRC[CCSDS_TC_PKT_MAX_SIZE-10]; |
|
451 | unsigned char dataAndCRC[CCSDS_TC_PKT_MAX_SIZE-10]; | |
508 | }; |
|
452 | } ccsdsTelecommandPacket_t; | |
509 | typedef struct ccsdsTelecommandPacket_str ccsdsTelecommandPacket_t; |
|
|||
510 |
|
453 | |||
511 | struct Packet_TM_LFR_HK_str |
|
454 | typedef struct { | |
512 | { |
|
|||
513 | unsigned char targetLogicalAddress; |
|
455 | unsigned char targetLogicalAddress; | |
514 | unsigned char protocolIdentifier; |
|
456 | unsigned char protocolIdentifier; | |
515 | unsigned char reserved; |
|
457 | unsigned char reserved; | |
516 | unsigned char userApplication; |
|
458 | unsigned char userApplication; | |
517 | unsigned char packetID[2]; |
|
459 | unsigned char packetID[2]; | |
518 | unsigned char packetSequenceControl[2]; |
|
460 | unsigned char packetSequenceControl[2]; | |
519 | unsigned char packetLength[2]; |
|
461 | unsigned char packetLength[2]; | |
520 | unsigned char spare1_pusVersion_spare2; |
|
462 | unsigned char spare1_pusVersion_spare2; | |
521 | unsigned char serviceType; |
|
463 | unsigned char serviceType; | |
522 | unsigned char serviceSubType; |
|
464 | unsigned char serviceSubType; | |
523 | unsigned char destinationID; |
|
465 | unsigned char destinationID; | |
524 | unsigned char time[6]; |
|
466 | unsigned char time[6]; | |
525 | unsigned char sid; |
|
467 | unsigned char sid; | |
526 |
|
468 | |||
527 | //************** |
|
469 | //************** | |
528 | // HK PARAMETERS |
|
470 | // HK PARAMETERS | |
529 | unsigned char lfr_status_word[2]; |
|
471 | unsigned char lfr_status_word[2]; | |
530 | unsigned char lfr_sw_version[4]; |
|
472 | unsigned char lfr_sw_version[4]; | |
531 | // tc statistics |
|
473 | // tc statistics | |
532 | unsigned char hk_lfr_update_info_tc_cnt[2]; |
|
474 | unsigned char hk_lfr_update_info_tc_cnt[2]; | |
533 | unsigned char hk_lfr_update_time_tc_cnt[2]; |
|
475 | unsigned char hk_lfr_update_time_tc_cnt[2]; | |
534 | unsigned char hk_dpu_exe_tc_lfr_cnt[2]; |
|
476 | unsigned char hk_dpu_exe_tc_lfr_cnt[2]; | |
535 | unsigned char hk_dpu_rej_tc_lfr_cnt[2]; |
|
477 | unsigned char hk_dpu_rej_tc_lfr_cnt[2]; | |
536 | unsigned char hk_lfr_last_exe_tc_id[2]; |
|
478 | unsigned char hk_lfr_last_exe_tc_id[2]; | |
537 | unsigned char hk_lfr_last_exe_tc_type[2]; |
|
479 | unsigned char hk_lfr_last_exe_tc_type[2]; | |
538 | unsigned char hk_lfr_last_exe_tc_subtype[2]; |
|
480 | unsigned char hk_lfr_last_exe_tc_subtype[2]; | |
539 | unsigned char hk_lfr_last_exe_tc_time[6]; |
|
481 | unsigned char hk_lfr_last_exe_tc_time[6]; | |
540 | unsigned char hk_lfr_last_rej_tc_id[2]; |
|
482 | unsigned char hk_lfr_last_rej_tc_id[2]; | |
541 | unsigned char hk_lfr_last_rej_tc_type[2]; |
|
483 | unsigned char hk_lfr_last_rej_tc_type[2]; | |
542 | unsigned char hk_lfr_last_rej_tc_subtype[2]; |
|
484 | unsigned char hk_lfr_last_rej_tc_subtype[2]; | |
543 | unsigned char hk_lfr_last_rej_tc_time[6]; |
|
485 | unsigned char hk_lfr_last_rej_tc_time[6]; | |
544 | // anomaly statistics |
|
486 | // anomaly statistics | |
545 | unsigned char hk_lfr_le_cnt[2]; |
|
487 | unsigned char hk_lfr_le_cnt[2]; | |
546 | unsigned char hk_lfr_me_cnt[2]; |
|
488 | unsigned char hk_lfr_me_cnt[2]; | |
547 | unsigned char hk_lfr_he_cnt[2]; |
|
489 | unsigned char hk_lfr_he_cnt[2]; | |
548 | unsigned char hk_lfr_last_er_rid[2]; |
|
490 | unsigned char hk_lfr_last_er_rid[2]; | |
549 | unsigned char hk_lfr_last_er_code; |
|
491 | unsigned char hk_lfr_last_er_code; | |
550 | unsigned char hk_lfr_last_er_time[6]; |
|
492 | unsigned char hk_lfr_last_er_time[6]; | |
551 | // vhdl_blk_status |
|
493 | // vhdl_blk_status | |
552 | unsigned char hk_lfr_vhdl_aa_sm; |
|
494 | unsigned char hk_lfr_vhdl_aa_sm; | |
553 | unsigned char hk_lfr_vhdl_fft_sr; |
|
495 | unsigned char hk_lfr_vhdl_fft_sr; | |
554 | unsigned char hk_lfr_vhdl_cic_hk; |
|
496 | unsigned char hk_lfr_vhdl_cic_hk; | |
555 | unsigned char hk_lfr_vhdl_iir_cal; |
|
497 | unsigned char hk_lfr_vhdl_iir_cal; | |
556 | // spacewire_if_statistics |
|
498 | // spacewire_if_statistics | |
557 | unsigned char hk_lfr_dpu_spw_pkt_rcv_cnt[2]; |
|
499 | unsigned char hk_lfr_dpu_spw_pkt_rcv_cnt[2]; | |
558 | unsigned char hk_lfr_dpu_spw_pkt_sent_cnt[2]; |
|
500 | unsigned char hk_lfr_dpu_spw_pkt_sent_cnt[2]; | |
559 | unsigned char hk_lfr_dpu_spw_tick_out_cnt; |
|
501 | unsigned char hk_lfr_dpu_spw_tick_out_cnt; | |
560 | unsigned char hk_lfr_dpu_spw_last_time; |
|
502 | unsigned char hk_lfr_dpu_spw_last_time; | |
561 | // ahb error statistics |
|
503 | // ahb error statistics | |
562 | unsigned int hk_lfr_last_fail_addr; |
|
504 | unsigned int hk_lfr_last_fail_addr; | |
563 | // temperatures |
|
505 | // temperatures | |
564 | unsigned char hk_lfr_temp_scm[2]; |
|
506 | unsigned char hk_lfr_temp_scm[2]; | |
565 | unsigned char hk_lfr_temp_pcb[2]; |
|
507 | unsigned char hk_lfr_temp_pcb[2]; | |
566 | unsigned char hk_lfr_temp_fpga[2]; |
|
508 | unsigned char hk_lfr_temp_fpga[2]; | |
567 | // error counters |
|
509 | // error counters | |
568 | unsigned char hk_lfr_dpu_spw_parity; |
|
510 | unsigned char hk_lfr_dpu_spw_parity; | |
569 | unsigned char hk_lfr_dpu_spw_disconnect; |
|
511 | unsigned char hk_lfr_dpu_spw_disconnect; | |
570 | unsigned char hk_lfr_dpu_spw_escape; |
|
512 | unsigned char hk_lfr_dpu_spw_escape; | |
571 | unsigned char hk_lfr_dpu_spw_credit; |
|
513 | unsigned char hk_lfr_dpu_spw_credit; | |
572 | unsigned char hk_lfr_dpu_spw_write_sync; |
|
514 | unsigned char hk_lfr_dpu_spw_write_sync; | |
573 | unsigned char hk_lfr_dpu_spw_rx_ahb; |
|
515 | unsigned char hk_lfr_dpu_spw_rx_ahb; | |
574 | unsigned char hk_lfr_dpu_spw_tx_ahb; |
|
516 | unsigned char hk_lfr_dpu_spw_tx_ahb; | |
575 | unsigned char hk_lfr_dpu_spw_header_crc; |
|
517 | unsigned char hk_lfr_dpu_spw_header_crc; | |
576 | unsigned char hk_lfr_dpu_spw_data_crc; |
|
518 | unsigned char hk_lfr_dpu_spw_data_crc; | |
577 | unsigned char hk_lfr_dpu_spw_early_eop; |
|
519 | unsigned char hk_lfr_dpu_spw_early_eop; | |
578 | unsigned char hk_lfr_dpu_spw_invalid_addr; |
|
520 | unsigned char hk_lfr_dpu_spw_invalid_addr; | |
579 | unsigned char hk_lfr_dpu_spw_eep; |
|
521 | unsigned char hk_lfr_dpu_spw_eep; | |
580 | unsigned char hk_lfr_dpu_spw_rx_too_big; |
|
522 | unsigned char hk_lfr_dpu_spw_rx_too_big; | |
581 | // timecode |
|
523 | // timecode | |
582 | unsigned char hk_lfr_timecode_erroneous; |
|
524 | unsigned char hk_lfr_timecode_erroneous; | |
583 | unsigned char hk_lfr_timecode_missing; |
|
525 | unsigned char hk_lfr_timecode_missing; | |
584 | unsigned char hk_lfr_timecode_invalid; |
|
526 | unsigned char hk_lfr_timecode_invalid; | |
585 | // time |
|
527 | // time | |
586 | unsigned char hk_lfr_time_timecode_it; |
|
528 | unsigned char hk_lfr_time_timecode_it; | |
587 | unsigned char hk_lfr_time_not_synchro; |
|
529 | unsigned char hk_lfr_time_not_synchro; | |
588 | unsigned char hk_lfr_time_timecode_ctr; |
|
530 | unsigned char hk_lfr_time_timecode_ctr; | |
589 | // hk_lfr_buffer_dpu_ |
|
531 | // hk_lfr_buffer_dpu_ | |
590 | unsigned char hk_lfr_buffer_dpu_tc_fifo; |
|
532 | unsigned char hk_lfr_buffer_dpu_tc_fifo; | |
591 | unsigned char hk_lfr_buffer_dpu_tm_fifo; |
|
533 | unsigned char hk_lfr_buffer_dpu_tm_fifo; | |
592 | // hk_lfr_ahb_ |
|
534 | // hk_lfr_ahb_ | |
593 | unsigned char hk_lfr_ahb_correctable; |
|
535 | unsigned char hk_lfr_ahb_correctable; | |
594 | unsigned char hk_lfr_ahb_uncorrectable; |
|
536 | unsigned char hk_lfr_ahb_uncorrectable; | |
595 | unsigned char hk_lfr_ahb_fails_trans; |
|
537 | unsigned char hk_lfr_ahb_fails_trans; | |
596 | // hk_lfr_adc_ |
|
538 | // hk_lfr_adc_ | |
597 | unsigned char hk_lfr_adc_failure; |
|
539 | unsigned char hk_lfr_adc_failure; | |
598 | unsigned char hk_lfr_adc_timeout; |
|
540 | unsigned char hk_lfr_adc_timeout; | |
599 | unsigned char hk_lfr_toomany_err; |
|
541 | unsigned char hk_lfr_toomany_err; | |
600 | // hk_lfr_cpu_ |
|
542 | // hk_lfr_cpu_ | |
601 | unsigned char hk_lfr_cpu_write_err; |
|
543 | unsigned char hk_lfr_cpu_write_err; | |
602 | unsigned char hk_lfr_cpu_ins_access_err; |
|
544 | unsigned char hk_lfr_cpu_ins_access_err; | |
603 | unsigned char hk_lfr_cpu_illegal_ins; |
|
545 | unsigned char hk_lfr_cpu_illegal_ins; | |
604 | unsigned char hk_lfr_cpu_privilegied_ins; |
|
546 | unsigned char hk_lfr_cpu_privilegied_ins; | |
605 | unsigned char hk_lfr_cpu_register_hw; |
|
547 | unsigned char hk_lfr_cpu_register_hw; | |
606 | unsigned char hk_lfr_cpu_not_aligned; |
|
548 | unsigned char hk_lfr_cpu_not_aligned; | |
607 | unsigned char hk_lfr_cpu_data_exception; |
|
549 | unsigned char hk_lfr_cpu_data_exception; | |
608 | unsigned char hk_lfr_cpu_div_exception; |
|
550 | unsigned char hk_lfr_cpu_div_exception; | |
609 | unsigned char hk_lfr_cpu_arith_overflow; |
|
551 | unsigned char hk_lfr_cpu_arith_overflow; | |
610 | }; |
|
552 | } Packet_TM_LFR_HK_t; | |
611 | typedef struct Packet_TM_LFR_HK_str Packet_TM_LFR_HK_t; |
|
|||
612 |
|
553 | |||
613 | struct Packet_TM_LFR_PARAMETER_DUMP_str |
|
554 | typedef struct { | |
614 | { |
|
|||
615 | unsigned char targetLogicalAddress; |
|
555 | unsigned char targetLogicalAddress; | |
616 | unsigned char protocolIdentifier; |
|
556 | unsigned char protocolIdentifier; | |
617 | unsigned char reserved; |
|
557 | unsigned char reserved; | |
618 | unsigned char userApplication; |
|
558 | unsigned char userApplication; | |
619 | unsigned char packetID[2]; |
|
559 | unsigned char packetID[2]; | |
620 | unsigned char packetSequenceControl[2]; |
|
560 | unsigned char packetSequenceControl[2]; | |
621 | unsigned char packetLength[2]; |
|
561 | unsigned char packetLength[2]; | |
622 | // DATA FIELD HEADER |
|
562 | // DATA FIELD HEADER | |
623 | unsigned char spare1_pusVersion_spare2; |
|
563 | unsigned char spare1_pusVersion_spare2; | |
624 | unsigned char serviceType; |
|
564 | unsigned char serviceType; | |
625 | unsigned char serviceSubType; |
|
565 | unsigned char serviceSubType; | |
626 | unsigned char destinationID; |
|
566 | unsigned char destinationID; | |
627 | unsigned char time[6]; |
|
567 | unsigned char time[6]; | |
628 | unsigned char sid; |
|
568 | unsigned char sid; | |
629 |
|
569 | |||
630 | //****************** |
|
570 | //****************** | |
631 | // COMMON PARAMETERS |
|
571 | // COMMON PARAMETERS | |
632 | unsigned char unused0; |
|
572 | unsigned char unused0; | |
633 | unsigned char bw_sp0_sp1_r0_r1; |
|
573 | unsigned char bw_sp0_sp1_r0_r1; | |
634 |
|
574 | |||
635 | //****************** |
|
575 | //****************** | |
636 | // NORMAL PARAMETERS |
|
576 | // NORMAL PARAMETERS | |
637 | unsigned char sy_lfr_n_swf_l[2]; |
|
577 | unsigned char sy_lfr_n_swf_l[2]; | |
638 | unsigned char sy_lfr_n_swf_p[2]; |
|
578 | unsigned char sy_lfr_n_swf_p[2]; | |
639 | unsigned char sy_lfr_n_asm_p[2]; |
|
579 | unsigned char sy_lfr_n_asm_p[2]; | |
640 | unsigned char sy_lfr_n_bp_p0; |
|
580 | unsigned char sy_lfr_n_bp_p0; | |
641 | unsigned char sy_lfr_n_bp_p1; |
|
581 | unsigned char sy_lfr_n_bp_p1; | |
642 |
|
582 | |||
643 | //***************** |
|
583 | //***************** | |
644 | // BURST PARAMETERS |
|
584 | // BURST PARAMETERS | |
645 | unsigned char sy_lfr_b_bp_p0; |
|
585 | unsigned char sy_lfr_b_bp_p0; | |
646 | unsigned char sy_lfr_b_bp_p1; |
|
586 | unsigned char sy_lfr_b_bp_p1; | |
647 |
|
587 | |||
648 | //**************** |
|
588 | //**************** | |
649 | // SBM1 PARAMETERS |
|
589 | // SBM1 PARAMETERS | |
650 | unsigned char sy_lfr_s1_bp_p0; |
|
590 | unsigned char sy_lfr_s1_bp_p0; | |
651 | unsigned char sy_lfr_s1_bp_p1; |
|
591 | unsigned char sy_lfr_s1_bp_p1; | |
652 |
|
592 | |||
653 | //**************** |
|
593 | //**************** | |
654 | // SBM2 PARAMETERS |
|
594 | // SBM2 PARAMETERS | |
655 | unsigned char sy_lfr_s2_bp_p0; |
|
595 | unsigned char sy_lfr_s2_bp_p0; | |
656 | unsigned char sy_lfr_s2_bp_p1; |
|
596 | unsigned char sy_lfr_s2_bp_p1; | |
657 | }; |
|
597 | } Packet_TM_LFR_PARAMETER_DUMP_t; | |
658 | typedef struct Packet_TM_LFR_PARAMETER_DUMP_str Packet_TM_LFR_PARAMETER_DUMP_t; |
|
|||
659 |
|
598 | |||
660 |
|
599 | |||
661 | #endif // CCSDS_TYPES_H_INCLUDED |
|
600 | #endif // CCSDS_TYPES_H_INCLUDED |
@@ -1,52 +1,35 | |||||
1 | #ifndef FSW_INIT_H_INCLUDED |
|
1 | #ifndef FSW_INIT_H_INCLUDED | |
2 | #define FSW_INIT_H_INCLUDED |
|
2 | #define FSW_INIT_H_INCLUDED | |
3 |
|
3 | |||
4 | #include <rtems.h> |
|
4 | #include <rtems.h> | |
5 | #include <leon.h> |
|
5 | #include <leon.h> | |
6 |
|
6 | |||
7 | #include "fsw_params.h" |
|
7 | #include "fsw_params.h" | |
8 | #include "fsw_misc.h" |
|
8 | #include "fsw_misc.h" | |
9 | #include "fsw_processing.h" |
|
9 | #include "fsw_processing.h" | |
10 | #include "tc_handler.h" |
|
10 | #include "tc_handler.h" | |
11 | #include "wf_handler.h" |
|
11 | #include "wf_handler.h" | |
12 |
|
12 | |||
13 | #include "fsw_spacewire.h" |
|
13 | #include "fsw_spacewire.h" | |
14 |
|
14 | |||
15 | extern rtems_name misc_name[5]; |
|
|||
16 | extern rtems_id misc_id[5]; |
|
|||
17 | extern rtems_name Task_name[20]; /* array of task names */ |
|
|||
18 | extern rtems_id Task_id[20]; /* array of task ids */ |
|
|||
19 | extern unsigned int maxCount; |
|
|||
20 | extern int fdSPW; // grspw file descriptor |
|
|||
21 | extern int fdUART; // uart file descriptor |
|
|||
22 | extern unsigned char lfrCurrentMode; |
|
|||
23 |
|
||||
24 | // MODE PARAMETERS |
|
|||
25 | extern struct param_local_str param_local; |
|
|||
26 | extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet; |
|
|||
27 | extern unsigned short sequenceCounters_SCIENCE_NORMAL_BURST; |
|
|||
28 | extern unsigned short sequenceCounters_SCIENCE_SBM1_SBM2; |
|
|||
29 | extern unsigned short sequenceCounters_TC_EXE[SEQ_CNT_NB_DEST_ID]; |
|
|||
30 |
|
||||
31 | // RTEMS TASKS |
|
15 | // RTEMS TASKS | |
32 | rtems_task Init( rtems_task_argument argument); |
|
16 | rtems_task Init( rtems_task_argument argument); | |
33 |
|
17 | |||
34 | // OTHER functions |
|
18 | // OTHER functions | |
35 | void create_names( void ); |
|
19 | void create_names( void ); | |
36 | int create_all_tasks( void ); |
|
20 | int create_all_tasks( void ); | |
37 | int start_all_tasks( void ); |
|
21 | int start_all_tasks( void ); | |
38 | // |
|
22 | // | |
39 | rtems_status_code create_message_queues( void ); |
|
23 | rtems_status_code create_message_queues( void ); | |
40 | // |
|
24 | // | |
41 | int start_recv_send_tasks( void ); |
|
25 | int start_recv_send_tasks( void ); | |
42 | // |
|
26 | // | |
43 | void init_local_mode_parameters( void ); |
|
27 | void init_local_mode_parameters( void ); | |
44 |
|
28 | |||
45 | extern int rtems_cpu_usage_report( void ); |
|
29 | extern int rtems_cpu_usage_report( void ); | |
46 | extern int rtems_cpu_usage_reset( void ); |
|
30 | extern int rtems_cpu_usage_reset( void ); | |
47 | extern void rtems_stack_checker_report_usage( void ); |
|
31 | extern void rtems_stack_checker_report_usage( void ); | |
48 |
|
32 | |||
49 | extern int sched_yield( void ); |
|
33 | extern int sched_yield( void ); | |
50 | extern int errno; |
|
|||
51 |
|
34 | |||
52 | #endif // FSW_INIT_H_INCLUDED |
|
35 | #endif // FSW_INIT_H_INCLUDED |
@@ -1,39 +1,39 | |||||
1 | #ifndef FSW_MISC_H_INCLUDED |
|
1 | #ifndef FSW_MISC_H_INCLUDED | |
2 | #define FSW_MISC_H_INCLUDED |
|
2 | #define FSW_MISC_H_INCLUDED | |
3 |
|
3 | |||
4 | #include <rtems.h> |
|
4 | #include <rtems.h> | |
5 | #include <stdio.h> |
|
5 | #include <stdio.h> | |
6 | #include <grspw.h> |
|
6 | #include <grspw.h> | |
7 |
|
7 | |||
8 | #include "fsw_params.h" |
|
8 | #include "fsw_params.h" | |
9 | #include "fsw_spacewire.h" |
|
9 | #include "fsw_spacewire.h" | |
10 |
|
10 | |||
11 | rtems_name name_hk_rate_monotonic; // name of the HK rate monotonic |
|
11 | rtems_name name_hk_rate_monotonic; // name of the HK rate monotonic | |
12 | rtems_id HK_id; // id of the HK rate monotonic period |
|
12 | rtems_id HK_id; // id of the HK rate monotonic period | |
13 |
|
13 | |||
14 | extern rtems_name misc_name[5]; |
|
14 | //extern rtems_name misc_name[5]; | |
15 | time_management_regs_t *time_management_regs; |
|
15 | //time_management_regs_t *time_management_regs; | |
16 | extern Packet_TM_LFR_HK_t housekeeping_packet; |
|
16 | //extern Packet_TM_LFR_HK_t housekeeping_packet; | |
17 |
|
17 | |||
18 |
|
|
18 | void configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider, | |
19 | unsigned char interrupt_level, rtems_isr (*timer_isr)() ); |
|
19 | unsigned char interrupt_level, rtems_isr (*timer_isr)() ); | |
20 |
|
|
20 | void timer_start( gptimer_regs_t *gptimer_regs, unsigned char timer ); | |
21 |
|
|
21 | void timer_stop( gptimer_regs_t *gptimer_regs, unsigned char timer ); | |
22 |
|
|
22 | void timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider); | |
23 |
|
23 | |||
24 | // SERIAL LINK |
|
24 | // SERIAL LINK | |
25 | int send_console_outputs_on_apbuart_port( void ); |
|
25 | int send_console_outputs_on_apbuart_port( void ); | |
26 | void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value); |
|
26 | void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value); | |
27 |
|
27 | |||
28 | // RTEMS TASKS |
|
28 | // RTEMS TASKS | |
29 | rtems_task stat_task( rtems_task_argument argument ); |
|
29 | rtems_task stat_task( rtems_task_argument argument ); | |
30 | rtems_task hous_task( rtems_task_argument argument ); |
|
30 | rtems_task hous_task( rtems_task_argument argument ); | |
31 | rtems_task dumb_task( rtems_task_argument unused ); |
|
31 | rtems_task dumb_task( rtems_task_argument unused ); | |
32 |
|
32 | |||
33 | void init_housekeeping_parameters( void ); |
|
33 | void init_housekeeping_parameters( void ); | |
34 |
|
34 | |||
35 | void increment_seq_counter( unsigned char *packet_sequence_control); |
|
35 | void increment_seq_counter( unsigned char *packet_sequence_control); | |
36 |
|
36 | |||
37 | void getTime( unsigned char *time); |
|
37 | void getTime( unsigned char *time); | |
38 |
|
38 | |||
39 | #endif // FSW_MISC_H_INCLUDED |
|
39 | #endif // FSW_MISC_H_INCLUDED |
@@ -1,29 +1,26 | |||||
1 | #ifndef FSW_PARAMS_PROCESSING_H |
|
1 | #ifndef FSW_PARAMS_PROCESSING_H | |
2 | #define FSW_PARAMS_PROCESSING_H |
|
2 | #define FSW_PARAMS_PROCESSING_H | |
3 |
|
3 | |||
4 | #define NB_BINS_PER_SM 128 |
|
4 | #define NB_BINS_PER_SM 128 | |
5 | #define NB_VALUES_PER_SM 25 |
|
5 | #define NB_VALUES_PER_SM 25 | |
6 | //#define TOTAL_SIZE_SM (NB_BINS_PER_SM * NB_VALUES_PER_SM) |
|
|||
7 | //#define SM_HEADER 4 |
|
|||
8 | #define TOTAL_SIZE_SM 0 |
|
6 | #define TOTAL_SIZE_SM 0 | |
9 | #define SM_HEADER 0 |
|
7 | #define SM_HEADER 0 | |
10 |
|
8 | |||
11 | #define NB_BINS_COMPRESSED_SM_F0 11 |
|
9 | #define NB_BINS_COMPRESSED_SM_F0 11 | |
12 | #define NB_BINS_COMPRESSED_SM_F1 13 |
|
10 | #define NB_BINS_COMPRESSED_SM_F1 13 | |
13 | #define NB_BINS_COMPRESSED_SM_F2 12 |
|
11 | #define NB_BINS_COMPRESSED_SM_F2 12 | |
14 | #define TOTAL_SIZE_COMPRESSED_MATRIX_f0 (NB_BINS_COMPRESSED_SM_F0 * NB_VALUES_PER_SM) |
|
12 | #define TOTAL_SIZE_COMPRESSED_MATRIX_f0 (NB_BINS_COMPRESSED_SM_F0 * NB_VALUES_PER_SM) | |
15 | #define NB_AVERAGE_NORMAL_f0 96*4 |
|
13 | #define NB_AVERAGE_NORMAL_f0 96*4 | |
16 | #define NB_SM_TO_RECEIVE_BEFORE_AVF0 8 |
|
14 | #define NB_SM_TO_RECEIVE_BEFORE_AVF0 8 | |
17 |
|
15 | |||
18 | struct BP1_str{ |
|
16 | typedef struct { | |
19 | volatile unsigned char PE[2]; |
|
17 | volatile unsigned char PE[2]; | |
20 | volatile unsigned char PB[2]; |
|
18 | volatile unsigned char PB[2]; | |
21 | volatile unsigned char V0; |
|
19 | volatile unsigned char V0; | |
22 | volatile unsigned char V1; |
|
20 | volatile unsigned char V1; | |
23 | volatile unsigned char V2_ELLIP_DOP; |
|
21 | volatile unsigned char V2_ELLIP_DOP; | |
24 | volatile unsigned char SZ; |
|
22 | volatile unsigned char SZ; | |
25 | volatile unsigned char VPHI; |
|
23 | volatile unsigned char VPHI; | |
26 | }; |
|
24 | } BP1_t; | |
27 | typedef struct BP1_str BP1_t; |
|
|||
28 |
|
25 | |||
29 | #endif // FSW_PARAMS_PROCESSING_H |
|
26 | #endif // FSW_PARAMS_PROCESSING_H |
@@ -1,67 +1,66 | |||||
1 | #ifndef FSW_PROCESSING_H_INCLUDED |
|
1 | #ifndef FSW_PROCESSING_H_INCLUDED | |
2 | #define FSW_PROCESSING_H_INCLUDED |
|
2 | #define FSW_PROCESSING_H_INCLUDED | |
3 |
|
3 | |||
4 | #include <rtems.h> |
|
4 | #include <rtems.h> | |
5 | #include <grspw.h> |
|
5 | #include <grspw.h> | |
6 | #include <math.h> |
|
6 | #include <math.h> | |
7 | #include <stdlib.h> // abs() is in the stdlib |
|
7 | #include <stdlib.h> // abs() is in the stdlib | |
8 | #include <stdio.h> // printf() |
|
8 | #include <stdio.h> // printf() | |
9 | #include <math.h> |
|
9 | #include <math.h> | |
10 |
|
10 | |||
11 | #include "fsw_params.h" |
|
11 | #include "fsw_params.h" | |
12 | #include "fsw_spacewire.h" |
|
12 | #include "fsw_spacewire.h" | |
13 |
|
13 | |||
14 |
|
||||
15 | extern volatile int spec_mat_f0_0[ ]; |
|
14 | extern volatile int spec_mat_f0_0[ ]; | |
16 | extern volatile int spec_mat_f0_1[ ]; |
|
15 | extern volatile int spec_mat_f0_1[ ]; | |
17 | extern volatile int spec_mat_f0_a[ ]; |
|
16 | extern volatile int spec_mat_f0_a[ ]; | |
18 | extern volatile int spec_mat_f0_b[ ]; |
|
17 | extern volatile int spec_mat_f0_b[ ]; | |
19 | extern volatile int spec_mat_f0_c[ ]; |
|
18 | extern volatile int spec_mat_f0_c[ ]; | |
20 | extern volatile int spec_mat_f0_d[ ]; |
|
19 | extern volatile int spec_mat_f0_d[ ]; | |
21 | extern volatile int spec_mat_f0_e[ ]; |
|
20 | extern volatile int spec_mat_f0_e[ ]; | |
22 | extern volatile int spec_mat_f0_f[ ]; |
|
21 | extern volatile int spec_mat_f0_f[ ]; | |
23 | extern volatile int spec_mat_f0_g[ ]; |
|
22 | extern volatile int spec_mat_f0_g[ ]; | |
24 | extern volatile int spec_mat_f0_h[ ]; |
|
23 | extern volatile int spec_mat_f0_h[ ]; | |
25 |
|
24 | |||
26 | extern volatile int spec_mat_f1[ ]; |
|
25 | extern volatile int spec_mat_f1[ ]; | |
27 | extern volatile int spec_mat_f2[ ]; |
|
26 | extern volatile int spec_mat_f2[ ]; | |
28 |
|
27 | |||
29 | extern volatile int spec_mat_f1_bis[ ]; |
|
28 | extern volatile int spec_mat_f1_bis[ ]; | |
30 | extern volatile int spec_mat_f2_bis[ ]; |
|
29 | extern volatile int spec_mat_f2_bis[ ]; | |
31 | extern volatile int spec_mat_f0_0_bis[ ]; |
|
30 | extern volatile int spec_mat_f0_0_bis[ ]; | |
32 | extern volatile int spec_mat_f0_1_bis[ ]; |
|
31 | extern volatile int spec_mat_f0_1_bis[ ]; | |
33 |
|
32 | |||
34 | // parameters |
|
33 | // parameters | |
35 | extern struct param_local_str param_local; |
|
34 | extern struct param_local_str param_local; | |
36 |
|
35 | |||
37 | // registers |
|
36 | // registers | |
38 | extern time_management_regs_t *time_management_regs; |
|
37 | extern time_management_regs_t *time_management_regs; | |
39 | extern spectral_matrix_regs_t *spectral_matrix_regs; |
|
38 | extern spectral_matrix_regs_t *spectral_matrix_regs; | |
40 |
|
39 | |||
41 | extern rtems_name misc_name[5]; |
|
40 | extern rtems_name misc_name[5]; | |
42 | extern rtems_id Task_id[20]; /* array of task ids */ |
|
41 | extern rtems_id Task_id[20]; /* array of task ids */ | |
43 |
|
42 | |||
44 | // ISR |
|
43 | // ISR | |
45 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ); |
|
44 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ); | |
46 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ); |
|
45 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ); | |
47 |
|
46 | |||
48 | // RTEMS TASKS |
|
47 | // RTEMS TASKS | |
49 | rtems_task spw_bppr_task(rtems_task_argument argument); |
|
48 | rtems_task spw_bppr_task(rtems_task_argument argument); | |
50 | rtems_task avf0_task(rtems_task_argument argument); |
|
49 | rtems_task avf0_task(rtems_task_argument argument); | |
51 | rtems_task bpf0_task(rtems_task_argument argument); |
|
50 | rtems_task bpf0_task(rtems_task_argument argument); | |
52 | rtems_task smiq_task(rtems_task_argument argument); // added to test the spectral matrix simulator |
|
51 | rtems_task smiq_task(rtems_task_argument argument); // added to test the spectral matrix simulator | |
53 | rtems_task matr_task(rtems_task_argument argument); |
|
52 | rtems_task matr_task(rtems_task_argument argument); | |
54 |
|
53 | |||
55 | void matrix_compression(volatile float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat); |
|
54 | void matrix_compression(volatile float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat); | |
56 | void matrix_reset(volatile float *averaged_spec_mat); |
|
55 | void matrix_reset(volatile float *averaged_spec_mat); | |
57 | void BP1_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1); |
|
56 | void BP1_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1); | |
58 | void BP2_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat); |
|
57 | void BP2_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat); | |
59 | // |
|
58 | // | |
60 | void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header); |
|
59 | void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header); | |
61 | void send_spectral_matrix(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, |
|
60 | void send_spectral_matrix(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, | |
62 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id); |
|
61 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id); | |
63 | void convert_averaged_spectral_matrix(volatile float *input_matrix, char *output_matrix); |
|
62 | void convert_averaged_spectral_matrix(volatile float *input_matrix, char *output_matrix); | |
64 | void fill_averaged_spectral_matrix( void ); |
|
63 | void fill_averaged_spectral_matrix( void ); | |
65 | void reset_spectral_matrix_regs(); |
|
64 | void reset_spectral_matrix_regs(); | |
66 |
|
65 | |||
67 | #endif // FSW_PROCESSING_H_INCLUDED |
|
66 | #endif // FSW_PROCESSING_H_INCLUDED |
@@ -1,41 +1,39 | |||||
1 | #ifndef FSW_SPACEWIRE_H_INCLUDED |
|
1 | #ifndef FSW_SPACEWIRE_H_INCLUDED | |
2 | #define FSW_SPACEWIRE_H_INCLUDED |
|
2 | #define FSW_SPACEWIRE_H_INCLUDED | |
3 |
|
3 | |||
4 | #include <rtems.h> |
|
4 | #include <rtems.h> | |
5 | #include <grspw.h> |
|
5 | #include <grspw.h> | |
6 |
|
6 | |||
7 | #include <fcntl.h> // for O_RDWR |
|
7 | #include <fcntl.h> // for O_RDWR | |
8 | #include <unistd.h> // for the read call |
|
8 | #include <unistd.h> // for the read call | |
9 | #include <sys/ioctl.h> // for the ioctl call |
|
9 | #include <sys/ioctl.h> // for the ioctl call | |
10 | #include <errno.h> |
|
10 | #include <errno.h> | |
11 |
|
11 | |||
12 | #include "fsw_params.h" |
|
12 | #include "fsw_params.h" | |
13 | #include "tc_handler.h" |
|
13 | #include "tc_handler.h" | |
14 |
|
14 | |||
15 | extern spw_stats spacewire_stats; |
|
15 | extern spw_stats spacewire_stats; | |
16 | extern spw_stats spacewire_stats_backup; |
|
16 | extern spw_stats spacewire_stats_backup; | |
17 | extern Packet_TM_LFR_HK_t housekeeping_packet; |
|
|||
18 | extern rtems_id Task_id[20]; /* array of task ids */ |
|
|||
19 |
|
17 | |||
20 | // RTEMS TASK |
|
18 | // RTEMS TASK | |
21 | rtems_task spiq_task( rtems_task_argument argument ); |
|
19 | rtems_task spiq_task( rtems_task_argument argument ); | |
22 | rtems_task recv_task( rtems_task_argument unused ); |
|
20 | rtems_task recv_task( rtems_task_argument unused ); | |
23 | rtems_task send_task( rtems_task_argument argument ); |
|
21 | rtems_task send_task( rtems_task_argument argument ); | |
24 | rtems_task wtdg_task( rtems_task_argument argument ); |
|
22 | rtems_task wtdg_task( rtems_task_argument argument ); | |
25 |
|
23 | |||
26 | int spacewire_open_link( void ); |
|
24 | int spacewire_open_link( void ); | |
27 | int spacewire_start_link( int fd ); |
|
25 | int spacewire_start_link( int fd ); | |
28 | int spacewire_stop_start_link( int fd ); |
|
26 | int spacewire_stop_start_link( int fd ); | |
29 | int spacewire_configure_link(int fd ); |
|
27 | int spacewire_configure_link(int fd ); | |
30 | int spacewire_reset_link( void ); |
|
28 | int spacewire_reset_link( void ); | |
31 | void spacewire_set_NP( unsigned char val, unsigned int regAddr ); // No Port force |
|
29 | void spacewire_set_NP( unsigned char val, unsigned int regAddr ); // No Port force | |
32 | void spacewire_set_RE( unsigned char val, unsigned int regAddr ); // RMAP Enable |
|
30 | void spacewire_set_RE( unsigned char val, unsigned int regAddr ); // RMAP Enable | |
33 | void spacewire_compute_stats_offsets( void ); |
|
31 | void spacewire_compute_stats_offsets( void ); | |
34 | void spacewire_update_statistics( void ); |
|
32 | void spacewire_update_statistics( void ); | |
35 |
|
33 | |||
36 | void timecode_irq_handler( void *pDev, void *regs, int minor, unsigned int tc ); |
|
34 | void timecode_irq_handler( void *pDev, void *regs, int minor, unsigned int tc ); | |
37 | rtems_timer_service_routine user_routine( rtems_id timer_id, void *user_data ); |
|
35 | rtems_timer_service_routine user_routine( rtems_id timer_id, void *user_data ); | |
38 |
|
36 | |||
39 | void (*grspw_timecode_callback) ( void *pDev, void *regs, int minor, unsigned int tc ); |
|
37 | void (*grspw_timecode_callback) ( void *pDev, void *regs, int minor, unsigned int tc ); | |
40 |
|
38 | |||
41 | #endif // FSW_SPACEWIRE_H_INCLUDED |
|
39 | #endif // FSW_SPACEWIRE_H_INCLUDED |
@@ -1,93 +1,67 | |||||
1 | #ifndef GRLIB_REGS_H_INCLUDED |
|
1 | #ifndef GRLIB_REGS_H_INCLUDED | |
2 | #define GRLIB_REGS_H_INCLUDED |
|
2 | #define GRLIB_REGS_H_INCLUDED | |
3 |
|
3 | |||
4 | #define NB_GPTIMER 3 |
|
4 | #define NB_GPTIMER 3 | |
5 |
|
5 | |||
6 | struct apbuart_regs_str{ |
|
6 | struct apbuart_regs_str{ | |
7 | volatile unsigned int data; |
|
7 | volatile unsigned int data; | |
8 | volatile unsigned int status; |
|
8 | volatile unsigned int status; | |
9 | volatile unsigned int ctrl; |
|
9 | volatile unsigned int ctrl; | |
10 | volatile unsigned int scaler; |
|
10 | volatile unsigned int scaler; | |
11 | volatile unsigned int fifoDebug; |
|
11 | volatile unsigned int fifoDebug; | |
12 | }; |
|
12 | }; | |
13 |
|
13 | |||
14 | struct ahbuart_regs_str{ |
|
14 | struct ahbuart_regs_str{ | |
15 | volatile unsigned int unused; |
|
15 | volatile unsigned int unused; | |
16 | volatile unsigned int status; |
|
16 | volatile unsigned int status; | |
17 | volatile unsigned int ctrl; |
|
17 | volatile unsigned int ctrl; | |
18 | volatile unsigned int scaler; |
|
18 | volatile unsigned int scaler; | |
19 | }; |
|
19 | }; | |
20 |
|
20 | |||
21 | struct timer_regs_str |
|
21 | typedef struct { | |
22 | { |
|
|||
23 | volatile unsigned int counter; |
|
22 | volatile unsigned int counter; | |
24 | volatile unsigned int reload; |
|
23 | volatile unsigned int reload; | |
25 | volatile unsigned int ctrl; |
|
24 | volatile unsigned int ctrl; | |
26 | volatile unsigned int unused; |
|
25 | volatile unsigned int unused; | |
27 | }; |
|
26 | } timer_regs_t; | |
28 | typedef struct timer_regs_str timer_regs_t; |
|
|||
29 |
|
27 | |||
30 | struct gptimer_regs_str |
|
28 | typedef struct { | |
31 | { |
|
|||
32 | volatile unsigned int scaler_value; |
|
29 | volatile unsigned int scaler_value; | |
33 | volatile unsigned int scaler_reload; |
|
30 | volatile unsigned int scaler_reload; | |
34 | volatile unsigned int conf; |
|
31 | volatile unsigned int conf; | |
35 | volatile unsigned int unused0; |
|
32 | volatile unsigned int unused0; | |
36 | timer_regs_t timer[NB_GPTIMER]; |
|
33 | timer_regs_t timer[NB_GPTIMER]; | |
37 | }; |
|
34 | } gptimer_regs_t; | |
38 | typedef struct gptimer_regs_str gptimer_regs_t; |
|
|||
39 |
|
35 | |||
40 | struct time_management_regs_str{ |
|
36 | typedef struct { | |
41 | volatile int ctrl; // bit 0 forces the load of the coarse_time_load value and resets the fine_time |
|
37 | volatile int ctrl; // bit 0 forces the load of the coarse_time_load value and resets the fine_time | |
42 | volatile int coarse_time_load; |
|
38 | volatile int coarse_time_load; | |
43 | volatile int coarse_time; |
|
39 | volatile int coarse_time; | |
44 | volatile int fine_time; |
|
40 | volatile int fine_time; | |
45 | }; |
|
41 | } time_management_regs_t; | |
46 | typedef struct time_management_regs_str time_management_regs_t; |
|
|||
47 |
|
42 | |||
48 | struct waveform_picker_regs_str{ |
|
43 | typedef struct { | |
49 | volatile int data_shaping; // 0x00 00 *** R1 R0 SP1 SP0 BW |
|
44 | volatile int data_shaping; // 0x00 00 *** R1 R0 SP1 SP0 BW | |
50 | volatile int burst_enable; // 0x04 01 *** burst f2, f1, f0 enable f3, f2, f1, f0 |
|
45 | volatile int burst_enable; // 0x04 01 *** burst f2, f1, f0 enable f3, f2, f1, f0 | |
51 | volatile int addr_data_f0; // 0x08 10 *** |
|
46 | volatile int addr_data_f0; // 0x08 10 *** | |
52 | volatile int addr_data_f1; // 0x0c 11 *** |
|
47 | volatile int addr_data_f1; // 0x0c 11 *** | |
53 | volatile int addr_data_f2; // 0x10 100 *** |
|
48 | volatile int addr_data_f2; // 0x10 100 *** | |
54 | volatile int addr_data_f3; // 0x14 101 *** |
|
49 | volatile int addr_data_f3; // 0x14 101 *** | |
55 | volatile int status; // 0x18 110 *** |
|
50 | volatile int status; // 0x18 110 *** | |
56 | volatile int delta_snapshot; // 0x1c 111 *** |
|
51 | volatile int delta_snapshot; // 0x1c 111 *** | |
57 | volatile int delta_f2_f1; // 0x20 0000 *** |
|
52 | volatile int delta_f2_f1; // 0x20 0000 *** | |
58 | volatile int delta_f2_f0; // 0x24 0001 *** |
|
53 | volatile int delta_f2_f0; // 0x24 0001 *** | |
59 | volatile int nb_burst_available;// 0x28 0010 *** |
|
54 | volatile int nb_burst_available;// 0x28 0010 *** | |
60 | volatile int nb_snapshot_param; // 0x2c 0011 *** |
|
55 | volatile int nb_snapshot_param; // 0x2c 0011 *** | |
61 | }; |
|
56 | } waveform_picker_regs_t; | |
62 | typedef struct waveform_picker_regs_str waveform_picker_regs_t; |
|
|||
63 |
|
57 | |||
64 | struct waveform_picker_regs_str_alt{ |
|
58 | typedef struct { | |
65 | volatile int data_shaping; // 0x00 00 *** R1 R0 SP1 SP0 BW |
|
|||
66 | volatile int run_burst_enable; // 0x04 01 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ] |
|
|||
67 | volatile int addr_data_f0; // 0x08 |
|
|||
68 | volatile int addr_data_f1; // 0x0c |
|
|||
69 | volatile int addr_data_f2; // 0x10 |
|
|||
70 | volatile int addr_data_f3; // 0x14 |
|
|||
71 | volatile int status; // 0x18 |
|
|||
72 | volatile int delta_snapshot; // 0x1c |
|
|||
73 | volatile int delta_f0; // 0x20 |
|
|||
74 | volatile int delta_f0_2; |
|
|||
75 | volatile int delta_f1; |
|
|||
76 | volatile int delta_f2; |
|
|||
77 | volatile int nb_data_by_buffer; |
|
|||
78 | volatile int snapshot_param; |
|
|||
79 | volatile int start_date; |
|
|||
80 | }; |
|
|||
81 | typedef struct waveform_picker_regs_str_alt waveform_picker_regs_t_alt; |
|
|||
82 |
|
||||
83 | struct spectral_matrix_regs_str{ |
|
|||
84 | volatile int config; |
|
59 | volatile int config; | |
85 | volatile int status; |
|
60 | volatile int status; | |
86 | volatile int matrixF0_Address0; |
|
61 | volatile int matrixF0_Address0; | |
87 | volatile int matrixFO_Address1; |
|
62 | volatile int matrixFO_Address1; | |
88 | volatile int matrixF1_Address; |
|
63 | volatile int matrixF1_Address; | |
89 | volatile int matrixF2_Address; |
|
64 | volatile int matrixF2_Address; | |
90 | }; |
|
65 | } spectral_matrix_regs_t; | |
91 | typedef struct spectral_matrix_regs_str spectral_matrix_regs_t; |
|
|||
92 |
|
66 | |||
93 | #endif // GRLIB_REGS_H_INCLUDED |
|
67 | #endif // GRLIB_REGS_H_INCLUDED |
@@ -1,63 +1,54 | |||||
1 | #ifndef TC_HANDLER_H_INCLUDED |
|
1 | #ifndef TC_HANDLER_H_INCLUDED | |
2 | #define TC_HANDLER_H_INCLUDED |
|
2 | #define TC_HANDLER_H_INCLUDED | |
3 |
|
3 | |||
4 | #include <rtems.h> |
|
4 | #include <rtems.h> | |
5 | #include <leon.h> |
|
5 | #include <leon.h> | |
6 |
|
6 | |||
7 | #include "tc_load_dump_parameters.h" |
|
7 | #include "tc_load_dump_parameters.h" | |
8 | #include "tc_acceptance.h" |
|
8 | #include "tc_acceptance.h" | |
9 | #include "tm_lfr_tc_exe.h" |
|
9 | #include "tm_lfr_tc_exe.h" | |
10 | #include "wf_handler.h" |
|
10 | #include "wf_handler.h" | |
11 |
|
11 | |||
12 | // MODE PARAMETERS |
|
12 | // MODE PARAMETERS | |
13 | extern struct param_sbm1_str param_sbm1; |
|
|||
14 | extern struct param_sbm2_str param_sbm2; |
|
|||
15 | extern time_management_regs_t *time_management_regs; |
|
|||
16 | extern waveform_picker_regs_t *waveform_picker_regs; |
|
|||
17 | extern gptimer_regs_t *gptimer_regs; |
|
|||
18 | extern rtems_name misc_name[5]; |
|
|||
19 | extern rtems_id Task_id[20]; /* array of task ids */ |
|
|||
20 | extern unsigned char lfrCurrentMode; |
|
|||
21 | extern unsigned int maxCount; |
|
13 | extern unsigned int maxCount; | |
22 |
|
14 | |||
23 |
|
||||
24 | //**** |
|
15 | //**** | |
25 | // ISR |
|
16 | // ISR | |
26 | rtems_isr commutation_isr1( rtems_vector_number vector ); |
|
17 | rtems_isr commutation_isr1( rtems_vector_number vector ); | |
27 | rtems_isr commutation_isr2( rtems_vector_number vector ); |
|
18 | rtems_isr commutation_isr2( rtems_vector_number vector ); | |
28 |
|
19 | |||
29 | //*********** |
|
20 | //*********** | |
30 | // RTEMS TASK |
|
21 | // RTEMS TASK | |
31 | rtems_task actn_task( rtems_task_argument unused ); |
|
22 | rtems_task actn_task( rtems_task_argument unused ); | |
32 |
|
23 | |||
33 | //*********** |
|
24 | //*********** | |
34 | // TC ACTIONS |
|
25 | // TC ACTIONS | |
35 | int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); |
|
26 | int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); | |
36 | int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); |
|
27 | int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); | |
37 | int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); |
|
28 | int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); | |
38 | int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); |
|
29 | int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); | |
39 | int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); |
|
30 | int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); | |
40 | int action_update_time(ccsdsTelecommandPacket_t *TC); |
|
31 | int action_update_time(ccsdsTelecommandPacket_t *TC); | |
41 |
|
32 | |||
42 | // mode transition |
|
33 | // mode transition | |
43 | int transition_validation(unsigned char requestedMode); |
|
34 | int transition_validation(unsigned char requestedMode); | |
44 | int stop_current_mode(); |
|
35 | int stop_current_mode(); | |
45 |
int enter_mode(unsigned char mode |
|
36 | int enter_mode(unsigned char mode); | |
46 | int enter_standby_mode(); |
|
37 | int enter_standby_mode(); | |
47 | int enter_normal_mode(); |
|
38 | int enter_normal_mode(); | |
48 | int enter_burst_mode(); |
|
39 | int enter_burst_mode(); | |
49 | int enter_sbm1_mode(); |
|
40 | int enter_sbm1_mode(); | |
50 | int enter_sbm2_mode(); |
|
41 | int enter_sbm2_mode(); | |
51 | int restart_science_tasks(); |
|
42 | int restart_science_tasks(); | |
52 | int suspend_science_tasks(); |
|
43 | int suspend_science_tasks(); | |
53 |
|
44 | |||
54 | // other functions |
|
45 | // other functions | |
55 | void updateLFRCurrentMode(); |
|
46 | void updateLFRCurrentMode(); | |
56 | void update_last_TC_exe(ccsdsTelecommandPacket_t *TC, unsigned char *time); |
|
47 | void update_last_TC_exe(ccsdsTelecommandPacket_t *TC, unsigned char *time); | |
57 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char *time); |
|
48 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char *time); | |
58 | void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id, unsigned char *time); |
|
49 | void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id, unsigned char *time); | |
59 |
|
50 | |||
60 | #endif // TC_HANDLER_H_INCLUDED |
|
51 | #endif // TC_HANDLER_H_INCLUDED | |
61 |
|
52 | |||
62 |
|
53 | |||
63 |
|
54 |
@@ -1,32 +1,27 | |||||
1 | #ifndef TC_LOAD_DUMP_PARAMETERS_H |
|
1 | #ifndef TC_LOAD_DUMP_PARAMETERS_H | |
2 | #define TC_LOAD_DUMP_PARAMETERS_H |
|
2 | #define TC_LOAD_DUMP_PARAMETERS_H | |
3 |
|
3 | |||
4 | #include <rtems.h> |
|
4 | #include <rtems.h> | |
5 | #include <stdio.h> |
|
5 | #include <stdio.h> | |
6 |
|
6 | |||
7 | #include "fsw_params.h" |
|
7 | #include "fsw_params.h" | |
8 | #include "wf_handler.h" |
|
8 | #include "wf_handler.h" | |
9 | #include "tm_lfr_tc_exe.h" |
|
9 | #include "tm_lfr_tc_exe.h" | |
10 | #include "fsw_misc.h" |
|
10 | #include "fsw_misc.h" | |
11 |
|
11 | |||
12 | extern int fdSPW; |
|
|||
13 | extern unsigned char lfrCurrentMode; |
|
|||
14 | extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet; |
|
|||
15 | extern Packet_TM_LFR_HK_t housekeeping_packet; |
|
|||
16 |
|
||||
17 | int action_load_common_par( ccsdsTelecommandPacket_t *TC ); |
|
12 | int action_load_common_par( ccsdsTelecommandPacket_t *TC ); | |
18 | int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time); |
|
13 | int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time); | |
19 | int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time); |
|
14 | int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time); | |
20 | int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time); |
|
15 | int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time); | |
21 | int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time); |
|
16 | int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time); | |
22 | int action_dump_par(rtems_id queue_id ); |
|
17 | int action_dump_par(rtems_id queue_id ); | |
23 |
|
18 | |||
24 | int set_sy_lfr_n_swf_l(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time); |
|
19 | int set_sy_lfr_n_swf_l(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time); | |
25 | int set_sy_lfr_n_swf_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time ); |
|
20 | int set_sy_lfr_n_swf_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time ); | |
26 | int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); |
|
21 | int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); | |
27 | int set_sy_lfr_n_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); |
|
22 | int set_sy_lfr_n_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); | |
28 | int set_sy_lfr_n_bp_p1( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); |
|
23 | int set_sy_lfr_n_bp_p1( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); | |
29 |
|
24 | |||
30 | void init_parameter_dump( void ); |
|
25 | void init_parameter_dump( void ); | |
31 |
|
26 | |||
32 | #endif // TC_LOAD_DUMP_PARAMETERS_H |
|
27 | #endif // TC_LOAD_DUMP_PARAMETERS_H |
@@ -1,28 +1,26 | |||||
1 | #ifndef TM_LFR_TC_EXE_H_INCLUDED |
|
1 | #ifndef TM_LFR_TC_EXE_H_INCLUDED | |
2 | #define TM_LFR_TC_EXE_H_INCLUDED |
|
2 | #define TM_LFR_TC_EXE_H_INCLUDED | |
3 |
|
3 | |||
4 | #include <rtems.h> |
|
4 | #include <rtems.h> | |
5 | #include <stdio.h> |
|
5 | #include <stdio.h> | |
6 |
|
6 | |||
7 | #include "fsw_params.h" |
|
7 | #include "fsw_params.h" | |
8 | #include "fsw_spacewire.h" |
|
8 | #include "fsw_spacewire.h" | |
9 |
|
9 | |||
10 | extern time_management_regs_t *time_management_regs; |
|
|||
11 | extern Packet_TM_LFR_HK_t housekeeping_packet; |
|
|||
12 | extern unsigned short sequenceCounters_TC_EXE[]; |
|
10 | extern unsigned short sequenceCounters_TC_EXE[]; | |
13 |
|
11 | |||
14 | int send_tm_lfr_tc_exe_success(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); |
|
12 | int send_tm_lfr_tc_exe_success(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); | |
15 | int send_tm_lfr_tc_exe_inconsistent(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, |
|
13 | int send_tm_lfr_tc_exe_inconsistent(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, | |
16 | unsigned char byte_position, unsigned char rcv_value, unsigned char *time); |
|
14 | unsigned char byte_position, unsigned char rcv_value, unsigned char *time); | |
17 | int send_tm_lfr_tc_exe_not_executable(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); |
|
15 | int send_tm_lfr_tc_exe_not_executable(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); | |
18 | int send_tm_lfr_tc_exe_not_implemented(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); |
|
16 | int send_tm_lfr_tc_exe_not_implemented(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); | |
19 | int send_tm_lfr_tc_exe_error(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); |
|
17 | int send_tm_lfr_tc_exe_error(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); | |
20 | int send_tm_lfr_tc_exe_corrupted(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, |
|
18 | int send_tm_lfr_tc_exe_corrupted(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, | |
21 | unsigned char *computed_CRC, unsigned char *currentTC_LEN_RCV, unsigned char destinationID, unsigned char *time); |
|
19 | unsigned char *computed_CRC, unsigned char *currentTC_LEN_RCV, unsigned char destinationID, unsigned char *time); | |
22 |
|
20 | |||
23 | void increment_seq_counter_destination_id( unsigned char *packet_sequence_control, unsigned char destination_id ); |
|
21 | void increment_seq_counter_destination_id( unsigned char *packet_sequence_control, unsigned char destination_id ); | |
24 |
|
22 | |||
25 | #endif // TM_LFR_TC_EXE_H_INCLUDED |
|
23 | #endif // TM_LFR_TC_EXE_H_INCLUDED | |
26 |
|
24 | |||
27 |
|
25 | |||
28 |
|
26 |
@@ -1,88 +1,87 | |||||
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 |
|
12 | |||
13 | #define pi 3.1415 |
|
13 | #define pi 3.1415 | |
14 |
|
14 | |||
15 | extern int fdSPW; |
|
15 | extern int fdSPW; | |
16 | extern volatile int wf_snap_f0[ ]; |
|
16 | extern volatile int wf_snap_f0[ ]; | |
17 | // |
|
17 | // | |
18 | extern volatile int wf_snap_f1[ ]; |
|
18 | extern volatile int wf_snap_f1[ ]; | |
19 | extern volatile int wf_snap_f1_bis[ ]; |
|
19 | extern volatile int wf_snap_f1_bis[ ]; | |
20 | extern volatile int wf_snap_f1_norm[ ]; |
|
20 | extern volatile int wf_snap_f1_norm[ ]; | |
21 | // |
|
21 | // | |
22 | extern volatile int wf_snap_f2[ ]; |
|
22 | extern volatile int wf_snap_f2[ ]; | |
23 | extern volatile int wf_snap_f2_bis[ ]; |
|
23 | extern volatile int wf_snap_f2_bis[ ]; | |
24 | extern volatile int wf_snap_f2_norm[ ]; |
|
24 | extern volatile int wf_snap_f2_norm[ ]; | |
25 | // |
|
25 | // | |
26 | extern volatile int wf_cont_f3[ ]; |
|
26 | extern volatile int wf_cont_f3[ ]; | |
27 | extern volatile int wf_cont_f3_bis[ ]; |
|
27 | extern volatile int wf_cont_f3_bis[ ]; | |
28 | extern char wf_cont_f3_light[ ]; |
|
28 | extern char wf_cont_f3_light[ ]; | |
29 | extern waveform_picker_regs_t *waveform_picker_regs; |
|
29 | extern waveform_picker_regs_t *waveform_picker_regs; | |
30 | extern waveform_picker_regs_t_alt *waveform_picker_regs_alt; |
|
|||
31 | extern time_management_regs_t *time_management_regs; |
|
30 | extern time_management_regs_t *time_management_regs; | |
32 | extern Packet_TM_LFR_HK_t housekeeping_packet; |
|
31 | extern Packet_TM_LFR_HK_t housekeeping_packet; | |
33 | extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet; |
|
32 | extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet; | |
34 | extern struct param_local_str param_local; |
|
33 | extern struct param_local_str param_local; | |
35 |
|
34 | |||
36 | extern unsigned short sequenceCounters_SCIENCE_NORMAL_BURST; |
|
35 | extern unsigned short sequenceCounters_SCIENCE_NORMAL_BURST; | |
37 | extern unsigned short sequenceCounters_SCIENCE_SBM1_SBM2; |
|
36 | extern unsigned short sequenceCounters_SCIENCE_SBM1_SBM2; | |
38 |
|
37 | |||
39 | extern rtems_name misc_name[5]; |
|
38 | extern rtems_name misc_name[5]; | |
40 | extern rtems_name Task_name[20]; /* array of task ids */ |
|
39 | extern rtems_name Task_name[20]; /* array of task ids */ | |
41 | extern rtems_id Task_id[20]; /* array of task ids */ |
|
40 | extern rtems_id Task_id[20]; /* array of task ids */ | |
42 |
|
41 | |||
43 | extern unsigned char lfrCurrentMode; |
|
42 | extern unsigned char lfrCurrentMode; | |
44 |
|
43 | |||
45 | rtems_isr waveforms_isr( rtems_vector_number vector ); |
|
44 | rtems_isr waveforms_isr( rtems_vector_number vector ); | |
46 | rtems_isr waveforms_simulator_isr( rtems_vector_number vector ); |
|
45 | rtems_isr waveforms_simulator_isr( rtems_vector_number vector ); | |
47 | rtems_task wfrm_task( rtems_task_argument argument ); |
|
46 | rtems_task wfrm_task( rtems_task_argument argument ); | |
48 | rtems_task cwf3_task( rtems_task_argument argument ); |
|
47 | rtems_task cwf3_task( rtems_task_argument argument ); | |
49 | rtems_task cwf2_task( rtems_task_argument argument ); |
|
48 | rtems_task cwf2_task( rtems_task_argument argument ); | |
50 | rtems_task cwf1_task( rtems_task_argument argument ); |
|
49 | rtems_task cwf1_task( rtems_task_argument argument ); | |
51 |
|
50 | |||
52 | //****************** |
|
51 | //****************** | |
53 | // general functions |
|
52 | // general functions | |
54 | void init_waveforms( void ); |
|
53 | void init_waveforms( void ); | |
55 | // |
|
54 | // | |
56 | int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF ); |
|
55 | int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF ); | |
57 | int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF ); |
|
56 | int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF ); | |
58 | int init_header_continuous_wf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF ); |
|
57 | int init_header_continuous_wf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF ); | |
59 | // |
|
58 | // | |
60 | void reset_waveforms( void ); |
|
59 | void reset_waveforms( void ); | |
61 | // |
|
60 | // | |
62 | int send_waveform_SWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id ); |
|
61 | 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_CWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id ); |
|
62 | 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_CWF3( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id ); |
|
63 | 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_light( volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id ); |
|
64 | int send_waveform_CWF3_light( volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id ); | |
66 | // |
|
65 | // | |
67 | rtems_id get_pkts_queue_id( void ); |
|
66 | rtems_id get_pkts_queue_id( void ); | |
68 |
|
67 | |||
69 | //************** |
|
68 | //************** | |
70 | // wfp registers |
|
69 | // wfp registers | |
71 | void set_wfp_data_shaping(); |
|
70 | void set_wfp_data_shaping(); | |
72 | char set_wfp_delta_snapshot(); |
|
71 | char set_wfp_delta_snapshot(); | |
73 | void set_wfp_burst_enable_register( unsigned char mode); |
|
72 | void set_wfp_burst_enable_register( unsigned char mode); | |
74 | void reset_wfp_burst_enable(); |
|
73 | void reset_wfp_burst_enable(); | |
75 | void reset_wfp_status(); |
|
74 | void reset_wfp_status(); | |
76 | void reset_waveform_picker_regs(); |
|
75 | void reset_waveform_picker_regs(); | |
77 |
|
76 | |||
78 | //***************** |
|
77 | //***************** | |
79 | // local parameters |
|
78 | // local parameters | |
80 | void set_local_sbm1_nb_cwf_max(); |
|
79 | void set_local_sbm1_nb_cwf_max( void ); | |
81 | void set_local_sbm2_nb_cwf_max(); |
|
80 | void set_local_sbm2_nb_cwf_max( void ); | |
82 | void set_local_nb_interrupt_f0_MAX(); |
|
81 | void set_local_nb_interrupt_f0_MAX( void ); | |
83 | void reset_local_sbm1_nb_cwf_sent(); |
|
82 | void reset_local_sbm1_nb_cwf_sent( void ); | |
84 | void reset_local_sbm2_nb_cwf_sent(); |
|
83 | void reset_local_sbm2_nb_cwf_sent( void ); | |
85 |
|
84 | |||
86 | void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid ); |
|
85 | void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid ); | |
87 |
|
86 | |||
88 | #endif // WF_HANDLER_H_INCLUDED |
|
87 | #endif // WF_HANDLER_H_INCLUDED |
@@ -1,92 +1,91 | |||||
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 |
|
23 | |||
24 | // RTEMS GLOBAL VARIABLES |
|
24 | // RTEMS GLOBAL VARIABLES | |
25 | rtems_name misc_name[5]; |
|
25 | rtems_name misc_name[5]; | |
26 | rtems_id misc_id[5]; |
|
26 | rtems_id misc_id[5]; | |
27 | rtems_name Task_name[20]; /* array of task names */ |
|
27 | rtems_name Task_name[20]; /* array of task names */ | |
28 | rtems_id Task_id[20]; /* array of task ids */ |
|
28 | rtems_id Task_id[20]; /* array of task ids */ | |
29 | unsigned int maxCount; |
|
29 | unsigned int maxCount; | |
30 | int fdSPW = 0; |
|
30 | int fdSPW = 0; | |
31 | int fdUART = 0; |
|
31 | int fdUART = 0; | |
32 | unsigned char lfrCurrentMode; |
|
32 | unsigned char lfrCurrentMode; | |
33 |
|
33 | |||
34 | // APB CONFIGURATION REGISTERS |
|
34 | // APB CONFIGURATION REGISTERS | |
35 | time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT; |
|
35 | time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT; | |
36 | gptimer_regs_t *gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER; |
|
36 | gptimer_regs_t *gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER; | |
37 | #ifdef GSA |
|
37 | #ifdef GSA | |
38 | #else |
|
38 | #else | |
39 | waveform_picker_regs_t *waveform_picker_regs = (waveform_picker_regs_t*) REGS_ADDR_WAVEFORM_PICKER; |
|
39 | waveform_picker_regs_t *waveform_picker_regs = (waveform_picker_regs_t*) REGS_ADDR_WAVEFORM_PICKER; | |
40 | waveform_picker_regs_t_alt *waveform_picker_regs_alt = (waveform_picker_regs_t_alt*) REGS_ADDR_WAVEFORM_PICKER; |
|
|||
41 | #endif |
|
40 | #endif | |
42 | spectral_matrix_regs_t *spectral_matrix_regs = (spectral_matrix_regs_t*) REGS_ADDR_SPECTRAL_MATRIX; |
|
41 | spectral_matrix_regs_t *spectral_matrix_regs = (spectral_matrix_regs_t*) REGS_ADDR_SPECTRAL_MATRIX; | |
43 |
|
42 | |||
44 | // WAVEFORMS GLOBAL VARIABLES // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes |
|
43 | // WAVEFORMS GLOBAL VARIABLES // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes | |
45 | volatile int wf_snap_f0[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; |
|
44 | volatile int wf_snap_f0[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; | |
46 | // |
|
45 | // | |
47 | volatile int wf_snap_f1[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; |
|
46 | volatile int wf_snap_f1[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; | |
48 | volatile int wf_snap_f1_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; |
|
47 | volatile int wf_snap_f1_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; | |
49 | volatile int wf_snap_f1_norm[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; |
|
48 | volatile int wf_snap_f1_norm[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; | |
50 | // |
|
49 | // | |
51 | volatile int wf_snap_f2[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; |
|
50 | volatile int wf_snap_f2[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; | |
52 | volatile int wf_snap_f2_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; |
|
51 | volatile int wf_snap_f2_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; | |
53 | volatile int wf_snap_f2_norm[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; |
|
52 | volatile int wf_snap_f2_norm[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; | |
54 | // |
|
53 | // | |
55 | volatile int wf_cont_f3[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; |
|
54 | volatile int wf_cont_f3[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; | |
56 | volatile int wf_cont_f3_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; |
|
55 | volatile int wf_cont_f3_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; | |
57 | char wf_cont_f3_light[ NB_SAMPLES_PER_SNAPSHOT * NB_BYTES_CWF3_LIGHT_BLK ]; |
|
56 | char wf_cont_f3_light[ NB_SAMPLES_PER_SNAPSHOT * NB_BYTES_CWF3_LIGHT_BLK ]; | |
58 |
|
57 | |||
59 | // SPECTRAL MATRICES GLOBAL VARIABLES |
|
58 | // SPECTRAL MATRICES GLOBAL VARIABLES | |
60 | volatile int spec_mat_f0_0[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
59 | volatile int spec_mat_f0_0[ SM_HEADER + TOTAL_SIZE_SM ]; | |
61 | volatile int spec_mat_f0_1[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
60 | volatile int spec_mat_f0_1[ SM_HEADER + TOTAL_SIZE_SM ]; | |
62 | volatile int spec_mat_f0_a[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
61 | volatile int spec_mat_f0_a[ SM_HEADER + TOTAL_SIZE_SM ]; | |
63 | volatile int spec_mat_f0_b[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
62 | volatile int spec_mat_f0_b[ SM_HEADER + TOTAL_SIZE_SM ]; | |
64 | volatile int spec_mat_f0_c[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
63 | volatile int spec_mat_f0_c[ SM_HEADER + TOTAL_SIZE_SM ]; | |
65 | volatile int spec_mat_f0_d[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
64 | volatile int spec_mat_f0_d[ SM_HEADER + TOTAL_SIZE_SM ]; | |
66 | volatile int spec_mat_f0_e[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
65 | volatile int spec_mat_f0_e[ SM_HEADER + TOTAL_SIZE_SM ]; | |
67 | volatile int spec_mat_f0_f[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
66 | volatile int spec_mat_f0_f[ SM_HEADER + TOTAL_SIZE_SM ]; | |
68 | volatile int spec_mat_f0_g[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
67 | volatile int spec_mat_f0_g[ SM_HEADER + TOTAL_SIZE_SM ]; | |
69 | volatile int spec_mat_f0_h[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
68 | volatile int spec_mat_f0_h[ SM_HEADER + TOTAL_SIZE_SM ]; | |
70 | volatile int spec_mat_f0_0_bis[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
69 | volatile int spec_mat_f0_0_bis[ SM_HEADER + TOTAL_SIZE_SM ]; | |
71 | volatile int spec_mat_f0_1_bis[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
70 | volatile int spec_mat_f0_1_bis[ SM_HEADER + TOTAL_SIZE_SM ]; | |
72 | // |
|
71 | // | |
73 | volatile int spec_mat_f1[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
72 | volatile int spec_mat_f1[ SM_HEADER + TOTAL_SIZE_SM ]; | |
74 | volatile int spec_mat_f1_bis[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
73 | volatile int spec_mat_f1_bis[ SM_HEADER + TOTAL_SIZE_SM ]; | |
75 | // |
|
74 | // | |
76 | volatile int spec_mat_f2[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
75 | volatile int spec_mat_f2[ SM_HEADER + TOTAL_SIZE_SM ]; | |
77 | volatile int spec_mat_f2_bis[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
76 | volatile int spec_mat_f2_bis[ SM_HEADER + TOTAL_SIZE_SM ]; | |
78 |
|
77 | |||
79 | // MODE PARAMETERS |
|
78 | // MODE PARAMETERS | |
80 | Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet; |
|
79 | Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet; | |
81 | struct param_local_str param_local; |
|
80 | struct param_local_str param_local; | |
82 |
|
81 | |||
83 | // HK PACKETS |
|
82 | // HK PACKETS | |
84 | Packet_TM_LFR_HK_t housekeeping_packet; |
|
83 | Packet_TM_LFR_HK_t housekeeping_packet; | |
85 | // sequence counters are incremented by APID (PID + CAT) and destination ID |
|
84 | // sequence counters are incremented by APID (PID + CAT) and destination ID | |
86 | unsigned short sequenceCounters_SCIENCE_NORMAL_BURST; |
|
85 | unsigned short sequenceCounters_SCIENCE_NORMAL_BURST; | |
87 | unsigned short sequenceCounters_SCIENCE_SBM1_SBM2; |
|
86 | unsigned short sequenceCounters_SCIENCE_SBM1_SBM2; | |
88 | unsigned short sequenceCounters_TC_EXE[SEQ_CNT_NB_DEST_ID]; |
|
87 | unsigned short sequenceCounters_TC_EXE[SEQ_CNT_NB_DEST_ID]; | |
89 | spw_stats spacewire_stats; |
|
88 | spw_stats spacewire_stats; | |
90 | spw_stats spacewire_stats_backup; |
|
89 | spw_stats spacewire_stats_backup; | |
91 |
|
90 | |||
92 |
|
91 |
@@ -1,333 +1,336 | |||||
1 | /** General usage functions and RTEMS tasks. |
|
1 | /** General usage functions and RTEMS tasks. | |
2 | * |
|
2 | * | |
3 | * @file |
|
3 | * @file | |
4 | * @author P. LEROY |
|
4 | * @author P. LEROY | |
5 | * |
|
5 | * | |
6 | */ |
|
6 | */ | |
7 |
|
7 | |||
8 | #include "fsw_misc.h" |
|
8 | #include "fsw_misc.h" | |
9 |
|
9 | |||
10 | char *DumbMessages[7] = {"in DUMB *** default", // RTEMS_EVENT_0 |
|
10 | //char *DumbMessages[7] = {"in DUMB *** default", // RTEMS_EVENT_0 | |
11 | "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1 |
|
11 | // "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1 | |
12 | "in DUMB *** waveforms_isr", // RTEMS_EVENT_2 |
|
12 | // "in DUMB *** waveforms_isr", // RTEMS_EVENT_2 | |
13 | "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3 |
|
13 | // "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3 | |
14 | "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4 |
|
14 | // "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4 | |
15 | "in DUMB *** waveforms_simulator_isr", // RTEMS_EVENT_5 |
|
15 | // "in DUMB *** waveforms_simulator_isr", // RTEMS_EVENT_5 | |
16 | "ERR HK" // RTEMS_EVENT_6 |
|
16 | // "ERR HK" // RTEMS_EVENT_6 | |
17 | }; |
|
17 | //}; | |
18 |
|
18 | |||
19 |
|
|
19 | void configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider, | |
20 | unsigned char interrupt_level, rtems_isr (*timer_isr)() ) |
|
20 | unsigned char interrupt_level, rtems_isr (*timer_isr)() ) | |
21 | { |
|
21 | { | |
22 | /** This function configures a GPTIMER timer instantiated in the VHDL design. |
|
22 | /** This function configures a GPTIMER timer instantiated in the VHDL design. | |
23 | * |
|
23 | * | |
24 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. |
|
24 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. | |
25 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). |
|
25 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). | |
26 | * @param clock_divider is the divider of the 1 MHz clock that will be configured. |
|
26 | * @param clock_divider is the divider of the 1 MHz clock that will be configured. | |
27 | * @param interrupt_level is the interrupt level that the timer drives. |
|
27 | * @param interrupt_level is the interrupt level that the timer drives. | |
28 | * @param timer_isr is the interrupt subroutine that will be attached to the IRQ driven by the timer. |
|
28 | * @param timer_isr is the interrupt subroutine that will be attached to the IRQ driven by the timer. | |
29 | * |
|
29 | * | |
30 | * @return |
|
|||
31 | * |
|
|||
32 | * Interrupt levels are described in the SPARC documentation sparcv8.pdf p.76 |
|
30 | * Interrupt levels are described in the SPARC documentation sparcv8.pdf p.76 | |
33 | * |
|
31 | * | |
34 | */ |
|
32 | */ | |
35 |
|
33 | |||
36 | rtems_status_code status; |
|
34 | rtems_status_code status; | |
37 | rtems_isr_entry old_isr_handler; |
|
35 | rtems_isr_entry old_isr_handler; | |
38 |
|
36 | |||
39 | status = rtems_interrupt_catch( timer_isr, interrupt_level, &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels |
|
37 | status = rtems_interrupt_catch( timer_isr, interrupt_level, &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels | |
40 | if (status!=RTEMS_SUCCESSFUL) |
|
38 | if (status!=RTEMS_SUCCESSFUL) | |
41 | { |
|
39 | { | |
42 | PRINTF("in configure_timer *** ERR rtems_interrupt_catch\n") |
|
40 | PRINTF("in configure_timer *** ERR rtems_interrupt_catch\n") | |
43 | } |
|
41 | } | |
44 |
|
42 | |||
45 | timer_set_clock_divider( gptimer_regs, timer, clock_divider); |
|
43 | timer_set_clock_divider( gptimer_regs, timer, clock_divider); | |
46 |
|
||||
47 | return 1; |
|
|||
48 | } |
|
44 | } | |
49 |
|
45 | |||
50 |
|
|
46 | void timer_start(gptimer_regs_t *gptimer_regs, unsigned char timer) | |
51 | { |
|
47 | { | |
52 | /** This function starts a GPTIMER timer. |
|
48 | /** This function starts a GPTIMER timer. | |
53 | * |
|
49 | * | |
54 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. |
|
50 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. | |
55 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). |
|
51 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). | |
56 | * |
|
52 | * | |
57 | * @return 1 |
|
|||
58 | * |
|
|||
59 | */ |
|
53 | */ | |
60 |
|
54 | |||
61 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any |
|
55 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any | |
62 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000004; // LD load value from the reload register |
|
56 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000004; // LD load value from the reload register | |
63 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000001; // EN enable the timer |
|
57 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000001; // EN enable the timer | |
64 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000002; // RS restart |
|
58 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000002; // RS restart | |
65 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000008; // IE interrupt enable |
|
59 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000008; // IE interrupt enable | |
66 |
|
||||
67 | return 1; |
|
|||
68 | } |
|
60 | } | |
69 |
|
61 | |||
70 |
|
|
62 | void timer_stop(gptimer_regs_t *gptimer_regs, unsigned char timer) | |
71 | { |
|
63 | { | |
72 | /** This function stops a GPTIMER timer. |
|
64 | /** This function stops a GPTIMER timer. | |
73 | * |
|
65 | * | |
74 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. |
|
66 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. | |
75 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). |
|
67 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). | |
76 | * |
|
68 | * | |
77 | * @return 1 |
|
|||
78 | * |
|
|||
79 | */ |
|
69 | */ | |
80 |
|
70 | |||
81 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xfffffffe; // EN enable the timer |
|
71 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xfffffffe; // EN enable the timer | |
82 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xffffffef; // IE interrupt enable |
|
72 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xffffffef; // IE interrupt enable | |
83 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any |
|
73 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any | |
84 |
|
||||
85 | return 1; |
|
|||
86 | } |
|
74 | } | |
87 |
|
75 | |||
88 |
|
|
76 | void timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider) | |
89 | { |
|
77 | { | |
90 | /** This function sets the clock divider of a GPTIMER timer. |
|
78 | /** This function sets the clock divider of a GPTIMER timer. | |
91 | * |
|
79 | * | |
92 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. |
|
80 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. | |
93 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). |
|
81 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). | |
94 | * @param clock_divider is the divider of the 1 MHz clock that will be configured. |
|
82 | * @param clock_divider is the divider of the 1 MHz clock that will be configured. | |
95 | * |
|
83 | * | |
96 | * @return 1 |
|
|||
97 | * |
|
|||
98 | */ |
|
84 | */ | |
99 |
|
85 | |||
100 | gptimer_regs->timer[timer].reload = clock_divider; // base clock frequency is 1 MHz |
|
86 | gptimer_regs->timer[timer].reload = clock_divider; // base clock frequency is 1 MHz | |
101 |
|
||||
102 | return 1; |
|
|||
103 | } |
|
87 | } | |
104 |
|
88 | |||
105 | int send_console_outputs_on_apbuart_port( void ) // Send the console outputs on the apbuart port |
|
89 | int send_console_outputs_on_apbuart_port( void ) // Send the console outputs on the apbuart port | |
106 | { |
|
90 | { | |
107 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART; |
|
91 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART; | |
108 |
|
92 | |||
109 | apbuart_regs->ctrl = apbuart_regs->ctrl & APBUART_CTRL_REG_MASK_DB; |
|
93 | apbuart_regs->ctrl = apbuart_regs->ctrl & APBUART_CTRL_REG_MASK_DB; | |
110 | PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n") |
|
94 | PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n") | |
111 |
|
95 | |||
112 | return 0; |
|
96 | return 0; | |
113 | } |
|
97 | } | |
114 |
|
98 | |||
115 | void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value) |
|
99 | void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value) | |
116 | { |
|
100 | { | |
117 | /** This function sets the scaler reload register of the apbuart module |
|
101 | /** This function sets the scaler reload register of the apbuart module | |
118 | * |
|
102 | * | |
119 | * @param regs is the address of the apbuart registers in memory |
|
103 | * @param regs is the address of the apbuart registers in memory | |
120 | * @param value is the value that will be stored in the scaler register |
|
104 | * @param value is the value that will be stored in the scaler register | |
121 | * |
|
105 | * | |
122 | * The value shall be set by the software to get data on the serial interface. |
|
106 | * The value shall be set by the software to get data on the serial interface. | |
123 | * |
|
107 | * | |
124 | */ |
|
108 | */ | |
125 |
|
109 | |||
126 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) regs; |
|
110 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) regs; | |
127 |
|
111 | |||
128 | apbuart_regs->scaler = value; |
|
112 | apbuart_regs->scaler = value; | |
129 | BOOT_PRINTF1("OK *** apbuart port scaler reload register set to 0x%x\n", value) |
|
113 | BOOT_PRINTF1("OK *** apbuart port scaler reload register set to 0x%x\n", value) | |
130 | } |
|
114 | } | |
131 |
|
115 | |||
132 | //************ |
|
116 | //************ | |
133 | // RTEMS TASKS |
|
117 | // RTEMS TASKS | |
134 |
|
118 | |||
135 | rtems_task stat_task(rtems_task_argument argument) |
|
119 | rtems_task stat_task(rtems_task_argument argument) | |
136 | { |
|
120 | { | |
137 | int i; |
|
121 | int i; | |
138 | int j; |
|
122 | int j; | |
139 | i = 0; |
|
123 | i = 0; | |
140 | j = 0; |
|
124 | j = 0; | |
141 | BOOT_PRINTF("in STAT *** \n") |
|
125 | BOOT_PRINTF("in STAT *** \n") | |
142 | while(1){ |
|
126 | while(1){ | |
143 | rtems_task_wake_after(1000); |
|
127 | rtems_task_wake_after(1000); | |
144 | PRINTF1("%d\n", j) |
|
128 | PRINTF1("%d\n", j) | |
145 | if (i == CPU_USAGE_REPORT_PERIOD) { |
|
129 | if (i == CPU_USAGE_REPORT_PERIOD) { | |
146 | // #ifdef PRINT_TASK_STATISTICS |
|
130 | // #ifdef PRINT_TASK_STATISTICS | |
147 | // rtems_cpu_usage_report(); |
|
131 | // rtems_cpu_usage_report(); | |
148 | // rtems_cpu_usage_reset(); |
|
132 | // rtems_cpu_usage_reset(); | |
149 | // #endif |
|
133 | // #endif | |
150 | i = 0; |
|
134 | i = 0; | |
151 | } |
|
135 | } | |
152 | else i++; |
|
136 | else i++; | |
153 | j++; |
|
137 | j++; | |
154 | } |
|
138 | } | |
155 | } |
|
139 | } | |
156 |
|
140 | |||
157 | rtems_task hous_task(rtems_task_argument argument) |
|
141 | rtems_task hous_task(rtems_task_argument argument) | |
158 | { |
|
142 | { | |
159 | rtems_status_code status; |
|
143 | rtems_status_code status; | |
160 | rtems_id queue_id; |
|
144 | rtems_id queue_id; | |
161 |
|
145 | |||
162 | status = rtems_message_queue_ident( misc_name[QUEUE_SEND], 0, &queue_id ); |
|
146 | status = rtems_message_queue_ident( misc_name[QUEUE_SEND], 0, &queue_id ); | |
163 | if (status != RTEMS_SUCCESSFUL) |
|
147 | if (status != RTEMS_SUCCESSFUL) | |
164 | { |
|
148 | { | |
165 | PRINTF1("in HOUS *** ERR %d\n", status) |
|
149 | PRINTF1("in HOUS *** ERR %d\n", status) | |
166 | } |
|
150 | } | |
167 |
|
151 | |||
168 | BOOT_PRINTF("in HOUS ***\n") |
|
152 | BOOT_PRINTF("in HOUS ***\n") | |
169 |
|
153 | |||
170 | if (rtems_rate_monotonic_ident( name_hk_rate_monotonic, &HK_id) != RTEMS_SUCCESSFUL) { |
|
154 | if (rtems_rate_monotonic_ident( name_hk_rate_monotonic, &HK_id) != RTEMS_SUCCESSFUL) { | |
171 | status = rtems_rate_monotonic_create( name_hk_rate_monotonic, &HK_id ); |
|
155 | status = rtems_rate_monotonic_create( name_hk_rate_monotonic, &HK_id ); | |
172 | if( status != RTEMS_SUCCESSFUL ) { |
|
156 | if( status != RTEMS_SUCCESSFUL ) { | |
173 | PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status ) |
|
157 | PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status ) | |
174 | } |
|
158 | } | |
175 | } |
|
159 | } | |
176 |
|
160 | |||
177 | housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
161 | housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; | |
178 | housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
162 | housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
179 | housekeeping_packet.reserved = DEFAULT_RESERVED; |
|
163 | housekeeping_packet.reserved = DEFAULT_RESERVED; | |
180 | housekeeping_packet.userApplication = CCSDS_USER_APP; |
|
164 | housekeeping_packet.userApplication = CCSDS_USER_APP; | |
181 | housekeeping_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_HK >> 8); |
|
165 | housekeeping_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_HK >> 8); | |
182 | housekeeping_packet.packetID[1] = (unsigned char) (TM_PACKET_ID_HK); |
|
166 | housekeeping_packet.packetID[1] = (unsigned char) (TM_PACKET_ID_HK); | |
183 | housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
167 | housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
184 | housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
168 | housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
185 | housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8); |
|
169 | housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8); | |
186 | housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK ); |
|
170 | housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK ); | |
187 | housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
171 | housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
188 | housekeeping_packet.serviceType = TM_TYPE_HK; |
|
172 | housekeeping_packet.serviceType = TM_TYPE_HK; | |
189 | housekeeping_packet.serviceSubType = TM_SUBTYPE_HK; |
|
173 | housekeeping_packet.serviceSubType = TM_SUBTYPE_HK; | |
190 | housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND; |
|
174 | housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND; | |
191 |
|
175 | |||
192 | status = rtems_rate_monotonic_cancel(HK_id); |
|
176 | status = rtems_rate_monotonic_cancel(HK_id); | |
193 | if( status != RTEMS_SUCCESSFUL ) { |
|
177 | if( status != RTEMS_SUCCESSFUL ) { | |
194 | PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status ) |
|
178 | PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status ) | |
195 | } |
|
179 | } | |
196 | else { |
|
180 | else { | |
197 | DEBUG_PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n") |
|
181 | DEBUG_PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n") | |
198 | } |
|
182 | } | |
199 |
|
183 | |||
200 | while(1){ // launch the rate monotonic task |
|
184 | while(1){ // launch the rate monotonic task | |
201 | status = rtems_rate_monotonic_period( HK_id, HK_PERIOD ); |
|
185 | status = rtems_rate_monotonic_period( HK_id, HK_PERIOD ); | |
202 | if ( status != RTEMS_SUCCESSFUL ) { |
|
186 | if ( status != RTEMS_SUCCESSFUL ) { | |
203 | PRINTF1( "in HOUS *** ERR period: %d\n", status); |
|
187 | PRINTF1( "in HOUS *** ERR period: %d\n", status); | |
204 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_6 ); |
|
188 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_6 ); | |
205 | } |
|
189 | } | |
206 | else { |
|
190 | else { | |
207 | increment_seq_counter( housekeeping_packet.packetSequenceControl ); |
|
191 | increment_seq_counter( housekeeping_packet.packetSequenceControl ); | |
208 | housekeeping_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
192 | housekeeping_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
209 | housekeeping_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
193 | housekeeping_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
210 | housekeeping_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
194 | housekeeping_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
211 | housekeeping_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
195 | housekeeping_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); | |
212 | housekeeping_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
196 | housekeeping_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
213 | housekeeping_packet.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
197 | housekeeping_packet.time[5] = (unsigned char) (time_management_regs->fine_time); | |
214 | housekeeping_packet.sid = SID_HK; |
|
198 | housekeeping_packet.sid = SID_HK; | |
215 |
|
199 | |||
216 | spacewire_update_statistics(); |
|
200 | spacewire_update_statistics(); | |
217 |
|
201 | |||
218 | // SEND PACKET |
|
202 | // SEND PACKET | |
219 | status = rtems_message_queue_send( queue_id, &housekeeping_packet, |
|
203 | status = rtems_message_queue_send( queue_id, &housekeeping_packet, | |
220 | PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES); |
|
204 | PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES); | |
221 | if (status != RTEMS_SUCCESSFUL) { |
|
205 | if (status != RTEMS_SUCCESSFUL) { | |
222 | PRINTF1("in HOUS *** ERR send: %d\n", status) |
|
206 | PRINTF1("in HOUS *** ERR send: %d\n", status) | |
223 | } |
|
207 | } | |
224 | } |
|
208 | } | |
225 | } |
|
209 | } | |
226 |
|
210 | |||
227 | PRINTF("in HOUS *** deleting task\n") |
|
211 | PRINTF("in HOUS *** deleting task\n") | |
228 |
|
212 | |||
229 | status = rtems_task_delete( RTEMS_SELF ); // should not return |
|
213 | status = rtems_task_delete( RTEMS_SELF ); // should not return | |
230 | printf( "rtems_task_delete returned with status of %d.\n", status ); |
|
214 | printf( "rtems_task_delete returned with status of %d.\n", status ); | |
231 | return; |
|
215 | return; | |
232 | } |
|
216 | } | |
233 |
|
217 | |||
234 | rtems_task dumb_task( rtems_task_argument unused ) |
|
218 | rtems_task dumb_task( rtems_task_argument unused ) | |
235 | { |
|
219 | { | |
236 | /** This RTEMS taks is used to print messages without affecting the general behaviour of the software. |
|
220 | /** This RTEMS taks is used to print messages without affecting the general behaviour of the software. | |
237 | * |
|
221 | * | |
238 | * @param unused is the starting argument of the RTEMS task |
|
222 | * @param unused is the starting argument of the RTEMS task | |
239 | * |
|
223 | * | |
240 | * The DUMB taks waits for RTEMS events and print messages depending on the incoming events. |
|
224 | * The DUMB taks waits for RTEMS events and print messages depending on the incoming events. | |
241 | * |
|
225 | * | |
242 | */ |
|
226 | */ | |
243 |
|
227 | |||
244 | unsigned int i; |
|
228 | unsigned int i; | |
245 | unsigned int intEventOut; |
|
229 | unsigned int intEventOut; | |
246 | unsigned int coarse_time = 0; |
|
230 | unsigned int coarse_time = 0; | |
247 | unsigned int fine_time = 0; |
|
231 | unsigned int fine_time = 0; | |
248 | rtems_event_set event_out; |
|
232 | rtems_event_set event_out; | |
249 |
|
233 | |||
|
234 | char *DumbMessages[7] = {"in DUMB *** default", // RTEMS_EVENT_0 | |||
|
235 | "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1 | |||
|
236 | "in DUMB *** waveforms_isr", // RTEMS_EVENT_2 | |||
|
237 | "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3 | |||
|
238 | "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4 | |||
|
239 | "in DUMB *** waveforms_simulator_isr", // RTEMS_EVENT_5 | |||
|
240 | "ERR HK" // RTEMS_EVENT_6 | |||
|
241 | }; | |||
|
242 | ||||
250 | BOOT_PRINTF("in DUMB *** \n") |
|
243 | BOOT_PRINTF("in DUMB *** \n") | |
251 |
|
244 | |||
252 | while(1){ |
|
245 | while(1){ | |
253 | rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3 |
|
246 | rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3 | |
254 | | RTEMS_EVENT_4 | RTEMS_EVENT_5 | RTEMS_EVENT_6, |
|
247 | | RTEMS_EVENT_4 | RTEMS_EVENT_5 | RTEMS_EVENT_6, | |
255 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT |
|
248 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT | |
256 | intEventOut = (unsigned int) event_out; |
|
249 | intEventOut = (unsigned int) event_out; | |
257 | for ( i=0; i<32; i++) |
|
250 | for ( i=0; i<32; i++) | |
258 | { |
|
251 | { | |
259 | if ( ((intEventOut >> i) & 0x0001) != 0) |
|
252 | if ( ((intEventOut >> i) & 0x0001) != 0) | |
260 | { |
|
253 | { | |
261 | coarse_time = time_management_regs->coarse_time; |
|
254 | coarse_time = time_management_regs->coarse_time; | |
262 | fine_time = time_management_regs->fine_time; |
|
255 | fine_time = time_management_regs->fine_time; | |
263 | printf("in DUMB *** coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]); |
|
256 | printf("in DUMB *** coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]); | |
264 | } |
|
257 | } | |
265 | } |
|
258 | } | |
266 | } |
|
259 | } | |
267 | } |
|
260 | } | |
268 |
|
261 | |||
269 | //***************************** |
|
262 | //***************************** | |
270 | // init housekeeping parameters |
|
263 | // init housekeeping parameters | |
271 |
|
264 | |||
272 | void init_housekeeping_parameters( void ) |
|
265 | void init_housekeeping_parameters( void ) | |
273 | { |
|
266 | { | |
274 | /** This function initialize the housekeeping_packet global variable with default values. |
|
267 | /** This function initialize the housekeeping_packet global variable with default values. | |
275 | * |
|
268 | * | |
276 | */ |
|
269 | */ | |
277 |
|
270 | |||
278 | unsigned int i = 0; |
|
271 | unsigned int i = 0; | |
279 | char *parameters; |
|
272 | char *parameters; | |
280 |
|
273 | |||
281 | parameters = (char*) &housekeeping_packet.lfr_status_word; |
|
274 | parameters = (char*) &housekeeping_packet.lfr_status_word; | |
282 | for(i = 0; i< SIZE_HK_PARAMETERS; i++) |
|
275 | for(i = 0; i< SIZE_HK_PARAMETERS; i++) | |
283 | { |
|
276 | { | |
284 | parameters[i] = 0x00; |
|
277 | parameters[i] = 0x00; | |
285 | } |
|
278 | } | |
286 | // init status word |
|
279 | // init status word | |
287 | housekeeping_packet.lfr_status_word[0] = DEFAULT_STATUS_WORD_BYTE0; |
|
280 | housekeeping_packet.lfr_status_word[0] = DEFAULT_STATUS_WORD_BYTE0; | |
288 | housekeeping_packet.lfr_status_word[1] = DEFAULT_STATUS_WORD_BYTE1; |
|
281 | housekeeping_packet.lfr_status_word[1] = DEFAULT_STATUS_WORD_BYTE1; | |
289 | // init software version |
|
282 | // init software version | |
290 | housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1; |
|
283 | housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1; | |
291 | housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2; |
|
284 | housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2; | |
292 | housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3; |
|
285 | housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3; | |
293 | housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4; |
|
286 | housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4; | |
294 |
|
287 | |||
295 | } |
|
288 | } | |
296 |
|
289 | |||
297 | void increment_seq_counter( unsigned char *packet_sequence_control) |
|
290 | void increment_seq_counter( unsigned char *packet_sequence_control) | |
298 | { |
|
291 | { | |
|
292 | /** This function increment the sequence counter psased in argument. | |||
|
293 | * | |||
|
294 | * The increment does not affect the grouping flag. In case of an overflow, the counter is reset to 0. | |||
|
295 | * | |||
|
296 | */ | |||
|
297 | ||||
299 | unsigned short sequence_cnt; |
|
298 | unsigned short sequence_cnt; | |
300 | unsigned short segmentation_grouping_flag; |
|
299 | unsigned short segmentation_grouping_flag; | |
301 | unsigned short new_packet_sequence_control; |
|
300 | unsigned short new_packet_sequence_control; | |
302 |
|
301 | |||
303 | segmentation_grouping_flag = (unsigned short) ( (packet_sequence_control[0] & 0xc0) << 8 ); // keep bits 7 downto 6 |
|
302 | segmentation_grouping_flag = (unsigned short) ( (packet_sequence_control[0] & 0xc0) << 8 ); // keep bits 7 downto 6 | |
304 | sequence_cnt = (unsigned short) ( |
|
303 | sequence_cnt = (unsigned short) ( | |
305 | ( (packet_sequence_control[0] & 0x3f) << 8 ) // keep bits 5 downto 0 |
|
304 | ( (packet_sequence_control[0] & 0x3f) << 8 ) // keep bits 5 downto 0 | |
306 | + packet_sequence_control[1] |
|
305 | + packet_sequence_control[1] | |
307 | ); |
|
306 | ); | |
308 |
|
307 | |||
309 | if ( sequence_cnt < SEQ_CNT_MAX) |
|
308 | if ( sequence_cnt < SEQ_CNT_MAX) | |
310 | { |
|
309 | { | |
311 | sequence_cnt = sequence_cnt + 1; |
|
310 | sequence_cnt = sequence_cnt + 1; | |
312 | } |
|
311 | } | |
313 | else |
|
312 | else | |
314 | { |
|
313 | { | |
315 | sequence_cnt = 0; |
|
314 | sequence_cnt = 0; | |
316 | } |
|
315 | } | |
317 |
|
316 | |||
318 | new_packet_sequence_control = segmentation_grouping_flag | sequence_cnt ; |
|
317 | new_packet_sequence_control = segmentation_grouping_flag | sequence_cnt ; | |
319 |
|
318 | |||
320 | packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8); |
|
319 | packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8); | |
321 | packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control ); |
|
320 | packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control ); | |
322 | } |
|
321 | } | |
323 |
|
322 | |||
324 | void getTime( unsigned char *time) |
|
323 | void getTime( unsigned char *time) | |
325 | { |
|
324 | { | |
|
325 | /** This function write the current local time in the time buffer passed in argument. | |||
|
326 | * | |||
|
327 | */ | |||
|
328 | ||||
326 | time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
329 | time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
327 | time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
330 | time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
328 | time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
331 | time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
329 | time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
332 | time[3] = (unsigned char) (time_management_regs->coarse_time); | |
330 | time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
333 | time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
331 | time[5] = (unsigned char) (time_management_regs->fine_time); |
|
334 | time[5] = (unsigned char) (time_management_regs->fine_time); | |
332 | } |
|
335 | } | |
333 |
|
336 |
@@ -1,677 +1,656 | |||||
1 | /** Functions related to data processing. |
|
1 | /** Functions related to data processing. | |
2 | * |
|
2 | * | |
3 | * @file |
|
3 | * @file | |
4 | * @author P. LEROY |
|
4 | * @author P. LEROY | |
5 | * |
|
5 | * | |
6 | * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation. |
|
6 | * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation. | |
7 | * |
|
7 | * | |
8 | */ |
|
8 | */ | |
9 |
|
9 | |||
10 | #include <fsw_processing.h> |
|
10 | #include <fsw_processing.h> | |
11 |
|
11 | |||
12 | #include "fsw_processing_globals.c" |
|
12 | #include "fsw_processing_globals.c" | |
13 |
|
13 | |||
14 | unsigned char LFR_BP1_F0[ NB_BINS_COMPRESSED_SM_F0 * 9 ]; |
|
|||
15 | BP1_t data_BP1[ NB_BINS_COMPRESSED_SM_F0 ]; |
|
14 | BP1_t data_BP1[ NB_BINS_COMPRESSED_SM_F0 ]; | |
16 | float averaged_spec_mat_f0[ TOTAL_SIZE_SM ]; |
|
15 | float averaged_spec_mat_f0[ TOTAL_SIZE_SM ]; | |
17 | char averaged_spec_mat_f0_char[ TOTAL_SIZE_SM * 2 ]; |
|
16 | char averaged_spec_mat_f0_char[ TOTAL_SIZE_SM * 2 ]; | |
18 | float compressed_spec_mat_f0[ TOTAL_SIZE_COMPRESSED_MATRIX_f0 ]; |
|
17 | float compressed_spec_mat_f0[ TOTAL_SIZE_COMPRESSED_MATRIX_f0 ]; | |
19 |
|
18 | |||
20 | //*********************************************************** |
|
19 | //*********************************************************** | |
21 | // Interrupt Service Routine for spectral matrices processing |
|
20 | // Interrupt Service Routine for spectral matrices processing | |
22 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ) |
|
21 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ) | |
23 | { |
|
22 | { | |
24 | unsigned char status; |
|
23 | unsigned char status; | |
25 | unsigned char i; |
|
24 | unsigned char i; | |
26 |
|
25 | |||
27 | status = spectral_matrix_regs->status; //[f2 f1 f0_1 f0_0] |
|
26 | status = spectral_matrix_regs->status; //[f2 f1 f0_1 f0_0] | |
28 | for (i=0; i<4; i++) |
|
27 | for (i=0; i<4; i++) | |
29 | { |
|
28 | { | |
30 | if ( ( (status >> i) & 0x01) == 1) // (1) buffer rotation |
|
29 | if ( ( (status >> i) & 0x01) == 1) // (1) buffer rotation | |
31 | { |
|
30 | { | |
32 | switch(i) |
|
31 | switch(i) | |
33 | { |
|
32 | { | |
34 | case 0: |
|
33 | case 0: | |
35 | if (spectral_matrix_regs->matrixF0_Address0 == (int) spec_mat_f0_0) |
|
34 | if (spectral_matrix_regs->matrixF0_Address0 == (int) spec_mat_f0_0) | |
36 | { |
|
35 | { | |
37 | spectral_matrix_regs->matrixF0_Address0 = (int) spec_mat_f0_0_bis; |
|
36 | spectral_matrix_regs->matrixF0_Address0 = (int) spec_mat_f0_0_bis; | |
38 | } |
|
37 | } | |
39 | else |
|
38 | else | |
40 | { |
|
39 | { | |
41 | spectral_matrix_regs->matrixF0_Address0 = (int) spec_mat_f0_0; |
|
40 | spectral_matrix_regs->matrixF0_Address0 = (int) spec_mat_f0_0; | |
42 | } |
|
41 | } | |
43 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe; |
|
42 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe; | |
44 | break; |
|
43 | break; | |
45 | case 1: |
|
44 | case 1: | |
46 | if (spectral_matrix_regs->matrixFO_Address1 == (int) spec_mat_f0_1) |
|
45 | if (spectral_matrix_regs->matrixFO_Address1 == (int) spec_mat_f0_1) | |
47 | { |
|
46 | { | |
48 | spectral_matrix_regs->matrixFO_Address1 = (int) spec_mat_f0_1_bis; |
|
47 | spectral_matrix_regs->matrixFO_Address1 = (int) spec_mat_f0_1_bis; | |
49 | } |
|
48 | } | |
50 | else |
|
49 | else | |
51 | { |
|
50 | { | |
52 | spectral_matrix_regs->matrixFO_Address1 = (int) spec_mat_f0_1; |
|
51 | spectral_matrix_regs->matrixFO_Address1 = (int) spec_mat_f0_1; | |
53 | } |
|
52 | } | |
54 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd; |
|
53 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd; | |
55 | break; |
|
54 | break; | |
56 | case 2: |
|
55 | case 2: | |
57 | if (spectral_matrix_regs->matrixF1_Address == (int) spec_mat_f1) |
|
56 | if (spectral_matrix_regs->matrixF1_Address == (int) spec_mat_f1) | |
58 | { |
|
57 | { | |
59 | spectral_matrix_regs->matrixF1_Address = (int) spec_mat_f1_bis; |
|
58 | spectral_matrix_regs->matrixF1_Address = (int) spec_mat_f1_bis; | |
60 | } |
|
59 | } | |
61 | else |
|
60 | else | |
62 | { |
|
61 | { | |
63 | spectral_matrix_regs->matrixF1_Address = (int) spec_mat_f1; |
|
62 | spectral_matrix_regs->matrixF1_Address = (int) spec_mat_f1; | |
64 | } |
|
63 | } | |
65 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffb; |
|
64 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffb; | |
66 | break; |
|
65 | break; | |
67 | case 3: |
|
66 | case 3: | |
68 | if (spectral_matrix_regs->matrixF2_Address == (int) spec_mat_f2) |
|
67 | if (spectral_matrix_regs->matrixF2_Address == (int) spec_mat_f2) | |
69 | { |
|
68 | { | |
70 | spectral_matrix_regs->matrixF2_Address = (int) spec_mat_f2_bis; |
|
69 | spectral_matrix_regs->matrixF2_Address = (int) spec_mat_f2_bis; | |
71 | } |
|
70 | } | |
72 | else |
|
71 | else | |
73 | { |
|
72 | { | |
74 | spectral_matrix_regs->matrixF2_Address = (int) spec_mat_f2; |
|
73 | spectral_matrix_regs->matrixF2_Address = (int) spec_mat_f2; | |
75 | } |
|
74 | } | |
76 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff7; |
|
75 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff7; | |
77 | break; |
|
76 | break; | |
78 | default: |
|
77 | default: | |
79 | break; |
|
78 | break; | |
80 | } |
|
79 | } | |
81 | } |
|
80 | } | |
82 | } |
|
81 | } | |
83 |
|
82 | |||
84 | // reset error codes to 0 |
|
83 | // reset error codes to 0 | |
85 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xffffffcf; // [1100 1111] |
|
84 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xffffffcf; // [1100 1111] | |
86 |
|
85 | |||
87 | if (rtems_event_send( Task_id[TASKID_SMIQ], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
86 | if (rtems_event_send( Task_id[TASKID_SMIQ], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { | |
88 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_4 ); |
|
87 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_4 ); | |
89 | } |
|
88 | } | |
90 | } |
|
89 | } | |
91 |
|
90 | |||
92 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ) |
|
91 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ) | |
93 | { |
|
92 | { | |
94 | if (rtems_event_send( Task_id[TASKID_SMIQ], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
93 | if (rtems_event_send( Task_id[TASKID_SMIQ], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { | |
95 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_4 ); |
|
94 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_4 ); | |
96 | } |
|
95 | } | |
97 | } |
|
96 | } | |
98 |
|
97 | |||
99 | //************ |
|
98 | //************ | |
100 | // RTEMS TASKS |
|
99 | // RTEMS TASKS | |
101 |
|
100 | |||
102 | rtems_task smiq_task(rtems_task_argument argument) // process the Spectral Matrices IRQ |
|
101 | rtems_task smiq_task(rtems_task_argument argument) // process the Spectral Matrices IRQ | |
103 | { |
|
102 | { | |
104 | rtems_event_set event_out; |
|
103 | rtems_event_set event_out; | |
105 | unsigned int nb_interrupt_f0 = 0; |
|
104 | unsigned int nb_interrupt_f0 = 0; | |
106 |
|
105 | |||
107 | BOOT_PRINTF("in SMIQ *** \n") |
|
106 | BOOT_PRINTF("in SMIQ *** \n") | |
108 |
|
107 | |||
109 | while(1){ |
|
108 | while(1){ | |
110 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
109 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 | |
111 | nb_interrupt_f0 = nb_interrupt_f0 + 1; |
|
110 | nb_interrupt_f0 = nb_interrupt_f0 + 1; | |
112 | if (nb_interrupt_f0 == NB_SM_TO_RECEIVE_BEFORE_AVF0 ){ |
|
111 | if (nb_interrupt_f0 == NB_SM_TO_RECEIVE_BEFORE_AVF0 ){ | |
113 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
112 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |
114 | { |
|
113 | { | |
115 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
114 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |
116 | } |
|
115 | } | |
117 | nb_interrupt_f0 = 0; |
|
116 | nb_interrupt_f0 = 0; | |
118 | } |
|
117 | } | |
119 | } |
|
118 | } | |
120 | } |
|
119 | } | |
121 |
|
120 | |||
122 | //rtems_task smiq_task(rtems_task_argument argument) // process the Spectral Matrices IRQ |
|
|||
123 | //{ |
|
|||
124 | // rtems_event_set event_out; |
|
|||
125 | // unsigned int nb_interrupt_f0 = 0; |
|
|||
126 |
|
||||
127 | // PRINTF("in SMIQ *** \n") |
|
|||
128 |
|
||||
129 | // while(1){ |
|
|||
130 | // rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
|||
131 | // nb_interrupt_f0 = nb_interrupt_f0 + 1; |
|
|||
132 | // if (nb_interrupt_f0 == param_local.local_nb_interrupt_f0_MAX ){ |
|
|||
133 | // if (rtems_event_send( Task_id[TASKID_MATR], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
|||
134 | // { |
|
|||
135 | // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
|||
136 | // } |
|
|||
137 | // nb_interrupt_f0 = 0; |
|
|||
138 | // } |
|
|||
139 | // } |
|
|||
140 | //} |
|
|||
141 |
|
||||
142 | rtems_task spw_bppr_task(rtems_task_argument argument) |
|
121 | rtems_task spw_bppr_task(rtems_task_argument argument) | |
143 | { |
|
122 | { | |
144 | rtems_status_code status; |
|
123 | rtems_status_code status; | |
145 | rtems_event_set event_out; |
|
124 | rtems_event_set event_out; | |
146 |
|
125 | |||
147 | BOOT_PRINTF("in BPPR ***\n"); |
|
126 | BOOT_PRINTF("in BPPR ***\n"); | |
148 |
|
127 | |||
149 | while( true ){ // wait for an event to begin with the processing |
|
128 | while( true ){ // wait for an event to begin with the processing | |
150 | status = rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); |
|
129 | status = rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); | |
151 | } |
|
130 | } | |
152 | } |
|
131 | } | |
153 |
|
132 | |||
154 | rtems_task avf0_task(rtems_task_argument argument) |
|
133 | rtems_task avf0_task(rtems_task_argument argument) | |
155 | { |
|
134 | { | |
156 | int i; |
|
135 | int i; | |
157 | static int nb_average; |
|
136 | static int nb_average; | |
158 | rtems_event_set event_out; |
|
137 | rtems_event_set event_out; | |
159 | rtems_status_code status; |
|
138 | rtems_status_code status; | |
160 |
|
139 | |||
161 | nb_average = 0; |
|
140 | nb_average = 0; | |
162 |
|
141 | |||
163 | BOOT_PRINTF("in AVFO *** \n") |
|
142 | BOOT_PRINTF("in AVFO *** \n") | |
164 |
|
143 | |||
165 | while(1){ |
|
144 | while(1){ | |
166 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
145 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 | |
167 | for(i=0; i<TOTAL_SIZE_SM; i++){ |
|
146 | for(i=0; i<TOTAL_SIZE_SM; i++){ | |
168 | averaged_spec_mat_f0[i] = averaged_spec_mat_f0[i] + spec_mat_f0_a[i] |
|
147 | averaged_spec_mat_f0[i] = averaged_spec_mat_f0[i] + spec_mat_f0_a[i] | |
169 | + spec_mat_f0_b[i] |
|
148 | + spec_mat_f0_b[i] | |
170 | + spec_mat_f0_c[i] |
|
149 | + spec_mat_f0_c[i] | |
171 | + spec_mat_f0_d[i] |
|
150 | + spec_mat_f0_d[i] | |
172 | + spec_mat_f0_e[i] |
|
151 | + spec_mat_f0_e[i] | |
173 | + spec_mat_f0_f[i] |
|
152 | + spec_mat_f0_f[i] | |
174 | + spec_mat_f0_g[i] |
|
153 | + spec_mat_f0_g[i] | |
175 | + spec_mat_f0_h[i]; |
|
154 | + spec_mat_f0_h[i]; | |
176 | } |
|
155 | } | |
177 | nb_average = nb_average + NB_SM_TO_RECEIVE_BEFORE_AVF0; |
|
156 | nb_average = nb_average + NB_SM_TO_RECEIVE_BEFORE_AVF0; | |
178 | if (nb_average == NB_AVERAGE_NORMAL_f0) { |
|
157 | if (nb_average == NB_AVERAGE_NORMAL_f0) { | |
179 | nb_average = 0; |
|
158 | nb_average = 0; | |
180 | status = rtems_event_send( Task_id[TASKID_MATR], RTEMS_EVENT_0 ); // sending an event to the task 7, BPF0 |
|
159 | status = rtems_event_send( Task_id[TASKID_MATR], RTEMS_EVENT_0 ); // sending an event to the task 7, BPF0 | |
181 | if (status != RTEMS_SUCCESSFUL) { |
|
160 | if (status != RTEMS_SUCCESSFUL) { | |
182 | printf("in AVF0 *** Error sending RTEMS_EVENT_0, code %d\n", status); |
|
161 | printf("in AVF0 *** Error sending RTEMS_EVENT_0, code %d\n", status); | |
183 | } |
|
162 | } | |
184 | } |
|
163 | } | |
185 | } |
|
164 | } | |
186 | } |
|
165 | } | |
187 |
|
166 | |||
188 | rtems_task bpf0_task(rtems_task_argument argument) |
|
167 | rtems_task bpf0_task(rtems_task_argument argument) | |
189 | { |
|
168 | { | |
190 | rtems_event_set event_out; |
|
169 | rtems_event_set event_out; | |
|
170 | static unsigned char LFR_BP1_F0[ NB_BINS_COMPRESSED_SM_F0 * 9 ]; | |||
191 |
|
171 | |||
192 | BOOT_PRINTF("in BPFO *** \n") |
|
172 | BOOT_PRINTF("in BPFO *** \n") | |
193 |
|
173 | |||
194 | while(1){ |
|
174 | while(1){ | |
195 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
175 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 | |
196 | matrix_compression(averaged_spec_mat_f0, 0, compressed_spec_mat_f0); |
|
176 | matrix_compression(averaged_spec_mat_f0, 0, compressed_spec_mat_f0); | |
197 | BP1_set(compressed_spec_mat_f0, NB_BINS_COMPRESSED_SM_F0, LFR_BP1_F0); |
|
177 | BP1_set(compressed_spec_mat_f0, NB_BINS_COMPRESSED_SM_F0, LFR_BP1_F0); | |
198 | //PRINTF("IN TASK BPF0 *** Matrix compressed, parameters calculated\n") |
|
|||
199 | } |
|
178 | } | |
200 | } |
|
179 | } | |
201 |
|
180 | |||
202 | rtems_task matr_task(rtems_task_argument argument) |
|
181 | rtems_task matr_task(rtems_task_argument argument) | |
203 | { |
|
182 | { | |
204 | spw_ioctl_pkt_send spw_ioctl_send_ASM; |
|
183 | spw_ioctl_pkt_send spw_ioctl_send_ASM; | |
205 | rtems_event_set event_out; |
|
184 | rtems_event_set event_out; | |
206 | rtems_status_code status; |
|
185 | rtems_status_code status; | |
207 | rtems_id queue_id; |
|
186 | rtems_id queue_id; | |
208 | Header_TM_LFR_SCIENCE_ASM_t headerASM; |
|
187 | Header_TM_LFR_SCIENCE_ASM_t headerASM; | |
209 |
|
188 | |||
210 | init_header_asm( &headerASM ); |
|
189 | init_header_asm( &headerASM ); | |
211 |
|
190 | |||
212 | status = rtems_message_queue_ident( misc_name[QUEUE_SEND], 0, &queue_id ); |
|
191 | status = rtems_message_queue_ident( misc_name[QUEUE_SEND], 0, &queue_id ); | |
213 | if (status != RTEMS_SUCCESSFUL) |
|
192 | if (status != RTEMS_SUCCESSFUL) | |
214 | { |
|
193 | { | |
215 | PRINTF1("in MATR *** ERR getting queue id, %d\n", status) |
|
194 | PRINTF1("in MATR *** ERR getting queue id, %d\n", status) | |
216 | } |
|
195 | } | |
217 |
|
196 | |||
218 | BOOT_PRINTF("in MATR *** \n") |
|
197 | BOOT_PRINTF("in MATR *** \n") | |
219 |
|
198 | |||
220 | fill_averaged_spectral_matrix( ); |
|
199 | fill_averaged_spectral_matrix( ); | |
221 |
|
200 | |||
222 | while(1){ |
|
201 | while(1){ | |
223 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
202 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 | |
224 |
|
203 | |||
225 | #ifdef GSA |
|
204 | #ifdef GSA | |
226 | #else |
|
205 | #else | |
227 | fill_averaged_spectral_matrix( ); |
|
206 | fill_averaged_spectral_matrix( ); | |
228 | #endif |
|
207 | #endif | |
229 | convert_averaged_spectral_matrix( averaged_spec_mat_f0, averaged_spec_mat_f0_char); |
|
208 | convert_averaged_spectral_matrix( averaged_spec_mat_f0, averaged_spec_mat_f0_char); | |
230 |
|
209 | |||
231 | send_spectral_matrix( &headerASM, averaged_spec_mat_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id); |
|
210 | send_spectral_matrix( &headerASM, averaged_spec_mat_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id); | |
232 | } |
|
211 | } | |
233 | } |
|
212 | } | |
234 |
|
213 | |||
235 | //***************************** |
|
214 | //***************************** | |
236 | // Spectral matrices processing |
|
215 | // Spectral matrices processing | |
237 |
|
216 | |||
238 | void matrix_reset(volatile float *averaged_spec_mat) |
|
217 | void matrix_reset(volatile float *averaged_spec_mat) | |
239 | { |
|
218 | { | |
240 |
|
|
219 | int i; | |
241 |
|
|
220 | for(i=0; i<TOTAL_SIZE_SM; i++){ | |
242 |
|
|
221 | averaged_spec_mat[i] = 0; | |
243 |
|
|
222 | } | |
244 | } |
|
223 | } | |
245 |
|
224 | |||
246 | void matrix_compression(volatile float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat) |
|
225 | void matrix_compression(volatile float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat) | |
247 | { |
|
226 | { | |
248 | int i; |
|
227 | int i; | |
249 | int j; |
|
228 | int j; | |
250 | switch (fChannel){ |
|
229 | switch (fChannel){ | |
251 | case 0: |
|
230 | case 0: | |
252 | for(i=0;i<NB_BINS_COMPRESSED_SM_F0;i++){ |
|
231 | for(i=0;i<NB_BINS_COMPRESSED_SM_F0;i++){ | |
253 | j = 17 + (i * 8); |
|
232 | j = 17 + (i * 8); | |
254 | compressed_spec_mat[i] = (averaged_spec_mat[j] |
|
233 | compressed_spec_mat[i] = (averaged_spec_mat[j] | |
255 | + averaged_spec_mat[j+1] |
|
234 | + averaged_spec_mat[j+1] | |
256 | + averaged_spec_mat[j+2] |
|
235 | + averaged_spec_mat[j+2] | |
257 | + averaged_spec_mat[j+3] |
|
236 | + averaged_spec_mat[j+3] | |
258 | + averaged_spec_mat[j+4] |
|
237 | + averaged_spec_mat[j+4] | |
259 | + averaged_spec_mat[j+5] |
|
238 | + averaged_spec_mat[j+5] | |
260 | + averaged_spec_mat[j+6] |
|
239 | + averaged_spec_mat[j+6] | |
261 | + averaged_spec_mat[j+7])/(8*NB_AVERAGE_NORMAL_f0); |
|
240 | + averaged_spec_mat[j+7])/(8*NB_AVERAGE_NORMAL_f0); | |
262 | } |
|
241 | } | |
263 | break; |
|
242 | break; | |
264 | case 1: |
|
243 | case 1: | |
265 | // case fChannel = f1 to be completed later |
|
244 | // case fChannel = f1 to be completed later | |
266 | break; |
|
245 | break; | |
267 | case 2: |
|
246 | case 2: | |
268 | // case fChannel = f1 to be completed later |
|
247 | // case fChannel = f1 to be completed later | |
269 | break; |
|
248 | break; | |
270 | default: |
|
249 | default: | |
271 | break; |
|
250 | break; | |
272 | } |
|
251 | } | |
273 | } |
|
252 | } | |
274 |
|
253 | |||
275 | void BP1_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1){ |
|
254 | void BP1_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1){ | |
276 | int i; |
|
255 | int i; | |
277 | int j; |
|
256 | int j; | |
278 | unsigned char tmp_u_char; |
|
257 | unsigned char tmp_u_char; | |
279 | unsigned char * pt_char = NULL; |
|
258 | unsigned char * pt_char = NULL; | |
280 | float PSDB, PSDE; |
|
259 | float PSDB, PSDE; | |
281 | float NVEC_V0; |
|
260 | float NVEC_V0; | |
282 | float NVEC_V1; |
|
261 | float NVEC_V1; | |
283 | float NVEC_V2; |
|
262 | float NVEC_V2; | |
284 | //float significand; |
|
263 | //float significand; | |
285 | //int exponent; |
|
264 | //int exponent; | |
286 | float aux; |
|
265 | float aux; | |
287 | float tr_SB_SB; |
|
266 | float tr_SB_SB; | |
288 | float tmp; |
|
267 | float tmp; | |
289 | float sx_re; |
|
268 | float sx_re; | |
290 | float sx_im; |
|
269 | float sx_im; | |
291 | float nebx_re = 0; |
|
270 | float nebx_re = 0; | |
292 | float nebx_im = 0; |
|
271 | float nebx_im = 0; | |
293 | float ny = 0; |
|
272 | float ny = 0; | |
294 | float nz = 0; |
|
273 | float nz = 0; | |
295 | float bx_bx_star = 0; |
|
274 | float bx_bx_star = 0; | |
296 | for(i=0; i<nb_bins_compressed_spec_mat; i++){ |
|
275 | for(i=0; i<nb_bins_compressed_spec_mat; i++){ | |
297 | //============================================== |
|
276 | //============================================== | |
298 | // BP1 PSD == B PAR_LFR_SC_BP1_PE_FL0 == 16 bits |
|
277 | // BP1 PSD == B PAR_LFR_SC_BP1_PE_FL0 == 16 bits | |
299 | PSDB = compressed_spec_mat[i*30] // S11 |
|
278 | PSDB = compressed_spec_mat[i*30] // S11 | |
300 | + compressed_spec_mat[(i*30) + 10] // S22 |
|
279 | + compressed_spec_mat[(i*30) + 10] // S22 | |
301 | + compressed_spec_mat[(i*30) + 18]; // S33 |
|
280 | + compressed_spec_mat[(i*30) + 18]; // S33 | |
302 | //significand = frexp(PSDB, &exponent); |
|
281 | //significand = frexp(PSDB, &exponent); | |
303 | pt_char = (unsigned char*) &PSDB; |
|
282 | pt_char = (unsigned char*) &PSDB; | |
304 | LFR_BP1[(i*9) + 2] = pt_char[0]; // bits 31 downto 24 of the float |
|
283 | LFR_BP1[(i*9) + 2] = pt_char[0]; // bits 31 downto 24 of the float | |
305 | LFR_BP1[(i*9) + 3] = pt_char[1]; // bits 23 downto 16 of the float |
|
284 | LFR_BP1[(i*9) + 3] = pt_char[1]; // bits 23 downto 16 of the float | |
306 | //============================================== |
|
285 | //============================================== | |
307 | // BP1 PSD == E PAR_LFR_SC_BP1_PB_FL0 == 16 bits |
|
286 | // BP1 PSD == E PAR_LFR_SC_BP1_PB_FL0 == 16 bits | |
308 | PSDE = compressed_spec_mat[(i*30) + 24] * K44_pe // S44 |
|
287 | PSDE = compressed_spec_mat[(i*30) + 24] * K44_pe // S44 | |
309 | + compressed_spec_mat[(i*30) + 28] * K55_pe // S55 |
|
288 | + compressed_spec_mat[(i*30) + 28] * K55_pe // S55 | |
310 | + compressed_spec_mat[(i*30) + 26] * K45_pe_re // S45 |
|
289 | + compressed_spec_mat[(i*30) + 26] * K45_pe_re // S45 | |
311 | - compressed_spec_mat[(i*30) + 27] * K45_pe_im; // S45 |
|
290 | - compressed_spec_mat[(i*30) + 27] * K45_pe_im; // S45 | |
312 | pt_char = (unsigned char*) &PSDE; |
|
291 | pt_char = (unsigned char*) &PSDE; | |
313 | LFR_BP1[(i*9) + 0] = pt_char[0]; // bits 31 downto 24 of the float |
|
292 | LFR_BP1[(i*9) + 0] = pt_char[0]; // bits 31 downto 24 of the float | |
314 | LFR_BP1[(i*9) + 1] = pt_char[1]; // bits 23 downto 16 of the float |
|
293 | LFR_BP1[(i*9) + 1] = pt_char[1]; // bits 23 downto 16 of the float | |
315 | //============================================================================== |
|
294 | //============================================================================== | |
316 | // BP1 normal wave vector == PAR_LFR_SC_BP1_NVEC_V0_F0 == 8 bits |
|
295 | // BP1 normal wave vector == PAR_LFR_SC_BP1_NVEC_V0_F0 == 8 bits | |
317 | // == PAR_LFR_SC_BP1_NVEC_V1_F0 == 8 bits |
|
296 | // == PAR_LFR_SC_BP1_NVEC_V1_F0 == 8 bits | |
318 | // == PAR_LFR_SC_BP1_NVEC_V2_F0 == 1 bits |
|
297 | // == PAR_LFR_SC_BP1_NVEC_V2_F0 == 1 bits | |
319 | tmp = sqrt( |
|
298 | tmp = sqrt( | |
320 | compressed_spec_mat[(i*30) + 3]*compressed_spec_mat[(i*30) + 3] //Im S12 |
|
299 | compressed_spec_mat[(i*30) + 3]*compressed_spec_mat[(i*30) + 3] //Im S12 | |
321 | +compressed_spec_mat[(i*30) + 5]*compressed_spec_mat[(i*30) + 5] //Im S13 |
|
300 | +compressed_spec_mat[(i*30) + 5]*compressed_spec_mat[(i*30) + 5] //Im S13 | |
322 | +compressed_spec_mat[(i*30) + 13]*compressed_spec_mat[(i*30) + 13] //Im S23 |
|
301 | +compressed_spec_mat[(i*30) + 13]*compressed_spec_mat[(i*30) + 13] //Im S23 | |
323 | ); |
|
302 | ); | |
324 | NVEC_V0 = compressed_spec_mat[(i*30) + 13] / tmp; // Im S23 |
|
303 | NVEC_V0 = compressed_spec_mat[(i*30) + 13] / tmp; // Im S23 | |
325 | NVEC_V1 = -compressed_spec_mat[(i*30) + 5] / tmp; // Im S13 |
|
304 | NVEC_V1 = -compressed_spec_mat[(i*30) + 5] / tmp; // Im S13 | |
326 | NVEC_V2 = compressed_spec_mat[(i*30) + 3] / tmp; // Im S12 |
|
305 | NVEC_V2 = compressed_spec_mat[(i*30) + 3] / tmp; // Im S12 | |
327 | LFR_BP1[(i*9) + 4] = (char) (NVEC_V0*127); |
|
306 | LFR_BP1[(i*9) + 4] = (char) (NVEC_V0*127); | |
328 | LFR_BP1[(i*9) + 5] = (char) (NVEC_V1*127); |
|
307 | LFR_BP1[(i*9) + 5] = (char) (NVEC_V1*127); | |
329 | pt_char = (unsigned char*) &NVEC_V2; |
|
308 | pt_char = (unsigned char*) &NVEC_V2; | |
330 | LFR_BP1[(i*9) + 6] = pt_char[0] & 0x80; // extract the sign of NVEC_V2 |
|
309 | LFR_BP1[(i*9) + 6] = pt_char[0] & 0x80; // extract the sign of NVEC_V2 | |
331 | //======================================================= |
|
310 | //======================================================= | |
332 | // BP1 ellipticity == PAR_LFR_SC_BP1_ELLIP_F0 == 4 bits |
|
311 | // BP1 ellipticity == PAR_LFR_SC_BP1_ELLIP_F0 == 4 bits | |
333 | aux = 2*tmp / PSDB; // compute the ellipticity |
|
312 | aux = 2*tmp / PSDB; // compute the ellipticity | |
334 | tmp_u_char = (unsigned char) (aux*(16-1)); // convert the ellipticity |
|
313 | tmp_u_char = (unsigned char) (aux*(16-1)); // convert the ellipticity | |
335 | LFR_BP1[i*9+6] = LFR_BP1[i*9+6] | ((tmp_u_char&0x0f)<<3); // keeps 4 bits of the resulting unsigned char |
|
314 | LFR_BP1[i*9+6] = LFR_BP1[i*9+6] | ((tmp_u_char&0x0f)<<3); // keeps 4 bits of the resulting unsigned char | |
336 | //============================================================== |
|
315 | //============================================================== | |
337 | // BP1 degree of polarization == PAR_LFR_SC_BP1_DOP_F0 == 3 bits |
|
316 | // BP1 degree of polarization == PAR_LFR_SC_BP1_DOP_F0 == 3 bits | |
338 | for(j = 0; j<NB_VALUES_PER_SM;j++){ |
|
317 | for(j = 0; j<NB_VALUES_PER_SM;j++){ | |
339 | tr_SB_SB = compressed_spec_mat[i*30] * compressed_spec_mat[i*30] |
|
318 | tr_SB_SB = compressed_spec_mat[i*30] * compressed_spec_mat[i*30] | |
340 | + compressed_spec_mat[(i*30) + 10] * compressed_spec_mat[(i*30) + 10] |
|
319 | + compressed_spec_mat[(i*30) + 10] * compressed_spec_mat[(i*30) + 10] | |
341 | + compressed_spec_mat[(i*30) + 18] * compressed_spec_mat[(i*30) + 18] |
|
320 | + compressed_spec_mat[(i*30) + 18] * compressed_spec_mat[(i*30) + 18] | |
342 | + 2 * compressed_spec_mat[(i*30) + 2] * compressed_spec_mat[(i*30) + 2] |
|
321 | + 2 * compressed_spec_mat[(i*30) + 2] * compressed_spec_mat[(i*30) + 2] | |
343 | + 2 * compressed_spec_mat[(i*30) + 3] * compressed_spec_mat[(i*30) + 3] |
|
322 | + 2 * compressed_spec_mat[(i*30) + 3] * compressed_spec_mat[(i*30) + 3] | |
344 | + 2 * compressed_spec_mat[(i*30) + 4] * compressed_spec_mat[(i*30) + 4] |
|
323 | + 2 * compressed_spec_mat[(i*30) + 4] * compressed_spec_mat[(i*30) + 4] | |
345 | + 2 * compressed_spec_mat[(i*30) + 5] * compressed_spec_mat[(i*30) + 5] |
|
324 | + 2 * compressed_spec_mat[(i*30) + 5] * compressed_spec_mat[(i*30) + 5] | |
346 | + 2 * compressed_spec_mat[(i*30) + 12] * compressed_spec_mat[(i*30) + 12] |
|
325 | + 2 * compressed_spec_mat[(i*30) + 12] * compressed_spec_mat[(i*30) + 12] | |
347 | + 2 * compressed_spec_mat[(i*30) + 13] * compressed_spec_mat[(i*30) + 13]; |
|
326 | + 2 * compressed_spec_mat[(i*30) + 13] * compressed_spec_mat[(i*30) + 13]; | |
348 | } |
|
327 | } | |
349 | aux = PSDB*PSDB; |
|
328 | aux = PSDB*PSDB; | |
350 | tmp = sqrt( abs( ( 3*tr_SB_SB - aux ) / ( 2 * aux ) ) ); |
|
329 | tmp = sqrt( abs( ( 3*tr_SB_SB - aux ) / ( 2 * aux ) ) ); | |
351 | tmp_u_char = (unsigned char) (NVEC_V0*(8-1)); |
|
330 | tmp_u_char = (unsigned char) (NVEC_V0*(8-1)); | |
352 | LFR_BP1[(i*9) + 6] = LFR_BP1[(i*9) + 6] | (tmp_u_char & 0x07); // keeps 3 bits of the resulting unsigned char |
|
331 | LFR_BP1[(i*9) + 6] = LFR_BP1[(i*9) + 6] | (tmp_u_char & 0x07); // keeps 3 bits of the resulting unsigned char | |
353 | //======================================================================================= |
|
332 | //======================================================================================= | |
354 | // BP1 x-component of the normalized Poynting flux == PAR_LFR_SC_BP1_SZ_F0 == 8 bits (7+1) |
|
333 | // BP1 x-component of the normalized Poynting flux == PAR_LFR_SC_BP1_SZ_F0 == 8 bits (7+1) | |
355 | sx_re = compressed_spec_mat[(i*30) + 20] * K34_sx_re |
|
334 | sx_re = compressed_spec_mat[(i*30) + 20] * K34_sx_re | |
356 | + compressed_spec_mat[(i*30) + 6] * K14_sx_re |
|
335 | + compressed_spec_mat[(i*30) + 6] * K14_sx_re | |
357 | + compressed_spec_mat[(i*30) + 8] * K15_sx_re |
|
336 | + compressed_spec_mat[(i*30) + 8] * K15_sx_re | |
358 | + compressed_spec_mat[(i*30) + 14] * K24_sx_re |
|
337 | + compressed_spec_mat[(i*30) + 14] * K24_sx_re | |
359 | + compressed_spec_mat[(i*30) + 16] * K25_sx_re |
|
338 | + compressed_spec_mat[(i*30) + 16] * K25_sx_re | |
360 | + compressed_spec_mat[(i*30) + 22] * K35_sx_re; |
|
339 | + compressed_spec_mat[(i*30) + 22] * K35_sx_re; | |
361 | sx_im = compressed_spec_mat[(i*30) + 21] * K34_sx_im |
|
340 | sx_im = compressed_spec_mat[(i*30) + 21] * K34_sx_im | |
362 | + compressed_spec_mat[(i*30) + 7] * K14_sx_im |
|
341 | + compressed_spec_mat[(i*30) + 7] * K14_sx_im | |
363 | + compressed_spec_mat[(i*30) + 9] * K15_sx_im |
|
342 | + compressed_spec_mat[(i*30) + 9] * K15_sx_im | |
364 | + compressed_spec_mat[(i*30) + 15] * K24_sx_im |
|
343 | + compressed_spec_mat[(i*30) + 15] * K24_sx_im | |
365 | + compressed_spec_mat[(i*30) + 17] * K25_sx_im |
|
344 | + compressed_spec_mat[(i*30) + 17] * K25_sx_im | |
366 | + compressed_spec_mat[(i*30) + 23] * K35_sx_im; |
|
345 | + compressed_spec_mat[(i*30) + 23] * K35_sx_im; | |
367 | LFR_BP1[(i*9) + 7] = ((unsigned char) (sx_re * 128)) & 0x7f; // cf DOC for the compression |
|
346 | LFR_BP1[(i*9) + 7] = ((unsigned char) (sx_re * 128)) & 0x7f; // cf DOC for the compression | |
368 | if ( abs(sx_re) > abs(sx_im) ) { |
|
347 | if ( abs(sx_re) > abs(sx_im) ) { | |
369 | LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] | (0x80); // extract the sector of sx |
|
348 | LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] | (0x80); // extract the sector of sx | |
370 | } |
|
349 | } | |
371 | else { |
|
350 | else { | |
372 | LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] & (0x7f); // extract the sector of sx |
|
351 | LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] & (0x7f); // extract the sector of sx | |
373 | } |
|
352 | } | |
374 | //====================================================================== |
|
353 | //====================================================================== | |
375 | // BP1 phase velocity estimator == PAR_LFR_SC_BP1_VPHI_F0 == 8 bits (7+1) |
|
354 | // BP1 phase velocity estimator == PAR_LFR_SC_BP1_VPHI_F0 == 8 bits (7+1) | |
376 | ny = sin(Alpha_M)*NVEC_V1 + cos(Alpha_M)*NVEC_V2; |
|
355 | ny = sin(Alpha_M)*NVEC_V1 + cos(Alpha_M)*NVEC_V2; | |
377 | nz = NVEC_V0; |
|
356 | nz = NVEC_V0; | |
378 | bx_bx_star = cos(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+10] // re S22 |
|
357 | bx_bx_star = cos(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+10] // re S22 | |
379 | + sin(Alpha_M) * sin(Alpha_M) * compressed_spec_mat[i*30+18] // re S33 |
|
358 | + sin(Alpha_M) * sin(Alpha_M) * compressed_spec_mat[i*30+18] // re S33 | |
380 | - 2 * sin(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+12]; // re S23 |
|
359 | - 2 * sin(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+12]; // re S23 | |
381 | nebx_re = ny * (compressed_spec_mat[(i*30) + 14] * K24_ny_re |
|
360 | nebx_re = ny * (compressed_spec_mat[(i*30) + 14] * K24_ny_re | |
382 | +compressed_spec_mat[(i*30) + 16] * K25_ny_re |
|
361 | +compressed_spec_mat[(i*30) + 16] * K25_ny_re | |
383 | +compressed_spec_mat[(i*30) + 20] * K34_ny_re |
|
362 | +compressed_spec_mat[(i*30) + 20] * K34_ny_re | |
384 | +compressed_spec_mat[(i*30) + 22] * K35_ny_re) |
|
363 | +compressed_spec_mat[(i*30) + 22] * K35_ny_re) | |
385 | + nz * (compressed_spec_mat[(i*30) + 14] * K24_nz_re |
|
364 | + nz * (compressed_spec_mat[(i*30) + 14] * K24_nz_re | |
386 | +compressed_spec_mat[(i*30) + 16] * K25_nz_re |
|
365 | +compressed_spec_mat[(i*30) + 16] * K25_nz_re | |
387 | +compressed_spec_mat[(i*30) + 20] * K34_nz_re |
|
366 | +compressed_spec_mat[(i*30) + 20] * K34_nz_re | |
388 | +compressed_spec_mat[(i*30) + 22] * K35_nz_re); |
|
367 | +compressed_spec_mat[(i*30) + 22] * K35_nz_re); | |
389 | nebx_im = ny * (compressed_spec_mat[(i*30) + 15]*K24_ny_re |
|
368 | nebx_im = ny * (compressed_spec_mat[(i*30) + 15]*K24_ny_re | |
390 | +compressed_spec_mat[(i*30) + 17] * K25_ny_re |
|
369 | +compressed_spec_mat[(i*30) + 17] * K25_ny_re | |
391 | +compressed_spec_mat[(i*30) + 21] * K34_ny_re |
|
370 | +compressed_spec_mat[(i*30) + 21] * K34_ny_re | |
392 | +compressed_spec_mat[(i*30) + 23] * K35_ny_re) |
|
371 | +compressed_spec_mat[(i*30) + 23] * K35_ny_re) | |
393 | + nz * (compressed_spec_mat[(i*30) + 15] * K24_nz_im |
|
372 | + nz * (compressed_spec_mat[(i*30) + 15] * K24_nz_im | |
394 | +compressed_spec_mat[(i*30) + 17] * K25_nz_im |
|
373 | +compressed_spec_mat[(i*30) + 17] * K25_nz_im | |
395 | +compressed_spec_mat[(i*30) + 21] * K34_nz_im |
|
374 | +compressed_spec_mat[(i*30) + 21] * K34_nz_im | |
396 | +compressed_spec_mat[(i*30) + 23] * K35_nz_im); |
|
375 | +compressed_spec_mat[(i*30) + 23] * K35_nz_im); | |
397 | tmp = nebx_re / bx_bx_star; |
|
376 | tmp = nebx_re / bx_bx_star; | |
398 | LFR_BP1[(i*9) + 8] = ((unsigned char) (tmp * 128)) & 0x7f; // cf DOC for the compression |
|
377 | LFR_BP1[(i*9) + 8] = ((unsigned char) (tmp * 128)) & 0x7f; // cf DOC for the compression | |
399 | if ( abs(nebx_re) > abs(nebx_im) ) { |
|
378 | if ( abs(nebx_re) > abs(nebx_im) ) { | |
400 | LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] | (0x80); // extract the sector of nebx |
|
379 | LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] | (0x80); // extract the sector of nebx | |
401 | } |
|
380 | } | |
402 | else { |
|
381 | else { | |
403 | LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] & (0x7f); // extract the sector of nebx |
|
382 | LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] & (0x7f); // extract the sector of nebx | |
404 | } |
|
383 | } | |
405 | } |
|
384 | } | |
406 |
|
385 | |||
407 | } |
|
386 | } | |
408 |
|
387 | |||
409 | void BP2_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat){ |
|
388 | void BP2_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat){ | |
410 | // BP2 autocorrelation |
|
389 | // BP2 autocorrelation | |
411 | int i; |
|
390 | int i; | |
412 | int aux = 0; |
|
391 | int aux = 0; | |
413 |
|
392 | |||
414 | for(i = 0; i<nb_bins_compressed_spec_mat; i++){ |
|
393 | for(i = 0; i<nb_bins_compressed_spec_mat; i++){ | |
415 | // S12 |
|
394 | // S12 | |
416 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 10]); |
|
395 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 10]); | |
417 | compressed_spec_mat[(i*30) + 2] = compressed_spec_mat[(i*30) + 2] / aux; |
|
396 | compressed_spec_mat[(i*30) + 2] = compressed_spec_mat[(i*30) + 2] / aux; | |
418 | compressed_spec_mat[(i*30) + 3] = compressed_spec_mat[(i*30) + 3] / aux; |
|
397 | compressed_spec_mat[(i*30) + 3] = compressed_spec_mat[(i*30) + 3] / aux; | |
419 | // S13 |
|
398 | // S13 | |
420 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 18]); |
|
399 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 18]); | |
421 | compressed_spec_mat[(i*30) + 4] = compressed_spec_mat[(i*30) + 4] / aux; |
|
400 | compressed_spec_mat[(i*30) + 4] = compressed_spec_mat[(i*30) + 4] / aux; | |
422 | compressed_spec_mat[(i*30) + 5] = compressed_spec_mat[(i*30) + 5] / aux; |
|
401 | compressed_spec_mat[(i*30) + 5] = compressed_spec_mat[(i*30) + 5] / aux; | |
423 | // S23 |
|
402 | // S23 | |
424 | aux = sqrt(compressed_spec_mat[i*30+12]*compressed_spec_mat[(i*30) + 18]); |
|
403 | aux = sqrt(compressed_spec_mat[i*30+12]*compressed_spec_mat[(i*30) + 18]); | |
425 | compressed_spec_mat[(i*30) + 12] = compressed_spec_mat[(i*30) + 12] / aux; |
|
404 | compressed_spec_mat[(i*30) + 12] = compressed_spec_mat[(i*30) + 12] / aux; | |
426 | compressed_spec_mat[(i*30) + 13] = compressed_spec_mat[(i*30) + 13] / aux; |
|
405 | compressed_spec_mat[(i*30) + 13] = compressed_spec_mat[(i*30) + 13] / aux; | |
427 | // S45 |
|
406 | // S45 | |
428 | aux = sqrt(compressed_spec_mat[i*30+24]*compressed_spec_mat[(i*30) + 28]); |
|
407 | aux = sqrt(compressed_spec_mat[i*30+24]*compressed_spec_mat[(i*30) + 28]); | |
429 | compressed_spec_mat[(i*30) + 26] = compressed_spec_mat[(i*30) + 26] / aux; |
|
408 | compressed_spec_mat[(i*30) + 26] = compressed_spec_mat[(i*30) + 26] / aux; | |
430 | compressed_spec_mat[(i*30) + 27] = compressed_spec_mat[(i*30) + 27] / aux; |
|
409 | compressed_spec_mat[(i*30) + 27] = compressed_spec_mat[(i*30) + 27] / aux; | |
431 | // S14 |
|
410 | // S14 | |
432 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) +24]); |
|
411 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) +24]); | |
433 | compressed_spec_mat[(i*30) + 6] = compressed_spec_mat[(i*30) + 6] / aux; |
|
412 | compressed_spec_mat[(i*30) + 6] = compressed_spec_mat[(i*30) + 6] / aux; | |
434 | compressed_spec_mat[(i*30) + 7] = compressed_spec_mat[(i*30) + 7] / aux; |
|
413 | compressed_spec_mat[(i*30) + 7] = compressed_spec_mat[(i*30) + 7] / aux; | |
435 | // S15 |
|
414 | // S15 | |
436 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 28]); |
|
415 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 28]); | |
437 | compressed_spec_mat[(i*30) + 8] = compressed_spec_mat[(i*30) + 8] / aux; |
|
416 | compressed_spec_mat[(i*30) + 8] = compressed_spec_mat[(i*30) + 8] / aux; | |
438 | compressed_spec_mat[(i*30) + 9] = compressed_spec_mat[(i*30) + 9] / aux; |
|
417 | compressed_spec_mat[(i*30) + 9] = compressed_spec_mat[(i*30) + 9] / aux; | |
439 | // S24 |
|
418 | // S24 | |
440 | aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 24]); |
|
419 | aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 24]); | |
441 | compressed_spec_mat[(i*30) + 14] = compressed_spec_mat[(i*30) + 14] / aux; |
|
420 | compressed_spec_mat[(i*30) + 14] = compressed_spec_mat[(i*30) + 14] / aux; | |
442 | compressed_spec_mat[(i*30) + 15] = compressed_spec_mat[(i*30) + 15] / aux; |
|
421 | compressed_spec_mat[(i*30) + 15] = compressed_spec_mat[(i*30) + 15] / aux; | |
443 | // S25 |
|
422 | // S25 | |
444 | aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 28]); |
|
423 | aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 28]); | |
445 | compressed_spec_mat[(i*30) + 16] = compressed_spec_mat[(i*30) + 16] / aux; |
|
424 | compressed_spec_mat[(i*30) + 16] = compressed_spec_mat[(i*30) + 16] / aux; | |
446 | compressed_spec_mat[(i*30) + 17] = compressed_spec_mat[(i*30) + 17] / aux; |
|
425 | compressed_spec_mat[(i*30) + 17] = compressed_spec_mat[(i*30) + 17] / aux; | |
447 | // S34 |
|
426 | // S34 | |
448 | aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 24]); |
|
427 | aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 24]); | |
449 | compressed_spec_mat[(i*30) + 20] = compressed_spec_mat[(i*30) + 20] / aux; |
|
428 | compressed_spec_mat[(i*30) + 20] = compressed_spec_mat[(i*30) + 20] / aux; | |
450 | compressed_spec_mat[(i*30) + 21] = compressed_spec_mat[(i*30) + 21] / aux; |
|
429 | compressed_spec_mat[(i*30) + 21] = compressed_spec_mat[(i*30) + 21] / aux; | |
451 | // S35 |
|
430 | // S35 | |
452 | aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 28]); |
|
431 | aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 28]); | |
453 | compressed_spec_mat[(i*30) + 22] = compressed_spec_mat[(i*30) + 22] / aux; |
|
432 | compressed_spec_mat[(i*30) + 22] = compressed_spec_mat[(i*30) + 22] / aux; | |
454 | compressed_spec_mat[(i*30) + 23] = compressed_spec_mat[(i*30) + 23] / aux; |
|
433 | compressed_spec_mat[(i*30) + 23] = compressed_spec_mat[(i*30) + 23] / aux; | |
455 | } |
|
434 | } | |
456 | } |
|
435 | } | |
457 |
|
436 | |||
458 | void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header) |
|
437 | void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header) | |
459 | { |
|
438 | { | |
460 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
439 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; | |
461 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
440 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
462 | header->reserved = 0x00; |
|
441 | header->reserved = 0x00; | |
463 | header->userApplication = CCSDS_USER_APP; |
|
442 | header->userApplication = CCSDS_USER_APP; | |
464 | header->packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); |
|
443 | header->packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); | |
465 | header->packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); |
|
444 | header->packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); | |
466 | header->packetSequenceControl[0] = 0xc0; |
|
445 | header->packetSequenceControl[0] = 0xc0; | |
467 | header->packetSequenceControl[1] = 0x00; |
|
446 | header->packetSequenceControl[1] = 0x00; | |
468 | header->packetLength[0] = 0x00; |
|
447 | header->packetLength[0] = 0x00; | |
469 | header->packetLength[1] = 0x00; |
|
448 | header->packetLength[1] = 0x00; | |
470 | // DATA FIELD HEADER |
|
449 | // DATA FIELD HEADER | |
471 | header->spare1_pusVersion_spare2 = 0x10; |
|
450 | header->spare1_pusVersion_spare2 = 0x10; | |
472 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
451 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
473 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
452 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
474 | header->destinationID = TM_DESTINATION_ID_GROUND; |
|
453 | header->destinationID = TM_DESTINATION_ID_GROUND; | |
475 | // AUXILIARY DATA HEADER |
|
454 | // AUXILIARY DATA HEADER | |
476 | header->sid = 0x00; |
|
455 | header->sid = 0x00; | |
477 | header->biaStatusInfo = 0x00; |
|
456 | header->biaStatusInfo = 0x00; | |
478 | header->cntASM = 0x00; |
|
457 | header->cntASM = 0x00; | |
479 | header->nrASM = 0x00; |
|
458 | header->nrASM = 0x00; | |
480 | header->time[0] = 0x00; |
|
459 | header->time[0] = 0x00; | |
481 | header->time[0] = 0x00; |
|
460 | header->time[0] = 0x00; | |
482 | header->time[0] = 0x00; |
|
461 | header->time[0] = 0x00; | |
483 | header->time[0] = 0x00; |
|
462 | header->time[0] = 0x00; | |
484 | header->time[0] = 0x00; |
|
463 | header->time[0] = 0x00; | |
485 | header->time[0] = 0x00; |
|
464 | header->time[0] = 0x00; | |
486 | header->blkNr[0] = 0x00; // BLK_NR MSB |
|
465 | header->blkNr[0] = 0x00; // BLK_NR MSB | |
487 | header->blkNr[1] = 0x00; // BLK_NR LSB |
|
466 | header->blkNr[1] = 0x00; // BLK_NR LSB | |
488 | } |
|
467 | } | |
489 |
|
468 | |||
490 | void send_spectral_matrix(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, |
|
469 | void send_spectral_matrix(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, | |
491 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id) |
|
470 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id) | |
492 | { |
|
471 | { | |
493 | unsigned int i; |
|
472 | unsigned int i; | |
494 | unsigned int length = 0; |
|
473 | unsigned int length = 0; | |
495 | rtems_status_code status; |
|
474 | rtems_status_code status; | |
496 |
|
475 | |||
497 | header->sid = (unsigned char) sid; |
|
476 | header->sid = (unsigned char) sid; | |
498 |
|
477 | |||
499 | for (i=0; i<2; i++) |
|
478 | for (i=0; i<2; i++) | |
500 | { |
|
479 | { | |
501 | // BUILD THE DATA |
|
480 | // BUILD THE DATA | |
502 | spw_ioctl_send->dlen = TOTAL_SIZE_SM; |
|
481 | spw_ioctl_send->dlen = TOTAL_SIZE_SM; | |
503 | spw_ioctl_send->data = &spectral_matrix[ i * TOTAL_SIZE_SM]; |
|
482 | spw_ioctl_send->data = &spectral_matrix[ i * TOTAL_SIZE_SM]; | |
504 | spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
483 | spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES; | |
505 | spw_ioctl_send->hdr = (char *) header; |
|
484 | spw_ioctl_send->hdr = (char *) header; | |
506 | spw_ioctl_send->options = 0; |
|
485 | spw_ioctl_send->options = 0; | |
507 |
|
486 | |||
508 | // BUILD THE HEADER |
|
487 | // BUILD THE HEADER | |
509 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM; |
|
488 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM; | |
510 | header->packetLength[0] = (unsigned char) (length>>8); |
|
489 | header->packetLength[0] = (unsigned char) (length>>8); | |
511 | header->packetLength[1] = (unsigned char) (length); |
|
490 | header->packetLength[1] = (unsigned char) (length); | |
512 | header->sid = (unsigned char) sid; // SID |
|
491 | header->sid = (unsigned char) sid; // SID | |
513 | header->cntASM = 2; |
|
492 | header->cntASM = 2; | |
514 | header->nrASM = (unsigned char) (i+1); |
|
493 | header->nrASM = (unsigned char) (i+1); | |
515 | header->blkNr[0] =(unsigned char) ( (NB_BINS_PER_SM/2) >> 8 ); // BLK_NR MSB |
|
494 | header->blkNr[0] =(unsigned char) ( (NB_BINS_PER_SM/2) >> 8 ); // BLK_NR MSB | |
516 | header->blkNr[1] = (unsigned char) (NB_BINS_PER_SM/2); // BLK_NR LSB |
|
495 | header->blkNr[1] = (unsigned char) (NB_BINS_PER_SM/2); // BLK_NR LSB | |
517 | // SET PACKET TIME |
|
496 | // SET PACKET TIME | |
518 | header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
497 | header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
519 | header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
498 | header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
520 | header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
499 | header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
521 | header->time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
500 | header->time[3] = (unsigned char) (time_management_regs->coarse_time); | |
522 | header->time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
501 | header->time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
523 | header->time[5] = (unsigned char) (time_management_regs->fine_time); |
|
502 | header->time[5] = (unsigned char) (time_management_regs->fine_time); | |
524 | header->acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
503 | header->acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
525 | header->acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
504 | header->acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
526 | header->acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
505 | header->acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
527 | header->acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time); |
|
506 | header->acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time); | |
528 | header->acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
507 | header->acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
529 | header->acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time); |
|
508 | header->acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time); | |
530 | // SEND PACKET |
|
509 | // SEND PACKET | |
531 | status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE); |
|
510 | status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE); | |
532 | if (status != RTEMS_SUCCESSFUL) { |
|
511 | if (status != RTEMS_SUCCESSFUL) { | |
533 | printf("in send_spectral_matrix *** ERR %d\n", (int) status); |
|
512 | printf("in send_spectral_matrix *** ERR %d\n", (int) status); | |
534 | } |
|
513 | } | |
535 | } |
|
514 | } | |
536 | } |
|
515 | } | |
537 |
|
516 | |||
538 | void convert_averaged_spectral_matrix( volatile float *input_matrix, char *output_matrix) |
|
517 | void convert_averaged_spectral_matrix( volatile float *input_matrix, char *output_matrix) | |
539 | { |
|
518 | { | |
540 | unsigned int i; |
|
519 | unsigned int i; | |
541 | unsigned int j; |
|
520 | unsigned int j; | |
542 | char * pt_char_input; |
|
521 | char * pt_char_input; | |
543 | char * pt_char_output; |
|
522 | char * pt_char_output; | |
544 |
|
523 | |||
545 | pt_char_input = NULL; |
|
524 | pt_char_input = NULL; | |
546 | pt_char_output = NULL; |
|
525 | pt_char_output = NULL; | |
547 |
|
526 | |||
548 | for( i=0; i<NB_BINS_PER_SM; i++) |
|
527 | for( i=0; i<NB_BINS_PER_SM; i++) | |
549 | { |
|
528 | { | |
550 | for ( j=0; j<NB_VALUES_PER_SM; j++) |
|
529 | for ( j=0; j<NB_VALUES_PER_SM; j++) | |
551 | { |
|
530 | { | |
552 | pt_char_input = (char*) &input_matrix[ (i*NB_VALUES_PER_SM) + j ]; |
|
531 | pt_char_input = (char*) &input_matrix[ (i*NB_VALUES_PER_SM) + j ]; | |
553 | pt_char_output = (char*) &output_matrix[ 2 * ( (i*NB_VALUES_PER_SM) + j ) ]; |
|
532 | pt_char_output = (char*) &output_matrix[ 2 * ( (i*NB_VALUES_PER_SM) + j ) ]; | |
554 | pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float |
|
533 | pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float | |
555 | pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float |
|
534 | pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float | |
556 | } |
|
535 | } | |
557 | } |
|
536 | } | |
558 | } |
|
537 | } | |
559 |
|
538 | |||
560 | void fill_averaged_spectral_matrix(void) |
|
539 | void fill_averaged_spectral_matrix(void) | |
561 | { |
|
540 | { | |
562 | /** This function fills spectral matrices related buffers with arbitrary data. |
|
541 | /** This function fills spectral matrices related buffers with arbitrary data. | |
563 | * |
|
542 | * | |
564 | * This function is for testing purpose only. |
|
543 | * This function is for testing purpose only. | |
565 | * |
|
544 | * | |
566 | */ |
|
545 | */ | |
567 |
|
546 | |||
568 | #ifdef GSA |
|
547 | #ifdef GSA | |
569 | float offset = 10.; |
|
548 | float offset = 10.; | |
570 | float coeff = 100000.; |
|
549 | float coeff = 100000.; | |
571 |
|
550 | |||
572 | averaged_spec_mat_f0[ 0 + 25 * 0 ] = 0. + offset; |
|
551 | averaged_spec_mat_f0[ 0 + 25 * 0 ] = 0. + offset; | |
573 | averaged_spec_mat_f0[ 0 + 25 * 1 ] = 1. + offset; |
|
552 | averaged_spec_mat_f0[ 0 + 25 * 1 ] = 1. + offset; | |
574 | averaged_spec_mat_f0[ 0 + 25 * 2 ] = 2. + offset; |
|
553 | averaged_spec_mat_f0[ 0 + 25 * 2 ] = 2. + offset; | |
575 | averaged_spec_mat_f0[ 0 + 25 * 3 ] = 3. + offset; |
|
554 | averaged_spec_mat_f0[ 0 + 25 * 3 ] = 3. + offset; | |
576 | averaged_spec_mat_f0[ 0 + 25 * 4 ] = 4. + offset; |
|
555 | averaged_spec_mat_f0[ 0 + 25 * 4 ] = 4. + offset; | |
577 | averaged_spec_mat_f0[ 0 + 25 * 5 ] = 5. + offset; |
|
556 | averaged_spec_mat_f0[ 0 + 25 * 5 ] = 5. + offset; | |
578 | averaged_spec_mat_f0[ 0 + 25 * 6 ] = 6. + offset; |
|
557 | averaged_spec_mat_f0[ 0 + 25 * 6 ] = 6. + offset; | |
579 | averaged_spec_mat_f0[ 0 + 25 * 7 ] = 7. + offset; |
|
558 | averaged_spec_mat_f0[ 0 + 25 * 7 ] = 7. + offset; | |
580 | averaged_spec_mat_f0[ 0 + 25 * 8 ] = 8. + offset; |
|
559 | averaged_spec_mat_f0[ 0 + 25 * 8 ] = 8. + offset; | |
581 | averaged_spec_mat_f0[ 0 + 25 * 9 ] = 9. + offset; |
|
560 | averaged_spec_mat_f0[ 0 + 25 * 9 ] = 9. + offset; | |
582 | averaged_spec_mat_f0[ 0 + 25 * 10 ] = 10. + offset; |
|
561 | averaged_spec_mat_f0[ 0 + 25 * 10 ] = 10. + offset; | |
583 | averaged_spec_mat_f0[ 0 + 25 * 11 ] = 11. + offset; |
|
562 | averaged_spec_mat_f0[ 0 + 25 * 11 ] = 11. + offset; | |
584 | averaged_spec_mat_f0[ 0 + 25 * 12 ] = 12. + offset; |
|
563 | averaged_spec_mat_f0[ 0 + 25 * 12 ] = 12. + offset; | |
585 | averaged_spec_mat_f0[ 0 + 25 * 13 ] = 13. + offset; |
|
564 | averaged_spec_mat_f0[ 0 + 25 * 13 ] = 13. + offset; | |
586 | averaged_spec_mat_f0[ 0 + 25 * 14 ] = 14. + offset; |
|
565 | averaged_spec_mat_f0[ 0 + 25 * 14 ] = 14. + offset; | |
587 | averaged_spec_mat_f0[ 9 + 25 * 0 ] = -(0. + offset)* coeff; |
|
566 | averaged_spec_mat_f0[ 9 + 25 * 0 ] = -(0. + offset)* coeff; | |
588 | averaged_spec_mat_f0[ 9 + 25 * 1 ] = -(1. + offset)* coeff; |
|
567 | averaged_spec_mat_f0[ 9 + 25 * 1 ] = -(1. + offset)* coeff; | |
589 | averaged_spec_mat_f0[ 9 + 25 * 2 ] = -(2. + offset)* coeff; |
|
568 | averaged_spec_mat_f0[ 9 + 25 * 2 ] = -(2. + offset)* coeff; | |
590 | averaged_spec_mat_f0[ 9 + 25 * 3 ] = -(3. + offset)* coeff; |
|
569 | averaged_spec_mat_f0[ 9 + 25 * 3 ] = -(3. + offset)* coeff; | |
591 | averaged_spec_mat_f0[ 9 + 25 * 4 ] = -(4. + offset)* coeff; |
|
570 | averaged_spec_mat_f0[ 9 + 25 * 4 ] = -(4. + offset)* coeff; | |
592 | averaged_spec_mat_f0[ 9 + 25 * 5 ] = -(5. + offset)* coeff; |
|
571 | averaged_spec_mat_f0[ 9 + 25 * 5 ] = -(5. + offset)* coeff; | |
593 | averaged_spec_mat_f0[ 9 + 25 * 6 ] = -(6. + offset)* coeff; |
|
572 | averaged_spec_mat_f0[ 9 + 25 * 6 ] = -(6. + offset)* coeff; | |
594 | averaged_spec_mat_f0[ 9 + 25 * 7 ] = -(7. + offset)* coeff; |
|
573 | averaged_spec_mat_f0[ 9 + 25 * 7 ] = -(7. + offset)* coeff; | |
595 | averaged_spec_mat_f0[ 9 + 25 * 8 ] = -(8. + offset)* coeff; |
|
574 | averaged_spec_mat_f0[ 9 + 25 * 8 ] = -(8. + offset)* coeff; | |
596 | averaged_spec_mat_f0[ 9 + 25 * 9 ] = -(9. + offset)* coeff; |
|
575 | averaged_spec_mat_f0[ 9 + 25 * 9 ] = -(9. + offset)* coeff; | |
597 | averaged_spec_mat_f0[ 9 + 25 * 10 ] = -(10. + offset)* coeff; |
|
576 | averaged_spec_mat_f0[ 9 + 25 * 10 ] = -(10. + offset)* coeff; | |
598 | averaged_spec_mat_f0[ 9 + 25 * 11 ] = -(11. + offset)* coeff; |
|
577 | averaged_spec_mat_f0[ 9 + 25 * 11 ] = -(11. + offset)* coeff; | |
599 | averaged_spec_mat_f0[ 9 + 25 * 12 ] = -(12. + offset)* coeff; |
|
578 | averaged_spec_mat_f0[ 9 + 25 * 12 ] = -(12. + offset)* coeff; | |
600 | averaged_spec_mat_f0[ 9 + 25 * 13 ] = -(13. + offset)* coeff; |
|
579 | averaged_spec_mat_f0[ 9 + 25 * 13 ] = -(13. + offset)* coeff; | |
601 | averaged_spec_mat_f0[ 9 + 25 * 14 ] = -(14. + offset)* coeff; |
|
580 | averaged_spec_mat_f0[ 9 + 25 * 14 ] = -(14. + offset)* coeff; | |
602 | offset = 10000000; |
|
581 | offset = 10000000; | |
603 | averaged_spec_mat_f0[ 16 + 25 * 0 ] = (0. + offset)* coeff; |
|
582 | averaged_spec_mat_f0[ 16 + 25 * 0 ] = (0. + offset)* coeff; | |
604 | averaged_spec_mat_f0[ 16 + 25 * 1 ] = (1. + offset)* coeff; |
|
583 | averaged_spec_mat_f0[ 16 + 25 * 1 ] = (1. + offset)* coeff; | |
605 | averaged_spec_mat_f0[ 16 + 25 * 2 ] = (2. + offset)* coeff; |
|
584 | averaged_spec_mat_f0[ 16 + 25 * 2 ] = (2. + offset)* coeff; | |
606 | averaged_spec_mat_f0[ 16 + 25 * 3 ] = (3. + offset)* coeff; |
|
585 | averaged_spec_mat_f0[ 16 + 25 * 3 ] = (3. + offset)* coeff; | |
607 | averaged_spec_mat_f0[ 16 + 25 * 4 ] = (4. + offset)* coeff; |
|
586 | averaged_spec_mat_f0[ 16 + 25 * 4 ] = (4. + offset)* coeff; | |
608 | averaged_spec_mat_f0[ 16 + 25 * 5 ] = (5. + offset)* coeff; |
|
587 | averaged_spec_mat_f0[ 16 + 25 * 5 ] = (5. + offset)* coeff; | |
609 | averaged_spec_mat_f0[ 16 + 25 * 6 ] = (6. + offset)* coeff; |
|
588 | averaged_spec_mat_f0[ 16 + 25 * 6 ] = (6. + offset)* coeff; | |
610 | averaged_spec_mat_f0[ 16 + 25 * 7 ] = (7. + offset)* coeff; |
|
589 | averaged_spec_mat_f0[ 16 + 25 * 7 ] = (7. + offset)* coeff; | |
611 | averaged_spec_mat_f0[ 16 + 25 * 8 ] = (8. + offset)* coeff; |
|
590 | averaged_spec_mat_f0[ 16 + 25 * 8 ] = (8. + offset)* coeff; | |
612 | averaged_spec_mat_f0[ 16 + 25 * 9 ] = (9. + offset)* coeff; |
|
591 | averaged_spec_mat_f0[ 16 + 25 * 9 ] = (9. + offset)* coeff; | |
613 | averaged_spec_mat_f0[ 16 + 25 * 10 ] = (10. + offset)* coeff; |
|
592 | averaged_spec_mat_f0[ 16 + 25 * 10 ] = (10. + offset)* coeff; | |
614 | averaged_spec_mat_f0[ 16 + 25 * 11 ] = (11. + offset)* coeff; |
|
593 | averaged_spec_mat_f0[ 16 + 25 * 11 ] = (11. + offset)* coeff; | |
615 | averaged_spec_mat_f0[ 16 + 25 * 12 ] = (12. + offset)* coeff; |
|
594 | averaged_spec_mat_f0[ 16 + 25 * 12 ] = (12. + offset)* coeff; | |
616 | averaged_spec_mat_f0[ 16 + 25 * 13 ] = (13. + offset)* coeff; |
|
595 | averaged_spec_mat_f0[ 16 + 25 * 13 ] = (13. + offset)* coeff; | |
617 | averaged_spec_mat_f0[ 16 + 25 * 14 ] = (14. + offset)* coeff; |
|
596 | averaged_spec_mat_f0[ 16 + 25 * 14 ] = (14. + offset)* coeff; | |
618 |
|
597 | |||
619 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 0 ] = averaged_spec_mat_f0[ 0 ]; |
|
598 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 0 ] = averaged_spec_mat_f0[ 0 ]; | |
620 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 1 ] = averaged_spec_mat_f0[ 1 ]; |
|
599 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 1 ] = averaged_spec_mat_f0[ 1 ]; | |
621 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 2 ] = averaged_spec_mat_f0[ 2 ]; |
|
600 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 2 ] = averaged_spec_mat_f0[ 2 ]; | |
622 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 3 ] = averaged_spec_mat_f0[ 3 ]; |
|
601 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 3 ] = averaged_spec_mat_f0[ 3 ]; | |
623 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 4 ] = averaged_spec_mat_f0[ 4 ]; |
|
602 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 4 ] = averaged_spec_mat_f0[ 4 ]; | |
624 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 5 ] = averaged_spec_mat_f0[ 5 ]; |
|
603 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 5 ] = averaged_spec_mat_f0[ 5 ]; | |
625 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 6 ] = averaged_spec_mat_f0[ 6 ]; |
|
604 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 6 ] = averaged_spec_mat_f0[ 6 ]; | |
626 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 7 ] = averaged_spec_mat_f0[ 7 ]; |
|
605 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 7 ] = averaged_spec_mat_f0[ 7 ]; | |
627 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 8 ] = averaged_spec_mat_f0[ 8 ]; |
|
606 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 8 ] = averaged_spec_mat_f0[ 8 ]; | |
628 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 9 ] = averaged_spec_mat_f0[ 9 ]; |
|
607 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 9 ] = averaged_spec_mat_f0[ 9 ]; | |
629 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 10 ] = averaged_spec_mat_f0[ 10 ]; |
|
608 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 10 ] = averaged_spec_mat_f0[ 10 ]; | |
630 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 11 ] = averaged_spec_mat_f0[ 11 ]; |
|
609 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 11 ] = averaged_spec_mat_f0[ 11 ]; | |
631 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 12 ] = averaged_spec_mat_f0[ 12 ]; |
|
610 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 12 ] = averaged_spec_mat_f0[ 12 ]; | |
632 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 13 ] = averaged_spec_mat_f0[ 13 ]; |
|
611 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 13 ] = averaged_spec_mat_f0[ 13 ]; | |
633 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 14 ] = averaged_spec_mat_f0[ 14 ]; |
|
612 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 14 ] = averaged_spec_mat_f0[ 14 ]; | |
634 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 15 ] = averaged_spec_mat_f0[ 15 ]; |
|
613 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 15 ] = averaged_spec_mat_f0[ 15 ]; | |
635 | #else |
|
614 | #else | |
636 | unsigned int i; |
|
615 | unsigned int i; | |
637 |
|
616 | |||
638 | for(i=0; i<TOTAL_SIZE_SM; i++) |
|
617 | for(i=0; i<TOTAL_SIZE_SM; i++) | |
639 | { |
|
618 | { | |
640 | if (spectral_matrix_regs->matrixF0_Address0 == (int) spec_mat_f0_0) |
|
619 | if (spectral_matrix_regs->matrixF0_Address0 == (int) spec_mat_f0_0) | |
641 | averaged_spec_mat_f0[i] = (float) spec_mat_f0_0_bis[ SM_HEADER + i ]; |
|
620 | averaged_spec_mat_f0[i] = (float) spec_mat_f0_0_bis[ SM_HEADER + i ]; | |
642 | else |
|
621 | else | |
643 | averaged_spec_mat_f0[i] = (float) spec_mat_f0_0[ SM_HEADER + i ]; |
|
622 | averaged_spec_mat_f0[i] = (float) spec_mat_f0_0[ SM_HEADER + i ]; | |
644 | } |
|
623 | } | |
645 | #endif |
|
624 | #endif | |
646 | } |
|
625 | } | |
647 |
|
626 | |||
648 | void reset_spectral_matrix_regs() |
|
627 | void reset_spectral_matrix_regs() | |
649 | { |
|
628 | { | |
650 | /** This function resets the spectral matrices module registers. |
|
629 | /** This function resets the spectral matrices module registers. | |
651 | * |
|
630 | * | |
652 | * The registers affected by this function are located at the following offset addresses: |
|
631 | * The registers affected by this function are located at the following offset addresses: | |
653 | * |
|
632 | * | |
654 | * - 0x00 config |
|
633 | * - 0x00 config | |
655 | * - 0x04 status |
|
634 | * - 0x04 status | |
656 | * - 0x08 matrixF0_Address0 |
|
635 | * - 0x08 matrixF0_Address0 | |
657 | * - 0x10 matrixFO_Address1 |
|
636 | * - 0x10 matrixFO_Address1 | |
658 | * - 0x14 matrixF1_Address |
|
637 | * - 0x14 matrixF1_Address | |
659 | * - 0x18 matrixF2_Address |
|
638 | * - 0x18 matrixF2_Address | |
660 | * |
|
639 | * | |
661 | */ |
|
640 | */ | |
662 |
|
641 | |||
663 | #ifdef GSA |
|
642 | #ifdef GSA | |
664 | #else |
|
643 | #else | |
665 | spectral_matrix_regs->matrixF0_Address0 = (int) spec_mat_f0_0; |
|
644 | spectral_matrix_regs->matrixF0_Address0 = (int) spec_mat_f0_0; | |
666 | spectral_matrix_regs->matrixFO_Address1 = (int) spec_mat_f0_1; |
|
645 | spectral_matrix_regs->matrixFO_Address1 = (int) spec_mat_f0_1; | |
667 | spectral_matrix_regs->matrixF1_Address = (int) spec_mat_f1; |
|
646 | spectral_matrix_regs->matrixF1_Address = (int) spec_mat_f1; | |
668 | spectral_matrix_regs->matrixF2_Address = (int) spec_mat_f2; |
|
647 | spectral_matrix_regs->matrixF2_Address = (int) spec_mat_f2; | |
669 | #endif |
|
648 | #endif | |
670 | } |
|
649 | } | |
671 |
|
650 | |||
672 | //****************** |
|
651 | //****************** | |
673 | // general functions |
|
652 | // general functions | |
674 |
|
653 | |||
675 |
|
654 | |||
676 |
|
655 | |||
677 |
|
656 |
@@ -1,626 +1,624 | |||||
1 | /** Functions related to the SpaceWire interface. |
|
1 | /** Functions related to the SpaceWire interface. | |
2 | * |
|
2 | * | |
3 | * @file |
|
3 | * @file | |
4 | * @author P. LEROY |
|
4 | * @author P. LEROY | |
5 | * |
|
5 | * | |
6 | * A group of functions to handle SpaceWire transmissions: |
|
6 | * A group of functions to handle SpaceWire transmissions: | |
7 | * - configuration of the SpaceWire link |
|
7 | * - configuration of the SpaceWire link | |
8 | * - SpaceWire related interruption requests processing |
|
8 | * - SpaceWire related interruption requests processing | |
9 | * - transmission of TeleMetry packets by a dedicated RTEMS task |
|
9 | * - transmission of TeleMetry packets by a dedicated RTEMS task | |
10 | * - reception of TeleCommands by a dedicated RTEMS task |
|
10 | * - reception of TeleCommands by a dedicated RTEMS task | |
11 | * |
|
11 | * | |
12 | */ |
|
12 | */ | |
13 |
|
13 | |||
14 | #include "fsw_spacewire.h" |
|
14 | #include "fsw_spacewire.h" | |
15 |
|
15 | |||
16 | char *lstates[6] = {"Error-reset", |
|
|||
17 | "Error-wait", |
|
|||
18 | "Ready", |
|
|||
19 | "Started", |
|
|||
20 | "Connecting", |
|
|||
21 | "Run" |
|
|||
22 | }; |
|
|||
23 |
|
||||
24 | rtems_name semq_name; |
|
16 | rtems_name semq_name; | |
25 | rtems_id semq_id; |
|
17 | rtems_id semq_id; | |
26 |
|
18 | |||
27 | //*********** |
|
19 | //*********** | |
28 | // RTEMS TASK |
|
20 | // RTEMS TASK | |
29 | rtems_task spiq_task(rtems_task_argument unused) |
|
21 | rtems_task spiq_task(rtems_task_argument unused) | |
30 | { |
|
22 | { | |
31 | /** This RTEMS task is awaken by an rtems_event sent by the interruption subroutine of the SpaceWire driver. |
|
23 | /** This RTEMS task is awaken by an rtems_event sent by the interruption subroutine of the SpaceWire driver. | |
32 | * |
|
24 | * | |
33 | * @param unused is the starting argument of the RTEMS task |
|
25 | * @param unused is the starting argument of the RTEMS task | |
34 | * |
|
26 | * | |
35 | */ |
|
27 | */ | |
36 |
|
28 | |||
37 | rtems_event_set event_out; |
|
29 | rtems_event_set event_out; | |
38 | rtems_status_code status; |
|
30 | rtems_status_code status; | |
39 | int linkStatus; |
|
31 | int linkStatus; | |
40 |
|
32 | |||
41 | BOOT_PRINTF("in SPIQ *** \n") |
|
33 | BOOT_PRINTF("in SPIQ *** \n") | |
42 |
|
34 | |||
43 | while(true){ |
|
35 | while(true){ | |
44 | rtems_event_receive(SPW_LINKERR_EVENT, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an SPW_LINKERR_EVENT |
|
36 | rtems_event_receive(SPW_LINKERR_EVENT, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an SPW_LINKERR_EVENT | |
45 | PRINTF("in SPIQ *** got SPW_LINKERR_EVENT\n") |
|
37 | PRINTF("in SPIQ *** got SPW_LINKERR_EVENT\n") | |
46 |
|
38 | |||
47 | // [0] SUSPEND RECV AND SEND TASKS |
|
39 | // [0] SUSPEND RECV AND SEND TASKS | |
48 | rtems_task_suspend( Task_id[ TASKID_RECV ] ); |
|
40 | status = rtems_task_suspend( Task_id[ TASKID_RECV ] ); | |
49 | rtems_task_suspend( Task_id[ TASKID_SEND ] ); |
|
41 | if ( status != RTEMS_SUCCESSFUL ) { | |
|
42 | PRINTF("in SPIQ *** ERR suspending RECV Task\n") | |||
|
43 | } | |||
|
44 | status = rtems_task_suspend( Task_id[ TASKID_SEND ] ); | |||
|
45 | if ( status != RTEMS_SUCCESSFUL ) { | |||
|
46 | PRINTF("in SPIQ *** ERR suspending SEND Task\n") | |||
|
47 | } | |||
50 |
|
48 | |||
51 | // [1] CHECK THE LINK |
|
49 | // [1] CHECK THE LINK | |
52 | ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status (1) |
|
50 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status (1) | |
53 | if ( linkStatus != 5) { |
|
51 | if ( linkStatus != 5) { | |
54 | PRINTF1("in SPIQ *** linkStatus %d, wait...\n", linkStatus) |
|
52 | PRINTF1("in SPIQ *** linkStatus %d, wait...\n", linkStatus) | |
55 | rtems_task_wake_after( SY_LFR_DPU_CONNECT_TIMEOUT ); // wait SY_LFR_DPU_CONNECT_TIMEOUT 1000 ms |
|
53 | status = rtems_task_wake_after( SY_LFR_DPU_CONNECT_TIMEOUT ); // wait SY_LFR_DPU_CONNECT_TIMEOUT 1000 ms | |
56 | } |
|
54 | } | |
57 |
|
55 | |||
58 | // [2] RECHECK THE LINK AFTER SY_LFR_DPU_CONNECT_TIMEOUT |
|
56 | // [2] RECHECK THE LINK AFTER SY_LFR_DPU_CONNECT_TIMEOUT | |
59 | ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status (2) |
|
57 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status (2) | |
60 | if ( linkStatus != 5 ) // [2.a] not in run state, reset the link |
|
58 | if ( linkStatus != 5 ) // [2.a] not in run state, reset the link | |
61 | { |
|
59 | { | |
62 | spacewire_compute_stats_offsets(); |
|
60 | spacewire_compute_stats_offsets(); | |
63 | status = spacewire_reset_link( ); |
|
61 | status = spacewire_reset_link( ); | |
64 | } |
|
62 | } | |
65 | else // [2.b] in run state, start the link |
|
63 | else // [2.b] in run state, start the link | |
66 | { |
|
64 | { | |
67 | status = spacewire_stop_start_link( fdSPW ); // start the link |
|
65 | status = spacewire_stop_start_link( fdSPW ); // start the link | |
68 | if ( status != RTEMS_SUCCESSFUL) |
|
66 | if ( status != RTEMS_SUCCESSFUL) | |
69 | { |
|
67 | { | |
70 | PRINTF1("in SPIQ *** ERR spacewire_start_link %d\n", status) |
|
68 | PRINTF1("in SPIQ *** ERR spacewire_start_link %d\n", status) | |
71 | } |
|
69 | } | |
72 | } |
|
70 | } | |
73 |
|
71 | |||
74 | // [3] COMPLETE RECOVERY ACTION AFTER SY_LFR_DPU_CONNECT_ATTEMPTS |
|
72 | // [3] COMPLETE RECOVERY ACTION AFTER SY_LFR_DPU_CONNECT_ATTEMPTS | |
75 | if ( status == RTEMS_SUCCESSFUL ) // [3.a] the link is in run state and has been started successfully |
|
73 | if ( status == RTEMS_SUCCESSFUL ) // [3.a] the link is in run state and has been started successfully | |
76 | { |
|
74 | { | |
77 | status = rtems_task_restart( Task_id[ TASKID_SEND ], 1 ); |
|
75 | status = rtems_task_restart( Task_id[ TASKID_SEND ], 1 ); | |
78 | if ( status != RTEMS_SUCCESSFUL ) { |
|
76 | if ( status != RTEMS_SUCCESSFUL ) { | |
79 | PRINTF("in SPIQ *** ERR resuming SEND Task\n") |
|
77 | PRINTF("in SPIQ *** ERR resuming SEND Task\n") | |
80 | } |
|
78 | } | |
81 | status = rtems_task_restart( Task_id[ TASKID_RECV ], 1 ); |
|
79 | status = rtems_task_restart( Task_id[ TASKID_RECV ], 1 ); | |
82 | if ( status != RTEMS_SUCCESSFUL ) { |
|
80 | if ( status != RTEMS_SUCCESSFUL ) { | |
83 | PRINTF("in SPIQ *** ERR resuming RECV Task\n") |
|
81 | PRINTF("in SPIQ *** ERR resuming RECV Task\n") | |
84 | } |
|
82 | } | |
85 | } |
|
83 | } | |
86 | else // [3.b] the link is not in run state, go in STANDBY mode |
|
84 | else // [3.b] the link is not in run state, go in STANDBY mode | |
87 | { |
|
85 | { | |
88 | status = stop_current_mode(); |
|
86 | status = stop_current_mode(); | |
89 | if ( status != RTEMS_SUCCESSFUL ) { |
|
87 | if ( status != RTEMS_SUCCESSFUL ) { | |
90 | PRINTF1("in SPIQ *** ERR stop_current_mode *** code %d\n", status) |
|
88 | PRINTF1("in SPIQ *** ERR stop_current_mode *** code %d\n", status) | |
91 | } |
|
89 | } | |
92 | status = enter_standby_mode(); |
|
90 | status = enter_standby_mode(); | |
93 | if ( status != RTEMS_SUCCESSFUL ) { |
|
91 | if ( status != RTEMS_SUCCESSFUL ) { | |
94 | PRINTF1("in SPIQ *** ERR enter_standby_mode *** code %d\n", status) |
|
92 | PRINTF1("in SPIQ *** ERR enter_standby_mode *** code %d\n", status) | |
95 | } |
|
93 | } | |
96 | // wake the WTDG task up to wait for the link recovery |
|
94 | // wake the WTDG task up to wait for the link recovery | |
97 | status = rtems_event_send ( Task_id[TASKID_WTDG], RTEMS_EVENT_0 ); |
|
95 | status = rtems_event_send ( Task_id[TASKID_WTDG], RTEMS_EVENT_0 ); | |
98 | rtems_task_suspend( RTEMS_SELF ); |
|
96 | status = rtems_task_suspend( RTEMS_SELF ); | |
99 | } |
|
97 | } | |
100 | } |
|
98 | } | |
101 | } |
|
99 | } | |
102 |
|
100 | |||
103 | rtems_task recv_task( rtems_task_argument unused ) |
|
101 | rtems_task recv_task( rtems_task_argument unused ) | |
104 | { |
|
102 | { | |
105 | /** This RTEMS task is dedicated to the reception of incoming TeleCommands. |
|
103 | /** This RTEMS task is dedicated to the reception of incoming TeleCommands. | |
106 | * |
|
104 | * | |
107 | * @param unused is the starting argument of the RTEMS task |
|
105 | * @param unused is the starting argument of the RTEMS task | |
108 | * |
|
106 | * | |
109 | * The RECV task blocks on a call to the read system call, waiting for incoming SpaceWire data. When unblocked: |
|
107 | * The RECV task blocks on a call to the read system call, waiting for incoming SpaceWire data. When unblocked: | |
110 | * 1. It reads the incoming data. |
|
108 | * 1. It reads the incoming data. | |
111 | * 2. Launches the acceptance procedure. |
|
109 | * 2. Launches the acceptance procedure. | |
112 | * 3. If the Telecommand is valid, sends it to a dedicated RTEMS message queue. |
|
110 | * 3. If the Telecommand is valid, sends it to a dedicated RTEMS message queue. | |
113 | * |
|
111 | * | |
114 | */ |
|
112 | */ | |
115 |
|
113 | |||
116 | int len; |
|
114 | int len; | |
117 | ccsdsTelecommandPacket_t currentTC; |
|
115 | ccsdsTelecommandPacket_t currentTC; | |
118 | unsigned char computed_CRC[ 2 ]; |
|
116 | unsigned char computed_CRC[ 2 ]; | |
119 | unsigned char currentTC_LEN_RCV[ 2 ]; |
|
117 | unsigned char currentTC_LEN_RCV[ 2 ]; | |
120 | unsigned char destinationID; |
|
118 | unsigned char destinationID; | |
121 | unsigned int currentTC_LEN_RCV_AsUnsignedInt; |
|
119 | unsigned int currentTC_LEN_RCV_AsUnsignedInt; | |
122 | unsigned int parserCode; |
|
120 | unsigned int parserCode; | |
123 | unsigned char time[6]; |
|
121 | unsigned char time[6]; | |
124 | rtems_status_code status; |
|
122 | rtems_status_code status; | |
125 | rtems_id queue_recv_id; |
|
123 | rtems_id queue_recv_id; | |
126 | rtems_id queue_send_id; |
|
124 | rtems_id queue_send_id; | |
127 |
|
125 | |||
128 | initLookUpTableForCRC(); // the table is used to compute Cyclic Redundancy Codes |
|
126 | initLookUpTableForCRC(); // the table is used to compute Cyclic Redundancy Codes | |
129 |
|
127 | |||
130 | status = rtems_message_queue_ident( misc_name[QUEUE_RECV], 0, &queue_recv_id ); |
|
128 | status = rtems_message_queue_ident( misc_name[QUEUE_RECV], 0, &queue_recv_id ); | |
131 | if (status != RTEMS_SUCCESSFUL) |
|
129 | if (status != RTEMS_SUCCESSFUL) | |
132 | { |
|
130 | { | |
133 | PRINTF1("in RECV *** ERR getting QUEUE_RECV id, %d\n", status) |
|
131 | PRINTF1("in RECV *** ERR getting QUEUE_RECV id, %d\n", status) | |
134 | } |
|
132 | } | |
135 |
|
133 | |||
136 | status = rtems_message_queue_ident( misc_name[QUEUE_SEND], 0, &queue_send_id ); |
|
134 | status = rtems_message_queue_ident( misc_name[QUEUE_SEND], 0, &queue_send_id ); | |
137 | if (status != RTEMS_SUCCESSFUL) |
|
135 | if (status != RTEMS_SUCCESSFUL) | |
138 | { |
|
136 | { | |
139 | PRINTF1("in RECV *** ERR getting QUEUE_SEND id, %d\n", status) |
|
137 | PRINTF1("in RECV *** ERR getting QUEUE_SEND id, %d\n", status) | |
140 | } |
|
138 | } | |
141 |
|
139 | |||
142 | BOOT_PRINTF("in RECV *** \n") |
|
140 | BOOT_PRINTF("in RECV *** \n") | |
143 |
|
141 | |||
144 | while(1) |
|
142 | while(1) | |
145 | { |
|
143 | { | |
146 | len = read( fdSPW, (char*) ¤tTC, CCSDS_TC_PKT_MAX_SIZE ); // the call to read is blocking |
|
144 | len = read( fdSPW, (char*) ¤tTC, CCSDS_TC_PKT_MAX_SIZE ); // the call to read is blocking | |
147 | if (len == -1){ // error during the read call |
|
145 | if (len == -1){ // error during the read call | |
148 | PRINTF1("in RECV *** last read call returned -1, ERRNO %d\n", errno) |
|
146 | PRINTF1("in RECV *** last read call returned -1, ERRNO %d\n", errno) | |
149 | } |
|
147 | } | |
150 | else { |
|
148 | else { | |
151 | if ( (len+1) < CCSDS_TC_PKT_MIN_SIZE ) { |
|
149 | if ( (len+1) < CCSDS_TC_PKT_MIN_SIZE ) { | |
152 | PRINTF("in RECV *** packet lenght too short\n") |
|
150 | PRINTF("in RECV *** packet lenght too short\n") | |
153 | } |
|
151 | } | |
154 | else { |
|
152 | else { | |
155 | currentTC_LEN_RCV_AsUnsignedInt = (unsigned int) (len - CCSDS_TC_TM_PACKET_OFFSET - 3); // => -3 is for Prot ID, Reserved and User App bytes |
|
153 | currentTC_LEN_RCV_AsUnsignedInt = (unsigned int) (len - CCSDS_TC_TM_PACKET_OFFSET - 3); // => -3 is for Prot ID, Reserved and User App bytes | |
156 | currentTC_LEN_RCV[ 0 ] = (unsigned char) (currentTC_LEN_RCV_AsUnsignedInt >> 8); |
|
154 | currentTC_LEN_RCV[ 0 ] = (unsigned char) (currentTC_LEN_RCV_AsUnsignedInt >> 8); | |
157 | currentTC_LEN_RCV[ 1 ] = (unsigned char) (currentTC_LEN_RCV_AsUnsignedInt ); |
|
155 | currentTC_LEN_RCV[ 1 ] = (unsigned char) (currentTC_LEN_RCV_AsUnsignedInt ); | |
158 | // CHECK THE TC |
|
156 | // CHECK THE TC | |
159 | parserCode = tc_parser( ¤tTC, currentTC_LEN_RCV_AsUnsignedInt, computed_CRC ) ; |
|
157 | parserCode = tc_parser( ¤tTC, currentTC_LEN_RCV_AsUnsignedInt, computed_CRC ) ; | |
160 | if ( (parserCode == ILLEGAL_APID) || (parserCode == WRONG_LEN_PKT) |
|
158 | if ( (parserCode == ILLEGAL_APID) || (parserCode == WRONG_LEN_PKT) | |
161 | || (parserCode == INCOR_CHECKSUM) || (parserCode == ILL_TYPE) |
|
159 | || (parserCode == INCOR_CHECKSUM) || (parserCode == ILL_TYPE) | |
162 | || (parserCode == ILL_SUBTYPE) || (parserCode == WRONG_APP_DATA) |
|
160 | || (parserCode == ILL_SUBTYPE) || (parserCode == WRONG_APP_DATA) | |
163 | || (parserCode == WRONG_SRC_ID) ) |
|
161 | || (parserCode == WRONG_SRC_ID) ) | |
164 | { // send TM_LFR_TC_EXE_CORRUPTED |
|
162 | { // send TM_LFR_TC_EXE_CORRUPTED | |
165 | if ( !( (currentTC.serviceType==TC_TYPE_TIME) && (currentTC.serviceSubType==TC_SUBTYPE_UPDT_TIME) ) |
|
163 | if ( !( (currentTC.serviceType==TC_TYPE_TIME) && (currentTC.serviceSubType==TC_SUBTYPE_UPDT_TIME) ) | |
166 | && |
|
164 | && | |
167 | !( (currentTC.serviceType==TC_TYPE_GEN) && (currentTC.serviceSubType==TC_SUBTYPE_UPDT_INFO)) |
|
165 | !( (currentTC.serviceType==TC_TYPE_GEN) && (currentTC.serviceSubType==TC_SUBTYPE_UPDT_INFO)) | |
168 | ) |
|
166 | ) | |
169 | { |
|
167 | { | |
170 | if ( parserCode == WRONG_SRC_ID ) |
|
168 | if ( parserCode == WRONG_SRC_ID ) | |
171 | { |
|
169 | { | |
172 | destinationID = SID_TC_GROUND; |
|
170 | destinationID = SID_TC_GROUND; | |
173 | } |
|
171 | } | |
174 | else |
|
172 | else | |
175 | { |
|
173 | { | |
176 | destinationID = currentTC.sourceID; |
|
174 | destinationID = currentTC.sourceID; | |
177 | } |
|
175 | } | |
178 | getTime( time ); |
|
176 | getTime( time ); | |
179 | close_action( ¤tTC, LFR_DEFAULT, queue_send_id, time); |
|
177 | close_action( ¤tTC, LFR_DEFAULT, queue_send_id, time); | |
180 | send_tm_lfr_tc_exe_corrupted( ¤tTC, queue_send_id, |
|
178 | send_tm_lfr_tc_exe_corrupted( ¤tTC, queue_send_id, | |
181 | computed_CRC, currentTC_LEN_RCV, |
|
179 | computed_CRC, currentTC_LEN_RCV, | |
182 | destinationID, time ); |
|
180 | destinationID, time ); | |
183 | } |
|
181 | } | |
184 | } |
|
182 | } | |
185 | else |
|
183 | else | |
186 | { // send valid TC to the action launcher |
|
184 | { // send valid TC to the action launcher | |
187 | status = rtems_message_queue_send( queue_recv_id, ¤tTC, |
|
185 | status = rtems_message_queue_send( queue_recv_id, ¤tTC, | |
188 | currentTC_LEN_RCV_AsUnsignedInt + CCSDS_TC_TM_PACKET_OFFSET + 3); |
|
186 | currentTC_LEN_RCV_AsUnsignedInt + CCSDS_TC_TM_PACKET_OFFSET + 3); | |
189 | } |
|
187 | } | |
190 | } |
|
188 | } | |
191 | } |
|
189 | } | |
192 | } |
|
190 | } | |
193 | } |
|
191 | } | |
194 |
|
192 | |||
195 | rtems_task send_task( rtems_task_argument argument) |
|
193 | rtems_task send_task( rtems_task_argument argument) | |
196 | { |
|
194 | { | |
197 | /** This RTEMS task is dedicated to the transmission of TeleMetry packets. |
|
195 | /** This RTEMS task is dedicated to the transmission of TeleMetry packets. | |
198 | * |
|
196 | * | |
199 | * @param unused is the starting argument of the RTEMS task |
|
197 | * @param unused is the starting argument of the RTEMS task | |
200 | * |
|
198 | * | |
201 | * The SEND task waits for a message to become available in the dedicated RTEMS queue. When a message arrives: |
|
199 | * The SEND task waits for a message to become available in the dedicated RTEMS queue. When a message arrives: | |
202 | * - if the first byte is equal to CCSDS_DESTINATION_ID, the message is sent as is using the write system call. |
|
200 | * - if the first byte is equal to CCSDS_DESTINATION_ID, the message is sent as is using the write system call. | |
203 | * - if the first byte is not equal to CCSDS_DESTINATION_ID, the message is handled as a spw_ioctl_pkt_send. After |
|
201 | * - if the first byte is not equal to CCSDS_DESTINATION_ID, the message is handled as a spw_ioctl_pkt_send. After | |
204 | * analyzis, the packet is sent either using the write system call or using the ioctl call SPACEWIRE_IOCTRL_SEND, depending on the |
|
202 | * analyzis, the packet is sent either using the write system call or using the ioctl call SPACEWIRE_IOCTRL_SEND, depending on the | |
205 | * data it contains. |
|
203 | * data it contains. | |
206 | * |
|
204 | * | |
207 | */ |
|
205 | */ | |
208 |
|
206 | |||
209 | rtems_status_code status; // RTEMS status code |
|
207 | rtems_status_code status; // RTEMS status code | |
210 | char incomingData[ACTION_MSG_PKTS_MAX_SIZE]; // incoming data buffer |
|
208 | char incomingData[ACTION_MSG_PKTS_MAX_SIZE]; // incoming data buffer | |
211 | spw_ioctl_pkt_send *spw_ioctl_send; |
|
209 | spw_ioctl_pkt_send *spw_ioctl_send; | |
212 | size_t size; // size of the incoming TC packet |
|
210 | size_t size; // size of the incoming TC packet | |
213 | u_int32_t count; |
|
211 | u_int32_t count; | |
214 | rtems_id queue_id; |
|
212 | rtems_id queue_id; | |
215 |
|
213 | |||
216 | status = rtems_message_queue_ident( misc_name[QUEUE_SEND], 0, &queue_id ); |
|
214 | status = rtems_message_queue_ident( misc_name[QUEUE_SEND], 0, &queue_id ); | |
217 | if (status != RTEMS_SUCCESSFUL) |
|
215 | if (status != RTEMS_SUCCESSFUL) | |
218 | { |
|
216 | { | |
219 | PRINTF1("in SEND *** ERR getting queue id, %d\n", status) |
|
217 | PRINTF1("in SEND *** ERR getting queue id, %d\n", status) | |
220 | } |
|
218 | } | |
221 |
|
219 | |||
222 | BOOT_PRINTF("in SEND *** \n") |
|
220 | BOOT_PRINTF("in SEND *** \n") | |
223 |
|
221 | |||
224 | while(1) |
|
222 | while(1) | |
225 | { |
|
223 | { | |
226 | status = rtems_message_queue_receive( queue_id, incomingData, &size, |
|
224 | status = rtems_message_queue_receive( queue_id, incomingData, &size, | |
227 | RTEMS_WAIT, RTEMS_NO_TIMEOUT ); |
|
225 | RTEMS_WAIT, RTEMS_NO_TIMEOUT ); | |
228 |
|
226 | |||
229 | if (status!=RTEMS_SUCCESSFUL) |
|
227 | if (status!=RTEMS_SUCCESSFUL) | |
230 | { |
|
228 | { | |
231 | PRINTF1("in SEND *** (1) ERR = %d\n", status) |
|
229 | PRINTF1("in SEND *** (1) ERR = %d\n", status) | |
232 | } |
|
230 | } | |
233 | else |
|
231 | else | |
234 | { |
|
232 | { | |
235 | if ( incomingData[0] == CCSDS_DESTINATION_ID) // the incoming message is a ccsds packet |
|
233 | if ( incomingData[0] == CCSDS_DESTINATION_ID) // the incoming message is a ccsds packet | |
236 | { |
|
234 | { | |
237 | status = write( fdSPW, incomingData, size ); |
|
235 | status = write( fdSPW, incomingData, size ); | |
238 | if (status == -1){ |
|
236 | if (status == -1){ | |
239 | PRINTF2("in SEND *** (2.a) ERRNO = %d, size = %d\n", errno, size) |
|
237 | PRINTF2("in SEND *** (2.a) ERRNO = %d, size = %d\n", errno, size) | |
240 | } |
|
238 | } | |
241 | } |
|
239 | } | |
242 | else // the incoming message is a spw_ioctl_pkt_send structure |
|
240 | else // the incoming message is a spw_ioctl_pkt_send structure | |
243 | { |
|
241 | { | |
244 | spw_ioctl_send = (spw_ioctl_pkt_send*) incomingData; |
|
242 | spw_ioctl_send = (spw_ioctl_pkt_send*) incomingData; | |
245 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, spw_ioctl_send ); |
|
243 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, spw_ioctl_send ); | |
246 | if (status == -1){ |
|
244 | if (status == -1){ | |
247 | PRINTF2("in SEND *** (2.b) ERRNO = %d, RTEMS = %d\n", errno, status) |
|
245 | PRINTF2("in SEND *** (2.b) ERRNO = %d, RTEMS = %d\n", errno, status) | |
248 | } |
|
246 | } | |
249 | } |
|
247 | } | |
250 | } |
|
248 | } | |
251 |
|
249 | |||
252 | status = rtems_message_queue_get_number_pending( queue_id, &count ); |
|
250 | status = rtems_message_queue_get_number_pending( queue_id, &count ); | |
253 | if (status != RTEMS_SUCCESSFUL) |
|
251 | if (status != RTEMS_SUCCESSFUL) | |
254 | { |
|
252 | { | |
255 | PRINTF1("in SEND *** (3) ERR = %d\n", status) |
|
253 | PRINTF1("in SEND *** (3) ERR = %d\n", status) | |
256 | } |
|
254 | } | |
257 | else |
|
255 | else | |
258 | { |
|
256 | { | |
259 | if (count > maxCount) |
|
257 | if (count > maxCount) | |
260 | { |
|
258 | { | |
261 | maxCount = count; |
|
259 | maxCount = count; | |
262 | } |
|
260 | } | |
263 | } |
|
261 | } | |
264 | } |
|
262 | } | |
265 | } |
|
263 | } | |
266 |
|
264 | |||
267 | rtems_task wtdg_task( rtems_task_argument argument ) |
|
265 | rtems_task wtdg_task( rtems_task_argument argument ) | |
268 | { |
|
266 | { | |
269 | rtems_event_set event_out; |
|
267 | rtems_event_set event_out; | |
270 | rtems_status_code status; |
|
268 | rtems_status_code status; | |
271 | int linkStatus; |
|
269 | int linkStatus; | |
272 |
|
270 | |||
273 | BOOT_PRINTF("in WTDG ***\n") |
|
271 | BOOT_PRINTF("in WTDG ***\n") | |
274 |
|
272 | |||
275 | while(1) |
|
273 | while(1) | |
276 | { |
|
274 | { | |
277 | // wait for an RTEMS_EVENT |
|
275 | // wait for an RTEMS_EVENT | |
278 | rtems_event_receive( RTEMS_EVENT_0, |
|
276 | rtems_event_receive( RTEMS_EVENT_0, | |
279 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
277 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
280 | PRINTF("in WTDG *** wait for the link\n") |
|
278 | PRINTF("in WTDG *** wait for the link\n") | |
281 | ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status |
|
279 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status | |
282 | while( linkStatus != 5) // wait for the link |
|
280 | while( linkStatus != 5) // wait for the link | |
283 | { |
|
281 | { | |
284 | rtems_task_wake_after( 10 ); |
|
282 | rtems_task_wake_after( 10 ); | |
285 | ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status |
|
283 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status | |
286 | } |
|
284 | } | |
287 |
|
285 | |||
288 | status = spacewire_stop_start_link( fdSPW ); |
|
286 | status = spacewire_stop_start_link( fdSPW ); | |
289 |
|
287 | |||
290 | if (status != RTEMS_SUCCESSFUL) |
|
288 | if (status != RTEMS_SUCCESSFUL) | |
291 | { |
|
289 | { | |
292 | PRINTF1("in WTDG *** ERR link not started %d\n", status) |
|
290 | PRINTF1("in WTDG *** ERR link not started %d\n", status) | |
293 | } |
|
291 | } | |
294 | else |
|
292 | else | |
295 | { |
|
293 | { | |
296 | PRINTF("in WTDG *** OK link started\n") |
|
294 | PRINTF("in WTDG *** OK link started\n") | |
297 | } |
|
295 | } | |
298 |
|
296 | |||
299 | // restart the SPIQ task |
|
297 | // restart the SPIQ task | |
300 | status = rtems_task_restart( Task_id[TASKID_SPIQ], 1 ); |
|
298 | status = rtems_task_restart( Task_id[TASKID_SPIQ], 1 ); | |
301 | if ( status != RTEMS_SUCCESSFUL ) { |
|
299 | if ( status != RTEMS_SUCCESSFUL ) { | |
302 | PRINTF("in SPIQ *** ERR restarting SPIQ Task\n") |
|
300 | PRINTF("in SPIQ *** ERR restarting SPIQ Task\n") | |
303 | } |
|
301 | } | |
304 |
|
302 | |||
305 | // restart RECV and SEND |
|
303 | // restart RECV and SEND | |
306 | status = rtems_task_restart( Task_id[ TASKID_SEND ], 1 ); |
|
304 | status = rtems_task_restart( Task_id[ TASKID_SEND ], 1 ); | |
307 | if ( status != RTEMS_SUCCESSFUL ) { |
|
305 | if ( status != RTEMS_SUCCESSFUL ) { | |
308 | PRINTF("in SPIQ *** ERR restarting SEND Task\n") |
|
306 | PRINTF("in SPIQ *** ERR restarting SEND Task\n") | |
309 | } |
|
307 | } | |
310 | status = rtems_task_restart( Task_id[ TASKID_RECV ], 1 ); |
|
308 | status = rtems_task_restart( Task_id[ TASKID_RECV ], 1 ); | |
311 | if ( status != RTEMS_SUCCESSFUL ) { |
|
309 | if ( status != RTEMS_SUCCESSFUL ) { | |
312 | PRINTF("in SPIQ *** ERR restarting RECV Task\n") |
|
310 | PRINTF("in SPIQ *** ERR restarting RECV Task\n") | |
313 | } |
|
311 | } | |
314 | } |
|
312 | } | |
315 | } |
|
313 | } | |
316 |
|
314 | |||
317 | //**************** |
|
315 | //**************** | |
318 | // OTHER FUNCTIONS |
|
316 | // OTHER FUNCTIONS | |
319 | int spacewire_open_link( void ) |
|
317 | int spacewire_open_link( void ) | |
320 | { |
|
318 | { | |
321 | /** This function opens the SpaceWire link. |
|
319 | /** This function opens the SpaceWire link. | |
322 | * |
|
320 | * | |
323 | * @return a valid file descriptor in case of success, -1 in case of a failure |
|
321 | * @return a valid file descriptor in case of success, -1 in case of a failure | |
324 | * |
|
322 | * | |
325 | */ |
|
323 | */ | |
326 | rtems_status_code status; |
|
324 | rtems_status_code status; | |
327 |
|
325 | |||
328 | fdSPW = open(GRSPW_DEVICE_NAME, O_RDWR); // open the device. the open call resets the hardware |
|
326 | fdSPW = open(GRSPW_DEVICE_NAME, O_RDWR); // open the device. the open call resets the hardware | |
329 | if ( fdSPW < 0 ) { |
|
327 | if ( fdSPW < 0 ) { | |
330 | PRINTF1("ERR *** in configure_spw_link *** error opening "GRSPW_DEVICE_NAME" with ERR %d\n", errno) |
|
328 | PRINTF1("ERR *** in configure_spw_link *** error opening "GRSPW_DEVICE_NAME" with ERR %d\n", errno) | |
331 | } |
|
329 | } | |
332 | else |
|
330 | else | |
333 | { |
|
331 | { | |
334 | status = RTEMS_SUCCESSFUL; |
|
332 | status = RTEMS_SUCCESSFUL; | |
335 | } |
|
333 | } | |
336 |
|
334 | |||
337 | return status; |
|
335 | return status; | |
338 | } |
|
336 | } | |
339 |
|
337 | |||
340 | int spacewire_start_link( int fd ) |
|
338 | int spacewire_start_link( int fd ) | |
341 | { |
|
339 | { | |
342 | rtems_status_code status; |
|
340 | rtems_status_code status; | |
343 |
|
341 | |||
344 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is started |
|
342 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is started | |
345 | // -1 default hardcoded driver timeout |
|
343 | // -1 default hardcoded driver timeout | |
346 |
|
344 | |||
347 | return status; |
|
345 | return status; | |
348 | } |
|
346 | } | |
349 |
|
347 | |||
350 | int spacewire_stop_start_link( int fd ) |
|
348 | int spacewire_stop_start_link( int fd ) | |
351 | { |
|
349 | { | |
352 | rtems_status_code status; |
|
350 | rtems_status_code status; | |
353 |
|
351 | |||
354 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_STOP); // start fails if link pDev->running != 0 |
|
352 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_STOP); // start fails if link pDev->running != 0 | |
355 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is started |
|
353 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is started | |
356 | // -1 default hardcoded driver timeout |
|
354 | // -1 default hardcoded driver timeout | |
357 |
|
355 | |||
358 | return status; |
|
356 | return status; | |
359 | } |
|
357 | } | |
360 |
|
358 | |||
361 | int spacewire_configure_link( int fd ) |
|
359 | int spacewire_configure_link( int fd ) | |
362 | { |
|
360 | { | |
363 | /** This function configures the SpaceWire link. |
|
361 | /** This function configures the SpaceWire link. | |
364 | * |
|
362 | * | |
365 | * @return GR-RTEMS-DRIVER directive status codes: |
|
363 | * @return GR-RTEMS-DRIVER directive status codes: | |
366 | * - 22 EINVAL - Null pointer or an out of range value was given as the argument. |
|
364 | * - 22 EINVAL - Null pointer or an out of range value was given as the argument. | |
367 | * - 16 EBUSY - Only used for SEND. Returned when no descriptors are avialble in non-blocking mode. |
|
365 | * - 16 EBUSY - Only used for SEND. Returned when no descriptors are avialble in non-blocking mode. | |
368 | * - 88 ENOSYS - Returned for SET_DESTKEY if RMAP command handler is not available or if a non-implemented call is used. |
|
366 | * - 88 ENOSYS - Returned for SET_DESTKEY if RMAP command handler is not available or if a non-implemented call is used. | |
369 | * - 116 ETIMEDOUT - REturned for SET_PACKET_SIZE and START if the link could not be brought up. |
|
367 | * - 116 ETIMEDOUT - REturned for SET_PACKET_SIZE and START if the link could not be brought up. | |
370 | * - 12 ENOMEM - Returned for SET_PACKETSIZE if it was unable to allocate the new buffers. |
|
368 | * - 12 ENOMEM - Returned for SET_PACKETSIZE if it was unable to allocate the new buffers. | |
371 | * - 5 EIO - Error when writing to grswp hardware registers. |
|
369 | * - 5 EIO - Error when writing to grswp hardware registers. | |
372 | * - 2 ENOENT - No such file or directory |
|
370 | * - 2 ENOENT - No such file or directory | |
373 | */ |
|
371 | */ | |
374 |
|
372 | |||
375 | rtems_status_code status; |
|
373 | rtems_status_code status; | |
376 |
|
374 | |||
377 | spacewire_set_NP(1, REGS_ADDR_GRSPW); // [N]o [P]ort force |
|
375 | spacewire_set_NP(1, REGS_ADDR_GRSPW); // [N]o [P]ort force | |
378 | spacewire_set_RE(1, REGS_ADDR_GRSPW); // [R]MAP [E]nable, the dedicated call seems to break the no port force configuration |
|
376 | spacewire_set_RE(1, REGS_ADDR_GRSPW); // [R]MAP [E]nable, the dedicated call seems to break the no port force configuration | |
379 |
|
377 | |||
380 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_RXBLOCK, 1); // sets the blocking mode for reception |
|
378 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_RXBLOCK, 1); // sets the blocking mode for reception | |
381 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_RXBLOCK\n") |
|
379 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_RXBLOCK\n") | |
382 | // |
|
380 | // | |
383 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_EVENT_ID, Task_id[TASKID_SPIQ]); // sets the task ID to which an event is sent when a |
|
381 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_EVENT_ID, Task_id[TASKID_SPIQ]); // sets the task ID to which an event is sent when a | |
384 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_EVENT_ID\n") // link-error interrupt occurs |
|
382 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_EVENT_ID\n") // link-error interrupt occurs | |
385 | // |
|
383 | // | |
386 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_DISABLE_ERR, 0); // automatic link-disabling due to link-error interrupts |
|
384 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_DISABLE_ERR, 0); // automatic link-disabling due to link-error interrupts | |
387 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_DISABLE_ERR\n") |
|
385 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_DISABLE_ERR\n") | |
388 | // |
|
386 | // | |
389 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ, 1); // sets the link-error interrupt bit |
|
387 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ, 1); // sets the link-error interrupt bit | |
390 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ\n") |
|
388 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ\n") | |
391 | // |
|
389 | // | |
392 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TXBLOCK, 0); // transmission blocks |
|
390 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TXBLOCK, 0); // transmission blocks | |
393 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK\n") |
|
391 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK\n") | |
394 | // |
|
392 | // | |
395 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL, 1); // transmission blocks when no transmission descriptor is available |
|
393 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL, 1); // transmission blocks when no transmission descriptor is available | |
396 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL\n") |
|
394 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL\n") | |
397 | // |
|
395 | // | |
398 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TCODE_CTRL, 0x0909); // [Time Rx : Time Tx : Link error : Tick-out IRQ] |
|
396 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TCODE_CTRL, 0x0909); // [Time Rx : Time Tx : Link error : Tick-out IRQ] | |
399 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TCODE_CTRL,\n") |
|
397 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TCODE_CTRL,\n") | |
400 |
|
398 | |||
401 | return status; |
|
399 | return status; | |
402 | } |
|
400 | } | |
403 |
|
401 | |||
404 | int spacewire_reset_link( void ) |
|
402 | int spacewire_reset_link( void ) | |
405 | { |
|
403 | { | |
406 | /** This function is executed by the SPIQ rtems_task wehn it has been awaken by an interruption raised by the SpaceWire driver. |
|
404 | /** This function is executed by the SPIQ rtems_task wehn it has been awaken by an interruption raised by the SpaceWire driver. | |
407 | * |
|
405 | * | |
408 | * @return RTEMS directive status code: |
|
406 | * @return RTEMS directive status code: | |
409 | * - RTEMS_UNSATISFIED is returned is the link is not in the running state after 10 s. |
|
407 | * - RTEMS_UNSATISFIED is returned is the link is not in the running state after 10 s. | |
410 | * - RTEMS_SUCCESSFUL is returned if the link is up before the timeout. |
|
408 | * - RTEMS_SUCCESSFUL is returned if the link is up before the timeout. | |
411 | * |
|
409 | * | |
412 | */ |
|
410 | */ | |
413 |
|
411 | |||
414 | rtems_status_code status_spw; |
|
412 | rtems_status_code status_spw; | |
415 | int i; |
|
413 | int i; | |
416 |
|
414 | |||
417 | for ( i=0; i<SY_LFR_DPU_CONNECT_ATTEMPT; i++ ) |
|
415 | for ( i=0; i<SY_LFR_DPU_CONNECT_ATTEMPT; i++ ) | |
418 | { |
|
416 | { | |
419 | PRINTF1("in spacewire_reset_link *** link recovery, try %d\n", i); |
|
417 | PRINTF1("in spacewire_reset_link *** link recovery, try %d\n", i); | |
420 |
|
418 | |||
421 | // CLOSING THE DRIVER AT THIS POINT WILL MAKE THE SEND TASK BLOCK THE SYSTEM |
|
419 | // CLOSING THE DRIVER AT THIS POINT WILL MAKE THE SEND TASK BLOCK THE SYSTEM | |
422 |
|
420 | |||
423 | status_spw = spacewire_stop_start_link( fdSPW ); |
|
421 | status_spw = spacewire_stop_start_link( fdSPW ); | |
424 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
422 | if ( status_spw != RTEMS_SUCCESSFUL ) | |
425 | { |
|
423 | { | |
426 | PRINTF1("in spacewire_reset_link *** ERR spacewire_start_link code %d\n", status_spw) |
|
424 | PRINTF1("in spacewire_reset_link *** ERR spacewire_start_link code %d\n", status_spw) | |
427 | } |
|
425 | } | |
428 |
|
426 | |||
429 | if ( status_spw == RTEMS_SUCCESSFUL) |
|
427 | if ( status_spw == RTEMS_SUCCESSFUL) | |
430 | { |
|
428 | { | |
431 | break; |
|
429 | break; | |
432 | } |
|
430 | } | |
433 | } |
|
431 | } | |
434 |
|
432 | |||
435 | return status_spw; |
|
433 | return status_spw; | |
436 | } |
|
434 | } | |
437 |
|
435 | |||
438 | void spacewire_set_NP( unsigned char val, unsigned int regAddr ) // [N]o [P]ort force |
|
436 | void spacewire_set_NP( unsigned char val, unsigned int regAddr ) // [N]o [P]ort force | |
439 | { |
|
437 | { | |
440 | /** This function sets the [N]o [P]ort force bit of the GRSPW control register. |
|
438 | /** This function sets the [N]o [P]ort force bit of the GRSPW control register. | |
441 | * |
|
439 | * | |
442 | * @param val is the value, 0 or 1, used to set the value of the NP bit. |
|
440 | * @param val is the value, 0 or 1, used to set the value of the NP bit. | |
443 | * @param regAddr is the address of the GRSPW control register. |
|
441 | * @param regAddr is the address of the GRSPW control register. | |
444 | * |
|
442 | * | |
445 | * NP is the bit 20 of the GRSPW control register. |
|
443 | * NP is the bit 20 of the GRSPW control register. | |
446 | * |
|
444 | * | |
447 | */ |
|
445 | */ | |
448 |
|
446 | |||
449 | unsigned int *spwptr = (unsigned int*) regAddr; |
|
447 | unsigned int *spwptr = (unsigned int*) regAddr; | |
450 |
|
448 | |||
451 | if (val == 1) { |
|
449 | if (val == 1) { | |
452 | *spwptr = *spwptr | 0x00100000; // [NP] set the No port force bit |
|
450 | *spwptr = *spwptr | 0x00100000; // [NP] set the No port force bit | |
453 | } |
|
451 | } | |
454 | if (val== 0) { |
|
452 | if (val== 0) { | |
455 | *spwptr = *spwptr & 0xffdfffff; |
|
453 | *spwptr = *spwptr & 0xffdfffff; | |
456 | } |
|
454 | } | |
457 | } |
|
455 | } | |
458 |
|
456 | |||
459 | void spacewire_set_RE( unsigned char val, unsigned int regAddr ) // [R]MAP [E]nable |
|
457 | void spacewire_set_RE( unsigned char val, unsigned int regAddr ) // [R]MAP [E]nable | |
460 | { |
|
458 | { | |
461 | /** This function sets the [R]MAP [E]nable bit of the GRSPW control register. |
|
459 | /** This function sets the [R]MAP [E]nable bit of the GRSPW control register. | |
462 | * |
|
460 | * | |
463 | * @param val is the value, 0 or 1, used to set the value of the RE bit. |
|
461 | * @param val is the value, 0 or 1, used to set the value of the RE bit. | |
464 | * @param regAddr is the address of the GRSPW control register. |
|
462 | * @param regAddr is the address of the GRSPW control register. | |
465 | * |
|
463 | * | |
466 | * RE is the bit 16 of the GRSPW control register. |
|
464 | * RE is the bit 16 of the GRSPW control register. | |
467 | * |
|
465 | * | |
468 | */ |
|
466 | */ | |
469 |
|
467 | |||
470 | unsigned int *spwptr = (unsigned int*) regAddr; |
|
468 | unsigned int *spwptr = (unsigned int*) regAddr; | |
471 |
|
469 | |||
472 | if (val == 1) |
|
470 | if (val == 1) | |
473 | { |
|
471 | { | |
474 | *spwptr = *spwptr | 0x00010000; // [RE] set the RMAP Enable bit |
|
472 | *spwptr = *spwptr | 0x00010000; // [RE] set the RMAP Enable bit | |
475 | } |
|
473 | } | |
476 | if (val== 0) |
|
474 | if (val== 0) | |
477 | { |
|
475 | { | |
478 | *spwptr = *spwptr & 0xfffdffff; |
|
476 | *spwptr = *spwptr & 0xfffdffff; | |
479 | } |
|
477 | } | |
480 | } |
|
478 | } | |
481 |
|
479 | |||
482 | void spacewire_compute_stats_offsets( void ) |
|
480 | void spacewire_compute_stats_offsets( void ) | |
483 | { |
|
481 | { | |
484 | /** This function computes the SpaceWire statistics offsets in case of a SpaceWire related interruption raising. |
|
482 | /** This function computes the SpaceWire statistics offsets in case of a SpaceWire related interruption raising. | |
485 | * |
|
483 | * | |
486 | * The offsets keep a record of the statistics in case of a reset of the statistics. They are added to the current statistics |
|
484 | * The offsets keep a record of the statistics in case of a reset of the statistics. They are added to the current statistics | |
487 | * to keep the counters consistent even after a reset of the SpaceWire driver (the counter are set to zero by the driver when it |
|
485 | * to keep the counters consistent even after a reset of the SpaceWire driver (the counter are set to zero by the driver when it | |
488 | * during the open systel call). |
|
486 | * during the open systel call). | |
489 | * |
|
487 | * | |
490 | */ |
|
488 | */ | |
491 |
|
489 | |||
492 | spw_stats spacewire_stats_grspw; |
|
490 | spw_stats spacewire_stats_grspw; | |
493 | rtems_status_code status; |
|
491 | rtems_status_code status; | |
494 |
|
492 | |||
495 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw ); |
|
493 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw ); | |
496 |
|
494 | |||
497 | spacewire_stats_backup.packets_received = spacewire_stats_grspw.packets_received |
|
495 | spacewire_stats_backup.packets_received = spacewire_stats_grspw.packets_received | |
498 | + spacewire_stats.packets_received; |
|
496 | + spacewire_stats.packets_received; | |
499 | spacewire_stats_backup.packets_sent = spacewire_stats_grspw.packets_sent |
|
497 | spacewire_stats_backup.packets_sent = spacewire_stats_grspw.packets_sent | |
500 | + spacewire_stats.packets_sent; |
|
498 | + spacewire_stats.packets_sent; | |
501 | spacewire_stats_backup.parity_err = spacewire_stats_grspw.parity_err |
|
499 | spacewire_stats_backup.parity_err = spacewire_stats_grspw.parity_err | |
502 | + spacewire_stats.parity_err; |
|
500 | + spacewire_stats.parity_err; | |
503 | spacewire_stats_backup.disconnect_err = spacewire_stats_grspw.disconnect_err |
|
501 | spacewire_stats_backup.disconnect_err = spacewire_stats_grspw.disconnect_err | |
504 | + spacewire_stats.disconnect_err; |
|
502 | + spacewire_stats.disconnect_err; | |
505 | spacewire_stats_backup.escape_err = spacewire_stats_grspw.escape_err |
|
503 | spacewire_stats_backup.escape_err = spacewire_stats_grspw.escape_err | |
506 | + spacewire_stats.escape_err; |
|
504 | + spacewire_stats.escape_err; | |
507 | spacewire_stats_backup.credit_err = spacewire_stats_grspw.credit_err |
|
505 | spacewire_stats_backup.credit_err = spacewire_stats_grspw.credit_err | |
508 | + spacewire_stats.credit_err; |
|
506 | + spacewire_stats.credit_err; | |
509 | spacewire_stats_backup.write_sync_err = spacewire_stats_grspw.write_sync_err |
|
507 | spacewire_stats_backup.write_sync_err = spacewire_stats_grspw.write_sync_err | |
510 | + spacewire_stats.write_sync_err; |
|
508 | + spacewire_stats.write_sync_err; | |
511 | spacewire_stats_backup.rx_rmap_header_crc_err = spacewire_stats_grspw.rx_rmap_header_crc_err |
|
509 | spacewire_stats_backup.rx_rmap_header_crc_err = spacewire_stats_grspw.rx_rmap_header_crc_err | |
512 | + spacewire_stats.rx_rmap_header_crc_err; |
|
510 | + spacewire_stats.rx_rmap_header_crc_err; | |
513 | spacewire_stats_backup.rx_rmap_data_crc_err = spacewire_stats_grspw.rx_rmap_data_crc_err |
|
511 | spacewire_stats_backup.rx_rmap_data_crc_err = spacewire_stats_grspw.rx_rmap_data_crc_err | |
514 | + spacewire_stats.rx_rmap_data_crc_err; |
|
512 | + spacewire_stats.rx_rmap_data_crc_err; | |
515 | spacewire_stats_backup.early_ep = spacewire_stats_grspw.early_ep |
|
513 | spacewire_stats_backup.early_ep = spacewire_stats_grspw.early_ep | |
516 | + spacewire_stats.early_ep; |
|
514 | + spacewire_stats.early_ep; | |
517 | spacewire_stats_backup.invalid_address = spacewire_stats_grspw.invalid_address |
|
515 | spacewire_stats_backup.invalid_address = spacewire_stats_grspw.invalid_address | |
518 | + spacewire_stats.invalid_address; |
|
516 | + spacewire_stats.invalid_address; | |
519 | spacewire_stats_backup.rx_eep_err = spacewire_stats_grspw.rx_eep_err |
|
517 | spacewire_stats_backup.rx_eep_err = spacewire_stats_grspw.rx_eep_err | |
520 | + spacewire_stats.rx_eep_err; |
|
518 | + spacewire_stats.rx_eep_err; | |
521 | spacewire_stats_backup.rx_truncated = spacewire_stats_grspw.rx_truncated |
|
519 | spacewire_stats_backup.rx_truncated = spacewire_stats_grspw.rx_truncated | |
522 | + spacewire_stats.rx_truncated; |
|
520 | + spacewire_stats.rx_truncated; | |
523 | } |
|
521 | } | |
524 |
|
522 | |||
525 | void spacewire_update_statistics( void ) |
|
523 | void spacewire_update_statistics( void ) | |
526 | { |
|
524 | { | |
527 | rtems_status_code status; |
|
525 | rtems_status_code status; | |
528 | spw_stats spacewire_stats_grspw; |
|
526 | spw_stats spacewire_stats_grspw; | |
529 |
|
527 | |||
530 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw ); |
|
528 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw ); | |
531 |
|
529 | |||
532 | spacewire_stats.packets_received = spacewire_stats_backup.packets_received |
|
530 | spacewire_stats.packets_received = spacewire_stats_backup.packets_received | |
533 | + spacewire_stats_grspw.packets_received; |
|
531 | + spacewire_stats_grspw.packets_received; | |
534 | spacewire_stats.packets_sent = spacewire_stats_backup.packets_sent |
|
532 | spacewire_stats.packets_sent = spacewire_stats_backup.packets_sent | |
535 | + spacewire_stats_grspw.packets_sent; |
|
533 | + spacewire_stats_grspw.packets_sent; | |
536 | spacewire_stats.parity_err = spacewire_stats_backup.parity_err |
|
534 | spacewire_stats.parity_err = spacewire_stats_backup.parity_err | |
537 | + spacewire_stats_grspw.parity_err; |
|
535 | + spacewire_stats_grspw.parity_err; | |
538 | spacewire_stats.disconnect_err = spacewire_stats_backup.disconnect_err |
|
536 | spacewire_stats.disconnect_err = spacewire_stats_backup.disconnect_err | |
539 | + spacewire_stats_grspw.disconnect_err; |
|
537 | + spacewire_stats_grspw.disconnect_err; | |
540 | spacewire_stats.escape_err = spacewire_stats_backup.escape_err |
|
538 | spacewire_stats.escape_err = spacewire_stats_backup.escape_err | |
541 | + spacewire_stats_grspw.escape_err; |
|
539 | + spacewire_stats_grspw.escape_err; | |
542 | spacewire_stats.credit_err = spacewire_stats_backup.credit_err |
|
540 | spacewire_stats.credit_err = spacewire_stats_backup.credit_err | |
543 | + spacewire_stats_grspw.credit_err; |
|
541 | + spacewire_stats_grspw.credit_err; | |
544 | spacewire_stats.write_sync_err = spacewire_stats_backup.write_sync_err |
|
542 | spacewire_stats.write_sync_err = spacewire_stats_backup.write_sync_err | |
545 | + spacewire_stats_grspw.write_sync_err; |
|
543 | + spacewire_stats_grspw.write_sync_err; | |
546 | spacewire_stats.rx_rmap_header_crc_err = spacewire_stats_backup.rx_rmap_header_crc_err |
|
544 | spacewire_stats.rx_rmap_header_crc_err = spacewire_stats_backup.rx_rmap_header_crc_err | |
547 | + spacewire_stats_grspw.rx_rmap_header_crc_err; |
|
545 | + spacewire_stats_grspw.rx_rmap_header_crc_err; | |
548 | spacewire_stats.rx_rmap_data_crc_err = spacewire_stats_backup.rx_rmap_data_crc_err |
|
546 | spacewire_stats.rx_rmap_data_crc_err = spacewire_stats_backup.rx_rmap_data_crc_err | |
549 | + spacewire_stats_grspw.rx_rmap_data_crc_err; |
|
547 | + spacewire_stats_grspw.rx_rmap_data_crc_err; | |
550 | spacewire_stats.early_ep = spacewire_stats_backup.early_ep |
|
548 | spacewire_stats.early_ep = spacewire_stats_backup.early_ep | |
551 | + spacewire_stats_grspw.early_ep; |
|
549 | + spacewire_stats_grspw.early_ep; | |
552 | spacewire_stats.invalid_address = spacewire_stats_backup.invalid_address |
|
550 | spacewire_stats.invalid_address = spacewire_stats_backup.invalid_address | |
553 | + spacewire_stats_grspw.invalid_address; |
|
551 | + spacewire_stats_grspw.invalid_address; | |
554 | spacewire_stats.rx_eep_err = spacewire_stats_backup.rx_eep_err |
|
552 | spacewire_stats.rx_eep_err = spacewire_stats_backup.rx_eep_err | |
555 | + spacewire_stats_grspw.rx_eep_err; |
|
553 | + spacewire_stats_grspw.rx_eep_err; | |
556 | spacewire_stats.rx_truncated = spacewire_stats_backup.rx_truncated |
|
554 | spacewire_stats.rx_truncated = spacewire_stats_backup.rx_truncated | |
557 | + spacewire_stats_grspw.rx_truncated; |
|
555 | + spacewire_stats_grspw.rx_truncated; | |
558 | //spacewire_stats.tx_link_err; |
|
556 | //spacewire_stats.tx_link_err; | |
559 |
|
557 | |||
560 | //**************************** |
|
558 | //**************************** | |
561 | // DPU_SPACEWIRE_IF_STATISTICS |
|
559 | // DPU_SPACEWIRE_IF_STATISTICS | |
562 | housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[0] = (unsigned char) (spacewire_stats.packets_received >> 8); |
|
560 | housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[0] = (unsigned char) (spacewire_stats.packets_received >> 8); | |
563 | housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[1] = (unsigned char) (spacewire_stats.packets_received); |
|
561 | housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[1] = (unsigned char) (spacewire_stats.packets_received); | |
564 | housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[0] = (unsigned char) (spacewire_stats.packets_sent >> 8); |
|
562 | housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[0] = (unsigned char) (spacewire_stats.packets_sent >> 8); | |
565 | housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[1] = (unsigned char) (spacewire_stats.packets_sent); |
|
563 | housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[1] = (unsigned char) (spacewire_stats.packets_sent); | |
566 | //housekeeping_packet.hk_lfr_dpu_spw_tick_out_cnt; |
|
564 | //housekeeping_packet.hk_lfr_dpu_spw_tick_out_cnt; | |
567 | //housekeeping_packet.hk_lfr_dpu_spw_last_timc; |
|
565 | //housekeeping_packet.hk_lfr_dpu_spw_last_timc; | |
568 |
|
566 | |||
569 | //****************************************** |
|
567 | //****************************************** | |
570 | // ERROR COUNTERS / SPACEWIRE / LOW SEVERITY |
|
568 | // ERROR COUNTERS / SPACEWIRE / LOW SEVERITY | |
571 | housekeeping_packet.hk_lfr_dpu_spw_parity = (unsigned char) spacewire_stats.parity_err; |
|
569 | housekeeping_packet.hk_lfr_dpu_spw_parity = (unsigned char) spacewire_stats.parity_err; | |
572 | housekeeping_packet.hk_lfr_dpu_spw_disconnect = (unsigned char) spacewire_stats.disconnect_err; |
|
570 | housekeeping_packet.hk_lfr_dpu_spw_disconnect = (unsigned char) spacewire_stats.disconnect_err; | |
573 | housekeeping_packet.hk_lfr_dpu_spw_escape = (unsigned char) spacewire_stats.escape_err; |
|
571 | housekeeping_packet.hk_lfr_dpu_spw_escape = (unsigned char) spacewire_stats.escape_err; | |
574 | housekeeping_packet.hk_lfr_dpu_spw_credit = (unsigned char) spacewire_stats.credit_err; |
|
572 | housekeeping_packet.hk_lfr_dpu_spw_credit = (unsigned char) spacewire_stats.credit_err; | |
575 | housekeeping_packet.hk_lfr_dpu_spw_write_sync = (unsigned char) spacewire_stats.write_sync_err; |
|
573 | housekeeping_packet.hk_lfr_dpu_spw_write_sync = (unsigned char) spacewire_stats.write_sync_err; | |
576 | // housekeeping_packet.hk_lfr_dpu_spw_rx_ahb; |
|
574 | // housekeeping_packet.hk_lfr_dpu_spw_rx_ahb; | |
577 | // housekeeping_packet.hk_lfr_dpu_spw_tx_ahb; |
|
575 | // housekeeping_packet.hk_lfr_dpu_spw_tx_ahb; | |
578 | housekeeping_packet.hk_lfr_dpu_spw_header_crc = (unsigned char) spacewire_stats.rx_rmap_header_crc_err; |
|
576 | housekeeping_packet.hk_lfr_dpu_spw_header_crc = (unsigned char) spacewire_stats.rx_rmap_header_crc_err; | |
579 | housekeeping_packet.hk_lfr_dpu_spw_data_crc = (unsigned char) spacewire_stats.rx_rmap_data_crc_err; |
|
577 | housekeeping_packet.hk_lfr_dpu_spw_data_crc = (unsigned char) spacewire_stats.rx_rmap_data_crc_err; | |
580 |
|
578 | |||
581 | //********************************************* |
|
579 | //********************************************* | |
582 | // ERROR COUNTERS / SPACEWIRE / MEDIUM SEVERITY |
|
580 | // ERROR COUNTERS / SPACEWIRE / MEDIUM SEVERITY | |
583 | housekeeping_packet.hk_lfr_dpu_spw_early_eop = (unsigned char) spacewire_stats.early_ep; |
|
581 | housekeeping_packet.hk_lfr_dpu_spw_early_eop = (unsigned char) spacewire_stats.early_ep; | |
584 | housekeeping_packet.hk_lfr_dpu_spw_invalid_addr = (unsigned char) spacewire_stats.invalid_address; |
|
582 | housekeeping_packet.hk_lfr_dpu_spw_invalid_addr = (unsigned char) spacewire_stats.invalid_address; | |
585 | housekeeping_packet.hk_lfr_dpu_spw_eep = (unsigned char) spacewire_stats.rx_eep_err; |
|
583 | housekeeping_packet.hk_lfr_dpu_spw_eep = (unsigned char) spacewire_stats.rx_eep_err; | |
586 | housekeeping_packet.hk_lfr_dpu_spw_rx_too_big = (unsigned char) spacewire_stats.rx_truncated; |
|
584 | housekeeping_packet.hk_lfr_dpu_spw_rx_too_big = (unsigned char) spacewire_stats.rx_truncated; | |
587 |
|
585 | |||
588 | } |
|
586 | } | |
589 |
|
587 | |||
590 | void timecode_irq_handler( void *pDev, void *regs, int minor, unsigned int tc ) |
|
588 | void timecode_irq_handler( void *pDev, void *regs, int minor, unsigned int tc ) | |
591 | { |
|
589 | { | |
592 | //if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_1 ) != RTEMS_SUCCESSFUL) { |
|
590 | //if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_1 ) != RTEMS_SUCCESSFUL) { | |
593 | // printf("In timecode_irq_handler *** Error sending event to DUMB\n"); |
|
591 | // printf("In timecode_irq_handler *** Error sending event to DUMB\n"); | |
594 | //} |
|
592 | //} | |
595 | } |
|
593 | } | |
596 |
|
594 | |||
597 | rtems_timer_service_routine user_routine( rtems_id timer_id, void *user_data ) |
|
595 | rtems_timer_service_routine user_routine( rtems_id timer_id, void *user_data ) | |
598 | { |
|
596 | { | |
599 | int linkStatus; |
|
597 | int linkStatus; | |
600 | rtems_status_code status; |
|
598 | rtems_status_code status; | |
601 |
|
599 | |||
602 | ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status |
|
600 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status | |
603 |
|
601 | |||
604 | if ( linkStatus == 5) { |
|
602 | if ( linkStatus == 5) { | |
605 | PRINTF("in spacewire_reset_link *** link is running\n") |
|
603 | PRINTF("in spacewire_reset_link *** link is running\n") | |
606 | status = RTEMS_SUCCESSFUL; |
|
604 | status = RTEMS_SUCCESSFUL; | |
607 | } |
|
605 | } | |
608 | } |
|
606 | } | |
609 |
|
607 | |||
610 | rtems_status_code rtems_message_queue_send_lfr( rtems_id id, const void *buffer, size_t size ) |
|
608 | rtems_status_code rtems_message_queue_send_lfr( rtems_id id, const void *buffer, size_t size ) | |
611 | { |
|
609 | { | |
612 | rtems_status_code status; |
|
610 | rtems_status_code status; | |
613 | rtems_mode previous_mode_set; |
|
611 | rtems_mode previous_mode_set; | |
614 |
|
612 | |||
615 | // set the preemption OFF |
|
613 | // set the preemption OFF | |
616 | status = rtems_task_mode( RTEMS_NO_PREEMPT, RTEMS_PREEMPT_MASK, &previous_mode_set ); |
|
614 | status = rtems_task_mode( RTEMS_NO_PREEMPT, RTEMS_PREEMPT_MASK, &previous_mode_set ); | |
617 |
|
615 | |||
618 | // use the message queue |
|
616 | // use the message queue | |
619 | status = rtems_message_queue_send_lfr( id, buffer, size ); |
|
617 | status = rtems_message_queue_send_lfr( id, buffer, size ); | |
620 |
|
618 | |||
621 | // set the preemption ON |
|
619 | // set the preemption ON | |
622 | status = rtems_task_mode( RTEMS_PREEMPT , RTEMS_PREEMPT_MASK, &previous_mode_set ); |
|
620 | status = rtems_task_mode( RTEMS_PREEMPT , RTEMS_PREEMPT_MASK, &previous_mode_set ); | |
623 |
|
621 | |||
624 | return status; |
|
622 | return status; | |
625 | } |
|
623 | } | |
626 |
|
624 |
@@ -1,771 +1,862 | |||||
1 | /** Functions and tasks related to TeleCommand handling. |
|
1 | /** Functions and tasks related to TeleCommand handling. | |
2 | * |
|
2 | * | |
3 | * @file |
|
3 | * @file | |
4 | * @author P. LEROY |
|
4 | * @author P. LEROY | |
5 | * |
|
5 | * | |
6 | * A group of functions to handle TeleCommands:\n |
|
6 | * A group of functions to handle TeleCommands:\n | |
7 | * action launching\n |
|
7 | * action launching\n | |
8 | * TC parsing\n |
|
8 | * TC parsing\n | |
9 | * ... |
|
9 | * ... | |
10 | * |
|
10 | * | |
11 | */ |
|
11 | */ | |
12 |
|
12 | |||
13 | #include "tc_handler.h" |
|
13 | #include "tc_handler.h" | |
14 |
|
14 | |||
15 | //*********** |
|
15 | //*********** | |
16 | // RTEMS TASK |
|
16 | // RTEMS TASK | |
17 |
|
17 | |||
18 | rtems_task actn_task( rtems_task_argument unused ) |
|
18 | rtems_task actn_task( rtems_task_argument unused ) | |
19 | { |
|
19 | { | |
20 | /** This RTEMS task is responsible for launching actions upton the reception of valid TeleCommands. |
|
20 | /** This RTEMS task is responsible for launching actions upton the reception of valid TeleCommands. | |
21 | * |
|
21 | * | |
22 | * @param unused is the starting argument of the RTEMS task |
|
22 | * @param unused is the starting argument of the RTEMS task | |
23 | * |
|
23 | * | |
24 | * The ACTN task waits for data coming from an RTEMS msesage queue. When data arrives, it launches specific actions depending |
|
24 | * The ACTN task waits for data coming from an RTEMS msesage queue. When data arrives, it launches specific actions depending | |
25 | * on the incoming TeleCommand. |
|
25 | * on the incoming TeleCommand. | |
26 | * |
|
26 | * | |
27 | */ |
|
27 | */ | |
28 |
|
28 | |||
29 | int result; |
|
29 | int result; | |
30 | rtems_status_code status; // RTEMS status code |
|
30 | rtems_status_code status; // RTEMS status code | |
31 | ccsdsTelecommandPacket_t TC; // TC sent to the ACTN task |
|
31 | ccsdsTelecommandPacket_t TC; // TC sent to the ACTN task | |
32 | size_t size; // size of the incoming TC packet |
|
32 | size_t size; // size of the incoming TC packet | |
33 | unsigned char subtype; // subtype of the current TC packet |
|
33 | unsigned char subtype; // subtype of the current TC packet | |
34 | unsigned char time[6]; |
|
34 | unsigned char time[6]; | |
35 | rtems_id queue_rcv_id; |
|
35 | rtems_id queue_rcv_id; | |
36 | rtems_id queue_snd_id; |
|
36 | rtems_id queue_snd_id; | |
37 |
|
37 | |||
38 | status = rtems_message_queue_ident( misc_name[QUEUE_RECV], 0, &queue_rcv_id ); |
|
38 | status = rtems_message_queue_ident( misc_name[QUEUE_RECV], 0, &queue_rcv_id ); | |
39 | if (status != RTEMS_SUCCESSFUL) |
|
39 | if (status != RTEMS_SUCCESSFUL) | |
40 | { |
|
40 | { | |
41 | PRINTF1("in ACTN *** ERR getting queue_rcv_id %d\n", status) |
|
41 | PRINTF1("in ACTN *** ERR getting queue_rcv_id %d\n", status) | |
42 | } |
|
42 | } | |
43 |
|
43 | |||
44 | status = rtems_message_queue_ident( misc_name[QUEUE_SEND], 0, &queue_snd_id ); |
|
44 | status = rtems_message_queue_ident( misc_name[QUEUE_SEND], 0, &queue_snd_id ); | |
45 | if (status != RTEMS_SUCCESSFUL) |
|
45 | if (status != RTEMS_SUCCESSFUL) | |
46 | { |
|
46 | { | |
47 | PRINTF1("in ACTN *** ERR getting queue_snd_id %d\n", status) |
|
47 | PRINTF1("in ACTN *** ERR getting queue_snd_id %d\n", status) | |
48 | } |
|
48 | } | |
49 |
|
49 | |||
50 | result = LFR_SUCCESSFUL; |
|
50 | result = LFR_SUCCESSFUL; | |
51 | subtype = 0; // subtype of the current TC packet |
|
51 | subtype = 0; // subtype of the current TC packet | |
52 |
|
52 | |||
53 | BOOT_PRINTF("in ACTN *** \n") |
|
53 | BOOT_PRINTF("in ACTN *** \n") | |
54 |
|
54 | |||
55 | while(1) |
|
55 | while(1) | |
56 | { |
|
56 | { | |
57 | status = rtems_message_queue_receive( queue_rcv_id, (char*) &TC, &size, |
|
57 | status = rtems_message_queue_receive( queue_rcv_id, (char*) &TC, &size, | |
58 | RTEMS_WAIT, RTEMS_NO_TIMEOUT); |
|
58 | RTEMS_WAIT, RTEMS_NO_TIMEOUT); | |
59 | getTime( time ); // set time to the current time |
|
59 | getTime( time ); // set time to the current time | |
60 | if (status!=RTEMS_SUCCESSFUL) PRINTF1("ERR *** in task ACTN *** error receiving a message, code %d \n", status) |
|
60 | if (status!=RTEMS_SUCCESSFUL) | |
|
61 | { | |||
|
62 | PRINTF1("ERR *** in task ACTN *** error receiving a message, code %d \n", status) | |||
|
63 | } | |||
61 | else |
|
64 | else | |
62 | { |
|
65 | { | |
63 | subtype = TC.serviceSubType; |
|
66 | subtype = TC.serviceSubType; | |
64 | switch(subtype) |
|
67 | switch(subtype) | |
65 | { |
|
68 | { | |
66 | case TC_SUBTYPE_RESET: |
|
69 | case TC_SUBTYPE_RESET: | |
67 | result = action_reset( &TC, queue_snd_id, time ); |
|
70 | result = action_reset( &TC, queue_snd_id, time ); | |
68 | close_action( &TC, result, queue_snd_id, time ); |
|
71 | close_action( &TC, result, queue_snd_id, time ); | |
69 | break; |
|
72 | break; | |
70 | // |
|
73 | // | |
71 | case TC_SUBTYPE_LOAD_COMM: |
|
74 | case TC_SUBTYPE_LOAD_COMM: | |
72 | result = action_load_common_par( &TC ); |
|
75 | result = action_load_common_par( &TC ); | |
73 | close_action( &TC, result, queue_snd_id, time ); |
|
76 | close_action( &TC, result, queue_snd_id, time ); | |
74 | break; |
|
77 | break; | |
75 | // |
|
78 | // | |
76 | case TC_SUBTYPE_LOAD_NORM: |
|
79 | case TC_SUBTYPE_LOAD_NORM: | |
77 | result = action_load_normal_par( &TC, queue_snd_id, time ); |
|
80 | result = action_load_normal_par( &TC, queue_snd_id, time ); | |
78 | close_action( &TC, result, queue_snd_id, time ); |
|
81 | close_action( &TC, result, queue_snd_id, time ); | |
79 | break; |
|
82 | break; | |
80 | // |
|
83 | // | |
81 | case TC_SUBTYPE_LOAD_BURST: |
|
84 | case TC_SUBTYPE_LOAD_BURST: | |
82 | result = action_load_burst_par( &TC, queue_snd_id, time ); |
|
85 | result = action_load_burst_par( &TC, queue_snd_id, time ); | |
83 | close_action( &TC, result, queue_snd_id, time ); |
|
86 | close_action( &TC, result, queue_snd_id, time ); | |
84 | break; |
|
87 | break; | |
85 | // |
|
88 | // | |
86 | case TC_SUBTYPE_LOAD_SBM1: |
|
89 | case TC_SUBTYPE_LOAD_SBM1: | |
87 | result = action_load_sbm1_par( &TC, queue_snd_id, time ); |
|
90 | result = action_load_sbm1_par( &TC, queue_snd_id, time ); | |
88 | close_action( &TC, result, queue_snd_id, time ); |
|
91 | close_action( &TC, result, queue_snd_id, time ); | |
89 | break; |
|
92 | break; | |
90 | // |
|
93 | // | |
91 | case TC_SUBTYPE_LOAD_SBM2: |
|
94 | case TC_SUBTYPE_LOAD_SBM2: | |
92 | result = action_load_sbm2_par( &TC, queue_snd_id, time ); |
|
95 | result = action_load_sbm2_par( &TC, queue_snd_id, time ); | |
93 | close_action( &TC, result, queue_snd_id, time ); |
|
96 | close_action( &TC, result, queue_snd_id, time ); | |
94 | break; |
|
97 | break; | |
95 | // |
|
98 | // | |
96 | case TC_SUBTYPE_DUMP: |
|
99 | case TC_SUBTYPE_DUMP: | |
97 | result = action_dump_par( queue_snd_id ); |
|
100 | result = action_dump_par( queue_snd_id ); | |
98 | close_action( &TC, result, queue_snd_id, time ); |
|
101 | close_action( &TC, result, queue_snd_id, time ); | |
99 | break; |
|
102 | break; | |
100 | // |
|
103 | // | |
101 | case TC_SUBTYPE_ENTER: |
|
104 | case TC_SUBTYPE_ENTER: | |
102 | result = action_enter_mode( &TC, queue_snd_id, time ); |
|
105 | result = action_enter_mode( &TC, queue_snd_id, time ); | |
103 | close_action( &TC, result, queue_snd_id, time ); |
|
106 | close_action( &TC, result, queue_snd_id, time ); | |
104 | break; |
|
107 | break; | |
105 | // |
|
108 | // | |
106 | case TC_SUBTYPE_UPDT_INFO: |
|
109 | case TC_SUBTYPE_UPDT_INFO: | |
107 | result = action_update_info( &TC, queue_snd_id ); |
|
110 | result = action_update_info( &TC, queue_snd_id ); | |
108 | close_action( &TC, result, queue_snd_id, time ); |
|
111 | close_action( &TC, result, queue_snd_id, time ); | |
109 | break; |
|
112 | break; | |
110 | // |
|
113 | // | |
111 | case TC_SUBTYPE_EN_CAL: |
|
114 | case TC_SUBTYPE_EN_CAL: | |
112 | result = action_enable_calibration( &TC, queue_snd_id, time ); |
|
115 | result = action_enable_calibration( &TC, queue_snd_id, time ); | |
113 | close_action( &TC, result, queue_snd_id, time ); |
|
116 | close_action( &TC, result, queue_snd_id, time ); | |
114 | break; |
|
117 | break; | |
115 | // |
|
118 | // | |
116 | case TC_SUBTYPE_DIS_CAL: |
|
119 | case TC_SUBTYPE_DIS_CAL: | |
117 | result = action_disable_calibration( &TC, queue_snd_id, time ); |
|
120 | result = action_disable_calibration( &TC, queue_snd_id, time ); | |
118 | close_action( &TC, result, queue_snd_id, time ); |
|
121 | close_action( &TC, result, queue_snd_id, time ); | |
119 | break; |
|
122 | break; | |
120 | // |
|
123 | // | |
121 | case TC_SUBTYPE_UPDT_TIME: |
|
124 | case TC_SUBTYPE_UPDT_TIME: | |
122 | result = action_update_time( &TC ); |
|
125 | result = action_update_time( &TC ); | |
123 | close_action( &TC, result, queue_snd_id, time ); |
|
126 | close_action( &TC, result, queue_snd_id, time ); | |
124 | break; |
|
127 | break; | |
125 | // |
|
128 | // | |
126 | default: |
|
129 | default: | |
127 | break; |
|
130 | break; | |
128 | } |
|
131 | } | |
129 | } |
|
132 | } | |
130 | } |
|
133 | } | |
131 | } |
|
134 | } | |
132 |
|
135 | |||
133 | //*********** |
|
136 | //*********** | |
134 | // TC ACTIONS |
|
137 | // TC ACTIONS | |
135 |
|
138 | |||
136 | int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
139 | int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) | |
137 | { |
|
140 | { | |
138 | /** This function executes specific actions when a TC_LFR_RESET TeleCommand has been received. |
|
141 | /** This function executes specific actions when a TC_LFR_RESET TeleCommand has been received. | |
139 | * |
|
142 | * | |
140 | * @param TC points to the TeleCommand packet that is being processed |
|
143 | * @param TC points to the TeleCommand packet that is being processed | |
141 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
144 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver | |
142 | * |
|
145 | * | |
143 | */ |
|
146 | */ | |
144 |
|
147 | |||
145 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); |
|
148 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); | |
146 | return LFR_DEFAULT; |
|
149 | return LFR_DEFAULT; | |
147 | } |
|
150 | } | |
148 |
|
151 | |||
149 | int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
152 | int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) | |
150 | { |
|
153 | { | |
151 | /** This function executes specific actions when a TC_LFR_ENTER_MODE TeleCommand has been received. |
|
154 | /** This function executes specific actions when a TC_LFR_ENTER_MODE TeleCommand has been received. | |
152 | * |
|
155 | * | |
153 | * @param TC points to the TeleCommand packet that is being processed |
|
156 | * @param TC points to the TeleCommand packet that is being processed | |
154 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
157 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver | |
155 | * |
|
158 | * | |
156 | */ |
|
159 | */ | |
157 |
|
160 | |||
158 | rtems_status_code status; |
|
161 | rtems_status_code status; | |
159 | unsigned char requestedMode; |
|
162 | unsigned char requestedMode; | |
160 |
|
163 | |||
161 | requestedMode = TC->dataAndCRC[1]; |
|
164 | requestedMode = TC->dataAndCRC[1]; | |
162 |
|
165 | |||
163 | if ( (requestedMode != LFR_MODE_STANDBY) |
|
166 | if ( (requestedMode != LFR_MODE_STANDBY) | |
164 | && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST) |
|
167 | && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST) | |
165 | && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) ) |
|
168 | && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) ) | |
166 | { |
|
169 | { | |
167 | status = RTEMS_UNSATISFIED; |
|
170 | status = RTEMS_UNSATISFIED; | |
168 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_LFR_MODE, requestedMode, time ); |
|
171 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_LFR_MODE, requestedMode, time ); | |
169 | } |
|
172 | } | |
170 | else |
|
173 | else | |
171 | { |
|
174 | { | |
172 | printf("try to enter mode %d\n", requestedMode); |
|
175 | printf("try to enter mode %d\n", requestedMode); | |
173 |
|
176 | |||
174 | #ifdef PRINT_TASK_STATISTICS |
|
177 | #ifdef PRINT_TASK_STATISTICS | |
175 | if (requestedMode != LFR_MODE_STANDBY) |
|
178 | if (requestedMode != LFR_MODE_STANDBY) | |
176 | { |
|
179 | { | |
177 | rtems_cpu_usage_reset(); |
|
180 | rtems_cpu_usage_reset(); | |
178 | maxCount = 0; |
|
181 | maxCount = 0; | |
179 | } |
|
182 | } | |
180 | #endif |
|
183 | #endif | |
181 |
|
184 | |||
182 | status = transition_validation(requestedMode); |
|
185 | status = transition_validation(requestedMode); | |
183 |
|
186 | |||
184 | if ( status == LFR_SUCCESSFUL ) { |
|
187 | if ( status == LFR_SUCCESSFUL ) { | |
185 | if ( lfrCurrentMode != LFR_MODE_STANDBY) |
|
188 | if ( lfrCurrentMode != LFR_MODE_STANDBY) | |
186 | { |
|
189 | { | |
187 | status = stop_current_mode(); |
|
190 | status = stop_current_mode(); | |
188 | } |
|
191 | } | |
189 | if (status != RTEMS_SUCCESSFUL) |
|
192 | if (status != RTEMS_SUCCESSFUL) | |
190 | { |
|
193 | { | |
191 | PRINTF("ERR *** in action_enter *** stop_current_mode\n") |
|
194 | PRINTF("ERR *** in action_enter *** stop_current_mode\n") | |
192 | } |
|
195 | } | |
193 |
status = enter_mode(requestedMode |
|
196 | status = enter_mode( requestedMode ); | |
194 | } |
|
197 | } | |
195 | else |
|
198 | else | |
196 | { |
|
199 | { | |
197 | PRINTF("ERR *** in action_enter *** transition rejected\n") |
|
200 | PRINTF("ERR *** in action_enter *** transition rejected\n") | |
198 | send_tm_lfr_tc_exe_not_executable( TC, queue_id, time ); |
|
201 | send_tm_lfr_tc_exe_not_executable( TC, queue_id, time ); | |
199 | } |
|
202 | } | |
200 | } |
|
203 | } | |
201 |
|
204 | |||
202 | return status; |
|
205 | return status; | |
203 | } |
|
206 | } | |
204 |
|
207 | |||
205 | int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
208 | int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) | |
206 | { |
|
209 | { | |
207 | /** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received. |
|
210 | /** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received. | |
208 | * |
|
211 | * | |
209 | * @param TC points to the TeleCommand packet that is being processed |
|
212 | * @param TC points to the TeleCommand packet that is being processed | |
210 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
213 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver | |
211 | * |
|
214 | * | |
212 | * @return LFR directive status code: |
|
215 | * @return LFR directive status code: | |
213 | * - LFR_DEFAULT |
|
216 | * - LFR_DEFAULT | |
214 | * - LFR_SUCCESSFUL |
|
217 | * - LFR_SUCCESSFUL | |
215 | * |
|
218 | * | |
216 | */ |
|
219 | */ | |
217 |
|
220 | |||
218 | unsigned int val; |
|
221 | unsigned int val; | |
219 | int result; |
|
222 | int result; | |
220 |
|
223 | |||
221 | result = LFR_SUCCESSFUL; |
|
224 | result = LFR_SUCCESSFUL; | |
222 |
|
225 | |||
223 | val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256 |
|
226 | val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256 | |
224 | + housekeeping_packet.hk_lfr_update_info_tc_cnt[1]; |
|
227 | + housekeeping_packet.hk_lfr_update_info_tc_cnt[1]; | |
225 | val++; |
|
228 | val++; | |
226 | housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8); |
|
229 | housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8); | |
227 | housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val); |
|
230 | housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val); | |
228 |
|
231 | |||
229 | return result; |
|
232 | return result; | |
230 | } |
|
233 | } | |
231 |
|
234 | |||
232 | int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
235 | int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) | |
233 | { |
|
236 | { | |
234 | /** This function executes specific actions when a TC_LFR_ENABLE_CALIBRATION TeleCommand has been received. |
|
237 | /** This function executes specific actions when a TC_LFR_ENABLE_CALIBRATION TeleCommand has been received. | |
235 | * |
|
238 | * | |
236 | * @param TC points to the TeleCommand packet that is being processed |
|
239 | * @param TC points to the TeleCommand packet that is being processed | |
237 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
240 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver | |
238 | * |
|
241 | * | |
239 | */ |
|
242 | */ | |
240 |
|
243 | |||
241 | int result; |
|
244 | int result; | |
242 | unsigned char lfrMode; |
|
245 | unsigned char lfrMode; | |
243 |
|
246 | |||
244 | result = LFR_DEFAULT; |
|
247 | result = LFR_DEFAULT; | |
245 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
248 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
246 |
|
249 | |||
247 | if ( (lfrMode == LFR_MODE_STANDBY) || (lfrMode == LFR_MODE_BURST) || (lfrMode == LFR_MODE_SBM2) ) { |
|
250 | if ( (lfrMode == LFR_MODE_STANDBY) || (lfrMode == LFR_MODE_BURST) || (lfrMode == LFR_MODE_SBM2) ) { | |
248 | send_tm_lfr_tc_exe_not_executable( TC, queue_id, time ); |
|
251 | send_tm_lfr_tc_exe_not_executable( TC, queue_id, time ); | |
249 | result = LFR_DEFAULT; |
|
252 | result = LFR_DEFAULT; | |
250 | } |
|
253 | } | |
251 | else { |
|
254 | else { | |
252 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); |
|
255 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); | |
253 | result = LFR_DEFAULT; |
|
256 | result = LFR_DEFAULT; | |
254 | } |
|
257 | } | |
255 | return result; |
|
258 | return result; | |
256 | } |
|
259 | } | |
257 |
|
260 | |||
258 | int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
261 | int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) | |
259 | { |
|
262 | { | |
260 | /** This function executes specific actions when a TC_LFR_DISABLE_CALIBRATION TeleCommand has been received. |
|
263 | /** This function executes specific actions when a TC_LFR_DISABLE_CALIBRATION TeleCommand has been received. | |
261 | * |
|
264 | * | |
262 | * @param TC points to the TeleCommand packet that is being processed |
|
265 | * @param TC points to the TeleCommand packet that is being processed | |
263 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
266 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver | |
264 | * |
|
267 | * | |
265 | */ |
|
268 | */ | |
266 |
|
269 | |||
267 | int result; |
|
270 | int result; | |
268 | unsigned char lfrMode; |
|
271 | unsigned char lfrMode; | |
269 |
|
272 | |||
270 | result = LFR_DEFAULT; |
|
273 | result = LFR_DEFAULT; | |
271 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
274 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
272 |
|
275 | |||
273 | if ( (lfrMode == LFR_MODE_STANDBY) || (lfrMode == LFR_MODE_BURST) || (lfrMode == LFR_MODE_SBM2) ) { |
|
276 | if ( (lfrMode == LFR_MODE_STANDBY) || (lfrMode == LFR_MODE_BURST) || (lfrMode == LFR_MODE_SBM2) ) { | |
274 | send_tm_lfr_tc_exe_not_executable( TC, queue_id, time ); |
|
277 | send_tm_lfr_tc_exe_not_executable( TC, queue_id, time ); | |
275 | result = LFR_DEFAULT; |
|
278 | result = LFR_DEFAULT; | |
276 | } |
|
279 | } | |
277 | else { |
|
280 | else { | |
278 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); |
|
281 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); | |
279 | result = LFR_DEFAULT; |
|
282 | result = LFR_DEFAULT; | |
280 | } |
|
283 | } | |
281 | return result; |
|
284 | return result; | |
282 | } |
|
285 | } | |
283 |
|
286 | |||
284 | int action_update_time(ccsdsTelecommandPacket_t *TC) |
|
287 | int action_update_time(ccsdsTelecommandPacket_t *TC) | |
285 | { |
|
288 | { | |
286 | /** This function executes specific actions when a TC_LFR_UPDATE_TIME TeleCommand has been received. |
|
289 | /** This function executes specific actions when a TC_LFR_UPDATE_TIME TeleCommand has been received. | |
287 | * |
|
290 | * | |
288 | * @param TC points to the TeleCommand packet that is being processed |
|
291 | * @param TC points to the TeleCommand packet that is being processed | |
289 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
292 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver | |
290 | * |
|
293 | * | |
291 | * @return LFR_SUCCESSFUL |
|
294 | * @return LFR_SUCCESSFUL | |
292 | * |
|
295 | * | |
293 | */ |
|
296 | */ | |
294 |
|
297 | |||
295 | unsigned int val; |
|
298 | unsigned int val; | |
296 |
|
299 | |||
297 | time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24) |
|
300 | time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24) | |
298 | + (TC->dataAndCRC[1] << 16) |
|
301 | + (TC->dataAndCRC[1] << 16) | |
299 | + (TC->dataAndCRC[2] << 8) |
|
302 | + (TC->dataAndCRC[2] << 8) | |
300 | + TC->dataAndCRC[3]; |
|
303 | + TC->dataAndCRC[3]; | |
301 | val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256 |
|
304 | val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256 | |
302 | + housekeeping_packet.hk_lfr_update_time_tc_cnt[1]; |
|
305 | + housekeeping_packet.hk_lfr_update_time_tc_cnt[1]; | |
303 | val++; |
|
306 | val++; | |
304 | housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8); |
|
307 | housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8); | |
305 | housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val); |
|
308 | housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val); | |
306 | time_management_regs->ctrl = time_management_regs->ctrl | 1; |
|
309 | time_management_regs->ctrl = time_management_regs->ctrl | 1; | |
307 |
|
310 | |||
308 | return LFR_SUCCESSFUL; |
|
311 | return LFR_SUCCESSFUL; | |
309 | } |
|
312 | } | |
310 |
|
313 | |||
311 | //******************* |
|
314 | //******************* | |
312 | // ENTERING THE MODES |
|
315 | // ENTERING THE MODES | |
313 |
|
316 | |||
314 | int transition_validation(unsigned char requestedMode) |
|
317 | int transition_validation(unsigned char requestedMode) | |
315 | { |
|
318 | { | |
|
319 | /** This function checks the validity of the transition requested by the TC_LFR_ENTER_MODE. | |||
|
320 | * | |||
|
321 | * @param requestedMode is the mode requested by the TC_LFR_ENTER_MODE | |||
|
322 | * | |||
|
323 | * @return LFR directive status codes: | |||
|
324 | * - LFR_SUCCESSFUL - the transition is authorized | |||
|
325 | * - LFR_DEFAULT - the transition is not authorized | |||
|
326 | * | |||
|
327 | */ | |||
|
328 | ||||
316 | int status; |
|
329 | int status; | |
317 |
|
330 | |||
318 | switch (requestedMode) |
|
331 | switch (requestedMode) | |
319 | { |
|
332 | { | |
320 | case LFR_MODE_STANDBY: |
|
333 | case LFR_MODE_STANDBY: | |
321 | if ( lfrCurrentMode == LFR_MODE_STANDBY ) { |
|
334 | if ( lfrCurrentMode == LFR_MODE_STANDBY ) { | |
322 | status = LFR_DEFAULT; |
|
335 | status = LFR_DEFAULT; | |
323 | } |
|
336 | } | |
324 | else |
|
337 | else | |
325 | { |
|
338 | { | |
326 | status = LFR_SUCCESSFUL; |
|
339 | status = LFR_SUCCESSFUL; | |
327 | } |
|
340 | } | |
328 | break; |
|
341 | break; | |
329 | case LFR_MODE_NORMAL: |
|
342 | case LFR_MODE_NORMAL: | |
330 | if ( lfrCurrentMode == LFR_MODE_NORMAL ) { |
|
343 | if ( lfrCurrentMode == LFR_MODE_NORMAL ) { | |
331 | status = LFR_DEFAULT; |
|
344 | status = LFR_DEFAULT; | |
332 | } |
|
345 | } | |
333 | else { |
|
346 | else { | |
334 | status = LFR_SUCCESSFUL; |
|
347 | status = LFR_SUCCESSFUL; | |
335 | } |
|
348 | } | |
336 | break; |
|
349 | break; | |
337 | case LFR_MODE_BURST: |
|
350 | case LFR_MODE_BURST: | |
338 | if ( lfrCurrentMode == LFR_MODE_BURST ) { |
|
351 | if ( lfrCurrentMode == LFR_MODE_BURST ) { | |
339 | status = LFR_DEFAULT; |
|
352 | status = LFR_DEFAULT; | |
340 | } |
|
353 | } | |
341 | else { |
|
354 | else { | |
342 | status = LFR_SUCCESSFUL; |
|
355 | status = LFR_SUCCESSFUL; | |
343 | } |
|
356 | } | |
344 | break; |
|
357 | break; | |
345 | case LFR_MODE_SBM1: |
|
358 | case LFR_MODE_SBM1: | |
346 | if ( lfrCurrentMode == LFR_MODE_SBM1 ) { |
|
359 | if ( lfrCurrentMode == LFR_MODE_SBM1 ) { | |
347 | status = LFR_DEFAULT; |
|
360 | status = LFR_DEFAULT; | |
348 | } |
|
361 | } | |
349 | else { |
|
362 | else { | |
350 | status = LFR_SUCCESSFUL; |
|
363 | status = LFR_SUCCESSFUL; | |
351 | } |
|
364 | } | |
352 | break; |
|
365 | break; | |
353 | case LFR_MODE_SBM2: |
|
366 | case LFR_MODE_SBM2: | |
354 | if ( lfrCurrentMode == LFR_MODE_SBM2 ) { |
|
367 | if ( lfrCurrentMode == LFR_MODE_SBM2 ) { | |
355 | status = LFR_DEFAULT; |
|
368 | status = LFR_DEFAULT; | |
356 | } |
|
369 | } | |
357 | else { |
|
370 | else { | |
358 | status = LFR_SUCCESSFUL; |
|
371 | status = LFR_SUCCESSFUL; | |
359 | } |
|
372 | } | |
360 | break; |
|
373 | break; | |
361 | default: |
|
374 | default: | |
362 | status = LFR_DEFAULT; |
|
375 | status = LFR_DEFAULT; | |
363 | break; |
|
376 | break; | |
364 | } |
|
377 | } | |
365 |
|
378 | |||
366 | return status; |
|
379 | return status; | |
367 | } |
|
380 | } | |
368 |
|
381 | |||
369 | int stop_current_mode() |
|
382 | int stop_current_mode() | |
370 | { |
|
383 | { | |
371 | /** This function stops the current mode by masking interrupt lines and suspending science tasks. |
|
384 | /** This function stops the current mode by masking interrupt lines and suspending science tasks. | |
372 | * |
|
385 | * | |
373 | * @return RTEMS directive status codes: |
|
386 | * @return RTEMS directive status codes: | |
374 | * - RTEMS_SUCCESSFUL - task restarted successfully |
|
387 | * - RTEMS_SUCCESSFUL - task restarted successfully | |
375 | * - RTEMS_INVALID_ID - task id invalid |
|
388 | * - RTEMS_INVALID_ID - task id invalid | |
376 | * - RTEMS_ALREADY_SUSPENDED - task already suspended |
|
389 | * - RTEMS_ALREADY_SUSPENDED - task already suspended | |
377 | * |
|
390 | * | |
378 | */ |
|
391 | */ | |
379 |
|
392 | |||
380 | rtems_status_code status; |
|
393 | rtems_status_code status; | |
381 |
|
394 | |||
382 | status = RTEMS_SUCCESSFUL; |
|
395 | status = RTEMS_SUCCESSFUL; | |
383 |
|
396 | |||
384 | #ifdef GSA |
|
397 | #ifdef GSA | |
385 | LEON_Mask_interrupt( IRQ_WF ); // mask waveform interrupt (coming from the timer VHDL IP) |
|
398 | LEON_Mask_interrupt( IRQ_WF ); // mask waveform interrupt (coming from the timer VHDL IP) | |
386 | LEON_Clear_interrupt( IRQ_WF ); // clear waveform interrupt (coming from the timer VHDL IP) |
|
399 | LEON_Clear_interrupt( IRQ_WF ); // clear waveform interrupt (coming from the timer VHDL IP) | |
387 | timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR ); |
|
400 | timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR ); | |
388 | #else |
|
401 | #else | |
389 | // mask interruptions |
|
402 | // mask interruptions | |
390 | LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt |
|
403 | LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt | |
391 | LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // mask spectral matrix interrupt |
|
404 | LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // mask spectral matrix interrupt | |
392 | // reset registers |
|
405 | // reset registers | |
393 | reset_wfp_burst_enable(); // reset burst and enable bits |
|
406 | reset_wfp_burst_enable(); // reset burst and enable bits | |
394 | reset_wfp_status(); // reset all the status bits |
|
407 | reset_wfp_status(); // reset all the status bits | |
395 | // creal interruptions |
|
408 | // creal interruptions | |
396 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt |
|
409 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt | |
397 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectarl matrix interrupt |
|
410 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectarl matrix interrupt | |
398 | #endif |
|
411 | #endif | |
399 | //********************** |
|
412 | //********************** | |
400 | // suspend several tasks |
|
413 | // suspend several tasks | |
401 | if (lfrCurrentMode != LFR_MODE_STANDBY) { |
|
414 | if (lfrCurrentMode != LFR_MODE_STANDBY) { | |
402 | status = suspend_science_tasks(); |
|
415 | status = suspend_science_tasks(); | |
403 | } |
|
416 | } | |
404 |
|
417 | |||
405 | if (status != RTEMS_SUCCESSFUL) |
|
418 | if (status != RTEMS_SUCCESSFUL) | |
406 | { |
|
419 | { | |
407 | PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status) |
|
420 | PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status) | |
408 | } |
|
421 | } | |
409 |
|
422 | |||
410 | return status; |
|
423 | return status; | |
411 | } |
|
424 | } | |
412 |
|
425 | |||
413 |
int enter_mode(unsigned char mode |
|
426 | int enter_mode(unsigned char mode ) | |
414 | { |
|
427 | { | |
|
428 | /** This function is launched after a mode transition validation. | |||
|
429 | * | |||
|
430 | * @param mode is the mode in which LFR will be put. | |||
|
431 | * | |||
|
432 | * @return RTEMS directive status codes: | |||
|
433 | * - RTEMS_SUCCESSFUL - the mode has been entered successfully | |||
|
434 | * - RTEMS_NOT_SATISFIED - the mode has not been entered successfully | |||
|
435 | * | |||
|
436 | */ | |||
|
437 | ||||
415 | rtems_status_code status; |
|
438 | rtems_status_code status; | |
416 |
|
439 | |||
417 | status = RTEMS_UNSATISFIED; |
|
440 | status = RTEMS_UNSATISFIED; | |
418 |
|
441 | |||
419 | housekeeping_packet.lfr_status_word[0] = (unsigned char) ((mode << 4) + 0x0d); |
|
442 | housekeeping_packet.lfr_status_word[0] = (unsigned char) ((mode << 4) + 0x0d); | |
420 | updateLFRCurrentMode(); |
|
443 | updateLFRCurrentMode(); | |
421 |
|
444 | |||
422 | switch(mode){ |
|
445 | switch(mode){ | |
423 | case LFR_MODE_STANDBY: |
|
446 | case LFR_MODE_STANDBY: | |
424 | status = enter_standby_mode( ); |
|
447 | status = enter_standby_mode( ); | |
425 | break; |
|
448 | break; | |
426 | case LFR_MODE_NORMAL: |
|
449 | case LFR_MODE_NORMAL: | |
427 | status = enter_normal_mode( ); |
|
450 | status = enter_normal_mode( ); | |
428 | break; |
|
451 | break; | |
429 | case LFR_MODE_BURST: |
|
452 | case LFR_MODE_BURST: | |
430 | status = enter_burst_mode( ); |
|
453 | status = enter_burst_mode( ); | |
431 | break; |
|
454 | break; | |
432 | case LFR_MODE_SBM1: |
|
455 | case LFR_MODE_SBM1: | |
433 | status = enter_sbm1_mode( ); |
|
456 | status = enter_sbm1_mode( ); | |
434 | break; |
|
457 | break; | |
435 | case LFR_MODE_SBM2: |
|
458 | case LFR_MODE_SBM2: | |
436 | status = enter_sbm2_mode( ); |
|
459 | status = enter_sbm2_mode( ); | |
437 | break; |
|
460 | break; | |
438 | default: |
|
461 | default: | |
439 | status = RTEMS_UNSATISFIED; |
|
462 | status = RTEMS_UNSATISFIED; | |
440 | } |
|
463 | } | |
441 |
|
464 | |||
442 | if (status != RTEMS_SUCCESSFUL) |
|
465 | if (status != RTEMS_SUCCESSFUL) | |
443 | { |
|
466 | { | |
444 | PRINTF("in enter_mode *** ERR\n") |
|
467 | PRINTF("in enter_mode *** ERR\n") | |
445 | status = RTEMS_UNSATISFIED; |
|
468 | status = RTEMS_UNSATISFIED; | |
446 | } |
|
469 | } | |
447 |
|
470 | |||
448 | return status; |
|
471 | return status; | |
449 | } |
|
472 | } | |
450 |
|
473 | |||
451 | int enter_standby_mode() |
|
474 | int enter_standby_mode() | |
452 | { |
|
475 | { | |
|
476 | /** This function is used to enter the STANDBY mode. | |||
|
477 | * | |||
|
478 | * @return RTEMS directive status codes: | |||
|
479 | * - RTEMS_SUCCESSFUL - the mode has been entered successfully | |||
|
480 | * | |||
|
481 | */ | |||
|
482 | ||||
453 | PRINTF1("maxCount = %d\n", maxCount) |
|
483 | PRINTF1("maxCount = %d\n", maxCount) | |
454 |
|
484 | |||
455 | #ifdef PRINT_TASK_STATISTICS |
|
485 | #ifdef PRINT_TASK_STATISTICS | |
456 | rtems_cpu_usage_report(); |
|
486 | rtems_cpu_usage_report(); | |
457 | #endif |
|
487 | #endif | |
458 |
|
488 | |||
459 | #ifdef PRINT_STACK_REPORT |
|
489 | #ifdef PRINT_STACK_REPORT | |
460 | rtems_stack_checker_report_usage(); |
|
490 | rtems_stack_checker_report_usage(); | |
461 | #endif |
|
491 | #endif | |
462 |
|
492 | |||
463 | return LFR_SUCCESSFUL; |
|
493 | return LFR_SUCCESSFUL; | |
464 | } |
|
494 | } | |
465 |
|
495 | |||
466 | int enter_normal_mode() |
|
496 | int enter_normal_mode() | |
467 | { |
|
497 | { | |
468 | rtems_status_code status; |
|
498 | rtems_status_code status; | |
469 |
|
499 | |||
470 | status = restart_science_tasks(); |
|
500 | status = restart_science_tasks(); | |
471 |
|
501 | |||
472 | #ifdef GSA |
|
502 | #ifdef GSA | |
473 | timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR ); |
|
503 | timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR ); | |
474 | timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); |
|
504 | timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); | |
475 | LEON_Clear_interrupt( IRQ_WF ); |
|
505 | LEON_Clear_interrupt( IRQ_WF ); | |
476 | LEON_Unmask_interrupt( IRQ_WF ); |
|
506 | LEON_Unmask_interrupt( IRQ_WF ); | |
477 | // |
|
507 | // | |
478 | set_local_nb_interrupt_f0_MAX(); |
|
508 | set_local_nb_interrupt_f0_MAX(); | |
479 | LEON_Clear_interrupt( IRQ_SM ); // the IRQ_SM seems to be incompatible with the IRQ_WF on the xilinx board |
|
509 | LEON_Clear_interrupt( IRQ_SM ); // the IRQ_SM seems to be incompatible with the IRQ_WF on the xilinx board | |
480 | LEON_Unmask_interrupt( IRQ_SM ); |
|
510 | LEON_Unmask_interrupt( IRQ_SM ); | |
481 | #else |
|
511 | #else | |
482 | //**************** |
|
512 | //**************** | |
483 | // waveform picker |
|
513 | // waveform picker | |
484 | reset_waveform_picker_regs(); |
|
514 | reset_waveform_picker_regs(); | |
485 | set_wfp_burst_enable_register(LFR_MODE_NORMAL); |
|
515 | set_wfp_burst_enable_register(LFR_MODE_NORMAL); | |
486 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); |
|
516 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); | |
487 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); |
|
517 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); | |
488 | //**************** |
|
518 | //**************** | |
489 | // spectral matrix |
|
519 | // spectral matrix | |
490 | #endif |
|
520 | #endif | |
491 |
|
521 | |||
492 | return status; |
|
522 | return status; | |
493 | } |
|
523 | } | |
494 |
|
524 | |||
495 | int enter_burst_mode() |
|
525 | int enter_burst_mode() | |
496 | { |
|
526 | { | |
|
527 | /** This function is used to enter the STANDBY mode. | |||
|
528 | * | |||
|
529 | * @return RTEMS directive status codes: | |||
|
530 | * - RTEMS_SUCCESSFUL - the mode has been entered successfully | |||
|
531 | * - RTEMS_INVALID_ID - task id invalid | |||
|
532 | * - RTEMS_INCORRECT_STATE - task never started | |||
|
533 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task | |||
|
534 | * | |||
|
535 | */ | |||
|
536 | ||||
497 | rtems_status_code status; |
|
537 | rtems_status_code status; | |
498 |
|
538 | |||
499 | status = restart_science_tasks(); |
|
539 | status = restart_science_tasks(); | |
500 |
|
540 | |||
501 | #ifdef GSA |
|
541 | #ifdef GSA | |
502 | LEON_Unmask_interrupt( IRQ_SM ); |
|
542 | LEON_Unmask_interrupt( IRQ_SM ); | |
503 | #else |
|
543 | #else | |
504 | reset_waveform_picker_regs(); |
|
544 | reset_waveform_picker_regs(); | |
505 | set_wfp_burst_enable_register(LFR_MODE_BURST); |
|
545 | set_wfp_burst_enable_register(LFR_MODE_BURST); | |
506 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); |
|
546 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); | |
507 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); |
|
547 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); | |
508 | #endif |
|
548 | #endif | |
509 |
|
549 | |||
510 | return status; |
|
550 | return status; | |
511 | } |
|
551 | } | |
512 |
|
552 | |||
513 | int enter_sbm1_mode() |
|
553 | int enter_sbm1_mode() | |
514 | { |
|
554 | { | |
|
555 | /** This function is used to enter the SBM1 mode. | |||
|
556 | * | |||
|
557 | * @return RTEMS directive status codes: | |||
|
558 | * - RTEMS_SUCCESSFUL - the mode has been entered successfully | |||
|
559 | * - RTEMS_INVALID_ID - task id invalid | |||
|
560 | * - RTEMS_INCORRECT_STATE - task never started | |||
|
561 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task | |||
|
562 | * | |||
|
563 | */ | |||
|
564 | ||||
515 | rtems_status_code status; |
|
565 | rtems_status_code status; | |
516 |
|
566 | |||
517 | status = restart_science_tasks(); |
|
567 | status = restart_science_tasks(); | |
518 |
|
568 | |||
519 | set_local_sbm1_nb_cwf_max(); |
|
569 | set_local_sbm1_nb_cwf_max(); | |
520 |
|
570 | |||
521 | reset_local_sbm1_nb_cwf_sent(); |
|
571 | reset_local_sbm1_nb_cwf_sent(); | |
522 |
|
572 | |||
523 | #ifdef GSA |
|
573 | #ifdef GSA | |
524 | LEON_Unmask_interrupt( IRQ_SM ); |
|
574 | LEON_Unmask_interrupt( IRQ_SM ); | |
525 | #else |
|
575 | #else | |
526 | reset_waveform_picker_regs(); |
|
576 | reset_waveform_picker_regs(); | |
527 | set_wfp_burst_enable_register(LFR_MODE_SBM1); |
|
577 | set_wfp_burst_enable_register(LFR_MODE_SBM1); | |
528 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); |
|
578 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); | |
529 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); |
|
579 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); | |
530 | // SM simulation |
|
|||
531 | // timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); |
|
|||
532 | // LEON_Clear_interrupt( IRQ_SM ); // the IRQ_SM seems to be incompatible with the IRQ_WF on the xilinx board |
|
|||
533 | // LEON_Unmask_interrupt( IRQ_SM ); |
|
|||
534 | #endif |
|
580 | #endif | |
535 |
|
581 | |||
536 | return status; |
|
582 | return status; | |
537 | } |
|
583 | } | |
538 |
|
584 | |||
539 | int enter_sbm2_mode() |
|
585 | int enter_sbm2_mode() | |
540 | { |
|
586 | { | |
|
587 | /** This function is used to enter the SBM2 mode. | |||
|
588 | * | |||
|
589 | * @return RTEMS directive status codes: | |||
|
590 | * - RTEMS_SUCCESSFUL - the mode has been entered successfully | |||
|
591 | * - RTEMS_INVALID_ID - task id invalid | |||
|
592 | * - RTEMS_INCORRECT_STATE - task never started | |||
|
593 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task | |||
|
594 | * | |||
|
595 | */ | |||
|
596 | ||||
541 | rtems_status_code status; |
|
597 | rtems_status_code status; | |
542 |
|
598 | |||
543 | status = restart_science_tasks(); |
|
599 | status = restart_science_tasks(); | |
544 |
|
600 | |||
545 | set_local_sbm2_nb_cwf_max(); |
|
601 | set_local_sbm2_nb_cwf_max(); | |
546 |
|
602 | |||
547 | reset_local_sbm2_nb_cwf_sent(); |
|
603 | reset_local_sbm2_nb_cwf_sent(); | |
548 |
|
604 | |||
549 | #ifdef GSA |
|
605 | #ifdef GSA | |
550 | LEON_Unmask_interrupt( IRQ_SM ); |
|
606 | LEON_Unmask_interrupt( IRQ_SM ); | |
551 | #else |
|
607 | #else | |
552 | reset_waveform_picker_regs(); |
|
608 | reset_waveform_picker_regs(); | |
553 | set_wfp_burst_enable_register(LFR_MODE_SBM2); |
|
609 | set_wfp_burst_enable_register(LFR_MODE_SBM2); | |
554 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); |
|
610 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); | |
555 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); |
|
611 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); | |
556 | #endif |
|
612 | #endif | |
557 |
|
613 | |||
558 | return status; |
|
614 | return status; | |
559 | } |
|
615 | } | |
560 |
|
616 | |||
561 | int restart_science_tasks() |
|
617 | int restart_science_tasks() | |
562 | { |
|
618 | { | |
|
619 | /** This function is used to restart all science tasks. | |||
|
620 | * | |||
|
621 | * @return RTEMS directive status codes: | |||
|
622 | * - RTEMS_SUCCESSFUL - task restarted successfully | |||
|
623 | * - RTEMS_INVALID_ID - task id invalid | |||
|
624 | * - RTEMS_INCORRECT_STATE - task never started | |||
|
625 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task | |||
|
626 | * | |||
|
627 | * Science tasks are AVF0, BPF0, WFRM, CWF3, CW2, CWF1 | |||
|
628 | * | |||
|
629 | */ | |||
|
630 | ||||
563 | rtems_status_code status[6]; |
|
631 | rtems_status_code status[6]; | |
564 | rtems_status_code ret; |
|
632 | rtems_status_code ret; | |
565 |
|
633 | |||
566 | ret = RTEMS_SUCCESSFUL; |
|
634 | ret = RTEMS_SUCCESSFUL; | |
567 |
|
635 | |||
568 | status[0] = rtems_task_restart( Task_id[TASKID_AVF0], 1 ); |
|
636 | status[0] = rtems_task_restart( Task_id[TASKID_AVF0], 1 ); | |
569 | if (status[0] != RTEMS_SUCCESSFUL) |
|
637 | if (status[0] != RTEMS_SUCCESSFUL) | |
570 | { |
|
638 | { | |
571 | PRINTF1("in restart_science_task *** 0 ERR %d\n", status[0]) |
|
639 | PRINTF1("in restart_science_task *** 0 ERR %d\n", status[0]) | |
572 | } |
|
640 | } | |
573 |
|
641 | |||
574 | status[1] = rtems_task_restart( Task_id[TASKID_BPF0],1 ); |
|
642 | status[1] = rtems_task_restart( Task_id[TASKID_BPF0],1 ); | |
575 | if (status[1] != RTEMS_SUCCESSFUL) |
|
643 | if (status[1] != RTEMS_SUCCESSFUL) | |
576 | { |
|
644 | { | |
577 | PRINTF1("in restart_science_task *** 1 ERR %d\n", status[1]) |
|
645 | PRINTF1("in restart_science_task *** 1 ERR %d\n", status[1]) | |
578 | } |
|
646 | } | |
579 |
|
647 | |||
580 | status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 ); |
|
648 | status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 ); | |
581 | if (status[2] != RTEMS_SUCCESSFUL) |
|
649 | if (status[2] != RTEMS_SUCCESSFUL) | |
582 | { |
|
650 | { | |
583 | PRINTF1("in restart_science_task *** 2 ERR %d\n", status[2]) |
|
651 | PRINTF1("in restart_science_task *** 2 ERR %d\n", status[2]) | |
584 | } |
|
652 | } | |
585 |
|
653 | |||
586 | status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 ); |
|
654 | status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 ); | |
587 | if (status[3] != RTEMS_SUCCESSFUL) |
|
655 | if (status[3] != RTEMS_SUCCESSFUL) | |
588 | { |
|
656 | { | |
589 | PRINTF1("in restart_science_task *** 3 ERR %d\n", status[3]) |
|
657 | PRINTF1("in restart_science_task *** 3 ERR %d\n", status[3]) | |
590 | } |
|
658 | } | |
591 |
|
659 | |||
592 | status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 ); |
|
660 | status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 ); | |
593 | if (status[4] != RTEMS_SUCCESSFUL) |
|
661 | if (status[4] != RTEMS_SUCCESSFUL) | |
594 | { |
|
662 | { | |
595 | PRINTF1("in restart_science_task *** 4 ERR %d\n", status[4]) |
|
663 | PRINTF1("in restart_science_task *** 4 ERR %d\n", status[4]) | |
596 | } |
|
664 | } | |
597 |
|
665 | |||
598 | status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 ); |
|
666 | status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 ); | |
599 | if (status[5] != RTEMS_SUCCESSFUL) |
|
667 | if (status[5] != RTEMS_SUCCESSFUL) | |
600 | { |
|
668 | { | |
601 | PRINTF1("in restart_science_task *** 5 ERR %d\n", status[5]) |
|
669 | PRINTF1("in restart_science_task *** 5 ERR %d\n", status[5]) | |
602 | } |
|
670 | } | |
603 |
|
671 | |||
604 | if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) || |
|
672 | if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) || | |
605 | (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) ) |
|
673 | (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) ) | |
606 | { |
|
674 | { | |
607 | ret = RTEMS_UNSATISFIED; |
|
675 | ret = RTEMS_UNSATISFIED; | |
608 | } |
|
676 | } | |
609 |
|
677 | |||
610 | return ret; |
|
678 | return ret; | |
611 | } |
|
679 | } | |
612 |
|
680 | |||
613 | int suspend_science_tasks() |
|
681 | int suspend_science_tasks() | |
614 | { |
|
682 | { | |
615 | /** This function suspends the science tasks. |
|
683 | /** This function suspends the science tasks. | |
616 | * |
|
684 | * | |
617 | * @return RTEMS directive status codes: |
|
685 | * @return RTEMS directive status codes: | |
618 | * - RTEMS_SUCCESSFUL - task restarted successfully |
|
686 | * - RTEMS_SUCCESSFUL - task restarted successfully | |
619 | * - RTEMS_INVALID_ID - task id invalid |
|
687 | * - RTEMS_INVALID_ID - task id invalid | |
620 | * - RTEMS_ALREADY_SUSPENDED - task already suspended |
|
688 | * - RTEMS_ALREADY_SUSPENDED - task already suspended | |
621 | * |
|
689 | * | |
622 | */ |
|
690 | */ | |
623 |
|
691 | |||
624 | rtems_status_code status; |
|
692 | rtems_status_code status; | |
625 |
|
693 | |||
626 | status = rtems_task_suspend( Task_id[TASKID_AVF0] ); |
|
694 | status = rtems_task_suspend( Task_id[TASKID_AVF0] ); | |
627 | if (status != RTEMS_SUCCESSFUL) |
|
695 | if (status != RTEMS_SUCCESSFUL) | |
628 | { |
|
696 | { | |
629 | PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status) |
|
697 | PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status) | |
630 | } |
|
698 | } | |
631 |
|
699 | |||
632 | if (status == RTEMS_SUCCESSFUL) // suspend BPF0 |
|
700 | if (status == RTEMS_SUCCESSFUL) // suspend BPF0 | |
633 | { |
|
701 | { | |
634 | status = rtems_task_suspend( Task_id[TASKID_BPF0] ); |
|
702 | status = rtems_task_suspend( Task_id[TASKID_BPF0] ); | |
635 | if (status != RTEMS_SUCCESSFUL) |
|
703 | if (status != RTEMS_SUCCESSFUL) | |
636 | { |
|
704 | { | |
637 | PRINTF1("in suspend_science_task *** BPF0 ERR %d\n", status) |
|
705 | PRINTF1("in suspend_science_task *** BPF0 ERR %d\n", status) | |
638 | } |
|
706 | } | |
639 | } |
|
707 | } | |
640 |
|
708 | |||
641 | if (status == RTEMS_SUCCESSFUL) // suspend WFRM |
|
709 | if (status == RTEMS_SUCCESSFUL) // suspend WFRM | |
642 | { |
|
710 | { | |
643 | status = rtems_task_suspend( Task_id[TASKID_WFRM] ); |
|
711 | status = rtems_task_suspend( Task_id[TASKID_WFRM] ); | |
644 | if (status != RTEMS_SUCCESSFUL) |
|
712 | if (status != RTEMS_SUCCESSFUL) | |
645 | { |
|
713 | { | |
646 | PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status) |
|
714 | PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status) | |
647 | } |
|
715 | } | |
648 | } |
|
716 | } | |
649 |
|
717 | |||
650 | if (status == RTEMS_SUCCESSFUL) // suspend CWF3 |
|
718 | if (status == RTEMS_SUCCESSFUL) // suspend CWF3 | |
651 | { |
|
719 | { | |
652 | status = rtems_task_suspend( Task_id[TASKID_CWF3] ); |
|
720 | status = rtems_task_suspend( Task_id[TASKID_CWF3] ); | |
653 | if (status != RTEMS_SUCCESSFUL) |
|
721 | if (status != RTEMS_SUCCESSFUL) | |
654 | { |
|
722 | { | |
655 | PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status) |
|
723 | PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status) | |
656 | } |
|
724 | } | |
657 | } |
|
725 | } | |
658 |
|
726 | |||
659 | if (status == RTEMS_SUCCESSFUL) // suspend CWF2 |
|
727 | if (status == RTEMS_SUCCESSFUL) // suspend CWF2 | |
660 | { |
|
728 | { | |
661 | status = rtems_task_suspend( Task_id[TASKID_CWF2] ); |
|
729 | status = rtems_task_suspend( Task_id[TASKID_CWF2] ); | |
662 | if (status != RTEMS_SUCCESSFUL) |
|
730 | if (status != RTEMS_SUCCESSFUL) | |
663 | { |
|
731 | { | |
664 | PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status) |
|
732 | PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status) | |
665 | } |
|
733 | } | |
666 | } |
|
734 | } | |
667 |
|
735 | |||
668 | if (status == RTEMS_SUCCESSFUL) // suspend CWF1 |
|
736 | if (status == RTEMS_SUCCESSFUL) // suspend CWF1 | |
669 | { |
|
737 | { | |
670 | status = rtems_task_suspend( Task_id[TASKID_CWF1] ); |
|
738 | status = rtems_task_suspend( Task_id[TASKID_CWF1] ); | |
671 | if (status != RTEMS_SUCCESSFUL) |
|
739 | if (status != RTEMS_SUCCESSFUL) | |
672 | { |
|
740 | { | |
673 | PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status) |
|
741 | PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status) | |
674 | } |
|
742 | } | |
675 | } |
|
743 | } | |
676 |
|
744 | |||
677 | return status; |
|
745 | return status; | |
678 | } |
|
746 | } | |
679 |
|
747 | |||
680 | //**************** |
|
748 | //**************** | |
681 | // CLOSING ACTIONS |
|
749 | // CLOSING ACTIONS | |
682 | void update_last_TC_exe(ccsdsTelecommandPacket_t *TC, unsigned char *time) |
|
750 | void update_last_TC_exe(ccsdsTelecommandPacket_t *TC, unsigned char *time) | |
683 | { |
|
751 | { | |
|
752 | /** This function is used to update the HK packets statistics after a successful TC execution. | |||
|
753 | * | |||
|
754 | * @param TC points to the TC being processed | |||
|
755 | * @param time is the time used to date the TC execution | |||
|
756 | * | |||
|
757 | */ | |||
|
758 | ||||
684 | housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0]; |
|
759 | housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0]; | |
685 | housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1]; |
|
760 | housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1]; | |
686 | housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00; |
|
761 | housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00; | |
687 | housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType; |
|
762 | housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType; | |
688 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00; |
|
763 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00; | |
689 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType; |
|
764 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType; | |
690 | housekeeping_packet.hk_lfr_last_exe_tc_time[0] = time[0]; |
|
765 | housekeeping_packet.hk_lfr_last_exe_tc_time[0] = time[0]; | |
691 | housekeeping_packet.hk_lfr_last_exe_tc_time[1] = time[1]; |
|
766 | housekeeping_packet.hk_lfr_last_exe_tc_time[1] = time[1]; | |
692 | housekeeping_packet.hk_lfr_last_exe_tc_time[2] = time[2]; |
|
767 | housekeeping_packet.hk_lfr_last_exe_tc_time[2] = time[2]; | |
693 | housekeeping_packet.hk_lfr_last_exe_tc_time[3] = time[3]; |
|
768 | housekeeping_packet.hk_lfr_last_exe_tc_time[3] = time[3]; | |
694 | housekeeping_packet.hk_lfr_last_exe_tc_time[4] = time[4]; |
|
769 | housekeeping_packet.hk_lfr_last_exe_tc_time[4] = time[4]; | |
695 | housekeeping_packet.hk_lfr_last_exe_tc_time[5] = time[5]; |
|
770 | housekeeping_packet.hk_lfr_last_exe_tc_time[5] = time[5]; | |
696 | } |
|
771 | } | |
697 |
|
772 | |||
698 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char *time) |
|
773 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char *time) | |
699 | { |
|
774 | { | |
|
775 | /** This function is used to update the HK packets statistics after a TC rejection. | |||
|
776 | * | |||
|
777 | * @param TC points to the TC being processed | |||
|
778 | * @param time is the time used to date the TC rejection | |||
|
779 | * | |||
|
780 | */ | |||
|
781 | ||||
700 | housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0]; |
|
782 | housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0]; | |
701 | housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1]; |
|
783 | housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1]; | |
702 | housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00; |
|
784 | housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00; | |
703 | housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType; |
|
785 | housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType; | |
704 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00; |
|
786 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00; | |
705 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType; |
|
787 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType; | |
706 | housekeeping_packet.hk_lfr_last_rej_tc_time[0] = time[0]; |
|
788 | housekeeping_packet.hk_lfr_last_rej_tc_time[0] = time[0]; | |
707 | housekeeping_packet.hk_lfr_last_rej_tc_time[1] = time[1]; |
|
789 | housekeeping_packet.hk_lfr_last_rej_tc_time[1] = time[1]; | |
708 | housekeeping_packet.hk_lfr_last_rej_tc_time[2] = time[2]; |
|
790 | housekeeping_packet.hk_lfr_last_rej_tc_time[2] = time[2]; | |
709 | housekeeping_packet.hk_lfr_last_rej_tc_time[3] = time[3]; |
|
791 | housekeeping_packet.hk_lfr_last_rej_tc_time[3] = time[3]; | |
710 | housekeeping_packet.hk_lfr_last_rej_tc_time[4] = time[4]; |
|
792 | housekeeping_packet.hk_lfr_last_rej_tc_time[4] = time[4]; | |
711 | housekeeping_packet.hk_lfr_last_rej_tc_time[5] = time[5]; |
|
793 | housekeeping_packet.hk_lfr_last_rej_tc_time[5] = time[5]; | |
712 | } |
|
794 | } | |
713 |
|
795 | |||
714 | void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id, unsigned char *time) |
|
796 | void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id, unsigned char *time) | |
715 | { |
|
797 | { | |
|
798 | /** This function is the last step of the TC execution workflow. | |||
|
799 | * | |||
|
800 | * @param TC points to the TC being processed | |||
|
801 | * @param result is the result of the TC execution (LFR_SUCCESSFUL / LFR_DEFAULT) | |||
|
802 | * @param queue_id is the id of the RTEMS message queue used to send TM packets | |||
|
803 | * @param time is the time used to date the TC execution | |||
|
804 | * | |||
|
805 | */ | |||
|
806 | ||||
716 | unsigned int val = 0; |
|
807 | unsigned int val = 0; | |
717 |
|
808 | |||
718 | if (result == LFR_SUCCESSFUL) |
|
809 | if (result == LFR_SUCCESSFUL) | |
719 | { |
|
810 | { | |
720 | if ( !( (TC->serviceType==TC_TYPE_TIME) && (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) ) |
|
811 | if ( !( (TC->serviceType==TC_TYPE_TIME) && (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) ) | |
721 | && |
|
812 | && | |
722 | !( (TC->serviceType==TC_TYPE_GEN) && (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO)) |
|
813 | !( (TC->serviceType==TC_TYPE_GEN) && (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO)) | |
723 | ) |
|
814 | ) | |
724 | { |
|
815 | { | |
725 | send_tm_lfr_tc_exe_success( TC, queue_id, time ); |
|
816 | send_tm_lfr_tc_exe_success( TC, queue_id, time ); | |
726 | } |
|
817 | } | |
727 | update_last_TC_exe( TC, time ); |
|
818 | update_last_TC_exe( TC, time ); | |
728 | val = housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[0] * 256 + housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[1]; |
|
819 | val = housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[0] * 256 + housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[1]; | |
729 | val++; |
|
820 | val++; | |
730 | housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[0] = (unsigned char) (val >> 8); |
|
821 | housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[0] = (unsigned char) (val >> 8); | |
731 | housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[1] = (unsigned char) (val); |
|
822 | housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[1] = (unsigned char) (val); | |
732 | } |
|
823 | } | |
733 | else |
|
824 | else | |
734 | { |
|
825 | { | |
735 | update_last_TC_rej( TC, time ); |
|
826 | update_last_TC_rej( TC, time ); | |
736 | val = housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[0] * 256 + housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[1]; |
|
827 | val = housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[0] * 256 + housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[1]; | |
737 | val++; |
|
828 | val++; | |
738 | housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[0] = (unsigned char) (val >> 8); |
|
829 | housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[0] = (unsigned char) (val >> 8); | |
739 | housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[1] = (unsigned char) (val); |
|
830 | housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[1] = (unsigned char) (val); | |
740 | } |
|
831 | } | |
741 | } |
|
832 | } | |
742 |
|
833 | |||
743 | //*************************** |
|
834 | //*************************** | |
744 | // Interrupt Service Routines |
|
835 | // Interrupt Service Routines | |
745 | rtems_isr commutation_isr1( rtems_vector_number vector ) |
|
836 | rtems_isr commutation_isr1( rtems_vector_number vector ) | |
746 | { |
|
837 | { | |
747 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
838 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { | |
748 | printf("In commutation_isr1 *** Error sending event to DUMB\n"); |
|
839 | printf("In commutation_isr1 *** Error sending event to DUMB\n"); | |
749 | } |
|
840 | } | |
750 | } |
|
841 | } | |
751 |
|
842 | |||
752 | rtems_isr commutation_isr2( rtems_vector_number vector ) |
|
843 | rtems_isr commutation_isr2( rtems_vector_number vector ) | |
753 | { |
|
844 | { | |
754 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
845 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { | |
755 | printf("In commutation_isr2 *** Error sending event to DUMB\n"); |
|
846 | printf("In commutation_isr2 *** Error sending event to DUMB\n"); | |
756 | } |
|
847 | } | |
757 | } |
|
848 | } | |
758 |
|
849 | |||
759 | //**************** |
|
850 | //**************** | |
760 | // OTHER FUNCTIONS |
|
851 | // OTHER FUNCTIONS | |
761 | void updateLFRCurrentMode() |
|
852 | void updateLFRCurrentMode() | |
762 | { |
|
853 | { | |
763 | /** This function updates the value of the global variable lfrCurrentMode. |
|
854 | /** This function updates the value of the global variable lfrCurrentMode. | |
764 | * |
|
855 | * | |
765 | * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running. |
|
856 | * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running. | |
766 | * |
|
857 | * | |
767 | */ |
|
858 | */ | |
768 | // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure |
|
859 | // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure | |
769 | lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
860 | lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
770 | } |
|
861 | } | |
771 |
|
862 |
@@ -1,492 +1,501 | |||||
1 | /** Functions to send TM packets related to TC parsing and execution. |
|
1 | /** Functions to send TM packets related to TC parsing and execution. | |
2 | * |
|
2 | * | |
3 | * @file |
|
3 | * @file | |
4 | * @author P. LEROY |
|
4 | * @author P. LEROY | |
5 | * |
|
5 | * | |
6 | * A group of functions to send appropriate TM packets after parsing and execution: |
|
6 | * A group of functions to send appropriate TM packets after parsing and execution: | |
7 | * - TM_LFR_TC_EXE_SUCCESS |
|
7 | * - TM_LFR_TC_EXE_SUCCESS | |
8 | * - TM_LFR_TC_EXE_INCONSISTENT |
|
8 | * - TM_LFR_TC_EXE_INCONSISTENT | |
9 | * - TM_LFR_TC_EXE_NOT_EXECUTABLE |
|
9 | * - TM_LFR_TC_EXE_NOT_EXECUTABLE | |
10 | * - TM_LFR_TC_EXE_NOT_IMPLEMENTED |
|
10 | * - TM_LFR_TC_EXE_NOT_IMPLEMENTED | |
11 | * - TM_LFR_TC_EXE_ERROR |
|
11 | * - TM_LFR_TC_EXE_ERROR | |
12 | * - TM_LFR_TC_EXE_CORRUPTED |
|
12 | * - TM_LFR_TC_EXE_CORRUPTED | |
13 | * |
|
13 | * | |
14 | */ |
|
14 | */ | |
15 |
|
15 | |||
16 | #include "tm_lfr_tc_exe.h" |
|
16 | #include "tm_lfr_tc_exe.h" | |
17 |
|
17 | |||
18 | int send_tm_lfr_tc_exe_success( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time ) |
|
18 | int send_tm_lfr_tc_exe_success( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time ) | |
19 | { |
|
19 | { | |
20 | /** This function sends a TM_LFR_TC_EXE_SUCCESS packet in the dedicated RTEMS message queue. |
|
20 | /** This function sends a TM_LFR_TC_EXE_SUCCESS packet in the dedicated RTEMS message queue. | |
21 | * |
|
21 | * | |
22 | * @param TC points to the TeleCommand packet that is being processed |
|
22 | * @param TC points to the TeleCommand packet that is being processed | |
23 | * @param queue_id is the id of the queue which handles TM |
|
23 | * @param queue_id is the id of the queue which handles TM | |
24 | * |
|
24 | * | |
25 | * @return RTEMS directive status code: |
|
25 | * @return RTEMS directive status code: | |
26 | * - RTEMS_SUCCESSFUL - message sent successfully |
|
26 | * - RTEMS_SUCCESSFUL - message sent successfully | |
27 | * - RTEMS_INVALID_ID - invalid queue id |
|
27 | * - RTEMS_INVALID_ID - invalid queue id | |
28 | * - RTEMS_INVALID_SIZE - invalid message size |
|
28 | * - RTEMS_INVALID_SIZE - invalid message size | |
29 | * - RTEMS_INVALID_ADDRESS - buffer is NULL |
|
29 | * - RTEMS_INVALID_ADDRESS - buffer is NULL | |
30 | * - RTEMS_UNSATISFIED - out of message buffers |
|
30 | * - RTEMS_UNSATISFIED - out of message buffers | |
31 | * - RTEMS_TOO_MANY - queue s limit has been reached |
|
31 | * - RTEMS_TOO_MANY - queue s limit has been reached | |
32 | * |
|
32 | * | |
33 | */ |
|
33 | */ | |
34 |
|
34 | |||
35 | rtems_status_code status; |
|
35 | rtems_status_code status; | |
36 | Packet_TM_LFR_TC_EXE_SUCCESS_t TM; |
|
36 | Packet_TM_LFR_TC_EXE_SUCCESS_t TM; | |
37 | unsigned char messageSize; |
|
37 | unsigned char messageSize; | |
38 |
|
38 | |||
39 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
39 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; | |
40 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
40 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
41 | TM.reserved = DEFAULT_RESERVED; |
|
41 | TM.reserved = DEFAULT_RESERVED; | |
42 | TM.userApplication = CCSDS_USER_APP; |
|
42 | TM.userApplication = CCSDS_USER_APP; | |
43 | // PACKET HEADER |
|
43 | // PACKET HEADER | |
44 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); |
|
44 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); | |
45 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); |
|
45 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); | |
46 | increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID ); |
|
46 | increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID ); | |
47 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_SUCCESS >> 8); |
|
47 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_SUCCESS >> 8); | |
48 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_SUCCESS ); |
|
48 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_SUCCESS ); | |
49 | // DATA FIELD HEADER |
|
49 | // DATA FIELD HEADER | |
50 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
50 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
51 | TM.serviceType = TM_TYPE_TC_EXE; |
|
51 | TM.serviceType = TM_TYPE_TC_EXE; | |
52 | TM.serviceSubType = TM_SUBTYPE_EXE_OK; |
|
52 | TM.serviceSubType = TM_SUBTYPE_EXE_OK; | |
53 | TM.destinationID = TC->sourceID; |
|
53 | TM.destinationID = TC->sourceID; | |
54 | TM.time[0] = time[0]; |
|
54 | TM.time[0] = time[0]; | |
55 | TM.time[1] = time[1]; |
|
55 | TM.time[1] = time[1]; | |
56 | TM.time[2] = time[2]; |
|
56 | TM.time[2] = time[2]; | |
57 | TM.time[3] = time[3]; |
|
57 | TM.time[3] = time[3]; | |
58 | TM.time[4] = time[4]; |
|
58 | TM.time[4] = time[4]; | |
59 | TM.time[5] = time[5]; |
|
59 | TM.time[5] = time[5]; | |
60 | // |
|
60 | // | |
61 | TM.telecommand_pkt_id[0] = TC->packetID[0]; |
|
61 | TM.telecommand_pkt_id[0] = TC->packetID[0]; | |
62 | TM.telecommand_pkt_id[1] = TC->packetID[1]; |
|
62 | TM.telecommand_pkt_id[1] = TC->packetID[1]; | |
63 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; |
|
63 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; | |
64 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; |
|
64 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; | |
65 |
|
65 | |||
66 | messageSize = PACKET_LENGTH_TC_EXE_SUCCESS + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
66 | messageSize = PACKET_LENGTH_TC_EXE_SUCCESS + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; | |
67 |
|
67 | |||
68 | // SEND DATA |
|
68 | // SEND DATA | |
69 | status = rtems_message_queue_send( queue_id, &TM, messageSize); |
|
69 | status = rtems_message_queue_send( queue_id, &TM, messageSize); | |
70 | if (status != RTEMS_SUCCESSFUL) { |
|
70 | if (status != RTEMS_SUCCESSFUL) { | |
71 | PRINTF("in send_tm_lfr_tc_exe_success *** ERR\n") |
|
71 | PRINTF("in send_tm_lfr_tc_exe_success *** ERR\n") | |
72 | } |
|
72 | } | |
73 |
|
73 | |||
74 | return status; |
|
74 | return status; | |
75 | } |
|
75 | } | |
76 |
|
76 | |||
77 | int send_tm_lfr_tc_exe_inconsistent( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, |
|
77 | int send_tm_lfr_tc_exe_inconsistent( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, | |
78 | unsigned char byte_position, unsigned char rcv_value, |
|
78 | unsigned char byte_position, unsigned char rcv_value, | |
79 | unsigned char *time) |
|
79 | unsigned char *time) | |
80 | { |
|
80 | { | |
81 | /** This function sends a TM_LFR_TC_EXE_INCONSISTENT packet in the dedicated RTEMS message queue. |
|
81 | /** This function sends a TM_LFR_TC_EXE_INCONSISTENT packet in the dedicated RTEMS message queue. | |
82 | * |
|
82 | * | |
83 | * @param TC points to the TeleCommand packet that is being processed |
|
83 | * @param TC points to the TeleCommand packet that is being processed | |
84 | * @param queue_id is the id of the queue which handles TM |
|
84 | * @param queue_id is the id of the queue which handles TM | |
85 | * @param byte_position is the byte position of the MSB of the parameter that has been seen as inconsistent |
|
85 | * @param byte_position is the byte position of the MSB of the parameter that has been seen as inconsistent | |
86 | * @param rcv_value is the value of the LSB of the parameter that has been deteced as inconsistent |
|
86 | * @param rcv_value is the value of the LSB of the parameter that has been deteced as inconsistent | |
87 | * |
|
87 | * | |
88 | * @return RTEMS directive status code: |
|
88 | * @return RTEMS directive status code: | |
89 | * - RTEMS_SUCCESSFUL - message sent successfully |
|
89 | * - RTEMS_SUCCESSFUL - message sent successfully | |
90 | * - RTEMS_INVALID_ID - invalid queue id |
|
90 | * - RTEMS_INVALID_ID - invalid queue id | |
91 | * - RTEMS_INVALID_SIZE - invalid message size |
|
91 | * - RTEMS_INVALID_SIZE - invalid message size | |
92 | * - RTEMS_INVALID_ADDRESS - buffer is NULL |
|
92 | * - RTEMS_INVALID_ADDRESS - buffer is NULL | |
93 | * - RTEMS_UNSATISFIED - out of message buffers |
|
93 | * - RTEMS_UNSATISFIED - out of message buffers | |
94 | * - RTEMS_TOO_MANY - queue s limit has been reached |
|
94 | * - RTEMS_TOO_MANY - queue s limit has been reached | |
95 | * |
|
95 | * | |
96 | */ |
|
96 | */ | |
97 |
|
97 | |||
98 | rtems_status_code status; |
|
98 | rtems_status_code status; | |
99 | Packet_TM_LFR_TC_EXE_INCONSISTENT_t TM; |
|
99 | Packet_TM_LFR_TC_EXE_INCONSISTENT_t TM; | |
100 | unsigned char messageSize; |
|
100 | unsigned char messageSize; | |
101 |
|
101 | |||
102 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
102 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; | |
103 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
103 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
104 | TM.reserved = DEFAULT_RESERVED; |
|
104 | TM.reserved = DEFAULT_RESERVED; | |
105 | TM.userApplication = CCSDS_USER_APP; |
|
105 | TM.userApplication = CCSDS_USER_APP; | |
106 | // PACKET HEADER |
|
106 | // PACKET HEADER | |
107 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); |
|
107 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); | |
108 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); |
|
108 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); | |
109 | increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID ); |
|
109 | increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID ); | |
110 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_INCONSISTENT >> 8); |
|
110 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_INCONSISTENT >> 8); | |
111 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_INCONSISTENT ); |
|
111 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_INCONSISTENT ); | |
112 | // DATA FIELD HEADER |
|
112 | // DATA FIELD HEADER | |
113 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
113 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
114 | TM.serviceType = TM_TYPE_TC_EXE; |
|
114 | TM.serviceType = TM_TYPE_TC_EXE; | |
115 | TM.serviceSubType = TM_SUBTYPE_EXE_NOK; |
|
115 | TM.serviceSubType = TM_SUBTYPE_EXE_NOK; | |
116 | TM.destinationID = TC->sourceID; |
|
116 | TM.destinationID = TC->sourceID; | |
117 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
117 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
118 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
118 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
119 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
119 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
120 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
120 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); | |
121 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
121 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
122 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
122 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); | |
123 | // |
|
123 | // | |
124 | TM.tc_failure_code[0] = (char) (WRONG_APP_DATA >> 8); |
|
124 | TM.tc_failure_code[0] = (char) (WRONG_APP_DATA >> 8); | |
125 | TM.tc_failure_code[1] = (char) (WRONG_APP_DATA ); |
|
125 | TM.tc_failure_code[1] = (char) (WRONG_APP_DATA ); | |
126 | TM.telecommand_pkt_id[0] = TC->packetID[0]; |
|
126 | TM.telecommand_pkt_id[0] = TC->packetID[0]; | |
127 | TM.telecommand_pkt_id[1] = TC->packetID[1]; |
|
127 | TM.telecommand_pkt_id[1] = TC->packetID[1]; | |
128 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; |
|
128 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; | |
129 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; |
|
129 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; | |
130 | TM.tc_service = TC->serviceType; // type of the rejected TC |
|
130 | TM.tc_service = TC->serviceType; // type of the rejected TC | |
131 | TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC |
|
131 | TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC | |
132 | TM.byte_position = byte_position; |
|
132 | TM.byte_position = byte_position; | |
133 | TM.rcv_value = rcv_value; |
|
133 | TM.rcv_value = rcv_value; | |
134 |
|
134 | |||
135 | messageSize = PACKET_LENGTH_TC_EXE_INCONSISTENT + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
135 | messageSize = PACKET_LENGTH_TC_EXE_INCONSISTENT + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; | |
136 |
|
136 | |||
137 | // SEND DATA |
|
137 | // SEND DATA | |
138 | status = rtems_message_queue_send( queue_id, &TM, messageSize); |
|
138 | status = rtems_message_queue_send( queue_id, &TM, messageSize); | |
139 | if (status != RTEMS_SUCCESSFUL) { |
|
139 | if (status != RTEMS_SUCCESSFUL) { | |
140 | PRINTF("in send_tm_lfr_tc_exe_inconsistent *** ERR\n") |
|
140 | PRINTF("in send_tm_lfr_tc_exe_inconsistent *** ERR\n") | |
141 | } |
|
141 | } | |
142 |
|
142 | |||
143 | return status; |
|
143 | return status; | |
144 | } |
|
144 | } | |
145 |
|
145 | |||
146 | int send_tm_lfr_tc_exe_not_executable( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time ) |
|
146 | int send_tm_lfr_tc_exe_not_executable( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time ) | |
147 | { |
|
147 | { | |
148 | /** This function sends a TM_LFR_TC_EXE_NOT_EXECUTABLE packet in the dedicated RTEMS message queue. |
|
148 | /** This function sends a TM_LFR_TC_EXE_NOT_EXECUTABLE packet in the dedicated RTEMS message queue. | |
149 | * |
|
149 | * | |
150 | * @param TC points to the TeleCommand packet that is being processed |
|
150 | * @param TC points to the TeleCommand packet that is being processed | |
151 | * @param queue_id is the id of the queue which handles TM |
|
151 | * @param queue_id is the id of the queue which handles TM | |
152 | * |
|
152 | * | |
153 | * @return RTEMS directive status code: |
|
153 | * @return RTEMS directive status code: | |
154 | * - RTEMS_SUCCESSFUL - message sent successfully |
|
154 | * - RTEMS_SUCCESSFUL - message sent successfully | |
155 | * - RTEMS_INVALID_ID - invalid queue id |
|
155 | * - RTEMS_INVALID_ID - invalid queue id | |
156 | * - RTEMS_INVALID_SIZE - invalid message size |
|
156 | * - RTEMS_INVALID_SIZE - invalid message size | |
157 | * - RTEMS_INVALID_ADDRESS - buffer is NULL |
|
157 | * - RTEMS_INVALID_ADDRESS - buffer is NULL | |
158 | * - RTEMS_UNSATISFIED - out of message buffers |
|
158 | * - RTEMS_UNSATISFIED - out of message buffers | |
159 | * - RTEMS_TOO_MANY - queue s limit has been reached |
|
159 | * - RTEMS_TOO_MANY - queue s limit has been reached | |
160 | * |
|
160 | * | |
161 | */ |
|
161 | */ | |
162 |
|
162 | |||
163 | rtems_status_code status; |
|
163 | rtems_status_code status; | |
164 | Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t TM; |
|
164 | Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t TM; | |
165 | unsigned char messageSize; |
|
165 | unsigned char messageSize; | |
166 |
|
166 | |||
167 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
167 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; | |
168 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
168 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
169 | TM.reserved = DEFAULT_RESERVED; |
|
169 | TM.reserved = DEFAULT_RESERVED; | |
170 | TM.userApplication = CCSDS_USER_APP; |
|
170 | TM.userApplication = CCSDS_USER_APP; | |
171 | // PACKET HEADER |
|
171 | // PACKET HEADER | |
172 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); |
|
172 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); | |
173 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); |
|
173 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); | |
174 | increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID ); |
|
174 | increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID ); | |
175 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE >> 8); |
|
175 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE >> 8); | |
176 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE ); |
|
176 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE ); | |
177 | // DATA FIELD HEADER |
|
177 | // DATA FIELD HEADER | |
178 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
178 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
179 | TM.serviceType = TM_TYPE_TC_EXE; |
|
179 | TM.serviceType = TM_TYPE_TC_EXE; | |
180 | TM.serviceSubType = TM_SUBTYPE_EXE_NOK; |
|
180 | TM.serviceSubType = TM_SUBTYPE_EXE_NOK; | |
181 | TM.destinationID = TC->sourceID; // default destination id |
|
181 | TM.destinationID = TC->sourceID; // default destination id | |
182 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
182 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
183 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
183 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
184 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
184 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
185 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
185 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); | |
186 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
186 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
187 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
187 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); | |
188 | // |
|
188 | // | |
189 | TM.tc_failure_code[0] = (char) (TC_NOT_EXE >> 8); |
|
189 | TM.tc_failure_code[0] = (char) (TC_NOT_EXE >> 8); | |
190 | TM.tc_failure_code[1] = (char) (TC_NOT_EXE ); |
|
190 | TM.tc_failure_code[1] = (char) (TC_NOT_EXE ); | |
191 | TM.telecommand_pkt_id[0] = TC->packetID[0]; |
|
191 | TM.telecommand_pkt_id[0] = TC->packetID[0]; | |
192 | TM.telecommand_pkt_id[1] = TC->packetID[1]; |
|
192 | TM.telecommand_pkt_id[1] = TC->packetID[1]; | |
193 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; |
|
193 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; | |
194 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; |
|
194 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; | |
195 | TM.tc_service = TC->serviceType; // type of the rejected TC |
|
195 | TM.tc_service = TC->serviceType; // type of the rejected TC | |
196 | TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC |
|
196 | TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC | |
197 | TM.lfr_status_word[0] = housekeeping_packet.lfr_status_word[0]; |
|
197 | TM.lfr_status_word[0] = housekeeping_packet.lfr_status_word[0]; | |
198 | TM.lfr_status_word[1] = housekeeping_packet.lfr_status_word[1]; |
|
198 | TM.lfr_status_word[1] = housekeeping_packet.lfr_status_word[1]; | |
199 |
|
199 | |||
200 | messageSize = PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
200 | messageSize = PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; | |
201 |
|
201 | |||
202 | // SEND DATA |
|
202 | // SEND DATA | |
203 | status = rtems_message_queue_send( queue_id, &TM, messageSize); |
|
203 | status = rtems_message_queue_send( queue_id, &TM, messageSize); | |
204 | if (status != RTEMS_SUCCESSFUL) { |
|
204 | if (status != RTEMS_SUCCESSFUL) { | |
205 | PRINTF("in send_tm_lfr_tc_exe_not_executable *** ERR\n") |
|
205 | PRINTF("in send_tm_lfr_tc_exe_not_executable *** ERR\n") | |
206 | } |
|
206 | } | |
207 |
|
207 | |||
208 | return status; |
|
208 | return status; | |
209 | } |
|
209 | } | |
210 |
|
210 | |||
211 | int send_tm_lfr_tc_exe_not_implemented( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time ) |
|
211 | int send_tm_lfr_tc_exe_not_implemented( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time ) | |
212 | { |
|
212 | { | |
213 | /** This function sends a TM_LFR_TC_EXE_NOT_IMPLEMENTED packet in the dedicated RTEMS message queue. |
|
213 | /** This function sends a TM_LFR_TC_EXE_NOT_IMPLEMENTED packet in the dedicated RTEMS message queue. | |
214 | * |
|
214 | * | |
215 | * @param TC points to the TeleCommand packet that is being processed |
|
215 | * @param TC points to the TeleCommand packet that is being processed | |
216 | * @param queue_id is the id of the queue which handles TM |
|
216 | * @param queue_id is the id of the queue which handles TM | |
217 | * |
|
217 | * | |
218 | * @return RTEMS directive status code: |
|
218 | * @return RTEMS directive status code: | |
219 | * - RTEMS_SUCCESSFUL - message sent successfully |
|
219 | * - RTEMS_SUCCESSFUL - message sent successfully | |
220 | * - RTEMS_INVALID_ID - invalid queue id |
|
220 | * - RTEMS_INVALID_ID - invalid queue id | |
221 | * - RTEMS_INVALID_SIZE - invalid message size |
|
221 | * - RTEMS_INVALID_SIZE - invalid message size | |
222 | * - RTEMS_INVALID_ADDRESS - buffer is NULL |
|
222 | * - RTEMS_INVALID_ADDRESS - buffer is NULL | |
223 | * - RTEMS_UNSATISFIED - out of message buffers |
|
223 | * - RTEMS_UNSATISFIED - out of message buffers | |
224 | * - RTEMS_TOO_MANY - queue s limit has been reached |
|
224 | * - RTEMS_TOO_MANY - queue s limit has been reached | |
225 | * |
|
225 | * | |
226 | */ |
|
226 | */ | |
227 |
|
227 | |||
228 | rtems_status_code status; |
|
228 | rtems_status_code status; | |
229 | Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t TM; |
|
229 | Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t TM; | |
230 | unsigned char messageSize; |
|
230 | unsigned char messageSize; | |
231 |
|
231 | |||
232 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
232 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; | |
233 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
233 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
234 | TM.reserved = DEFAULT_RESERVED; |
|
234 | TM.reserved = DEFAULT_RESERVED; | |
235 | TM.userApplication = CCSDS_USER_APP; |
|
235 | TM.userApplication = CCSDS_USER_APP; | |
236 | // PACKET HEADER |
|
236 | // PACKET HEADER | |
237 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); |
|
237 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); | |
238 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); |
|
238 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); | |
239 | increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID ); |
|
239 | increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID ); | |
240 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED >> 8); |
|
240 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED >> 8); | |
241 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED ); |
|
241 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED ); | |
242 | // DATA FIELD HEADER |
|
242 | // DATA FIELD HEADER | |
243 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
243 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
244 | TM.serviceType = TM_TYPE_TC_EXE; |
|
244 | TM.serviceType = TM_TYPE_TC_EXE; | |
245 | TM.serviceSubType = TM_SUBTYPE_EXE_NOK; |
|
245 | TM.serviceSubType = TM_SUBTYPE_EXE_NOK; | |
246 | TM.destinationID = TC->sourceID; // default destination id |
|
246 | TM.destinationID = TC->sourceID; // default destination id | |
247 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
247 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
248 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
248 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
249 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
249 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
250 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
250 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); | |
251 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
251 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
252 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
252 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); | |
253 | // |
|
253 | // | |
254 | TM.tc_failure_code[0] = (char) (FUNCT_NOT_IMPL >> 8); |
|
254 | TM.tc_failure_code[0] = (char) (FUNCT_NOT_IMPL >> 8); | |
255 | TM.tc_failure_code[1] = (char) (FUNCT_NOT_IMPL ); |
|
255 | TM.tc_failure_code[1] = (char) (FUNCT_NOT_IMPL ); | |
256 | TM.telecommand_pkt_id[0] = TC->packetID[0]; |
|
256 | TM.telecommand_pkt_id[0] = TC->packetID[0]; | |
257 | TM.telecommand_pkt_id[1] = TC->packetID[1]; |
|
257 | TM.telecommand_pkt_id[1] = TC->packetID[1]; | |
258 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; |
|
258 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; | |
259 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; |
|
259 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; | |
260 | TM.tc_service = TC->serviceType; // type of the rejected TC |
|
260 | TM.tc_service = TC->serviceType; // type of the rejected TC | |
261 | TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC |
|
261 | TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC | |
262 |
|
262 | |||
263 | messageSize = PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
263 | messageSize = PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; | |
264 |
|
264 | |||
265 | // SEND DATA |
|
265 | // SEND DATA | |
266 | status = rtems_message_queue_send( queue_id, &TM, messageSize); |
|
266 | status = rtems_message_queue_send( queue_id, &TM, messageSize); | |
267 | if (status != RTEMS_SUCCESSFUL) { |
|
267 | if (status != RTEMS_SUCCESSFUL) { | |
268 | PRINTF("in send_tm_lfr_tc_exe_not_implemented *** ERR\n") |
|
268 | PRINTF("in send_tm_lfr_tc_exe_not_implemented *** ERR\n") | |
269 | } |
|
269 | } | |
270 |
|
270 | |||
271 | return status; |
|
271 | return status; | |
272 | } |
|
272 | } | |
273 |
|
273 | |||
274 | int send_tm_lfr_tc_exe_error( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time ) |
|
274 | int send_tm_lfr_tc_exe_error( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time ) | |
275 | { |
|
275 | { | |
276 | /** This function sends a TM_LFR_TC_EXE_ERROR packet in the dedicated RTEMS message queue. |
|
276 | /** This function sends a TM_LFR_TC_EXE_ERROR packet in the dedicated RTEMS message queue. | |
277 | * |
|
277 | * | |
278 | * @param TC points to the TeleCommand packet that is being processed |
|
278 | * @param TC points to the TeleCommand packet that is being processed | |
279 | * @param queue_id is the id of the queue which handles TM |
|
279 | * @param queue_id is the id of the queue which handles TM | |
280 | * |
|
280 | * | |
281 | * @return RTEMS directive status code: |
|
281 | * @return RTEMS directive status code: | |
282 | * - RTEMS_SUCCESSFUL - message sent successfully |
|
282 | * - RTEMS_SUCCESSFUL - message sent successfully | |
283 | * - RTEMS_INVALID_ID - invalid queue id |
|
283 | * - RTEMS_INVALID_ID - invalid queue id | |
284 | * - RTEMS_INVALID_SIZE - invalid message size |
|
284 | * - RTEMS_INVALID_SIZE - invalid message size | |
285 | * - RTEMS_INVALID_ADDRESS - buffer is NULL |
|
285 | * - RTEMS_INVALID_ADDRESS - buffer is NULL | |
286 | * - RTEMS_UNSATISFIED - out of message buffers |
|
286 | * - RTEMS_UNSATISFIED - out of message buffers | |
287 | * - RTEMS_TOO_MANY - queue s limit has been reached |
|
287 | * - RTEMS_TOO_MANY - queue s limit has been reached | |
288 | * |
|
288 | * | |
289 | */ |
|
289 | */ | |
290 |
|
290 | |||
291 | rtems_status_code status; |
|
291 | rtems_status_code status; | |
292 | Packet_TM_LFR_TC_EXE_ERROR_t TM; |
|
292 | Packet_TM_LFR_TC_EXE_ERROR_t TM; | |
293 | unsigned char messageSize; |
|
293 | unsigned char messageSize; | |
294 |
|
294 | |||
295 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
295 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; | |
296 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
296 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
297 | TM.reserved = DEFAULT_RESERVED; |
|
297 | TM.reserved = DEFAULT_RESERVED; | |
298 | TM.userApplication = CCSDS_USER_APP; |
|
298 | TM.userApplication = CCSDS_USER_APP; | |
299 | // PACKET HEADER |
|
299 | // PACKET HEADER | |
300 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); |
|
300 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); | |
301 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); |
|
301 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); | |
302 | increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID ); |
|
302 | increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID ); | |
303 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_ERROR >> 8); |
|
303 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_ERROR >> 8); | |
304 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_ERROR ); |
|
304 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_ERROR ); | |
305 | // DATA FIELD HEADER |
|
305 | // DATA FIELD HEADER | |
306 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
306 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
307 | TM.serviceType = TM_TYPE_TC_EXE; |
|
307 | TM.serviceType = TM_TYPE_TC_EXE; | |
308 | TM.serviceSubType = TM_SUBTYPE_EXE_NOK; |
|
308 | TM.serviceSubType = TM_SUBTYPE_EXE_NOK; | |
309 | TM.destinationID = TC->sourceID; // default destination id |
|
309 | TM.destinationID = TC->sourceID; // default destination id | |
310 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
310 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
311 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
311 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
312 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
312 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
313 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
313 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); | |
314 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
314 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
315 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
315 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); | |
316 | // |
|
316 | // | |
317 | TM.tc_failure_code[0] = (char) (FAIL_DETECTED >> 8); |
|
317 | TM.tc_failure_code[0] = (char) (FAIL_DETECTED >> 8); | |
318 | TM.tc_failure_code[1] = (char) (FAIL_DETECTED ); |
|
318 | TM.tc_failure_code[1] = (char) (FAIL_DETECTED ); | |
319 | TM.telecommand_pkt_id[0] = TC->packetID[0]; |
|
319 | TM.telecommand_pkt_id[0] = TC->packetID[0]; | |
320 | TM.telecommand_pkt_id[1] = TC->packetID[1]; |
|
320 | TM.telecommand_pkt_id[1] = TC->packetID[1]; | |
321 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; |
|
321 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; | |
322 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; |
|
322 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; | |
323 | TM.tc_service = TC->serviceType; // type of the rejected TC |
|
323 | TM.tc_service = TC->serviceType; // type of the rejected TC | |
324 | TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC |
|
324 | TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC | |
325 |
|
325 | |||
326 | messageSize = PACKET_LENGTH_TC_EXE_ERROR + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
326 | messageSize = PACKET_LENGTH_TC_EXE_ERROR + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; | |
327 |
|
327 | |||
328 | // SEND DATA |
|
328 | // SEND DATA | |
329 | status = rtems_message_queue_send( queue_id, &TM, messageSize); |
|
329 | status = rtems_message_queue_send( queue_id, &TM, messageSize); | |
330 | if (status != RTEMS_SUCCESSFUL) { |
|
330 | if (status != RTEMS_SUCCESSFUL) { | |
331 | PRINTF("in send_tm_lfr_tc_exe_error *** ERR\n") |
|
331 | PRINTF("in send_tm_lfr_tc_exe_error *** ERR\n") | |
332 | } |
|
332 | } | |
333 |
|
333 | |||
334 | return status; |
|
334 | return status; | |
335 | } |
|
335 | } | |
336 |
|
336 | |||
337 | int send_tm_lfr_tc_exe_corrupted(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, |
|
337 | int send_tm_lfr_tc_exe_corrupted(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, | |
338 | unsigned char *computed_CRC, unsigned char *currentTC_LEN_RCV, |
|
338 | unsigned char *computed_CRC, unsigned char *currentTC_LEN_RCV, | |
339 | unsigned char destinationID, unsigned char *time) |
|
339 | unsigned char destinationID, unsigned char *time) | |
340 | { |
|
340 | { | |
341 | /** This function sends a TM_LFR_TC_EXE_CORRUPTED packet in the dedicated RTEMS message queue. |
|
341 | /** This function sends a TM_LFR_TC_EXE_CORRUPTED packet in the dedicated RTEMS message queue. | |
342 | * |
|
342 | * | |
343 | * @param TC points to the TeleCommand packet that is being processed |
|
343 | * @param TC points to the TeleCommand packet that is being processed | |
344 | * @param queue_id is the id of the queue which handles TM |
|
344 | * @param queue_id is the id of the queue which handles TM | |
345 | * @param computed_CRC points to a buffer of two bytes containing the CRC computed during the parsing of the TeleCommand |
|
345 | * @param computed_CRC points to a buffer of two bytes containing the CRC computed during the parsing of the TeleCommand | |
346 | * @param currentTC_LEN_RCV points to a buffer of two bytes containing a packet size field computed on the received data |
|
346 | * @param currentTC_LEN_RCV points to a buffer of two bytes containing a packet size field computed on the received data | |
347 | * |
|
347 | * | |
348 | * @return RTEMS directive status code: |
|
348 | * @return RTEMS directive status code: | |
349 | * - RTEMS_SUCCESSFUL - message sent successfully |
|
349 | * - RTEMS_SUCCESSFUL - message sent successfully | |
350 | * - RTEMS_INVALID_ID - invalid queue id |
|
350 | * - RTEMS_INVALID_ID - invalid queue id | |
351 | * - RTEMS_INVALID_SIZE - invalid message size |
|
351 | * - RTEMS_INVALID_SIZE - invalid message size | |
352 | * - RTEMS_INVALID_ADDRESS - buffer is NULL |
|
352 | * - RTEMS_INVALID_ADDRESS - buffer is NULL | |
353 | * - RTEMS_UNSATISFIED - out of message buffers |
|
353 | * - RTEMS_UNSATISFIED - out of message buffers | |
354 | * - RTEMS_TOO_MANY - queue s limit has been reached |
|
354 | * - RTEMS_TOO_MANY - queue s limit has been reached | |
355 | * |
|
355 | * | |
356 | */ |
|
356 | */ | |
357 |
|
357 | |||
358 | rtems_status_code status; |
|
358 | rtems_status_code status; | |
359 | Packet_TM_LFR_TC_EXE_CORRUPTED_t TM; |
|
359 | Packet_TM_LFR_TC_EXE_CORRUPTED_t TM; | |
360 | unsigned char messageSize; |
|
360 | unsigned char messageSize; | |
361 | unsigned int packetLength; |
|
361 | unsigned int packetLength; | |
362 | unsigned char *packetDataField; |
|
362 | unsigned char *packetDataField; | |
363 |
|
363 | |||
364 | packetLength = (TC->packetLength[0] * 256) + TC->packetLength[1]; // compute the packet length parameter |
|
364 | packetLength = (TC->packetLength[0] * 256) + TC->packetLength[1]; // compute the packet length parameter | |
365 | packetDataField = (unsigned char *) &TC->headerFlag_pusVersion_Ack; // get the beginning of the data field |
|
365 | packetDataField = (unsigned char *) &TC->headerFlag_pusVersion_Ack; // get the beginning of the data field | |
366 |
|
366 | |||
367 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
367 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; | |
368 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
368 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
369 | TM.reserved = DEFAULT_RESERVED; |
|
369 | TM.reserved = DEFAULT_RESERVED; | |
370 | TM.userApplication = CCSDS_USER_APP; |
|
370 | TM.userApplication = CCSDS_USER_APP; | |
371 | // PACKET HEADER |
|
371 | // PACKET HEADER | |
372 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); |
|
372 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); | |
373 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); |
|
373 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); | |
374 | increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID ); |
|
374 | increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID ); | |
375 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_CORRUPTED >> 8); |
|
375 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_CORRUPTED >> 8); | |
376 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_CORRUPTED ); |
|
376 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_CORRUPTED ); | |
377 | // DATA FIELD HEADER |
|
377 | // DATA FIELD HEADER | |
378 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
378 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
379 | TM.serviceType = TM_TYPE_TC_EXE; |
|
379 | TM.serviceType = TM_TYPE_TC_EXE; | |
380 | TM.serviceSubType = TM_SUBTYPE_EXE_NOK; |
|
380 | TM.serviceSubType = TM_SUBTYPE_EXE_NOK; | |
381 | TM.destinationID = destinationID; |
|
381 | TM.destinationID = destinationID; | |
382 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
382 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
383 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
383 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
384 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
384 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
385 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
385 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); | |
386 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
386 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
387 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
387 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); | |
388 | // |
|
388 | // | |
389 | TM.tc_failure_code[0] = (unsigned char) (CORRUPTED >> 8); |
|
389 | TM.tc_failure_code[0] = (unsigned char) (CORRUPTED >> 8); | |
390 | TM.tc_failure_code[1] = (unsigned char) (CORRUPTED ); |
|
390 | TM.tc_failure_code[1] = (unsigned char) (CORRUPTED ); | |
391 | TM.telecommand_pkt_id[0] = TC->packetID[0]; |
|
391 | TM.telecommand_pkt_id[0] = TC->packetID[0]; | |
392 | TM.telecommand_pkt_id[1] = TC->packetID[1]; |
|
392 | TM.telecommand_pkt_id[1] = TC->packetID[1]; | |
393 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; |
|
393 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; | |
394 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; |
|
394 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; | |
395 | TM.tc_service = TC->serviceType; // type of the rejected TC |
|
395 | TM.tc_service = TC->serviceType; // type of the rejected TC | |
396 | TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC |
|
396 | TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC | |
397 | TM.pkt_len_rcv_value[0] = TC->packetLength[0]; |
|
397 | TM.pkt_len_rcv_value[0] = TC->packetLength[0]; | |
398 | TM.pkt_len_rcv_value[1] = TC->packetLength[1]; |
|
398 | TM.pkt_len_rcv_value[1] = TC->packetLength[1]; | |
399 | TM.pkt_datafieldsize_cnt[0] = currentTC_LEN_RCV[0]; |
|
399 | TM.pkt_datafieldsize_cnt[0] = currentTC_LEN_RCV[0]; | |
400 | TM.pkt_datafieldsize_cnt[1] = currentTC_LEN_RCV[1]; |
|
400 | TM.pkt_datafieldsize_cnt[1] = currentTC_LEN_RCV[1]; | |
401 | TM.rcv_crc[0] = packetDataField[ packetLength - 1 ]; |
|
401 | TM.rcv_crc[0] = packetDataField[ packetLength - 1 ]; | |
402 | TM.rcv_crc[1] = packetDataField[ packetLength ]; |
|
402 | TM.rcv_crc[1] = packetDataField[ packetLength ]; | |
403 | TM.computed_crc[0] = computed_CRC[0]; |
|
403 | TM.computed_crc[0] = computed_CRC[0]; | |
404 | TM.computed_crc[1] = computed_CRC[1]; |
|
404 | TM.computed_crc[1] = computed_CRC[1]; | |
405 |
|
405 | |||
406 | messageSize = PACKET_LENGTH_TC_EXE_CORRUPTED + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
406 | messageSize = PACKET_LENGTH_TC_EXE_CORRUPTED + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; | |
407 |
|
407 | |||
408 | // SEND DATA |
|
408 | // SEND DATA | |
409 | status = rtems_message_queue_send( queue_id, &TM, messageSize); |
|
409 | status = rtems_message_queue_send( queue_id, &TM, messageSize); | |
410 | if (status != RTEMS_SUCCESSFUL) { |
|
410 | if (status != RTEMS_SUCCESSFUL) { | |
411 | PRINTF("in send_tm_lfr_tc_exe_error *** ERR\n") |
|
411 | PRINTF("in send_tm_lfr_tc_exe_error *** ERR\n") | |
412 | } |
|
412 | } | |
413 |
|
413 | |||
414 | return status; |
|
414 | return status; | |
415 | } |
|
415 | } | |
416 |
|
416 | |||
417 | void increment_seq_counter_destination_id( unsigned char *packet_sequence_control, unsigned char destination_id ) |
|
417 | void increment_seq_counter_destination_id( unsigned char *packet_sequence_control, unsigned char destination_id ) | |
418 | { |
|
418 | { | |
|
419 | /** This function increment the packet sequence control parameter of a TC, depending on its destination ID. | |||
|
420 | * | |||
|
421 | * @param packet_sequence_control points to the packet sequence control which will be incremented | |||
|
422 | * @param destination_id is the destination ID of the TM, there is one counter by destination ID | |||
|
423 | * | |||
|
424 | * If the destination ID is not known, a dedicated counter is incremented. | |||
|
425 | * | |||
|
426 | */ | |||
|
427 | ||||
419 | unsigned short sequence_cnt; |
|
428 | unsigned short sequence_cnt; | |
420 | unsigned short segmentation_grouping_flag; |
|
429 | unsigned short segmentation_grouping_flag; | |
421 | unsigned short new_packet_sequence_control; |
|
430 | unsigned short new_packet_sequence_control; | |
422 | unsigned char i; |
|
431 | unsigned char i; | |
423 |
|
432 | |||
424 | switch (destination_id) |
|
433 | switch (destination_id) | |
425 | { |
|
434 | { | |
426 | case SID_TC_GROUND: |
|
435 | case SID_TC_GROUND: | |
427 | i = GROUND; |
|
436 | i = GROUND; | |
428 | break; |
|
437 | break; | |
429 | case SID_TC_MISSION_TIMELINE: |
|
438 | case SID_TC_MISSION_TIMELINE: | |
430 | i = MISSION_TIMELINE; |
|
439 | i = MISSION_TIMELINE; | |
431 | break; |
|
440 | break; | |
432 | case SID_TC_TC_SEQUENCES: |
|
441 | case SID_TC_TC_SEQUENCES: | |
433 | i = TC_SEQUENCES; |
|
442 | i = TC_SEQUENCES; | |
434 | break; |
|
443 | break; | |
435 | case SID_TC_RECOVERY_ACTION_CMD: |
|
444 | case SID_TC_RECOVERY_ACTION_CMD: | |
436 | i = RECOVERY_ACTION_CMD; |
|
445 | i = RECOVERY_ACTION_CMD; | |
437 | break; |
|
446 | break; | |
438 | case SID_TC_BACKUP_MISSION_TIMELINE: |
|
447 | case SID_TC_BACKUP_MISSION_TIMELINE: | |
439 | i = BACKUP_MISSION_TIMELINE; |
|
448 | i = BACKUP_MISSION_TIMELINE; | |
440 | break; |
|
449 | break; | |
441 | case SID_TC_DIRECT_CMD: |
|
450 | case SID_TC_DIRECT_CMD: | |
442 | i = DIRECT_CMD; |
|
451 | i = DIRECT_CMD; | |
443 | break; |
|
452 | break; | |
444 | case SID_TC_SPARE_GRD_SRC1: |
|
453 | case SID_TC_SPARE_GRD_SRC1: | |
445 | i = SPARE_GRD_SRC1; |
|
454 | i = SPARE_GRD_SRC1; | |
446 | break; |
|
455 | break; | |
447 | case SID_TC_SPARE_GRD_SRC2: |
|
456 | case SID_TC_SPARE_GRD_SRC2: | |
448 | i = SPARE_GRD_SRC2; |
|
457 | i = SPARE_GRD_SRC2; | |
449 | break; |
|
458 | break; | |
450 | case SID_TC_OBCP: |
|
459 | case SID_TC_OBCP: | |
451 | i = OBCP; |
|
460 | i = OBCP; | |
452 | break; |
|
461 | break; | |
453 | case SID_TC_SYSTEM_CONTROL: |
|
462 | case SID_TC_SYSTEM_CONTROL: | |
454 | i = SYSTEM_CONTROL; |
|
463 | i = SYSTEM_CONTROL; | |
455 | break; |
|
464 | break; | |
456 | case SID_TC_AOCS: |
|
465 | case SID_TC_AOCS: | |
457 | i = AOCS; |
|
466 | i = AOCS; | |
458 | break; |
|
467 | break; | |
459 | case SID_TC_RPW_INTERNAL: |
|
468 | case SID_TC_RPW_INTERNAL: | |
460 | i = RPW_INTERNAL; |
|
469 | i = RPW_INTERNAL; | |
461 | break; |
|
470 | break; | |
462 | default: |
|
471 | default: | |
463 | i = UNKNOWN; |
|
472 | i = UNKNOWN; | |
464 | break; |
|
473 | break; | |
465 | } |
|
474 | } | |
466 |
|
475 | |||
467 | if (i != UNKNOWN) |
|
476 | if (i != UNKNOWN) | |
468 | { |
|
477 | { | |
469 | segmentation_grouping_flag = TM_PACKET_SEQ_CTRL_STANDALONE << 8; |
|
478 | segmentation_grouping_flag = TM_PACKET_SEQ_CTRL_STANDALONE << 8; | |
470 | sequence_cnt = sequenceCounters_TC_EXE[ i ] & 0x3fff; |
|
479 | sequence_cnt = sequenceCounters_TC_EXE[ i ] & 0x3fff; | |
471 |
|
480 | |||
472 | new_packet_sequence_control = segmentation_grouping_flag | sequence_cnt ; |
|
481 | new_packet_sequence_control = segmentation_grouping_flag | sequence_cnt ; | |
473 |
|
482 | |||
474 | packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8); |
|
483 | packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8); | |
475 | packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control ); |
|
484 | packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control ); | |
476 |
|
485 | |||
477 | // increment the sequence counter for the next packet |
|
486 | // increment the sequence counter for the next packet | |
478 | if ( sequenceCounters_TC_EXE[ i ] < SEQ_CNT_MAX) |
|
487 | if ( sequenceCounters_TC_EXE[ i ] < SEQ_CNT_MAX) | |
479 | { |
|
488 | { | |
480 | sequenceCounters_TC_EXE[ i ] = sequenceCounters_TC_EXE[ i ] + 1; |
|
489 | sequenceCounters_TC_EXE[ i ] = sequenceCounters_TC_EXE[ i ] + 1; | |
481 | } |
|
490 | } | |
482 | else |
|
491 | else | |
483 | { |
|
492 | { | |
484 | sequenceCounters_TC_EXE[ i ] = 0; |
|
493 | sequenceCounters_TC_EXE[ i ] = 0; | |
485 | } |
|
494 | } | |
486 | } |
|
495 | } | |
487 | else |
|
496 | else | |
488 | { |
|
497 | { | |
489 | DEBUG_PRINTF1("in increment_seq_counter_destination_id *** ERR destination ID %d not known\n", destination_id) |
|
498 | DEBUG_PRINTF1("in increment_seq_counter_destination_id *** ERR destination ID %d not known\n", destination_id) | |
490 | } |
|
499 | } | |
491 |
|
500 | |||
492 | } |
|
501 | } |
@@ -1,1219 +1,1219 | |||||
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 | // SWF |
|
12 | // SWF | |
13 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F0[7]; |
|
13 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F0[7]; | |
14 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F1[7]; |
|
14 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F1[7]; | |
15 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F2[7]; |
|
15 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F2[7]; | |
16 | // CWF |
|
16 | // CWF | |
17 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F1[7]; |
|
17 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F1[7]; | |
18 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_BURST[7]; |
|
18 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_BURST[7]; | |
19 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_SBM2[7]; |
|
19 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_SBM2[7]; | |
20 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3[7]; |
|
20 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3[7]; | |
21 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3_light[7]; |
|
21 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3_light[7]; | |
22 |
|
22 | |||
23 | unsigned char doubleSendCWF1 = 0; |
|
23 | unsigned char doubleSendCWF1 = 0; | |
24 | unsigned char doubleSendCWF2 = 0; |
|
24 | unsigned char doubleSendCWF2 = 0; | |
25 |
|
25 | |||
26 | rtems_isr waveforms_isr( rtems_vector_number vector ) |
|
26 | rtems_isr waveforms_isr( rtems_vector_number vector ) | |
27 | { |
|
27 | { | |
28 | /** This is the interrupt sub routine called by the waveform picker core. |
|
28 | /** This is the interrupt sub routine called by the waveform picker core. | |
29 | * |
|
29 | * | |
30 | * This ISR launch different actions depending mainly on two pieces of information: |
|
30 | * This ISR launch different actions depending mainly on two pieces of information: | |
31 | * 1. the values read in the registers of the waveform picker. |
|
31 | * 1. the values read in the registers of the waveform picker. | |
32 | * 2. the current LFR mode. |
|
32 | * 2. the current LFR mode. | |
33 | * |
|
33 | * | |
34 | */ |
|
34 | */ | |
35 |
|
35 | |||
36 | #ifdef GSA |
|
36 | #ifdef GSA | |
37 | #else |
|
37 | #else | |
38 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) |
|
38 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) | |
39 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
39 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) | |
40 | { // in modes other than STANDBY and BURST, send the CWF_F3 data |
|
40 | { // in modes other than STANDBY and BURST, send the CWF_F3 data | |
41 | if ((waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full |
|
41 | if ((waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full | |
42 | // (1) change the receiving buffer for the waveform picker |
|
42 | // (1) change the receiving buffer for the waveform picker | |
43 | if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3) { |
|
43 | if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3) { | |
44 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_bis); |
|
44 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_bis); | |
45 | } |
|
45 | } | |
46 | else { |
|
46 | else { | |
47 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3); |
|
47 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3); | |
48 | } |
|
48 | } | |
49 | // (2) send an event for the waveforms transmission |
|
49 | // (2) send an event for the waveforms transmission | |
50 | if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
50 | if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { | |
51 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
51 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
52 | } |
|
52 | } | |
53 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff777; // reset f3 bits to 0, [1111 0111 0111 0111] |
|
53 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff777; // reset f3 bits to 0, [1111 0111 0111 0111] | |
54 | } |
|
54 | } | |
55 | } |
|
55 | } | |
56 | #endif |
|
56 | #endif | |
57 |
|
57 | |||
58 | switch(lfrCurrentMode) |
|
58 | switch(lfrCurrentMode) | |
59 | { |
|
59 | { | |
60 | //******** |
|
60 | //******** | |
61 | // STANDBY |
|
61 | // STANDBY | |
62 | case(LFR_MODE_STANDBY): |
|
62 | case(LFR_MODE_STANDBY): | |
63 | break; |
|
63 | break; | |
64 |
|
64 | |||
65 | //****** |
|
65 | //****** | |
66 | // NORMAL |
|
66 | // NORMAL | |
67 | case(LFR_MODE_NORMAL): |
|
67 | case(LFR_MODE_NORMAL): | |
68 | #ifdef GSA |
|
68 | #ifdef GSA | |
69 | PRINTF("in waveform_isr *** unexpected waveform picker interruption\n") |
|
69 | PRINTF("in waveform_isr *** unexpected waveform picker interruption\n") | |
70 | #else |
|
70 | #else | |
71 | if ( (waveform_picker_regs->burst_enable & 0x7) == 0x0 ){ // if no channel is enable |
|
71 | if ( (waveform_picker_regs->burst_enable & 0x7) == 0x0 ){ // if no channel is enable | |
72 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
72 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
73 | } |
|
73 | } | |
74 | else { |
|
74 | else { | |
75 | if ( (waveform_picker_regs->status & 0x7) == 0x7 ){ // f2 f1 and f0 are full |
|
75 | if ( (waveform_picker_regs->status & 0x7) == 0x7 ){ // f2 f1 and f0 are full | |
76 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable & 0x08; |
|
76 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable & 0x08; | |
77 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) { |
|
77 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) { | |
78 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
78 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
79 | } |
|
79 | } | |
80 | // waveform_picker_regs->status = waveform_picker_regs->status & 0x00; |
|
80 | // waveform_picker_regs->status = waveform_picker_regs->status & 0x00; | |
81 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff888; |
|
81 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff888; | |
82 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x07; // [0111] enable f2 f1 f0 |
|
82 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x07; // [0111] enable f2 f1 f0 | |
83 | } |
|
83 | } | |
84 | } |
|
84 | } | |
85 | #endif |
|
85 | #endif | |
86 | break; |
|
86 | break; | |
87 |
|
87 | |||
88 | //****** |
|
88 | //****** | |
89 | // BURST |
|
89 | // BURST | |
90 | case(LFR_MODE_BURST): |
|
90 | case(LFR_MODE_BURST): | |
91 | #ifdef GSA |
|
91 | #ifdef GSA | |
92 | PRINTF("in waveform_isr *** unexpected waveform picker interruption\n") |
|
92 | PRINTF("in waveform_isr *** unexpected waveform picker interruption\n") | |
93 | #else |
|
93 | #else | |
94 | if ((waveform_picker_regs->status & 0x04) == 0x04){ // [0100] check the f2 full bit |
|
94 | if ((waveform_picker_regs->status & 0x04) == 0x04){ // [0100] check the f2 full bit | |
95 | // (1) change the receiving buffer for the waveform picker |
|
95 | // (1) change the receiving buffer for the waveform picker | |
96 | if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) { |
|
96 | if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) { | |
97 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_bis); |
|
97 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_bis); | |
98 | } |
|
98 | } | |
99 | else { |
|
99 | else { | |
100 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); |
|
100 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); | |
101 | } |
|
101 | } | |
102 | // (2) send an event for the waveforms transmission |
|
102 | // (2) send an event for the waveforms transmission | |
103 | if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) { |
|
103 | if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) { | |
104 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
104 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
105 | } |
|
105 | } | |
106 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bits = 0 |
|
106 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bits = 0 | |
107 | } |
|
107 | } | |
108 | #endif |
|
108 | #endif | |
109 | break; |
|
109 | break; | |
110 |
|
110 | |||
111 | //***** |
|
111 | //***** | |
112 | // SBM1 |
|
112 | // SBM1 | |
113 | case(LFR_MODE_SBM1): |
|
113 | case(LFR_MODE_SBM1): | |
114 | #ifdef GSA |
|
114 | #ifdef GSA | |
115 | PRINTF("in waveform_isr *** unexpected waveform picker interruption\n") |
|
115 | PRINTF("in waveform_isr *** unexpected waveform picker interruption\n") | |
116 | #else |
|
116 | #else | |
117 | if ((waveform_picker_regs->status & 0x02) == 0x02){ // [0010] check the f1 full bit |
|
117 | if ((waveform_picker_regs->status & 0x02) == 0x02){ // [0010] check the f1 full bit | |
118 | // (1) change the receiving buffer for the waveform picker |
|
118 | // (1) change the receiving buffer for the waveform picker | |
119 | if ( param_local.local_sbm1_nb_cwf_sent == (param_local.local_sbm1_nb_cwf_max-1) ) |
|
119 | if ( param_local.local_sbm1_nb_cwf_sent == (param_local.local_sbm1_nb_cwf_max-1) ) | |
120 | { |
|
120 | { | |
121 | waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_norm); |
|
121 | waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_norm); | |
122 | } |
|
122 | } | |
123 | else if ( waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1_norm ) |
|
123 | else if ( waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1_norm ) | |
124 | { |
|
124 | { | |
125 | doubleSendCWF1 = 1; |
|
125 | doubleSendCWF1 = 1; | |
126 | waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1); |
|
126 | waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1); | |
127 | } |
|
127 | } | |
128 | else if ( waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1 ) { |
|
128 | else if ( waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1 ) { | |
129 | waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_bis); |
|
129 | waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_bis); | |
130 | } |
|
130 | } | |
131 | else { |
|
131 | else { | |
132 | waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1); |
|
132 | waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1); | |
133 | } |
|
133 | } | |
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_CWF1], RTEMS_EVENT_MODE_SBM1 ) != RTEMS_SUCCESSFUL) { |
|
135 | if (rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 ) != 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 & 0xfffffddd; // [1111 1101 1101 1101] f1 bit = 0 |
|
138 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bit = 0 | |
139 | } |
|
139 | } | |
140 | if ( ( (waveform_picker_regs->status & 0x05) == 0x05 ) ) { // [0101] check the f2 and f0 full bit |
|
140 | if ( ( (waveform_picker_regs->status & 0x05) == 0x05 ) ) { // [0101] check the f2 and f0 full bit | |
141 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) { |
|
141 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) { | |
142 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
142 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
143 | } |
|
143 | } | |
144 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2 and f0 bits = 0 |
|
144 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2 and f0 bits = 0 | |
145 | reset_local_sbm1_nb_cwf_sent(); |
|
145 | reset_local_sbm1_nb_cwf_sent(); | |
146 | } |
|
146 | } | |
147 |
|
147 | |||
148 | #endif |
|
148 | #endif | |
149 | break; |
|
149 | break; | |
150 |
|
150 | |||
151 | //***** |
|
151 | //***** | |
152 | // SBM2 |
|
152 | // SBM2 | |
153 | case(LFR_MODE_SBM2): |
|
153 | case(LFR_MODE_SBM2): | |
154 | #ifdef GSA |
|
154 | #ifdef GSA | |
155 | PRINTF("in waveform_isr *** unexpected waveform picker interruption\n") |
|
155 | PRINTF("in waveform_isr *** unexpected waveform picker interruption\n") | |
156 | #else |
|
156 | #else | |
157 | if ((waveform_picker_regs->status & 0x04) == 0x04){ // [0100] check the f2 full bit |
|
157 | if ((waveform_picker_regs->status & 0x04) == 0x04){ // [0100] check the f2 full bit | |
158 | // (1) change the receiving buffer for the waveform picker |
|
158 | // (1) change the receiving buffer for the waveform picker | |
159 | if ( param_local.local_sbm2_nb_cwf_sent == (param_local.local_sbm2_nb_cwf_max-1) ) |
|
159 | if ( param_local.local_sbm2_nb_cwf_sent == (param_local.local_sbm2_nb_cwf_max-1) ) | |
160 | { |
|
160 | { | |
161 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_norm); |
|
161 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_norm); | |
162 | } |
|
162 | } | |
163 | else if ( waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2_norm ) { |
|
163 | else if ( waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2_norm ) { | |
164 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); |
|
164 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); | |
165 | doubleSendCWF2 = 1; |
|
165 | doubleSendCWF2 = 1; | |
166 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2_WFRM ) != RTEMS_SUCCESSFUL) { |
|
166 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2_WFRM ) != RTEMS_SUCCESSFUL) { | |
167 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
167 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
168 | } |
|
168 | } | |
169 | reset_local_sbm2_nb_cwf_sent(); |
|
169 | reset_local_sbm2_nb_cwf_sent(); | |
170 | } |
|
170 | } | |
171 | else if ( waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2 ) { |
|
171 | else if ( waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2 ) { | |
172 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_bis); |
|
172 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_bis); | |
173 | } |
|
173 | } | |
174 | else { |
|
174 | else { | |
175 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); |
|
175 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); | |
176 | } |
|
176 | } | |
177 | // (2) send an event for the waveforms transmission |
|
177 | // (2) send an event for the waveforms transmission | |
178 | if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) { |
|
178 | if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) { | |
179 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
179 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
180 | } |
|
180 | } | |
181 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0 |
|
181 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0 | |
182 | } |
|
182 | } | |
183 | if ( ( (waveform_picker_regs->status & 0x03) == 0x03 ) ) { // [0011] f3 f2 f1 f0, f1 and f0 are full |
|
183 | if ( ( (waveform_picker_regs->status & 0x03) == 0x03 ) ) { // [0011] f3 f2 f1 f0, f1 and f0 are full | |
184 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) { |
|
184 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) { | |
185 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
185 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
186 | } |
|
186 | } | |
187 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0 |
|
187 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0 | |
188 | } |
|
188 | } | |
189 | #endif |
|
189 | #endif | |
190 | break; |
|
190 | break; | |
191 |
|
191 | |||
192 | //******** |
|
192 | //******** | |
193 | // DEFAULT |
|
193 | // DEFAULT | |
194 | default: |
|
194 | default: | |
195 | break; |
|
195 | break; | |
196 | } |
|
196 | } | |
197 | } |
|
197 | } | |
198 |
|
198 | |||
199 | rtems_isr waveforms_simulator_isr( rtems_vector_number vector ) |
|
199 | rtems_isr waveforms_simulator_isr( rtems_vector_number vector ) | |
200 | { |
|
200 | { | |
201 | /** This is the interrupt sub routine called by the waveform picker simulator. |
|
201 | /** This is the interrupt sub routine called by the waveform picker simulator. | |
202 | * |
|
202 | * | |
203 | * This ISR is for debug purpose only. |
|
203 | * This ISR is for debug purpose only. | |
204 | * |
|
204 | * | |
205 | */ |
|
205 | */ | |
206 |
|
206 | |||
207 | unsigned char lfrMode; |
|
207 | unsigned char lfrMode; | |
208 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
208 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
209 |
|
209 | |||
210 | switch(lfrMode) { |
|
210 | switch(lfrMode) { | |
211 | case (LFR_MODE_STANDBY): |
|
211 | case (LFR_MODE_STANDBY): | |
212 | break; |
|
212 | break; | |
213 | case (LFR_MODE_NORMAL): |
|
213 | case (LFR_MODE_NORMAL): | |
214 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) { |
|
214 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) { | |
215 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_5 ); |
|
215 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_5 ); | |
216 | } |
|
216 | } | |
217 | break; |
|
217 | break; | |
218 | case (LFR_MODE_BURST): |
|
218 | case (LFR_MODE_BURST): | |
219 | break; |
|
219 | break; | |
220 | case (LFR_MODE_SBM1): |
|
220 | case (LFR_MODE_SBM1): | |
221 | break; |
|
221 | break; | |
222 | case (LFR_MODE_SBM2): |
|
222 | case (LFR_MODE_SBM2): | |
223 | break; |
|
223 | break; | |
224 | } |
|
224 | } | |
225 | } |
|
225 | } | |
226 |
|
226 | |||
227 | rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP |
|
227 | rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP | |
228 | { |
|
228 | { | |
229 | /** This RTEMS task is dedicated to the transmission of snapshots of the NORMAL mode. |
|
229 | /** This RTEMS task is dedicated to the transmission of snapshots of the NORMAL mode. | |
230 | * |
|
230 | * | |
231 | * @param unused is the starting argument of the RTEMS task |
|
231 | * @param unused is the starting argument of the RTEMS task | |
232 | * |
|
232 | * | |
233 | * The following data packets are sent by this task: |
|
233 | * The following data packets are sent by this task: | |
234 | * - TM_LFR_SCIENCE_NORMAL_SWF_F0 |
|
234 | * - TM_LFR_SCIENCE_NORMAL_SWF_F0 | |
235 | * - TM_LFR_SCIENCE_NORMAL_SWF_F1 |
|
235 | * - TM_LFR_SCIENCE_NORMAL_SWF_F1 | |
236 | * - TM_LFR_SCIENCE_NORMAL_SWF_F2 |
|
236 | * - TM_LFR_SCIENCE_NORMAL_SWF_F2 | |
237 | * |
|
237 | * | |
238 | */ |
|
238 | */ | |
239 |
|
239 | |||
240 | rtems_event_set event_out; |
|
240 | rtems_event_set event_out; | |
241 | rtems_id queue_id; |
|
241 | rtems_id queue_id; | |
242 |
|
242 | |||
243 | init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 ); |
|
243 | init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 ); | |
244 | init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 ); |
|
244 | init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 ); | |
245 | init_header_snapshot_wf_table( SID_NORM_SWF_F2, headerSWF_F2 ); |
|
245 | init_header_snapshot_wf_table( SID_NORM_SWF_F2, headerSWF_F2 ); | |
246 |
|
246 | |||
247 | init_waveforms(); |
|
247 | init_waveforms(); | |
248 |
|
248 | |||
249 | queue_id = get_pkts_queue_id(); |
|
249 | queue_id = get_pkts_queue_id(); | |
250 |
|
250 | |||
251 | BOOT_PRINTF("in WFRM ***\n") |
|
251 | BOOT_PRINTF("in WFRM ***\n") | |
252 |
|
252 | |||
253 | while(1){ |
|
253 | while(1){ | |
254 | // wait for an RTEMS_EVENT |
|
254 | // wait for an RTEMS_EVENT | |
255 | rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1 |
|
255 | rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1 | |
256 | | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM, |
|
256 | | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM, | |
257 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
257 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
258 |
|
258 | |||
259 | if (event_out == RTEMS_EVENT_MODE_NORMAL) |
|
259 | if (event_out == RTEMS_EVENT_MODE_NORMAL) | |
260 | { |
|
260 | { | |
261 | send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id); |
|
261 | send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id); | |
262 | send_waveform_SWF(wf_snap_f1, SID_NORM_SWF_F1, headerSWF_F1, queue_id); |
|
262 | send_waveform_SWF(wf_snap_f1, SID_NORM_SWF_F1, headerSWF_F1, queue_id); | |
263 | send_waveform_SWF(wf_snap_f2, SID_NORM_SWF_F2, headerSWF_F2, queue_id); |
|
263 | send_waveform_SWF(wf_snap_f2, SID_NORM_SWF_F2, headerSWF_F2, queue_id); | |
264 | #ifdef GSA |
|
264 | #ifdef GSA | |
265 | waveform_picker_regs->status = waveform_picker_regs->status & 0xf888; // [1111 1000 1000 1000] f2, f1, f0 bits =0 |
|
265 | waveform_picker_regs->status = waveform_picker_regs->status & 0xf888; // [1111 1000 1000 1000] f2, f1, f0 bits =0 | |
266 | #endif |
|
266 | #endif | |
267 | } |
|
267 | } | |
268 | else if (event_out == RTEMS_EVENT_MODE_SBM1) |
|
268 | else if (event_out == RTEMS_EVENT_MODE_SBM1) | |
269 | { |
|
269 | { | |
270 | send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id); |
|
270 | send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id); | |
271 | send_waveform_SWF(wf_snap_f1_norm, SID_NORM_SWF_F1, headerSWF_F1, queue_id); |
|
271 | send_waveform_SWF(wf_snap_f1_norm, SID_NORM_SWF_F1, headerSWF_F1, queue_id); | |
272 | send_waveform_SWF(wf_snap_f2, SID_NORM_SWF_F2, headerSWF_F2, queue_id); |
|
272 | send_waveform_SWF(wf_snap_f2, SID_NORM_SWF_F2, headerSWF_F2, queue_id); | |
273 | #ifdef GSA |
|
273 | #ifdef GSA | |
274 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2, f0 bits = 0 |
|
274 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2, f0 bits = 0 | |
275 | #endif |
|
275 | #endif | |
276 | } |
|
276 | } | |
277 | else if (event_out == RTEMS_EVENT_MODE_SBM2) |
|
277 | else if (event_out == RTEMS_EVENT_MODE_SBM2) | |
278 | { |
|
278 | { | |
279 | send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id); |
|
279 | send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id); | |
280 | send_waveform_SWF(wf_snap_f1, SID_NORM_SWF_F1, headerSWF_F1, queue_id); |
|
280 | send_waveform_SWF(wf_snap_f1, SID_NORM_SWF_F1, headerSWF_F1, queue_id); | |
281 | #ifdef GSA |
|
281 | #ifdef GSA | |
282 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0 |
|
282 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0 | |
283 | #endif |
|
283 | #endif | |
284 | } |
|
284 | } | |
285 | else if (event_out == RTEMS_EVENT_MODE_SBM2_WFRM) |
|
285 | else if (event_out == RTEMS_EVENT_MODE_SBM2_WFRM) | |
286 | { |
|
286 | { | |
287 | send_waveform_SWF(wf_snap_f2_norm, SID_NORM_SWF_F2, headerSWF_F2, queue_id); |
|
287 | send_waveform_SWF(wf_snap_f2_norm, SID_NORM_SWF_F2, headerSWF_F2, queue_id); | |
288 | } |
|
288 | } | |
289 | else |
|
289 | else | |
290 | { |
|
290 | { | |
291 | PRINTF("in WFRM *** unexpected event") |
|
291 | PRINTF("in WFRM *** unexpected event") | |
292 | } |
|
292 | } | |
293 |
|
293 | |||
294 |
|
294 | |||
295 | #ifdef GSA |
|
295 | #ifdef GSA | |
296 | // irq processed, reset the related register of the timer unit |
|
296 | // irq processed, reset the related register of the timer unit | |
297 | gptimer_regs->timer[TIMER_WF_SIMULATOR].ctrl = gptimer_regs->timer[TIMER_WF_SIMULATOR].ctrl | 0x00000010; |
|
297 | gptimer_regs->timer[TIMER_WF_SIMULATOR].ctrl = gptimer_regs->timer[TIMER_WF_SIMULATOR].ctrl | 0x00000010; | |
298 | // clear the interruption |
|
298 | // clear the interruption | |
299 | LEON_Unmask_interrupt( IRQ_WF ); |
|
299 | LEON_Unmask_interrupt( IRQ_WF ); | |
300 | #endif |
|
300 | #endif | |
301 | } |
|
301 | } | |
302 | } |
|
302 | } | |
303 |
|
303 | |||
304 | rtems_task cwf3_task(rtems_task_argument argument) //used with the waveform picker VHDL IP |
|
304 | rtems_task cwf3_task(rtems_task_argument argument) //used with the waveform picker VHDL IP | |
305 | { |
|
305 | { | |
306 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f3. |
|
306 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f3. | |
307 | * |
|
307 | * | |
308 | * @param unused is the starting argument of the RTEMS task |
|
308 | * @param unused is the starting argument of the RTEMS task | |
309 | * |
|
309 | * | |
310 | * The following data packet is sent by this task: |
|
310 | * The following data packet is sent by this task: | |
311 | * - TM_LFR_SCIENCE_NORMAL_CWF_F3 |
|
311 | * - TM_LFR_SCIENCE_NORMAL_CWF_F3 | |
312 | * |
|
312 | * | |
313 | */ |
|
313 | */ | |
314 |
|
314 | |||
315 | rtems_event_set event_out; |
|
315 | rtems_event_set event_out; | |
316 | rtems_id queue_id; |
|
316 | rtems_id queue_id; | |
317 |
|
317 | |||
318 | init_header_continuous_wf_table( SID_NORM_CWF_F3, headerCWF_F3 ); |
|
318 | init_header_continuous_wf_table( SID_NORM_CWF_F3, headerCWF_F3 ); | |
319 | init_header_continuous_wf3_light_table( headerCWF_F3_light ); |
|
319 | init_header_continuous_wf3_light_table( headerCWF_F3_light ); | |
320 |
|
320 | |||
321 | queue_id = get_pkts_queue_id(); |
|
321 | queue_id = get_pkts_queue_id(); | |
322 |
|
322 | |||
323 | BOOT_PRINTF("in CWF3 ***\n") |
|
323 | BOOT_PRINTF("in CWF3 ***\n") | |
324 |
|
324 | |||
325 | while(1){ |
|
325 | while(1){ | |
326 | // wait for an RTEMS_EVENT |
|
326 | // wait for an RTEMS_EVENT | |
327 | rtems_event_receive( RTEMS_EVENT_0, |
|
327 | rtems_event_receive( RTEMS_EVENT_0, | |
328 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
328 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
329 | PRINTF("send CWF F3 \n") |
|
329 | PRINTF("send CWF F3 \n") | |
330 | #ifdef GSA |
|
330 | #ifdef GSA | |
331 | #else |
|
331 | #else | |
332 | if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3) { |
|
332 | if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3) { | |
333 | send_waveform_CWF3_light( wf_cont_f3_bis, headerCWF_F3_light, queue_id ); |
|
333 | send_waveform_CWF3_light( wf_cont_f3_bis, headerCWF_F3_light, queue_id ); | |
334 | } |
|
334 | } | |
335 | else { |
|
335 | else { | |
336 | send_waveform_CWF3_light( wf_cont_f3, headerCWF_F3_light, queue_id ); |
|
336 | send_waveform_CWF3_light( wf_cont_f3, headerCWF_F3_light, queue_id ); | |
337 | } |
|
337 | } | |
338 | #endif |
|
338 | #endif | |
339 | } |
|
339 | } | |
340 | } |
|
340 | } | |
341 |
|
341 | |||
342 | rtems_task cwf2_task(rtems_task_argument argument) // ONLY USED IN BURST AND SBM2 |
|
342 | rtems_task cwf2_task(rtems_task_argument argument) // ONLY USED IN BURST AND SBM2 | |
343 | { |
|
343 | { | |
344 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f2. |
|
344 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f2. | |
345 | * |
|
345 | * | |
346 | * @param unused is the starting argument of the RTEMS task |
|
346 | * @param unused is the starting argument of the RTEMS task | |
347 | * |
|
347 | * | |
348 | * The following data packet is sent by this function: |
|
348 | * The following data packet is sent by this function: | |
349 | * - TM_LFR_SCIENCE_BURST_CWF_F2 |
|
349 | * - TM_LFR_SCIENCE_BURST_CWF_F2 | |
350 | * - TM_LFR_SCIENCE_SBM2_CWF_F2 |
|
350 | * - TM_LFR_SCIENCE_SBM2_CWF_F2 | |
351 | * |
|
351 | * | |
352 | */ |
|
352 | */ | |
353 |
|
353 | |||
354 | rtems_event_set event_out; |
|
354 | rtems_event_set event_out; | |
355 | rtems_id queue_id; |
|
355 | rtems_id queue_id; | |
356 |
|
356 | |||
357 | init_header_continuous_wf_table( SID_BURST_CWF_F2, headerCWF_F2_BURST ); |
|
357 | init_header_continuous_wf_table( SID_BURST_CWF_F2, headerCWF_F2_BURST ); | |
358 | init_header_continuous_wf_table( SID_SBM2_CWF_F2, headerCWF_F2_SBM2 ); |
|
358 | init_header_continuous_wf_table( SID_SBM2_CWF_F2, headerCWF_F2_SBM2 ); | |
359 |
|
359 | |||
360 | queue_id = get_pkts_queue_id(); |
|
360 | queue_id = get_pkts_queue_id(); | |
361 |
|
361 | |||
362 | BOOT_PRINTF("in CWF2 ***\n") |
|
362 | BOOT_PRINTF("in CWF2 ***\n") | |
363 |
|
363 | |||
364 | while(1){ |
|
364 | while(1){ | |
365 | // wait for an RTEMS_EVENT |
|
365 | // wait for an RTEMS_EVENT | |
366 | rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2, |
|
366 | rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2, | |
367 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
367 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
368 |
|
368 | |||
369 | if (event_out == RTEMS_EVENT_MODE_BURST) |
|
369 | if (event_out == RTEMS_EVENT_MODE_BURST) | |
370 | { |
|
370 | { | |
371 | // F2 |
|
371 | // F2 | |
372 | #ifdef GSA |
|
372 | #ifdef GSA | |
373 | #else |
|
373 | #else | |
374 | if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) { |
|
374 | if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) { | |
375 | send_waveform_CWF( wf_snap_f2_bis, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id ); |
|
375 | send_waveform_CWF( wf_snap_f2_bis, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id ); | |
376 | } |
|
376 | } | |
377 | else { |
|
377 | else { | |
378 | send_waveform_CWF( wf_snap_f2, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id ); |
|
378 | send_waveform_CWF( wf_snap_f2, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id ); | |
379 | } |
|
379 | } | |
380 | #endif |
|
380 | #endif | |
381 | } |
|
381 | } | |
382 |
|
382 | |||
383 | else if (event_out == RTEMS_EVENT_MODE_SBM2) |
|
383 | else if (event_out == RTEMS_EVENT_MODE_SBM2) | |
384 | { |
|
384 | { | |
385 | #ifdef GSA |
|
385 | #ifdef GSA | |
386 | #else |
|
386 | #else | |
387 | if (doubleSendCWF2 == 1) |
|
387 | if (doubleSendCWF2 == 1) | |
388 | { |
|
388 | { | |
389 | doubleSendCWF2 = 0; |
|
389 | doubleSendCWF2 = 0; | |
390 | send_waveform_CWF( wf_snap_f2_norm, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id ); |
|
390 | send_waveform_CWF( wf_snap_f2_norm, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id ); | |
391 | } |
|
391 | } | |
392 | else if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) { |
|
392 | else if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) { | |
393 | send_waveform_CWF( wf_snap_f2_bis, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id ); |
|
393 | send_waveform_CWF( wf_snap_f2_bis, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id ); | |
394 | } |
|
394 | } | |
395 | else { |
|
395 | else { | |
396 | send_waveform_CWF( wf_snap_f2, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id ); |
|
396 | send_waveform_CWF( wf_snap_f2, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id ); | |
397 | } |
|
397 | } | |
398 | param_local.local_sbm2_nb_cwf_sent ++; |
|
398 | param_local.local_sbm2_nb_cwf_sent ++; | |
399 | #endif |
|
399 | #endif | |
400 | } |
|
400 | } | |
401 | else |
|
401 | else | |
402 | { |
|
402 | { | |
403 | PRINTF1("in CWF2 *** ERR mode = %d\n", lfrCurrentMode) |
|
403 | PRINTF1("in CWF2 *** ERR mode = %d\n", lfrCurrentMode) | |
404 | } |
|
404 | } | |
405 | } |
|
405 | } | |
406 | } |
|
406 | } | |
407 |
|
407 | |||
408 | rtems_task cwf1_task(rtems_task_argument argument) // ONLY USED IN SBM1 |
|
408 | rtems_task cwf1_task(rtems_task_argument argument) // ONLY USED IN SBM1 | |
409 | { |
|
409 | { | |
410 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f1. |
|
410 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f1. | |
411 | * |
|
411 | * | |
412 | * @param unused is the starting argument of the RTEMS task |
|
412 | * @param unused is the starting argument of the RTEMS task | |
413 | * |
|
413 | * | |
414 | * The following data packet is sent by this function: |
|
414 | * The following data packet is sent by this function: | |
415 | * - TM_LFR_SCIENCE_SBM1_CWF_F1 |
|
415 | * - TM_LFR_SCIENCE_SBM1_CWF_F1 | |
416 | * |
|
416 | * | |
417 | */ |
|
417 | */ | |
418 |
|
418 | |||
419 | rtems_event_set event_out; |
|
419 | rtems_event_set event_out; | |
420 | rtems_id queue_id; |
|
420 | rtems_id queue_id; | |
421 |
|
421 | |||
422 | init_header_continuous_wf_table( SID_SBM1_CWF_F1, headerCWF_F1 ); |
|
422 | init_header_continuous_wf_table( SID_SBM1_CWF_F1, headerCWF_F1 ); | |
423 |
|
423 | |||
424 | queue_id = get_pkts_queue_id(); |
|
424 | queue_id = get_pkts_queue_id(); | |
425 |
|
425 | |||
426 | BOOT_PRINTF("in CWF1 ***\n") |
|
426 | BOOT_PRINTF("in CWF1 ***\n") | |
427 |
|
427 | |||
428 | while(1){ |
|
428 | while(1){ | |
429 | // wait for an RTEMS_EVENT |
|
429 | // wait for an RTEMS_EVENT | |
430 | rtems_event_receive( RTEMS_EVENT_MODE_SBM1, |
|
430 | rtems_event_receive( RTEMS_EVENT_MODE_SBM1, | |
431 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
431 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
432 | if (event_out == RTEMS_EVENT_MODE_SBM1) |
|
432 | if (event_out == RTEMS_EVENT_MODE_SBM1) | |
433 | { |
|
433 | { | |
434 | #ifdef GSA |
|
434 | #ifdef GSA | |
435 | #else |
|
435 | #else | |
436 | if (doubleSendCWF1 == 1) |
|
436 | if (doubleSendCWF1 == 1) | |
437 | { |
|
437 | { | |
438 | doubleSendCWF1 = 0; |
|
438 | doubleSendCWF1 = 0; | |
439 | send_waveform_CWF( wf_snap_f1_norm, SID_SBM1_CWF_F1, headerCWF_F1, queue_id ); |
|
439 | send_waveform_CWF( wf_snap_f1_norm, SID_SBM1_CWF_F1, headerCWF_F1, queue_id ); | |
440 | } |
|
440 | } | |
441 | else if (waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1) { |
|
441 | else if (waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1) { | |
442 | send_waveform_CWF( wf_snap_f1_bis, SID_SBM1_CWF_F1, headerCWF_F1, queue_id ); |
|
442 | send_waveform_CWF( wf_snap_f1_bis, SID_SBM1_CWF_F1, headerCWF_F1, queue_id ); | |
443 | } |
|
443 | } | |
444 | else { |
|
444 | else { | |
445 | send_waveform_CWF( wf_snap_f1, SID_SBM1_CWF_F1, headerCWF_F1, queue_id ); |
|
445 | send_waveform_CWF( wf_snap_f1, SID_SBM1_CWF_F1, headerCWF_F1, queue_id ); | |
446 | } |
|
446 | } | |
447 | param_local.local_sbm1_nb_cwf_sent ++; |
|
447 | param_local.local_sbm1_nb_cwf_sent ++; | |
448 | #endif |
|
448 | #endif | |
449 | } |
|
449 | } | |
450 | else |
|
450 | else | |
451 | { |
|
451 | { | |
452 | PRINTF1("in CWF1 *** ERR mode = %d\n", lfrCurrentMode) |
|
452 | PRINTF1("in CWF1 *** ERR mode = %d\n", lfrCurrentMode) | |
453 | } |
|
453 | } | |
454 | } |
|
454 | } | |
455 | } |
|
455 | } | |
456 |
|
456 | |||
457 | //****************** |
|
457 | //****************** | |
458 | // general functions |
|
458 | // general functions | |
459 | void init_waveforms( void ) |
|
459 | void init_waveforms( void ) | |
460 | { |
|
460 | { | |
461 | int i = 0; |
|
461 | int i = 0; | |
462 |
|
462 | |||
463 | for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++) |
|
463 | for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++) | |
464 | { |
|
464 | { | |
465 | //*** |
|
465 | //*** | |
466 | // F0 |
|
466 | // F0 | |
467 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x88887777; // |
|
467 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x88887777; // | |
468 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; // |
|
468 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; // | |
469 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x44443333; // |
|
469 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x44443333; // | |
470 |
|
470 | |||
471 | //*** |
|
471 | //*** | |
472 | // F1 |
|
472 | // F1 | |
473 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x22221111; |
|
473 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x22221111; | |
474 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x44443333; |
|
474 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x44443333; | |
475 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000; |
|
475 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000; | |
476 |
|
476 | |||
477 | //*** |
|
477 | //*** | |
478 | // F2 |
|
478 | // F2 | |
479 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x44443333; |
|
479 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x44443333; | |
480 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; |
|
480 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; | |
481 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000; |
|
481 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000; | |
482 |
|
482 | |||
483 | //*** |
|
483 | //*** | |
484 | // F3 |
|
484 | // F3 | |
485 | //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 0 ] = val1; |
|
485 | //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 0 ] = val1; | |
486 | //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 1 ] = val2; |
|
486 | //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 1 ] = val2; | |
487 | //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 2 ] = 0xaaaa0000; |
|
487 | //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 2 ] = 0xaaaa0000; | |
488 | } |
|
488 | } | |
489 | } |
|
489 | } | |
490 |
|
490 | |||
491 | int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF) |
|
491 | int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF) | |
492 | { |
|
492 | { | |
493 | unsigned char i; |
|
493 | unsigned char i; | |
494 |
|
494 | |||
495 | for (i=0; i<7; i++) |
|
495 | for (i=0; i<7; i++) | |
496 | { |
|
496 | { | |
497 | headerSWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
497 | headerSWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; | |
498 | headerSWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
498 | headerSWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
499 | headerSWF[ i ].reserved = DEFAULT_RESERVED; |
|
499 | headerSWF[ i ].reserved = DEFAULT_RESERVED; | |
500 | headerSWF[ i ].userApplication = CCSDS_USER_APP; |
|
500 | headerSWF[ i ].userApplication = CCSDS_USER_APP; | |
501 | headerSWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); |
|
501 | headerSWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); | |
502 | headerSWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); |
|
502 | headerSWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); | |
503 | if (i == 0) |
|
503 | if (i == 0) | |
504 | { |
|
504 | { | |
505 | headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST; |
|
505 | headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST; | |
506 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_340 >> 8); |
|
506 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_340 >> 8); | |
507 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_340 ); |
|
507 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_340 ); | |
508 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8); |
|
508 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8); | |
509 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 ); |
|
509 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 ); | |
510 | } |
|
510 | } | |
511 | else if (i == 6) |
|
511 | else if (i == 6) | |
512 | { |
|
512 | { | |
513 | headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST; |
|
513 | headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST; | |
514 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_8 >> 8); |
|
514 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_8 >> 8); | |
515 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_8 ); |
|
515 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_8 ); | |
516 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8); |
|
516 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8); | |
517 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 ); |
|
517 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 ); | |
518 | } |
|
518 | } | |
519 | else |
|
519 | else | |
520 | { |
|
520 | { | |
521 | headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION; |
|
521 | headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION; | |
522 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_340 >> 8); |
|
522 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_340 >> 8); | |
523 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_340 ); |
|
523 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_340 ); | |
524 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8); |
|
524 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8); | |
525 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 ); |
|
525 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 ); | |
526 | } |
|
526 | } | |
527 | headerSWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
527 | headerSWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
528 | headerSWF[ i ].pktCnt = DEFAULT_PKTCNT; // PKT_CNT |
|
528 | headerSWF[ i ].pktCnt = DEFAULT_PKTCNT; // PKT_CNT | |
529 | headerSWF[ i ].pktNr = i+1; // PKT_NR |
|
529 | headerSWF[ i ].pktNr = i+1; // PKT_NR | |
530 | // DATA FIELD HEADER |
|
530 | // DATA FIELD HEADER | |
531 | headerSWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
531 | headerSWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
532 | headerSWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
532 | headerSWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
533 | headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
533 | headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
534 | headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; |
|
534 | headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; | |
535 | // AUXILIARY DATA HEADER |
|
535 | // AUXILIARY DATA HEADER | |
536 | headerSWF[ i ].time[0] = 0x00; |
|
536 | headerSWF[ i ].time[0] = 0x00; | |
537 | headerSWF[ i ].time[0] = 0x00; |
|
537 | headerSWF[ i ].time[0] = 0x00; | |
538 | headerSWF[ i ].time[0] = 0x00; |
|
538 | headerSWF[ i ].time[0] = 0x00; | |
539 | headerSWF[ i ].time[0] = 0x00; |
|
539 | headerSWF[ i ].time[0] = 0x00; | |
540 | headerSWF[ i ].time[0] = 0x00; |
|
540 | headerSWF[ i ].time[0] = 0x00; | |
541 | headerSWF[ i ].time[0] = 0x00; |
|
541 | headerSWF[ i ].time[0] = 0x00; | |
542 | headerSWF[ i ].sid = sid; |
|
542 | headerSWF[ i ].sid = sid; | |
543 | headerSWF[ i ].hkBIA = DEFAULT_HKBIA; |
|
543 | headerSWF[ i ].hkBIA = DEFAULT_HKBIA; | |
544 | } |
|
544 | } | |
545 | return LFR_SUCCESSFUL; |
|
545 | return LFR_SUCCESSFUL; | |
546 | } |
|
546 | } | |
547 |
|
547 | |||
548 | int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF ) |
|
548 | int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF ) | |
549 | { |
|
549 | { | |
550 | unsigned int i; |
|
550 | unsigned int i; | |
551 |
|
551 | |||
552 | for (i=0; i<7; i++) |
|
552 | for (i=0; i<7; i++) | |
553 | { |
|
553 | { | |
554 | headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
554 | headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; | |
555 | headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
555 | headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
556 | headerCWF[ i ].reserved = DEFAULT_RESERVED; |
|
556 | headerCWF[ i ].reserved = DEFAULT_RESERVED; | |
557 | headerCWF[ i ].userApplication = CCSDS_USER_APP; |
|
557 | headerCWF[ i ].userApplication = CCSDS_USER_APP; | |
558 | if ( (sid == SID_SBM1_CWF_F1) || (sid == SID_SBM2_CWF_F2) ) |
|
558 | if ( (sid == SID_SBM1_CWF_F1) || (sid == SID_SBM2_CWF_F2) ) | |
559 | { |
|
559 | { | |
560 | headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2 >> 8); |
|
560 | headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2 >> 8); | |
561 | headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2); |
|
561 | headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2); | |
562 | } |
|
562 | } | |
563 | else |
|
563 | else | |
564 | { |
|
564 | { | |
565 | headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); |
|
565 | headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); | |
566 | headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); |
|
566 | headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); | |
567 | } |
|
567 | } | |
568 | if (i == 0) |
|
568 | if (i == 0) | |
569 | { |
|
569 | { | |
570 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST; |
|
570 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST; | |
571 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_340 >> 8); |
|
571 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_340 >> 8); | |
572 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_340 ); |
|
572 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_340 ); | |
573 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8); |
|
573 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8); | |
574 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 ); |
|
574 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 ); | |
575 | } |
|
575 | } | |
576 | else if (i == 6) |
|
576 | else if (i == 6) | |
577 | { |
|
577 | { | |
578 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST; |
|
578 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST; | |
579 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_8 >> 8); |
|
579 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_8 >> 8); | |
580 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_8 ); |
|
580 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_8 ); | |
581 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8); |
|
581 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8); | |
582 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 ); |
|
582 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 ); | |
583 | } |
|
583 | } | |
584 | else |
|
584 | else | |
585 | { |
|
585 | { | |
586 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION; |
|
586 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION; | |
587 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_340 >> 8); |
|
587 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_340 >> 8); | |
588 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_340 ); |
|
588 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_340 ); | |
589 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8); |
|
589 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8); | |
590 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 ); |
|
590 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 ); | |
591 | } |
|
591 | } | |
592 | headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
592 | headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
593 | // PKT_CNT |
|
593 | // PKT_CNT | |
594 | // PKT_NR |
|
594 | // PKT_NR | |
595 | // DATA FIELD HEADER |
|
595 | // DATA FIELD HEADER | |
596 | headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
596 | headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
597 | headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
597 | headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
598 | headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
598 | headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
599 | headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; |
|
599 | headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; | |
600 | // AUXILIARY DATA HEADER |
|
600 | // AUXILIARY DATA HEADER | |
601 | headerCWF[ i ].sid = sid; |
|
601 | headerCWF[ i ].sid = sid; | |
602 | headerCWF[ i ].hkBIA = DEFAULT_HKBIA; |
|
602 | headerCWF[ i ].hkBIA = DEFAULT_HKBIA; | |
603 | headerCWF[ i ].time[0] = 0x00; |
|
603 | headerCWF[ i ].time[0] = 0x00; | |
604 | headerCWF[ i ].time[0] = 0x00; |
|
604 | headerCWF[ i ].time[0] = 0x00; | |
605 | headerCWF[ i ].time[0] = 0x00; |
|
605 | headerCWF[ i ].time[0] = 0x00; | |
606 | headerCWF[ i ].time[0] = 0x00; |
|
606 | headerCWF[ i ].time[0] = 0x00; | |
607 | headerCWF[ i ].time[0] = 0x00; |
|
607 | headerCWF[ i ].time[0] = 0x00; | |
608 | headerCWF[ i ].time[0] = 0x00; |
|
608 | headerCWF[ i ].time[0] = 0x00; | |
609 | } |
|
609 | } | |
610 | return LFR_SUCCESSFUL; |
|
610 | return LFR_SUCCESSFUL; | |
611 | } |
|
611 | } | |
612 |
|
612 | |||
613 | int init_header_continuous_wf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF ) |
|
613 | int init_header_continuous_wf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF ) | |
614 | { |
|
614 | { | |
615 | unsigned int i; |
|
615 | unsigned int i; | |
616 |
|
616 | |||
617 | for (i=0; i<7; i++) |
|
617 | for (i=0; i<7; i++) | |
618 | { |
|
618 | { | |
619 | headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
619 | headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; | |
620 | headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
620 | headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
621 | headerCWF[ i ].reserved = DEFAULT_RESERVED; |
|
621 | headerCWF[ i ].reserved = DEFAULT_RESERVED; | |
622 | headerCWF[ i ].userApplication = CCSDS_USER_APP; |
|
622 | headerCWF[ i ].userApplication = CCSDS_USER_APP; | |
623 |
|
623 | |||
624 | headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); |
|
624 | headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); | |
625 | headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); |
|
625 | headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); | |
626 | if (i == 0) |
|
626 | if (i == 0) | |
627 | { |
|
627 | { | |
628 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST; |
|
628 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST; | |
629 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 >> 8); |
|
629 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 >> 8); | |
630 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 ); |
|
630 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 ); | |
631 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8); |
|
631 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8); | |
632 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 ); |
|
632 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 ); | |
633 | } |
|
633 | } | |
634 | else if (i == 6) |
|
634 | else if (i == 6) | |
635 | { |
|
635 | { | |
636 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST; |
|
636 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST; | |
637 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_8 >> 8); |
|
637 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_8 >> 8); | |
638 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_8 ); |
|
638 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_8 ); | |
639 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8); |
|
639 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8); | |
640 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 ); |
|
640 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 ); | |
641 | } |
|
641 | } | |
642 | else |
|
642 | else | |
643 | { |
|
643 | { | |
644 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION; |
|
644 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION; | |
645 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 >> 8); |
|
645 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 >> 8); | |
646 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 ); |
|
646 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 ); | |
647 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8); |
|
647 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8); | |
648 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 ); |
|
648 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 ); | |
649 | } |
|
649 | } | |
650 | headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
650 | headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
651 | // DATA FIELD HEADER |
|
651 | // DATA FIELD HEADER | |
652 | headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
652 | headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
653 | headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
653 | headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
654 | headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
654 | headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
655 | headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; |
|
655 | headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; | |
656 | // AUXILIARY DATA HEADER |
|
656 | // AUXILIARY DATA HEADER | |
657 | headerCWF[ i ].sid = SID_NORM_CWF_F3; |
|
657 | headerCWF[ i ].sid = SID_NORM_CWF_F3; | |
658 | headerCWF[ i ].hkBIA = DEFAULT_HKBIA; |
|
658 | headerCWF[ i ].hkBIA = DEFAULT_HKBIA; | |
659 | headerCWF[ i ].time[0] = 0x00; |
|
659 | headerCWF[ i ].time[0] = 0x00; | |
660 | headerCWF[ i ].time[0] = 0x00; |
|
660 | headerCWF[ i ].time[0] = 0x00; | |
661 | headerCWF[ i ].time[0] = 0x00; |
|
661 | headerCWF[ i ].time[0] = 0x00; | |
662 | headerCWF[ i ].time[0] = 0x00; |
|
662 | headerCWF[ i ].time[0] = 0x00; | |
663 | headerCWF[ i ].time[0] = 0x00; |
|
663 | headerCWF[ i ].time[0] = 0x00; | |
664 | headerCWF[ i ].time[0] = 0x00; |
|
664 | headerCWF[ i ].time[0] = 0x00; | |
665 | } |
|
665 | } | |
666 | return LFR_SUCCESSFUL; |
|
666 | return LFR_SUCCESSFUL; | |
667 | } |
|
667 | } | |
668 |
|
668 | |||
669 | void reset_waveforms( void ) |
|
669 | void reset_waveforms( void ) | |
670 | { |
|
670 | { | |
671 | int i = 0; |
|
671 | int i = 0; | |
672 |
|
672 | |||
673 | for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++) |
|
673 | for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++) | |
674 | { |
|
674 | { | |
675 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x10002000; |
|
675 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x10002000; | |
676 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0x20001000; |
|
676 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0x20001000; | |
677 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x40008000; |
|
677 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x40008000; | |
678 |
|
678 | |||
679 | //*** |
|
679 | //*** | |
680 | // F1 |
|
680 | // F1 | |
681 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x1000f000; |
|
681 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x1000f000; | |
682 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0xf0001000; |
|
682 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0xf0001000; | |
683 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x40008000; |
|
683 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x40008000; | |
684 |
|
684 | |||
685 | //*** |
|
685 | //*** | |
686 | // F2 |
|
686 | // F2 | |
687 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x40008000; |
|
687 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x40008000; | |
688 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0x20001000; |
|
688 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0x20001000; | |
689 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x10002000; |
|
689 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x10002000; | |
690 |
|
690 | |||
691 | //*** |
|
691 | //*** | |
692 | // F3 |
|
692 | // F3 | |
693 | /*wf_cont_f3[ i* NB_WORDS_SWF_BLK + 0 ] = build_value( i, i ); // v and 1 |
|
693 | /*wf_cont_f3[ i* NB_WORDS_SWF_BLK + 0 ] = build_value( i, i ); // v and 1 | |
694 | wf_cont_f3[ i* NB_WORDS_SWF_BLK + 1 ] = build_value( i, i ); // e2 and b1 |
|
694 | wf_cont_f3[ i* NB_WORDS_SWF_BLK + 1 ] = build_value( i, i ); // e2 and b1 | |
695 | wf_cont_f3[ i* NB_WORDS_SWF_BLK + 2 ] = build_value( i, i ); // b2 and b3*/ |
|
695 | wf_cont_f3[ i* NB_WORDS_SWF_BLK + 2 ] = build_value( i, i ); // b2 and b3*/ | |
696 | } |
|
696 | } | |
697 | } |
|
697 | } | |
698 |
|
698 | |||
699 | int send_waveform_SWF( volatile int *waveform, unsigned int sid, |
|
699 | int send_waveform_SWF( volatile int *waveform, unsigned int sid, | |
700 | Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id ) |
|
700 | Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id ) | |
701 | { |
|
701 | { | |
702 | /** This function sends SWF CCSDS packets (F2, F1 or F0). |
|
702 | /** This function sends SWF CCSDS packets (F2, F1 or F0). | |
703 | * |
|
703 | * | |
704 | * @param waveform points to the buffer containing the data that will be send. |
|
704 | * @param waveform points to the buffer containing the data that will be send. | |
705 | * @param sid is the source identifier of the data that will be sent. |
|
705 | * @param sid is the source identifier of the data that will be sent. | |
706 | * @param headerSWF points to a table of headers that have been prepared for the data transmission. |
|
706 | * @param headerSWF points to a table of headers that have been prepared for the data transmission. | |
707 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures |
|
707 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures | |
708 | * contain information to setup the transmission of the data packets. |
|
708 | * contain information to setup the transmission of the data packets. | |
709 | * |
|
709 | * | |
710 | * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks. |
|
710 | * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks. | |
711 | * |
|
711 | * | |
712 | */ |
|
712 | */ | |
713 |
|
713 | |||
714 | unsigned int i; |
|
714 | unsigned int i; | |
715 | int ret; |
|
715 | int ret; | |
716 | rtems_status_code status; |
|
716 | rtems_status_code status; | |
717 | spw_ioctl_pkt_send spw_ioctl_send_SWF; |
|
717 | spw_ioctl_pkt_send spw_ioctl_send_SWF; | |
718 |
|
718 | |||
719 | spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header |
|
719 | spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header | |
720 | spw_ioctl_send_SWF.options = 0; |
|
720 | spw_ioctl_send_SWF.options = 0; | |
721 |
|
721 | |||
722 | ret = LFR_DEFAULT; |
|
722 | ret = LFR_DEFAULT; | |
723 |
|
723 | |||
724 | for (i=0; i<7; i++) // send waveform |
|
724 | for (i=0; i<7; i++) // send waveform | |
725 | { |
|
725 | { | |
726 | spw_ioctl_send_SWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ]; |
|
726 | spw_ioctl_send_SWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ]; | |
727 | spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ]; |
|
727 | spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ]; | |
728 | // BUILD THE DATA |
|
728 | // BUILD THE DATA | |
729 | if (i==6) { |
|
729 | if (i==6) { | |
730 | spw_ioctl_send_SWF.dlen = 8 * NB_BYTES_SWF_BLK; |
|
730 | spw_ioctl_send_SWF.dlen = 8 * NB_BYTES_SWF_BLK; | |
731 | } |
|
731 | } | |
732 | else { |
|
732 | else { | |
733 | spw_ioctl_send_SWF.dlen = 340 * NB_BYTES_SWF_BLK; |
|
733 | spw_ioctl_send_SWF.dlen = 340 * NB_BYTES_SWF_BLK; | |
734 | } |
|
734 | } | |
735 | // SET PACKET SEQUENCE COUNTER |
|
735 | // SET PACKET SEQUENCE COUNTER | |
736 | increment_seq_counter_source_id( headerSWF[ i ].packetSequenceControl, sid ); |
|
736 | increment_seq_counter_source_id( headerSWF[ i ].packetSequenceControl, sid ); | |
737 | // SET PACKET TIME |
|
737 | // SET PACKET TIME | |
738 | headerSWF[ i ].acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
738 | headerSWF[ i ].acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
739 | headerSWF[ i ].acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
739 | headerSWF[ i ].acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
740 | headerSWF[ i ].acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
740 | headerSWF[ i ].acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
741 | headerSWF[ i ].acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time); |
|
741 | headerSWF[ i ].acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time); | |
742 | headerSWF[ i ].acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
742 | headerSWF[ i ].acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
743 | headerSWF[ i ].acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time); |
|
743 | headerSWF[ i ].acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time); | |
744 | headerSWF[ i ].time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
744 | headerSWF[ i ].time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
745 | headerSWF[ i ].time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
745 | headerSWF[ i ].time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
746 | headerSWF[ i ].time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
746 | headerSWF[ i ].time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
747 | headerSWF[ i ].time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
747 | headerSWF[ i ].time[3] = (unsigned char) (time_management_regs->coarse_time); | |
748 | headerSWF[ i ].time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
748 | headerSWF[ i ].time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
749 | headerSWF[ i ].time[5] = (unsigned char) (time_management_regs->fine_time); |
|
749 | headerSWF[ i ].time[5] = (unsigned char) (time_management_regs->fine_time); | |
750 | // SEND PACKET |
|
750 | // SEND PACKET | |
751 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_SWF, ACTION_MSG_SPW_IOCTL_SEND_SIZE); |
|
751 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_SWF, ACTION_MSG_SPW_IOCTL_SEND_SIZE); | |
752 | if (status != RTEMS_SUCCESSFUL) { |
|
752 | if (status != RTEMS_SUCCESSFUL) { | |
753 | printf("%d-%d, ERR %d\n", sid, i, (int) status); |
|
753 | printf("%d-%d, ERR %d\n", sid, i, (int) status); | |
754 | ret = LFR_DEFAULT; |
|
754 | ret = LFR_DEFAULT; | |
755 | } |
|
755 | } | |
756 | rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds |
|
756 | rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds | |
757 | } |
|
757 | } | |
758 |
|
758 | |||
759 | return ret; |
|
759 | return ret; | |
760 | } |
|
760 | } | |
761 |
|
761 | |||
762 | int send_waveform_CWF(volatile int *waveform, unsigned int sid, |
|
762 | int send_waveform_CWF(volatile int *waveform, unsigned int sid, | |
763 | Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id) |
|
763 | Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id) | |
764 | { |
|
764 | { | |
765 | /** This function sends CWF CCSDS packets (F2, F1 or F0). |
|
765 | /** This function sends CWF CCSDS packets (F2, F1 or F0). | |
766 | * |
|
766 | * | |
767 | * @param waveform points to the buffer containing the data that will be send. |
|
767 | * @param waveform points to the buffer containing the data that will be send. | |
768 | * @param sid is the source identifier of the data that will be sent. |
|
768 | * @param sid is the source identifier of the data that will be sent. | |
769 | * @param headerCWF points to a table of headers that have been prepared for the data transmission. |
|
769 | * @param headerCWF points to a table of headers that have been prepared for the data transmission. | |
770 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures |
|
770 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures | |
771 | * contain information to setup the transmission of the data packets. |
|
771 | * contain information to setup the transmission of the data packets. | |
772 | * |
|
772 | * | |
773 | * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks. |
|
773 | * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks. | |
774 | * |
|
774 | * | |
775 | */ |
|
775 | */ | |
776 |
|
776 | |||
777 | unsigned int i; |
|
777 | unsigned int i; | |
778 | int ret; |
|
778 | int ret; | |
779 | rtems_status_code status; |
|
779 | rtems_status_code status; | |
780 | spw_ioctl_pkt_send spw_ioctl_send_CWF; |
|
780 | spw_ioctl_pkt_send spw_ioctl_send_CWF; | |
781 |
|
781 | |||
782 | spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header |
|
782 | spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header | |
783 | spw_ioctl_send_CWF.options = 0; |
|
783 | spw_ioctl_send_CWF.options = 0; | |
784 |
|
784 | |||
785 | ret = LFR_DEFAULT; |
|
785 | ret = LFR_DEFAULT; | |
786 |
|
786 | |||
787 | for (i=0; i<7; i++) // send waveform |
|
787 | for (i=0; i<7; i++) // send waveform | |
788 | { |
|
788 | { | |
789 | int coarseTime = 0x00; |
|
789 | int coarseTime = 0x00; | |
790 | int fineTime = 0x00; |
|
790 | int fineTime = 0x00; | |
791 | spw_ioctl_send_CWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ]; |
|
791 | spw_ioctl_send_CWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ]; | |
792 | spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ]; |
|
792 | spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ]; | |
793 | // BUILD THE DATA |
|
793 | // BUILD THE DATA | |
794 | if (i==6) { |
|
794 | if (i==6) { | |
795 | spw_ioctl_send_CWF.dlen = 8 * NB_BYTES_SWF_BLK; |
|
795 | spw_ioctl_send_CWF.dlen = 8 * NB_BYTES_SWF_BLK; | |
796 | } |
|
796 | } | |
797 | else { |
|
797 | else { | |
798 | spw_ioctl_send_CWF.dlen = 340 * NB_BYTES_SWF_BLK; |
|
798 | spw_ioctl_send_CWF.dlen = 340 * NB_BYTES_SWF_BLK; | |
799 | } |
|
799 | } | |
800 | // SET PACKET SEQUENCE COUNTER |
|
800 | // SET PACKET SEQUENCE COUNTER | |
801 | increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, sid ); |
|
801 | increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, sid ); | |
802 | // SET PACKET TIME |
|
802 | // SET PACKET TIME | |
803 | coarseTime = time_management_regs->coarse_time; |
|
803 | coarseTime = time_management_regs->coarse_time; | |
804 | fineTime = time_management_regs->fine_time; |
|
804 | fineTime = time_management_regs->fine_time; | |
805 | headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24); |
|
805 | headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24); | |
806 | headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16); |
|
806 | headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16); | |
807 | headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8); |
|
807 | headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8); | |
808 | headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime); |
|
808 | headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime); | |
809 | headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8); |
|
809 | headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8); | |
810 | headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime); |
|
810 | headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime); | |
811 | headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24); |
|
811 | headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24); | |
812 | headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16); |
|
812 | headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16); | |
813 | headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8); |
|
813 | headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8); | |
814 | headerCWF[ i ].time[3] = (unsigned char) (coarseTime); |
|
814 | headerCWF[ i ].time[3] = (unsigned char) (coarseTime); | |
815 | headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8); |
|
815 | headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8); | |
816 | headerCWF[ i ].time[5] = (unsigned char) (fineTime); |
|
816 | headerCWF[ i ].time[5] = (unsigned char) (fineTime); | |
817 | // SEND PACKET |
|
817 | // SEND PACKET | |
818 | if (sid == SID_NORM_CWF_F3) |
|
818 | if (sid == SID_NORM_CWF_F3) | |
819 | { |
|
819 | { | |
820 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); |
|
820 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); | |
821 | if (status != RTEMS_SUCCESSFUL) { |
|
821 | if (status != RTEMS_SUCCESSFUL) { | |
822 | printf("%d-%d, ERR %d\n", sid, i, (int) status); |
|
822 | printf("%d-%d, ERR %d\n", sid, i, (int) status); | |
823 | ret = LFR_DEFAULT; |
|
823 | ret = LFR_DEFAULT; | |
824 | } |
|
824 | } | |
825 | rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS); |
|
825 | rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS); | |
826 | } |
|
826 | } | |
827 | else |
|
827 | else | |
828 | { |
|
828 | { | |
829 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); |
|
829 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); | |
830 | if (status != RTEMS_SUCCESSFUL) { |
|
830 | if (status != RTEMS_SUCCESSFUL) { | |
831 | printf("%d-%d, ERR %d\n", sid, i, (int) status); |
|
831 | printf("%d-%d, ERR %d\n", sid, i, (int) status); | |
832 | ret = LFR_DEFAULT; |
|
832 | ret = LFR_DEFAULT; | |
833 | } |
|
833 | } | |
834 | } |
|
834 | } | |
835 | } |
|
835 | } | |
836 |
|
836 | |||
837 | return ret; |
|
837 | return ret; | |
838 | } |
|
838 | } | |
839 |
|
839 | |||
840 | int send_waveform_CWF3_light(volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id) |
|
840 | int send_waveform_CWF3_light(volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id) | |
841 | { |
|
841 | { | |
842 | /** This function sends CWF_F3 CCSDS packets without the b1, b2 and b3 data. |
|
842 | /** This function sends CWF_F3 CCSDS packets without the b1, b2 and b3 data. | |
843 | * |
|
843 | * | |
844 | * @param waveform points to the buffer containing the data that will be send. |
|
844 | * @param waveform points to the buffer containing the data that will be send. | |
845 | * @param headerCWF points to a table of headers that have been prepared for the data transmission. |
|
845 | * @param headerCWF points to a table of headers that have been prepared for the data transmission. | |
846 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures |
|
846 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures | |
847 | * contain information to setup the transmission of the data packets. |
|
847 | * contain information to setup the transmission of the data packets. | |
848 | * |
|
848 | * | |
849 | * By default, CWF_F3 packet are send without the b1, b2 and b3 data. This function rebuilds a data buffer |
|
849 | * By default, CWF_F3 packet are send without the b1, b2 and b3 data. This function rebuilds a data buffer | |
850 | * from the incoming data and sends it in 7 packets, 6 containing 340 blocks and 1 one containing 8 blocks. |
|
850 | * from the incoming data and sends it in 7 packets, 6 containing 340 blocks and 1 one containing 8 blocks. | |
851 | * |
|
851 | * | |
852 | */ |
|
852 | */ | |
853 |
|
853 | |||
854 | unsigned int i; |
|
854 | unsigned int i; | |
855 | int ret; |
|
855 | int ret; | |
856 | rtems_status_code status; |
|
856 | rtems_status_code status; | |
857 | spw_ioctl_pkt_send spw_ioctl_send_CWF; |
|
857 | spw_ioctl_pkt_send spw_ioctl_send_CWF; | |
858 | char *sample; |
|
858 | char *sample; | |
859 |
|
859 | |||
860 | spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header |
|
860 | spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header | |
861 | spw_ioctl_send_CWF.options = 0; |
|
861 | spw_ioctl_send_CWF.options = 0; | |
862 |
|
862 | |||
863 | ret = LFR_DEFAULT; |
|
863 | ret = LFR_DEFAULT; | |
864 |
|
864 | |||
865 | //********************** |
|
865 | //********************** | |
866 | // BUILD CWF3_light DATA |
|
866 | // BUILD CWF3_light DATA | |
867 | for ( i=0; i< 2048; i++) |
|
867 | for ( i=0; i< 2048; i++) | |
868 | { |
|
868 | { | |
869 | sample = (char*) &waveform[ i * NB_WORDS_SWF_BLK ]; |
|
869 | sample = (char*) &waveform[ i * NB_WORDS_SWF_BLK ]; | |
870 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) ] = sample[ 0 ]; |
|
870 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) ] = sample[ 0 ]; | |
871 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 ] = sample[ 1 ]; |
|
871 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 ] = sample[ 1 ]; | |
872 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 ] = sample[ 2 ]; |
|
872 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 ] = sample[ 2 ]; | |
873 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 ] = sample[ 3 ]; |
|
873 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 ] = sample[ 3 ]; | |
874 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 ] = sample[ 4 ]; |
|
874 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 ] = sample[ 4 ]; | |
875 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 ] = sample[ 5 ]; |
|
875 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 ] = sample[ 5 ]; | |
876 | } |
|
876 | } | |
877 |
|
877 | |||
878 | //********************* |
|
878 | //********************* | |
879 | // SEND CWF3_light DATA |
|
879 | // SEND CWF3_light DATA | |
880 |
|
880 | |||
881 | for (i=0; i<7; i++) // send waveform |
|
881 | for (i=0; i<7; i++) // send waveform | |
882 | { |
|
882 | { | |
883 | int coarseTime = 0x00; |
|
883 | int coarseTime = 0x00; | |
884 | int fineTime = 0x00; |
|
884 | int fineTime = 0x00; | |
885 | spw_ioctl_send_CWF.data = (char*) &wf_cont_f3_light[ (i * 340 * NB_BYTES_CWF3_LIGHT_BLK) ]; |
|
885 | spw_ioctl_send_CWF.data = (char*) &wf_cont_f3_light[ (i * 340 * NB_BYTES_CWF3_LIGHT_BLK) ]; | |
886 | spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ]; |
|
886 | spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ]; | |
887 | // BUILD THE DATA |
|
887 | // BUILD THE DATA | |
888 | if ( i == WFRM_INDEX_OF_LAST_PACKET ) { |
|
888 | if ( i == WFRM_INDEX_OF_LAST_PACKET ) { | |
889 | spw_ioctl_send_CWF.dlen = 8 * NB_BYTES_CWF3_LIGHT_BLK; |
|
889 | spw_ioctl_send_CWF.dlen = 8 * NB_BYTES_CWF3_LIGHT_BLK; | |
890 | } |
|
890 | } | |
891 | else { |
|
891 | else { | |
892 | spw_ioctl_send_CWF.dlen = 340 * NB_BYTES_CWF3_LIGHT_BLK; |
|
892 | spw_ioctl_send_CWF.dlen = 340 * NB_BYTES_CWF3_LIGHT_BLK; | |
893 | } |
|
893 | } | |
894 | // SET PACKET SEQUENCE COUNTER |
|
894 | // SET PACKET SEQUENCE COUNTER | |
895 | increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, SID_NORM_CWF_F3 ); |
|
895 | increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, SID_NORM_CWF_F3 ); | |
896 | // SET PACKET TIME |
|
896 | // SET PACKET TIME | |
897 | coarseTime = time_management_regs->coarse_time; |
|
897 | coarseTime = time_management_regs->coarse_time; | |
898 | fineTime = time_management_regs->fine_time; |
|
898 | fineTime = time_management_regs->fine_time; | |
899 | headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24); |
|
899 | headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24); | |
900 | headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16); |
|
900 | headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16); | |
901 | headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8); |
|
901 | headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8); | |
902 | headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime); |
|
902 | headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime); | |
903 | headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8); |
|
903 | headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8); | |
904 | headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime); |
|
904 | headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime); | |
905 | headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24); |
|
905 | headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24); | |
906 | headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16); |
|
906 | headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16); | |
907 | headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8); |
|
907 | headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8); | |
908 | headerCWF[ i ].time[3] = (unsigned char) (coarseTime); |
|
908 | headerCWF[ i ].time[3] = (unsigned char) (coarseTime); | |
909 | headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8); |
|
909 | headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8); | |
910 | headerCWF[ i ].time[5] = (unsigned char) (fineTime); |
|
910 | headerCWF[ i ].time[5] = (unsigned char) (fineTime); | |
911 | // SEND PACKET |
|
911 | // SEND PACKET | |
912 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); |
|
912 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); | |
913 | if (status != RTEMS_SUCCESSFUL) { |
|
913 | if (status != RTEMS_SUCCESSFUL) { | |
914 | printf("%d-%d, ERR %d\n", SID_NORM_CWF_F3, i, (int) status); |
|
914 | printf("%d-%d, ERR %d\n", SID_NORM_CWF_F3, i, (int) status); | |
915 | ret = LFR_DEFAULT; |
|
915 | ret = LFR_DEFAULT; | |
916 | } |
|
916 | } | |
917 | rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS); |
|
917 | rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS); | |
918 | } |
|
918 | } | |
919 |
|
919 | |||
920 | return ret; |
|
920 | return ret; | |
921 | } |
|
921 | } | |
922 |
|
922 | |||
923 |
|
923 | |||
924 | //************** |
|
924 | //************** | |
925 | // wfp registers |
|
925 | // wfp registers | |
926 | void set_wfp_data_shaping() |
|
926 | void set_wfp_data_shaping() | |
927 | { |
|
927 | { | |
928 | /** This function sets the data_shaping register of the waveform picker module. |
|
928 | /** This function sets the data_shaping register of the waveform picker module. | |
929 | * |
|
929 | * | |
930 | * The value is read from one field of the parameter_dump_packet structure:\n |
|
930 | * The value is read from one field of the parameter_dump_packet structure:\n | |
931 | * bw_sp0_sp1_r0_r1 |
|
931 | * bw_sp0_sp1_r0_r1 | |
932 | * |
|
932 | * | |
933 | */ |
|
933 | */ | |
934 |
|
934 | |||
935 | unsigned char data_shaping; |
|
935 | unsigned char data_shaping; | |
936 |
|
936 | |||
937 | // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register |
|
937 | // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register | |
938 | // waveform picker : [R1 R0 SP1 SP0 BW] |
|
938 | // waveform picker : [R1 R0 SP1 SP0 BW] | |
939 |
|
939 | |||
940 | data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1; |
|
940 | data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1; | |
941 |
|
941 | |||
942 | #ifdef GSA |
|
942 | #ifdef GSA | |
943 | #else |
|
943 | #else | |
944 | waveform_picker_regs->data_shaping = |
|
944 | waveform_picker_regs->data_shaping = | |
945 | ( (data_shaping & 0x10) >> 4 ) // BW |
|
945 | ( (data_shaping & 0x10) >> 4 ) // BW | |
946 | + ( (data_shaping & 0x08) >> 2 ) // SP0 |
|
946 | + ( (data_shaping & 0x08) >> 2 ) // SP0 | |
947 | + ( (data_shaping & 0x04) ) // SP1 |
|
947 | + ( (data_shaping & 0x04) ) // SP1 | |
948 | + ( (data_shaping & 0x02) << 2 ) // R0 |
|
948 | + ( (data_shaping & 0x02) << 2 ) // R0 | |
949 | + ( (data_shaping & 0x01) << 4 ); // R1 |
|
949 | + ( (data_shaping & 0x01) << 4 ); // R1 | |
950 | #endif |
|
950 | #endif | |
951 | } |
|
951 | } | |
952 |
|
952 | |||
953 | char set_wfp_delta_snapshot() |
|
953 | char set_wfp_delta_snapshot() | |
954 | { |
|
954 | { | |
955 | /** This function sets the delta_snapshot register of the waveform picker module. |
|
955 | /** This function sets the delta_snapshot register of the waveform picker module. | |
956 | * |
|
956 | * | |
957 | * The value is read from two (unsigned char) of the parameter_dump_packet structure: |
|
957 | * The value is read from two (unsigned char) of the parameter_dump_packet structure: | |
958 | * - sy_lfr_n_swf_p[0] |
|
958 | * - sy_lfr_n_swf_p[0] | |
959 | * - sy_lfr_n_swf_p[1] |
|
959 | * - sy_lfr_n_swf_p[1] | |
960 | * |
|
960 | * | |
961 | */ |
|
961 | */ | |
962 |
|
962 | |||
963 | char ret; |
|
963 | char ret; | |
964 | unsigned int delta_snapshot; |
|
964 | unsigned int delta_snapshot; | |
965 | unsigned int aux; |
|
965 | unsigned int aux; | |
966 |
|
966 | |||
967 | aux = 0; |
|
967 | aux = 0; | |
968 | ret = LFR_DEFAULT; |
|
968 | ret = LFR_DEFAULT; | |
969 |
|
969 | |||
970 | delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256 |
|
970 | delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256 | |
971 | + parameter_dump_packet.sy_lfr_n_swf_p[1]; |
|
971 | + parameter_dump_packet.sy_lfr_n_swf_p[1]; | |
972 |
|
972 | |||
973 | #ifdef GSA |
|
973 | #ifdef GSA | |
974 | #else |
|
974 | #else | |
975 | if ( delta_snapshot < MIN_DELTA_SNAPSHOT ) |
|
975 | if ( delta_snapshot < MIN_DELTA_SNAPSHOT ) | |
976 | { |
|
976 | { | |
977 | aux = MIN_DELTA_SNAPSHOT; |
|
977 | aux = MIN_DELTA_SNAPSHOT; | |
978 | ret = LFR_DEFAULT; |
|
978 | ret = LFR_DEFAULT; | |
979 | } |
|
979 | } | |
980 | else |
|
980 | else | |
981 | { |
|
981 | { | |
982 | aux = delta_snapshot ; |
|
982 | aux = delta_snapshot ; | |
983 | ret = LFR_SUCCESSFUL; |
|
983 | ret = LFR_SUCCESSFUL; | |
984 | } |
|
984 | } | |
985 | waveform_picker_regs->delta_snapshot = aux - 1; // max 2 bytes |
|
985 | waveform_picker_regs->delta_snapshot = aux - 1; // max 2 bytes | |
986 | #endif |
|
986 | #endif | |
987 |
|
987 | |||
988 | return ret; |
|
988 | return ret; | |
989 | } |
|
989 | } | |
990 |
|
990 | |||
991 | void set_wfp_burst_enable_register( unsigned char mode) |
|
991 | void set_wfp_burst_enable_register( unsigned char mode) | |
992 | { |
|
992 | { | |
993 | /** This function sets the waveform picker burst_enable register depending on the mode. |
|
993 | /** This function sets the waveform picker burst_enable register depending on the mode. | |
994 | * |
|
994 | * | |
995 | * @param mode is the LFR mode to launch. |
|
995 | * @param mode is the LFR mode to launch. | |
996 | * |
|
996 | * | |
997 | * The burst bits shall be before the enable bits. |
|
997 | * The burst bits shall be before the enable bits. | |
998 | * |
|
998 | * | |
999 | */ |
|
999 | */ | |
1000 |
|
1000 | |||
1001 | #ifdef GSA |
|
1001 | #ifdef GSA | |
1002 | #else |
|
1002 | #else | |
1003 | // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0 |
|
1003 | // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0 | |
1004 | // the burst bits shall be set first, before the enable bits |
|
1004 | // the burst bits shall be set first, before the enable bits | |
1005 | switch(mode) { |
|
1005 | switch(mode) { | |
1006 | case(LFR_MODE_NORMAL): |
|
1006 | case(LFR_MODE_NORMAL): | |
1007 | waveform_picker_regs->burst_enable = 0x00; // [0000 0000] no burst enable |
|
1007 | waveform_picker_regs->burst_enable = 0x00; // [0000 0000] no burst enable | |
1008 | waveform_picker_regs->burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0 |
|
1008 | waveform_picker_regs->burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0 | |
1009 | break; |
|
1009 | break; | |
1010 | case(LFR_MODE_BURST): |
|
1010 | case(LFR_MODE_BURST): | |
1011 | waveform_picker_regs->burst_enable = 0x40; // [0100 0000] f2 burst enabled |
|
1011 | waveform_picker_regs->burst_enable = 0x40; // [0100 0000] f2 burst enabled | |
1012 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x04; // [0100] enable f2 |
|
1012 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x04; // [0100] enable f2 | |
1013 | break; |
|
1013 | break; | |
1014 | case(LFR_MODE_SBM1): |
|
1014 | case(LFR_MODE_SBM1): | |
1015 | waveform_picker_regs->burst_enable = 0x20; // [0010 0000] f1 burst enabled |
|
1015 | waveform_picker_regs->burst_enable = 0x20; // [0010 0000] f1 burst enabled | |
1016 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 |
|
1016 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 | |
1017 | break; |
|
1017 | break; | |
1018 | case(LFR_MODE_SBM2): |
|
1018 | case(LFR_MODE_SBM2): | |
1019 | waveform_picker_regs->burst_enable = 0x40; // [0100 0000] f2 burst enabled |
|
1019 | waveform_picker_regs->burst_enable = 0x40; // [0100 0000] f2 burst enabled | |
1020 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 |
|
1020 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 | |
1021 | break; |
|
1021 | break; | |
1022 | default: |
|
1022 | default: | |
1023 | waveform_picker_regs->burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled |
|
1023 | waveform_picker_regs->burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled | |
1024 | break; |
|
1024 | break; | |
1025 | } |
|
1025 | } | |
1026 | #endif |
|
1026 | #endif | |
1027 | } |
|
1027 | } | |
1028 |
|
1028 | |||
1029 | void reset_wfp_burst_enable() |
|
1029 | void reset_wfp_burst_enable() | |
1030 | { |
|
1030 | { | |
1031 | /** This function resets the waveform picker burst_enable register. |
|
1031 | /** This function resets the waveform picker burst_enable register. | |
1032 | * |
|
1032 | * | |
1033 | * The burst bits [f2 f1 f0] and the enable bits [f3 f2 f1 f0] are set to 0. |
|
1033 | * The burst bits [f2 f1 f0] and the enable bits [f3 f2 f1 f0] are set to 0. | |
1034 | * |
|
1034 | * | |
1035 | */ |
|
1035 | */ | |
1036 |
|
1036 | |||
1037 | #ifdef GSA |
|
1037 | #ifdef GSA | |
1038 | #else |
|
1038 | #else | |
1039 | waveform_picker_regs->burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 |
|
1039 | waveform_picker_regs->burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 | |
1040 | #endif |
|
1040 | #endif | |
1041 | } |
|
1041 | } | |
1042 |
|
1042 | |||
1043 | void reset_wfp_status() |
|
1043 | void reset_wfp_status() | |
1044 | { |
|
1044 | { | |
1045 | /** This function resets the waveform picker status register. |
|
1045 | /** This function resets the waveform picker status register. | |
1046 | * |
|
1046 | * | |
1047 | * All status bits are set to 0 [new_err full_err full]. |
|
1047 | * All status bits are set to 0 [new_err full_err full]. | |
1048 | * |
|
1048 | * | |
1049 | */ |
|
1049 | */ | |
1050 |
|
1050 | |||
1051 | #ifdef GSA |
|
1051 | #ifdef GSA | |
1052 | #else |
|
1052 | #else | |
1053 | waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 |
|
1053 | waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 | |
1054 | #endif |
|
1054 | #endif | |
1055 | } |
|
1055 | } | |
1056 |
|
1056 | |||
1057 | void reset_waveform_picker_regs() |
|
1057 | void reset_waveform_picker_regs() | |
1058 | { |
|
1058 | { | |
1059 | /** This function resets the waveform picker module registers. |
|
1059 | /** This function resets the waveform picker module registers. | |
1060 | * |
|
1060 | * | |
1061 | * The registers affected by this function are located at the following offset addresses: |
|
1061 | * The registers affected by this function are located at the following offset addresses: | |
1062 | * - 0x00 data_shaping |
|
1062 | * - 0x00 data_shaping | |
1063 | * - 0x04 burst_enable |
|
1063 | * - 0x04 burst_enable | |
1064 | * - 0x08 addr_data_f0 |
|
1064 | * - 0x08 addr_data_f0 | |
1065 | * - 0x0C addr_data_f1 |
|
1065 | * - 0x0C addr_data_f1 | |
1066 | * - 0x10 addr_data_f2 |
|
1066 | * - 0x10 addr_data_f2 | |
1067 | * - 0x14 addr_data_f3 |
|
1067 | * - 0x14 addr_data_f3 | |
1068 | * - 0x18 status |
|
1068 | * - 0x18 status | |
1069 | * - 0x1C delta_snapshot |
|
1069 | * - 0x1C delta_snapshot | |
1070 | * - 0x20 delta_f2_f1 |
|
1070 | * - 0x20 delta_f2_f1 | |
1071 | * - 0x24 delta_f2_f0 |
|
1071 | * - 0x24 delta_f2_f0 | |
1072 | * - 0x28 nb_burst |
|
1072 | * - 0x28 nb_burst | |
1073 | * - 0x2C nb_snapshot |
|
1073 | * - 0x2C nb_snapshot | |
1074 | * |
|
1074 | * | |
1075 | */ |
|
1075 | */ | |
1076 |
|
1076 | |||
1077 | #ifdef GSA |
|
1077 | #ifdef GSA | |
1078 | #else |
|
1078 | #else | |
1079 | reset_wfp_burst_enable(); |
|
1079 | reset_wfp_burst_enable(); | |
1080 | reset_wfp_status(); |
|
1080 | reset_wfp_status(); | |
1081 | // set buffer addresses |
|
1081 | // set buffer addresses | |
1082 | waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0); // |
|
1082 | waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0); // | |
1083 | waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1); // |
|
1083 | waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1); // | |
1084 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); // |
|
1084 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); // | |
1085 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3); // |
|
1085 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3); // | |
1086 | // set other parameters |
|
1086 | // set other parameters | |
1087 | set_wfp_data_shaping(); |
|
1087 | set_wfp_data_shaping(); | |
1088 | set_wfp_delta_snapshot(); // time in seconds between two snapshots |
|
1088 | set_wfp_delta_snapshot(); // time in seconds between two snapshots | |
1089 | waveform_picker_regs->delta_f2_f1 = 0xffff; // 0x16800 => 92160 (max 4 bytes) |
|
1089 | waveform_picker_regs->delta_f2_f1 = 0xffff; // 0x16800 => 92160 (max 4 bytes) | |
1090 | waveform_picker_regs->delta_f2_f0 = 0x17c00; // 97 280 (max 5 bytes) |
|
1090 | waveform_picker_regs->delta_f2_f0 = 0x17c00; // 97 280 (max 5 bytes) | |
1091 | waveform_picker_regs->nb_burst_available = 0x180; // max 3 bytes, size of the buffer in burst (1 burst = 16 x 4 octets) |
|
1091 | waveform_picker_regs->nb_burst_available = 0x180; // max 3 bytes, size of the buffer in burst (1 burst = 16 x 4 octets) | |
1092 | waveform_picker_regs->nb_snapshot_param = 0x7ff; // max 3 octets, 2048 - 1 |
|
1092 | waveform_picker_regs->nb_snapshot_param = 0x7ff; // max 3 octets, 2048 - 1 | |
1093 | #endif |
|
1093 | #endif | |
1094 | } |
|
1094 | } | |
1095 |
|
1095 | |||
1096 | //***************** |
|
1096 | //***************** | |
1097 | // local parameters |
|
1097 | // local parameters | |
1098 | void set_local_sbm1_nb_cwf_max() |
|
1098 | void set_local_sbm1_nb_cwf_max( void ) | |
1099 | { |
|
1099 | { | |
1100 | /** This function sets the value of the sbm1_nb_cwf_max local parameter. |
|
1100 | /** This function sets the value of the sbm1_nb_cwf_max local parameter. | |
1101 | * |
|
1101 | * | |
1102 | * The sbm1_nb_cwf_max parameter counts the number of CWF_F1 records that have been sent.\n |
|
1102 | * The sbm1_nb_cwf_max parameter counts the number of CWF_F1 records that have been sent.\n | |
1103 | * This parameter is used to send CWF_F1 data as normal data when the SBM1 is active.\n\n |
|
1103 | * This parameter is used to send CWF_F1 data as normal data when the SBM1 is active.\n\n | |
1104 | * (2 snapshots of 2048 points per seconds) * (period of the NORM snashots) - 8 s (duration of the f2 snapshot) |
|
1104 | * (2 snapshots of 2048 points per seconds) * (period of the NORM snashots) - 8 s (duration of the f2 snapshot) | |
1105 | * |
|
1105 | * | |
1106 | */ |
|
1106 | */ | |
1107 | param_local.local_sbm1_nb_cwf_max = 2 * |
|
1107 | param_local.local_sbm1_nb_cwf_max = 2 * | |
1108 | (parameter_dump_packet.sy_lfr_n_swf_p[0] * 256 |
|
1108 | (parameter_dump_packet.sy_lfr_n_swf_p[0] * 256 | |
1109 | + parameter_dump_packet.sy_lfr_n_swf_p[1]) - 8; // 16 CWF1 parts during 1 SWF2 |
|
1109 | + parameter_dump_packet.sy_lfr_n_swf_p[1]) - 8; // 16 CWF1 parts during 1 SWF2 | |
1110 | } |
|
1110 | } | |
1111 |
|
1111 | |||
1112 | void set_local_sbm2_nb_cwf_max() |
|
1112 | void set_local_sbm2_nb_cwf_max(void) | |
1113 | { |
|
1113 | { | |
1114 | /** This function sets the value of the sbm1_nb_cwf_max local parameter. |
|
1114 | /** This function sets the value of the sbm1_nb_cwf_max local parameter. | |
1115 | * |
|
1115 | * | |
1116 | * The sbm1_nb_cwf_max parameter counts the number of CWF_F1 records that have been sent.\n |
|
1116 | * The sbm1_nb_cwf_max parameter counts the number of CWF_F1 records that have been sent.\n | |
1117 | * This parameter is used to send CWF_F2 data as normal data when the SBM2 is active.\n\n |
|
1117 | * This parameter is used to send CWF_F2 data as normal data when the SBM2 is active.\n\n | |
1118 | * (period of the NORM snashots) / (8 seconds per snapshot at f2 = 256 Hz) |
|
1118 | * (period of the NORM snashots) / (8 seconds per snapshot at f2 = 256 Hz) | |
1119 | * |
|
1119 | * | |
1120 | */ |
|
1120 | */ | |
1121 |
|
1121 | |||
1122 | param_local.local_sbm2_nb_cwf_max = (parameter_dump_packet.sy_lfr_n_swf_p[0] * 256 |
|
1122 | param_local.local_sbm2_nb_cwf_max = (parameter_dump_packet.sy_lfr_n_swf_p[0] * 256 | |
1123 | + parameter_dump_packet.sy_lfr_n_swf_p[1]) / 8; |
|
1123 | + parameter_dump_packet.sy_lfr_n_swf_p[1]) / 8; | |
1124 | } |
|
1124 | } | |
1125 |
|
1125 | |||
1126 | void set_local_nb_interrupt_f0_MAX() |
|
1126 | void set_local_nb_interrupt_f0_MAX( void ) | |
1127 | { |
|
1127 | { | |
1128 | /** This function sets the value of the nb_interrupt_f0_MAX local parameter. |
|
1128 | /** This function sets the value of the nb_interrupt_f0_MAX local parameter. | |
1129 | * |
|
1129 | * | |
1130 | * This parameter is used for the SM validation only.\n |
|
1130 | * This parameter is used for the SM validation only.\n | |
1131 | * The software waits param_local.local_nb_interrupt_f0_MAX interruptions from the spectral matrices |
|
1131 | * The software waits param_local.local_nb_interrupt_f0_MAX interruptions from the spectral matrices | |
1132 | * module before launching a basic processing. |
|
1132 | * module before launching a basic processing. | |
1133 | * |
|
1133 | * | |
1134 | */ |
|
1134 | */ | |
1135 |
|
1135 | |||
1136 | param_local.local_nb_interrupt_f0_MAX = ( (parameter_dump_packet.sy_lfr_n_asm_p[0]) * 256 |
|
1136 | param_local.local_nb_interrupt_f0_MAX = ( (parameter_dump_packet.sy_lfr_n_asm_p[0]) * 256 | |
1137 | + parameter_dump_packet.sy_lfr_n_asm_p[1] ) * 100; |
|
1137 | + parameter_dump_packet.sy_lfr_n_asm_p[1] ) * 100; | |
1138 | } |
|
1138 | } | |
1139 |
|
1139 | |||
1140 | void reset_local_sbm1_nb_cwf_sent() |
|
1140 | void reset_local_sbm1_nb_cwf_sent( void ) | |
1141 | { |
|
1141 | { | |
1142 | /** This function resets the value of the sbm1_nb_cwf_sent local parameter. |
|
1142 | /** This function resets the value of the sbm1_nb_cwf_sent local parameter. | |
1143 | * |
|
1143 | * | |
1144 | * The sbm1_nb_cwf_sent parameter counts the number of CWF_F1 records that have been sent.\n |
|
1144 | * The sbm1_nb_cwf_sent parameter counts the number of CWF_F1 records that have been sent.\n | |
1145 | * This parameter is used to send CWF_F1 data as normal data when the SBM1 is active. |
|
1145 | * This parameter is used to send CWF_F1 data as normal data when the SBM1 is active. | |
1146 | * |
|
1146 | * | |
1147 | */ |
|
1147 | */ | |
1148 |
|
1148 | |||
1149 | param_local.local_sbm1_nb_cwf_sent = 0; |
|
1149 | param_local.local_sbm1_nb_cwf_sent = 0; | |
1150 | } |
|
1150 | } | |
1151 |
|
1151 | |||
1152 | void reset_local_sbm2_nb_cwf_sent() |
|
1152 | void reset_local_sbm2_nb_cwf_sent( void ) | |
1153 | { |
|
1153 | { | |
1154 | /** This function resets the value of the sbm2_nb_cwf_sent local parameter. |
|
1154 | /** This function resets the value of the sbm2_nb_cwf_sent local parameter. | |
1155 | * |
|
1155 | * | |
1156 | * The sbm2_nb_cwf_sent parameter counts the number of CWF_F2 records that have been sent.\n |
|
1156 | * The sbm2_nb_cwf_sent parameter counts the number of CWF_F2 records that have been sent.\n | |
1157 | * This parameter is used to send CWF_F2 data as normal data when the SBM2 mode is active. |
|
1157 | * This parameter is used to send CWF_F2 data as normal data when the SBM2 mode is active. | |
1158 | * |
|
1158 | * | |
1159 | */ |
|
1159 | */ | |
1160 |
|
1160 | |||
1161 | param_local.local_sbm2_nb_cwf_sent = 0; |
|
1161 | param_local.local_sbm2_nb_cwf_sent = 0; | |
1162 | } |
|
1162 | } | |
1163 |
|
1163 | |||
1164 | rtems_id get_pkts_queue_id( void ) |
|
1164 | rtems_id get_pkts_queue_id( void ) | |
1165 | { |
|
1165 | { | |
1166 | rtems_id queue_id; |
|
1166 | rtems_id queue_id; | |
1167 | rtems_status_code status; |
|
1167 | rtems_status_code status; | |
1168 | rtems_name queue_send_name; |
|
1168 | rtems_name queue_send_name; | |
1169 |
|
1169 | |||
1170 | queue_send_name = rtems_build_name( 'Q', '_', 'S', 'D' ); |
|
1170 | queue_send_name = rtems_build_name( 'Q', '_', 'S', 'D' ); | |
1171 |
|
1171 | |||
1172 | status = rtems_message_queue_ident( queue_send_name, 0, &queue_id ); |
|
1172 | status = rtems_message_queue_ident( queue_send_name, 0, &queue_id ); | |
1173 | if (status != RTEMS_SUCCESSFUL) |
|
1173 | if (status != RTEMS_SUCCESSFUL) | |
1174 | { |
|
1174 | { | |
1175 | PRINTF1("in get_pkts_queue_id *** ERR %d\n", status) |
|
1175 | PRINTF1("in get_pkts_queue_id *** ERR %d\n", status) | |
1176 | } |
|
1176 | } | |
1177 | return queue_id; |
|
1177 | return queue_id; | |
1178 | } |
|
1178 | } | |
1179 |
|
1179 | |||
1180 | void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid ) |
|
1180 | void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid ) | |
1181 | { |
|
1181 | { | |
1182 | unsigned short *sequence_cnt; |
|
1182 | unsigned short *sequence_cnt; | |
1183 | unsigned short segmentation_grouping_flag; |
|
1183 | unsigned short segmentation_grouping_flag; | |
1184 | unsigned short new_packet_sequence_control; |
|
1184 | unsigned short new_packet_sequence_control; | |
1185 |
|
1185 | |||
1186 | if ( (sid ==SID_NORM_SWF_F0) || (sid ==SID_NORM_SWF_F1) || (sid ==SID_NORM_SWF_F2) |
|
1186 | if ( (sid ==SID_NORM_SWF_F0) || (sid ==SID_NORM_SWF_F1) || (sid ==SID_NORM_SWF_F2) | |
1187 | || (sid ==SID_NORM_CWF_F3) || (sid ==SID_BURST_CWF_F2) ) |
|
1187 | || (sid ==SID_NORM_CWF_F3) || (sid ==SID_BURST_CWF_F2) ) | |
1188 | { |
|
1188 | { | |
1189 | sequence_cnt = &sequenceCounters_SCIENCE_NORMAL_BURST; |
|
1189 | sequence_cnt = &sequenceCounters_SCIENCE_NORMAL_BURST; | |
1190 | } |
|
1190 | } | |
1191 | else if ( (sid ==SID_SBM1_CWF_F1) || (sid ==SID_SBM2_CWF_F2) ) |
|
1191 | else if ( (sid ==SID_SBM1_CWF_F1) || (sid ==SID_SBM2_CWF_F2) ) | |
1192 | { |
|
1192 | { | |
1193 | sequence_cnt = &sequenceCounters_SCIENCE_SBM1_SBM2; |
|
1193 | sequence_cnt = &sequenceCounters_SCIENCE_SBM1_SBM2; | |
1194 | } |
|
1194 | } | |
1195 | else |
|
1195 | else | |
1196 | { |
|
1196 | { | |
1197 | sequence_cnt = &sequenceCounters_TC_EXE[ UNKNOWN ]; |
|
1197 | sequence_cnt = &sequenceCounters_TC_EXE[ UNKNOWN ]; | |
1198 | PRINTF1("in increment_seq_counter_source_id *** ERR apid_destid %d not known\n", sid) |
|
1198 | PRINTF1("in increment_seq_counter_source_id *** ERR apid_destid %d not known\n", sid) | |
1199 | } |
|
1199 | } | |
1200 |
|
1200 | |||
1201 | segmentation_grouping_flag = (packet_sequence_control[ 0 ] & 0xc0) << 8; |
|
1201 | segmentation_grouping_flag = (packet_sequence_control[ 0 ] & 0xc0) << 8; | |
1202 | *sequence_cnt = (*sequence_cnt) & 0x3fff; |
|
1202 | *sequence_cnt = (*sequence_cnt) & 0x3fff; | |
1203 |
|
1203 | |||
1204 | new_packet_sequence_control = segmentation_grouping_flag | *sequence_cnt ; |
|
1204 | new_packet_sequence_control = segmentation_grouping_flag | *sequence_cnt ; | |
1205 |
|
1205 | |||
1206 | packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8); |
|
1206 | packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8); | |
1207 | packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control ); |
|
1207 | packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control ); | |
1208 |
|
1208 | |||
1209 | // increment the seuqence counter for the next packet |
|
1209 | // increment the seuqence counter for the next packet | |
1210 | if ( *sequence_cnt < SEQ_CNT_MAX) |
|
1210 | if ( *sequence_cnt < SEQ_CNT_MAX) | |
1211 | { |
|
1211 | { | |
1212 | *sequence_cnt = *sequence_cnt + 1; |
|
1212 | *sequence_cnt = *sequence_cnt + 1; | |
1213 | } |
|
1213 | } | |
1214 | else |
|
1214 | else | |
1215 | { |
|
1215 | { | |
1216 | *sequence_cnt = 0; |
|
1216 | *sequence_cnt = 0; | |
1217 | } |
|
1217 | } | |
1218 |
|
1218 | |||
1219 | } |
|
1219 | } |
General Comments 0
You need to be logged in to leave comments.
Login now