##// END OF EJS Templates
commit before release
paul@pc-solar1.lab-lpp.local -
r25:68625add1e50 default
parent child
Show More
@@ -1,225 +1,225
1 #############################################################################
1 #############################################################################
2 # Makefile for building: bin/fsw
2 # Makefile for building: bin/fsw-gsa
3 # Generated by qmake (2.01a) (Qt 4.8.4) on: Fri Jun 28 07:59:21 2013
3 # Generated by qmake (2.01a) (Qt 4.8.4) on: Fri Jul 5 12:17:39 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=5 -DPRINT_MESSAGES_ON_CONSOLE
13 DEFINES = -DSW_VERSION_N1=0 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=6 -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
81 QMAKE_TARGET = fsw-gsa
82 DESTDIR = bin/
82 DESTDIR = bin/
83 TARGET = bin/fsw
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/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0
162 @$(CHK_DIR_EXISTS) obj/fsw-gsa1.0.0 || $(MKDIR) obj/fsw-gsa1.0.0
163 $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/fsw1.0.0/ && (cd `dirname obj/fsw1.0.0` && $(TAR) fsw1.0.0.tar fsw1.0.0 && $(COMPRESS) fsw1.0.0.tar) && $(MOVE) `dirname obj/fsw1.0.0`/fsw1.0.0.tar.gz . && $(DEL_FILE) -r obj/fsw1.0.0
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,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 SWVERSION=-0-6
10 SWVERSION=-0-6
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=6
14 DEFINES += SW_VERSION_N4=6
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
24 TARGET = fsw
25 contains( CONFIG, gsa ) {
25 contains( CONFIG, gsa ) {
26 DEFINES += GSA
26 DEFINES += GSA
27 TARGET = fsw-gsa
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-07-05T07:07:58. -->
3 <!-- Written by Qt Creator 2.4.1, 2013-07-05T13:31:36. -->
4 <qtcreator>
4 <qtcreator>
5 <data>
5 <data>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
7 <value type="int">0</value>
7 <value type="int">0</value>
8 </data>
8 </data>
9 <data>
9 <data>
10 <variable>ProjectExplorer.Project.EditorSettings</variable>
10 <variable>ProjectExplorer.Project.EditorSettings</variable>
11 <valuemap type="QVariantMap">
11 <valuemap type="QVariantMap">
12 <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
12 <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
13 <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
13 <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
14 <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,67 +1,67
1 #ifndef FSW_RTEMS_H_INCLUDED
1 #ifndef FSW_RTEMS_H_INCLUDED
2 #define FSW_RTEMS_H_INCLUDED
2 #define FSW_RTEMS_H_INCLUDED
3
3
4 #include <errno.h>
4 #include <errno.h>
5 #include <fcntl.h>
5 #include <fcntl.h>
6 #include <stdio.h>
6 #include <stdio.h>
7 #include <stdlib.h>
7 #include <stdlib.h>
8
8
9 #include <grspw.h>
9 #include <grspw.h>
10 #include <apbuart.h>
10 #include <apbuart.h>
11
11
12 #include <fsw_params.h>
12 #include <fsw_params.h>
13 #include <fsw_misc.h>
13 #include <fsw_misc.h>
14 #include <fsw_processing.h>
14 #include <fsw_processing.h>
15 #include <tc_handler.h>
15 #include <tc_handler.h>
16 #include <wf_handler.h>
16 #include <wf_handler.h>
17 #include <grlib_regs.h>
17 #include <grlib_regs.h>
18 #include <ccsds_types.h>
18 #include <ccsds_types.h>
19
19
20 extern int sched_yield( void );
20 extern int sched_yield( void );
21 extern int errno;
21 extern int errno;
22 extern rtems_id Task_id[ ]; /* array of task ids */
22 extern rtems_id Task_id[ ]; /* array of task ids */
23 extern rtems_name Task_name[ ]; /* array of task names */
23 extern rtems_name Task_name[ ]; /* array of task names */
24 extern rtems_name misc_name[ ]; /* arry of miscellaneous names for rtems objects */
24 extern rtems_name misc_name[ ]; /* arry of miscellaneous names for rtems objects */
25 extern int fdSPW; // grspw file descriptor
25 extern int fdSPW; // grspw file descriptor
26 extern int fdUART; // uart file descriptor
26 extern int fdUART; // uart file descriptor
27
27
28 void timecode_irq_handler(void *pDev, void *regs, int minor, unsigned int tc);
28 void timecode_irq_handler(void *pDev, void *regs, int minor, unsigned int tc);
29
29
30 // MODE PARAMETERS
30 // MODE PARAMETERS
31 extern struct param_local_str param_local;
31 extern struct param_local_str param_local;
32 extern struct param_common_str param_common;
32 extern struct param_common_str param_common;
33 extern struct param_norm_str param_norm;
33 extern struct param_norm_str param_norm;
34 extern struct param_burst_str param_burst;
34 extern struct param_burst_str param_burst;
35 extern struct param_sbm1_str param_sbm1;
35 extern struct param_sbm1_str param_sbm1;
36 extern struct param_sbm2_str param_sbm2;
36 extern struct param_sbm2_str param_sbm2;
37 extern Packet_TM_LFR_HK_t housekeeping_packet;
37 extern Packet_TM_LFR_HK_t housekeeping_packet;
38 extern unsigned short sequenceCounters[SEQ_CNT_NB_PID][SEQ_CNT_NB_CAT][SEQ_CNT_NB_DEST_ID];
38 extern unsigned short sequenceCounters[SEQ_CNT_NB_PID][SEQ_CNT_NB_CAT][SEQ_CNT_NB_DEST_ID];
39
39
40 // RTEMS TASKS
40 // RTEMS TASKS
41 rtems_task Init( rtems_task_argument argument); /* forward declaration needed */
41 rtems_task Init( rtems_task_argument argument); /* forward declaration needed */
42 rtems_task recv_task(rtems_task_argument argument);
42 rtems_task recv_task(rtems_task_argument argument);
43 rtems_task spiq_task(rtems_task_argument argument);
43 rtems_task spiq_task(rtems_task_argument argument);
44 rtems_task stat_task(rtems_task_argument argument);
44 rtems_task stat_task(rtems_task_argument argument);
45 rtems_task wfrm_task(rtems_task_argument argument);
45 rtems_task wfrm_task(rtems_task_argument argument);
46 int create_names( void );
46 int create_names( void );
47 int create_all_tasks( void );
47 int create_all_tasks( void );
48 int start_all_tasks( void );
48 int start_all_tasks( void );
49 int create_message_queue( void );
49 int create_message_queue( void );
50
50
51 // OTHER functions
51 // OTHER functions
52 void init_default_mode_parameters( void );
52 void init_default_mode_parameters( void );
53 void init_housekeeping_parameters( void );
53 void init_housekeeping_parameters( void );
54
54
55 int spacewire_configure_link( void );
55 int spacewire_configure_link( void );
56 int spacewire_try_to_start(void);
56 int spacewire_wait_for_link(void);
57 void spacewire_set_NP(unsigned char val, unsigned int regAddr); // No Port force
57 void spacewire_set_NP(unsigned char val, unsigned int regAddr); // No Port force
58 void spacewire_set_RE(unsigned char val, unsigned int regAddr); // RMAP Enable
58 void spacewire_set_RE(unsigned char val, unsigned int regAddr); // RMAP Enable
59 void spacewire_compute_stats_offsets();
59 void spacewire_compute_stats_offsets();
60
60
61 extern int rtems_cpu_usage_report( void );
61 extern int rtems_cpu_usage_report( void );
62 extern int rtems_cpu_usage_reset( void );
62 extern int rtems_cpu_usage_reset( void );
63
63
64 rtems_status_code write_spw(spw_ioctl_pkt_send* spw_ioctl_send);
64 rtems_status_code write_spw(spw_ioctl_pkt_send* spw_ioctl_send);
65 void (*grspw_timecode_callback) (void *pDev, void *regs, int minor, unsigned int tc);
65 void (*grspw_timecode_callback) (void *pDev, void *regs, int minor, unsigned int tc);
66
66
67 #endif // FSW_RTEMS_CONFIG_H_INCLUDED
67 #endif // FSW_RTEMS_CONFIG_H_INCLUDED
@@ -1,30 +1,30
1 #ifndef FSW_MISC_H_INCLUDED
1 #ifndef FSW_MISC_H_INCLUDED
2 #define FSW_MISC_H_INCLUDED
2 #define FSW_MISC_H_INCLUDED
3
3
4 #include <rtems.h>
4 #include <rtems.h>
5 #include <stdio.h>
5 #include <stdio.h>
6
6
7 #include <fsw_init.h>
7 #include <fsw_init.h>
8 #include <fsw_params.h>
8 #include <fsw_params.h>
9 #include <grlib_regs.h>
9 #include <grlib_regs.h>
10 #include <grspw.h>
10 #include <grspw.h>
11 #include <ccsds_types.h>
11 #include <ccsds_types.h>
12
12
13 rtems_name HK_name; // name of the HK rate monotonic
13 rtems_name HK_name; // name of the HK rate monotonic
14 rtems_id HK_id; // id of the HK rate monotonic period
14 rtems_id HK_id; // id of the HK rate monotonic period
15 extern spw_stats spacewire_stats;
15 extern spw_stats spacewire_stats;
16 extern spw_stats spacewire_stats_backup;
16 extern spw_stats spacewire_stats_backup;
17
17
18 int configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider,
18 int configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider,
19 unsigned char interrupt_level, rtems_isr (*timer_isr)() );
19 unsigned char interrupt_level, rtems_isr (*timer_isr)() );
20 void update_spacewire_statistics();
20 void update_spacewire_statistics();
21
21
22 // SERIAL LINK
22 // SERIAL LINK
23 int send_console_outputs_on_serial_port( void );
23 int send_console_outputs_on_apbuart_port( void );
24 int set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value);
24 int set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value);
25
25
26 // RTEMS TASKS
26 // RTEMS TASKS
27 rtems_task stat_task(rtems_task_argument argument);
27 rtems_task stat_task(rtems_task_argument argument);
28 rtems_task hous_task(rtems_task_argument argument);
28 rtems_task hous_task(rtems_task_argument argument);
29
29
30 #endif // FSW_MISC_H_INCLUDED
30 #endif // FSW_MISC_H_INCLUDED
@@ -1,175 +1,175
1 #ifndef FSW_RTEMS_CONFIG_H_INCLUDED
1 #ifndef FSW_RTEMS_CONFIG_H_INCLUDED
2 #define FSW_RTEMS_CONFIG_H_INCLUDED
2 #define FSW_RTEMS_CONFIG_H_INCLUDED
3
3
4 #define GRSPW_DEVICE_NAME "/dev/grspw0"
4 #define GRSPW_DEVICE_NAME "/dev/grspw0"
5 #define UART_DEVICE_NAME "/dev/console"
5 #define UART_DEVICE_NAME "/dev/console"
6
6
7 //************************
7 //************************
8 // flight software version
8 // flight software version
9 // this parameters is handled by the Qt project options
9 // this parameters is handled by the Qt project options
10
10
11 //**********
11 //**********
12 // LFR MODES
12 // LFR MODES
13 #define LFR_MODE_STANDBY 0
13 #define LFR_MODE_STANDBY 0
14 #define LFR_MODE_NORMAL 1
14 #define LFR_MODE_NORMAL 1
15 #define LFR_MODE_BURST 2
15 #define LFR_MODE_BURST 2
16 #define LFR_MODE_SBM1 3
16 #define LFR_MODE_SBM1 3
17 #define LFR_MODE_SBM2 4
17 #define LFR_MODE_SBM2 4
18
18
19 #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0
19 #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0
20 #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1
20 #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1
21 #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2
21 #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2
22 #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3
22 #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3
23 #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4
23 #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4
24
24
25 //****************************
25 //****************************
26 // LFR DEFAULT MODE PARAMETERS
26 // LFR DEFAULT MODE PARAMETERS
27 // NORM
27 // NORM
28 #define DEFAULT_SY_LFR_N_SWF_L 2048 // nb sample
28 #define DEFAULT_SY_LFR_N_SWF_L 2048 // nb sample
29 #define DEFAULT_SY_LFR_N_SWF_P 16 // sec
29 #define DEFAULT_SY_LFR_N_SWF_P 16 // sec
30 #define DEFAULT_SY_LFR_N_ASM_P 3600 // sec
30 #define DEFAULT_SY_LFR_N_ASM_P 3600 // sec
31 #define DEFAULT_SY_LFR_N_BP_P0 4 // sec
31 #define DEFAULT_SY_LFR_N_BP_P0 4 // sec
32 #define DEFAULT_SY_LFR_N_BP_P1 20 // sec
32 #define DEFAULT_SY_LFR_N_BP_P1 20 // sec
33 // BURST
33 // BURST
34 #define DEFAULT_SY_LFR_B_BP_P0 1 // sec
34 #define DEFAULT_SY_LFR_B_BP_P0 1 // sec
35 #define DEFAULT_SY_LFR_B_BP_P1 5 // sec
35 #define DEFAULT_SY_LFR_B_BP_P1 5 // sec
36 // SBM1
36 // SBM1
37 #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec
37 #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec
38 #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec
38 #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec
39 // SBM2
39 // SBM2
40 #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec
40 #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec
41 #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec
41 #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec
42
42
43 //*****************************
43 //*****************************
44 // APB REGISTERS BASE ADDRESSES
44 // APB REGISTERS BASE ADDRESSES
45 #define REGS_ADDR_APBUART 0x80000100
45 #define REGS_ADDR_APBUART 0x80000100
46 #define REGS_ADDR_GPTIMER 0x80000300
46 #define REGS_ADDR_GPTIMER 0x80000300
47 #define REGS_ADDR_GRSPW 0x80000500
47 #define REGS_ADDR_GRSPW 0x80000500
48 #define REGS_ADDR_TIME_MANAGEMENT 0x80000600
48 #define REGS_ADDR_TIME_MANAGEMENT 0x80000600
49 #define REGS_ADDR_SPECTRAL_MATRICES 0x80000700
49 #define REGS_ADDR_SPECTRAL_MATRICES 0x80000700
50 #define REGS_ADDR_WAVEFORM_PICKER 0x80000f20
50 #define REGS_ADDR_WAVEFORM_PICKER 0x80000f20
51
51
52 #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff
52 #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff
53 #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400
53 #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50)
54
54
55 //**********
55 //**********
56 // IRQ LINES
56 // IRQ LINES
57 #define IRQ_SM 9
57 #define IRQ_SM 9
58 #define IRQ_SPARC_SM 0x19 // see sparcv8.pdf p.76 for interrupt levels
58 #define IRQ_SPARC_SM 0x19 // see sparcv8.pdf p.76 for interrupt levels
59 #define IRQ_WF 10
59 #define IRQ_WF 10
60 #define IRQ_SPARC_WF 0x1a // see sparcv8.pdf p.76 for interrupt levels
60 #define IRQ_SPARC_WF 0x1a // see sparcv8.pdf p.76 for interrupt levels
61 #define IRQ_TIME1 12
61 #define IRQ_TIME1 12
62 #define IRQ_SPARC_TIME1 0x1c // see sparcv8.pdf p.76 for interrupt levels
62 #define IRQ_SPARC_TIME1 0x1c // see sparcv8.pdf p.76 for interrupt levels
63 #define IRQ_TIME2 13
63 #define IRQ_TIME2 13
64 #define IRQ_SPARC_TIME2 0x1d // see sparcv8.pdf p.76 for interrupt levels
64 #define IRQ_SPARC_TIME2 0x1d // see sparcv8.pdf p.76 for interrupt levels
65 #define IRQ_WAVEFORM_PICKER 14
65 #define IRQ_WAVEFORM_PICKER 14
66 #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels
66 #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels
67
67
68 //*****
68 //*****
69 // TIME
69 // TIME
70 #define CLKDIV_SM_SIMULATOR 9999
70 #define CLKDIV_SM_SIMULATOR 9999
71 #define CLKDIV_WF_SIMULATOR 9999999
71 #define CLKDIV_WF_SIMULATOR 9999999
72 #define TIMER_SM_SIMULATOR 1
72 #define TIMER_SM_SIMULATOR 1
73 #define TIMER_WF_SIMULATOR 2
73 #define TIMER_WF_SIMULATOR 2
74 #define HK_PERIOD 100 // 100 * 10ms => 1sec
74 #define HK_PERIOD 100 // 100 * 10ms => 1sec
75
75
76 //**********
76 //**********
77 // LPP CODES
77 // LPP CODES
78 #define LFR_SUCCESSFUL 0
78 #define LFR_SUCCESSFUL 0
79 #define LFR_DEFAULT 1
79 #define LFR_DEFAULT 1
80
80
81 //******
81 //******
82 // RTEMS
82 // RTEMS
83 #define TASKID_RECV 1
83 #define TASKID_RECV 1
84 #define TASKID_ACTN 2
84 #define TASKID_ACTN 2
85 #define TASKID_SPIQ 3
85 #define TASKID_SPIQ 3
86 #define TASKID_SMIQ 4
86 #define TASKID_SMIQ 4
87 #define TASKID_STAT 5
87 #define TASKID_STAT 5
88 #define TASKID_AVF0 6
88 #define TASKID_AVF0 6
89 #define TASKID_BPF0 7
89 #define TASKID_BPF0 7
90 #define TASKID_WFRM 8
90 #define TASKID_WFRM 8
91 #define TASKID_DUMB 9
91 #define TASKID_DUMB 9
92 #define TASKID_HOUS 10
92 #define TASKID_HOUS 10
93
93
94 #define ACTION_MSG_QUEUE_COUNT 10
94 #define ACTION_MSG_QUEUE_COUNT 10
95
95
96 //*******
96 //*******
97 // MACROS
97 // MACROS
98 #ifdef PRINT_MESSAGES_ON_CONSOLE
98 #ifdef PRINT_MESSAGES_ON_CONSOLE
99 #define PRINTF(x) printf(x);
99 #define PRINTF(x) printf(x);
100 #define PRINTF1(x,y) printf(x,y);
100 #define PRINTF1(x,y) printf(x,y);
101 #define PRINTF2(x,y,z) printf(x,y,z);
101 #define PRINTF2(x,y,z) printf(x,y,z);
102 #else
102 #else
103 #define PRINTF(x) ;
103 #define PRINTF(x) ;
104 #define PRINTF1(x,y) ;
104 #define PRINTF1(x,y) ;
105 #define PRINTF2(x,y,z) ;
105 #define PRINTF2(x,y,z) ;
106 #endif
106 #endif
107
107
108 #define NB_SAMPLES_PER_SNAPSHOT 2048
108 #define NB_SAMPLES_PER_SNAPSHOT 2048
109 #define TIME_OFFSET 2
109 #define TIME_OFFSET 2
110 #define WAVEFORM_EXTENDED_HEADER_OFFSET 22
110 #define WAVEFORM_EXTENDED_HEADER_OFFSET 22
111 #define NB_BYTES_SWF_BLK 2 * 6
111 #define NB_BYTES_SWF_BLK 2 * 6
112 #define NB_WORDS_SWF_BLK 3
112 #define NB_WORDS_SWF_BLK 3
113
113
114 //******************
114 //******************
115 // SEQUENCE COUNTERS
115 // SEQUENCE COUNTERS
116 #define SEQ_CNT_NB_PID 2
116 #define SEQ_CNT_NB_PID 2
117 #define SEQ_CNT_NB_CAT 4
117 #define SEQ_CNT_NB_CAT 4
118 #define SEQ_CNT_NB_DEST_ID 11
118 #define SEQ_CNT_NB_DEST_ID 11
119 // pid
119 // pid
120 #define SEQ_CNT_PID_76 0
120 #define SEQ_CNT_PID_76 0
121 #define SEQ_CNT_PID_79 1
121 #define SEQ_CNT_PID_79 1
122 //cat
122 //cat
123 #define SEQ_CNT_CAT_1 0
123 #define SEQ_CNT_CAT_1 0
124 #define SEQ_CNT_CAT_4 1
124 #define SEQ_CNT_CAT_4 1
125 #define SEQ_CNT_CAT_9 2
125 #define SEQ_CNT_CAT_9 2
126 #define SEQ_CNT_CAT_12 3
126 #define SEQ_CNT_CAT_12 3
127 // destination id
127 // destination id
128 #define SEQ_CNT_DST_ID_GROUND 0
128 #define SEQ_CNT_DST_ID_GROUND 0
129 #define SEQ_CNT_DST_ID_MISSION_TIMELINE 1
129 #define SEQ_CNT_DST_ID_MISSION_TIMELINE 1
130 #define SEQ_CNT_DST_ID_TC_SEQUENCES 2
130 #define SEQ_CNT_DST_ID_TC_SEQUENCES 2
131 #define SEQ_CNT_DST_ID_RECOVERY_ACTION_CMD 3
131 #define SEQ_CNT_DST_ID_RECOVERY_ACTION_CMD 3
132 #define SEQ_CNT_DST_ID_BACKUP_MISSION_TIMELINE 4
132 #define SEQ_CNT_DST_ID_BACKUP_MISSION_TIMELINE 4
133 #define SEQ_CNT_DST_ID_DIRECT_CMD 5
133 #define SEQ_CNT_DST_ID_DIRECT_CMD 5
134 #define SEQ_CNT_DST_ID_SPARE_GRD_SRC1 6
134 #define SEQ_CNT_DST_ID_SPARE_GRD_SRC1 6
135 #define SEQ_CNT_DST_ID_SPARE_GRD_SRC2 7
135 #define SEQ_CNT_DST_ID_SPARE_GRD_SRC2 7
136 #define SEQ_CNT_DST_ID_OBCP 8
136 #define SEQ_CNT_DST_ID_OBCP 8
137 #define SEQ_CNT_DST_ID_SYSTEM_CONTROL 9
137 #define SEQ_CNT_DST_ID_SYSTEM_CONTROL 9
138 #define SEQ_CNT_DST_ID_AOCS 10
138 #define SEQ_CNT_DST_ID_AOCS 10
139
139
140 struct param_local_str{
140 struct param_local_str{
141 unsigned int local_sbm1_nb_cwf_sent;
141 unsigned int local_sbm1_nb_cwf_sent;
142 unsigned int local_sbm1_nb_cwf_max;
142 unsigned int local_sbm1_nb_cwf_max;
143 unsigned int local_sbm2_nb_cwf_sent;
143 unsigned int local_sbm2_nb_cwf_sent;
144 unsigned int local_sbm2_nb_cwf_max;
144 unsigned int local_sbm2_nb_cwf_max;
145 };
145 };
146
146
147 struct param_common_str{
147 struct param_common_str{
148 unsigned char sy_lfr_common0;
148 unsigned char sy_lfr_common0;
149 unsigned char sy_lfr_common1;
149 unsigned char sy_lfr_common1;
150 };
150 };
151
151
152 struct param_norm_str{
152 struct param_norm_str{
153 unsigned int sy_lfr_n_swf_l; // length of the snapshots
153 unsigned int sy_lfr_n_swf_l; // length of the snapshots
154 unsigned int sy_lfr_n_swf_p; // time between two snapshots
154 unsigned int sy_lfr_n_swf_p; // time between two snapshots
155 unsigned int sy_lfr_n_asm_p; // time between two asm
155 unsigned int sy_lfr_n_asm_p; // time between two asm
156 unsigned char sy_lfr_n_bp_p0; // timebetween two products BP1 set
156 unsigned char sy_lfr_n_bp_p0; // timebetween two products BP1 set
157 unsigned char sy_lfr_n_bp_p1; // time between two products BP2 set
157 unsigned char sy_lfr_n_bp_p1; // time between two products BP2 set
158 };
158 };
159
159
160 struct param_burst_str{
160 struct param_burst_str{
161 unsigned char sy_lfr_b_bp_p0; // timebetween two products BP1 set
161 unsigned char sy_lfr_b_bp_p0; // timebetween two products BP1 set
162 unsigned char sy_lfr_b_bp_p1; // time between two products BP2 set
162 unsigned char sy_lfr_b_bp_p1; // time between two products BP2 set
163 };
163 };
164
164
165 struct param_sbm1_str{
165 struct param_sbm1_str{
166 unsigned char sy_lfr_s1_bp_p0; // timebetween two products BP1 set
166 unsigned char sy_lfr_s1_bp_p0; // timebetween two products BP1 set
167 unsigned char sy_lfr_s1_bp_p1; // time between two products BP2 set
167 unsigned char sy_lfr_s1_bp_p1; // time between two products BP2 set
168 };
168 };
169
169
170 struct param_sbm2_str{
170 struct param_sbm2_str{
171 unsigned char sy_lfr_s2_bp_p0; // timebetween two products BP1 set
171 unsigned char sy_lfr_s2_bp_p0; // timebetween two products BP1 set
172 unsigned char sy_lfr_s2_bp_p1; // time between two products BP2 set
172 unsigned char sy_lfr_s2_bp_p1; // time between two products BP2 set
173 };
173 };
174
174
175 #endif // FSW_RTEMS_CONFIG_H_INCLUDED
175 #endif // FSW_RTEMS_CONFIG_H_INCLUDED
@@ -1,64 +1,71
1 #ifndef GRLIBREGS_H_INCLUDED
1 #ifndef GRLIBREGS_H_INCLUDED
2 #define GRLIBREGS_H_INCLUDED
2 #define GRLIBREGS_H_INCLUDED
3
3
4 #define NB_GPTIMER 3
4 #define NB_GPTIMER 3
5
5
6 struct apbuart_regs_str{
6 struct apbuart_regs_str{
7 volatile unsigned int data;
7 volatile unsigned int data;
8 volatile unsigned int status;
8 volatile unsigned int status;
9 volatile unsigned int ctrl;
9 volatile unsigned int ctrl;
10 volatile unsigned int scaler;
10 volatile unsigned int scaler;
11 volatile unsigned int fifoDebug;
11 volatile unsigned int fifoDebug;
12 };
12 };
13
13
14 struct timer_regs_str
14 struct ahbuart_regs_str{
15 volatile unsigned int unused;
16 volatile unsigned int status;
17 volatile unsigned int ctrl;
18 volatile unsigned int scaler;
19 };
20
21 struct timer_regs_str
15 {
22 {
16 volatile unsigned int counter;
23 volatile unsigned int counter;
17 volatile unsigned int reload;
24 volatile unsigned int reload;
18 volatile unsigned int ctrl;
25 volatile unsigned int ctrl;
19 volatile unsigned int unused;
26 volatile unsigned int unused;
20 };
27 };
21 typedef struct timer_regs_str timer_regs_t;
28 typedef struct timer_regs_str timer_regs_t;
22
29
23 struct gptimer_regs_str
30 struct gptimer_regs_str
24 {
31 {
25 volatile unsigned int scaler_value;
32 volatile unsigned int scaler_value;
26 volatile unsigned int scaler_reload;
33 volatile unsigned int scaler_reload;
27 volatile unsigned int conf;
34 volatile unsigned int conf;
28 volatile unsigned int unused0;
35 volatile unsigned int unused0;
29 timer_regs_t timer[NB_GPTIMER];
36 timer_regs_t timer[NB_GPTIMER];
30 };
37 };
31 typedef struct gptimer_regs_str gptimer_regs_t;
38 typedef struct gptimer_regs_str gptimer_regs_t;
32
39
33 struct spectral_matrices_regs_str{
40 struct spectral_matrices_regs_str{
34 volatile int ctrl;
41 volatile int ctrl;
35 volatile int address0;
42 volatile int address0;
36 volatile int address1;
43 volatile int address1;
37 };
44 };
38 typedef struct spectral_matrices_regs_str spectral_matrices_regs_t;
45 typedef struct spectral_matrices_regs_str spectral_matrices_regs_t;
39
46
40 struct time_management_regs_str{
47 struct time_management_regs_str{
41 volatile int ctrl; // bit 0 forces the load of the coarse_time_load value and resets the fine_time
48 volatile int ctrl; // bit 0 forces the load of the coarse_time_load value and resets the fine_time
42 volatile int coarse_time_load;
49 volatile int coarse_time_load;
43 volatile int coarse_time;
50 volatile int coarse_time;
44 volatile int fine_time;
51 volatile int fine_time;
45 };
52 };
46 typedef struct time_management_regs_str time_management_regs_t;
53 typedef struct time_management_regs_str time_management_regs_t;
47
54
48 struct waveform_picker_regs_str{
55 struct waveform_picker_regs_str{
49 volatile int data_shaping; // 0x00 00 *** R1 R0 SP1 SP0 BW
56 volatile int data_shaping; // 0x00 00 *** R1 R0 SP1 SP0 BW
50 volatile int burst_enable; // 0x04 01 *** burst f2, f1, f0 enable f3, f2, f1, f0
57 volatile int burst_enable; // 0x04 01 *** burst f2, f1, f0 enable f3, f2, f1, f0
51 volatile int addr_data_f0; // 0x08 10 ***
58 volatile int addr_data_f0; // 0x08 10 ***
52 volatile int addr_data_f1; // 0x0c 11 ***
59 volatile int addr_data_f1; // 0x0c 11 ***
53 volatile int addr_data_f2; // 0x10 100 ***
60 volatile int addr_data_f2; // 0x10 100 ***
54 volatile int addr_data_f3; // 0x14 101 ***
61 volatile int addr_data_f3; // 0x14 101 ***
55 volatile int status; // 0x18 110 ***
62 volatile int status; // 0x18 110 ***
56 volatile int delta_snapshot; // 0x1c 111 ***
63 volatile int delta_snapshot; // 0x1c 111 ***
57 volatile int delta_f2_f1; // 0x20 0000 ***
64 volatile int delta_f2_f1; // 0x20 0000 ***
58 volatile int delta_f2_f0; // 0x24 0001 ***
65 volatile int delta_f2_f0; // 0x24 0001 ***
59 volatile int nb_burst_available;// 0x28 0010 ***
66 volatile int nb_burst_available;// 0x28 0010 ***
60 volatile int nb_snapshot_param; // 0x2c 0011 ***
67 volatile int nb_snapshot_param; // 0x2c 0011 ***
61 };
68 };
62 typedef struct waveform_picker_regs_str waveform_picker_regs_t;
69 typedef struct waveform_picker_regs_str waveform_picker_regs_t;
63
70
64 #endif // GRLIBREGS_H_INCLUDED
71 #endif // GRLIBREGS_H_INCLUDED
@@ -1,547 +1,549
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_apbuart_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(); // create all names
74 create_names(); // create all names
75 create_all_tasks(); // create all tasks
75 create_all_tasks(); // create all tasks
76 start_all_tasks(); // start all tasks
76 start_all_tasks(); // start all tasks
77 stop_current_mode(); // go in STANDBY mode
77 stop_current_mode(); // go in STANDBY mode
78
78
79 grspw_timecode_callback = &timecode_irq_handler;
79 grspw_timecode_callback = &timecode_irq_handler;
80
80
81 spacewire_configure_link();
81 spacewire_configure_link();
82
82
83 //****************************
83 //****************************
84 // Spectral Matrices simulator
84 // Spectral Matrices simulator
85 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,
86 IRQ_SPARC_SM, spectral_matrices_isr );
86 IRQ_SPARC_SM, spectral_matrices_isr );
87
87
88 //**********
88 //**********
89 // WAVEFORMS
89 // WAVEFORMS
90 // simulator
90 // simulator
91
91
92 #ifdef GSA
92 #ifdef GSA
93 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,
94 IRQ_SPARC_WF, waveforms_simulator_isr );
94 IRQ_SPARC_WF, waveforms_simulator_isr );
95 #else
95 #else
96 // configure the registers of the waveform picker
96 // configure the registers of the waveform picker
97 reset_wfp_regs();
97 reset_wfp_regs();
98 // configure the waveform picker interrupt service routine
98 // configure the waveform picker interrupt service routine
99 status = rtems_interrupt_catch( waveforms_isr,
99 status = rtems_interrupt_catch( waveforms_isr,
100 IRQ_SPARC_WAVEFORM_PICKER,
100 IRQ_SPARC_WAVEFORM_PICKER,
101 &old_isr_handler) ;
101 &old_isr_handler) ;
102 LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER );
102 LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER );
103 #endif
103 #endif
104
104
105 //**********
105 //**********
106
106
107 //*****************************************
107 //*****************************************
108 // irq handling of the time management unit
108 // irq handling of the time management unit
109 status = rtems_interrupt_catch( commutation_isr1,
109 status = rtems_interrupt_catch( commutation_isr1,
110 IRQ_SPARC_TIME1,
110 IRQ_SPARC_TIME1,
111 &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels
111 &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels
112 if (status==RTEMS_SUCCESSFUL) {
112 if (status==RTEMS_SUCCESSFUL) {
113 PRINTF("OK *** commutation_isr1 *** rtems_interrupt_catch successfullly configured\n")
113 PRINTF("OK *** commutation_isr1 *** rtems_interrupt_catch successfullly configured\n")
114 }
114 }
115
115
116 status = rtems_interrupt_catch( commutation_isr2,
116 status = rtems_interrupt_catch( commutation_isr2,
117 IRQ_SPARC_TIME2,
117 IRQ_SPARC_TIME2,
118 &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels
118 &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels
119 if (status==RTEMS_SUCCESSFUL) {
119 if (status==RTEMS_SUCCESSFUL) {
120 PRINTF("OK *** commutation_isr2 *** rtems_interrupt_catch successfullly configured\n")
120 PRINTF("OK *** commutation_isr2 *** rtems_interrupt_catch successfullly configured\n")
121 }
121 }
122
122
123 LEON_Unmask_interrupt( IRQ_TIME1 );
123 LEON_Unmask_interrupt( IRQ_TIME1 );
124 LEON_Unmask_interrupt( IRQ_TIME2 );
124 LEON_Unmask_interrupt( IRQ_TIME2 );
125
125
126 #ifdef GSA
126 #ifdef GSA
127 //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) {
128 // printf("in INIT *** Error sending event to WFRM\n");
128 // printf("in INIT *** Error sending event to WFRM\n");
129 //}
129 //}
130 #endif
130 #endif
131
131
132 status = rtems_task_delete(RTEMS_SELF);
132 status = rtems_task_delete(RTEMS_SELF);
133
133
134 }
134 }
135
135
136 rtems_task spiq_task(rtems_task_argument unused)
136 rtems_task spiq_task(rtems_task_argument unused)
137 {
137 {
138 rtems_event_set event_out;
138 rtems_event_set event_out;
139 rtems_status_code status;
139 rtems_status_code status;
140 unsigned char lfrMode;
140 unsigned char lfrMode;
141
141
142 while(true){
142 while(true){
143 PRINTF("in SPIQ *** Waiting for SPW_LINKERR_EVENT\n")
143 PRINTF("in SPIQ *** Waiting for SPW_LINKERR_EVENT\n")
144 rtems_event_receive(SPW_LINKERR_EVENT, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an SPW_LINKERR_EVENT
144 rtems_event_receive(SPW_LINKERR_EVENT, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an SPW_LINKERR_EVENT
145
145
146 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; // get the current mode
146 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; // get the current mode
147
147
148 //****************
148 status = spacewire_wait_for_link();
149 // STOP THE SYSTEM
149
150 spacewire_compute_stats_offsets();
150 if (status != RTEMS_SUCCESSFUL)
151 stop_current_mode();
151 {
152 if (rtems_task_suspend(Task_id[TASKID_RECV])!=RTEMS_SUCCESSFUL) { // suspend RECV task
152 //****************
153 PRINTF("in SPIQ *** Error suspending RECV Task\n")
153 // STOP THE SYSTEM
154 }
154 spacewire_compute_stats_offsets();
155 if (rtems_task_suspend(Task_id[TASKID_HOUS])!=RTEMS_SUCCESSFUL) { // suspend HOUS task
155 stop_current_mode();
156 PRINTF("in SPIQ *** Error suspending HOUS Task\n")
156 if (rtems_task_suspend(Task_id[TASKID_RECV])!=RTEMS_SUCCESSFUL) { // suspend RECV task
157 }
157 PRINTF("in SPIQ *** Error suspending RECV Task\n")
158 }
159 if (rtems_task_suspend(Task_id[TASKID_HOUS])!=RTEMS_SUCCESSFUL) { // suspend HOUS task
160 PRINTF("in SPIQ *** Error suspending HOUS Task\n")
161 }
158
162
159 //***************************
163 //***************************
160 // RESTART THE SPACEWIRE LINK
164 // RESTART THE SPACEWIRE LINK
161 status = spacewire_try_to_start();
162 if (status != RTEMS_SUCCESSFUL) {
163 spacewire_configure_link();
165 spacewire_configure_link();
164 }
165
166
166 //*******************
167 //*******************
167 // RESTART THE SYSTEM
168 // RESTART THE SYSTEM
168 //ioctl(fdSPW, SPACEWIRE_IOCTRL_CLR_STATISTICS); // clear statistics
169 //ioctl(fdSPW, SPACEWIRE_IOCTRL_CLR_STATISTICS); // clear statistics
169 status = rtems_task_restart( Task_id[TASKID_HOUS], 1 );
170 status = rtems_task_restart( Task_id[TASKID_HOUS], 1 );
170 if (status != RTEMS_SUCCESSFUL) {
171 if (status != RTEMS_SUCCESSFUL) {
171 PRINTF1("in SPIQ *** Error restarting HOUS Task *** code %d\n", status)
172 PRINTF1("in SPIQ *** Error restarting HOUS Task *** code %d\n", status)
173 }
174 if (rtems_task_restart(Task_id[TASKID_RECV], 1) != RTEMS_SUCCESSFUL) { // restart RECV task
175 PRINTF("in SPIQ *** Error restarting RECV Task\n")
176 }
177 //enter_mode(lfrMode, NULL); // enter the mode that was running before the SpaceWire interruption
172 }
178 }
173 if (rtems_task_restart(Task_id[TASKID_RECV], 1) != RTEMS_SUCCESSFUL) { // restart RECV task
174 PRINTF("in SPIQ *** Error restarting RECV Task\n")
175 }
176 //enter_mode(lfrMode, NULL); // enter the mode that was running before the SpaceWire interruption
177 }
179 }
178 }
180 }
179
181
180 void init_default_mode_parameters(void)
182 void init_default_mode_parameters(void)
181 {
183 {
182 // COMMON PARAMETERS
184 // COMMON PARAMETERS
183 param_common.sy_lfr_common0 = 0x00;
185 param_common.sy_lfr_common0 = 0x00;
184 param_common.sy_lfr_common1 = 0x10; // default value 0 0 0 1 0 0 0 0
186 param_common.sy_lfr_common1 = 0x10; // default value 0 0 0 1 0 0 0 0
185
187
186 // NORMAL MODE
188 // NORMAL MODE
187 param_norm.sy_lfr_n_swf_l = DEFAULT_SY_LFR_N_SWF_L; // nb sample
189 param_norm.sy_lfr_n_swf_l = DEFAULT_SY_LFR_N_SWF_L; // nb sample
188 param_norm.sy_lfr_n_swf_p = DEFAULT_SY_LFR_N_SWF_P; // sec
190 param_norm.sy_lfr_n_swf_p = DEFAULT_SY_LFR_N_SWF_P; // sec
189 param_norm.sy_lfr_n_asm_p = DEFAULT_SY_LFR_N_ASM_P; // sec
191 param_norm.sy_lfr_n_asm_p = DEFAULT_SY_LFR_N_ASM_P; // sec
190 param_norm.sy_lfr_n_bp_p0 = DEFAULT_SY_LFR_N_BP_P0; // sec
192 param_norm.sy_lfr_n_bp_p0 = DEFAULT_SY_LFR_N_BP_P0; // sec
191 param_norm.sy_lfr_n_bp_p1 = DEFAULT_SY_LFR_N_BP_P1; // sec
193 param_norm.sy_lfr_n_bp_p1 = DEFAULT_SY_LFR_N_BP_P1; // sec
192
194
193 // BURST MODE
195 // BURST MODE
194 param_burst.sy_lfr_b_bp_p0 = DEFAULT_SY_LFR_B_BP_P0; // sec
196 param_burst.sy_lfr_b_bp_p0 = DEFAULT_SY_LFR_B_BP_P0; // sec
195 param_burst.sy_lfr_b_bp_p1 = DEFAULT_SY_LFR_B_BP_P1; // sec
197 param_burst.sy_lfr_b_bp_p1 = DEFAULT_SY_LFR_B_BP_P1; // sec
196
198
197 // SBM1 MODE
199 // SBM1 MODE
198 param_sbm1.sy_lfr_s1_bp_p0 = DEFAULT_SY_LFR_S1_BP_P0; // sec
200 param_sbm1.sy_lfr_s1_bp_p0 = DEFAULT_SY_LFR_S1_BP_P0; // sec
199 param_sbm1.sy_lfr_s1_bp_p1 = DEFAULT_SY_LFR_B_BP_P1; // sec
201 param_sbm1.sy_lfr_s1_bp_p1 = DEFAULT_SY_LFR_B_BP_P1; // sec
200
202
201 // SBM2 MODE
203 // SBM2 MODE
202 param_sbm2.sy_lfr_s2_bp_p0 = DEFAULT_SY_LFR_S2_BP_P0; // sec
204 param_sbm2.sy_lfr_s2_bp_p0 = DEFAULT_SY_LFR_S2_BP_P0; // sec
203 param_sbm2.sy_lfr_s2_bp_p1 = DEFAULT_SY_LFR_S2_BP_P1; // sec
205 param_sbm2.sy_lfr_s2_bp_p1 = DEFAULT_SY_LFR_S2_BP_P1; // sec
204
206
205 // LOCAL PARAMETERS
207 // LOCAL PARAMETERS
206 // (2 snapshots of 2048 points per seconds) * (period of the NORM snashots)
208 // (2 snapshots of 2048 points per seconds) * (period of the NORM snashots)
207 param_local.local_sbm1_nb_cwf_max = 2 * param_norm.sy_lfr_n_swf_p;
209 param_local.local_sbm1_nb_cwf_max = 2 * param_norm.sy_lfr_n_swf_p;
208 // (period of the NORM snashots) / (8 seconds per snapshot at f2 = 256 Hz)
210 // (period of the NORM snashots) / (8 seconds per snapshot at f2 = 256 Hz)
209 param_local.local_sbm2_nb_cwf_max = param_norm.sy_lfr_n_swf_p / 8;
211 param_local.local_sbm2_nb_cwf_max = param_norm.sy_lfr_n_swf_p / 8;
210
212
211 PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max)
213 PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max)
212 PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max)
214 PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max)
213
215
214 param_local.local_sbm1_nb_cwf_sent = 0;
216 param_local.local_sbm1_nb_cwf_sent = 0;
215 param_local.local_sbm2_nb_cwf_sent = 0;
217 param_local.local_sbm2_nb_cwf_sent = 0;
216 }
218 }
217
219
218 void init_housekeeping_parameters(void)
220 void init_housekeeping_parameters(void)
219 {
221 {
220 unsigned int i = 0;
222 unsigned int i = 0;
221 unsigned int j = 0;
223 unsigned int j = 0;
222 unsigned int k = 0;
224 unsigned int k = 0;
223 char *parameters;
225 char *parameters;
224
226
225 parameters = (char*) &housekeeping_packet.lfr_status_word;
227 parameters = (char*) &housekeeping_packet.lfr_status_word;
226 for(i = 0; i< SIZE_HK_PARAMETERS; i++)
228 for(i = 0; i< SIZE_HK_PARAMETERS; i++)
227 {
229 {
228 parameters[i] = 0x00;
230 parameters[i] = 0x00;
229 }
231 }
230 // init status word
232 // init status word
231 housekeeping_packet.lfr_status_word[0] = 0x00;
233 housekeeping_packet.lfr_status_word[0] = 0x00;
232 housekeeping_packet.lfr_status_word[1] = 0x00;
234 housekeeping_packet.lfr_status_word[1] = 0x00;
233 // init software version
235 // init software version
234 housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1;
236 housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1;
235 housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2;
237 housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2;
236 housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3;
238 housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3;
237 housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4;
239 housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4;
238 // init sequence counters
240 // init sequence counters
239 for (i = 0; i<SEQ_CNT_NB_PID; i++)
241 for (i = 0; i<SEQ_CNT_NB_PID; i++)
240 {
242 {
241 for(j = 0; j<SEQ_CNT_NB_CAT; j++)
243 for(j = 0; j<SEQ_CNT_NB_CAT; j++)
242 {
244 {
243 for(k = 0; k<SEQ_CNT_NB_DEST_ID; k++)
245 for(k = 0; k<SEQ_CNT_NB_DEST_ID; k++)
244 {
246 {
245 sequenceCounters[i][j][k] = 0x00;
247 sequenceCounters[i][j][k] = 0x00;
246 }
248 }
247 }
249 }
248 }
250 }
249 }
251 }
250
252
251 int create_names( void )
253 int create_names( void )
252 {
254 {
253 // task names
255 // task names
254 Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' );
256 Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' );
255 Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' );
257 Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' );
256 Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' );
258 Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' );
257 Task_name[TASKID_SMIQ] = rtems_build_name( 'S', 'M', 'I', 'Q' );
259 Task_name[TASKID_SMIQ] = rtems_build_name( 'S', 'M', 'I', 'Q' );
258 Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' );
260 Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' );
259 Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' );
261 Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' );
260 Task_name[TASKID_BPF0] = rtems_build_name( 'B', 'P', 'F', '0' );
262 Task_name[TASKID_BPF0] = rtems_build_name( 'B', 'P', 'F', '0' );
261 Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' );
263 Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' );
262 Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' );
264 Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' );
263 Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' );
265 Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' );
264
266
265 // rate monotonic period name
267 // rate monotonic period name
266 HK_name = rtems_build_name( 'H', 'O', 'U', 'S' );
268 HK_name = rtems_build_name( 'H', 'O', 'U', 'S' );
267
269
268 return 0;
270 return 0;
269 }
271 }
270
272
271 int create_all_tasks( void )
273 int create_all_tasks( void )
272 {
274 {
273 rtems_status_code status;
275 rtems_status_code status;
274
276
275 // RECV
277 // RECV
276 status = rtems_task_create(
278 status = rtems_task_create(
277 Task_name[TASKID_RECV], 200, RTEMS_MINIMUM_STACK_SIZE * 2,
279 Task_name[TASKID_RECV], 200, RTEMS_MINIMUM_STACK_SIZE * 2,
278 RTEMS_DEFAULT_MODES,
280 RTEMS_DEFAULT_MODES,
279 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV]
281 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV]
280 );
282 );
281 // ACTN
283 // ACTN
282 status = rtems_task_create(
284 status = rtems_task_create(
283 Task_name[TASKID_ACTN], 100, RTEMS_MINIMUM_STACK_SIZE * 2,
285 Task_name[TASKID_ACTN], 100, RTEMS_MINIMUM_STACK_SIZE * 2,
284 RTEMS_DEFAULT_MODES,
286 RTEMS_DEFAULT_MODES,
285 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_ACTN]
287 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_ACTN]
286 );
288 );
287 // SPIQ
289 // SPIQ
288 status = rtems_task_create(
290 status = rtems_task_create(
289 Task_name[TASKID_SPIQ], 5, RTEMS_MINIMUM_STACK_SIZE * 2,
291 Task_name[TASKID_SPIQ], 5, RTEMS_MINIMUM_STACK_SIZE * 2,
290 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
292 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
291 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ]
293 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ]
292 );
294 );
293 // SMIQ
295 // SMIQ
294 status = rtems_task_create(
296 status = rtems_task_create(
295 Task_name[TASKID_SMIQ], 10, RTEMS_MINIMUM_STACK_SIZE * 2,
297 Task_name[TASKID_SMIQ], 10, RTEMS_MINIMUM_STACK_SIZE * 2,
296 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
298 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
297 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SMIQ]
299 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SMIQ]
298 );
300 );
299 // STAT
301 // STAT
300 status = rtems_task_create(
302 status = rtems_task_create(
301 Task_name[TASKID_STAT], 150, RTEMS_MINIMUM_STACK_SIZE * 2,
303 Task_name[TASKID_STAT], 150, RTEMS_MINIMUM_STACK_SIZE * 2,
302 RTEMS_DEFAULT_MODES,
304 RTEMS_DEFAULT_MODES,
303 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT]
305 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT]
304 );
306 );
305 // AVF0
307 // AVF0
306 status = rtems_task_create(
308 status = rtems_task_create(
307 Task_name[TASKID_AVF0], 50, RTEMS_MINIMUM_STACK_SIZE * 2,
309 Task_name[TASKID_AVF0], 50, RTEMS_MINIMUM_STACK_SIZE * 2,
308 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
310 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
309 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0]
311 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0]
310 );
312 );
311 // BPF0
313 // BPF0
312 status = rtems_task_create(
314 status = rtems_task_create(
313 Task_name[TASKID_BPF0], 50, RTEMS_MINIMUM_STACK_SIZE * 2,
315 Task_name[TASKID_BPF0], 50, RTEMS_MINIMUM_STACK_SIZE * 2,
314 RTEMS_DEFAULT_MODES,
316 RTEMS_DEFAULT_MODES,
315 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_BPF0]
317 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_BPF0]
316 );
318 );
317 // WFRM
319 // WFRM
318 status = rtems_task_create(
320 status = rtems_task_create(
319 Task_name[TASKID_WFRM], 50, RTEMS_MINIMUM_STACK_SIZE * 2,
321 Task_name[TASKID_WFRM], 50, RTEMS_MINIMUM_STACK_SIZE * 2,
320 RTEMS_DEFAULT_MODES,
322 RTEMS_DEFAULT_MODES,
321 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM]
323 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM]
322 );
324 );
323 // DUMB
325 // DUMB
324 status = rtems_task_create(
326 status = rtems_task_create(
325 Task_name[TASKID_DUMB], 200, RTEMS_MINIMUM_STACK_SIZE * 2,
327 Task_name[TASKID_DUMB], 200, RTEMS_MINIMUM_STACK_SIZE * 2,
326 RTEMS_DEFAULT_MODES,
328 RTEMS_DEFAULT_MODES,
327 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB]
329 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB]
328 );
330 );
329 // HOUS
331 // HOUS
330 status = rtems_task_create(
332 status = rtems_task_create(
331 Task_name[TASKID_HOUS], 199, RTEMS_MINIMUM_STACK_SIZE * 2,
333 Task_name[TASKID_HOUS], 199, RTEMS_MINIMUM_STACK_SIZE * 2,
332 RTEMS_DEFAULT_MODES,
334 RTEMS_DEFAULT_MODES,
333 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS]
335 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS]
334 );
336 );
335
337
336 return 0;
338 return 0;
337 }
339 }
338
340
339 int start_all_tasks( void )
341 int start_all_tasks( void )
340 {
342 {
341 rtems_status_code status;
343 rtems_status_code status;
342
344
343 status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 );
345 status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 );
344 if (status!=RTEMS_SUCCESSFUL) {
346 if (status!=RTEMS_SUCCESSFUL) {
345 PRINTF("In INIT *** Error starting TASK_SPIQ\n")
347 PRINTF("In INIT *** Error starting TASK_SPIQ\n")
346 }
348 }
347
349
348 status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 );
350 status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 );
349 if (status!=RTEMS_SUCCESSFUL) {
351 if (status!=RTEMS_SUCCESSFUL) {
350 PRINTF("In INIT *** Error starting TASK_RECV\n")
352 PRINTF("In INIT *** Error starting TASK_RECV\n")
351 }
353 }
352
354
353 status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 );
355 status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 );
354 if (status!=RTEMS_SUCCESSFUL) {
356 if (status!=RTEMS_SUCCESSFUL) {
355 PRINTF("In INIT *** Error starting TASK_ACTN\n")
357 PRINTF("In INIT *** Error starting TASK_ACTN\n")
356 }
358 }
357
359
358 status = rtems_task_start( Task_id[TASKID_SMIQ], smiq_task, 1 );
360 status = rtems_task_start( Task_id[TASKID_SMIQ], smiq_task, 1 );
359 if (status!=RTEMS_SUCCESSFUL) {
361 if (status!=RTEMS_SUCCESSFUL) {
360 PRINTF("In INIT *** Error starting TASK_BPPR\n")
362 PRINTF("In INIT *** Error starting TASK_BPPR\n")
361 }
363 }
362
364
363 status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 );
365 status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 );
364 if (status!=RTEMS_SUCCESSFUL) {
366 if (status!=RTEMS_SUCCESSFUL) {
365 PRINTF("In INIT *** Error starting TASK_STAT\n")
367 PRINTF("In INIT *** Error starting TASK_STAT\n")
366 }
368 }
367
369
368 status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, 1 );
370 status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, 1 );
369 if (status!=RTEMS_SUCCESSFUL) {
371 if (status!=RTEMS_SUCCESSFUL) {
370 PRINTF("In INIT *** Error starting TASK_AVF0\n")
372 PRINTF("In INIT *** Error starting TASK_AVF0\n")
371 }
373 }
372
374
373 status = rtems_task_start( Task_id[TASKID_BPF0], bpf0_task, 1 );
375 status = rtems_task_start( Task_id[TASKID_BPF0], bpf0_task, 1 );
374 if (status!=RTEMS_SUCCESSFUL) {
376 if (status!=RTEMS_SUCCESSFUL) {
375 PRINTF("In INIT *** Error starting TASK_BPF0\n")
377 PRINTF("In INIT *** Error starting TASK_BPF0\n")
376 }
378 }
377
379
378 status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 );
380 status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 );
379 if (status!=RTEMS_SUCCESSFUL) {
381 if (status!=RTEMS_SUCCESSFUL) {
380 PRINTF("In INIT *** Error starting TASK_WFRM\n")
382 PRINTF("In INIT *** Error starting TASK_WFRM\n")
381 }
383 }
382
384
383 status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 );
385 status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 );
384 if (status!=RTEMS_SUCCESSFUL) {
386 if (status!=RTEMS_SUCCESSFUL) {
385 PRINTF("In INIT *** Error starting TASK_DUMB\n")
387 PRINTF("In INIT *** Error starting TASK_DUMB\n")
386 }
388 }
387
389
388 status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 );
390 status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 );
389 if (status!=RTEMS_SUCCESSFUL) {
391 if (status!=RTEMS_SUCCESSFUL) {
390 PRINTF("In INIT *** Error starting TASK_HOUS\n")
392 PRINTF("In INIT *** Error starting TASK_HOUS\n")
391 }
393 }
392
394
393 return 0;
395 return 0;
394 }
396 }
395
397
396 int spacewire_configure_link( void )
398 int spacewire_configure_link( void )
397 {
399 {
398 rtems_status_code status;
400 rtems_status_code status;
399
401
400 close(fdSPW); // close the device if it is already open
402 close(fdSPW); // close the device if it is already open
401 PRINTF("OK *** in configure_spw_link *** try to open "GRSPW_DEVICE_NAME"\n")
403 PRINTF("OK *** in configure_spw_link *** try to open "GRSPW_DEVICE_NAME"\n")
402 fdSPW = open(GRSPW_DEVICE_NAME, O_RDWR); // open the device. the open call reset the hardware
404 fdSPW = open(GRSPW_DEVICE_NAME, O_RDWR); // open the device. the open call reset the hardware
403 if ( fdSPW<0 ) {
405 if ( fdSPW<0 ) {
404 PRINTF("ERR *** in configure_spw_link *** Error opening"GRSPW_DEVICE_NAME"\n")
406 PRINTF("ERR *** in configure_spw_link *** Error opening"GRSPW_DEVICE_NAME"\n")
405 }
407 }
406
408
407 while(ioctl(fdSPW, SPACEWIRE_IOCTRL_START, -1) != RTEMS_SUCCESSFUL){
409 while(ioctl(fdSPW, SPACEWIRE_IOCTRL_START, -1) != RTEMS_SUCCESSFUL){
408 PRINTF(".")
410 PRINTF(".")
409 fflush( stdout );
411 fflush( stdout );
410 close( fdSPW ); // close the device
412 close( fdSPW ); // close the device
411 fdSPW = open( GRSPW_DEVICE_NAME, O_RDWR ); // open the device. the open call reset the hardware
413 fdSPW = open( GRSPW_DEVICE_NAME, O_RDWR ); // open the device. the open call reset the hardware
412 if (fdSPW<0) {
414 if (fdSPW<0) {
413 PRINTF("ERR *** In configure_spw_link *** Error opening"GRSPW_DEVICE_NAME"\n")
415 PRINTF("ERR *** In configure_spw_link *** Error opening"GRSPW_DEVICE_NAME"\n")
414 }
416 }
415 rtems_task_wake_after(100);
417 rtems_task_wake_after(100);
416 }
418 }
417
419
418 PRINTF("OK *** In configure_spw_link *** "GRSPW_DEVICE_NAME" opened and started successfully\n")
420 PRINTF("OK *** In configure_spw_link *** "GRSPW_DEVICE_NAME" opened and started successfully\n")
419
421
420 spacewire_set_NP(1, REGS_ADDR_GRSPW); // No Port force
422 spacewire_set_NP(1, REGS_ADDR_GRSPW); // No Port force
421 spacewire_set_RE(1, REGS_ADDR_GRSPW); // the dedicated call seems to break the no port force configuration
423 spacewire_set_RE(1, REGS_ADDR_GRSPW); // the dedicated call seems to break the no port force configuration
422
424
423 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_RXBLOCK, 1); // sets the blocking mode for reception
425 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_RXBLOCK, 1); // sets the blocking mode for reception
424 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_RXBLOCK\n")
426 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_RXBLOCK\n")
425 //
427 //
426 //status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_EVENT_ID, Task_id[TASKID_SPIQ]); // sets the task ID to which an event is sent when a
428 //status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_EVENT_ID, Task_id[TASKID_SPIQ]); // sets the task ID to which an event is sent when a
427 //if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_EVENT_ID\n") // link-error interrupt occurs
429 //if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_EVENT_ID\n") // link-error interrupt occurs
428 //
430 //
429 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_DISABLE_ERR, 0); // automatic link-disabling due to link-error interrupts
431 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_DISABLE_ERR, 0); // automatic link-disabling due to link-error interrupts
430 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_DISABLE_ERR\n")
432 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_DISABLE_ERR\n")
431 //
433 //
432 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ, 1); // sets the link-error interrupt bit
434 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ, 1); // sets the link-error interrupt bit
433 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ\n")
435 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ\n")
434 //
436 //
435 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_TXBLOCK, 0); // transmission blocks
437 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_TXBLOCK, 0); // transmission blocks
436 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK\n")
438 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK\n")
437 //
439 //
438 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL, 0); // transmission blocks on full
440 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL, 0); // transmission blocks on full
439 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL\n")
441 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL\n")
440 //
442 //
441 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_TCODE_CTRL, 0x0909);
443 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_TCODE_CTRL, 0x0909);
442 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TCODE_CTRL,\n")
444 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TCODE_CTRL,\n")
443
445
444 PRINTF("OK *** in configure_spw_link *** "GRSPW_DEVICE_NAME" configured successfully\n")
446 PRINTF("OK *** in configure_spw_link *** "GRSPW_DEVICE_NAME" configured successfully\n")
445
447
446 return RTEMS_SUCCESSFUL;
448 return RTEMS_SUCCESSFUL;
447 }
449 }
448
450
449 int spacewire_try_to_start(void)
451 int spacewire_wait_for_link(void)
450 {
452 {
451 unsigned int i;
453 unsigned int i;
452 int linkStatus;
454 int linkStatus;
453 rtems_status_code status = RTEMS_UNSATISFIED;
455 rtems_status_code status = RTEMS_UNSATISFIED;
454
456
455 for(i = 0; i< 10; i++){
457 for(i = 0; i< 10; i++){
456 PRINTF(".")
458 PRINTF(".")
457 fflush( stdout );
459 fflush( stdout );
458 ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status
460 ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status
459 PRINTF1("in spacewire_try_to_start *** link status is: %s\n", lstates[linkStatus])
461 PRINTF1("in spacewire_try_to_start *** link status is: %s\n", lstates[linkStatus])
460 if ( linkStatus == 5) {
462 if ( linkStatus == 5) {
461 PRINTF("in spacewire_try_to_start *** link is running\n")
463 PRINTF("in spacewire_try_to_start *** link is running\n")
462 status = RTEMS_SUCCESSFUL;
464 status = RTEMS_SUCCESSFUL;
463 break;
465 break;
464 }
466 }
465 rtems_task_wake_after(100);
467 rtems_task_wake_after(100);
466 }
468 }
467
469
468 return status;
470 return status;
469 }
471 }
470
472
471 void spacewire_set_NP(unsigned char val, unsigned int regAddr) // [N]o [P]ort force
473 void spacewire_set_NP(unsigned char val, unsigned int regAddr) // [N]o [P]ort force
472 {
474 {
473 unsigned int *spwptr = (unsigned int*) regAddr;
475 unsigned int *spwptr = (unsigned int*) regAddr;
474
476
475 if (val == 1) {
477 if (val == 1) {
476 *spwptr = *spwptr | 0x00100000; // [NP] set the No port force bit
478 *spwptr = *spwptr | 0x00100000; // [NP] set the No port force bit
477 }
479 }
478 if (val== 0) {
480 if (val== 0) {
479 *spwptr = *spwptr & 0xffdfffff;
481 *spwptr = *spwptr & 0xffdfffff;
480 }
482 }
481 }
483 }
482
484
483 void spacewire_set_RE(unsigned char val, unsigned int regAddr) // [R]MAP [E]nable
485 void spacewire_set_RE(unsigned char val, unsigned int regAddr) // [R]MAP [E]nable
484 {
486 {
485 unsigned int *spwptr = (unsigned int*) regAddr;
487 unsigned int *spwptr = (unsigned int*) regAddr;
486
488
487 if (val == 1)
489 if (val == 1)
488 {
490 {
489 *spwptr = *spwptr | 0x00010000; // [RE] set the RMAP Enable bit
491 *spwptr = *spwptr | 0x00010000; // [RE] set the RMAP Enable bit
490 }
492 }
491 if (val== 0)
493 if (val== 0)
492 {
494 {
493 *spwptr = *spwptr & 0xfffdffff;
495 *spwptr = *spwptr & 0xfffdffff;
494 }
496 }
495 }
497 }
496
498
497 void spacewire_compute_stats_offsets()
499 void spacewire_compute_stats_offsets()
498 {
500 {
499 spw_stats spacewire_stats_grspw;
501 spw_stats spacewire_stats_grspw;
500 rtems_status_code status;
502 rtems_status_code status;
501
503
502 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw );
504 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw );
503
505
504 spacewire_stats_backup.packets_received = spacewire_stats_grspw.packets_received
506 spacewire_stats_backup.packets_received = spacewire_stats_grspw.packets_received
505 + spacewire_stats.packets_received;
507 + spacewire_stats.packets_received;
506 spacewire_stats_backup.packets_sent = spacewire_stats_grspw.packets_sent
508 spacewire_stats_backup.packets_sent = spacewire_stats_grspw.packets_sent
507 + spacewire_stats.packets_sent;
509 + spacewire_stats.packets_sent;
508 spacewire_stats_backup.parity_err = spacewire_stats_grspw.parity_err
510 spacewire_stats_backup.parity_err = spacewire_stats_grspw.parity_err
509 + spacewire_stats.parity_err;
511 + spacewire_stats.parity_err;
510 spacewire_stats_backup.disconnect_err = spacewire_stats_grspw.disconnect_err
512 spacewire_stats_backup.disconnect_err = spacewire_stats_grspw.disconnect_err
511 + spacewire_stats.disconnect_err;
513 + spacewire_stats.disconnect_err;
512 spacewire_stats_backup.escape_err = spacewire_stats_grspw.escape_err
514 spacewire_stats_backup.escape_err = spacewire_stats_grspw.escape_err
513 + spacewire_stats.escape_err;
515 + spacewire_stats.escape_err;
514 spacewire_stats_backup.credit_err = spacewire_stats_grspw.credit_err
516 spacewire_stats_backup.credit_err = spacewire_stats_grspw.credit_err
515 + spacewire_stats.credit_err;
517 + spacewire_stats.credit_err;
516 spacewire_stats_backup.write_sync_err = spacewire_stats_grspw.write_sync_err
518 spacewire_stats_backup.write_sync_err = spacewire_stats_grspw.write_sync_err
517 + spacewire_stats.write_sync_err;
519 + spacewire_stats.write_sync_err;
518 spacewire_stats_backup.rx_rmap_header_crc_err = spacewire_stats_grspw.rx_rmap_header_crc_err
520 spacewire_stats_backup.rx_rmap_header_crc_err = spacewire_stats_grspw.rx_rmap_header_crc_err
519 + spacewire_stats.rx_rmap_header_crc_err;
521 + spacewire_stats.rx_rmap_header_crc_err;
520 spacewire_stats_backup.rx_rmap_data_crc_err = spacewire_stats_grspw.rx_rmap_data_crc_err
522 spacewire_stats_backup.rx_rmap_data_crc_err = spacewire_stats_grspw.rx_rmap_data_crc_err
521 + spacewire_stats.rx_rmap_data_crc_err;
523 + spacewire_stats.rx_rmap_data_crc_err;
522 spacewire_stats_backup.early_ep = spacewire_stats_grspw.early_ep
524 spacewire_stats_backup.early_ep = spacewire_stats_grspw.early_ep
523 + spacewire_stats.early_ep;
525 + spacewire_stats.early_ep;
524 spacewire_stats_backup.invalid_address = spacewire_stats_grspw.invalid_address
526 spacewire_stats_backup.invalid_address = spacewire_stats_grspw.invalid_address
525 + spacewire_stats.invalid_address;
527 + spacewire_stats.invalid_address;
526 spacewire_stats_backup.rx_eep_err = spacewire_stats_grspw.rx_eep_err
528 spacewire_stats_backup.rx_eep_err = spacewire_stats_grspw.rx_eep_err
527 + spacewire_stats.rx_eep_err;
529 + spacewire_stats.rx_eep_err;
528 spacewire_stats_backup.rx_truncated = spacewire_stats_grspw.rx_truncated
530 spacewire_stats_backup.rx_truncated = spacewire_stats_grspw.rx_truncated
529 + spacewire_stats.rx_truncated;
531 + spacewire_stats.rx_truncated;
530 }
532 }
531
533
532 rtems_status_code write_spw(spw_ioctl_pkt_send* spw_ioctl_send)
534 rtems_status_code write_spw(spw_ioctl_pkt_send* spw_ioctl_send)
533 {
535 {
534 rtems_status_code status;
536 rtems_status_code status;
535 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, spw_ioctl_send );
537 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, spw_ioctl_send );
536 if (status != RTEMS_SUCCESSFUL){
538 if (status != RTEMS_SUCCESSFUL){
537 //PRINTF1("ERR *** in write_spw *** write operation failed with code: %d\n", status)
539 //PRINTF1("ERR *** in write_spw *** write operation failed with code: %d\n", status)
538 }
540 }
539 return status;
541 return status;
540 }
542 }
541
543
542 void timecode_irq_handler(void *pDev, void *regs, int minor, unsigned int tc)
544 void timecode_irq_handler(void *pDev, void *regs, int minor, unsigned int tc)
543 {
545 {
544 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_1 ) != RTEMS_SUCCESSFUL) {
546 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_1 ) != RTEMS_SUCCESSFUL) {
545 printf("In timecode_irq_handler *** Error sending event to DUMB\n");
547 printf("In timecode_irq_handler *** Error sending event to DUMB\n");
546 }
548 }
547 }
549 }
@@ -1,205 +1,205
1 #include <fsw_misc.h>
1 #include <fsw_misc.h>
2 #include <fsw_params.h>
2 #include <fsw_params.h>
3
3
4 extern rtems_id Task_id[]; /* array of task ids */
4 extern rtems_id Task_id[]; /* array of task ids */
5 extern int fdSPW;
5 extern int fdSPW;
6 extern TMHeader_t housekeeping_header;
6 extern TMHeader_t housekeeping_header;
7 extern char housekeeping_data[];
7 extern char housekeeping_data[];
8 extern Packet_TM_LFR_HK_t housekeeping_packet;
8 extern Packet_TM_LFR_HK_t housekeeping_packet;
9
9
10 int configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider,
10 int configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider,
11 unsigned char interrupt_level, rtems_isr (*timer_isr)() )
11 unsigned char interrupt_level, rtems_isr (*timer_isr)() )
12 { // configure the timer for the waveforms simulation
12 { // configure the timer for the waveforms simulation
13 rtems_status_code status;
13 rtems_status_code status;
14 rtems_isr_entry old_isr_handler;
14 rtems_isr_entry old_isr_handler;
15
15
16 status = rtems_interrupt_catch( timer_isr, interrupt_level, &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels
16 status = rtems_interrupt_catch( timer_isr, interrupt_level, &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels
17 //if (status==RTEMS_SUCCESSFUL) PRINTF("In configure_timer_for_wf_simulation *** rtems_interrupt_catch successfullly configured\n")
17 //if (status==RTEMS_SUCCESSFUL) PRINTF("In configure_timer_for_wf_simulation *** rtems_interrupt_catch successfullly configured\n")
18
18
19 gptimer_regs->timer[timer].reload = clock_divider; // base clock frequency is 1 MHz
19 gptimer_regs->timer[timer].reload = clock_divider; // base clock frequency is 1 MHz
20 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any
20 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any
21 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000004; // LD load value from the reload register
21 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000004; // LD load value from the reload register
22 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000001; // EN enable the timer
22 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000001; // EN enable the timer
23 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000002; // RS restart
23 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000002; // RS restart
24 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000008; // IE interrupt enable
24 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000008; // IE interrupt enable
25
25
26 return 1;
26 return 1;
27 }
27 }
28
28
29 void update_spacewire_statistics()
29 void update_spacewire_statistics()
30 {
30 {
31 rtems_status_code status;
31 rtems_status_code status;
32 spw_stats spacewire_stats_grspw;
32 spw_stats spacewire_stats_grspw;
33
33
34 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw );
34 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw );
35
35
36 spacewire_stats.packets_received = spacewire_stats_backup.packets_received
36 spacewire_stats.packets_received = spacewire_stats_backup.packets_received
37 + spacewire_stats_grspw.packets_received;
37 + spacewire_stats_grspw.packets_received;
38 spacewire_stats.packets_sent = spacewire_stats_backup.packets_sent
38 spacewire_stats.packets_sent = spacewire_stats_backup.packets_sent
39 + spacewire_stats_grspw.packets_sent;
39 + spacewire_stats_grspw.packets_sent;
40 spacewire_stats.parity_err = spacewire_stats_backup.parity_err
40 spacewire_stats.parity_err = spacewire_stats_backup.parity_err
41 + spacewire_stats_grspw.parity_err;
41 + spacewire_stats_grspw.parity_err;
42 spacewire_stats.disconnect_err = spacewire_stats_backup.disconnect_err
42 spacewire_stats.disconnect_err = spacewire_stats_backup.disconnect_err
43 + spacewire_stats_grspw.disconnect_err;
43 + spacewire_stats_grspw.disconnect_err;
44 spacewire_stats.escape_err = spacewire_stats_backup.escape_err
44 spacewire_stats.escape_err = spacewire_stats_backup.escape_err
45 + spacewire_stats_grspw.escape_err;
45 + spacewire_stats_grspw.escape_err;
46 spacewire_stats.credit_err = spacewire_stats_backup.credit_err
46 spacewire_stats.credit_err = spacewire_stats_backup.credit_err
47 + spacewire_stats_grspw.credit_err;
47 + spacewire_stats_grspw.credit_err;
48 spacewire_stats.write_sync_err = spacewire_stats_backup.write_sync_err
48 spacewire_stats.write_sync_err = spacewire_stats_backup.write_sync_err
49 + spacewire_stats_grspw.write_sync_err;
49 + spacewire_stats_grspw.write_sync_err;
50 spacewire_stats.rx_rmap_header_crc_err = spacewire_stats_backup.rx_rmap_header_crc_err
50 spacewire_stats.rx_rmap_header_crc_err = spacewire_stats_backup.rx_rmap_header_crc_err
51 + spacewire_stats_grspw.rx_rmap_header_crc_err;
51 + spacewire_stats_grspw.rx_rmap_header_crc_err;
52 spacewire_stats.rx_rmap_data_crc_err = spacewire_stats_backup.rx_rmap_data_crc_err
52 spacewire_stats.rx_rmap_data_crc_err = spacewire_stats_backup.rx_rmap_data_crc_err
53 + spacewire_stats_grspw.rx_rmap_data_crc_err;
53 + spacewire_stats_grspw.rx_rmap_data_crc_err;
54 spacewire_stats.early_ep = spacewire_stats_backup.early_ep
54 spacewire_stats.early_ep = spacewire_stats_backup.early_ep
55 + spacewire_stats_grspw.early_ep;
55 + spacewire_stats_grspw.early_ep;
56 spacewire_stats.invalid_address = spacewire_stats_backup.invalid_address
56 spacewire_stats.invalid_address = spacewire_stats_backup.invalid_address
57 + spacewire_stats_grspw.invalid_address;
57 + spacewire_stats_grspw.invalid_address;
58 spacewire_stats.rx_eep_err = spacewire_stats_backup.rx_eep_err
58 spacewire_stats.rx_eep_err = spacewire_stats_backup.rx_eep_err
59 + spacewire_stats_grspw.rx_eep_err;
59 + spacewire_stats_grspw.rx_eep_err;
60 spacewire_stats.rx_truncated = spacewire_stats_backup.rx_truncated
60 spacewire_stats.rx_truncated = spacewire_stats_backup.rx_truncated
61 + spacewire_stats_grspw.rx_truncated;
61 + spacewire_stats_grspw.rx_truncated;
62 //spacewire_stats.tx_link_err;
62 //spacewire_stats.tx_link_err;
63
63
64 //****************************
64 //****************************
65 // DPU_SPACEWIRE_IF_STATISTICS
65 // DPU_SPACEWIRE_IF_STATISTICS
66 housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[0] = (unsigned char) (spacewire_stats.packets_received >> 8);
66 housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[0] = (unsigned char) (spacewire_stats.packets_received >> 8);
67 housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[1] = (unsigned char) (spacewire_stats.packets_received);
67 housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[1] = (unsigned char) (spacewire_stats.packets_received);
68 housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[0] = (unsigned char) (spacewire_stats.packets_sent >> 8);
68 housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[0] = (unsigned char) (spacewire_stats.packets_sent >> 8);
69 housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[1] = (unsigned char) (spacewire_stats.packets_sent);
69 housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[1] = (unsigned char) (spacewire_stats.packets_sent);
70 //housekeeping_packet.hk_lfr_dpu_spw_tick_out_cnt;
70 //housekeeping_packet.hk_lfr_dpu_spw_tick_out_cnt;
71 //housekeeping_packet.hk_lfr_dpu_spw_last_timc;
71 //housekeeping_packet.hk_lfr_dpu_spw_last_timc;
72
72
73 //******************************************
73 //******************************************
74 // ERROR COUNTERS / SPACEWIRE / LOW SEVERITY
74 // ERROR COUNTERS / SPACEWIRE / LOW SEVERITY
75 housekeeping_packet.hk_lfr_dpu_spw_parity = (unsigned char) spacewire_stats.parity_err;
75 housekeeping_packet.hk_lfr_dpu_spw_parity = (unsigned char) spacewire_stats.parity_err;
76 housekeeping_packet.hk_lfr_dpu_spw_disconnect = (unsigned char) spacewire_stats.disconnect_err;
76 housekeeping_packet.hk_lfr_dpu_spw_disconnect = (unsigned char) spacewire_stats.disconnect_err;
77 housekeeping_packet.hk_lfr_dpu_spw_escape = (unsigned char) spacewire_stats.escape_err;
77 housekeeping_packet.hk_lfr_dpu_spw_escape = (unsigned char) spacewire_stats.escape_err;
78 housekeeping_packet.hk_lfr_dpu_spw_credit = (unsigned char) spacewire_stats.credit_err;
78 housekeeping_packet.hk_lfr_dpu_spw_credit = (unsigned char) spacewire_stats.credit_err;
79 housekeeping_packet.hk_lfr_dpu_spw_write_sync = (unsigned char) spacewire_stats.write_sync_err;
79 housekeeping_packet.hk_lfr_dpu_spw_write_sync = (unsigned char) spacewire_stats.write_sync_err;
80 // housekeeping_packet.hk_lfr_dpu_spw_rx_ahb;
80 // housekeeping_packet.hk_lfr_dpu_spw_rx_ahb;
81 // housekeeping_packet.hk_lfr_dpu_spw_tx_ahb;
81 // housekeeping_packet.hk_lfr_dpu_spw_tx_ahb;
82 housekeeping_packet.hk_lfr_dpu_spw_header_crc = (unsigned char) spacewire_stats.rx_rmap_header_crc_err;
82 housekeeping_packet.hk_lfr_dpu_spw_header_crc = (unsigned char) spacewire_stats.rx_rmap_header_crc_err;
83 housekeeping_packet.hk_lfr_dpu_spw_data_crc = (unsigned char) spacewire_stats.rx_rmap_data_crc_err;
83 housekeeping_packet.hk_lfr_dpu_spw_data_crc = (unsigned char) spacewire_stats.rx_rmap_data_crc_err;
84
84
85 //*********************************************
85 //*********************************************
86 // ERROR COUNTERS / SPACEWIRE / MEDIUM SEVERITY
86 // ERROR COUNTERS / SPACEWIRE / MEDIUM SEVERITY
87 housekeeping_packet.hk_lfr_dpu_spw_early_eop = (unsigned char) spacewire_stats.early_ep;
87 housekeeping_packet.hk_lfr_dpu_spw_early_eop = (unsigned char) spacewire_stats.early_ep;
88 housekeeping_packet.hk_lfr_dpu_spw_invalid_addr = (unsigned char) spacewire_stats.invalid_address;
88 housekeeping_packet.hk_lfr_dpu_spw_invalid_addr = (unsigned char) spacewire_stats.invalid_address;
89 housekeeping_packet.hk_lfr_dpu_spw_eep = (unsigned char) spacewire_stats.rx_eep_err;
89 housekeeping_packet.hk_lfr_dpu_spw_eep = (unsigned char) spacewire_stats.rx_eep_err;
90 housekeeping_packet.hk_lfr_dpu_spw_rx_too_big = (unsigned char) spacewire_stats.rx_truncated;
90 housekeeping_packet.hk_lfr_dpu_spw_rx_too_big = (unsigned char) spacewire_stats.rx_truncated;
91
91
92 }
92 }
93
93
94 int send_console_outputs_on_serial_port( void ) // Send the console outputs on the serial port
94 int send_console_outputs_on_apbuart_port( void ) // Send the console outputs on the apbuart port
95 {
95 {
96 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART;
96 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART;
97
97
98 apbuart_regs->ctrl = apbuart_regs->ctrl & APBUART_CTRL_REG_MASK_DB;
98 apbuart_regs->ctrl = apbuart_regs->ctrl & APBUART_CTRL_REG_MASK_DB;
99 PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n")
99 PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n")
100
100
101 return 0;
101 return 0;
102 }
102 }
103
103
104 int set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value)
104 int set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value)
105 {
105 {
106 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) regs;
106 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) regs;
107
107
108 apbuart_regs->scaler = value;
108 apbuart_regs->scaler = value;
109 PRINTF1("OK *** COM port scaler reload register set to %x\n", value)
109 PRINTF1("OK *** apbuart port scaler reload register set to 0x%x\n", value)
110
110
111 return 0;
111 return 0;
112 }
112 }
113
113
114 //************
114 //************
115 // RTEMS TASKS
115 // RTEMS TASKS
116
116
117 rtems_task stat_task(rtems_task_argument argument)
117 rtems_task stat_task(rtems_task_argument argument)
118 {
118 {
119 int i;
119 int i;
120 int j;
120 int j;
121 i = 0;
121 i = 0;
122 j = 0;
122 j = 0;
123 PRINTF("in STAT *** \n")
123 PRINTF("in STAT *** \n")
124 while(1){
124 while(1){
125 rtems_task_wake_after(1000);
125 rtems_task_wake_after(1000);
126 PRINTF1("%d\n", j)
126 PRINTF1("%d\n", j)
127 if (i == 2) {
127 if (i == 2) {
128 #ifdef PRINT_TASK_STATISTICS
128 #ifdef PRINT_TASK_STATISTICS
129 rtems_cpu_usage_report();
129 rtems_cpu_usage_report();
130 rtems_cpu_usage_reset();
130 rtems_cpu_usage_reset();
131 #endif
131 #endif
132 i = 0;
132 i = 0;
133 }
133 }
134 else i++;
134 else i++;
135 j++;
135 j++;
136 }
136 }
137 }
137 }
138
138
139 rtems_task hous_task(rtems_task_argument argument)
139 rtems_task hous_task(rtems_task_argument argument)
140 {
140 {
141 int result;
141 int result;
142 rtems_status_code status;
142 rtems_status_code status;
143
143
144 PRINTF("in HOUS ***\n")
144 PRINTF("in HOUS ***\n")
145
145
146 if (rtems_rate_monotonic_ident( HK_name, &HK_id) != RTEMS_SUCCESSFUL) {
146 if (rtems_rate_monotonic_ident( HK_name, &HK_id) != RTEMS_SUCCESSFUL) {
147 status = rtems_rate_monotonic_create( HK_name, &HK_id );
147 status = rtems_rate_monotonic_create( HK_name, &HK_id );
148 if( status != RTEMS_SUCCESSFUL ) {
148 if( status != RTEMS_SUCCESSFUL ) {
149 PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status )
149 PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status )
150 }
150 }
151 }
151 }
152
152
153 housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
153 housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
154 housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID;
154 housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID;
155 housekeeping_packet.reserved = 0x00;
155 housekeeping_packet.reserved = 0x00;
156 housekeeping_packet.userApplication = 0x00;
156 housekeeping_packet.userApplication = 0x00;
157 housekeeping_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_HK >> 8);
157 housekeeping_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_HK >> 8);
158 housekeeping_packet.packetID[1] = (unsigned char) (TM_PACKET_ID_HK);
158 housekeeping_packet.packetID[1] = (unsigned char) (TM_PACKET_ID_HK);
159 housekeeping_packet.packetSequenceControl[0] = 0xc0;
159 housekeeping_packet.packetSequenceControl[0] = 0xc0;
160 housekeeping_packet.packetSequenceControl[1] = 0x00;
160 housekeeping_packet.packetSequenceControl[1] = 0x00;
161 housekeeping_packet.packetLength[0] = 0x00;
161 housekeeping_packet.packetLength[0] = 0x00;
162 housekeeping_packet.packetLength[1] = 0x77;
162 housekeeping_packet.packetLength[1] = 0x77;
163 housekeeping_packet.dataFieldHeader[0] = 0x10;
163 housekeeping_packet.dataFieldHeader[0] = 0x10;
164 housekeeping_packet.dataFieldHeader[1] = TM_TYPE_HK;
164 housekeeping_packet.dataFieldHeader[1] = TM_TYPE_HK;
165 housekeeping_packet.dataFieldHeader[2] = TM_SUBTYPE_HK;
165 housekeeping_packet.dataFieldHeader[2] = TM_SUBTYPE_HK;
166 housekeeping_packet.dataFieldHeader[3] = TM_DESTINATION_ID_GROUND;
166 housekeeping_packet.dataFieldHeader[3] = TM_DESTINATION_ID_GROUND;
167
167
168 status = rtems_rate_monotonic_cancel(HK_id);
168 status = rtems_rate_monotonic_cancel(HK_id);
169 if( status != RTEMS_SUCCESSFUL ) {
169 if( status != RTEMS_SUCCESSFUL ) {
170 PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status )
170 PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status )
171 }
171 }
172 else {
172 else {
173 PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n")
173 PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n")
174 }
174 }
175
175
176 while(1){ // launch the rate monotonic task
176 while(1){ // launch the rate monotonic task
177 status = rtems_rate_monotonic_period( HK_id, HK_PERIOD );
177 status = rtems_rate_monotonic_period( HK_id, HK_PERIOD );
178 if ( status != RTEMS_SUCCESSFUL ) {
178 if ( status != RTEMS_SUCCESSFUL ) {
179 PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_period *** code %d\n", status);
179 PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_period *** code %d\n", status);
180 }
180 }
181 else {
181 else {
182 housekeeping_packet.dataFieldHeader[4] = (unsigned char) (time_management_regs->coarse_time>>24);
182 housekeeping_packet.dataFieldHeader[4] = (unsigned char) (time_management_regs->coarse_time>>24);
183 housekeeping_packet.dataFieldHeader[5] = (unsigned char) (time_management_regs->coarse_time>>16);
183 housekeeping_packet.dataFieldHeader[5] = (unsigned char) (time_management_regs->coarse_time>>16);
184 housekeeping_packet.dataFieldHeader[6] = (unsigned char) (time_management_regs->coarse_time>>8);
184 housekeeping_packet.dataFieldHeader[6] = (unsigned char) (time_management_regs->coarse_time>>8);
185 housekeeping_packet.dataFieldHeader[7] = (unsigned char) (time_management_regs->coarse_time);
185 housekeeping_packet.dataFieldHeader[7] = (unsigned char) (time_management_regs->coarse_time);
186 housekeeping_packet.dataFieldHeader[8] = (unsigned char) (time_management_regs->fine_time>>8);
186 housekeeping_packet.dataFieldHeader[8] = (unsigned char) (time_management_regs->fine_time>>8);
187 housekeeping_packet.dataFieldHeader[9] = (unsigned char) (time_management_regs->fine_time);
187 housekeeping_packet.dataFieldHeader[9] = (unsigned char) (time_management_regs->fine_time);
188 housekeeping_packet.sid = SID_HK;
188 housekeeping_packet.sid = SID_HK;
189
189
190 update_spacewire_statistics();
190 update_spacewire_statistics();
191
191
192 result = write ( fdSPW, &housekeeping_packet, LEN_TM_LFR_HK);
192 result = write ( fdSPW, &housekeeping_packet, LEN_TM_LFR_HK);
193 if (result==-1) {
193 if (result==-1) {
194 PRINTF("ERR *** in HOUS *** HK send\n");
194 PRINTF("ERR *** in HOUS *** HK send\n");
195 }
195 }
196 }
196 }
197 }
197 }
198
198
199 PRINTF("in HOUS *** deleting task\n")
199 PRINTF("in HOUS *** deleting task\n")
200
200
201 status = rtems_task_delete( RTEMS_SELF ); // should not return
201 status = rtems_task_delete( RTEMS_SELF ); // should not return
202 printf( "rtems_task_delete returned with status of %d.\n", status );
202 printf( "rtems_task_delete returned with status of %d.\n", status );
203 exit( 1 );
203 exit( 1 );
204 }
204 }
205
205
@@ -1,683 +1,683
1 #include <wf_handler.h>
1 #include <wf_handler.h>
2
2
3 rtems_isr waveforms_isr( rtems_vector_number vector )
3 rtems_isr waveforms_isr( rtems_vector_number vector )
4 {
4 {
5 unsigned char lfrMode;
5 unsigned char lfrMode;
6 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
6 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
7
7
8 switch(lfrMode)
8 switch(lfrMode)
9 {
9 {
10 //********
10 //********
11 // STANDBY
11 // STANDBY
12 case(LFR_MODE_STANDBY):
12 case(LFR_MODE_STANDBY):
13 break;
13 break;
14
14
15 //******
15 //******
16 // NORMAL
16 // NORMAL
17 case(LFR_MODE_NORMAL):
17 case(LFR_MODE_NORMAL):
18 #ifdef GSA
18 #ifdef GSA
19 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
19 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
20 #else
20 #else
21 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
22 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) {
23 PRINTF("in waveform_isr *** Error sending event to DUMB\n");
23 PRINTF("in waveform_isr *** Error sending event to DUMB\n");
24 }
24 }
25 }
25 }
26 else {
26 else {
27 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
28 waveform_picker_regs->burst_enable = 0x00;
28 waveform_picker_regs->burst_enable = 0x00;
29 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) {
30 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) {
31 PRINTF("in waveform_isr *** Error sending event to DUMB\n");
31 PRINTF("in waveform_isr *** Error sending event to DUMB\n");
32 }
32 }
33 }
33 }
34 }
34 }
35 }
35 }
36 #endif
36 #endif
37 break;
37 break;
38
38
39 //******
39 //******
40 // BURST
40 // BURST
41 case(LFR_MODE_BURST):
41 case(LFR_MODE_BURST):
42 #ifdef GSA
42 #ifdef GSA
43 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
43 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
44 #else
44 #else
45 if (waveform_picker_regs->burst_enable == 0x44) {
45 if (waveform_picker_regs->burst_enable == 0x44) {
46 if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) {
46 if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) {
47 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_bis);
47 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_bis);
48 }
48 }
49 else {
49 else {
50 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2);
50 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2);
51 }
51 }
52 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) {
52 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) {
53 PRINTF("in waveforms_isr *** Error sending event to WFRM\n")
53 PRINTF("in waveforms_isr *** Error sending event to WFRM\n")
54 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
54 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
55 }
55 }
56 }
56 }
57 waveform_picker_regs->status = 0x00;
57 waveform_picker_regs->status = 0x00;
58 #endif
58 #endif
59 break;
59 break;
60
60
61 //*****
61 //*****
62 // SBM1
62 // SBM1
63 case(LFR_MODE_SBM1):
63 case(LFR_MODE_SBM1):
64 #ifdef GSA
64 #ifdef GSA
65 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
65 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
66 #else
66 #else
67 if ((waveform_picker_regs->status & 0x02) == 0x02){ // check the f1 full bit
67 if ((waveform_picker_regs->status & 0x02) == 0x02){ // check the f1 full bit
68 // (1) change the receiving buffer for the waveform picker
68 // (1) change the receiving buffer for the waveform picker
69 if (waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1) {
69 if (waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1) {
70 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_bis);
70 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_bis);
71 }
71 }
72 else {
72 else {
73 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1);
73 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1);
74 }
74 }
75 // (2) send an event for the waveforms transmission
75 // (2) send an event for the waveforms transmission
76 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM1 ) != RTEMS_SUCCESSFUL) {
76 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM1 ) != RTEMS_SUCCESSFUL) {
77 PRINTF("in waveforms_isr *** Error sending event to WFRM\n")
77 PRINTF("in waveforms_isr *** Error sending event to WFRM\n")
78 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
78 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
79 }
79 }
80 waveform_picker_regs->status = waveform_picker_regs->status & 0x000d; // reset the f1 full bit to 0
80 waveform_picker_regs->status = waveform_picker_regs->status & 0x000d; // reset the f1 full bit to 0
81 }
81 }
82 if ( ( (waveform_picker_regs->status & 0x05) == 0x05 ) ) { // [0101] f3 f2 f1 f0, check the f2 and f0 full bit
82 if ( ( (waveform_picker_regs->status & 0x05) == 0x05 ) ) { // [0101] f3 f2 f1 f0, check the f2 and f0 full bit
83 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
83 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
84 PRINTF("in waveforms_isr *** Error sending event to WFRM\n")
84 PRINTF("in waveforms_isr *** Error sending event to WFRM\n")
85 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
85 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
86 }
86 }
87 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x05; // [0101] // enable f2 and f0
87 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x05; // [0101] // enable f2 and f0
88 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffaaa; // set to 0 the bits related to f2 and f0
88 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffaaa; // set to 0 the bits related to f2 and f0
89 }
89 }
90 #endif
90 #endif
91 break;
91 break;
92
92
93 //*****
93 //*****
94 // SBM2
94 // SBM2
95 case(LFR_MODE_SBM2):
95 case(LFR_MODE_SBM2):
96 #ifdef GSA
96 #ifdef GSA
97 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
97 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
98 #else
98 #else
99 if ((waveform_picker_regs->status & 0x04) == 0x04){ // check the f2 full bit
99 if ((waveform_picker_regs->status & 0x04) == 0x04){ // check the f2 full bit
100 // (1) change the receiving buffer for the waveform picker
100 // (1) change the receiving buffer for the waveform picker
101 if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) {
101 if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) {
102 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_bis);
102 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_bis);
103 }
103 }
104 else {
104 else {
105 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2);
105 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2);
106 }
106 }
107 // (2) send an event for the waveforms transmission
107 // (2) send an event for the waveforms transmission
108 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) {
108 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) {
109 PRINTF("in waveforms_isr *** Error sending event to WFRM\n")
109 PRINTF("in waveforms_isr *** Error sending event to WFRM\n")
110 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
110 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
111 }
111 }
112 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1011]
112 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1011]
113 }
113 }
114 if ( ( (waveform_picker_regs->status & 0x03) == 0x03 ) ) { // [0011] f3 f2 f1 f0, check the f2 and f0 full bit
114 if ( ( (waveform_picker_regs->status & 0x03) == 0x03 ) ) { // [0011] f3 f2 f1 f0, check the f2 and f0 full bit
115 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
115 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
116 PRINTF("in waveforms_isr *** Error sending event to WFRM\n")
116 PRINTF("in waveforms_isr *** Error sending event to WFRM\n")
117 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
117 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
118 }
118 }
119 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x03; // [0011] // enable f2 and f0
119 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x03; // [0011] // enable f2 and f0
120 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffccc; // set to 0 the bits related to f1 and f0
120 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffccc; // set to 0 the bits related to f1 and f0
121 }
121 }
122 #endif
122 #endif
123 break;
123 break;
124
124
125 //********
125 //********
126 // DEFAULT
126 // DEFAULT
127 default:
127 default:
128 break;
128 break;
129 }
129 }
130 }
130 }
131
131
132 rtems_isr waveforms_simulator_isr( rtems_vector_number vector )
132 rtems_isr waveforms_simulator_isr( rtems_vector_number vector )
133 {
133 {
134 unsigned char lfrMode;
134 unsigned char lfrMode;
135 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
135 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
136
136
137 switch(lfrMode)
137 switch(lfrMode)
138 {
138 {
139 //********
139 //********
140 // STANDBY
140 // STANDBY
141 case(LFR_MODE_STANDBY):
141 case(LFR_MODE_STANDBY):
142 break;
142 break;
143
143
144 //******
144 //******
145 // NORMAL
145 // NORMAL
146 case(LFR_MODE_NORMAL):
146 case(LFR_MODE_NORMAL):
147 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
147 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
148 PRINTF("ERR *** in waveforms_isr *** error sending event to WFRM\n");
148 PRINTF("ERR *** in waveforms_isr *** error sending event to WFRM\n")
149 }
149 }
150 break;
150 break;
151
151
152 //******
152 //******
153 // BURST
153 // BURST
154 case(LFR_MODE_BURST):
154 case(LFR_MODE_BURST):
155 break;
155 break;
156
156
157 //*****
157 //*****
158 // SBM1
158 // SBM1
159 case(LFR_MODE_SBM1):
159 case(LFR_MODE_SBM1):
160 break;
160 break;
161
161
162 //*****
162 //*****
163 // SBM2
163 // SBM2
164 case(LFR_MODE_SBM2):
164 case(LFR_MODE_SBM2):
165 break;
165 break;
166
166
167 //********
167 //********
168 // DEFAULT
168 // DEFAULT
169 default:
169 default:
170 break;
170 break;
171 }
171 }
172 }
172 }
173
173
174 rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
174 rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
175 {
175 {
176 unsigned int i;
176 unsigned int i;
177 unsigned int intEventOut;
177 unsigned int intEventOut;
178 spw_ioctl_pkt_send spw_ioctl_send_SWF;
178 spw_ioctl_pkt_send spw_ioctl_send_SWF;
179 spw_ioctl_pkt_send spw_ioctl_send_CWF;
179 spw_ioctl_pkt_send spw_ioctl_send_CWF;
180 rtems_event_set event_out;
180 rtems_event_set event_out;
181 Header_TM_LFR_SCIENCE_SWF_t headerSWF;
181 Header_TM_LFR_SCIENCE_SWF_t headerSWF;
182 Header_TM_LFR_SCIENCE_CWF_t headerCWF;
182 Header_TM_LFR_SCIENCE_CWF_t headerCWF;
183
183
184 init_header_snapshot_wf( &headerSWF );
184 init_header_snapshot_wf( &headerSWF );
185 init_header_continuous_wf( &headerCWF );
185 init_header_continuous_wf( &headerCWF );
186
186
187 // BUILD THE PACKET HEADERS
187 // BUILD THE PACKET HEADERS
188 spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header
188 spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header
189 spw_ioctl_send_SWF.hdr = (char*) &headerSWF;
189 spw_ioctl_send_SWF.hdr = (char*) &headerSWF;
190 spw_ioctl_send_SWF.options = 0;
190 spw_ioctl_send_SWF.options = 0;
191
191
192 spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
192 spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
193 spw_ioctl_send_CWF.hdr = (char*) &headerCWF;
193 spw_ioctl_send_CWF.hdr = (char*) &headerCWF;
194 spw_ioctl_send_CWF.options = 0;
194 spw_ioctl_send_CWF.options = 0;
195
195
196 init_waveforms();
196 init_waveforms();
197
197
198 PRINTF("in WFRM ***\n")
198 PRINTF("in WFRM ***\n")
199
199
200 while(1){
200 while(1){
201 // wait for an RTEMS_EVENT
201 // wait for an RTEMS_EVENT
202 rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3 | RTEMS_EVENT_4,
202 rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3 | RTEMS_EVENT_4,
203 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
203 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
204 intEventOut = (unsigned int) event_out;
204 intEventOut = (unsigned int) event_out;
205 for (i = 0; i< 5; i++) {
205 for (i = 0; i< 5; i++) {
206 if ( ( (intEventOut >> i) & 0x0001) != 0 ) {
206 if ( ( (intEventOut >> i) & 0x0001) != 0 ) {
207 switch(i) {
207 switch(i) {
208 case(LFR_MODE_NORMAL):
208 case(LFR_MODE_NORMAL):
209 send_waveform_norm( &headerSWF, &spw_ioctl_send_SWF);
209 send_waveform_norm( &headerSWF, &spw_ioctl_send_SWF);
210 break;
210 break;
211 case(LFR_MODE_BURST):
211 case(LFR_MODE_BURST):
212 send_waveform_burst( &headerCWF, &spw_ioctl_send_CWF);
212 send_waveform_burst( &headerCWF, &spw_ioctl_send_CWF);
213 break;
213 break;
214 case(LFR_MODE_SBM1):
214 case(LFR_MODE_SBM1):
215 send_waveform_sbm1( &headerCWF, &spw_ioctl_send_CWF);
215 send_waveform_sbm1( &headerCWF, &spw_ioctl_send_CWF);
216 param_local.local_sbm1_nb_cwf_sent ++;
216 param_local.local_sbm1_nb_cwf_sent ++;
217 if ( param_local.local_sbm1_nb_cwf_sent == (param_local.local_sbm1_nb_cwf_max-1) ) {
217 if ( param_local.local_sbm1_nb_cwf_sent == (param_local.local_sbm1_nb_cwf_max-1) ) {
218 // send the f1 buffer as a NORM snapshot
218 // send the f1 buffer as a NORM snapshot
219 if (waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1) {
219 if (waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1) {
220 send_waveform_SWF( &headerSWF, wf_snap_f1_bis, SID_NORM_SWF_F1, &spw_ioctl_send_SWF );
220 send_waveform_SWF( &headerSWF, wf_snap_f1_bis, SID_NORM_SWF_F1, &spw_ioctl_send_SWF );
221 }
221 }
222 else {
222 else {
223 send_waveform_SWF( &headerSWF, wf_snap_f1, SID_NORM_SWF_F1, &spw_ioctl_send_SWF );
223 send_waveform_SWF( &headerSWF, wf_snap_f1, SID_NORM_SWF_F1, &spw_ioctl_send_SWF );
224 }
224 }
225 }
225 }
226 break;
226 break;
227 case(LFR_MODE_SBM2):
227 case(LFR_MODE_SBM2):
228 send_waveform_sbm2( &headerCWF, &spw_ioctl_send_CWF);
228 send_waveform_sbm2( &headerCWF, &spw_ioctl_send_CWF);
229 param_local.local_sbm2_nb_cwf_sent ++;
229 param_local.local_sbm2_nb_cwf_sent ++;
230 if ( param_local.local_sbm2_nb_cwf_sent == (param_local.local_sbm2_nb_cwf_max-1) ) {
230 if ( param_local.local_sbm2_nb_cwf_sent == (param_local.local_sbm2_nb_cwf_max-1) ) {
231 // send the f2 buffer as a NORM snapshot
231 // send the f2 buffer as a NORM snapshot
232 if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) {
232 if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) {
233 send_waveform_SWF( &headerSWF, wf_snap_f2_bis, SID_NORM_SWF_F2, &spw_ioctl_send_SWF );
233 send_waveform_SWF( &headerSWF, wf_snap_f2_bis, SID_NORM_SWF_F2, &spw_ioctl_send_SWF );
234 }
234 }
235 else {
235 else {
236 send_waveform_SWF( &headerSWF, wf_snap_f2, SID_NORM_SWF_F2, &spw_ioctl_send_SWF );
236 send_waveform_SWF( &headerSWF, wf_snap_f2, SID_NORM_SWF_F2, &spw_ioctl_send_SWF );
237 }
237 }
238 }
238 }
239 break;
239 break;
240 default:
240 default:
241 break;
241 break;
242 }
242 }
243 }
243 }
244 }
244 }
245 }
245 }
246 }
246 }
247
247
248 //******************
248 //******************
249 // general functions
249 // general functions
250 void init_waveforms( void )
250 void init_waveforms( void )
251 {
251 {
252 int i = 0;
252 int i = 0;
253
253
254 for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
254 for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
255 {
255 {
256 //***
256 //***
257 // F0
257 // F0
258 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x88887777; //
258 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x88887777; //
259 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; //
259 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; //
260 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x44443333; //
260 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x44443333; //
261
261
262 //***
262 //***
263 // F1
263 // F1
264 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x22221111;
264 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x22221111;
265 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x44443333;
265 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x44443333;
266 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
266 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
267
267
268 //***
268 //***
269 // F2
269 // F2
270 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x44443333;
270 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x44443333;
271 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111;
271 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111;
272 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
272 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
273
273
274 //***
274 //***
275 // F3
275 // F3
276 //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 0 ] = val1;
276 //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 0 ] = val1;
277 //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 1 ] = val2;
277 //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 1 ] = val2;
278 //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 2 ] = 0xaaaa0000;
278 //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 2 ] = 0xaaaa0000;
279 }
279 }
280 }
280 }
281
281
282 void init_header_snapshot_wf( Header_TM_LFR_SCIENCE_SWF_t *header)
282 void init_header_snapshot_wf( Header_TM_LFR_SCIENCE_SWF_t *header)
283 {
283 {
284 header->targetLogicalAddress = CCSDS_DESTINATION_ID;
284 header->targetLogicalAddress = CCSDS_DESTINATION_ID;
285 header->protocolIdentifier = CCSDS_PROTOCOLE_ID;
285 header->protocolIdentifier = CCSDS_PROTOCOLE_ID;
286 header->reserved = 0x00;
286 header->reserved = 0x00;
287 header->userApplication = CCSDS_USER_APP;
287 header->userApplication = CCSDS_USER_APP;
288 header->packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL >> 8);
288 header->packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL >> 8);
289 header->packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL);
289 header->packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL);
290 header->packetSequenceControl[0] = 0xc0;
290 header->packetSequenceControl[0] = 0xc0;
291 header->packetSequenceControl[1] = 0x00;
291 header->packetSequenceControl[1] = 0x00;
292 header->packetLength[0] = 0x00;
292 header->packetLength[0] = 0x00;
293 header->packetLength[1] = 0x00;
293 header->packetLength[1] = 0x00;
294 // DATA FIELD HEADER
294 // DATA FIELD HEADER
295 header->spare1_pusVersion_spare2 = 0x10;
295 header->spare1_pusVersion_spare2 = 0x10;
296 header->serviceType = TM_TYPE_LFR_SCIENCE; // service type
296 header->serviceType = TM_TYPE_LFR_SCIENCE; // service type
297 header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
297 header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
298 header->destinationID = TM_DESTINATION_ID_GROUND;
298 header->destinationID = TM_DESTINATION_ID_GROUND;
299 // AUXILIARY DATA HEADER
299 // AUXILIARY DATA HEADER
300 header->sid = 0x00;
300 header->sid = 0x00;
301 header->hkBIA = 0x1f;
301 header->hkBIA = 0x1f;
302 header->pktCnt = 0x07; // PKT_CNT
302 header->pktCnt = 0x07; // PKT_CNT
303 header->pktNr = 0x00; // PKT_NR
303 header->pktNr = 0x00; // PKT_NR
304 header->time[0] = 0x00;
304 header->time[0] = 0x00;
305 header->time[0] = 0x00;
305 header->time[0] = 0x00;
306 header->time[0] = 0x00;
306 header->time[0] = 0x00;
307 header->time[0] = 0x00;
307 header->time[0] = 0x00;
308 header->time[0] = 0x00;
308 header->time[0] = 0x00;
309 header->time[0] = 0x00;
309 header->time[0] = 0x00;
310 header->blkNr[0] = 0x00; // BLK_NR MSB
310 header->blkNr[0] = 0x00; // BLK_NR MSB
311 header->blkNr[1] = 0x00; // BLK_NR LSB
311 header->blkNr[1] = 0x00; // BLK_NR LSB
312 }
312 }
313
313
314 void init_header_continuous_wf( Header_TM_LFR_SCIENCE_CWF_t *header)
314 void init_header_continuous_wf( Header_TM_LFR_SCIENCE_CWF_t *header)
315 {
315 {
316 header->targetLogicalAddress = CCSDS_DESTINATION_ID;
316 header->targetLogicalAddress = CCSDS_DESTINATION_ID;
317 header->protocolIdentifier = CCSDS_PROTOCOLE_ID;
317 header->protocolIdentifier = CCSDS_PROTOCOLE_ID;
318 header->reserved = 0x00;
318 header->reserved = 0x00;
319 header->userApplication = CCSDS_USER_APP;
319 header->userApplication = CCSDS_USER_APP;
320 header->packetID[0] = 0x00;
320 header->packetID[0] = 0x00;
321 header->packetID[1] = 0x00;
321 header->packetID[1] = 0x00;
322 header->packetSequenceControl[0] = 0xc0;
322 header->packetSequenceControl[0] = 0xc0;
323 header->packetSequenceControl[1] = 0x00;
323 header->packetSequenceControl[1] = 0x00;
324 header->packetLength[0] = 0x00;
324 header->packetLength[0] = 0x00;
325 header->packetLength[1] = 0x00;
325 header->packetLength[1] = 0x00;
326 // DATA FIELD HEADER
326 // DATA FIELD HEADER
327 header->spare1_pusVersion_spare2 = 0x10;
327 header->spare1_pusVersion_spare2 = 0x10;
328 header->serviceType = TM_TYPE_LFR_SCIENCE; // service type
328 header->serviceType = TM_TYPE_LFR_SCIENCE; // service type
329 header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
329 header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
330 header->destinationID = TM_DESTINATION_ID_GROUND;
330 header->destinationID = TM_DESTINATION_ID_GROUND;
331 // AUXILIARY DATA HEADER
331 // AUXILIARY DATA HEADER
332 header->sid = 0x00;
332 header->sid = 0x00;
333 header->hkBIA = 0x1f;
333 header->hkBIA = 0x1f;
334 header->time[0] = 0x00;
334 header->time[0] = 0x00;
335 header->time[0] = 0x00;
335 header->time[0] = 0x00;
336 header->time[0] = 0x00;
336 header->time[0] = 0x00;
337 header->time[0] = 0x00;
337 header->time[0] = 0x00;
338 header->time[0] = 0x00;
338 header->time[0] = 0x00;
339 header->time[0] = 0x00;
339 header->time[0] = 0x00;
340 header->blkNr[0] = 0x00; // BLK_NR MSB
340 header->blkNr[0] = 0x00; // BLK_NR MSB
341 header->blkNr[1] = 0x00; // BLK_NR LSB
341 header->blkNr[1] = 0x00; // BLK_NR LSB
342 }
342 }
343
343
344 void reset_waveforms( void )
344 void reset_waveforms( void )
345 {
345 {
346 int i = 0;
346 int i = 0;
347
347
348 for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
348 for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
349 {
349 {
350 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x10002000;
350 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x10002000;
351 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0x20001000;
351 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0x20001000;
352 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x40008000;
352 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x40008000;
353
353
354 //***
354 //***
355 // F1
355 // F1
356 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x1000f000;
356 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x1000f000;
357 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0xf0001000;
357 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0xf0001000;
358 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x40008000;
358 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x40008000;
359
359
360 //***
360 //***
361 // F2
361 // F2
362 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x40008000;
362 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x40008000;
363 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0x20001000;
363 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0x20001000;
364 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x10002000;
364 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x10002000;
365
365
366 //***
366 //***
367 // F3
367 // F3
368 /*wf_cont_f3[ i* NB_WORDS_SWF_BLK + 0 ] = build_value( i, i ); // v and 1
368 /*wf_cont_f3[ i* NB_WORDS_SWF_BLK + 0 ] = build_value( i, i ); // v and 1
369 wf_cont_f3[ i* NB_WORDS_SWF_BLK + 1 ] = build_value( i, i ); // e2 and b1
369 wf_cont_f3[ i* NB_WORDS_SWF_BLK + 1 ] = build_value( i, i ); // e2 and b1
370 wf_cont_f3[ i* NB_WORDS_SWF_BLK + 2 ] = build_value( i, i ); // b2 and b3*/
370 wf_cont_f3[ i* NB_WORDS_SWF_BLK + 2 ] = build_value( i, i ); // b2 and b3*/
371 }
371 }
372 }
372 }
373
373
374 void send_waveform_SWF( Header_TM_LFR_SCIENCE_SWF_t *header, volatile int *waveform,
374 void send_waveform_SWF( Header_TM_LFR_SCIENCE_SWF_t *header, volatile int *waveform,
375 unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send)
375 unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send)
376 {
376 {
377 unsigned int i = 0;
377 unsigned int i = 0;
378 unsigned int length = 0;
378 unsigned int length = 0;
379 rtems_status_code status;
379 rtems_status_code status;
380
380
381 header->sid = (unsigned char) sid;
381 header->sid = (unsigned char) sid;
382
382
383 for (i=0; i<7; i++) // send waveform
383 for (i=0; i<7; i++) // send waveform
384 {
384 {
385 header->pktNr = (unsigned char) i+1; // PKT_NR
385 header->pktNr = (unsigned char) i+1; // PKT_NR
386 // BUILD THE DATA
386 // BUILD THE DATA
387 if (i==6) {
387 if (i==6) {
388 spw_ioctl_send->dlen = 8 * NB_BYTES_SWF_BLK;
388 spw_ioctl_send->dlen = 8 * NB_BYTES_SWF_BLK;
389 length = TM_LEN_SCI_SWF_8;
389 length = TM_LEN_SCI_SWF_8;
390 header->blkNr[0] = 0x00; // BLK_NR MSB
390 header->blkNr[0] = 0x00; // BLK_NR MSB
391 header->blkNr[1] = 0x08; // BLK_NR LSB
391 header->blkNr[1] = 0x08; // BLK_NR LSB
392 }
392 }
393 else {
393 else {
394 spw_ioctl_send->dlen = 340 * NB_BYTES_SWF_BLK;
394 spw_ioctl_send->dlen = 340 * NB_BYTES_SWF_BLK;
395 length = TM_LEN_SCI_SWF_340;
395 length = TM_LEN_SCI_SWF_340;
396 header->blkNr[0] = 0x01; // BLK_NR MSB
396 header->blkNr[0] = 0x01; // BLK_NR MSB
397 header->blkNr[1] = 0x54; // BLK_NR LSB
397 header->blkNr[1] = 0x54; // BLK_NR LSB
398 }
398 }
399 spw_ioctl_send->data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ];
399 spw_ioctl_send->data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ];
400 // BUILD THE HEADER
400 // BUILD THE HEADER
401 header->packetLength[0] = (unsigned char) (length>>8);
401 header->packetLength[0] = (unsigned char) (length>>8);
402 header->packetLength[1] = (unsigned char) (length);
402 header->packetLength[1] = (unsigned char) (length);
403 header->sid = (unsigned char) sid; // SID
403 header->sid = (unsigned char) sid; // SID
404 // SET PACKET TIME
404 // SET PACKET TIME
405 header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
405 header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
406 header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
406 header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
407 header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
407 header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
408 header->time[3] = (unsigned char) (time_management_regs->coarse_time);
408 header->time[3] = (unsigned char) (time_management_regs->coarse_time);
409 header->time[4] = (unsigned char) (time_management_regs->fine_time>>8);
409 header->time[4] = (unsigned char) (time_management_regs->fine_time>>8);
410 header->time[5] = (unsigned char) (time_management_regs->fine_time);
410 header->time[5] = (unsigned char) (time_management_regs->fine_time);
411 header->acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24);
411 header->acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24);
412 header->acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16);
412 header->acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16);
413 header->acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8);
413 header->acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8);
414 header->acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time);
414 header->acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time);
415 header->acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8);
415 header->acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8);
416 header->acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time);
416 header->acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time);
417 // SEND PACKET
417 // SEND PACKET
418 status = write_spw(spw_ioctl_send);
418 status = write_spw(spw_ioctl_send);
419 if (status != RTEMS_SUCCESSFUL) {
419 if (status != RTEMS_SUCCESSFUL) {
420 while (true) {
420 while (true) {
421 if (status != RTEMS_SUCCESSFUL) {
421 if (status != RTEMS_SUCCESSFUL) {
422 status = write_spw(spw_ioctl_send);
422 status = write_spw(spw_ioctl_send);
423 //PRINTF1("%d", i)
423 //PRINTF1("%d", i)
424 sched_yield();
424 sched_yield();
425 }
425 }
426 else {
426 else {
427 //PRINTF("\n")
427 //PRINTF("\n")
428 break;
428 break;
429 }
429 }
430 }
430 }
431 }
431 }
432 }
432 }
433 }
433 }
434
434
435 void send_waveform_CWF( Header_TM_LFR_SCIENCE_CWF_t *header, volatile int *waveform,
435 void send_waveform_CWF( Header_TM_LFR_SCIENCE_CWF_t *header, volatile int *waveform,
436 unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send)
436 unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send)
437 {
437 {
438 unsigned int i = 0;
438 unsigned int i = 0;
439 unsigned int length = 0;
439 unsigned int length = 0;
440 rtems_status_code status;
440 rtems_status_code status;
441
441
442 header->sid = (unsigned char) sid;
442 header->sid = (unsigned char) sid;
443
443
444 for (i=0; i<7; i++) // send waveform
444 for (i=0; i<7; i++) // send waveform
445 {
445 {
446 // BUILD THE DATA
446 // BUILD THE DATA
447 if (i==6) {
447 if (i==6) {
448 spw_ioctl_send->dlen = 8 * NB_BYTES_SWF_BLK;
448 spw_ioctl_send->dlen = 8 * NB_BYTES_SWF_BLK;
449 length = TM_LEN_SCI_CWF_8;
449 length = TM_LEN_SCI_CWF_8;
450 header->blkNr[0] = 0x00; // BLK_NR MSB
450 header->blkNr[0] = 0x00; // BLK_NR MSB
451 header->blkNr[1] = 0x08; // BLK_NR LSB
451 header->blkNr[1] = 0x08; // BLK_NR LSB
452 }
452 }
453 else {
453 else {
454 spw_ioctl_send->dlen = 340 * NB_BYTES_SWF_BLK;
454 spw_ioctl_send->dlen = 340 * NB_BYTES_SWF_BLK;
455 length = TM_LEN_SCI_CWF_340;
455 length = TM_LEN_SCI_CWF_340;
456 header->blkNr[0] = 0x01; // BLK_NR MSB
456 header->blkNr[0] = 0x01; // BLK_NR MSB
457 header->blkNr[1] = 0x54; // BLK_NR LSB
457 header->blkNr[1] = 0x54; // BLK_NR LSB
458 }
458 }
459 spw_ioctl_send->data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ];
459 spw_ioctl_send->data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ];
460 // BUILD THE HEADER
460 // BUILD THE HEADER
461 header->packetLength[0] = (unsigned char) (length>>8);
461 header->packetLength[0] = (unsigned char) (length>>8);
462 header->packetLength[1] = (unsigned char) (length);
462 header->packetLength[1] = (unsigned char) (length);
463 // SET PACKET TIME
463 // SET PACKET TIME
464 header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
464 header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
465 header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
465 header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
466 header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
466 header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
467 header->time[3] = (unsigned char) (time_management_regs->coarse_time);
467 header->time[3] = (unsigned char) (time_management_regs->coarse_time);
468 header->time[4] = (unsigned char) (time_management_regs->fine_time>>8);
468 header->time[4] = (unsigned char) (time_management_regs->fine_time>>8);
469 header->time[5] = (unsigned char) (time_management_regs->fine_time);
469 header->time[5] = (unsigned char) (time_management_regs->fine_time);
470 header->acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24);
470 header->acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24);
471 header->acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16);
471 header->acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16);
472 header->acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8);
472 header->acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8);
473 header->acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time);
473 header->acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time);
474 header->acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8);
474 header->acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8);
475 header->acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time);
475 header->acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time);
476 // SEND PACKET
476 // SEND PACKET
477 status = write_spw(spw_ioctl_send);
477 status = write_spw(spw_ioctl_send);
478 if (status != RTEMS_SUCCESSFUL) {
478 if (status != RTEMS_SUCCESSFUL) {
479 while (true) {
479 while (true) {
480 if (status != RTEMS_SUCCESSFUL) {
480 if (status != RTEMS_SUCCESSFUL) {
481 status = write_spw(spw_ioctl_send);
481 status = write_spw(spw_ioctl_send);
482 //PRINTF1("%d", i)
482 //PRINTF1("%d", i)
483 sched_yield();
483 sched_yield();
484 }
484 }
485 else {
485 else {
486 //PRINTF("\n")
486 //PRINTF("\n")
487 break;
487 break;
488 }
488 }
489 }
489 }
490 }
490 }
491 }
491 }
492 }
492 }
493
493
494 int build_value(int value1, int value0)
494 int build_value(int value1, int value0)
495 {
495 {
496 int aux = 0;
496 int aux = 0;
497 int aux1 = 0;
497 int aux1 = 0;
498 int aux0 = 0;
498 int aux0 = 0;
499 int value1_aux = 0;
499 int value1_aux = 0;
500 int value0_aux = 0;
500 int value0_aux = 0;
501
501
502 value1_aux = value1;
502 value1_aux = value1;
503 value0_aux = value0;
503 value0_aux = value0;
504
504
505 //******
505 //******
506 // B3 B2
506 // B3 B2
507 if (value1_aux > 8191) value1_aux = 8191;
507 if (value1_aux > 8191) value1_aux = 8191;
508 if (value1_aux < -8192) value1_aux = -8192;
508 if (value1_aux < -8192) value1_aux = -8192;
509 aux1 = ( (int) ( ( (unsigned char) (value1_aux / 256 ) ) << 8 ) )
509 aux1 = ( (int) ( ( (unsigned char) (value1_aux / 256 ) ) << 8 ) )
510 + ( (int) ( (unsigned char) (value1_aux ) ) );
510 + ( (int) ( (unsigned char) (value1_aux ) ) );
511
511
512 //******
512 //******
513 // B1 B0
513 // B1 B0
514 if (value0_aux > 8191) value0_aux = 8191;
514 if (value0_aux > 8191) value0_aux = 8191;
515 if (value0_aux < -8192) value0_aux = -8192;
515 if (value0_aux < -8192) value0_aux = -8192;
516 aux0 = ( (int) ( ( (unsigned char) (value0_aux / 256) ) << 8 ) )
516 aux0 = ( (int) ( ( (unsigned char) (value0_aux / 256) ) << 8 ) )
517 + ( (int) ( (unsigned char) (value0_aux ) ) );
517 + ( (int) ( (unsigned char) (value0_aux ) ) );
518
518
519 aux = (aux1 << 16) + aux0;
519 aux = (aux1 << 16) + aux0;
520
520
521 return aux;
521 return aux;
522 }
522 }
523
523
524 void send_waveform_norm(Header_TM_LFR_SCIENCE_SWF_t *header, spw_ioctl_pkt_send *spw_ioctl_send)
524 void send_waveform_norm(Header_TM_LFR_SCIENCE_SWF_t *header, spw_ioctl_pkt_send *spw_ioctl_send)
525 {
525 {
526 unsigned char lfrMode;
526 unsigned char lfrMode;
527 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
527 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
528
528
529 header->packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL >> 8);
529 header->packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL >> 8);
530 header->packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL);
530 header->packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL);
531 // TIME
531 // TIME
532 header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
532 header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
533 header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
533 header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
534 header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
534 header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
535 header->time[3] = (unsigned char) (time_management_regs->coarse_time);
535 header->time[3] = (unsigned char) (time_management_regs->coarse_time);
536 header->time[4] = (unsigned char) (time_management_regs->fine_time>>8);
536 header->time[4] = (unsigned char) (time_management_regs->fine_time>>8);
537 header->time[5] = (unsigned char) (time_management_regs->fine_time);
537 header->time[5] = (unsigned char) (time_management_regs->fine_time);
538
538
539 //***************
539 //***************
540 // send snapshots
540 // send snapshots
541 // F0
541 // F0
542 send_waveform_SWF( header, wf_snap_f0, SID_NORM_SWF_F0, spw_ioctl_send);
542 send_waveform_SWF( header, wf_snap_f0, SID_NORM_SWF_F0, spw_ioctl_send);
543 // F1
543 // F1
544 if (lfrMode == LFR_MODE_NORMAL) // in SBM1 mode, the snapshot is sent by the send_waveform_sbm1 function
544 if (lfrMode == LFR_MODE_NORMAL) // in SBM1 mode, the snapshot is sent by the send_waveform_sbm1 function
545 {
545 {
546 send_waveform_SWF( header, wf_snap_f1, SID_NORM_SWF_F1, spw_ioctl_send);
546 send_waveform_SWF( header, wf_snap_f1, SID_NORM_SWF_F1, spw_ioctl_send);
547 }
547 }
548 // F2
548 // F2
549 send_waveform_SWF( header, wf_snap_f2, SID_NORM_SWF_F2, spw_ioctl_send);
549 send_waveform_SWF( header, wf_snap_f2, SID_NORM_SWF_F2, spw_ioctl_send);
550 #ifdef GSA
550 #ifdef GSA
551 // irq processed, reset the related register of the timer unit
551 // irq processed, reset the related register of the timer unit
552 gptimer_regs->timer[2].ctrl = gptimer_regs->timer[2].ctrl | 0x00000010;
552 gptimer_regs->timer[2].ctrl = gptimer_regs->timer[2].ctrl | 0x00000010;
553 #else
553 #else
554 // irq processed, reset the related register of the waveform picker
554 // irq processed, reset the related register of the waveform picker
555 if (lfrMode == LFR_MODE_SBM1) {
555 if (lfrMode == LFR_MODE_SBM1) {
556 param_local.local_sbm1_nb_cwf_sent = 0;
556 param_local.local_sbm1_nb_cwf_sent = 0;
557 // after the first transmission of the swf at F1, the period is set to local_sbm1_nb_cwf_max
557 // after the first transmission of the swf at F1, the period is set to local_sbm1_nb_cwf_max
558 param_local.local_sbm1_nb_cwf_max = 2 * param_norm.sy_lfr_n_swf_p;
558 param_local.local_sbm1_nb_cwf_max = 2 * param_norm.sy_lfr_n_swf_p;
559 }
559 }
560 else if (lfrMode == LFR_MODE_SBM2) {
560 else if (lfrMode == LFR_MODE_SBM2) {
561 param_local.local_sbm2_nb_cwf_sent = 0;
561 param_local.local_sbm2_nb_cwf_sent = 0;
562 // after the first transmission of the swf at F2, the period is set to local_sbm2_nb_cwf_max
562 // after the first transmission of the swf at F2, the period is set to local_sbm2_nb_cwf_max
563 param_local.local_sbm2_nb_cwf_max = param_norm.sy_lfr_n_swf_p / 8;
563 param_local.local_sbm2_nb_cwf_max = param_norm.sy_lfr_n_swf_p / 8;
564 }
564 }
565 else {
565 else {
566 waveform_picker_regs->status = waveform_picker_regs->status & 0x00;
566 waveform_picker_regs->status = waveform_picker_regs->status & 0x00;
567 waveform_picker_regs->burst_enable = 0x07; // [0111] enable f2 f1 f0
567 waveform_picker_regs->burst_enable = 0x07; // [0111] enable f2 f1 f0
568 }
568 }
569
569
570 #endif
570 #endif
571 }
571 }
572
572
573 void send_waveform_burst(Header_TM_LFR_SCIENCE_CWF_t *header, spw_ioctl_pkt_send *spw_ioctl_send)
573 void send_waveform_burst(Header_TM_LFR_SCIENCE_CWF_t *header, spw_ioctl_pkt_send *spw_ioctl_send)
574 {
574 {
575 header->packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_BURST_SBM1_SBM2 >> 8);
575 header->packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_BURST_SBM1_SBM2 >> 8);
576 header->packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_BURST_SBM1_SBM2);
576 header->packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_BURST_SBM1_SBM2);
577 // TIME
577 // TIME
578 header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
578 header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
579 header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
579 header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
580 header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
580 header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
581 header->time[3] = (unsigned char) (time_management_regs->coarse_time);
581 header->time[3] = (unsigned char) (time_management_regs->coarse_time);
582 header->time[4] = (unsigned char) (time_management_regs->fine_time>>8);
582 header->time[4] = (unsigned char) (time_management_regs->fine_time>>8);
583 header->time[5] = (unsigned char) (time_management_regs->fine_time);
583 header->time[5] = (unsigned char) (time_management_regs->fine_time);
584 // ACQUISITION TIME
584 // ACQUISITION TIME
585
585
586 // F2
586 // F2
587 if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) {
587 if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) {
588 send_waveform_CWF( header, wf_snap_f2_bis, SID_BURST_CWF_F2, spw_ioctl_send);
588 send_waveform_CWF( header, wf_snap_f2_bis, SID_BURST_CWF_F2, spw_ioctl_send);
589 }
589 }
590 else {
590 else {
591 send_waveform_CWF( header, wf_snap_f2, SID_BURST_CWF_F2, spw_ioctl_send);
591 send_waveform_CWF( header, wf_snap_f2, SID_BURST_CWF_F2, spw_ioctl_send);
592 }
592 }
593 }
593 }
594
594
595 void send_waveform_sbm1(Header_TM_LFR_SCIENCE_CWF_t *header, spw_ioctl_pkt_send *spw_ioctl_send)
595 void send_waveform_sbm1(Header_TM_LFR_SCIENCE_CWF_t *header, spw_ioctl_pkt_send *spw_ioctl_send)
596 {
596 {
597 header->packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_BURST_SBM1_SBM2 >> 8);
597 header->packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_BURST_SBM1_SBM2 >> 8);
598 header->packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_BURST_SBM1_SBM2);
598 header->packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_BURST_SBM1_SBM2);
599 // TIME
599 // TIME
600 header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
600 header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
601 header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
601 header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
602 header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
602 header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
603 header->time[3] = (unsigned char) (time_management_regs->coarse_time);
603 header->time[3] = (unsigned char) (time_management_regs->coarse_time);
604 header->time[4] = (unsigned char) (time_management_regs->fine_time>>8);
604 header->time[4] = (unsigned char) (time_management_regs->fine_time>>8);
605 header->time[5] = (unsigned char) (time_management_regs->fine_time);
605 header->time[5] = (unsigned char) (time_management_regs->fine_time);
606
606
607 // F1
607 // F1
608 if (waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1) {
608 if (waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1) {
609 send_waveform_CWF( header, wf_snap_f1_bis, SID_SBM1_CWF_F1, spw_ioctl_send );
609 send_waveform_CWF( header, wf_snap_f1_bis, SID_SBM1_CWF_F1, spw_ioctl_send );
610 }
610 }
611 else {
611 else {
612 send_waveform_CWF( header, wf_snap_f1, SID_SBM1_CWF_F1, spw_ioctl_send );
612 send_waveform_CWF( header, wf_snap_f1, SID_SBM1_CWF_F1, spw_ioctl_send );
613 }
613 }
614 }
614 }
615
615
616 void send_waveform_sbm2(Header_TM_LFR_SCIENCE_CWF_t *header, spw_ioctl_pkt_send *spw_ioctl_send)
616 void send_waveform_sbm2(Header_TM_LFR_SCIENCE_CWF_t *header, spw_ioctl_pkt_send *spw_ioctl_send)
617 {
617 {
618 header->packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_BURST_SBM1_SBM2 >> 8);
618 header->packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_BURST_SBM1_SBM2 >> 8);
619 header->packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_BURST_SBM1_SBM2);
619 header->packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_BURST_SBM1_SBM2);
620 // TIME
620 // TIME
621 header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
621 header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
622 header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
622 header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
623 header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
623 header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
624 header->time[3] = (unsigned char) (time_management_regs->coarse_time);
624 header->time[3] = (unsigned char) (time_management_regs->coarse_time);
625 header->time[4] = (unsigned char) (time_management_regs->fine_time>>8);
625 header->time[4] = (unsigned char) (time_management_regs->fine_time>>8);
626 header->time[5] = (unsigned char) (time_management_regs->fine_time);
626 header->time[5] = (unsigned char) (time_management_regs->fine_time);
627
627
628 // F2
628 // F2
629 if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) {
629 if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) {
630 send_waveform_CWF( header, wf_snap_f2_bis, SID_SBM2_CWF_F2, spw_ioctl_send);
630 send_waveform_CWF( header, wf_snap_f2_bis, SID_SBM2_CWF_F2, spw_ioctl_send);
631 }
631 }
632 else {
632 else {
633 send_waveform_CWF( header, wf_snap_f2, SID_SBM2_CWF_F2, spw_ioctl_send);
633 send_waveform_CWF( header, wf_snap_f2, SID_SBM2_CWF_F2, spw_ioctl_send);
634 }
634 }
635 }
635 }
636
636
637 //**************
637 //**************
638 // wfp registers
638 // wfp registers
639 void set_wfp_data_shaping(unsigned char data_shaping)
639 void set_wfp_data_shaping(unsigned char data_shaping)
640 {
640 {
641 // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register
641 // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register
642 // waveform picker : [R1 R0 SP1 SP0 BW]
642 // waveform picker : [R1 R0 SP1 SP0 BW]
643 waveform_picker_regs->data_shaping =
643 waveform_picker_regs->data_shaping =
644 ( (data_shaping & 0x10) >> 4 ) // BW
644 ( (data_shaping & 0x10) >> 4 ) // BW
645 + ( (data_shaping & 0x08) >> 2 ) // SP0
645 + ( (data_shaping & 0x08) >> 2 ) // SP0
646 + ( (data_shaping & 0x04) ) // SP1
646 + ( (data_shaping & 0x04) ) // SP1
647 + ( (data_shaping & 0x02) << 2 ) // R0
647 + ( (data_shaping & 0x02) << 2 ) // R0
648 + ( (data_shaping & 0x01) << 4 ); // R1
648 + ( (data_shaping & 0x01) << 4 ); // R1
649 }
649 }
650
650
651 void set_wfp_delta_snapshot(unsigned int delta_snapshot)
651 void set_wfp_delta_snapshot(unsigned int delta_snapshot)
652 {
652 {
653 unsigned char aux = 0;
653 unsigned char aux = 0;
654 aux = delta_snapshot / 2 ;
654 aux = delta_snapshot / 2 ;
655 waveform_picker_regs->delta_snapshot = aux; // max 2 bytes
655 waveform_picker_regs->delta_snapshot = aux; // max 2 bytes
656 //waveform_picker_regs->delta_snapshot = 0x5; // max 2 bytes
656 //waveform_picker_regs->delta_snapshot = 0x5; // max 2 bytes
657 }
657 }
658
658
659 void reset_wfp_burst_enable()
659 void reset_wfp_burst_enable()
660 {
660 {
661 waveform_picker_regs->burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
661 waveform_picker_regs->burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
662 }
662 }
663
663
664 void reset_wfp_regs()
664 void reset_wfp_regs()
665 {
665 {
666 set_wfp_data_shaping(param_common.sy_lfr_common1);
666 set_wfp_data_shaping(param_common.sy_lfr_common1);
667 reset_wfp_burst_enable();
667 reset_wfp_burst_enable();
668 waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0); //
668 waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0); //
669 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1); //
669 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1); //
670 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); //
670 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); //
671 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3); //
671 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3); //
672 waveform_picker_regs->status = 0x00; //
672 waveform_picker_regs->status = 0x00; //
673 set_wfp_delta_snapshot( param_norm.sy_lfr_n_swf_p ); // time in seconds between two snapshots
673 set_wfp_delta_snapshot( param_norm.sy_lfr_n_swf_p ); // time in seconds between two snapshots
674 waveform_picker_regs->delta_f2_f1 = 0xffff; // max 4 bytes
674 waveform_picker_regs->delta_f2_f1 = 0xffff; // max 4 bytes
675 waveform_picker_regs->delta_f2_f0 = 0x17c00; // max 5 bytes
675 waveform_picker_regs->delta_f2_f0 = 0x17c00; // max 5 bytes
676 waveform_picker_regs->nb_burst_available = 0x180; // max 3 bytes, size of the buffer in burst (1 burst = 16 x 4 octets)
676 waveform_picker_regs->nb_burst_available = 0x180; // max 3 bytes, size of the buffer in burst (1 burst = 16 x 4 octets)
677 waveform_picker_regs->nb_snapshot_param = 0x7ff; // max 3 octets, 2048 - 1
677 waveform_picker_regs->nb_snapshot_param = 0x7ff; // max 3 octets, 2048 - 1
678 //waveform_picker_regs->delta_snapshot = 0x2; // max 2 bytes, = period / 2
678 //waveform_picker_regs->delta_snapshot = 0x2; // max 2 bytes, = period / 2
679 //waveform_picker_regs->delta_f2_f1 = 0x2d00; // max 4 bytes
679 //waveform_picker_regs->delta_f2_f1 = 0x2d00; // max 4 bytes
680 //waveform_picker_regs->delta_f2_f0 = 0x2f80; // max 5 bytes
680 //waveform_picker_regs->delta_f2_f0 = 0x2f80; // max 5 bytes
681 //waveform_picker_regs->nb_burst_available = 0x30; // max 3 bytes, size of the buffer in burst (1 burst = 16 x 4 octets)
681 //waveform_picker_regs->nb_burst_available = 0x30; // max 3 bytes, size of the buffer in burst (1 burst = 16 x 4 octets)
682 //waveform_picker_regs->nb_snapshot_param = 0xff; // max 3 octets, 256 - 1
682 //waveform_picker_regs->nb_snapshot_param = 0xff; // max 3 octets, 256 - 1
683 }
683 }
General Comments 0
You need to be logged in to leave comments. Login now