##// END OF EJS Templates
All modes partially implemented...
paul@pc-solar1.lab-lpp.local -
r22:c4e2ba2dd2be default
parent child
Show More
@@ -1,225 +1,225
1 #############################################################################
1 #############################################################################
2 # Makefile for building: bin/fsw$(SW_VERSION)
2 # Makefile for building: bin/fsw-gsa
3 # Generated by qmake (2.01a) (Qt 4.8.4) on: Fri Jun 14 07:50:58 2013
3 # Generated by qmake (2.01a) (Qt 4.8.4) on: Tue Jun 18 14:00:55 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=4 -DPRINT_MESSAGES_ON_CONSOLE
13 DEFINES = -DSW_VERSION_N1=0 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=5 -DPRINT_MESSAGES_ON_CONSOLE -DGSA
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 OBJECTS = obj/wf_handler.o \
52 OBJECTS = obj/wf_handler.o \
53 obj/tc_handler.o \
53 obj/tc_handler.o \
54 obj/fsw_processing.o \
54 obj/fsw_processing.o \
55 obj/fsw_misc.o \
55 obj/fsw_misc.o \
56 obj/fsw_init.o \
56 obj/fsw_init.o \
57 obj/fsw_globals.o
57 obj/fsw_globals.o
58 DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \
58 DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \
59 /usr/lib64/qt4/mkspecs/common/linux.conf \
59 /usr/lib64/qt4/mkspecs/common/linux.conf \
60 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
60 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
61 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
61 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
62 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
62 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
63 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
63 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
64 /usr/lib64/qt4/mkspecs/qconfig.pri \
64 /usr/lib64/qt4/mkspecs/qconfig.pri \
65 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
65 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
66 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
66 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
67 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
67 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
68 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
68 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
69 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
69 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
70 sparc.pri \
70 sparc.pri \
71 /usr/lib64/qt4/mkspecs/features/release.prf \
71 /usr/lib64/qt4/mkspecs/features/release.prf \
72 /usr/lib64/qt4/mkspecs/features/default_post.prf \
72 /usr/lib64/qt4/mkspecs/features/default_post.prf \
73 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
73 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
74 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
74 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
75 /usr/lib64/qt4/mkspecs/features/resources.prf \
75 /usr/lib64/qt4/mkspecs/features/resources.prf \
76 /usr/lib64/qt4/mkspecs/features/uic.prf \
76 /usr/lib64/qt4/mkspecs/features/uic.prf \
77 /usr/lib64/qt4/mkspecs/features/yacc.prf \
77 /usr/lib64/qt4/mkspecs/features/yacc.prf \
78 /usr/lib64/qt4/mkspecs/features/lex.prf \
78 /usr/lib64/qt4/mkspecs/features/lex.prf \
79 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \
79 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \
80 fsw-qt.pro
80 fsw-qt.pro
81 QMAKE_TARGET = fsw$(SW_VERSION)
81 QMAKE_TARGET = fsw-gsa
82 DESTDIR = bin/
82 DESTDIR = bin/
83 TARGET = bin/fsw$(SW_VERSION)
83 TARGET = bin/fsw-gsa
84
84
85 first: all
85 first: all
86 ####### Implicit rules
86 ####### Implicit rules
87
87
88 .SUFFIXES: .o .c .cpp .cc .cxx .C
88 .SUFFIXES: .o .c .cpp .cc .cxx .C
89
89
90 .cpp.o:
90 .cpp.o:
91 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
91 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
92
92
93 .cc.o:
93 .cc.o:
94 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
94 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
95
95
96 .cxx.o:
96 .cxx.o:
97 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
97 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
98
98
99 .C.o:
99 .C.o:
100 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
100 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
101
101
102 .c.o:
102 .c.o:
103 $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
103 $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
104
104
105 ####### Build rules
105 ####### Build rules
106
106
107 all: Makefile $(TARGET)
107 all: Makefile $(TARGET)
108
108
109 $(TARGET): $(OBJECTS)
109 $(TARGET): $(OBJECTS)
110 @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/
110 @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/
111 $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
111 $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
112
112
113 Makefile: fsw-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \
113 Makefile: fsw-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \
114 /usr/lib64/qt4/mkspecs/common/linux.conf \
114 /usr/lib64/qt4/mkspecs/common/linux.conf \
115 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
115 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
116 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
116 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
117 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
117 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
118 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
118 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
119 /usr/lib64/qt4/mkspecs/qconfig.pri \
119 /usr/lib64/qt4/mkspecs/qconfig.pri \
120 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
120 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
121 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
121 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
122 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
122 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
123 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
123 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
124 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
124 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
125 sparc.pri \
125 sparc.pri \
126 /usr/lib64/qt4/mkspecs/features/release.prf \
126 /usr/lib64/qt4/mkspecs/features/release.prf \
127 /usr/lib64/qt4/mkspecs/features/default_post.prf \
127 /usr/lib64/qt4/mkspecs/features/default_post.prf \
128 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
128 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
129 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
129 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
130 /usr/lib64/qt4/mkspecs/features/resources.prf \
130 /usr/lib64/qt4/mkspecs/features/resources.prf \
131 /usr/lib64/qt4/mkspecs/features/uic.prf \
131 /usr/lib64/qt4/mkspecs/features/uic.prf \
132 /usr/lib64/qt4/mkspecs/features/yacc.prf \
132 /usr/lib64/qt4/mkspecs/features/yacc.prf \
133 /usr/lib64/qt4/mkspecs/features/lex.prf \
133 /usr/lib64/qt4/mkspecs/features/lex.prf \
134 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf
134 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf
135 $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
135 $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
136 /usr/lib64/qt4/mkspecs/common/unix.conf:
136 /usr/lib64/qt4/mkspecs/common/unix.conf:
137 /usr/lib64/qt4/mkspecs/common/linux.conf:
137 /usr/lib64/qt4/mkspecs/common/linux.conf:
138 /usr/lib64/qt4/mkspecs/common/gcc-base.conf:
138 /usr/lib64/qt4/mkspecs/common/gcc-base.conf:
139 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf:
139 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf:
140 /usr/lib64/qt4/mkspecs/common/g++-base.conf:
140 /usr/lib64/qt4/mkspecs/common/g++-base.conf:
141 /usr/lib64/qt4/mkspecs/common/g++-unix.conf:
141 /usr/lib64/qt4/mkspecs/common/g++-unix.conf:
142 /usr/lib64/qt4/mkspecs/qconfig.pri:
142 /usr/lib64/qt4/mkspecs/qconfig.pri:
143 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri:
143 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri:
144 /usr/lib64/qt4/mkspecs/features/qt_functions.prf:
144 /usr/lib64/qt4/mkspecs/features/qt_functions.prf:
145 /usr/lib64/qt4/mkspecs/features/qt_config.prf:
145 /usr/lib64/qt4/mkspecs/features/qt_config.prf:
146 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf:
146 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf:
147 /usr/lib64/qt4/mkspecs/features/default_pre.prf:
147 /usr/lib64/qt4/mkspecs/features/default_pre.prf:
148 sparc.pri:
148 sparc.pri:
149 /usr/lib64/qt4/mkspecs/features/release.prf:
149 /usr/lib64/qt4/mkspecs/features/release.prf:
150 /usr/lib64/qt4/mkspecs/features/default_post.prf:
150 /usr/lib64/qt4/mkspecs/features/default_post.prf:
151 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf:
151 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf:
152 /usr/lib64/qt4/mkspecs/features/warn_on.prf:
152 /usr/lib64/qt4/mkspecs/features/warn_on.prf:
153 /usr/lib64/qt4/mkspecs/features/resources.prf:
153 /usr/lib64/qt4/mkspecs/features/resources.prf:
154 /usr/lib64/qt4/mkspecs/features/uic.prf:
154 /usr/lib64/qt4/mkspecs/features/uic.prf:
155 /usr/lib64/qt4/mkspecs/features/yacc.prf:
155 /usr/lib64/qt4/mkspecs/features/yacc.prf:
156 /usr/lib64/qt4/mkspecs/features/lex.prf:
156 /usr/lib64/qt4/mkspecs/features/lex.prf:
157 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf:
157 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf:
158 qmake: FORCE
158 qmake: FORCE
159 @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
159 @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
160
160
161 dist:
161 dist:
162 @$(CHK_DIR_EXISTS) obj/fsw$(SW_VERSION)1.0.0 || $(MKDIR) obj/fsw$(SW_VERSION)1.0.0
162 @$(CHK_DIR_EXISTS) obj/fsw-gsa1.0.0 || $(MKDIR) obj/fsw-gsa1.0.0
163 $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/fsw$(SW_VERSION)1.0.0/ && (cd `dirname obj/fsw$(SW_VERSION)1.0.0` && $(TAR) fsw$(SW_VERSION)1.0.0.tar fsw$(SW_VERSION)1.0.0 && $(COMPRESS) fsw$(SW_VERSION)1.0.0.tar) && $(MOVE) `dirname obj/fsw$(SW_VERSION)1.0.0`/fsw$(SW_VERSION)1.0.0.tar.gz . && $(DEL_FILE) -r obj/fsw$(SW_VERSION)1.0.0
163 $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/fsw-gsa1.0.0/ && (cd `dirname obj/fsw-gsa1.0.0` && $(TAR) fsw-gsa1.0.0.tar fsw-gsa1.0.0 && $(COMPRESS) fsw-gsa1.0.0.tar) && $(MOVE) `dirname obj/fsw-gsa1.0.0`/fsw-gsa1.0.0.tar.gz . && $(DEL_FILE) -r obj/fsw-gsa1.0.0
164
164
165
165
166 clean:compiler_clean
166 clean:compiler_clean
167 -$(DEL_FILE) $(OBJECTS)
167 -$(DEL_FILE) $(OBJECTS)
168 -$(DEL_FILE) *~ core *.core
168 -$(DEL_FILE) *~ core *.core
169
169
170
170
171 ####### Sub-libraries
171 ####### Sub-libraries
172
172
173 distclean: clean
173 distclean: clean
174 -$(DEL_FILE) $(TARGET)
174 -$(DEL_FILE) $(TARGET)
175 -$(DEL_FILE) Makefile
175 -$(DEL_FILE) Makefile
176
176
177
177
178 grmon:
178 grmon:
179 cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u
179 cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u
180
180
181 check: first
181 check: first
182
182
183 compiler_rcc_make_all:
183 compiler_rcc_make_all:
184 compiler_rcc_clean:
184 compiler_rcc_clean:
185 compiler_uic_make_all:
185 compiler_uic_make_all:
186 compiler_uic_clean:
186 compiler_uic_clean:
187 compiler_image_collection_make_all: qmake_image_collection.cpp
187 compiler_image_collection_make_all: qmake_image_collection.cpp
188 compiler_image_collection_clean:
188 compiler_image_collection_clean:
189 -$(DEL_FILE) qmake_image_collection.cpp
189 -$(DEL_FILE) qmake_image_collection.cpp
190 compiler_yacc_decl_make_all:
190 compiler_yacc_decl_make_all:
191 compiler_yacc_decl_clean:
191 compiler_yacc_decl_clean:
192 compiler_yacc_impl_make_all:
192 compiler_yacc_impl_make_all:
193 compiler_yacc_impl_clean:
193 compiler_yacc_impl_clean:
194 compiler_lex_make_all:
194 compiler_lex_make_all:
195 compiler_lex_clean:
195 compiler_lex_clean:
196 compiler_clean:
196 compiler_clean:
197
197
198 ####### Compile
198 ####### Compile
199
199
200 obj/wf_handler.o: ../src/wf_handler.c
200 obj/wf_handler.o: ../src/wf_handler.c
201 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/wf_handler.o ../src/wf_handler.c
201 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/wf_handler.o ../src/wf_handler.c
202
202
203 obj/tc_handler.o: ../src/tc_handler.c
203 obj/tc_handler.o: ../src/tc_handler.c
204 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o ../src/tc_handler.c
204 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o ../src/tc_handler.c
205
205
206 obj/fsw_processing.o: ../src/fsw_processing.c
206 obj/fsw_processing.o: ../src/fsw_processing.c
207 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/fsw_processing.c
207 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/fsw_processing.c
208
208
209 obj/fsw_misc.o: ../src/fsw_misc.c
209 obj/fsw_misc.o: ../src/fsw_misc.c
210 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c
210 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c
211
211
212 obj/fsw_init.o: ../src/fsw_init.c
212 obj/fsw_init.o: ../src/fsw_init.c
213 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o ../src/fsw_init.c
213 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o ../src/fsw_init.c
214
214
215 obj/fsw_globals.o: ../src/fsw_globals.c
215 obj/fsw_globals.o: ../src/fsw_globals.c
216 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c
216 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c
217
217
218 ####### Install
218 ####### Install
219
219
220 install: FORCE
220 install: FORCE
221
221
222 uninstall: FORCE
222 uninstall: FORCE
223
223
224 FORCE:
224 FORCE:
225
225
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
@@ -1,51 +1,51
1 TEMPLATE = app
1 TEMPLATE = app
2 # CONFIG += console v8 sim
2 # CONFIG += console v8 sim
3 # CONFIG options = verbose *** cpu_usage_report *** gsa
3 # CONFIG options = verbose *** cpu_usage_report *** gsa
4 CONFIG += console verbose
4 CONFIG += console verbose gsa
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 SW_VERSION=-0-5
10 SWVERSION=-0-5
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=5
14 DEFINES += SW_VERSION_N4=5
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, cpu_usage_report ) {
20 contains( CONFIG, cpu_usage_report ) {
21 DEFINES += PRINT_TASK_STATISTICS
21 DEFINES += PRINT_TASK_STATISTICS
22 }
22 }
23
23
24 TARGET = fsw$(SW_VERSION)
24 TARGET = fsw
25 contains( CONFIG, gsa ) {
25 contains( CONFIG, gsa ) {
26 DEFINES += GSA
26 DEFINES += GSA
27 TARGET = fsw-gsa$(SW_VERSION)
27 TARGET = fsw-gsa
28 }
28 }
29
29
30 INCLUDEPATH += \
30 INCLUDEPATH += \
31 ../src \
31 ../src \
32 ../header
32 ../header
33
33
34 SOURCES += \
34 SOURCES += \
35 ../src/wf_handler.c \
35 ../src/wf_handler.c \
36 ../src/tc_handler.c \
36 ../src/tc_handler.c \
37 ../src/fsw_processing.c \
37 ../src/fsw_processing.c \
38 ../src/fsw_misc.c \
38 ../src/fsw_misc.c \
39 ../src/fsw_init.c \
39 ../src/fsw_init.c \
40 ../src/fsw_globals.c
40 ../src/fsw_globals.c
41
41
42 HEADERS += \
42 HEADERS += \
43 ../header/wf_handler.h \
43 ../header/wf_handler.h \
44 ../header/tc_handler.h \
44 ../header/tc_handler.h \
45 ../header/grlib_regs.h \
45 ../header/grlib_regs.h \
46 ../header/fsw_processing.h \
46 ../header/fsw_processing.h \
47 ../header/fsw_params.h \
47 ../header/fsw_params.h \
48 ../header/fsw_misc.h \
48 ../header/fsw_misc.h \
49 ../header/fsw_init.h \
49 ../header/fsw_init.h \
50 ../header/ccsds_types.h
50 ../header/ccsds_types.h
51
51
@@ -1,265 +1,265
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 Qt Creator 2.4.1, 2013-06-17T15:56:28. -->
3 <!-- Written by Qt Creator 2.4.1, 2013-06-18T14:38:28. -->
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 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
14 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
15 <value type="QString" key="language">Cpp</value>
15 <value type="QString" key="language">Cpp</value>
16 <valuemap type="QVariantMap" key="value">
16 <valuemap type="QVariantMap" key="value">
17 <value type="QString" key="CurrentPreferences">CppGlobal</value>
17 <value type="QString" key="CurrentPreferences">CppGlobal</value>
18 </valuemap>
18 </valuemap>
19 </valuemap>
19 </valuemap>
20 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
20 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
21 <value type="QString" key="language">QmlJS</value>
21 <value type="QString" key="language">QmlJS</value>
22 <valuemap type="QVariantMap" key="value">
22 <valuemap type="QVariantMap" key="value">
23 <value type="QString" key="CurrentPreferences">QmlJSGlobal</value>
23 <value type="QString" key="CurrentPreferences">QmlJSGlobal</value>
24 </valuemap>
24 </valuemap>
25 </valuemap>
25 </valuemap>
26 <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
26 <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
27 <value type="QByteArray" key="EditorConfiguration.Codec">System</value>
27 <value type="QByteArray" key="EditorConfiguration.Codec">System</value>
28 <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
28 <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
29 <value type="int" key="EditorConfiguration.IndentSize">4</value>
29 <value type="int" key="EditorConfiguration.IndentSize">4</value>
30 <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
30 <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
31 <value type="int" key="EditorConfiguration.PaddingMode">1</value>
31 <value type="int" key="EditorConfiguration.PaddingMode">1</value>
32 <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
32 <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
33 <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
33 <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
34 <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
34 <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
35 <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
35 <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
36 <value type="int" key="EditorConfiguration.TabSize">8</value>
36 <value type="int" key="EditorConfiguration.TabSize">8</value>
37 <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
37 <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
38 <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
38 <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
39 <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
39 <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
40 <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
40 <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
41 <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
41 <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
42 <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
42 <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
43 </valuemap>
43 </valuemap>
44 </data>
44 </data>
45 <data>
45 <data>
46 <variable>ProjectExplorer.Project.PluginSettings</variable>
46 <variable>ProjectExplorer.Project.PluginSettings</variable>
47 <valuemap type="QVariantMap"/>
47 <valuemap type="QVariantMap"/>
48 </data>
48 </data>
49 <data>
49 <data>
50 <variable>ProjectExplorer.Project.Target.0</variable>
50 <variable>ProjectExplorer.Project.Target.0</variable>
51 <valuemap type="QVariantMap">
51 <valuemap type="QVariantMap">
52 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
52 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
53 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
53 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
54 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Target.DesktopTarget</value>
54 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Target.DesktopTarget</value>
55 <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
55 <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
56 <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
56 <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
57 <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
57 <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
58 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
58 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
59 <value type="QString" key="ProjectExplorer.BuildCOnfiguration.ToolChain">ProjectExplorer.ToolChain.Gcc:/usr/bin/g++.x86-linux-generic-elf-64bit./usr/bin/gdb</value>
59 <value type="QString" key="ProjectExplorer.BuildCOnfiguration.ToolChain">ProjectExplorer.ToolChain.Gcc:/usr/bin/g++.x86-linux-generic-elf-64bit./usr/bin/gdb</value>
60 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
60 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
61 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
61 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
62 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
62 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
63 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
63 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
64 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
64 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
65 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
65 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
66 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
66 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
67 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
67 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
68 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
68 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
69 </valuemap>
69 </valuemap>
70 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
70 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
71 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
71 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
72 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
72 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
73 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
73 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
74 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
74 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
75 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
75 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
76 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
76 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
77 </valuemap>
77 </valuemap>
78 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
78 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
79 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
79 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
80 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
80 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
81 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
81 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
82 </valuemap>
82 </valuemap>
83 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
83 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
84 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
84 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
85 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
85 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
86 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
86 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
87 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
87 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
88 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
88 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
89 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
89 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
90 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
90 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
91 </valuemap>
91 </valuemap>
92 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
92 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
93 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
93 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</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">ProjectExplorer.BuildSteps.Clean</value>
95 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
96 </valuemap>
96 </valuemap>
97 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
97 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
98 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
98 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
99 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
99 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
100 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 4.8.2 in PATH (System) Release</value>
100 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 4.8.2 in PATH (System) Release</value>
101 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
101 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
102 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
102 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
103 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
103 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
104 <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/DEV_PLE/FSW-qt</value>
104 <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/DEV_PLE/FSW-qt</value>
105 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId">1</value>
105 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId">1</value>
106 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value>
106 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value>
107 </valuemap>
107 </valuemap>
108 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
108 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
109 <value type="QString" key="ProjectExplorer.BuildCOnfiguration.ToolChain">ProjectExplorer.ToolChain.Gcc:/usr/bin/g++.x86-linux-generic-elf-64bit./usr/bin/gdb</value>
109 <value type="QString" key="ProjectExplorer.BuildCOnfiguration.ToolChain">ProjectExplorer.ToolChain.Gcc:/usr/bin/g++.x86-linux-generic-elf-64bit./usr/bin/gdb</value>
110 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
110 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
111 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
111 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
112 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
112 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</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">QtProjectManager.QMakeBuildStep</value>
114 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
115 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
115 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
116 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
116 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
117 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
117 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
118 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
118 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
119 </valuemap>
119 </valuemap>
120 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
120 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
121 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
121 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
122 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
122 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
123 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
123 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
124 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
124 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
125 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
125 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
126 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
126 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
127 </valuemap>
127 </valuemap>
128 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
128 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
129 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
129 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
130 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
130 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
131 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
131 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
132 </valuemap>
132 </valuemap>
133 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
133 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
134 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
134 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
135 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
135 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
136 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
136 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
137 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
137 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
138 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
138 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
139 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
139 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
140 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
140 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
141 </valuemap>
141 </valuemap>
142 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
142 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
143 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
143 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
144 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
144 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
145 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
145 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
146 </valuemap>
146 </valuemap>
147 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
147 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
148 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
148 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
149 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
149 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
150 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 4.8.2 in PATH (System) Debug</value>
150 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 4.8.2 in PATH (System) Debug</value>
151 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
151 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
152 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
152 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
153 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
153 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
154 <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/DEV_PLE/FSW-qt</value>
154 <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/DEV_PLE/FSW-qt</value>
155 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId">1</value>
155 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId">1</value>
156 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value>
156 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value>
157 </valuemap>
157 </valuemap>
158 <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
158 <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
159 <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
159 <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
160 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
160 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
161 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
161 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
162 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
162 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
163 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
163 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
164 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
164 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
165 </valuemap>
165 </valuemap>
166 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
166 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
167 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">No deployment</value>
167 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">No deployment</value>
168 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
168 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
169 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
169 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
170 </valuemap>
170 </valuemap>
171 <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
171 <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
172 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
172 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
173 <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
173 <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
174 <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
174 <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
175 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
175 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
176 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
176 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
177 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
177 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
178 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
178 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
179 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
179 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
180 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
180 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
181 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
181 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
182 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
182 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
183 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
183 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
184 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
184 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
185 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
185 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
186 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
186 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
187 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
187 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
188 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
188 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
189 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
189 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
190 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
190 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
191 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
191 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
192 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
192 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
193 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
193 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
194 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
194 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
195 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
195 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
196 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
196 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
197 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
197 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
198 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
198 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
199 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
199 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
200 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
200 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
201 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
201 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
202 <value type="int">0</value>
202 <value type="int">0</value>
203 <value type="int">1</value>
203 <value type="int">1</value>
204 <value type="int">2</value>
204 <value type="int">2</value>
205 <value type="int">3</value>
205 <value type="int">3</value>
206 <value type="int">4</value>
206 <value type="int">4</value>
207 <value type="int">5</value>
207 <value type="int">5</value>
208 <value type="int">6</value>
208 <value type="int">6</value>
209 <value type="int">7</value>
209 <value type="int">7</value>
210 <value type="int">8</value>
210 <value type="int">8</value>
211 <value type="int">9</value>
211 <value type="int">9</value>
212 <value type="int">10</value>
212 <value type="int">10</value>
213 <value type="int">11</value>
213 <value type="int">11</value>
214 <value type="int">12</value>
214 <value type="int">12</value>
215 <value type="int">13</value>
215 <value type="int">13</value>
216 <value type="int">14</value>
216 <value type="int">14</value>
217 </valuelist>
217 </valuelist>
218 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
218 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
219 <value type="int">0</value>
219 <value type="int">0</value>
220 <value type="int">1</value>
220 <value type="int">1</value>
221 <value type="int">2</value>
221 <value type="int">2</value>
222 <value type="int">3</value>
222 <value type="int">3</value>
223 <value type="int">4</value>
223 <value type="int">4</value>
224 <value type="int">5</value>
224 <value type="int">5</value>
225 <value type="int">6</value>
225 <value type="int">6</value>
226 <value type="int">7</value>
226 <value type="int">7</value>
227 <value type="int">8</value>
227 <value type="int">8</value>
228 <value type="int">9</value>
228 <value type="int">9</value>
229 <value type="int">10</value>
229 <value type="int">10</value>
230 <value type="int">11</value>
230 <value type="int">11</value>
231 <value type="int">12</value>
231 <value type="int">12</value>
232 <value type="int">13</value>
232 <value type="int">13</value>
233 <value type="int">14</value>
233 <value type="int">14</value>
234 </valuelist>
234 </valuelist>
235 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value>
235 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value>
236 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
236 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
237 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration</value>
237 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration</value>
238 <value type="int" key="Qt4ProjectManager.Qt4RunConfiguration.BaseEnvironmentBase">2</value>
238 <value type="int" key="Qt4ProjectManager.Qt4RunConfiguration.BaseEnvironmentBase">2</value>
239 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
239 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
240 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value>
240 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value>
241 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
241 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
242 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>
242 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>
243 <valuelist type="QVariantList" key="Qt4ProjectManager.Qt4RunConfiguration.UserEnvironmentChanges"/>
243 <valuelist type="QVariantList" key="Qt4ProjectManager.Qt4RunConfiguration.UserEnvironmentChanges"/>
244 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
244 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
245 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
245 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
246 <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
246 <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
247 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
247 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
248 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">false</value>
248 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">false</value>
249 </valuemap>
249 </valuemap>
250 <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
250 <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
251 </valuemap>
251 </valuemap>
252 </data>
252 </data>
253 <data>
253 <data>
254 <variable>ProjectExplorer.Project.TargetCount</variable>
254 <variable>ProjectExplorer.Project.TargetCount</variable>
255 <value type="int">1</value>
255 <value type="int">1</value>
256 </data>
256 </data>
257 <data>
257 <data>
258 <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
258 <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
259 <value type="QString">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value>
259 <value type="QString">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value>
260 </data>
260 </data>
261 <data>
261 <data>
262 <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
262 <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
263 <value type="int">10</value>
263 <value type="int">10</value>
264 </data>
264 </data>
265 </qtcreator>
265 </qtcreator>
@@ -1,77 +1,76
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 <bsp.h> // for the LEON_Unmask_interrupt function
5 #include <bsp.h> // for the LEON_Unmask_interrupt function
6 #include <stdio.h>
6 #include <stdio.h>
7 #include <unistd.h> // for the read call
7 #include <unistd.h> // for the read call
8 #include <sys/ioctl.h> // for the ioctl call
8 #include <sys/ioctl.h> // for the ioctl call
9 #include <ccsds_types.h>
9 #include <ccsds_types.h>
10 #include <grspw.h>
10 #include <grspw.h>
11 #include <fsw_init.h>
11 #include <fsw_init.h>
12
12
13 extern int fdSPW;
13 extern int fdSPW;
14 extern rtems_name misc_name[ ];
14 extern rtems_name misc_name[ ];
15 extern rtems_name misc_id[ ];
15 extern rtems_name misc_id[ ];
16 extern rtems_id Task_id[ ]; // array of task ids
16 extern rtems_id Task_id[ ]; // array of task ids
17 // MODE PARAMETERS
17 // MODE PARAMETERS
18 extern struct param_common_str param_common;
18 extern struct param_common_str param_common;
19 extern struct param_norm_str param_norm;
19 extern struct param_norm_str param_norm;
20 extern struct param_sbm1_str param_sbm1;
20 extern struct param_sbm1_str param_sbm1;
21 extern struct param_sbm2_str param_sbm2;
21 extern struct param_sbm2_str param_sbm2;
22 extern Packet_TM_LFR_HK_t housekeeping_packet;
22 extern Packet_TM_LFR_HK_t housekeeping_packet;
23 extern time_management_regs_t *time_management_regs;
23 extern time_management_regs_t *time_management_regs;
24 extern waveform_picker_regs_t *waveform_picker_regs;
24 extern waveform_picker_regs_t *waveform_picker_regs;
25 extern gptimer_regs_t *gptimer_regs;
25 extern gptimer_regs_t *gptimer_regs;
26
26
27 //****
27 //****
28 // ISR
28 // ISR
29 rtems_isr commutation_isr1( rtems_vector_number vector );
29 rtems_isr commutation_isr1( rtems_vector_number vector );
30 rtems_isr commutation_isr2( rtems_vector_number vector );
30 rtems_isr commutation_isr2( rtems_vector_number vector );
31
31
32 //**********************
32 //**********************
33 // GENERAL USE FUNCTIONS
33 // GENERAL USE FUNCTIONS
34 void initLookUpTableForCRC( void );
34 void initLookUpTableForCRC( void );
35 void GetCRCAsTwoBytes(unsigned char* data, unsigned char* crcAsTwoBytes, unsigned int sizeOfData);
35 void GetCRCAsTwoBytes(unsigned char* data, unsigned char* crcAsTwoBytes, unsigned int sizeOfData);
36
36
37 //*********************
37 //*********************
38 // ACCEPTANCE FUNCTIONS
38 // ACCEPTANCE FUNCTIONS
39 unsigned char acceptTM(ccsdsTelecommandPacket_t * TMPacket, unsigned int tc_len_recv);
39 unsigned char acceptTM(ccsdsTelecommandPacket_t * TMPacket, unsigned int tc_len_recv);
40
40
41 unsigned char TM_build_header( enum TM_TYPE tm_type, unsigned int packetLength,
41 unsigned char TM_build_header( enum TM_TYPE tm_type, unsigned int packetLength,
42 unsigned int coarseTime, unsigned int fineTime, TMHeader_t *TMHeader);
42 unsigned int coarseTime, unsigned int fineTime, TMHeader_t *TMHeader);
43 unsigned char TM_build_data(ccsdsTelecommandPacket_t *TC, char* data, unsigned int SID, unsigned char *computed_CRC);
43 unsigned char TM_build_data(ccsdsTelecommandPacket_t *TC, char* data, unsigned int SID, unsigned char *computed_CRC);
44 int TC_checker(ccsdsTelecommandPacket_t *TC, unsigned int TC_LEN_RCV);
44 int TC_checker(ccsdsTelecommandPacket_t *TC, unsigned int TC_LEN_RCV);
45
45
46 //***********
46 //***********
47 // RTEMS TASK
47 // RTEMS TASK
48 rtems_task recv_task( rtems_task_argument unused );
48 rtems_task recv_task( rtems_task_argument unused );
49 rtems_task actn_task( rtems_task_argument unused );
49 rtems_task actn_task( rtems_task_argument unused );
50 rtems_task dumb_task( rtems_task_argument unused );
50 rtems_task dumb_task( rtems_task_argument unused );
51 int create_message_queue( void );
51 int create_message_queue( void );
52
52
53 //***********
53 //***********
54 // TC ACTIONS
54 // TC ACTIONS
55 int action_default(ccsdsTelecommandPacket_t *TC);
55 int action_default(ccsdsTelecommandPacket_t *TC);
56 int action_default_alt(ccsdsTelecommandPacket_t *TC);
56 int action_default_alt(ccsdsTelecommandPacket_t *TC);
57 int send_tm_lfr_tc_exe_success(ccsdsTelecommandPacket_t *TC);
57 int send_tm_lfr_tc_exe_success(ccsdsTelecommandPacket_t *TC);
58 //
58 //
59 int stop_current_mode();
59 int stop_current_mode();
60 int enter_normal_mode();
60 int enter_normal_mode();
61 int enter_burst_mode();
61 int enter_sbm1_mode();
62 int enter_sbm1_mode();
63 int enter_sbm2_mode();
62 int action_load_comm(ccsdsTelecommandPacket_t *TC);
64 int action_load_comm(ccsdsTelecommandPacket_t *TC);
63 int action_load_norm(ccsdsTelecommandPacket_t *TC);
65 int action_load_norm(ccsdsTelecommandPacket_t *TC);
64 int action_enter(ccsdsTelecommandPacket_t *TC);
66 int action_enter(ccsdsTelecommandPacket_t *TC);
65 int action_updt_time(ccsdsTelecommandPacket_t *TC);
67 int action_updt_time(ccsdsTelecommandPacket_t *TC);
66 //
68 //
67 void update_last_TC_exe(ccsdsTelecommandPacket_t *TC);
69 void update_last_TC_exe(ccsdsTelecommandPacket_t *TC);
68 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC);
70 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC);
69 void close_action(ccsdsTelecommandPacket_t *TC, int result);
71 void close_action(ccsdsTelecommandPacket_t *TC, int result);
70 //
71 rtems_status_code restart_if_needed(rtems_id id);
72 rtems_status_code suspend_if_needed(rtems_id id);
73
72
74 #endif // TC_HANDLER_H_INCLUDED
73 #endif // TC_HANDLER_H_INCLUDED
75
74
76
75
77
76
@@ -1,40 +1,40
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 <fsw_params.h>
5 #include <fsw_params.h>
6 #include <grspw.h>
6 #include <grspw.h>
7 #include <grlib_regs.h>
7 #include <grlib_regs.h>
8 #include <ccsds_types.h>
8 #include <ccsds_types.h>
9 #include <stdio.h>
9 #include <stdio.h>
10 #include <fsw_init.h>
10 #include <fsw_init.h>
11 #include <math.h>
11 #include <math.h>
12
12
13 #define pi 3.1415
13 #define pi 3.1415
14
14
15 //#include <sys/ioctl.h>
15 //#include <sys/ioctl.h>
16
16
17 extern rtems_id Task_id[]; /* array of task ids */
17 extern rtems_id Task_id[]; /* array of task ids */
18 extern int fdSPW;
18 extern int fdSPW;
19 extern volatile int wf_snap_f0[ ];
19 extern volatile int wf_snap_f0[ ];
20 extern volatile int wf_snap_f1[ ];
20 extern volatile int wf_snap_f1[ ];
21 extern volatile int wf_snap_f1_bis[ ];
21 extern volatile int wf_snap_f1_bis[ ];
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_cont_f3[ ];
24 extern volatile int wf_cont_f3[ ];
24 extern waveform_picker_regs_t *waveform_picker_regs;
25 extern waveform_picker_regs_t *waveform_picker_regs;
25
26
26 rtems_isr waveforms_isr( rtems_vector_number vector );
27 rtems_isr waveforms_isr( rtems_vector_number vector );
27 rtems_isr waveforms_isr_alternative( rtems_vector_number vector );
28 rtems_isr waveforms_simulator_isr( rtems_vector_number vector );
28 rtems_isr waveforms_simulator_isr( rtems_vector_number vector );
29 rtems_task wfrm_task(rtems_task_argument argument);
29 rtems_task wfrm_task(rtems_task_argument argument);
30
30
31 //******************
31 //******************
32 // general functions
32 // general functions
33 void init_waveforms( void );
33 void init_waveforms( void );
34 void reset_waveforms( void );
34 void reset_waveforms( void );
35 void send_waveform( ExtendedTMHeader_t *header, volatile int *waveform, unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send);
35 void send_waveform( ExtendedTMHeader_t *header, volatile int *waveform, unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send);
36 void init_waveform_picker_regs();
36 void init_waveform_picker_regs();
37 void set_data_shaping_parameters(unsigned char parameters);
37 void set_data_shaping_parameters(unsigned char parameters);
38 int build_value(int value1, int value0);
38 int build_value(int value1, int value0);
39
39
40 #endif // WF_HANDLER_H_INCLUDED
40 #endif // WF_HANDLER_H_INCLUDED
@@ -1,54 +1,55
1 #include <fsw_processing.h>
1 #include <fsw_processing.h>
2 #include <rtems.h>
2 #include <rtems.h>
3 #include <ccsds_types.h>
3 #include <ccsds_types.h>
4
4
5 // RTEMS GLOBAL VARIABLES
5 // RTEMS GLOBAL VARIABLES
6 rtems_name misc_name[5];
6 rtems_name misc_name[5];
7 rtems_name misc_id[5];
7 rtems_name misc_id[5];
8 rtems_id Task_id[15]; /* array of task ids */
8 rtems_id Task_id[15]; /* array of task ids */
9 rtems_name Task_name[15]; /* array of task names */
9 rtems_name Task_name[15]; /* array of task names */
10 int fdSPW = 0;
10 int fdSPW = 0;
11 int fdUART = 0;
11 int fdUART = 0;
12
12
13 spectral_matrices_regs_t *spectral_matrices_regs = NULL;
13 spectral_matrices_regs_t *spectral_matrices_regs = NULL;
14
14
15 // APB CONFIGURATION REGISTERS
15 // APB CONFIGURATION REGISTERS
16 time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT;
16 time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT;
17 waveform_picker_regs_t *waveform_picker_regs = (waveform_picker_regs_t*) REGS_ADDR_WAVEFORM_PICKER;
17 waveform_picker_regs_t *waveform_picker_regs = (waveform_picker_regs_t*) REGS_ADDR_WAVEFORM_PICKER;
18 gptimer_regs_t *gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER;
18 gptimer_regs_t *gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER;
19
19
20 // WAVEFORMS GLOBAL VARIABLES // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes
20 // WAVEFORMS GLOBAL VARIABLES // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes
21 volatile int wf_snap_f0[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET];
21 volatile int wf_snap_f0[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET];
22 volatile int wf_snap_f1[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET];
22 volatile int wf_snap_f1[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET];
23 volatile int wf_snap_f1_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET];
23 volatile int wf_snap_f1_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET];
24 volatile int wf_snap_f2[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET];
24 volatile int wf_snap_f2[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET];
25 volatile int wf_snap_f2_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET];
25 volatile int wf_cont_f3[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET];
26 volatile int wf_cont_f3[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET];
26
27
27 // SPECTRAL MATRICES GLOBAL VARIABLES
28 // SPECTRAL MATRICES GLOBAL VARIABLES
28 volatile int spec_mat_f0_a[ TOTAL_SIZE_SPEC_MAT ];
29 volatile int spec_mat_f0_a[ TOTAL_SIZE_SPEC_MAT ];
29 volatile int spec_mat_f0_b[ TOTAL_SIZE_SPEC_MAT ];
30 volatile int spec_mat_f0_b[ TOTAL_SIZE_SPEC_MAT ];
30 volatile int spec_mat_f0_c[ TOTAL_SIZE_SPEC_MAT ];
31 volatile int spec_mat_f0_c[ TOTAL_SIZE_SPEC_MAT ];
31 volatile int spec_mat_f0_d[ TOTAL_SIZE_SPEC_MAT ];
32 volatile int spec_mat_f0_d[ TOTAL_SIZE_SPEC_MAT ];
32 volatile int spec_mat_f0_e[ TOTAL_SIZE_SPEC_MAT ];
33 volatile int spec_mat_f0_e[ TOTAL_SIZE_SPEC_MAT ];
33 volatile int spec_mat_f0_f[ TOTAL_SIZE_SPEC_MAT ];
34 volatile int spec_mat_f0_f[ TOTAL_SIZE_SPEC_MAT ];
34 volatile int spec_mat_f0_g[ TOTAL_SIZE_SPEC_MAT ];
35 volatile int spec_mat_f0_g[ TOTAL_SIZE_SPEC_MAT ];
35 volatile int spec_mat_f0_h[ TOTAL_SIZE_SPEC_MAT ];
36 volatile int spec_mat_f0_h[ TOTAL_SIZE_SPEC_MAT ];
36 //
37 //
37 float averaged_spec_mat_f0[ TOTAL_SIZE_SPEC_MAT ];
38 float averaged_spec_mat_f0[ TOTAL_SIZE_SPEC_MAT ];
38 float compressed_spec_mat_f0[ TOTAL_SIZE_COMPRESSED_MATRIX_f0 ];
39 float compressed_spec_mat_f0[ TOTAL_SIZE_COMPRESSED_MATRIX_f0 ];
39
40
40 // MODE PARAMETERS
41 // MODE PARAMETERS
41 struct param_common_str param_common;
42 struct param_common_str param_common;
42 struct param_norm_str param_norm;
43 struct param_norm_str param_norm;
43 struct param_burst_str param_burst;
44 struct param_burst_str param_burst;
44 struct param_sbm1_str param_sbm1;
45 struct param_sbm1_str param_sbm1;
45 struct param_sbm2_str param_sbm2;
46 struct param_sbm2_str param_sbm2;
46
47
47 // HK PACKETS
48 // HK PACKETS
48 Packet_TM_LFR_HK_t housekeeping_packet;
49 Packet_TM_LFR_HK_t housekeeping_packet;
49 unsigned short sequenceCounters[SEQ_CNT_NB_PID][SEQ_CNT_NB_CAT][SEQ_CNT_NB_DEST_ID];
50 unsigned short sequenceCounters[SEQ_CNT_NB_PID][SEQ_CNT_NB_CAT][SEQ_CNT_NB_DEST_ID];
50
51
51 // BASIC PARAMETERS GLOBAL VARIABLES
52 // BASIC PARAMETERS GLOBAL VARIABLES
52 unsigned char LFR_BP1_F0[ NB_BINS_COMPRESSED_MATRIX_f0 * 9 ];
53 unsigned char LFR_BP1_F0[ NB_BINS_COMPRESSED_MATRIX_f0 * 9 ];
53 BP1_t data_BP1[ NB_BINS_COMPRESSED_MATRIX_f0 ];
54 BP1_t data_BP1[ NB_BINS_COMPRESSED_MATRIX_f0 ];
54
55
@@ -1,448 +1,449
1 //*************************
1 //*************************
2 // GPL reminder to be added
2 // GPL reminder to be added
3 //*************************
3 //*************************
4
4
5 #include <rtems.h>
5 #include <rtems.h>
6
6
7 /* configuration information */
7 /* configuration information */
8
8
9 #define CONFIGURE_INIT
9 #define CONFIGURE_INIT
10
10
11 #include <bsp.h> /* for device driver prototypes */
11 #include <bsp.h> /* for device driver prototypes */
12
12
13 /* configuration information */
13 /* configuration information */
14
14
15 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
15 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
16 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
16 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
17
17
18 #define CONFIGURE_MAXIMUM_TASKS 15
18 #define CONFIGURE_MAXIMUM_TASKS 15
19 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
19 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
20 #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE)
20 #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE)
21 #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32
21 #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32
22 #define CONFIGURE_INIT_TASK_PRIORITY 100
22 #define CONFIGURE_INIT_TASK_PRIORITY 100
23 #define CONFIGURE_MAXIMUM_DRIVERS 16
23 #define CONFIGURE_MAXIMUM_DRIVERS 16
24 #define CONFIGURE_MAXIMUM_PERIODS 5
24 #define CONFIGURE_MAXIMUM_PERIODS 5
25 #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
25 #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
26
26
27 #include <rtems/confdefs.h>
27 #include <rtems/confdefs.h>
28
28
29 /* If --drvmgr was enabled during the configuration of the RTEMS kernel */
29 /* If --drvmgr was enabled during the configuration of the RTEMS kernel */
30 #ifdef RTEMS_DRVMGR_STARTUP
30 #ifdef RTEMS_DRVMGR_STARTUP
31 #ifdef LEON3
31 #ifdef LEON3
32 /* Add Timer and UART Driver */
32 /* Add Timer and UART Driver */
33 #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
33 #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
34 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER
34 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER
35 #endif
35 #endif
36 #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
36 #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
37 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART
37 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART
38 #endif
38 #endif
39 #endif
39 #endif
40 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */
40 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */
41 #include <drvmgr/drvmgr_confdefs.h>
41 #include <drvmgr/drvmgr_confdefs.h>
42 #endif
42 #endif
43
43
44 #include <fsw_init.h>
44 #include <fsw_init.h>
45 #include <fsw_config.c>
45 #include <fsw_config.c>
46
46
47 char *lstates[6] = {"Error-reset",
47 char *lstates[6] = {"Error-reset",
48 "Error-wait",
48 "Error-wait",
49 "Ready",
49 "Ready",
50 "Started",
50 "Started",
51 "Connecting",
51 "Connecting",
52 "Run"
52 "Run"
53 };
53 };
54
54
55 rtems_task Init( rtems_task_argument ignored )
55 rtems_task Init( rtems_task_argument ignored )
56 {
56 {
57 rtems_status_code status;
57 rtems_status_code status;
58 rtems_isr_entry old_isr_handler;
58 rtems_isr_entry old_isr_handler;
59
59
60 PRINTF("\n\n\n\n\n")
60 PRINTF("\n\n\n\n\n")
61 PRINTF("***************************\n")
61 PRINTF("***************************\n")
62 PRINTF("** START Flight Software **\n")
62 PRINTF("** START Flight Software **\n")
63 PRINTF("***************************\n")
63 PRINTF("***************************\n")
64 PRINTF("\n\n")
64 PRINTF("\n\n")
65
65
66 //send_console_outputs_on_serial_port();
66 //send_console_outputs_on_serial_port();
67 set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE);
67 set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE);
68
68
69 initLookUpTableForCRC(); // in tc_handler.h
69 initLookUpTableForCRC(); // in tc_handler.h
70 init_default_mode_parameters();
70 init_default_mode_parameters();
71 init_housekeeping_parameters();
71 init_housekeeping_parameters();
72 create_message_queue();
72 create_message_queue();
73
73
74 create_names();
74 create_names(); // create all names
75 create_all_tasks();
75 create_all_tasks(); // create all tasks
76 start_all_tasks();
76 start_all_tasks(); // start all tasks
77 stop_current_mode(); // go in STANDBY mode
77
78
78 grspw_timecode_callback = &timecode_irq_handler;
79 grspw_timecode_callback = &timecode_irq_handler;
79
80
80 configure_spw_link();
81 configure_spw_link();
81
82
82 //****************************
83 //****************************
83 // Spectral Matrices simulator
84 // Spectral Matrices simulator
84 configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR,
85 configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR,
85 IRQ_SPARC_SM, spectral_matrices_isr );
86 IRQ_SPARC_SM, spectral_matrices_isr );
86
87
87 //**********
88 //**********
88 // WAVEFORMS
89 // WAVEFORMS
89 // simulator
90 // simulator
90
91
91 #ifdef GSA
92 #ifdef GSA
92 configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR, CLKDIV_WF_SIMULATOR,
93 configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR, CLKDIV_WF_SIMULATOR,
93 IRQ_SPARC_WF, waveforms_simulator_isr );
94 IRQ_SPARC_WF, waveforms_simulator_isr );
94 #else
95 #else
95 // configure the registers of the waveform picker
96 // configure the registers of the waveform picker
96 init_waveform_picker_regs();
97 init_waveform_picker_regs();
97 // configure the waveform picker interrupt service routine
98 // configure the waveform picker interrupt service routine
98 status = rtems_interrupt_catch( waveforms_isr,
99 status = rtems_interrupt_catch( waveforms_isr,
99 IRQ_SPARC_WAVEFORM_PICKER,
100 IRQ_SPARC_WAVEFORM_PICKER,
100 &old_isr_handler) ;
101 &old_isr_handler) ;
101 LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER );
102 LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER );
102 #endif
103 #endif
103
104
104 //**********
105 //**********
105
106
106 //*****************************************
107 //*****************************************
107 // irq handling of the time management unit
108 // irq handling of the time management unit
108 status = rtems_interrupt_catch( commutation_isr1,
109 status = rtems_interrupt_catch( commutation_isr1,
109 IRQ_SPARC_TIME1,
110 IRQ_SPARC_TIME1,
110 &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels
111 &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels
111 if (status==RTEMS_SUCCESSFUL) {
112 if (status==RTEMS_SUCCESSFUL) {
112 PRINTF("OK *** commutation_isr1 *** rtems_interrupt_catch successfullly configured\n")
113 PRINTF("OK *** commutation_isr1 *** rtems_interrupt_catch successfullly configured\n")
113 }
114 }
114
115
115 status = rtems_interrupt_catch( commutation_isr2,
116 status = rtems_interrupt_catch( commutation_isr2,
116 IRQ_SPARC_TIME2,
117 IRQ_SPARC_TIME2,
117 &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels
118 &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels
118 if (status==RTEMS_SUCCESSFUL) {
119 if (status==RTEMS_SUCCESSFUL) {
119 PRINTF("OK *** commutation_isr2 *** rtems_interrupt_catch successfullly configured\n")
120 PRINTF("OK *** commutation_isr2 *** rtems_interrupt_catch successfullly configured\n")
120 }
121 }
121
122
122 LEON_Unmask_interrupt( IRQ_TIME1 );
123 LEON_Unmask_interrupt( IRQ_TIME1 );
123 LEON_Unmask_interrupt( IRQ_TIME2 );
124 LEON_Unmask_interrupt( IRQ_TIME2 );
124
125
125 #ifdef GSA
126 #ifdef GSA
126 //if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
127 //if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
127 // printf("in INIT *** Error sending event to WFRM\n");
128 // printf("in INIT *** Error sending event to WFRM\n");
128 //}
129 //}
129 #endif
130 #endif
130
131
131 status = rtems_task_delete(RTEMS_SELF);
132 status = rtems_task_delete(RTEMS_SELF);
132
133
133 }
134 }
134
135
135 rtems_task spiq_task(rtems_task_argument unused)
136 rtems_task spiq_task(rtems_task_argument unused)
136 {
137 {
137 rtems_event_set event_out;
138 rtems_event_set event_out;
138 rtems_status_code status;
139 rtems_status_code status;
139
140
140 while(true){
141 while(true){
141 PRINTF("in SPIQ *** Waiting for SPW_LINKERR_EVENT\n")
142 PRINTF("in SPIQ *** Waiting for SPW_LINKERR_EVENT\n")
142 rtems_event_receive(SPW_LINKERR_EVENT, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an SPW_LINKERR_EVENT
143 rtems_event_receive(SPW_LINKERR_EVENT, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an SPW_LINKERR_EVENT
143
144
144 if (rtems_task_suspend(Task_id[TASKID_RECV])!=RTEMS_SUCCESSFUL) { // suspend RECV task
145 if (rtems_task_suspend(Task_id[TASKID_RECV])!=RTEMS_SUCCESSFUL) { // suspend RECV task
145 PRINTF("in SPIQ *** Error suspending RECV Task\n")
146 PRINTF("in SPIQ *** Error suspending RECV Task\n")
146 }
147 }
147 if (rtems_task_suspend(Task_id[TASKID_HOUS])!=RTEMS_SUCCESSFUL) { // suspend HOUS task
148 if (rtems_task_suspend(Task_id[TASKID_HOUS])!=RTEMS_SUCCESSFUL) { // suspend HOUS task
148 PRINTF("in SPIQ *** Error suspending HOUS Task\n")
149 PRINTF("in SPIQ *** Error suspending HOUS Task\n")
149 }
150 }
150
151
151 configure_spw_link();
152 configure_spw_link();
152
153
153 status = rtems_task_restart( Task_id[TASKID_HOUS], 1 );
154 status = rtems_task_restart( Task_id[TASKID_HOUS], 1 );
154 if (status!=RTEMS_SUCCESSFUL) {
155 if (status!=RTEMS_SUCCESSFUL) {
155 PRINTF1("in SPIQ *** Error restarting HOUS Task *** code %d\n", status)
156 PRINTF1("in SPIQ *** Error restarting HOUS Task *** code %d\n", status)
156 }
157 }
157
158
158 if (rtems_task_restart(Task_id[TASKID_RECV], 1)!=RTEMS_SUCCESSFUL) { // restart RECV task
159 if (rtems_task_restart(Task_id[TASKID_RECV], 1)!=RTEMS_SUCCESSFUL) { // restart RECV task
159 PRINTF("in SPIQ *** Error restarting RECV Task\n")
160 PRINTF("in SPIQ *** Error restarting RECV Task\n")
160 }
161 }
161 }
162 }
162 }
163 }
163
164
164 void init_default_mode_parameters(void)
165 void init_default_mode_parameters(void)
165 {
166 {
166 // COMMON PARAMETERS
167 // COMMON PARAMETERS
167 param_common.sy_lfr_common0 = 0x00;
168 param_common.sy_lfr_common0 = 0x00;
168 param_common.sy_lfr_common1 = 0x10; // default value 0 0 0 1 0 0 0 0
169 param_common.sy_lfr_common1 = 0x10; // default value 0 0 0 1 0 0 0 0
169 // NORMAL MODE
170 // NORMAL MODE
170 param_norm.sy_lfr_n_swf_l = 2048; // nb sample
171 param_norm.sy_lfr_n_swf_l = 2048; // nb sample
171 param_norm.sy_lfr_n_swf_p = 300; // sec
172 param_norm.sy_lfr_n_swf_p = 300; // sec
172 param_norm.sy_lfr_n_asm_p = 3600; // sec
173 param_norm.sy_lfr_n_asm_p = 3600; // sec
173 param_norm.sy_lfr_n_bp_p0 = 4; // sec
174 param_norm.sy_lfr_n_bp_p0 = 4; // sec
174 param_norm.sy_lfr_n_bp_p1 = 20; // sec
175 param_norm.sy_lfr_n_bp_p1 = 20; // sec
175 // BURST MODE
176 // BURST MODE
176 param_burst.sy_lfr_b_bp_p0 = 1; // sec
177 param_burst.sy_lfr_b_bp_p0 = 1; // sec
177 param_burst.sy_lfr_b_bp_p1 = 5; // sec
178 param_burst.sy_lfr_b_bp_p1 = 5; // sec
178 // SBM1 MODE
179 // SBM1 MODE
179 param_sbm1.sy_lfr_s1_bp_p0 = 1; // sec
180 param_sbm1.sy_lfr_s1_bp_p0 = 1; // sec
180 param_sbm1.sy_lfr_s1_bp_p1 = 1; // sec
181 param_sbm1.sy_lfr_s1_bp_p1 = 1; // sec
181 // SBM2 MODE
182 // SBM2 MODE
182 param_sbm2.sy_lfr_s2_bp_p0 = 1; // sec
183 param_sbm2.sy_lfr_s2_bp_p0 = 1; // sec
183 param_sbm2.sy_lfr_s2_bp_p0 = 5; // sec
184 param_sbm2.sy_lfr_s2_bp_p0 = 5; // sec
184 }
185 }
185
186
186 void init_housekeeping_parameters(void)
187 void init_housekeeping_parameters(void)
187 {
188 {
188 unsigned int i = 0;
189 unsigned int i = 0;
189 unsigned int j = 0;
190 unsigned int j = 0;
190 unsigned int k = 0;
191 unsigned int k = 0;
191 char *parameters;
192 char *parameters;
192
193
193 parameters = (char*) &housekeeping_packet.lfr_status_word;
194 parameters = (char*) &housekeeping_packet.lfr_status_word;
194 for(i = 0; i< SIZE_HK_PARAMETERS; i++)
195 for(i = 0; i< SIZE_HK_PARAMETERS; i++)
195 {
196 {
196 parameters[i] = 0x00;
197 parameters[i] = 0x00;
197 }
198 }
198 // init status word
199 // init status word
199 housekeeping_packet.lfr_status_word[0] = 0x00;
200 housekeeping_packet.lfr_status_word[0] = 0x00;
200 housekeeping_packet.lfr_status_word[1] = 0x00;
201 housekeeping_packet.lfr_status_word[1] = 0x00;
201 // init software version
202 // init software version
202 housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1;
203 housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1;
203 housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2;
204 housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2;
204 housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3;
205 housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3;
205 housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4;
206 housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4;
206 // init sequence counters
207 // init sequence counters
207 for (i = 0; i<SEQ_CNT_NB_PID; i++)
208 for (i = 0; i<SEQ_CNT_NB_PID; i++)
208 {
209 {
209 for(j = 0; j<SEQ_CNT_NB_CAT; j++)
210 for(j = 0; j<SEQ_CNT_NB_CAT; j++)
210 {
211 {
211 for(k = 0; k<SEQ_CNT_NB_DEST_ID; k++)
212 for(k = 0; k<SEQ_CNT_NB_DEST_ID; k++)
212 {
213 {
213 sequenceCounters[i][j][k] = 0x00;
214 sequenceCounters[i][j][k] = 0x00;
214 }
215 }
215 }
216 }
216 }
217 }
217 }
218 }
218
219
219 int create_names( void )
220 int create_names( void )
220 {
221 {
221 // task names
222 // task names
222 Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' );
223 Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' );
223 Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' );
224 Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' );
224 Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' );
225 Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' );
225 Task_name[TASKID_SMIQ] = rtems_build_name( 'S', 'M', 'I', 'Q' );
226 Task_name[TASKID_SMIQ] = rtems_build_name( 'S', 'M', 'I', 'Q' );
226 Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' );
227 Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' );
227 Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' );
228 Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' );
228 Task_name[TASKID_BPF0] = rtems_build_name( 'B', 'P', 'F', '0' );
229 Task_name[TASKID_BPF0] = rtems_build_name( 'B', 'P', 'F', '0' );
229 Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' );
230 Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' );
230 Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' );
231 Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' );
231 Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' );
232 Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' );
232
233
233 // rate monotonic period name
234 // rate monotonic period name
234 HK_name = rtems_build_name( 'H', 'O', 'U', 'S' );
235 HK_name = rtems_build_name( 'H', 'O', 'U', 'S' );
235
236
236 return 0;
237 return 0;
237 }
238 }
238
239
239 int create_all_tasks( void )
240 int create_all_tasks( void )
240 {
241 {
241 rtems_status_code status;
242 rtems_status_code status;
242
243
243 // RECV
244 // RECV
244 status = rtems_task_create(
245 status = rtems_task_create(
245 Task_name[TASKID_RECV], 200, RTEMS_MINIMUM_STACK_SIZE * 2,
246 Task_name[TASKID_RECV], 200, RTEMS_MINIMUM_STACK_SIZE * 2,
246 RTEMS_DEFAULT_MODES,
247 RTEMS_DEFAULT_MODES,
247 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV]
248 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV]
248 );
249 );
249 // ACTN
250 // ACTN
250 status = rtems_task_create(
251 status = rtems_task_create(
251 Task_name[TASKID_ACTN], 50, RTEMS_MINIMUM_STACK_SIZE * 2,
252 Task_name[TASKID_ACTN], 50, RTEMS_MINIMUM_STACK_SIZE * 2,
252 RTEMS_DEFAULT_MODES,
253 RTEMS_DEFAULT_MODES,
253 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_ACTN]
254 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_ACTN]
254 );
255 );
255 // SPIQ
256 // SPIQ
256 status = rtems_task_create(
257 status = rtems_task_create(
257 Task_name[TASKID_SPIQ], 5, RTEMS_MINIMUM_STACK_SIZE * 2,
258 Task_name[TASKID_SPIQ], 5, RTEMS_MINIMUM_STACK_SIZE * 2,
258 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
259 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
259 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ]
260 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ]
260 );
261 );
261 // SMIQ
262 // SMIQ
262 status = rtems_task_create(
263 status = rtems_task_create(
263 Task_name[TASKID_SMIQ], 10, RTEMS_MINIMUM_STACK_SIZE * 2,
264 Task_name[TASKID_SMIQ], 10, RTEMS_MINIMUM_STACK_SIZE * 2,
264 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
265 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
265 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SMIQ]
266 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SMIQ]
266 );
267 );
267 // STAT
268 // STAT
268 status = rtems_task_create(
269 status = rtems_task_create(
269 Task_name[TASKID_STAT], 150, RTEMS_MINIMUM_STACK_SIZE * 2,
270 Task_name[TASKID_STAT], 150, RTEMS_MINIMUM_STACK_SIZE * 2,
270 RTEMS_DEFAULT_MODES,
271 RTEMS_DEFAULT_MODES,
271 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT]
272 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT]
272 );
273 );
273 // AVF0
274 // AVF0
274 status = rtems_task_create(
275 status = rtems_task_create(
275 Task_name[TASKID_AVF0], 50, RTEMS_MINIMUM_STACK_SIZE * 2,
276 Task_name[TASKID_AVF0], 50, RTEMS_MINIMUM_STACK_SIZE * 2,
276 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
277 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
277 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0]
278 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0]
278 );
279 );
279 // BPF0
280 // BPF0
280 status = rtems_task_create(
281 status = rtems_task_create(
281 Task_name[TASKID_BPF0], 50, RTEMS_MINIMUM_STACK_SIZE * 2,
282 Task_name[TASKID_BPF0], 50, RTEMS_MINIMUM_STACK_SIZE * 2,
282 RTEMS_DEFAULT_MODES,
283 RTEMS_DEFAULT_MODES,
283 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_BPF0]
284 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_BPF0]
284 );
285 );
285 // WFRM
286 // WFRM
286 status = rtems_task_create(
287 status = rtems_task_create(
287 Task_name[TASKID_WFRM], 100, RTEMS_MINIMUM_STACK_SIZE * 2,
288 Task_name[TASKID_WFRM], 100, RTEMS_MINIMUM_STACK_SIZE * 2,
288 RTEMS_DEFAULT_MODES,
289 RTEMS_DEFAULT_MODES,
289 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM]
290 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM]
290 );
291 );
291 // DUMB
292 // DUMB
292 status = rtems_task_create(
293 status = rtems_task_create(
293 Task_name[TASKID_DUMB], 200, RTEMS_MINIMUM_STACK_SIZE * 2,
294 Task_name[TASKID_DUMB], 200, RTEMS_MINIMUM_STACK_SIZE * 2,
294 RTEMS_DEFAULT_MODES,
295 RTEMS_DEFAULT_MODES,
295 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB]
296 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB]
296 );
297 );
297 // HOUS
298 // HOUS
298 status = rtems_task_create(
299 status = rtems_task_create(
299 Task_name[TASKID_HOUS], 199, RTEMS_MINIMUM_STACK_SIZE * 2,
300 Task_name[TASKID_HOUS], 199, RTEMS_MINIMUM_STACK_SIZE * 2,
300 RTEMS_DEFAULT_MODES,
301 RTEMS_DEFAULT_MODES,
301 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS]
302 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS]
302 );
303 );
303
304
304 return 0;
305 return 0;
305 }
306 }
306
307
307 int start_all_tasks( void )
308 int start_all_tasks( void )
308 {
309 {
309 rtems_status_code status;
310 rtems_status_code status;
310
311
311 status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 );
312 status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 );
312 if (status!=RTEMS_SUCCESSFUL) {
313 if (status!=RTEMS_SUCCESSFUL) {
313 PRINTF("In INIT *** Error starting TASK_SPIQ\n")
314 PRINTF("In INIT *** Error starting TASK_SPIQ\n")
314 }
315 }
315
316
316 status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 );
317 status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 );
317 if (status!=RTEMS_SUCCESSFUL) {
318 if (status!=RTEMS_SUCCESSFUL) {
318 PRINTF("In INIT *** Error starting TASK_RECV\n")
319 PRINTF("In INIT *** Error starting TASK_RECV\n")
319 }
320 }
320
321
321 status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 );
322 status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 );
322 if (status!=RTEMS_SUCCESSFUL) {
323 if (status!=RTEMS_SUCCESSFUL) {
323 PRINTF("In INIT *** Error starting TASK_ACTN\n")
324 PRINTF("In INIT *** Error starting TASK_ACTN\n")
324 }
325 }
325
326
326 status = rtems_task_start( Task_id[TASKID_SMIQ], smiq_task, 1 );
327 status = rtems_task_start( Task_id[TASKID_SMIQ], smiq_task, 1 );
327 if (status!=RTEMS_SUCCESSFUL) {
328 if (status!=RTEMS_SUCCESSFUL) {
328 PRINTF("In INIT *** Error starting TASK_BPPR\n")
329 PRINTF("In INIT *** Error starting TASK_BPPR\n")
329 }
330 }
330
331
331 status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 );
332 status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 );
332 if (status!=RTEMS_SUCCESSFUL) {
333 if (status!=RTEMS_SUCCESSFUL) {
333 PRINTF("In INIT *** Error starting TASK_STAT\n")
334 PRINTF("In INIT *** Error starting TASK_STAT\n")
334 }
335 }
335
336
336 status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, 1 );
337 status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, 1 );
337 if (status!=RTEMS_SUCCESSFUL) {
338 if (status!=RTEMS_SUCCESSFUL) {
338 PRINTF("In INIT *** Error starting TASK_AVF0\n")
339 PRINTF("In INIT *** Error starting TASK_AVF0\n")
339 }
340 }
340
341
341 status = rtems_task_start( Task_id[TASKID_BPF0], bpf0_task, 1 );
342 status = rtems_task_start( Task_id[TASKID_BPF0], bpf0_task, 1 );
342 if (status!=RTEMS_SUCCESSFUL) {
343 if (status!=RTEMS_SUCCESSFUL) {
343 PRINTF("In INIT *** Error starting TASK_BPF0\n")
344 PRINTF("In INIT *** Error starting TASK_BPF0\n")
344 }
345 }
345
346
346 status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 );
347 status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 );
347 if (status!=RTEMS_SUCCESSFUL) {
348 if (status!=RTEMS_SUCCESSFUL) {
348 PRINTF("In INIT *** Error starting TASK_WFRM\n")
349 PRINTF("In INIT *** Error starting TASK_WFRM\n")
349 }
350 }
350
351
351 status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 );
352 status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 );
352 if (status!=RTEMS_SUCCESSFUL) {
353 if (status!=RTEMS_SUCCESSFUL) {
353 PRINTF("In INIT *** Error starting TASK_DUMB\n")
354 PRINTF("In INIT *** Error starting TASK_DUMB\n")
354 }
355 }
355
356
356 status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 );
357 status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 );
357 if (status!=RTEMS_SUCCESSFUL) {
358 if (status!=RTEMS_SUCCESSFUL) {
358 PRINTF("In INIT *** Error starting TASK_HOUS\n")
359 PRINTF("In INIT *** Error starting TASK_HOUS\n")
359 }
360 }
360
361
361 return 0;
362 return 0;
362 }
363 }
363
364
364 int configure_spw_link( void )
365 int configure_spw_link( void )
365 {
366 {
366 rtems_status_code status;
367 rtems_status_code status;
367
368
368 close(fdSPW); // close the device if it is already open
369 close(fdSPW); // close the device if it is already open
369 PRINTF("OK *** in configure_spw_link *** try to open "GRSPW_DEVICE_NAME"\n")
370 PRINTF("OK *** in configure_spw_link *** try to open "GRSPW_DEVICE_NAME"\n")
370 fdSPW = open(GRSPW_DEVICE_NAME, O_RDWR); // open the device. the open call reset the hardware
371 fdSPW = open(GRSPW_DEVICE_NAME, O_RDWR); // open the device. the open call reset the hardware
371 if (fdSPW<0) PRINTF("ERR *** in configure_spw_link *** Error opening"GRSPW_DEVICE_NAME"\n")
372 if (fdSPW<0) PRINTF("ERR *** in configure_spw_link *** Error opening"GRSPW_DEVICE_NAME"\n")
372 while(ioctl(fdSPW, SPACEWIRE_IOCTRL_START, 0) != RTEMS_SUCCESSFUL){
373 while(ioctl(fdSPW, SPACEWIRE_IOCTRL_START, 0) != RTEMS_SUCCESSFUL){
373 PRINTF(".")
374 PRINTF(".")
374 fflush(stdout);
375 fflush(stdout);
375 close(fdSPW); // close the device
376 close(fdSPW); // close the device
376 fdSPW = open(GRSPW_DEVICE_NAME, O_RDWR); // open the device. the open call reset the hardware
377 fdSPW = open(GRSPW_DEVICE_NAME, O_RDWR); // open the device. the open call reset the hardware
377 if (fdSPW<0) PRINTF("ERR *** In configure_spw_link *** Error opening"GRSPW_DEVICE_NAME"\n")
378 if (fdSPW<0) PRINTF("ERR *** In configure_spw_link *** Error opening"GRSPW_DEVICE_NAME"\n")
378 rtems_task_wake_after(100);
379 rtems_task_wake_after(100);
379 }
380 }
380
381
381 PRINTF("OK *** In configure_spw_link *** "GRSPW_DEVICE_NAME" opened and started successfully\n")
382 PRINTF("OK *** In configure_spw_link *** "GRSPW_DEVICE_NAME" opened and started successfully\n")
382
383
383 configure_spacewire_set_NP(1, REGS_ADDR_GRSPW); // No Port force
384 configure_spacewire_set_NP(1, REGS_ADDR_GRSPW); // No Port force
384 configure_spacewire_set_RE(1, REGS_ADDR_GRSPW); // the dedicated call seems to break the no port force configuration
385 configure_spacewire_set_RE(1, REGS_ADDR_GRSPW); // the dedicated call seems to break the no port force configuration
385
386
386 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_RXBLOCK, 1); // sets the blocking mode for reception
387 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_RXBLOCK, 1); // sets the blocking mode for reception
387 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_RXBLOCK\n")
388 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_RXBLOCK\n")
388 //
389 //
389 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_EVENT_ID, Task_id[TASKID_SPIQ]); // sets the task ID to which an event is sent when a
390 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_EVENT_ID, Task_id[TASKID_SPIQ]); // sets the task ID to which an event is sent when a
390 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_EVENT_ID\n") // link-error interrupt occurs
391 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_EVENT_ID\n") // link-error interrupt occurs
391 //
392 //
392 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_DISABLE_ERR, 1); // automatic link-disabling due to link-error interrupts
393 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_DISABLE_ERR, 1); // automatic link-disabling due to link-error interrupts
393 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_DISABLE_ERR\n")
394 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_DISABLE_ERR\n")
394 //
395 //
395 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ, 1); // sets the link-error interrupt bit
396 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ, 1); // sets the link-error interrupt bit
396 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ\n")
397 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ\n")
397 //
398 //
398 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL, 0); // transmission blocks on full
399 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL, 0); // transmission blocks on full
399 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL\n")
400 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL\n")
400 //
401 //
401 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_TCODE_CTRL, 0x0909);
402 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_TCODE_CTRL, 0x0909);
402 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TCODE_CTRL,\n")
403 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TCODE_CTRL,\n")
403
404
404 PRINTF("OK *** in configure_spw_link *** "GRSPW_DEVICE_NAME" configured successfully\n")
405 PRINTF("OK *** in configure_spw_link *** "GRSPW_DEVICE_NAME" configured successfully\n")
405
406
406 return RTEMS_SUCCESSFUL;
407 return RTEMS_SUCCESSFUL;
407 }
408 }
408
409
409 void configure_spacewire_set_NP(unsigned char val, unsigned int regAddr) // [N]o [P]ort force
410 void configure_spacewire_set_NP(unsigned char val, unsigned int regAddr) // [N]o [P]ort force
410 {
411 {
411 unsigned int *spwptr = (unsigned int*) regAddr;
412 unsigned int *spwptr = (unsigned int*) regAddr;
412
413
413 if (val == 1) {
414 if (val == 1) {
414 *spwptr = *spwptr | 0x00100000; // [NP] set the No port force bit
415 *spwptr = *spwptr | 0x00100000; // [NP] set the No port force bit
415 }
416 }
416 if (val== 0) {
417 if (val== 0) {
417 *spwptr = *spwptr & 0xffdfffff;
418 *spwptr = *spwptr & 0xffdfffff;
418 }
419 }
419 }
420 }
420
421
421 void configure_spacewire_set_RE(unsigned char val, unsigned int regAddr) // [R]MAP [E]nable
422 void configure_spacewire_set_RE(unsigned char val, unsigned int regAddr) // [R]MAP [E]nable
422 {
423 {
423 unsigned int *spwptr = (unsigned int*) regAddr;
424 unsigned int *spwptr = (unsigned int*) regAddr;
424
425
425 if (val == 1)
426 if (val == 1)
426 {
427 {
427 *spwptr = *spwptr | 0x00010000; // [RE] set the RMAP Enable bit
428 *spwptr = *spwptr | 0x00010000; // [RE] set the RMAP Enable bit
428 }
429 }
429 if (val== 0)
430 if (val== 0)
430 {
431 {
431 *spwptr = *spwptr & 0xfffdffff;
432 *spwptr = *spwptr & 0xfffdffff;
432 }
433 }
433 }
434 }
434
435
435 rtems_status_code write_spw(spw_ioctl_pkt_send* spw_ioctl_send)
436 rtems_status_code write_spw(spw_ioctl_pkt_send* spw_ioctl_send)
436 {
437 {
437 rtems_status_code status;
438 rtems_status_code status;
438 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, spw_ioctl_send );
439 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, spw_ioctl_send );
439 return status;
440 return status;
440 }
441 }
441
442
442 void timecode_irq_handler(void *pDev, void *regs, int minor, unsigned int tc)
443 void timecode_irq_handler(void *pDev, void *regs, int minor, unsigned int tc)
443 {
444 {
444 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_1 ) != RTEMS_SUCCESSFUL) {
445 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_1 ) != RTEMS_SUCCESSFUL) {
445 printf("In timecode_irq_handler *** Error sending event to DUMB\n");
446 printf("In timecode_irq_handler *** Error sending event to DUMB\n");
446 }
447 }
447 }
448 }
448
449
@@ -1,942 +1,969
1 #include <tc_handler.h>
1 #include <tc_handler.h>
2 #include <fsw_params.h>
2 #include <fsw_params.h>
3
3
4 char *DumbMessages[5] = {"in DUMB *** default",
4 char *DumbMessages[5] = {"in DUMB *** default",
5 "in DUMB *** timecode_irq_handler",
5 "in DUMB *** timecode_irq_handler",
6 "in DUMB *** waveforms_isr",
6 "in DUMB *** waveforms_isr",
7 "",
7 "",
8 ""
8 ""
9 };
9 };
10
10
11 unsigned char currentTC_LEN_RCV[2]; // SHALL be equal to the current TC packet estimated packet length field
11 unsigned char currentTC_LEN_RCV[2]; // SHALL be equal to the current TC packet estimated packet length field
12 unsigned char currentTC_COMPUTED_CRC[2];
12 unsigned char currentTC_COMPUTED_CRC[2];
13 unsigned int currentTC_LEN_RCV_AsUnsignedInt;
13 unsigned int currentTC_LEN_RCV_AsUnsignedInt;
14 unsigned int currentTM_length;
14 unsigned int currentTM_length;
15 unsigned char currentTC_processedFlag;
15 unsigned char currentTC_processedFlag;
16
16
17 unsigned int lookUpTableForCRC[256];
17 unsigned int lookUpTableForCRC[256];
18
18
19 //**********************
19 //**********************
20 // GENERAL USE FUNCTIONS
20 // GENERAL USE FUNCTIONS
21 unsigned int Crc_opt( unsigned char D, unsigned int Chk)
21 unsigned int Crc_opt( unsigned char D, unsigned int Chk)
22 {
22 {
23 return(((Chk << 8) & 0xff00)^lookUpTableForCRC [(((Chk >> 8)^D) & 0x00ff)]);
23 return(((Chk << 8) & 0xff00)^lookUpTableForCRC [(((Chk >> 8)^D) & 0x00ff)]);
24 }
24 }
25
25
26 void initLookUpTableForCRC( void )
26 void initLookUpTableForCRC( void )
27 {
27 {
28 unsigned int i;
28 unsigned int i;
29 unsigned int tmp;
29 unsigned int tmp;
30
30
31 for (i=0; i<256; i++)
31 for (i=0; i<256; i++)
32 {
32 {
33 tmp = 0;
33 tmp = 0;
34 if((i & 1) != 0) {
34 if((i & 1) != 0) {
35 tmp = tmp ^ 0x1021;
35 tmp = tmp ^ 0x1021;
36 }
36 }
37 if((i & 2) != 0) {
37 if((i & 2) != 0) {
38 tmp = tmp ^ 0x2042;
38 tmp = tmp ^ 0x2042;
39 }
39 }
40 if((i & 4) != 0) {
40 if((i & 4) != 0) {
41 tmp = tmp ^ 0x4084;
41 tmp = tmp ^ 0x4084;
42 }
42 }
43 if((i & 8) != 0) {
43 if((i & 8) != 0) {
44 tmp = tmp ^ 0x8108;
44 tmp = tmp ^ 0x8108;
45 }
45 }
46 if((i & 16) != 0) {
46 if((i & 16) != 0) {
47 tmp = tmp ^ 0x1231;
47 tmp = tmp ^ 0x1231;
48 }
48 }
49 if((i & 32) != 0) {
49 if((i & 32) != 0) {
50 tmp = tmp ^ 0x2462;
50 tmp = tmp ^ 0x2462;
51 }
51 }
52 if((i & 64) != 0) {
52 if((i & 64) != 0) {
53 tmp = tmp ^ 0x48c4;
53 tmp = tmp ^ 0x48c4;
54 }
54 }
55 if((i & 128) != 0) {
55 if((i & 128) != 0) {
56 tmp = tmp ^ 0x9188;
56 tmp = tmp ^ 0x9188;
57 }
57 }
58 lookUpTableForCRC[i] = tmp;
58 lookUpTableForCRC[i] = tmp;
59 }
59 }
60 }
60 }
61
61
62 void GetCRCAsTwoBytes(unsigned char* data, unsigned char* crcAsTwoBytes, unsigned int sizeOfData)
62 void GetCRCAsTwoBytes(unsigned char* data, unsigned char* crcAsTwoBytes, unsigned int sizeOfData)
63 {
63 {
64 unsigned int Chk;
64 unsigned int Chk;
65 int j;
65 int j;
66 Chk = 0xffff; // reset the syndrom to all ones
66 Chk = 0xffff; // reset the syndrom to all ones
67 for (j=0; j<sizeOfData; j++) {
67 for (j=0; j<sizeOfData; j++) {
68 Chk = Crc_opt(data[j], Chk);
68 Chk = Crc_opt(data[j], Chk);
69 }
69 }
70 crcAsTwoBytes[0] = (unsigned char) (Chk >> 8);
70 crcAsTwoBytes[0] = (unsigned char) (Chk >> 8);
71 crcAsTwoBytes[1] = (unsigned char) (Chk & 0x00ff);
71 crcAsTwoBytes[1] = (unsigned char) (Chk & 0x00ff);
72 }
72 }
73
73
74 //*********************
74 //*********************
75 // ACCEPTANCE FUNCTIONS
75 // ACCEPTANCE FUNCTIONS
76 int TC_checker(ccsdsTelecommandPacket_t *TC, unsigned int tc_len_recv)
76 int TC_checker(ccsdsTelecommandPacket_t *TC, unsigned int tc_len_recv)
77 {
77 {
78 int ret = 0;
78 int ret = 0;
79 rtems_status_code status;
79 rtems_status_code status;
80 spw_ioctl_pkt_send spw_ioctl_send;
80 spw_ioctl_pkt_send spw_ioctl_send;
81 TMHeader_t TM_header;
81 TMHeader_t TM_header;
82 unsigned int code = 0;
82 unsigned int code = 0;
83 unsigned char computed_CRC[2];
83 unsigned char computed_CRC[2];
84 char data[ TM_LEN_EXE_CORR + CCSDS_TC_TM_PACKET_OFFSET - TM_HEADER_LEN ];
84 char data[ TM_LEN_EXE_CORR + CCSDS_TC_TM_PACKET_OFFSET - TM_HEADER_LEN ];
85
85
86 GetCRCAsTwoBytes( (unsigned char*) TC->packetID, computed_CRC, tc_len_recv + 5 );
86 GetCRCAsTwoBytes( (unsigned char*) TC->packetID, computed_CRC, tc_len_recv + 5 );
87 code = acceptTM( TC, tc_len_recv ) ;
87 code = acceptTM( TC, tc_len_recv ) ;
88 if ( (code == ILLEGAL_APID) | (code == WRONG_LEN_PACKET) | (code == INCOR_CHECKSUM)
88 if ( (code == ILLEGAL_APID) | (code == WRONG_LEN_PACKET) | (code == INCOR_CHECKSUM)
89 | (code == ILL_TYPE) | (code == ILL_SUBTYPE) | (code == WRONG_APP_DATA) )
89 | (code == ILL_TYPE) | (code == ILL_SUBTYPE) | (code == WRONG_APP_DATA) )
90 { // generate TM_LFR_TC_EXE_CORRUPTED
90 { // generate TM_LFR_TC_EXE_CORRUPTED
91 // BUILD HEADER
91 // BUILD HEADER
92 TM_build_header( TM_LFR_TC_EXE_ERR, TM_LEN_EXE_CORR, 0, 0, &TM_header);
92 TM_build_header( TM_LFR_TC_EXE_ERR, TM_LEN_EXE_CORR, 0, 0, &TM_header);
93 // BUILD DATA
93 // BUILD DATA
94 TM_build_data( TC, data, SID_EXE_CORR, computed_CRC);
94 TM_build_data( TC, data, SID_EXE_CORR, computed_CRC);
95 // PREPARE TM SENDING
95 // PREPARE TM SENDING
96 spw_ioctl_send.hlen = TM_HEADER_LEN + 4; // + 4 is for the protocole extra header
96 spw_ioctl_send.hlen = TM_HEADER_LEN + 4; // + 4 is for the protocole extra header
97 spw_ioctl_send.hdr = (char*) &TM_header;
97 spw_ioctl_send.hdr = (char*) &TM_header;
98 spw_ioctl_send.dlen = 16;
98 spw_ioctl_send.dlen = 16;
99 spw_ioctl_send.data = data;
99 spw_ioctl_send.data = data;
100 // SEND PACKET
100 // SEND PACKET
101 write_spw(&spw_ioctl_send);
101 write_spw(&spw_ioctl_send);
102 }
102 }
103 else { // send valid TC to the action launcher
103 else { // send valid TC to the action launcher
104 status = rtems_message_queue_send( misc_id[0], TC, tc_len_recv + CCSDS_TC_TM_PACKET_OFFSET + 3);
104 status = rtems_message_queue_send( misc_id[0], TC, tc_len_recv + CCSDS_TC_TM_PACKET_OFFSET + 3);
105 ret = -1;
105 ret = -1;
106 }
106 }
107 return ret;
107 return ret;
108 }
108 }
109
109
110 unsigned char acceptTM(ccsdsTelecommandPacket_t * TMPacket, unsigned int TC_LEN_RCV)
110 unsigned char acceptTM(ccsdsTelecommandPacket_t * TMPacket, unsigned int TC_LEN_RCV)
111 {
111 {
112 unsigned char ret = 0;
112 unsigned char ret = 0;
113 unsigned char pid = 0;
113 unsigned char pid = 0;
114 unsigned char category = 0;
114 unsigned char category = 0;
115 unsigned int length = 0;
115 unsigned int length = 0;
116 unsigned char packetType = 0;
116 unsigned char packetType = 0;
117 unsigned char packetSubtype = 0;
117 unsigned char packetSubtype = 0;
118 unsigned char * CCSDSContent = NULL;
118 unsigned char * CCSDSContent = NULL;
119
119
120 // APID check *** APID on 2 bytes
120 // APID check *** APID on 2 bytes
121 pid = ((TMPacket->packetID[0] & 0x07)<<4) + ( (TMPacket->packetID[1]>>4) & 0x0f ); // PID = 11 *** 7 bits xxxxx210 7654xxxx
121 pid = ((TMPacket->packetID[0] & 0x07)<<4) + ( (TMPacket->packetID[1]>>4) & 0x0f ); // PID = 11 *** 7 bits xxxxx210 7654xxxx
122 category = (TMPacket->packetID[1] & 0x0f); // PACKET_CATEGORY = 12 *** 4 bits xxxxxxxx xxxx3210
122 category = (TMPacket->packetID[1] & 0x0f); // PACKET_CATEGORY = 12 *** 4 bits xxxxxxxx xxxx3210
123 length = (TMPacket->packetLength[0] * 256) + TMPacket->packetLength[1];
123 length = (TMPacket->packetLength[0] * 256) + TMPacket->packetLength[1];
124 packetType = TMPacket->dataFieldHeader[1];
124 packetType = TMPacket->dataFieldHeader[1];
125 packetSubtype = TMPacket->dataFieldHeader[2];
125 packetSubtype = TMPacket->dataFieldHeader[2];
126
126
127 if (pid!=CCSDS_PROCESS_ID) {
127 if (pid!=CCSDS_PROCESS_ID) {
128 ret = ILLEGAL_APID;
128 ret = ILLEGAL_APID;
129 }
129 }
130 else if (category!=CCSDS_PACKET_CATEGORY) {
130 else if (category!=CCSDS_PACKET_CATEGORY) {
131 ret = ILLEGAL_APID;
131 ret = ILLEGAL_APID;
132 }
132 }
133 else if (length != TC_LEN_RCV ) { // packet length check
133 else if (length != TC_LEN_RCV ) { // packet length check
134 ret = WRONG_LEN_PACKET; // LEN RCV != SIZE FIELD
134 ret = WRONG_LEN_PACKET; // LEN RCV != SIZE FIELD
135 }
135 }
136 else if (length >= CCSDS_TC_PKT_MAX_SIZE) {
136 else if (length >= CCSDS_TC_PKT_MAX_SIZE) {
137 ret = WRONG_LEN_PACKET; // check that the packet does not exceed the MAX size
137 ret = WRONG_LEN_PACKET; // check that the packet does not exceed the MAX size
138 }
138 }
139 else if (packetType == TC_TYPE_GEN){ // service type, subtype and packet length check
139 else if (packetType == TC_TYPE_GEN){ // service type, subtype and packet length check
140 switch(packetSubtype){ //subtype, autorized values are 3, 20, 21, 24, 27, 28, 30, 40, 50, 60, 61
140 switch(packetSubtype){ //subtype, autorized values are 3, 20, 21, 24, 27, 28, 30, 40, 50, 60, 61
141 case TC_SUBTYPE_RESET:
141 case TC_SUBTYPE_RESET:
142 if (length!=(TC_LEN_RESET-CCSDS_TC_TM_PACKET_OFFSET)) {
142 if (length!=(TC_LEN_RESET-CCSDS_TC_TM_PACKET_OFFSET)) {
143 ret = WRONG_LEN_PACKET;
143 ret = WRONG_LEN_PACKET;
144 }
144 }
145 else {
145 else {
146 ret = CCSDS_TM_VALID;
146 ret = CCSDS_TM_VALID;
147 }
147 }
148 break;
148 break;
149 case TC_SUBTYPE_LOAD_COMM:
149 case TC_SUBTYPE_LOAD_COMM:
150 if (length!=(TC_LEN_LOAD_COMM-CCSDS_TC_TM_PACKET_OFFSET)) {
150 if (length!=(TC_LEN_LOAD_COMM-CCSDS_TC_TM_PACKET_OFFSET)) {
151 ret = WRONG_LEN_PACKET;
151 ret = WRONG_LEN_PACKET;
152 }
152 }
153 else {
153 else {
154 ret = CCSDS_TM_VALID;
154 ret = CCSDS_TM_VALID;
155 }
155 }
156 break;
156 break;
157 case TC_SUBTYPE_LOAD_NORM:
157 case TC_SUBTYPE_LOAD_NORM:
158 if (length!=(TC_LEN_LOAD_NORM-CCSDS_TC_TM_PACKET_OFFSET)) {
158 if (length!=(TC_LEN_LOAD_NORM-CCSDS_TC_TM_PACKET_OFFSET)) {
159 ret = WRONG_LEN_PACKET;
159 ret = WRONG_LEN_PACKET;
160 }
160 }
161 else {
161 else {
162 ret = CCSDS_TM_VALID;
162 ret = CCSDS_TM_VALID;
163 }
163 }
164 break;
164 break;
165 case TC_SUBTYPE_LOAD_BURST:
165 case TC_SUBTYPE_LOAD_BURST:
166 if (length!=(TC_LEN_LOAD_BURST-CCSDS_TC_TM_PACKET_OFFSET)) {
166 if (length!=(TC_LEN_LOAD_BURST-CCSDS_TC_TM_PACKET_OFFSET)) {
167 ret = WRONG_LEN_PACKET;
167 ret = WRONG_LEN_PACKET;
168 }
168 }
169 else {
169 else {
170 ret = CCSDS_TM_VALID;
170 ret = CCSDS_TM_VALID;
171 }
171 }
172 break;
172 break;
173 case TC_SUBTYPE_LOAD_SBM1:
173 case TC_SUBTYPE_LOAD_SBM1:
174 if (length!=(TC_LEN_LOAD_SBM1-CCSDS_TC_TM_PACKET_OFFSET)) {
174 if (length!=(TC_LEN_LOAD_SBM1-CCSDS_TC_TM_PACKET_OFFSET)) {
175 ret = WRONG_LEN_PACKET;
175 ret = WRONG_LEN_PACKET;
176 }
176 }
177 else {
177 else {
178 ret = CCSDS_TM_VALID;
178 ret = CCSDS_TM_VALID;
179 }
179 }
180 break;
180 break;
181 case TC_SUBTYPE_LOAD_SBM2:
181 case TC_SUBTYPE_LOAD_SBM2:
182 if (length!=(TC_LEN_LOAD_SBM2-CCSDS_TC_TM_PACKET_OFFSET)) {
182 if (length!=(TC_LEN_LOAD_SBM2-CCSDS_TC_TM_PACKET_OFFSET)) {
183 ret = WRONG_LEN_PACKET;
183 ret = WRONG_LEN_PACKET;
184 }
184 }
185 else {
185 else {
186 ret = CCSDS_TM_VALID;
186 ret = CCSDS_TM_VALID;
187 }
187 }
188 break;
188 break;
189 case TC_SUBTYPE_DUMP:
189 case TC_SUBTYPE_DUMP:
190 if (length!=(TC_LEN_DUMP-CCSDS_TC_TM_PACKET_OFFSET)) {
190 if (length!=(TC_LEN_DUMP-CCSDS_TC_TM_PACKET_OFFSET)) {
191 ret = WRONG_LEN_PACKET;
191 ret = WRONG_LEN_PACKET;
192 }
192 }
193 else {
193 else {
194 ret = CCSDS_TM_VALID;
194 ret = CCSDS_TM_VALID;
195 }
195 }
196 break;
196 break;
197 case TC_SUBTYPE_ENTER:
197 case TC_SUBTYPE_ENTER:
198 if (length!=(TC_LEN_ENTER-CCSDS_TC_TM_PACKET_OFFSET)) {
198 if (length!=(TC_LEN_ENTER-CCSDS_TC_TM_PACKET_OFFSET)) {
199 ret = WRONG_LEN_PACKET;
199 ret = WRONG_LEN_PACKET;
200 }
200 }
201 else {
201 else {
202 ret = CCSDS_TM_VALID;
202 ret = CCSDS_TM_VALID;
203 }
203 }
204 break;
204 break;
205 case TC_SUBTYPE_UPDT_INFO:
205 case TC_SUBTYPE_UPDT_INFO:
206 if (length!=(TC_LEN_UPDT_INFO-CCSDS_TC_TM_PACKET_OFFSET)) {
206 if (length!=(TC_LEN_UPDT_INFO-CCSDS_TC_TM_PACKET_OFFSET)) {
207 ret = WRONG_LEN_PACKET;
207 ret = WRONG_LEN_PACKET;
208 }
208 }
209 else {
209 else {
210 ret = CCSDS_TM_VALID;
210 ret = CCSDS_TM_VALID;
211 }
211 }
212 break;
212 break;
213 case TC_SUBTYPE_EN_CAL:
213 case TC_SUBTYPE_EN_CAL:
214 if (length!=(TC_LEN_EN_CAL-CCSDS_TC_TM_PACKET_OFFSET)) {
214 if (length!=(TC_LEN_EN_CAL-CCSDS_TC_TM_PACKET_OFFSET)) {
215 ret = WRONG_LEN_PACKET;
215 ret = WRONG_LEN_PACKET;
216 }
216 }
217 else {
217 else {
218 ret = CCSDS_TM_VALID;
218 ret = CCSDS_TM_VALID;
219 }
219 }
220 break;
220 break;
221 case TC_SUBTYPE_DIS_CAL:
221 case TC_SUBTYPE_DIS_CAL:
222 if (length!=(TC_LEN_DIS_CAL-CCSDS_TC_TM_PACKET_OFFSET)) {
222 if (length!=(TC_LEN_DIS_CAL-CCSDS_TC_TM_PACKET_OFFSET)) {
223 ret = WRONG_LEN_PACKET;
223 ret = WRONG_LEN_PACKET;
224 }
224 }
225 else {
225 else {
226 ret = CCSDS_TM_VALID;
226 ret = CCSDS_TM_VALID;
227 }
227 }
228 break;
228 break;
229 default:
229 default:
230 ret = ILL_SUBTYPE;
230 ret = ILL_SUBTYPE;
231 break;
231 break;
232 }
232 }
233 }
233 }
234 else if (packetType == TC_TYPE_TIME){
234 else if (packetType == TC_TYPE_TIME){
235 if (packetSubtype!=TC_SUBTYPE_UPDT_TIME) {
235 if (packetSubtype!=TC_SUBTYPE_UPDT_TIME) {
236 ret = ILL_SUBTYPE;
236 ret = ILL_SUBTYPE;
237 }
237 }
238 else if (length!=(TC_LEN_UPDT_TIME-CCSDS_TC_TM_PACKET_OFFSET)) {
238 else if (length!=(TC_LEN_UPDT_TIME-CCSDS_TC_TM_PACKET_OFFSET)) {
239 ret = WRONG_LEN_PACKET;
239 ret = WRONG_LEN_PACKET;
240 }
240 }
241 else {
241 else {
242 ret = CCSDS_TM_VALID;
242 ret = CCSDS_TM_VALID;
243 }
243 }
244 }
244 }
245 else {
245 else {
246 ret = ILL_TYPE;
246 ret = ILL_TYPE;
247 }
247 }
248
248
249 // source ID check // Source ID not documented in the ICD
249 // source ID check // Source ID not documented in the ICD
250
250
251 // packet error control, CRC check
251 // packet error control, CRC check
252 if ( ret == CCSDS_TM_VALID ) {
252 if ( ret == CCSDS_TM_VALID ) {
253 CCSDSContent = (unsigned char*) TMPacket->packetID;
253 CCSDSContent = (unsigned char*) TMPacket->packetID;
254 GetCRCAsTwoBytes(CCSDSContent, currentTC_COMPUTED_CRC, length + CCSDS_TC_TM_PACKET_OFFSET - 2); // 2 CRC bytes removed from the calculation of the CRC
254 GetCRCAsTwoBytes(CCSDSContent, currentTC_COMPUTED_CRC, length + CCSDS_TC_TM_PACKET_OFFSET - 2); // 2 CRC bytes removed from the calculation of the CRC
255 if (currentTC_COMPUTED_CRC[0] != CCSDSContent[length + CCSDS_TC_TM_PACKET_OFFSET -2]) {
255 if (currentTC_COMPUTED_CRC[0] != CCSDSContent[length + CCSDS_TC_TM_PACKET_OFFSET -2]) {
256 ret = INCOR_CHECKSUM;
256 ret = INCOR_CHECKSUM;
257 }
257 }
258 else if (currentTC_COMPUTED_CRC[1] != CCSDSContent[length + CCSDS_TC_TM_PACKET_OFFSET -1]) {
258 else if (currentTC_COMPUTED_CRC[1] != CCSDSContent[length + CCSDS_TC_TM_PACKET_OFFSET -1]) {
259 ret = INCOR_CHECKSUM;
259 ret = INCOR_CHECKSUM;
260 }
260 }
261 else {
261 else {
262 ret = CCSDS_TM_VALID;
262 ret = CCSDS_TM_VALID;
263 }
263 }
264 }
264 }
265
265
266 return ret;
266 return ret;
267 }
267 }
268
268
269 unsigned char TM_build_header( enum TM_TYPE tm_type, unsigned int packetLength,
269 unsigned char TM_build_header( enum TM_TYPE tm_type, unsigned int packetLength,
270 unsigned int coarseTime, unsigned int fineTime, TMHeader_t *TMHeader)
270 unsigned int coarseTime, unsigned int fineTime, TMHeader_t *TMHeader)
271 {
271 {
272 TMHeader->targetLogicalAddress = CCSDS_DESTINATION_ID;
272 TMHeader->targetLogicalAddress = CCSDS_DESTINATION_ID;
273 TMHeader->protocolIdentifier = 0x02;
273 TMHeader->protocolIdentifier = 0x02;
274 TMHeader->reserved = 0x00;
274 TMHeader->reserved = 0x00;
275 TMHeader->userApplication = 0x00;
275 TMHeader->userApplication = 0x00;
276 TMHeader->packetID[0] = 0x0c;
276 TMHeader->packetID[0] = 0x0c;
277 TMHeader->packetSequenceControl[0] = 0xc0;
277 TMHeader->packetSequenceControl[0] = 0xc0;
278 TMHeader->packetSequenceControl[1] = 0x00;
278 TMHeader->packetSequenceControl[1] = 0x00;
279 TMHeader->packetLength[0] = (unsigned char) (packetLength>>8);
279 TMHeader->packetLength[0] = (unsigned char) (packetLength>>8);
280 TMHeader->packetLength[1] = (unsigned char) packetLength;
280 TMHeader->packetLength[1] = (unsigned char) packetLength;
281 TMHeader->dataFieldHeader[0] = 0x10;
281 TMHeader->dataFieldHeader[0] = 0x10;
282 TMHeader->dataFieldHeader[3] = CCSDS_DESTINATION_ID;
282 TMHeader->dataFieldHeader[3] = CCSDS_DESTINATION_ID;
283 switch (tm_type){
283 switch (tm_type){
284 case(TM_LFR_TC_EXE_OK):
284 case(TM_LFR_TC_EXE_OK):
285 TMHeader->packetID[1] = 0xc1;
285 TMHeader->packetID[1] = 0xc1;
286 TMHeader->dataFieldHeader[1] = 1; // type
286 TMHeader->dataFieldHeader[1] = 1; // type
287 TMHeader->dataFieldHeader[2] = 7; // subtype
287 TMHeader->dataFieldHeader[2] = 7; // subtype
288 break;
288 break;
289 case(TM_LFR_TC_EXE_ERR):
289 case(TM_LFR_TC_EXE_ERR):
290 TMHeader->packetID[1] = 0xc1;
290 TMHeader->packetID[1] = 0xc1;
291 TMHeader->dataFieldHeader[1] = 1; // type
291 TMHeader->dataFieldHeader[1] = 1; // type
292 TMHeader->dataFieldHeader[2] = 8; // subtype
292 TMHeader->dataFieldHeader[2] = 8; // subtype
293 break;
293 break;
294 case(TM_LFR_HK):
294 case(TM_LFR_HK):
295 TMHeader->packetID[1] = 0xc4;
295 TMHeader->packetID[1] = 0xc4;
296 TMHeader->dataFieldHeader[1] = 3; // type
296 TMHeader->dataFieldHeader[1] = 3; // type
297 TMHeader->dataFieldHeader[2] = 25; // subtype
297 TMHeader->dataFieldHeader[2] = 25; // subtype
298 break;
298 break;
299 case(TM_LFR_SCI):
299 case(TM_LFR_SCI):
300 TMHeader->packetID[1] = 0xcc;
300 TMHeader->packetID[1] = 0xcc;
301 TMHeader->dataFieldHeader[1] = 21; // type
301 TMHeader->dataFieldHeader[1] = 21; // type
302 TMHeader->dataFieldHeader[2] = 3; // subtype
302 TMHeader->dataFieldHeader[2] = 3; // subtype
303 break;
303 break;
304 case(TM_LFR_SCI_SBM):
304 case(TM_LFR_SCI_SBM):
305 TMHeader->packetID[1] = 0xfc;
305 TMHeader->packetID[1] = 0xfc;
306 TMHeader->dataFieldHeader[1] = 21; // type
306 TMHeader->dataFieldHeader[1] = 21; // type
307 TMHeader->dataFieldHeader[2] = 3; // subtype
307 TMHeader->dataFieldHeader[2] = 3; // subtype
308 break;
308 break;
309 case(TM_LFR_PAR_DUMP):
309 case(TM_LFR_PAR_DUMP):
310 TMHeader->packetID[1] = 0xc9;
310 TMHeader->packetID[1] = 0xc9;
311 TMHeader->dataFieldHeader[1] = 181; // type
311 TMHeader->dataFieldHeader[1] = 181; // type
312 TMHeader->dataFieldHeader[2] = 31; // subtype
312 TMHeader->dataFieldHeader[2] = 31; // subtype
313 break;
313 break;
314 default:
314 default:
315 return 0;
315 return 0;
316 }
316 }
317 TMHeader->dataFieldHeader[4] = (unsigned char) (time_management_regs->coarse_time>>24);
317 TMHeader->dataFieldHeader[4] = (unsigned char) (time_management_regs->coarse_time>>24);
318 TMHeader->dataFieldHeader[5] = (unsigned char) (time_management_regs->coarse_time>>16);
318 TMHeader->dataFieldHeader[5] = (unsigned char) (time_management_regs->coarse_time>>16);
319 TMHeader->dataFieldHeader[6] = (unsigned char) (time_management_regs->coarse_time>>8);
319 TMHeader->dataFieldHeader[6] = (unsigned char) (time_management_regs->coarse_time>>8);
320 TMHeader->dataFieldHeader[7] = (unsigned char) (time_management_regs->coarse_time);
320 TMHeader->dataFieldHeader[7] = (unsigned char) (time_management_regs->coarse_time);
321 TMHeader->dataFieldHeader[8] = (unsigned char) (time_management_regs->fine_time>>8);
321 TMHeader->dataFieldHeader[8] = (unsigned char) (time_management_regs->fine_time>>8);
322 TMHeader->dataFieldHeader[9] = (unsigned char) (time_management_regs->fine_time);
322 TMHeader->dataFieldHeader[9] = (unsigned char) (time_management_regs->fine_time);
323 return 1;
323 return 1;
324 }
324 }
325
325
326 unsigned char TM_build_header_bis( enum TM_TYPE tm_type, unsigned int packetLength,
326 unsigned char TM_build_header_bis( enum TM_TYPE tm_type, unsigned int packetLength,
327 unsigned int coarseTime, unsigned int fineTime, Packet_TM_LFR_TC_EXE_t *packet)
327 unsigned int coarseTime, unsigned int fineTime, Packet_TM_LFR_TC_EXE_t *packet)
328 {
328 {
329
329
330 packet->targetLogicalAddress = CCSDS_DESTINATION_ID;
330 packet->targetLogicalAddress = CCSDS_DESTINATION_ID;
331 packet->protocolIdentifier = 0x02;
331 packet->protocolIdentifier = 0x02;
332 packet->reserved = 0x00;
332 packet->reserved = 0x00;
333 packet->userApplication = 0x00;
333 packet->userApplication = 0x00;
334 packet->packetID[0] = 0x0c;
334 packet->packetID[0] = 0x0c;
335 packet->packetSequenceControl[0] = 0xc0;
335 packet->packetSequenceControl[0] = 0xc0;
336 packet->packetSequenceControl[1] = 0x00;
336 packet->packetSequenceControl[1] = 0x00;
337 packet->packetLength[0] = (unsigned char) (packetLength>>8);
337 packet->packetLength[0] = (unsigned char) (packetLength>>8);
338 packet->packetLength[1] = (unsigned char) packetLength;
338 packet->packetLength[1] = (unsigned char) packetLength;
339 packet->dataFieldHeader[0] = 0x10;
339 packet->dataFieldHeader[0] = 0x10;
340 packet->dataFieldHeader[3] = CCSDS_DESTINATION_ID;
340 packet->dataFieldHeader[3] = CCSDS_DESTINATION_ID;
341 switch (tm_type){
341 switch (tm_type){
342 case(TM_LFR_TC_EXE_OK):
342 case(TM_LFR_TC_EXE_OK):
343 packet->packetID[1] = 0xc1;
343 packet->packetID[1] = 0xc1;
344 packet->dataFieldHeader[1] = 1; // type
344 packet->dataFieldHeader[1] = 1; // type
345 packet->dataFieldHeader[2] = 7; // subtype
345 packet->dataFieldHeader[2] = 7; // subtype
346 break;
346 break;
347 case(TM_LFR_TC_EXE_ERR):
347 case(TM_LFR_TC_EXE_ERR):
348 packet->packetID[1] = 0xc1;
348 packet->packetID[1] = 0xc1;
349 packet->dataFieldHeader[1] = 1; // type
349 packet->dataFieldHeader[1] = 1; // type
350 packet->dataFieldHeader[2] = 8; // subtype
350 packet->dataFieldHeader[2] = 8; // subtype
351 break;
351 break;
352 case(TM_LFR_HK):
352 case(TM_LFR_HK):
353 packet->packetID[1] = 0xc4;
353 packet->packetID[1] = 0xc4;
354 packet->dataFieldHeader[1] = 3; // type
354 packet->dataFieldHeader[1] = 3; // type
355 packet->dataFieldHeader[2] = 25; // subtype
355 packet->dataFieldHeader[2] = 25; // subtype
356 break;
356 break;
357 case(TM_LFR_SCI):
357 case(TM_LFR_SCI):
358 packet->packetID[1] = 0xcc;
358 packet->packetID[1] = 0xcc;
359 packet->dataFieldHeader[1] = 21; // type
359 packet->dataFieldHeader[1] = 21; // type
360 packet->dataFieldHeader[2] = 3; // subtype
360 packet->dataFieldHeader[2] = 3; // subtype
361 break;
361 break;
362 case(TM_LFR_SCI_SBM):
362 case(TM_LFR_SCI_SBM):
363 packet->packetID[1] = 0xfc;
363 packet->packetID[1] = 0xfc;
364 packet->dataFieldHeader[1] = 21; // type
364 packet->dataFieldHeader[1] = 21; // type
365 packet->dataFieldHeader[2] = 3; // subtype
365 packet->dataFieldHeader[2] = 3; // subtype
366 break;
366 break;
367 case(TM_LFR_PAR_DUMP):
367 case(TM_LFR_PAR_DUMP):
368 packet->packetID[1] = 0xc9;
368 packet->packetID[1] = 0xc9;
369 packet->dataFieldHeader[1] = 181; // type
369 packet->dataFieldHeader[1] = 181; // type
370 packet->dataFieldHeader[2] = 31; // subtype
370 packet->dataFieldHeader[2] = 31; // subtype
371 break;
371 break;
372 default:
372 default:
373 return 0;
373 return 0;
374 }
374 }
375 packet->dataFieldHeader[4] = (unsigned char) (time_management_regs->coarse_time>>24);
375 packet->dataFieldHeader[4] = (unsigned char) (time_management_regs->coarse_time>>24);
376 packet->dataFieldHeader[5] = (unsigned char) (time_management_regs->coarse_time>>16);
376 packet->dataFieldHeader[5] = (unsigned char) (time_management_regs->coarse_time>>16);
377 packet->dataFieldHeader[6] = (unsigned char) (time_management_regs->coarse_time>>8);
377 packet->dataFieldHeader[6] = (unsigned char) (time_management_regs->coarse_time>>8);
378 packet->dataFieldHeader[7] = (unsigned char) (time_management_regs->coarse_time);
378 packet->dataFieldHeader[7] = (unsigned char) (time_management_regs->coarse_time);
379 packet->dataFieldHeader[8] = (unsigned char) (time_management_regs->fine_time>>8);
379 packet->dataFieldHeader[8] = (unsigned char) (time_management_regs->fine_time>>8);
380 packet->dataFieldHeader[9] = (unsigned char) (time_management_regs->fine_time);
380 packet->dataFieldHeader[9] = (unsigned char) (time_management_regs->fine_time);
381 return 1;
381 return 1;
382 }
382 }
383
383
384 unsigned char TM_build_data(ccsdsTelecommandPacket_t *TC, char* data, unsigned int SID, unsigned char *computed_CRC)
384 unsigned char TM_build_data(ccsdsTelecommandPacket_t *TC, char* data, unsigned int SID, unsigned char *computed_CRC)
385 {
385 {
386 unsigned int packetLength;
386 unsigned int packetLength;
387 packetLength = (TC->packetLength[0] * 256) + TC->packetLength[1];
387 packetLength = (TC->packetLength[0] * 256) + TC->packetLength[1];
388 switch (SID){
388 switch (SID){
389 case (SID_NOT_EXE):
389 case (SID_NOT_EXE):
390 break;
390 break;
391 case (SID_NOT_IMP):
391 case (SID_NOT_IMP):
392 data[0] = 0x9c;
392 data[0] = 0x9c;
393 data[1] = 0x42;
393 data[1] = 0x42;
394 data[2] = TC->packetID[0];
394 data[2] = TC->packetID[0];
395 data[3] = TC->packetID[1];
395 data[3] = TC->packetID[1];
396 data[4] = TC->packetSequenceControl[0];
396 data[4] = TC->packetSequenceControl[0];
397 data[5] = TC->packetSequenceControl[1];
397 data[5] = TC->packetSequenceControl[1];
398 data[6] = TC->dataFieldHeader[1]; // type
398 data[6] = TC->dataFieldHeader[1]; // type
399 data[7] = TC->dataFieldHeader[2]; // subtype
399 data[7] = TC->dataFieldHeader[2]; // subtype
400 break;
400 break;
401 case (SID_EXE_ERR):
401 case (SID_EXE_ERR):
402 break;
402 break;
403 case (SID_EXE_CORR):
403 case (SID_EXE_CORR):
404 data[0] = 0x9c;
404 data[0] = 0x9c;
405 data[1] = 0x45;
405 data[1] = 0x45;
406 data[2] = TC->packetID[0];
406 data[2] = TC->packetID[0];
407 data[3] = TC->packetID[1];
407 data[3] = TC->packetID[1];
408 data[4] = TC->packetSequenceControl[0];
408 data[4] = TC->packetSequenceControl[0];
409 data[5] = TC->packetSequenceControl[1];
409 data[5] = TC->packetSequenceControl[1];
410 data[6] = TC->dataFieldHeader[1]; // type
410 data[6] = TC->dataFieldHeader[1]; // type
411 data[7] = TC->dataFieldHeader[2]; // subtype
411 data[7] = TC->dataFieldHeader[2]; // subtype
412 data[8] = currentTC_LEN_RCV[0];
412 data[8] = currentTC_LEN_RCV[0];
413 data[9] = currentTC_LEN_RCV[1];
413 data[9] = currentTC_LEN_RCV[1];
414 data[10] = TC->packetLength[0];
414 data[10] = TC->packetLength[0];
415 data[11] = TC->packetLength[1];
415 data[11] = TC->packetLength[1];
416 data[12] = TC->dataAndCRC[packetLength];
416 data[12] = TC->dataAndCRC[packetLength];
417 data[13] = TC->dataAndCRC[packetLength+1];
417 data[13] = TC->dataAndCRC[packetLength+1];
418 data[14] = computed_CRC[0];
418 data[14] = computed_CRC[0];
419 data[15] = computed_CRC[1];
419 data[15] = computed_CRC[1];
420 break;
420 break;
421 default:
421 default:
422 return 0;
422 return 0;
423 }
423 }
424 return 1;
424 return 1;
425 }
425 }
426
426
427 int create_message_queue( void )
427 int create_message_queue( void )
428 {
428 {
429 rtems_status_code status;
429 rtems_status_code status;
430 misc_name[0] = rtems_build_name( 'Q', 'U', 'E', 'U' );
430 misc_name[0] = rtems_build_name( 'Q', 'U', 'E', 'U' );
431 status = rtems_message_queue_create( misc_name[0], ACTION_MSG_QUEUE_COUNT, CCSDS_TC_PKT_MAX_SIZE,
431 status = rtems_message_queue_create( misc_name[0], ACTION_MSG_QUEUE_COUNT, CCSDS_TC_PKT_MAX_SIZE,
432 RTEMS_FIFO | RTEMS_LOCAL, &misc_id[0] );
432 RTEMS_FIFO | RTEMS_LOCAL, &misc_id[0] );
433 if (status!=RTEMS_SUCCESSFUL) {
433 if (status!=RTEMS_SUCCESSFUL) {
434 PRINTF("in create_message_queue *** error creating message queue\n")
434 PRINTF("in create_message_queue *** error creating message queue\n")
435 }
435 }
436
436
437 return 0;
437 return 0;
438 }
438 }
439
439
440 //***********
440 //***********
441 // RTEMS TASK
441 // RTEMS TASK
442 rtems_task recv_task( rtems_task_argument unused )
442 rtems_task recv_task( rtems_task_argument unused )
443 {
443 {
444 int len = 0;
444 int len = 0;
445 unsigned int i = 0;
445 unsigned int i = 0;
446 unsigned int data_length = 0;
446 unsigned int data_length = 0;
447 ccsdsTelecommandPacket_t currentTC;
447 ccsdsTelecommandPacket_t currentTC;
448 char data[100];
448 char data[100];
449
449
450 for(i=0; i<100; i++) data[i] = 0;
450 for(i=0; i<100; i++) data[i] = 0;
451
451
452 PRINTF("in RECV *** \n")
452 PRINTF("in RECV *** \n")
453
453
454 while(1)
454 while(1)
455 {
455 {
456 len = read(fdSPW, (char*) &currentTC, CCSDS_TC_PKT_MAX_SIZE); // the call to read is blocking
456 len = read(fdSPW, (char*) &currentTC, CCSDS_TC_PKT_MAX_SIZE); // the call to read is blocking
457 if (len == -1){ // error during the read call
457 if (len == -1){ // error during the read call
458 PRINTF("In RECV *** last read call returned -1\n")
458 PRINTF("In RECV *** last read call returned -1\n")
459 if (rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT ) != RTEMS_SUCCESSFUL) {
459 if (rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT ) != RTEMS_SUCCESSFUL) {
460 PRINTF("IN RECV *** Error: rtems_event_send SPW_LINKERR_EVENT\n")
460 PRINTF("IN RECV *** Error: rtems_event_send SPW_LINKERR_EVENT\n")
461 }
461 }
462 if (rtems_task_suspend(RTEMS_SELF) != RTEMS_SUCCESSFUL) {
462 if (rtems_task_suspend(RTEMS_SELF) != RTEMS_SUCCESSFUL) {
463 PRINTF("In RECV *** Error: rtems_task_suspend(RTEMS_SELF)\n")
463 PRINTF("In RECV *** Error: rtems_task_suspend(RTEMS_SELF)\n")
464 }
464 }
465 }
465 }
466 else {
466 else {
467 PRINTF1("Got pck of length %d\n", len+1)
467 PRINTF1("Got pck of length %d\n", len+1)
468 if ( (len+1) < CCSDS_TC_PKT_MIN_SIZE ) {
468 if ( (len+1) < CCSDS_TC_PKT_MIN_SIZE ) {
469 PRINTF("In RECV *** packet lenght too short\n")
469 PRINTF("In RECV *** packet lenght too short\n")
470 }
470 }
471 else {
471 else {
472 currentTC_LEN_RCV[0] = 0x00;
472 currentTC_LEN_RCV[0] = 0x00;
473 currentTC_LEN_RCV[1] = (unsigned char) (len - CCSDS_TC_TM_PACKET_OFFSET - 3); // build the corresponding packet size field
473 currentTC_LEN_RCV[1] = (unsigned char) (len - CCSDS_TC_TM_PACKET_OFFSET - 3); // build the corresponding packet size field
474 currentTC_LEN_RCV_AsUnsignedInt = (unsigned int) (len - CCSDS_TC_TM_PACKET_OFFSET - 3); // => -3 is for Prot ID, Reserved and User App bytes
474 currentTC_LEN_RCV_AsUnsignedInt = (unsigned int) (len - CCSDS_TC_TM_PACKET_OFFSET - 3); // => -3 is for Prot ID, Reserved and User App bytes
475 // CHECK THE TC AND BUILD THE APPROPRIATE TM
475 // CHECK THE TC AND BUILD THE APPROPRIATE TM
476 data_length = TC_checker(&currentTC, currentTC_LEN_RCV_AsUnsignedInt);
476 data_length = TC_checker(&currentTC, currentTC_LEN_RCV_AsUnsignedInt);
477 if (data_length!=-1)
477 if (data_length!=-1)
478 {
478 {
479 }
479 }
480 }
480 }
481 }
481 }
482 }
482 }
483 }
483 }
484
484
485 rtems_task actn_task( rtems_task_argument unused )
485 rtems_task actn_task( rtems_task_argument unused )
486 {
486 {
487 int result = 0;
487 int result = 0;
488 unsigned int val;
488 unsigned int val;
489 rtems_status_code status; // RTEMS status code
489 rtems_status_code status; // RTEMS status code
490 ccsdsTelecommandPacket_t TC; // TC sent to the ACTN task
490 ccsdsTelecommandPacket_t TC; // TC sent to the ACTN task
491 size_t size; // size of the incoming TC packet
491 size_t size; // size of the incoming TC packet
492 unsigned char subtype = 0; // subtype of the current TC packet
492 unsigned char subtype = 0; // subtype of the current TC packet
493
493
494 PRINTF("in ACTN *** \n")
494 PRINTF("in ACTN *** \n")
495
495
496 while(1)
496 while(1)
497 {
497 {
498 status = rtems_message_queue_receive(misc_id[0], (char*) &TC, &size,
498 status = rtems_message_queue_receive(misc_id[0], (char*) &TC, &size,
499 RTEMS_WAIT, RTEMS_NO_TIMEOUT);
499 RTEMS_WAIT, RTEMS_NO_TIMEOUT);
500 if (status!=RTEMS_SUCCESSFUL) PRINTF1("in task ACTN *** error receiving a message, code %d \n", status)
500 if (status!=RTEMS_SUCCESSFUL) PRINTF1("ERR *** in task ACTN *** error receiving a message, code %d \n", status)
501 else
501 else
502 {
502 {
503 subtype = TC.dataFieldHeader[2];
503 subtype = TC.dataFieldHeader[2];
504 switch(subtype)
504 switch(subtype)
505 {
505 {
506 case TC_SUBTYPE_RESET:
506 case TC_SUBTYPE_RESET:
507 result = action_default( &TC );
507 result = action_default( &TC );
508 break;
508 break;
509 //
509 //
510 case TC_SUBTYPE_LOAD_COMM:
510 case TC_SUBTYPE_LOAD_COMM:
511 result = action_load_comm( &TC );
511 result = action_load_comm( &TC );
512 close_action( &TC, result );
512 close_action( &TC, result );
513 break;
513 break;
514 //
514 //
515 case TC_SUBTYPE_LOAD_NORM:
515 case TC_SUBTYPE_LOAD_NORM:
516 result = action_load_norm( &TC );
516 result = action_load_norm( &TC );
517 close_action( &TC, result );
517 close_action( &TC, result );
518 break;
518 break;
519 //
519 //
520 case TC_SUBTYPE_LOAD_BURST:
520 case TC_SUBTYPE_LOAD_BURST:
521 result = action_default( &TC );
521 result = action_default( &TC );
522 close_action( &TC, result );
522 close_action( &TC, result );
523 break;
523 break;
524 //
524 //
525 case TC_SUBTYPE_LOAD_SBM1:
525 case TC_SUBTYPE_LOAD_SBM1:
526 result = action_default( &TC );
526 result = action_default( &TC );
527 close_action( &TC, result );
527 close_action( &TC, result );
528 break;
528 break;
529 //
529 //
530 case TC_SUBTYPE_LOAD_SBM2:
530 case TC_SUBTYPE_LOAD_SBM2:
531 result = action_default( &TC );
531 result = action_default( &TC );
532 close_action( &TC, result );
532 close_action( &TC, result );
533 break;
533 break;
534 //
534 //
535 case TC_SUBTYPE_DUMP:
535 case TC_SUBTYPE_DUMP:
536 result = action_default( &TC );
536 result = action_default( &TC );
537 close_action( &TC, result );
537 close_action( &TC, result );
538 break;
538 break;
539 //
539 //
540 case TC_SUBTYPE_ENTER:
540 case TC_SUBTYPE_ENTER:
541 if ( (housekeeping_packet.lfr_status_word[0] & 0xf0) != LFR_MODE_STANDBY)
542 {
543 status = stop_current_mode();
544 }
545 if (status != RTEMS_SUCCESSFUL)
546 {
547 PRINTF("ERR *** in task ACTN *** TC_SUBTYPE_ENTER *** stop_current_mode\n")
548 }
541 result = action_enter( &TC );
549 result = action_enter( &TC );
542 close_action( &TC, result );
550 close_action( &TC, result );
543 break;
551 break;
544 //
552 //
545 case TC_SUBTYPE_UPDT_INFO:
553 case TC_SUBTYPE_UPDT_INFO:
546 result = action_default( &TC );
554 result = action_default( &TC );
547 val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256
555 val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256
548 + housekeeping_packet.hk_lfr_update_info_tc_cnt[1];
556 + housekeeping_packet.hk_lfr_update_info_tc_cnt[1];
549 val++;
557 val++;
550 housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8);
558 housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8);
551 housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val);
559 housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val);
552 break;
560 break;
553 //
561 //
554 case TC_SUBTYPE_EN_CAL:
562 case TC_SUBTYPE_EN_CAL:
555 result = action_default( &TC );
563 result = action_default( &TC );
556 break;
564 break;
557 //
565 //
558 case TC_SUBTYPE_DIS_CAL:
566 case TC_SUBTYPE_DIS_CAL:
559 result = action_default( &TC );
567 result = action_default( &TC );
560 break;
568 break;
561 //
569 //
562 case TC_SUBTYPE_UPDT_TIME:
570 case TC_SUBTYPE_UPDT_TIME:
563 result = action_updt_time( &TC );
571 result = action_updt_time( &TC );
564 val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256
572 val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256
565 + housekeeping_packet.hk_lfr_update_time_tc_cnt[1];
573 + housekeeping_packet.hk_lfr_update_time_tc_cnt[1];
566 val++;
574 val++;
567 housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8);
575 housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8);
568 housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val);
576 housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val);
569 break;
577 break;
570 //
578 //
571 default:
579 default:
572 break;
580 break;
573 }
581 }
574 }
582 }
575 }
583 }
576 }
584 }
577
585
578 rtems_task dumb_task( rtems_task_argument unused )
586 rtems_task dumb_task( rtems_task_argument unused )
579 {
587 {
580 unsigned int coarse_time = 0;
588 unsigned int coarse_time = 0;
581 unsigned int fine_time = 0;
589 unsigned int fine_time = 0;
582 unsigned int indice = 0;
590 unsigned int indice = 0;
583 unsigned int shiftedIndice = 0;
591 unsigned int shiftedIndice = 0;
584 rtems_event_set event_out;
592 rtems_event_set event_out;
585
593
586 PRINTF("in DUMB *** \n")
594 PRINTF("in DUMB *** \n")
587
595
588 while(1){
596 while(1){
589 rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3 | RTEMS_EVENT_4,
597 rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3 | RTEMS_EVENT_4,
590 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT
598 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT
591 indice = 0;
599 indice = 0;
592 shiftedIndice = (unsigned int) event_out;
600 shiftedIndice = (unsigned int) event_out;
593 while(!(shiftedIndice & 0x0001))
601 while(!(shiftedIndice & 0x0001))
594 {
602 {
595 shiftedIndice = shiftedIndice >> 1;
603 shiftedIndice = shiftedIndice >> 1;
596 indice++;
604 indice++;
597 }
605 }
598 coarse_time = time_management_regs->coarse_time;
606 coarse_time = time_management_regs->coarse_time;
599 fine_time = time_management_regs->fine_time;
607 fine_time = time_management_regs->fine_time;
600 printf("in DUMB *** time = coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[indice]);
608 printf("in DUMB *** time = coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[indice]);
601 }
609 }
602 }
610 }
603
611
604 //***********
612 //***********
605 // TC ACTIONS
613 // TC ACTIONS
606
614
607 int action_default(ccsdsTelecommandPacket_t *TC)
615 int action_default(ccsdsTelecommandPacket_t *TC)
608 {
616 {
609 Packet_TM_LFR_TC_EXE_t packet;
617 Packet_TM_LFR_TC_EXE_t packet;
610
618
611 TM_build_header_bis( TM_LFR_TC_EXE_ERR, TM_LEN_NOT_IMP,
619 TM_build_header_bis( TM_LFR_TC_EXE_ERR, TM_LEN_NOT_IMP,
612 time_management_regs->coarse_time, time_management_regs->fine_time, &packet);
620 time_management_regs->coarse_time, time_management_regs->fine_time, &packet);
613
621
614 packet.data[0] = 0x9c;
622 packet.data[0] = 0x9c;
615 packet.data[1] = 0x42;
623 packet.data[1] = 0x42;
616 packet.data[2] = TC->packetID[0];
624 packet.data[2] = TC->packetID[0];
617 packet.data[3] = TC->packetID[1];
625 packet.data[3] = TC->packetID[1];
618 packet.data[4] = TC->packetSequenceControl[0];
626 packet.data[4] = TC->packetSequenceControl[0];
619 packet.data[5] = TC->packetSequenceControl[1];
627 packet.data[5] = TC->packetSequenceControl[1];
620 packet.data[6] = TC->dataFieldHeader[1]; // type
628 packet.data[6] = TC->dataFieldHeader[1]; // type
621 packet.data[7] = TC->dataFieldHeader[2]; // subtype
629 packet.data[7] = TC->dataFieldHeader[2]; // subtype
622
630
623 // SEND DATA
631 // SEND DATA
624 if (write ( fdSPW, &packet, LEN_TM_LFR_TC_EXE_NOT_IMP)==-1) {
632 if (write ( fdSPW, &packet, LEN_TM_LFR_TC_EXE_NOT_IMP)==-1) {
625 PRINTF("ERR *** in action_default *** send TM packet\n");
633 PRINTF("ERR *** in action_default *** send TM packet\n");
626 }
634 }
627
635
628 return LFR_DEFAULT;
636 return LFR_DEFAULT;
629 }
637 }
630
638
631 int action_enter(ccsdsTelecommandPacket_t *TC)
639 int action_enter(ccsdsTelecommandPacket_t *TC)
632 {
640 {
633 rtems_status_code status;
641 rtems_status_code status = RTEMS_SUCCESSFUL;
634 unsigned char lfr_mode = TC->dataAndCRC[1];
642 unsigned char lfr_mode = TC->dataAndCRC[1];
635 printf("enter mode %d\n", lfr_mode);
643 printf("enter mode %d\n", lfr_mode);
636 switch(lfr_mode)
644 switch(lfr_mode)
637 {
645 {
638 //********
646 //********
639 // STANDBY
647 // STANDBY
640 case(LFR_MODE_STANDBY):
648 case(LFR_MODE_STANDBY):
641 status = stop_current_mode();
642 if (status != RTEMS_SUCCESSFUL)
643 {
644 PRINTF("in action_enter *** error going back to STANDBY mode\n")
645 }
646 housekeeping_packet.lfr_status_word[0] = (unsigned char) ((LFR_MODE_STANDBY << 4) + 0x0d);
649 housekeeping_packet.lfr_status_word[0] = (unsigned char) ((LFR_MODE_STANDBY << 4) + 0x0d);
647 break;
650 break;
648
651
649 //******
652 //******
650 // NORMAL
653 // NORMAL
651 case(LFR_MODE_NORMAL):
654 case(LFR_MODE_NORMAL):
652 status = stop_current_mode();
653 status = enter_normal_mode();
655 status = enter_normal_mode();
654 if (status == RTEMS_SUCCESSFUL)
656 if (status == RTEMS_SUCCESSFUL)
655 {
657 {
656 housekeeping_packet.lfr_status_word[0] = (unsigned char) ((LFR_MODE_NORMAL << 4) + 0x0d);
658 housekeeping_packet.lfr_status_word[0] = (unsigned char) ((LFR_MODE_NORMAL << 4) + 0x0d);
657 }
659 }
658 break;
660 break;
659
661
660 //******
662 //******
661 // BURST
663 // BURST
662 case(LFR_MODE_BURST):
664 case(LFR_MODE_BURST):
663 status = stop_current_mode();
665 status = enter_burst_mode();
664 if (status == RTEMS_SUCCESSFUL)
666 if (status == RTEMS_SUCCESSFUL)
665 {
667 {
666 housekeeping_packet.lfr_status_word[0] = (unsigned char) ((LFR_MODE_BURST << 4) + 0x0d);
668 housekeeping_packet.lfr_status_word[0] = (unsigned char) ((LFR_MODE_BURST << 4) + 0x0d);
667 }
669 }
668 break;
670 break;
669
671
670 //*****
672 //*****
671 // SBM1
673 // SBM1
672 case(LFR_MODE_SBM1):
674 case(LFR_MODE_SBM1):
673 status = stop_current_mode();
674 status = enter_sbm1_mode();
675 status = enter_sbm1_mode();
675 if (status == RTEMS_SUCCESSFUL)
676 if (status == RTEMS_SUCCESSFUL)
676 {
677 {
677 housekeeping_packet.lfr_status_word[0] = (unsigned char) ((LFR_MODE_SBM1 << 4) + 0x0d);
678 housekeeping_packet.lfr_status_word[0] = (unsigned char) ((LFR_MODE_SBM1 << 4) + 0x0d);
678 }
679 }
679 break;
680 break;
680
681
681 //*****
682 //*****
682 // SBM2
683 // SBM2
683 case(LFR_MODE_SBM2):
684 case(LFR_MODE_SBM2):
684 status = stop_current_mode();
685 status = enter_sbm2_mode();
685 if (status == RTEMS_SUCCESSFUL)
686 if (status == RTEMS_SUCCESSFUL)
686 {
687 {
687 housekeeping_packet.lfr_status_word[0] = (unsigned char) ((LFR_MODE_SBM2 << 4) + 0x0d);
688 housekeeping_packet.lfr_status_word[0] = (unsigned char) ((LFR_MODE_SBM2 << 4) + 0x0d);
688 }
689 }
689 break;
690 break;
690
691
691 //********
692 //********
692 // DEFAULT
693 // DEFAULT
693 default:
694 default:
694 status = stop_current_mode();
695 housekeeping_packet.lfr_status_word[0] = (unsigned char) ((LFR_MODE_STANDBY << 4) + 0x0d);
695 if (status == RTEMS_SUCCESSFUL)
696 {
697 housekeeping_packet.lfr_status_word[0] = (unsigned char) ((LFR_MODE_STANDBY << 4) + 0x0d);
698 }
699 break;
696 break;
700 }
697 }
701 return status;
698 return status;
702 }
699 }
703
700
704 int stop_current_mode()
701 int stop_current_mode()
705 {
702 {
706 rtems_status_code status;
703 rtems_status_code status;
704
707 // mask all IRQ lines related to signal processing
705 // mask all IRQ lines related to signal processing
708 LEON_Mask_interrupt( IRQ_WF ); // mask waveform interrupt (coming from the timer VHDL IP)
706 LEON_Mask_interrupt( IRQ_WF ); // mask waveform interrupt (coming from the timer VHDL IP)
709 LEON_Mask_interrupt( IRQ_SM ); // mask spectral matrices interrupt (coming from the timer VHDL IP)
707 LEON_Mask_interrupt( IRQ_SM ); // mask spectral matrices interrupt (coming from the timer VHDL IP)
710 LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt
708 LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt
711
709
712 // clear all pending interruptions related to signal processing
710 // clear all pending interruptions related to signal processing
713 LEON_Clear_interrupt( IRQ_WF ); // clear waveform interrupt (coming from the timer VHDL IP)
711 LEON_Clear_interrupt( IRQ_WF ); // clear waveform interrupt (coming from the timer VHDL IP)
714 LEON_Clear_interrupt( IRQ_SM ); // clear spectral matrices interrupt (coming from the timer VHDL IP)
712 LEON_Clear_interrupt( IRQ_SM ); // clear spectral matrices interrupt (coming from the timer VHDL IP)
715 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt
713 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt
716
714
717 // suspend several tasks
715 // suspend several tasks
718 status = suspend_if_needed( Task_id[TASKID_AVF0] );
716
717 status = rtems_task_suspend( Task_id[TASKID_AVF0] );
719 if (status == RTEMS_SUCCESSFUL) {
718 if (status == RTEMS_SUCCESSFUL) {
720 status = suspend_if_needed( Task_id[TASKID_BPF0] );
719 status = rtems_task_suspend( Task_id[TASKID_BPF0] );
721 if (status == RTEMS_SUCCESSFUL) {
720 if (status == RTEMS_SUCCESSFUL) {
722 status = suspend_if_needed( Task_id[TASKID_WFRM] );
721 status = rtems_task_suspend( Task_id[TASKID_WFRM] );
723 }
722 }
724 }
723 }
725
724
725 if (status != RTEMS_SUCCESSFUL)
726 {
727 PRINTF("ERR *** in stop_current_mode *** suspending tasks\n")
728 }
729
726 // initialize the registers
730 // initialize the registers
727 waveform_picker_regs->burst_enable = 0x00; // initialize
731 waveform_picker_regs->burst_enable = 0x00; // initialize
728
732
729 return status;
733 return status;
730 }
734 }
731
735
732 int enter_normal_mode()
736 int enter_normal_mode()
733 {
737 {
734 rtems_status_code status;
738 rtems_status_code status;
735
739
736 status = restart_if_needed( Task_id[TASKID_AVF0] );
740 status = rtems_task_restart( Task_id[TASKID_AVF0], 0 );
737 if (status == RTEMS_SUCCESSFUL) {
741 if (status == RTEMS_SUCCESSFUL) {
738 status = restart_if_needed( Task_id[TASKID_BPF0] );
742 status = rtems_task_restart( Task_id[TASKID_BPF0], 0 );
739 if (status == RTEMS_SUCCESSFUL) {
743 if (status == RTEMS_SUCCESSFUL) {
740 status = restart_if_needed( Task_id[TASKID_WFRM] );
744 status = rtems_task_restart( Task_id[TASKID_WFRM], 0 );
741 }
745 }
742 }
746 }
743
747
744 #ifdef GSA
748 #ifdef GSA
745 LEON_Unmask_interrupt( IRQ_WF );
749 LEON_Unmask_interrupt( IRQ_WF );
746 #else
750 #else
747 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
751 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
748 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
752 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
749 waveform_picker_regs->burst_enable = 0x07;
753 waveform_picker_regs->burst_enable = 0x07;
750 waveform_picker_regs->addr_data_f1 = (int) wf_snap_f1;
754 waveform_picker_regs->addr_data_f1 = (int) wf_snap_f1;
751 waveform_picker_regs->status = 0x00;
755 waveform_picker_regs->status = 0x00;
752 #endif
756 #endif
753 LEON_Unmask_interrupt( IRQ_SM );
757 LEON_Unmask_interrupt( IRQ_SM );
754
758
755 return status;
759 return status;
756 }
760 }
757
761
758 int enter_sbm1_mode()
762 int enter_burst_mode()
759 {
763 {
760 rtems_status_code status;
764 rtems_status_code status;
761 status = restart_if_needed( Task_id[TASKID_AVF0] );
765
766 status = rtems_task_restart( Task_id[TASKID_AVF0], 0 );
762 if (status == RTEMS_SUCCESSFUL) {
767 if (status == RTEMS_SUCCESSFUL) {
763 status = restart_if_needed( Task_id[TASKID_BPF0] );
768 status = rtems_task_restart( Task_id[TASKID_BPF0], 0 );
764 if (status == RTEMS_SUCCESSFUL) {
769 if (status == RTEMS_SUCCESSFUL) {
765 status = restart_if_needed( Task_id[TASKID_WFRM] );
770 status = rtems_task_restart( Task_id[TASKID_WFRM], 0 );
766 }
771 }
767 }
772 }
768
773
769 #ifdef GSA
774 #ifdef GSA
770 #else
775 #else
771 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
776 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
772 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
777 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
778 waveform_picker_regs->addr_data_f2 = (int) wf_snap_f2;
779 waveform_picker_regs->burst_enable = 0x40; // [0100 0000] burst f2, f1, f0 enable f3 f2 f1 f0
780 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x04;
781 waveform_picker_regs->status = 0x00;
782 #endif
783
784 LEON_Unmask_interrupt( IRQ_SM );
785 return status;
786 }
787
788 int enter_sbm1_mode()
789 {
790 rtems_status_code status;
791
792 status = rtems_task_restart( Task_id[TASKID_AVF0], 0 );
793 if (status == RTEMS_SUCCESSFUL) {
794 status = rtems_task_restart( Task_id[TASKID_BPF0], 0 );
795 if (status == RTEMS_SUCCESSFUL) {
796 status = rtems_task_restart( Task_id[TASKID_WFRM], 0 );
797 }
798 }
799
800 #ifdef GSA
801 #else
802 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
803 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
804 waveform_picker_regs->addr_data_f1 = (int) wf_snap_f1;
773 waveform_picker_regs->burst_enable = 0x20; // [0010 0000] burst f2, f1, f0 enable f3 f2 f1 f0
805 waveform_picker_regs->burst_enable = 0x20; // [0010 0000] burst f2, f1, f0 enable f3 f2 f1 f0
774 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x02;
806 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x02;
775 waveform_picker_regs->status = 0x00;
807 waveform_picker_regs->status = 0x00;
776 #endif
808 #endif
777 //LEON_Unmask_interrupt( IRQ_SM );
809
810 LEON_Unmask_interrupt( IRQ_SM );
811 return status;
812 }
813
814 int enter_sbm2_mode()
815 {
816 rtems_status_code status;
817
818 status = rtems_task_restart( Task_id[TASKID_AVF0], 0 );
819 if (status == RTEMS_SUCCESSFUL) {
820 status = rtems_task_restart( Task_id[TASKID_BPF0], 0 );
821 if (status == RTEMS_SUCCESSFUL) {
822 status = rtems_task_restart( Task_id[TASKID_WFRM], 0 );
823 }
824 }
825
826 #ifdef GSA
827 #else
828 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
829 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
830 waveform_picker_regs->addr_data_f2 = (int) wf_snap_f2;
831 waveform_picker_regs->burst_enable = 0x40; // [0100 0000] burst f2, f1, f0 enable f3 f2 f1 f0
832 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x04;
833 waveform_picker_regs->status = 0x00;
834 #endif
835
836 LEON_Unmask_interrupt( IRQ_SM );
778 return status;
837 return status;
779 }
838 }
780
839
781 int action_load_norm(ccsdsTelecommandPacket_t *TC)
840 int action_load_norm(ccsdsTelecommandPacket_t *TC)
782 {
841 {
783 param_norm.sy_lfr_n_swf_l = (TC->dataAndCRC[0] * 256) + TC->dataAndCRC[1];
842 param_norm.sy_lfr_n_swf_l = (TC->dataAndCRC[0] * 256) + TC->dataAndCRC[1];
784 param_norm.sy_lfr_n_swf_p = (TC->dataAndCRC[2] * 256) + TC->dataAndCRC[3];
843 param_norm.sy_lfr_n_swf_p = (TC->dataAndCRC[2] * 256) + TC->dataAndCRC[3];
785 param_norm.sy_lfr_n_asm_p = (TC->dataAndCRC[4] * 256) + TC->dataAndCRC[5];
844 param_norm.sy_lfr_n_asm_p = (TC->dataAndCRC[4] * 256) + TC->dataAndCRC[5];
786 param_norm.sy_lfr_n_bp_p0 = TC->dataAndCRC[6];
845 param_norm.sy_lfr_n_bp_p0 = TC->dataAndCRC[6];
787 param_norm.sy_lfr_n_bp_p1 = TC->dataAndCRC[7];
846 param_norm.sy_lfr_n_bp_p1 = TC->dataAndCRC[7];
788
847
789 return LFR_SUCCESSFUL;
848 return LFR_SUCCESSFUL;
790 }
849 }
791
850
792 int action_load_comm(ccsdsTelecommandPacket_t *TC)
851 int action_load_comm(ccsdsTelecommandPacket_t *TC)
793 {
852 {
794 param_common.sy_lfr_common0 = TC->dataAndCRC[0];
853 param_common.sy_lfr_common0 = TC->dataAndCRC[0];
795 param_common.sy_lfr_common1 = TC->dataAndCRC[1];
854 param_common.sy_lfr_common1 = TC->dataAndCRC[1];
796
855
797 set_data_shaping_parameters(param_common.sy_lfr_common1);
856 set_data_shaping_parameters(param_common.sy_lfr_common1);
798
857
799 return LFR_SUCCESSFUL;
858 return LFR_SUCCESSFUL;
800 }
859 }
801
860
802 int action_updt_time(ccsdsTelecommandPacket_t *TC)
861 int action_updt_time(ccsdsTelecommandPacket_t *TC)
803 {
862 {
804 time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24)
863 time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24)
805 + (TC->dataAndCRC[1] << 16)
864 + (TC->dataAndCRC[1] << 16)
806 + (TC->dataAndCRC[2] << 8)
865 + (TC->dataAndCRC[2] << 8)
807 + TC->dataAndCRC[3];
866 + TC->dataAndCRC[3];
808 //time_management_regs->ctrl = time_management_regs->ctrl | 1;
867 //time_management_regs->ctrl = time_management_regs->ctrl | 1;
809 return 0;
868 return 0;
810 }
869 }
811
870
812 int send_tm_lfr_tc_exe_success(ccsdsTelecommandPacket_t *TC)
871 int send_tm_lfr_tc_exe_success(ccsdsTelecommandPacket_t *TC)
813 {
872 {
814 TMHeader_t TM_header;
873 TMHeader_t TM_header;
815 char data[4];
874 char data[4];
816 spw_ioctl_pkt_send spw_ioctl_send;
875 spw_ioctl_pkt_send spw_ioctl_send;
817
876
818 TM_build_header( TM_LFR_TC_EXE_OK, TM_LEN_EXE,
877 TM_build_header( TM_LFR_TC_EXE_OK, TM_LEN_EXE,
819 time_management_regs->coarse_time, time_management_regs->fine_time, &TM_header);
878 time_management_regs->coarse_time, time_management_regs->fine_time, &TM_header);
820
879
821 data[0] = TC->packetID[0];
880 data[0] = TC->packetID[0];
822 data[1] = TC->packetID[1];
881 data[1] = TC->packetID[1];
823 data[2] = TC->packetSequenceControl[0];
882 data[2] = TC->packetSequenceControl[0];
824 data[3] = TC->packetSequenceControl[1];
883 data[3] = TC->packetSequenceControl[1];
825
884
826 // filling the structure for the spacewire transmission
885 // filling the structure for the spacewire transmission
827 spw_ioctl_send.hlen = TM_HEADER_LEN + 3; // + 4 is for the protocole extra header
886 spw_ioctl_send.hlen = TM_HEADER_LEN + 3; // + 4 is for the protocole extra header
828 spw_ioctl_send.hdr = (char*) &TM_header;
887 spw_ioctl_send.hdr = (char*) &TM_header;
829 spw_ioctl_send.dlen = 3;
888 spw_ioctl_send.dlen = 3;
830 spw_ioctl_send.data = data;
889 spw_ioctl_send.data = data;
831
890
832 // SEND DATA
891 // SEND DATA
833 write_spw(&spw_ioctl_send);
892 write_spw(&spw_ioctl_send);
834
893
835 return 0;
894 return 0;
836 }
895 }
837
896
838 rtems_status_code restart_if_needed(rtems_id id)
839 {
840 rtems_status_code status;
841
842 status = rtems_task_is_suspended( id );
843
844 if (status==RTEMS_SUCCESSFUL) {
845 status = rtems_task_restart( id, 0 );
846 if (status!=RTEMS_SUCCESSFUL) {
847 PRINTF1("in restart_if_needed *** Error restarting with id %d\n", (int) id)
848 }
849 }
850
851 return status;
852 }
853
854 rtems_status_code suspend_if_needed(rtems_id id)
855 {
856 rtems_status_code status;
857
858 status = rtems_task_is_suspended( id );
859
860 if (status!=RTEMS_SUCCESSFUL) {
861 status = rtems_task_suspend( id );
862 if (status!=RTEMS_SUCCESSFUL) {
863 PRINTF1("in suspend_if_needed *** Error suspending task with id %d\n", (int) id)
864 }
865 }
866
867 return status;
868 }
869
870 void update_last_TC_exe(ccsdsTelecommandPacket_t *TC)
897 void update_last_TC_exe(ccsdsTelecommandPacket_t *TC)
871 {
898 {
872 housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0];
899 housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0];
873 housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1];
900 housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1];
874 housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00;
901 housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00;
875 housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->dataFieldHeader[1];
902 housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->dataFieldHeader[1];
876 housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00;
903 housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00;
877 housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->dataFieldHeader[2];
904 housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->dataFieldHeader[2];
878 housekeeping_packet.hk_lfr_last_exe_tc_time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
905 housekeeping_packet.hk_lfr_last_exe_tc_time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
879 housekeeping_packet.hk_lfr_last_exe_tc_time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
906 housekeeping_packet.hk_lfr_last_exe_tc_time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
880 housekeeping_packet.hk_lfr_last_exe_tc_time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
907 housekeeping_packet.hk_lfr_last_exe_tc_time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
881 housekeeping_packet.hk_lfr_last_exe_tc_time[3] = (unsigned char) (time_management_regs->coarse_time);
908 housekeeping_packet.hk_lfr_last_exe_tc_time[3] = (unsigned char) (time_management_regs->coarse_time);
882 housekeeping_packet.hk_lfr_last_exe_tc_time[4] = (unsigned char) (time_management_regs->fine_time>>8);
909 housekeeping_packet.hk_lfr_last_exe_tc_time[4] = (unsigned char) (time_management_regs->fine_time>>8);
883 housekeeping_packet.hk_lfr_last_exe_tc_time[5] = (unsigned char) (time_management_regs->fine_time);
910 housekeeping_packet.hk_lfr_last_exe_tc_time[5] = (unsigned char) (time_management_regs->fine_time);
884 }
911 }
885
912
886 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC)
913 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC)
887 {
914 {
888 housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0];
915 housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0];
889 housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1];
916 housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1];
890 housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00;
917 housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00;
891 housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->dataFieldHeader[1];
918 housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->dataFieldHeader[1];
892 housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00;
919 housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00;
893 housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->dataFieldHeader[2];
920 housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->dataFieldHeader[2];
894 housekeeping_packet.hk_lfr_last_rej_tc_time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
921 housekeeping_packet.hk_lfr_last_rej_tc_time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
895 housekeeping_packet.hk_lfr_last_rej_tc_time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
922 housekeeping_packet.hk_lfr_last_rej_tc_time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
896 housekeeping_packet.hk_lfr_last_rej_tc_time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
923 housekeeping_packet.hk_lfr_last_rej_tc_time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
897 housekeeping_packet.hk_lfr_last_rej_tc_time[3] = (unsigned char) (time_management_regs->coarse_time);
924 housekeeping_packet.hk_lfr_last_rej_tc_time[3] = (unsigned char) (time_management_regs->coarse_time);
898 housekeeping_packet.hk_lfr_last_rej_tc_time[4] = (unsigned char) (time_management_regs->fine_time>>8);
925 housekeeping_packet.hk_lfr_last_rej_tc_time[4] = (unsigned char) (time_management_regs->fine_time>>8);
899 housekeeping_packet.hk_lfr_last_rej_tc_time[5] = (unsigned char) (time_management_regs->fine_time);
926 housekeeping_packet.hk_lfr_last_rej_tc_time[5] = (unsigned char) (time_management_regs->fine_time);
900 }
927 }
901
928
902 void close_action(ccsdsTelecommandPacket_t *TC, int result)
929 void close_action(ccsdsTelecommandPacket_t *TC, int result)
903 {
930 {
904 unsigned int val = 0;
931 unsigned int val = 0;
905 if (result == LFR_SUCCESSFUL)
932 if (result == LFR_SUCCESSFUL)
906 {
933 {
907 send_tm_lfr_tc_exe_success( TC );
934 send_tm_lfr_tc_exe_success( TC );
908 update_last_TC_exe( TC );
935 update_last_TC_exe( TC );
909 val = housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[0] * 256 + housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[1];
936 val = housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[0] * 256 + housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[1];
910 val++;
937 val++;
911 housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[0] = (unsigned char) (val >> 8);
938 housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[0] = (unsigned char) (val >> 8);
912 housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[1] = (unsigned char) (val);
939 housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[1] = (unsigned char) (val);
913 }
940 }
914 else
941 else
915 {
942 {
916 update_last_TC_rej( TC );
943 update_last_TC_rej( TC );
917 val = housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[0] * 256 + housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[1];
944 val = housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[0] * 256 + housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[1];
918 val++;
945 val++;
919 housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[0] = (unsigned char) (val >> 8);
946 housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[0] = (unsigned char) (val >> 8);
920 housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[1] = (unsigned char) (val);
947 housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[1] = (unsigned char) (val);
921 }
948 }
922 }
949 }
923
950
924 //***************************
951 //***************************
925 // Interrupt Service Routines
952 // Interrupt Service Routines
926 rtems_isr commutation_isr1( rtems_vector_number vector )
953 rtems_isr commutation_isr1( rtems_vector_number vector )
927 {
954 {
928 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
955 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
929 printf("In commutation_isr1 *** Error sending event to DUMB\n");
956 printf("In commutation_isr1 *** Error sending event to DUMB\n");
930 }
957 }
931 }
958 }
932
959
933 rtems_isr commutation_isr2( rtems_vector_number vector )
960 rtems_isr commutation_isr2( rtems_vector_number vector )
934 {
961 {
935 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
962 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
936 printf("In commutation_isr2 *** Error sending event to DUMB\n");
963 printf("In commutation_isr2 *** Error sending event to DUMB\n");
937 }
964 }
938 }
965 }
939
966
940
967
941
968
942
969
@@ -1,414 +1,452
1 #include <wf_handler.h>
1 #include <wf_handler.h>
2
2
3 rtems_isr waveforms_isr_alternative( rtems_vector_number vector )
4 {
5 if (waveform_picker_regs->burst_enable == 0x22) {
6 if (waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1) {
7 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_bis);
8 }
9 else {
10 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1);
11 }
12 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_2 ) != RTEMS_SUCCESSFUL) {
13 //rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
14 }
15 }
16 waveform_picker_regs->status = 0x00;
17 /*else if ( (waveform_picker_regs->burst_enable & 0x7) == 0x0 ){// if no channel is enable
18 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ) != RTEMS_SUCCESSFUL) {
19 printf("In timecode_irq_handler *** Error sending event to DUMB\n");
20 }
21 }
22 else {
23 if ( (waveform_picker_regs->status & 0x7) == 0x7 ){ // f2 f1 and f0 are full
24 waveform_picker_regs->burst_enable = 0x00;
25 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
26 printf("In waveforms_isr *** Error sending event to WFRM\n");
27 }
28 }
29 }*/
30 }
31
32 rtems_isr waveforms_isr( rtems_vector_number vector )
3 rtems_isr waveforms_isr( rtems_vector_number vector )
33 {
4 {
34 unsigned char lfrMode;
5 unsigned char lfrMode;
35 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
6 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
36
7
37 switch(lfrMode)
8 switch(lfrMode)
38 {
9 {
39 //********
10 //********
40 // STANDBY
11 // STANDBY
41 case(LFR_MODE_STANDBY):
12 case(LFR_MODE_STANDBY):
42 break;
13 break;
43
14
44 //******
15 //******
45 // NORMAL
16 // NORMAL
46 case(LFR_MODE_NORMAL):
17 case(LFR_MODE_NORMAL):
47 #ifdef GSA
18 #ifdef GSA
48 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
19 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
49 #else
20 #else
50 if ( (waveform_picker_regs->burst_enable & 0x7) == 0x0 ){// if no channel is enable
21 if ( (waveform_picker_regs->burst_enable & 0x7) == 0x0 ){// if no channel is enable
51 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ) != RTEMS_SUCCESSFUL) {
22 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ) != RTEMS_SUCCESSFUL) {
52 PRINTF("in waveform_isr *** Error sending event to DUMB\n");
23 PRINTF("in waveform_isr *** Error sending event to DUMB\n");
53 }
24 }
54 }
25 }
55 else {
26 else {
56 if ( (waveform_picker_regs->status & 0x7) == 0x7 ){ // f2 f1 and f0 are full
27 if ( (waveform_picker_regs->status & 0x7) == 0x7 ){ // f2 f1 and f0 are full
57 waveform_picker_regs->burst_enable = 0x00;
28 waveform_picker_regs->burst_enable = 0x00;
58 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
29 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
59 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ) != RTEMS_SUCCESSFUL) {
30 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ) != RTEMS_SUCCESSFUL) {
60 PRINTF("in waveform_isr *** Error sending event to DUMB\n");
31 PRINTF("in waveform_isr *** Error sending event to DUMB\n");
61 }
32 }
62 }
33 }
63 }
34 }
64 }
35 }
65 #endif
36 #endif
66 break;
37 break;
67
38
68 //******
39 //******
69 // BURST
40 // BURST
70 case(LFR_MODE_BURST):
41 case(LFR_MODE_BURST):
71 break;
42 break;
72
43
73 //*****
44 //*****
74 // SBM1
45 // SBM1
75 case(LFR_MODE_SBM1):
46 case(LFR_MODE_SBM1):
76 #ifdef GSA
47 #ifdef GSA
77 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
48 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
78 #else
49 #else
79 if (waveform_picker_regs->burst_enable == 0x22) {
50 if (waveform_picker_regs->burst_enable == 0x22) {
80 if (waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1) {
51 if (waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1) {
81 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_bis);
52 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_bis);
82 }
53 }
83 else {
54 else {
84 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1);
55 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1);
85 }
56 }
86 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM1 ) != RTEMS_SUCCESSFUL) {
57 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM1 ) != RTEMS_SUCCESSFUL) {
87 PRINTF("in waveforms_isr *** Error sending event to WFRM\n")
58 PRINTF("in waveforms_isr *** Error sending event to WFRM\n")
88 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
59 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
89 }
60 }
90 }
61 }
91 waveform_picker_regs->status = 0x00;
62 waveform_picker_regs->status = 0x00;
92 #endif
63 #endif
93 break;
64 break;
94
65
95 //*****
66 //*****
96 // SBM2
67 // SBM2
97 case(LFR_MODE_SBM2):
68 case(LFR_MODE_SBM2):
69 #ifdef GSA
70 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
71 #else
72 if (waveform_picker_regs->burst_enable == 0x44) {
73 if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) {
74 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_bis);
75 }
76 else {
77 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2);
78 }
79 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) {
80 PRINTF("in waveforms_isr *** Error sending event to WFRM\n")
81 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
82 }
83 }
84 waveform_picker_regs->status = 0x00;
85 #endif
98 break;
86 break;
99
87
100 //********
88 //********
101 // DEFAULT
89 // DEFAULT
102 default:
90 default:
103 break;
91 break;
104 }
92 }
105 }
93 }
106
94
107 rtems_isr waveforms_simulator_isr( rtems_vector_number vector )
95 rtems_isr waveforms_simulator_isr( rtems_vector_number vector )
108 {
96 {
109 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
97 unsigned char lfrMode;
110 printf("In waveforms_isr *** Error sending event to WFRM\n");
98 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
99
100 switch(lfrMode)
101 {
102 //********
103 // STANDBY
104 case(LFR_MODE_STANDBY):
105 break;
106
107 //******
108 // NORMAL
109 case(LFR_MODE_NORMAL):
110 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
111 PRINTF("ERR *** in waveforms_isr *** error sending event to WFRM\n");
112 }
113 break;
114
115 //******
116 // BURST
117 case(LFR_MODE_BURST):
118 break;
119
120 //*****
121 // SBM1
122 case(LFR_MODE_SBM1):
123 break;
124
125 //*****
126 // SBM2
127 case(LFR_MODE_SBM2):
128 break;
129
130 //********
131 // DEFAULT
132 default:
133 break;
111 }
134 }
112 }
135 }
113
136
114 rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
137 rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
115 {
138 {
116 spw_ioctl_pkt_send spw_ioctl_send;
139 spw_ioctl_pkt_send spw_ioctl_send;
117 rtems_event_set event_out;
140 rtems_event_set event_out;
118 ExtendedTMHeader_t header;
141 ExtendedTMHeader_t header;
119
142
120 header.targetLogicalAddress = CCSDS_DESTINATION_ID;
143 header.targetLogicalAddress = CCSDS_DESTINATION_ID;
121 header.protocolIdentifier = CCSDS_PROTOCOLE_ID;
144 header.protocolIdentifier = CCSDS_PROTOCOLE_ID;
122 header.reserved = 0x00;
145 header.reserved = 0x00;
123 header.userApplication = CCSDS_USER_APP;
146 header.userApplication = CCSDS_USER_APP;
124 header.packetID[0] = 0x0c;
147 header.packetID[0] = 0x0c;
125 header.packetID[1] = 0xcc;
148 header.packetID[1] = 0xcc;
126 header.packetSequenceControl[0] = 0x00;
149 header.packetSequenceControl[0] = 0x00;
127 header.packetSequenceControl[1] = 0x00;
150 header.packetSequenceControl[1] = 0x00;
128 header.packetLength[0] = 0x00;
151 header.packetLength[0] = 0x00;
129 header.packetLength[1] = 0x00;
152 header.packetLength[1] = 0x00;
130 header.dataFieldHeader[0] = 0x10;
153 header.dataFieldHeader[0] = 0x10;
131 header.dataFieldHeader[1] = TM_TYPE_LFR_SCIENCE; // service type
154 header.dataFieldHeader[1] = TM_TYPE_LFR_SCIENCE; // service type
132 header.dataFieldHeader[2] = TM_SUBTYPE_LFR_SCIENCE; // service subtype
155 header.dataFieldHeader[2] = TM_SUBTYPE_LFR_SCIENCE; // service subtype
133 header.dataFieldHeader[3] = CCSDS_DESTINATION_ID_GROUND;
156 header.dataFieldHeader[3] = CCSDS_DESTINATION_ID_GROUND;
134
157
135 header.auxiliaryHeader[0] = 0x00;
158 header.auxiliaryHeader[0] = 0x00;
136 header.auxiliaryHeader[1] = 0x1f;
159 header.auxiliaryHeader[1] = 0x1f;
137 header.auxiliaryHeader[2] = 0x07; // PKT_CNT
160 header.auxiliaryHeader[2] = 0x07; // PKT_CNT
138 header.auxiliaryHeader[3] = 0x00; // PKT_NR
161 header.auxiliaryHeader[3] = 0x00; // PKT_NR
139 header.auxiliaryHeader[4] = 0x00; // BLK_NR MSB
162 header.auxiliaryHeader[4] = 0x00; // BLK_NR MSB
140 header.auxiliaryHeader[5] = 0x00; // BLK_NR LSB
163 header.auxiliaryHeader[5] = 0x00; // BLK_NR LSB
141
164
142 // BUILD THE PACKET HEADER
165 // BUILD THE PACKET HEADER
143 spw_ioctl_send.hlen = TM_HEADER_LEN + 4 + 6; // + 4 is for the protocole extra header, + 6 is for the auxiliary header
166 spw_ioctl_send.hlen = TM_HEADER_LEN + 4 + 6; // + 4 is for the protocole extra header, + 6 is for the auxiliary header
144 spw_ioctl_send.hdr = (char*) &header;
167 spw_ioctl_send.hdr = (char*) &header;
145
168
146 init_waveforms();
169 init_waveforms();
147
170
148 PRINTF("in WFRM ***\n")
171 PRINTF("in WFRM ***\n")
149
172
150 while(1){
173 while(1){
151 // wait for an RTEMS_EVENT
174 // wait for an RTEMS_EVENT
152 rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3 | RTEMS_EVENT_4,
175 rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3 | RTEMS_EVENT_4,
153 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
176 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
154 header.dataFieldHeader[4] = (unsigned char) (time_management_regs->coarse_time>>24);
177 header.dataFieldHeader[4] = (unsigned char) (time_management_regs->coarse_time>>24);
155 header.dataFieldHeader[5] = (unsigned char) (time_management_regs->coarse_time>>16);
178 header.dataFieldHeader[5] = (unsigned char) (time_management_regs->coarse_time>>16);
156 header.dataFieldHeader[6] = (unsigned char) (time_management_regs->coarse_time>>8);
179 header.dataFieldHeader[6] = (unsigned char) (time_management_regs->coarse_time>>8);
157 header.dataFieldHeader[7] = (unsigned char) (time_management_regs->coarse_time);
180 header.dataFieldHeader[7] = (unsigned char) (time_management_regs->coarse_time);
158 header.dataFieldHeader[8] = (unsigned char) (time_management_regs->fine_time>>8);
181 header.dataFieldHeader[8] = (unsigned char) (time_management_regs->fine_time>>8);
159 header.dataFieldHeader[9] = (unsigned char) (time_management_regs->fine_time);
182 header.dataFieldHeader[9] = (unsigned char) (time_management_regs->fine_time);
160
183
161 switch(event_out)
184 switch(event_out)
162 {
185 {
163 //********
186 //********
164 // STANDBY
187 // STANDBY
165 case(RTEMS_EVENT_MODE_STANDBY):
188 case(RTEMS_EVENT_MODE_STANDBY):
166 break;
189 break;
167
190
168 //*******
191 //*******
169 // NORMAL
192 // NORMAL
170 case(RTEMS_EVENT_MODE_NORMAL):
193 case(RTEMS_EVENT_MODE_NORMAL):
171 //***************
194 //***************
172 // send snapshots
195 // send snapshots
173 // F0
196 // F0
174 send_waveform( &header, wf_snap_f0, SID_NORM_SWF_F0, &spw_ioctl_send);
197 send_waveform( &header, wf_snap_f0, SID_NORM_SWF_F0, &spw_ioctl_send);
175 // F1
198 // F1
176 send_waveform( &header, wf_snap_f1, SID_NORM_SWF_F1, &spw_ioctl_send);
199 send_waveform( &header, wf_snap_f1, SID_NORM_SWF_F1, &spw_ioctl_send);
177 // F2
200 // F2
178 send_waveform( &header, wf_snap_f2, SID_NORM_SWF_F2, &spw_ioctl_send);
201 send_waveform( &header, wf_snap_f2, SID_NORM_SWF_F2, &spw_ioctl_send);
179 #ifdef GSA
202 #ifdef GSA
180 // irq processed, reset the related register of the timer unit
203 // irq processed, reset the related register of the timer unit
181 gptimer_regs->timer[2].ctrl = gptimer_regs->timer[2].ctrl | 0x00000010;
204 gptimer_regs->timer[2].ctrl = gptimer_regs->timer[2].ctrl | 0x00000010;
182 #else
205 #else
183 // irq processed, reset the related register of the waveform picker
206 // irq processed, reset the related register of the waveform picker
184 waveform_picker_regs->status = 0x00;
207 waveform_picker_regs->status = 0x00;
185 waveform_picker_regs->burst_enable = 0x07;
208 waveform_picker_regs->burst_enable = 0x07;
186 #endif
209 #endif
187 break;
210 break;
188
211
189 //*****
212 //*****
190 // SBM1
213 // SBM1
191 case(RTEMS_EVENT_MODE_SBM1):
214 case(RTEMS_EVENT_MODE_SBM1):
192 // F1
215 // F1
193 if (waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1) {
216 if (waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1) {
194 send_waveform( &header, wf_snap_f1_bis, SID_NORM_SWF_F1, &spw_ioctl_send);
217 send_waveform( &header, wf_snap_f1_bis, SID_NORM_SWF_F1, &spw_ioctl_send);
195 }
218 }
196 else {
219 else {
197 send_waveform( &header, wf_snap_f1, SID_NORM_SWF_F1, &spw_ioctl_send);
220 send_waveform( &header, wf_snap_f1, SID_NORM_SWF_F1, &spw_ioctl_send);
198 }
221 }
199 break;
222 break;
223
224 //*****
225 // SBM2
226 case(RTEMS_EVENT_MODE_SBM2):
227 // F2
228 if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) {
229 send_waveform( &header, wf_snap_f2_bis, SID_NORM_SWF_F2, &spw_ioctl_send);
230 }
231 else {
232 send_waveform( &header, wf_snap_f2, SID_NORM_SWF_F2, &spw_ioctl_send);
233 }
234 break;
235
236 //********
237 // DEFAULT
200 default:
238 default:
201 break;
239 break;
202 }
240 }
203 }
241 }
204 }
242 }
205
243
206 //******************
244 //******************
207 // general functions
245 // general functions
208 void init_waveforms( void )
246 void init_waveforms( void )
209 {
247 {
210 int i = 0;
248 int i = 0;
211
249
212 for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
250 for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
213 {
251 {
214 //***
252 //***
215 // F0
253 // F0
216 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x88887777; //
254 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x88887777; //
217 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; //
255 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; //
218 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x44443333; //
256 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x44443333; //
219
257
220 //***
258 //***
221 // F1
259 // F1
222 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x22221111;
260 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x22221111;
223 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x44443333;
261 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x44443333;
224 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
262 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
225
263
226 //***
264 //***
227 // F2
265 // F2
228 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x44443333;
266 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x44443333;
229 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111;
267 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111;
230 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
268 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
231
269
232 //***
270 //***
233 // F3
271 // F3
234 //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 0 ] = val1;
272 //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 0 ] = val1;
235 //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 1 ] = val2;
273 //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 1 ] = val2;
236 //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 2 ] = 0xaaaa0000;
274 //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 2 ] = 0xaaaa0000;
237 }
275 }
238 }
276 }
239
277
240 void init_waveform_header( ExtendedTMHeader_t * header, unsigned int sid )
278 void init_waveform_header( ExtendedTMHeader_t * header, unsigned int sid )
241 {
279 {
242
280
243 header->targetLogicalAddress = CCSDS_DESTINATION_ID;
281 header->targetLogicalAddress = CCSDS_DESTINATION_ID;
244 header->protocolIdentifier = CCSDS_PROTOCOLE_ID;
282 header->protocolIdentifier = CCSDS_PROTOCOLE_ID;
245 header->reserved = 0x00;
283 header->reserved = 0x00;
246 header->userApplication = CCSDS_USER_APP;
284 header->userApplication = CCSDS_USER_APP;
247 header->packetID[0] = 0x0c;
285 header->packetID[0] = 0x0c;
248 header->packetID[1] = 0xcc;
286 header->packetID[1] = 0xcc;
249 header->packetSequenceControl[0] = 0x00;
287 header->packetSequenceControl[0] = 0x00;
250 header->packetSequenceControl[1] = 0x00;
288 header->packetSequenceControl[1] = 0x00;
251 header->packetLength[0] = 0x00;
289 header->packetLength[0] = 0x00;
252 header->packetLength[1] = 0x00;
290 header->packetLength[1] = 0x00;
253 header->dataFieldHeader[0] = 0x10;
291 header->dataFieldHeader[0] = 0x10;
254 header->dataFieldHeader[1] = TM_TYPE_LFR_SCIENCE; // service type
292 header->dataFieldHeader[1] = TM_TYPE_LFR_SCIENCE; // service type
255 header->dataFieldHeader[2] = TM_SUBTYPE_LFR_SCIENCE; // service subtype
293 header->dataFieldHeader[2] = TM_SUBTYPE_LFR_SCIENCE; // service subtype
256 header->dataFieldHeader[3] = CCSDS_DESTINATION_ID_GROUND;
294 header->dataFieldHeader[3] = CCSDS_DESTINATION_ID_GROUND;
257
295
258 header->auxiliaryHeader[0] = sid;
296 header->auxiliaryHeader[0] = sid;
259 header->auxiliaryHeader[1] = 0x1f;
297 header->auxiliaryHeader[1] = 0x1f;
260 header->auxiliaryHeader[2] = 0x07; // PKT_CNT
298 header->auxiliaryHeader[2] = 0x07; // PKT_CNT
261 header->auxiliaryHeader[3] = 0x00; // PKT_NR
299 header->auxiliaryHeader[3] = 0x00; // PKT_NR
262 header->auxiliaryHeader[4] = 0x00; // BLK_NR MSB
300 header->auxiliaryHeader[4] = 0x00; // BLK_NR MSB
263 header->auxiliaryHeader[5] = 0x00; // BLK_NR LSB
301 header->auxiliaryHeader[5] = 0x00; // BLK_NR LSB
264 }
302 }
265
303
266 void reset_waveforms( void )
304 void reset_waveforms( void )
267 {
305 {
268 int i = 0;
306 int i = 0;
269
307
270 for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
308 for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
271 {
309 {
272 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x10002000;
310 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x10002000;
273 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0x20001000;
311 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0x20001000;
274 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x40008000;
312 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x40008000;
275
313
276 //***
314 //***
277 // F1
315 // F1
278 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x1000f000;
316 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x1000f000;
279 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0xf0001000;
317 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0xf0001000;
280 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x40008000;
318 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x40008000;
281
319
282 //***
320 //***
283 // F2
321 // F2
284 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x40008000;
322 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x40008000;
285 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0x20001000;
323 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0x20001000;
286 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x10002000;
324 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x10002000;
287
325
288 //***
326 //***
289 // F3
327 // F3
290 /*wf_cont_f3[ i* NB_WORDS_SWF_BLK + 0 ] = build_value( i, i ); // v and 1
328 /*wf_cont_f3[ i* NB_WORDS_SWF_BLK + 0 ] = build_value( i, i ); // v and 1
291 wf_cont_f3[ i* NB_WORDS_SWF_BLK + 1 ] = build_value( i, i ); // e2 and b1
329 wf_cont_f3[ i* NB_WORDS_SWF_BLK + 1 ] = build_value( i, i ); // e2 and b1
292 wf_cont_f3[ i* NB_WORDS_SWF_BLK + 2 ] = build_value( i, i ); // b2 and b3*/
330 wf_cont_f3[ i* NB_WORDS_SWF_BLK + 2 ] = build_value( i, i ); // b2 and b3*/
293 }
331 }
294 }
332 }
295
333
296 void send_waveform( ExtendedTMHeader_t *header, volatile int *waveform,
334 void send_waveform( ExtendedTMHeader_t *header, volatile int *waveform,
297 unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send)
335 unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send)
298 {
336 {
299 unsigned int i = 0;
337 unsigned int i = 0;
300 unsigned int length = 0;
338 unsigned int length = 0;
301 rtems_status_code status;
339 rtems_status_code status;
302
340
303 for (i=0; i<7; i++) // send waveform
341 for (i=0; i<7; i++) // send waveform
304 {
342 {
305 header->auxiliaryHeader[3] = (unsigned char) i+1; // PKT_NR
343 header->auxiliaryHeader[3] = (unsigned char) i+1; // PKT_NR
306 // BUILD THE DATA
344 // BUILD THE DATA
307 if (i==6) {
345 if (i==6) {
308 spw_ioctl_send->dlen = 8 * NB_BYTES_SWF_BLK;
346 spw_ioctl_send->dlen = 8 * NB_BYTES_SWF_BLK;
309 length = TM_LEN_SCI_NORM_SWF_8;
347 length = TM_LEN_SCI_NORM_SWF_8;
310 header->auxiliaryHeader[4] = 0x00; // BLK_NR MSB
348 header->auxiliaryHeader[4] = 0x00; // BLK_NR MSB
311 header->auxiliaryHeader[5] = 0x08; // BLK_NR LSB
349 header->auxiliaryHeader[5] = 0x08; // BLK_NR LSB
312 }
350 }
313 else {
351 else {
314 spw_ioctl_send->dlen = 340 * NB_BYTES_SWF_BLK;
352 spw_ioctl_send->dlen = 340 * NB_BYTES_SWF_BLK;
315 length = TM_LEN_SCI_NORM_SWF_340;
353 length = TM_LEN_SCI_NORM_SWF_340;
316 header->auxiliaryHeader[4] = 0x01; // BLK_NR MSB
354 header->auxiliaryHeader[4] = 0x01; // BLK_NR MSB
317 header->auxiliaryHeader[5] = 0x54; // BLK_NR LSB
355 header->auxiliaryHeader[5] = 0x54; // BLK_NR LSB
318 }
356 }
319 if (sid == SID_NORM_SWF_F0) {
357 if (sid == SID_NORM_SWF_F0) {
320 spw_ioctl_send->data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) + (1 * TIME_OFFSET) ];
358 spw_ioctl_send->data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) + (1 * TIME_OFFSET) ];
321 }
359 }
322 else if (sid == SID_NORM_SWF_F1) {
360 else if (sid == SID_NORM_SWF_F1) {
323 spw_ioctl_send->data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) + (1 * TIME_OFFSET) ];
361 spw_ioctl_send->data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) + (1 * TIME_OFFSET) ];
324 }
362 }
325 else if (sid == SID_NORM_SWF_F2) {
363 else if (sid == SID_NORM_SWF_F2) {
326 spw_ioctl_send->data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) + (1 * TIME_OFFSET) ];
364 spw_ioctl_send->data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) + (1 * TIME_OFFSET) ];
327 }
365 }
328 else {
366 else {
329 spw_ioctl_send->data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ];
367 spw_ioctl_send->data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ];
330 }
368 }
331 // BUILD THE HEADER
369 // BUILD THE HEADER
332 header->packetLength[0] = (unsigned char) (length>>8);
370 header->packetLength[0] = (unsigned char) (length>>8);
333 header->packetLength[1] = (unsigned char) (length);
371 header->packetLength[1] = (unsigned char) (length);
334 header->auxiliaryHeader[0] = sid; // SID
372 header->auxiliaryHeader[0] = sid; // SID
335 // SEND PACKET
373 // SEND PACKET
336 status = write_spw(spw_ioctl_send);
374 status = write_spw(spw_ioctl_send);
337 if (status != RTEMS_SUCCESSFUL) {
375 if (status != RTEMS_SUCCESSFUL) {
338 while (true) {
376 while (true) {
339 if (status != RTEMS_SUCCESSFUL) {
377 if (status != RTEMS_SUCCESSFUL) {
340 status = write_spw(spw_ioctl_send);
378 status = write_spw(spw_ioctl_send);
341 //PRINTF1("%d", i)
379 //PRINTF1("%d", i)
342 sched_yield();
380 sched_yield();
343 }
381 }
344 else {
382 else {
345 //PRINTF("\n")
383 //PRINTF("\n")
346 break;
384 break;
347 }
385 }
348 }
386 }
349 }
387 }
350 }
388 }
351 }
389 }
352
390
353 int build_value(int value1, int value0)
391 int build_value(int value1, int value0)
354 {
392 {
355 int aux = 0;
393 int aux = 0;
356 int aux1 = 0;
394 int aux1 = 0;
357 int aux0 = 0;
395 int aux0 = 0;
358 int value1_aux = 0;
396 int value1_aux = 0;
359 int value0_aux = 0;
397 int value0_aux = 0;
360
398
361 value1_aux = value1;
399 value1_aux = value1;
362 value0_aux = value0;
400 value0_aux = value0;
363
401
364 //******
402 //******
365 // B3 B2
403 // B3 B2
366 if (value1_aux > 8191) value1_aux = 8191;
404 if (value1_aux > 8191) value1_aux = 8191;
367 if (value1_aux < -8192) value1_aux = -8192;
405 if (value1_aux < -8192) value1_aux = -8192;
368 aux1 = ( (int) ( ( (unsigned char) (value1_aux / 256 ) ) << 8 ) )
406 aux1 = ( (int) ( ( (unsigned char) (value1_aux / 256 ) ) << 8 ) )
369 + ( (int) ( (unsigned char) (value1_aux ) ) );
407 + ( (int) ( (unsigned char) (value1_aux ) ) );
370
408
371 //******
409 //******
372 // B1 B0
410 // B1 B0
373 if (value0_aux > 8191) value0_aux = 8191;
411 if (value0_aux > 8191) value0_aux = 8191;
374 if (value0_aux < -8192) value0_aux = -8192;
412 if (value0_aux < -8192) value0_aux = -8192;
375 aux0 = ( (int) ( ( (unsigned char) (value0_aux / 256) ) << 8 ) )
413 aux0 = ( (int) ( ( (unsigned char) (value0_aux / 256) ) << 8 ) )
376 + ( (int) ( (unsigned char) (value0_aux ) ) );
414 + ( (int) ( (unsigned char) (value0_aux ) ) );
377
415
378 aux = (aux1 << 16) + aux0;
416 aux = (aux1 << 16) + aux0;
379
417
380 return aux;
418 return aux;
381 }
419 }
382
420
383 void init_waveform_picker_regs()
421 void init_waveform_picker_regs()
384 {
422 {
385 set_data_shaping_parameters(param_common.sy_lfr_common1);
423 set_data_shaping_parameters(param_common.sy_lfr_common1);
386 waveform_picker_regs->burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
424 waveform_picker_regs->burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
387 waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0); //
425 waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0); //
388 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1); //
426 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1); //
389 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); //
427 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); //
390 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3); //
428 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3); //
391 waveform_picker_regs->status = 0x00; //
429 waveform_picker_regs->status = 0x00; //
392 waveform_picker_regs->delta_snapshot = 0x5; // max 2 bytes
430 waveform_picker_regs->delta_snapshot = 0x5; // max 2 bytes
393 waveform_picker_regs->delta_f2_f1 = 0xffff; // max 4 bytes
431 waveform_picker_regs->delta_f2_f1 = 0xffff; // max 4 bytes
394 waveform_picker_regs->delta_f2_f0 = 0x17c00; // max 5 bytes
432 waveform_picker_regs->delta_f2_f0 = 0x17c00; // max 5 bytes
395 waveform_picker_regs->nb_burst_available = 0x180; // max 3 bytes, size of the buffer in burst (1 burst = 16 x 4 octets)
433 waveform_picker_regs->nb_burst_available = 0x180; // max 3 bytes, size of the buffer in burst (1 burst = 16 x 4 octets)
396 waveform_picker_regs->nb_snapshot_param = 0x7ff; // max 3 octets, 2048 - 1
434 waveform_picker_regs->nb_snapshot_param = 0x7ff; // max 3 octets, 2048 - 1
397 //waveform_picker_regs->delta_snapshot = 0x2; // max 2 bytes, = period / 2
435 //waveform_picker_regs->delta_snapshot = 0x2; // max 2 bytes, = period / 2
398 //waveform_picker_regs->delta_f2_f1 = 0x2d00; // max 4 bytes
436 //waveform_picker_regs->delta_f2_f1 = 0x2d00; // max 4 bytes
399 //waveform_picker_regs->delta_f2_f0 = 0x2f80; // max 5 bytes
437 //waveform_picker_regs->delta_f2_f0 = 0x2f80; // max 5 bytes
400 //waveform_picker_regs->nb_burst_available = 0x30; // max 3 bytes, size of the buffer in burst (1 burst = 16 x 4 octets)
438 //waveform_picker_regs->nb_burst_available = 0x30; // max 3 bytes, size of the buffer in burst (1 burst = 16 x 4 octets)
401 //waveform_picker_regs->nb_snapshot_param = 0xff; // max 3 octets, 256 - 1
439 //waveform_picker_regs->nb_snapshot_param = 0xff; // max 3 octets, 256 - 1
402 }
440 }
403
441
404 void set_data_shaping_parameters(unsigned char parameters)
442 void set_data_shaping_parameters(unsigned char parameters)
405 {
443 {
406 // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register
444 // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register
407 // waveform picker : [R1 R0 SP1 SP0 BW]
445 // waveform picker : [R1 R0 SP1 SP0 BW]
408 waveform_picker_regs->data_shaping =
446 waveform_picker_regs->data_shaping =
409 ( (parameters & 0x10) >> 4 ) // BW
447 ( (parameters & 0x10) >> 4 ) // BW
410 + ( (parameters & 0x08) >> 2 ) // SP0
448 + ( (parameters & 0x08) >> 2 ) // SP0
411 + ( (parameters & 0x04) ) // SP1
449 + ( (parameters & 0x04) ) // SP1
412 + ( (parameters & 0x02) << 2 ) // R0
450 + ( (parameters & 0x02) << 2 ) // R0
413 + ( (parameters & 0x01) << 4 ); // R1
451 + ( (parameters & 0x01) << 4 ); // R1
414 }
452 }
General Comments 0
You need to be logged in to leave comments. Login now