##// END OF EJS Templates
Creation of a spool task (SPOO) to handle
paul -
r165:c9daaae78ba2 spool
parent child
Show More
@@ -0,0 +1,64
1 #ifndef FSW_SPOOL_H_INCLUDED
2 #define FSW_SPOOL_H_INCLUDED
3
4 #include <rtems.h>
5 #include <stdio.h>
6
7 #include "fsw_params.h"
8 #include "fsw_processing.h"
9
10 rtems_name name_spool_rate_monotonic; // name of the SPOOL rate monotonic
11 rtems_id spool_period_id; // id of the SPOOL rate monotonic period
12
13 extern unsigned char lfrCurrentMode;
14
15 extern waveform_picker_regs_new_t *waveform_picker_regs;
16 extern spectral_matrix_regs_t *spectral_matrix_regs;
17
18 // WAVEFORMS
19 extern ring_node *current_ring_node_f0;
20 extern ring_node *ring_node_to_send_swf_f0;
21 extern ring_node *current_ring_node_f1;
22 extern ring_node *ring_node_to_send_swf_f1;
23 extern ring_node *ring_node_to_send_cwf_f1;
24 extern ring_node *current_ring_node_f2;
25 extern ring_node *ring_node_to_send_swf_f2;
26 extern ring_node *ring_node_to_send_cwf_f2;
27 extern ring_node *current_ring_node_f3;
28 extern ring_node *ring_node_to_send_cwf_f3;
29
30 // SPECTRAL MATRICES
31 unsigned int spool_nb_sm_f0;
32 unsigned int spool_nb_sm_f1;
33 extern ring_node_sm *current_ring_node_sm_f0;
34 extern ring_node_sm *current_ring_node_sm_f1;
35 extern ring_node_sm *current_ring_node_sm_f2;
36 extern ring_node_sm *ring_node_for_averaging_sm_f0;
37 extern ring_node_sm *ring_node_for_averaging_sm_f1;
38 extern ring_node_sm *ring_node_for_averaging_sm_f2;
39
40 extern rtems_id Task_id[]; /* array of task ids */
41
42 extern bool swf_f0_ready;
43 extern bool swf_f1_ready;
44 extern bool swf_f2_ready;
45
46 extern bool wake_up_task_wfrm;
47 extern bool wake_up_task_cwf_f1;
48 extern bool wake_up_task_cwf_f2_burst;
49 extern bool wake_up_task_cwf_f2_sbm2;
50 extern bool wake_up_task_cwf_f3;
51
52 //***********
53 // RTEMS_TASK
54 rtems_task spoo_task( rtems_task_argument argument );
55
56 // OTHER FUNCTIONS
57 void spool_waveforms( void );
58 void spool_spectral_matrices_f0( void );
59 void spool_spectral_matrices_f1( void );
60 void spool_spectral_matrices_f2( void );
61 void spool_spectral_matrices( void );
62 void spool_reset_nb_sm( void );
63
64 #endif // FSW_SPOOL_H_INCLUDED
@@ -0,0 +1,276
1 /** Functions and tasks related to waveform packet generation.
2 *
3 * @file
4 * @author P. LEROY
5 *
6 * A group of functions to handle waveforms, in snapshot or continuous format.\n
7 *
8 */
9
10 #include "fsw_spool.h"
11
12 //*********************
13 // Interrupt SubRoutine
14
15 void spool_waveforms( void )
16 {
17 /** This is the interrupt sub routine called by the waveform picker core.
18 *
19 * This ISR launch different actions depending mainly on two pieces of information:
20 * 1. the values read in the registers of the waveform picker.
21 * 2. the current LFR mode.
22 *
23 */
24
25 rtems_status_code status;
26
27 if ( (lfrCurrentMode == LFR_MODE_NORMAL) || (lfrCurrentMode == LFR_MODE_BURST) // in BURST the data are used to place v, e1 and e2 in the HK packet
28 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
29 { // in modes other than STANDBY and BURST, send the CWF_F3 data
30 if ((waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full
31 // (1) change the receiving buffer for the waveform picker
32 ring_node_to_send_cwf_f3 = current_ring_node_f3;
33 current_ring_node_f3 = current_ring_node_f3->next;
34 waveform_picker_regs->addr_data_f3 = current_ring_node_f3->buffer_address;
35 // (2) send an event for the waveforms transmission
36 if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
37 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
38 }
39 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2);
40 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff777; // reset f3 bits to 0, [1111 0111 0111 0111]
41 }
42 }
43
44 switch(lfrCurrentMode)
45 {
46 //********
47 // STANDBY
48 case(LFR_MODE_STANDBY):
49 break;
50
51 //******
52 // NORMAL
53 case(LFR_MODE_NORMAL):
54 if ( (waveform_picker_regs->status & 0xff8) != 0x00) // [1000] check the error bits
55 {
56 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
57 }
58 if ( (waveform_picker_regs->status & 0x07) == 0x07) // [0111] check the f2, f1, f0 full bits
59 {
60 // change F0 ring node
61 ring_node_to_send_swf_f0 = current_ring_node_f0;
62 current_ring_node_f0 = current_ring_node_f0->next;
63 waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address;
64 // change F1 ring node
65 ring_node_to_send_swf_f1 = current_ring_node_f1;
66 current_ring_node_f1 = current_ring_node_f1->next;
67 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address;
68 // change F2 ring node
69 ring_node_to_send_swf_f2 = current_ring_node_f2;
70 current_ring_node_f2 = current_ring_node_f2->next;
71 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
72 //
73 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL)
74 {
75 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
76 }
77 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff888; // [1000 1000 1000]
78 }
79 break;
80
81 //******
82 // BURST
83 case(LFR_MODE_BURST):
84 if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit
85 // (1) change the receiving buffer for the waveform picker
86 ring_node_to_send_cwf_f2 = current_ring_node_f2;
87 current_ring_node_f2 = current_ring_node_f2->next;
88 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
89 // (2) send an event for the waveforms transmission
90 if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) {
91 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
92 }
93 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0
94 }
95 break;
96
97 //*****
98 // SBM1
99 case(LFR_MODE_SBM1):
100 if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit
101 // (1) change the receiving buffer for the waveform picker
102 ring_node_to_send_cwf_f1 = current_ring_node_f1;
103 current_ring_node_f1 = current_ring_node_f1->next;
104 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address;
105 // (2) send an event for the the CWF1 task for transmission (and snapshot extraction if needed)
106 status = rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 );
107 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bits = 0
108 }
109 if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit
110 swf_f0_ready = true;
111 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffeee; // [1111 1110 1110 1110] f0 bits = 0
112 }
113 if ( (waveform_picker_regs->status & 0x04) == 0x04 ) { // [0100] check the f2 full bit
114 swf_f2_ready = true;
115 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bits = 0
116 }
117 break;
118
119 //*****
120 // SBM2
121 case(LFR_MODE_SBM2):
122 if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit
123 // (1) change the receiving buffer for the waveform picker
124 ring_node_to_send_cwf_f2 = current_ring_node_f2;
125 current_ring_node_f2 = current_ring_node_f2->next;
126 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
127 // (2) send an event for the waveforms transmission
128 status = rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 );
129 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0
130 }
131 if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit
132 swf_f0_ready = true;
133 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffeee; // [1111 1110 1110 1110] f0 bits = 0
134 }
135 if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit
136 swf_f1_ready = true;
137 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1, f0 bits = 0
138 }
139 break;
140
141 //********
142 // DEFAULT
143 default:
144 break;
145 }
146 }
147
148 void spool_waveforms_alt( void )
149 {
150 // WFRM
151 if (wake_up_task_wfrm == true)
152 {
153 rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL );
154 wake_up_task_wfrm = false;
155 }
156 // CWF_F1
157 if (wake_up_task_cwf_f1 == true)
158 {
159 rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 );
160 wake_up_task_cwf_f1 = false;
161 }
162 // CWF_F2 BURST
163 if (wake_up_task_cwf_f2_burst == true)
164 {
165 rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST );
166 wake_up_task_cwf_f2_burst = false;
167 }
168 // CWF_F2 SBM2
169 if (wake_up_task_cwf_f2_sbm2 == true)
170 {
171 rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 );
172 wake_up_task_cwf_f2_sbm2 = false;
173 }
174 // CWF_F3
175 if (wake_up_task_cwf_f3 == true)
176 {
177 rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 );
178 wake_up_task_cwf_f3 = false;
179 }
180 }
181
182 void spool_spectral_matrices( void )
183 {
184 // STATUS REGISTER
185 // input_fifo_write(2) *** input_fifo_write(1) *** input_fifo_write(0)
186 // 10 9 8
187 // buffer_full ** bad_component_err ** f2_1 ** f2_0 ** f1_1 ** f1_0 ** f0_1 ** f0_0
188 // 7 6 5 4 3 2 1 0
189
190 unsigned char status_f0;
191 unsigned char status_f1;
192 unsigned char status_f2;
193 static unsigned int counter = 0;
194
195 rtems_interrupt_level level;
196
197 rtems_interrupt_disable( level );
198
199 status_f0 = spectral_matrix_regs->status & 0x03; // [0011] get the status_ready_matrix_f0_x bits
200 status_f1 = (spectral_matrix_regs->status & 0x0c) >> 2; // [0011] get the status_ready_matrix_f0_x bits
201 status_f2 = (spectral_matrix_regs->status & 0x30) >> 4; // [0011] get the status_ready_matrix_f0_x bits
202
203 // if ( status_f0 == 0x03)
204 // {
205 // printf("%d \n", counter);
206 // }
207 if ( status_f1 == 0x03)
208 {
209 printf("f1 %d \n", counter);
210 }
211 if ( status_f2 == 0x03)
212 {
213 printf("f2 %d \n", counter);
214 }
215
216 spectral_matrices_isr_f0();
217
218 spectral_matrices_isr_f1();
219
220 spectral_matrices_isr_f2();
221
222 spectral_matrix_isr_error_handler();
223
224 rtems_interrupt_enable( level );
225
226 counter = counter + 1;
227 }
228
229 //************
230 // RTEMS TASKS
231
232 rtems_task spoo_task(rtems_task_argument argument)
233 {
234 rtems_status_code status;
235
236 BOOT_PRINTF("in SPOOL ***\n")
237
238 if (rtems_rate_monotonic_ident( name_spool_rate_monotonic, &spool_period_id) != RTEMS_SUCCESSFUL) {
239 status = rtems_rate_monotonic_create( name_spool_rate_monotonic, &spool_period_id );
240 if( status != RTEMS_SUCCESSFUL ) {
241 PRINTF1( "in SPOO *** rtems_rate_monotonic_create failed with status %d\n", status )
242 }
243 }
244
245 status = rtems_rate_monotonic_cancel( spool_period_id );
246 if( status != RTEMS_SUCCESSFUL )
247 {
248 PRINTF1( "ERR *** in SPOOL *** rtems_rate_monotonic_cancel(spool_period_id) ***code: %d\n", status )
249 }
250 else
251 {
252 DEBUG_PRINTF("OK *** in SPOOL *** rtems_rate_monotonic_cancel(spool_period_id)\n")
253 }
254
255 while(1){ // launch the rate monotonic task
256 // status = rtems_rate_monotonic_period( spool_period_id, SPOOL_TIMEOUT_in_ticks );
257 rtems_task_wake_after( SPOOL_TIMEOUT_in_ticks / 2 );
258 spool_waveforms_alt();
259 spool_spectral_matrices();
260 // if ( status != RTEMS_SUCCESSFUL )
261 // {
262 // PRINTF1( "in SPOOL *** ERR period: %d\n", status);
263 // }
264 // else
265 // {
266 // spool_waveforms();
267 // spool_spectral_matrices();
268 // }
269 }
270
271 PRINTF("in SPOOL *** deleting task\n")
272
273 status = rtems_task_delete( RTEMS_SELF ); // should not return
274 printf( "rtems_task_delete returned with status of %d.\n", status );
275 return;
276 }
@@ -1,6 +1,6
1 #############################################################################
1 #############################################################################
2 # Makefile for building: bin/fsw
2 # Makefile for building: bin/fsw
3 # Generated by qmake (2.01a) (Qt 4.8.6) on: Tue Jul 15 15:57:23 2014
3 # Generated by qmake (2.01a) (Qt 4.8.6) on: Thu Jul 17 15:49:45 2014
4 # Project: fsw-qt.pro
4 # Project: fsw-qt.pro
5 # Template: app
5 # Template: app
6 # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
6 # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
@@ -10,7 +10,7
10
10
11 CC = sparc-rtems-gcc
11 CC = sparc-rtems-gcc
12 CXX = sparc-rtems-g++
12 CXX = sparc-rtems-g++
13 DEFINES = -DSW_VERSION_N1=2 -DSW_VERSION_N2=0 -DSW_VERSION_N3=1 -DSW_VERSION_N4=0 -DPRINT_MESSAGES_ON_CONSOLE
13 DEFINES = -DSW_VERSION_N1=2 -DSW_VERSION_N2=0 -DSW_VERSION_N3=1 -DSW_VERSION_N4=1 -DPRINT_MESSAGES_ON_CONSOLE -DPRINT_TASK_STATISTICS -DFAST_SCHEDULER
14 CFLAGS = -pipe -O3 -Wall $(DEFINES)
14 CFLAGS = -pipe -O3 -Wall $(DEFINES)
15 CXXFLAGS = -pipe -O3 -Wall $(DEFINES)
15 CXXFLAGS = -pipe -O3 -Wall $(DEFINES)
16 INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header -I../header/processing -I../src/LFR_basic-parameters
16 INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header -I../header/processing -I../src/LFR_basic-parameters
@@ -57,7 +57,8 SOURCES = ../src/wf_handler.c \
57 ../src/processing/avf1_prc1.c \
57 ../src/processing/avf1_prc1.c \
58 ../src/processing/avf2_prc2.c \
58 ../src/processing/avf2_prc2.c \
59 ../src/lfr_cpu_usage_report.c \
59 ../src/lfr_cpu_usage_report.c \
60 ../src/LFR_basic-parameters/basic_parameters.c
60 ../src/LFR_basic-parameters/basic_parameters.c \
61 ../src/fsw_spool.c
61 OBJECTS = obj/wf_handler.o \
62 OBJECTS = obj/wf_handler.o \
62 obj/tc_handler.o \
63 obj/tc_handler.o \
63 obj/fsw_misc.o \
64 obj/fsw_misc.o \
@@ -72,7 +73,8 OBJECTS = obj/wf_handler.o \
72 obj/avf1_prc1.o \
73 obj/avf1_prc1.o \
73 obj/avf2_prc2.o \
74 obj/avf2_prc2.o \
74 obj/lfr_cpu_usage_report.o \
75 obj/lfr_cpu_usage_report.o \
75 obj/basic_parameters.o
76 obj/basic_parameters.o \
77 obj/fsw_spool.o
76 DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \
78 DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \
77 /usr/lib64/qt4/mkspecs/common/linux.conf \
79 /usr/lib64/qt4/mkspecs/common/linux.conf \
78 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
80 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
@@ -263,6 +265,9 obj/lfr_cpu_usage_report.o: ../src/lfr_c
263 obj/basic_parameters.o: ../src/LFR_basic-parameters/basic_parameters.c
265 obj/basic_parameters.o: ../src/LFR_basic-parameters/basic_parameters.c
264 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/basic_parameters.o ../src/LFR_basic-parameters/basic_parameters.c
266 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/basic_parameters.o ../src/LFR_basic-parameters/basic_parameters.c
265
267
268 obj/fsw_spool.o: ../src/fsw_spool.c
269 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spool.o ../src/fsw_spool.c
270
266 ####### Install
271 ####### Install
267
272
268 install: FORCE
273 install: FORCE
@@ -1,10 +1,9
1 SREC_PREFIX = RpwLfrApp
1 SREC_PREFIX = RpwLfrApp
2 SREC_COUNTER_TEXT = 0003
2 SREC_COUNTER = 0003
3 SREC_COUNTER_DATA = 0004
3 SREC_FSW_REF = rev-2-0-1-0
4 SREC_FSW_REF = rev-1-0-0-7
5 SREC_SUFFIX = .srec
4 SREC_SUFFIX = .srec
6 SREC_TEXT = $(SREC_PREFIX)_$(SREC_COUNTER_TEXT)_text_$(SREC_FSW_REF)$(SREC_SUFFIX)
5 SREC_TEXT = $(SREC_PREFIX)_$(SREC_COUNTER)_text_$(SREC_FSW_REF)$(SREC_SUFFIX)
7 SREC_DATA = $(SREC_PREFIX)_$(SREC_COUNTER_DATA)_data_$(SREC_FSW_REF)$(SREC_SUFFIX)
6 SREC_DATA = $(SREC_PREFIX)_$(SREC_COUNTER)_data_$(SREC_FSW_REF)$(SREC_SUFFIX)
8 OBJCOPY = sparc-rtems-objcopy
7 OBJCOPY = sparc-rtems-objcopy
9 OBJCOPY_OPT = -g -v
8 OBJCOPY_OPT = -g -v
10
9
@@ -1,7 +1,7
1 TEMPLATE = app
1 TEMPLATE = app
2 # CONFIG += console v8 sim
2 # CONFIG += console v8 sim
3 # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** vhdl_dev *** debug_tch
3 # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** vhdl_dev *** debug_tch
4 CONFIG += console verbose
4 CONFIG += console verbose fast_scheduler cpu_usage_report
5 CONFIG -= qt
5 CONFIG -= qt
6
6
7 include(./sparc.pri)
7 include(./sparc.pri)
@@ -11,7 +11,7 SWVERSION=-1-0
11 DEFINES += SW_VERSION_N1=2 # major
11 DEFINES += SW_VERSION_N1=2 # major
12 DEFINES += SW_VERSION_N2=0 # minor
12 DEFINES += SW_VERSION_N2=0 # minor
13 DEFINES += SW_VERSION_N3=1 # patch
13 DEFINES += SW_VERSION_N3=1 # patch
14 DEFINES += SW_VERSION_N4=0 # internal
14 DEFINES += SW_VERSION_N4=1 # internal
15
15
16 contains( CONFIG, debug_tch ) {
16 contains( CONFIG, debug_tch ) {
17 DEFINES += DEBUG_TCH
17 DEFINES += DEBUG_TCH
@@ -41,6 +41,10 contains( CONFIG, boot_messages ) {
41 DEFINES += BOOT_MESSAGES
41 DEFINES += BOOT_MESSAGES
42 }
42 }
43
43
44 contains( CONFIG, fast_scheduler ) {
45 DEFINES += FAST_SCHEDULER
46 }
47
44 #doxygen.target = doxygen
48 #doxygen.target = doxygen
45 #doxygen.commands = doxygen ../doc/Doxyfile
49 #doxygen.commands = doxygen ../doc/Doxyfile
46 #QMAKE_EXTRA_TARGETS += doxygen
50 #QMAKE_EXTRA_TARGETS += doxygen
@@ -68,7 +72,8 SOURCES += \
68 ../src/processing/avf1_prc1.c \
72 ../src/processing/avf1_prc1.c \
69 ../src/processing/avf2_prc2.c \
73 ../src/processing/avf2_prc2.c \
70 ../src/lfr_cpu_usage_report.c \
74 ../src/lfr_cpu_usage_report.c \
71 ../src/LFR_basic-parameters/basic_parameters.c
75 ../src/LFR_basic-parameters/basic_parameters.c \
76 ../src/fsw_spool.c
72
77
73 HEADERS += \
78 HEADERS += \
74 ../header/wf_handler.h \
79 ../header/wf_handler.h \
@@ -91,5 +96,6 HEADERS += \
91 ../header/fsw_params_wf_handler.h \
96 ../header/fsw_params_wf_handler.h \
92 ../header/lfr_cpu_usage_report.h \
97 ../header/lfr_cpu_usage_report.h \
93 ../src/LFR_basic-parameters/basic_parameters.h \
98 ../src/LFR_basic-parameters/basic_parameters.h \
94 ../src/LFR_basic-parameters/basic_parameters_params.h
99 ../src/LFR_basic-parameters/basic_parameters_params.h \
100 ../header/fsw_spool.h
95
101
@@ -1,6 +1,6
1 <?xml version="1.0" encoding="UTF-8"?>
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE QtCreatorProject>
2 <!DOCTYPE QtCreatorProject>
3 <!-- Written by QtCreator 3.0.1, 2014-07-15T16:01:49. -->
3 <!-- Written by QtCreator 3.1.2, 2014-08-28T14:53:30. -->
4 <qtcreator>
4 <qtcreator>
5 <data>
5 <data>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
@@ -29,9 +29,12
29 <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
29 <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
30 <value type="int" key="EditorConfiguration.IndentSize">4</value>
30 <value type="int" key="EditorConfiguration.IndentSize">4</value>
31 <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
31 <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
32 <value type="int" key="EditorConfiguration.MarginColumn">80</value>
33 <value type="bool" key="EditorConfiguration.MouseHiding">true</value>
32 <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
34 <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
33 <value type="int" key="EditorConfiguration.PaddingMode">1</value>
35 <value type="int" key="EditorConfiguration.PaddingMode">1</value>
34 <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
36 <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
37 <value type="bool" key="EditorConfiguration.ShowMargin">false</value>
35 <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
38 <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
36 <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
39 <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
37 <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
40 <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
@@ -15,9 +15,10
15 #include "avf0_prc0.h"
15 #include "avf0_prc0.h"
16 #include "avf1_prc1.h"
16 #include "avf1_prc1.h"
17 #include "avf2_prc2.h"
17 #include "avf2_prc2.h"
18 #include "fsw_spool.h"
18
19
19 extern rtems_name Task_name[20]; /* array of task names */
20 extern rtems_name Task_name[]; /* array of task names */
20 extern rtems_id Task_id[20]; /* array of task ids */
21 extern rtems_id Task_id[]; /* array of task ids */
21
22
22 // RTEMS TASKS
23 // RTEMS TASKS
23 rtems_task Init( rtems_task_argument argument);
24 rtems_task Init( rtems_task_argument argument);
@@ -140,11 +140,25 typedef struct ring_node
140
140
141 //*****
141 //*****
142 // TIME
142 // TIME
143 #define CLKDIV_SM_SIMULATOR (10416 - 1) // 10 ms => nominal is 1/96 = 0.010416667, 10417 - 1 = 10416
143 #ifdef FAST_SCHEDULER
144 #define TIMER_SM_SIMULATOR 1
144 #define CLKDIV_SM_SIMULATOR (10416 - 1) // 10 ms => nominal is 1/96 = 0.010416667, 10417 - 1 = 10416
145 #define HK_PERIOD 100 // 100 * 10ms => 1s
145 #define TIMER_SM_SIMULATOR 1
146 #define SY_LFR_TIME_SYN_TIMEOUT_in_ms 2000
146 #define HK_PERIOD 1000 // 1000 * 1ms = 1s
147 #define SY_LFR_TIME_SYN_TIMEOUT_in_ticks 200 // 200 * 10 ms = 2 s
147 #define SY_LFR_TIME_SYN_TIMEOUT_in_ms 2000
148 #define SY_LFR_TIME_SYN_TIMEOUT_in_ticks 2000 // 2000 * 1ms = 2s
149 #define SPOOL_TIMEOUT_in_ms 10
150 #define SPOOL_TIMEOUT_in_ticks 5 // 10 * 1ms = 10ms
151 #define STAT_TASK_PERIOD 10000 // 10000 * 1ms = 10s
152 #else
153 #define CLKDIV_SM_SIMULATOR (10416 - 1) // 10 ms => nominal is 1/96 = 0.010416667, 10417 - 1 = 10416
154 #define TIMER_SM_SIMULATOR 1
155 #define HK_PERIOD 100 // 100 * 10ms = 1s
156 #define SY_LFR_TIME_SYN_TIMEOUT_in_ms 2000
157 #define SY_LFR_TIME_SYN_TIMEOUT_in_ticks 200 // 200 * 10 ms = 2 s
158 #define SPOOL_TIMEOUT_in_ms 10
159 #define SPOOL_TIMEOUT_in_ticks 1 // 200 * 10 ms = 2 s
160 #define STAT_TASK_PERIOD 1000 // 1000 * 10ms = 10s
161 #endif
148
162
149 //**********
163 //**********
150 // LPP CODES
164 // LPP CODES
@@ -173,6 +187,7 typedef struct ring_node
173 #define TASKID_PRC1 17
187 #define TASKID_PRC1 17
174 #define TASKID_AVF2 18
188 #define TASKID_AVF2 18
175 #define TASKID_PRC2 19
189 #define TASKID_PRC2 19
190 #define TASKID_SPOO 20
176
191
177 #define TASK_PRIORITY_SPIQ 5
192 #define TASK_PRIORITY_SPIQ 5
178 #define TASK_PRIORITY_WTDG 20
193 #define TASK_PRIORITY_WTDG 20
@@ -191,6 +206,7 typedef struct ring_node
191 #define TASK_PRIORITY_PRC1 100
206 #define TASK_PRIORITY_PRC1 100
192 #define TASK_PRIORITY_AVF2 110
207 #define TASK_PRIORITY_AVF2 110
193 #define TASK_PRIORITY_PRC2 110
208 #define TASK_PRIORITY_PRC2 110
209 #define TASK_PRIORITY_SPOO 150
194 #define TASK_PRIORITY_STAT 200
210 #define TASK_PRIORITY_STAT 200
195 #define TASK_PRIORITY_DUMB 200
211 #define TASK_PRIORITY_DUMB 200
196
212
@@ -60,10 +60,14 extern struct param_local_str param_loca
60 extern time_management_regs_t *time_management_regs;
60 extern time_management_regs_t *time_management_regs;
61 extern spectral_matrix_regs_t *spectral_matrix_regs;
61 extern spectral_matrix_regs_t *spectral_matrix_regs;
62
62
63 extern rtems_name misc_name[5];
63 extern rtems_name misc_name[];
64 extern rtems_id Task_id[20]; /* array of task ids */
64 extern rtems_id Task_id[]; /* array of task ids */
65
65
66 // ISR
66 // ISR
67 void spectral_matrices_isr_f0( void );
68 void spectral_matrices_isr_f1( void );
69 void spectral_matrices_isr_f2( void );
70 void spectral_matrix_isr_error_handler( void );
67 rtems_isr spectral_matrices_isr( rtems_vector_number vector );
71 rtems_isr spectral_matrices_isr( rtems_vector_number vector );
68 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector );
72 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector );
69
73
@@ -42,7 +42,9 int enter_mode( unsigned char mode , uns
42 int restart_science_tasks(unsigned char lfrRequestedMode );
42 int restart_science_tasks(unsigned char lfrRequestedMode );
43 int suspend_science_tasks();
43 int suspend_science_tasks();
44 void launch_waveform_picker(unsigned char mode , unsigned int transitionCoarseTime);
44 void launch_waveform_picker(unsigned char mode , unsigned int transitionCoarseTime);
45 void launch_waveform_picker_spool(unsigned char mode , unsigned int transitionCoarseTime);
45 void launch_spectral_matrix( void );
46 void launch_spectral_matrix( void );
47 void launch_spectral_matrix_spool( void );
46 void launch_spectral_matrix_simu( void );
48 void launch_spectral_matrix_simu( void );
47 void set_irq_on_new_ready_matrix(unsigned char value );
49 void set_irq_on_new_ready_matrix(unsigned char value );
48 void set_run_matrix_spectral( unsigned char value );
50 void set_run_matrix_spectral( unsigned char value );
@@ -32,7 +32,7 extern struct param_local_str param_loca
32 extern unsigned short sequenceCounters_SCIENCE_NORMAL_BURST;
32 extern unsigned short sequenceCounters_SCIENCE_NORMAL_BURST;
33 extern unsigned short sequenceCounters_SCIENCE_SBM1_SBM2;
33 extern unsigned short sequenceCounters_SCIENCE_SBM1_SBM2;
34
34
35 extern rtems_id Task_id[20]; /* array of task ids */
35 extern rtems_id Task_id[]; /* array of task ids */
36
36
37 extern unsigned char lfrCurrentMode;
37 extern unsigned char lfrCurrentMode;
38
38
@@ -40,6 +40,7 extern unsigned char lfrCurrentMode;
40 // RTEMS_ISR
40 // RTEMS_ISR
41 void reset_extractSWF( void );
41 void reset_extractSWF( void );
42 rtems_isr waveforms_isr( rtems_vector_number vector );
42 rtems_isr waveforms_isr( rtems_vector_number vector );
43 rtems_isr waveforms_isr_alt( rtems_vector_number vector );
43
44
44 //***********
45 //***********
45 // RTEMS_TASK
46 // RTEMS_TASK
@@ -25,8 +25,8
25 // RTEMS GLOBAL VARIABLES
25 // RTEMS GLOBAL VARIABLES
26 rtems_name misc_name[5];
26 rtems_name misc_name[5];
27 rtems_id misc_id[5];
27 rtems_id misc_id[5];
28 rtems_name Task_name[20]; /* array of task names */
28 rtems_name Task_name[21]; /* array of task names */
29 rtems_id Task_id[20]; /* array of task ids */
29 rtems_id Task_id[21]; /* array of task ids */
30 unsigned int maxCount;
30 unsigned int maxCount;
31 int fdSPW = 0;
31 int fdSPW = 0;
32 int fdUART = 0;
32 int fdUART = 0;
@@ -26,7 +26,7
26 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
26 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
27 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
27 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
28
28
29 #define CONFIGURE_MAXIMUM_TASKS 20
29 #define CONFIGURE_MAXIMUM_TASKS 21
30 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
30 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
31 #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE)
31 #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE)
32 #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32
32 #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32
@@ -40,6 +40,9
40 #ifdef PRINT_STACK_REPORT
40 #ifdef PRINT_STACK_REPORT
41 #define CONFIGURE_STACK_CHECKER_ENABLED
41 #define CONFIGURE_STACK_CHECKER_ENABLED
42 #endif
42 #endif
43 #ifdef FAST_SCHEDULER
44 #define CONFIGURE_MICROSECONDS_PER_TICK 1000 /* 1 millisecond */
45 #endif
43
46
44 #include <rtems/confdefs.h>
47 #include <rtems/confdefs.h>
45
48
@@ -194,13 +197,13 rtems_task Init( rtems_task_argument ign
194 //*******************************
197 //*******************************
195
198
196 // configure IRQ handling for the waveform picker unit
199 // configure IRQ handling for the waveform picker unit
197 status = rtems_interrupt_catch( waveforms_isr,
200 status = rtems_interrupt_catch( waveforms_isr_alt,
198 IRQ_SPARC_WAVEFORM_PICKER,
201 IRQ_SPARC_WAVEFORM_PICKER,
199 &old_isr_handler) ;
202 &old_isr_handler) ;
200 // configure IRQ handling for the spectral matrices unit
203 // configure IRQ handling for the spectral matrices unit
201 status = rtems_interrupt_catch( spectral_matrices_isr,
204 // status = rtems_interrupt_catch( spectral_matrices_isr,
202 IRQ_SPARC_SPECTRAL_MATRIX,
205 // IRQ_SPARC_SPECTRAL_MATRIX,
203 &old_isr_handler) ;
206 // &old_isr_handler) ;
204
207
205 // if the spacewire link is not up then send an event to the SPIQ task for link recovery
208 // if the spacewire link is not up then send an event to the SPIQ task for link recovery
206 if ( status_spw != RTEMS_SUCCESSFUL )
209 if ( status_spw != RTEMS_SUCCESSFUL )
@@ -277,9 +280,11 void create_names( void ) // create all
277 Task_name[TASKID_PRC1] = rtems_build_name( 'P', 'R', 'C', '1' );
280 Task_name[TASKID_PRC1] = rtems_build_name( 'P', 'R', 'C', '1' );
278 Task_name[TASKID_AVF2] = rtems_build_name( 'A', 'V', 'F', '2' );
281 Task_name[TASKID_AVF2] = rtems_build_name( 'A', 'V', 'F', '2' );
279 Task_name[TASKID_PRC2] = rtems_build_name( 'P', 'R', 'C', '2' );
282 Task_name[TASKID_PRC2] = rtems_build_name( 'P', 'R', 'C', '2' );
283 Task_name[TASKID_SPOO] = rtems_build_name( 'S', 'P', 'O', 'O' );
280
284
281 // rate monotonic period names
285 // rate monotonic period names
282 name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' );
286 name_hk_rate_monotonic = rtems_build_name( 'R', '_', 'H', 'K' );
287 name_spool_rate_monotonic = rtems_build_name( 'R', '_', 'S', 'P' );
283
288
284 misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' );
289 misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' );
285 misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' );
290 misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' );
@@ -467,6 +472,14 int create_all_tasks( void ) // create a
467 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS]
472 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS]
468 );
473 );
469 }
474 }
475 if (status == RTEMS_SUCCESSFUL) // SPOO
476 {
477 status = rtems_task_create(
478 Task_name[TASKID_SPOO], TASK_PRIORITY_SPOO, RTEMS_MINIMUM_STACK_SIZE,
479 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
480 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPOO]
481 );
482 }
470
483
471 return status;
484 return status;
472 }
485 }
@@ -636,6 +649,13 int start_all_tasks( void ) // start all
636 BOOT_PRINTF("in INIT *** Error starting TASK_STAT\n")
649 BOOT_PRINTF("in INIT *** Error starting TASK_STAT\n")
637 }
650 }
638 }
651 }
652 if (status == RTEMS_SUCCESSFUL) // SPOO
653 {
654 status = rtems_task_start( Task_id[TASKID_SPOO], spoo_task, 1 );
655 if (status!=RTEMS_SUCCESSFUL) {
656 BOOT_PRINTF("in INIT *** Error starting TASK_SPOO\n")
657 }
658 }
639
659
640 return status;
660 return status;
641 }
661 }
@@ -125,7 +125,7 rtems_task stat_task(rtems_task_argument
125 j = 0;
125 j = 0;
126 BOOT_PRINTF("in STAT *** \n")
126 BOOT_PRINTF("in STAT *** \n")
127 while(1){
127 while(1){
128 rtems_task_wake_after(1000);
128 rtems_task_wake_after(STAT_TASK_PERIOD);
129 PRINTF1("%d\n", j)
129 PRINTF1("%d\n", j)
130 if (i == CPU_USAGE_REPORT_PERIOD) {
130 if (i == CPU_USAGE_REPORT_PERIOD) {
131 // #ifdef PRINT_TASK_STATISTICS
131 // #ifdef PRINT_TASK_STATISTICS
@@ -156,7 +156,7 rtems_task hous_task(rtems_task_argument
156 if (rtems_rate_monotonic_ident( name_hk_rate_monotonic, &HK_id) != RTEMS_SUCCESSFUL) {
156 if (rtems_rate_monotonic_ident( name_hk_rate_monotonic, &HK_id) != RTEMS_SUCCESSFUL) {
157 status = rtems_rate_monotonic_create( name_hk_rate_monotonic, &HK_id );
157 status = rtems_rate_monotonic_create( name_hk_rate_monotonic, &HK_id );
158 if( status != RTEMS_SUCCESSFUL ) {
158 if( status != RTEMS_SUCCESSFUL ) {
159 PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status )
159 PRINTF1( "in HOUS *** rtems_rate_monotonic_create failed with status of %d\n", status )
160 }
160 }
161 }
161 }
162
162
@@ -524,6 +524,3 void get_cpu_load( unsigned char *resour
524 #endif
524 #endif
525
525
526 }
526 }
527
528
529
@@ -208,6 +208,7 rtems_task send_task( rtems_task_argumen
208 size_t size; // size of the incoming TC packet
208 size_t size; // size of the incoming TC packet
209 u_int32_t count;
209 u_int32_t count;
210 rtems_id queue_id;
210 rtems_id queue_id;
211 rtems_interrupt_level level;
211
212
212 status = get_message_queue_id_send( &queue_id );
213 status = get_message_queue_id_send( &queue_id );
213 if (status != RTEMS_SUCCESSFUL)
214 if (status != RTEMS_SUCCESSFUL)
@@ -221,7 +222,7 rtems_task send_task( rtems_task_argumen
221 {
222 {
222 status = rtems_message_queue_receive( queue_id, incomingData, &size,
223 status = rtems_message_queue_receive( queue_id, incomingData, &size,
223 RTEMS_WAIT, RTEMS_NO_TIMEOUT );
224 RTEMS_WAIT, RTEMS_NO_TIMEOUT );
224
225 rtems_interrupt_disable( level );
225 if (status!=RTEMS_SUCCESSFUL)
226 if (status!=RTEMS_SUCCESSFUL)
226 {
227 {
227 PRINTF1("in SEND *** (1) ERR = %d\n", status)
228 PRINTF1("in SEND *** (1) ERR = %d\n", status)
@@ -257,6 +258,8 rtems_task send_task( rtems_task_argumen
257 maxCount = count;
258 maxCount = count;
258 }
259 }
259 }
260 }
261
262 rtems_interrupt_enable( level );
260 }
263 }
261 }
264 }
262
265
@@ -173,10 +173,12 void spectral_matrices_isr_f2( void )
173
173
174 void spectral_matrix_isr_error_handler( void )
174 void spectral_matrix_isr_error_handler( void )
175 {
175 {
176 if (spectral_matrix_regs->status & 0x7c0) // [0111 1100 0000]
176 // if (spectral_matrix_regs->status & 0x7c0) // [0111 1100 0000]
177 {
177 // {
178 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 );