##// END OF EJS Templates
AVF1 and PRC1 tasks added for processing at f1
paul -
r121:4bba4856191b VHDLib206
parent child
Show More
@@ -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.5) on: Thu Apr 17 09:53:23 2014
3 # Generated by qmake (2.01a) (Qt 4.8.5) on: Tue Apr 22 18:10:21 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
@@ -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-04-17T09:46:14. -->
3 <!-- Written by QtCreator 3.0.1, 2014-04-22T18:12:39. -->
4 <qtcreator>
4 <qtcreator>
5 <data>
5 <data>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
@@ -203,14 +203,17 enum apid_destid{
203 #define PACKET_LENGTH_TC_EXE_CORRUPTED (32 - CCSDS_TC_TM_PACKET_OFFSET)
203 #define PACKET_LENGTH_TC_EXE_CORRUPTED (32 - CCSDS_TC_TM_PACKET_OFFSET)
204 #define PACKET_LENGTH_HK (124 - CCSDS_TC_TM_PACKET_OFFSET)
204 #define PACKET_LENGTH_HK (124 - CCSDS_TC_TM_PACKET_OFFSET)
205 #define PACKET_LENGTH_PARAMETER_DUMP (36 - CCSDS_TC_TM_PACKET_OFFSET)
205 #define PACKET_LENGTH_PARAMETER_DUMP (36 - CCSDS_TC_TM_PACKET_OFFSET)
206 #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0 (2228 - CCSDS_TC_TM_PACKET_OFFSET) // 44 * 25 * 2 + 28 - 7
206 #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0 (2228 - CCSDS_TC_TM_PACKET_OFFSET) // 44 * 25 * 2 + 28
207 #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F1 (2628 - CCSDS_TC_TM_PACKET_OFFSET) // 52 * 25 * 2 + 28 - 7
207 #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F1 (2628 - CCSDS_TC_TM_PACKET_OFFSET) // 52 * 25 * 2 + 28
208 #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F2 (2428 - CCSDS_TC_TM_PACKET_OFFSET) // 48 * 25 * 2 + 28 - 7
208 #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F2 (2428 - CCSDS_TC_TM_PACKET_OFFSET) // 48 * 25 * 2 + 28
209 #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 (126 - CCSDS_TC_TM_PACKET_OFFSET) // 11 * 9 + 27 - 7
209 #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 (126 - CCSDS_TC_TM_PACKET_OFFSET) // 11 * 9 + 27
210 #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0 (356 - CCSDS_TC_TM_PACKET_OFFSET) // 11 * 30 + 25 - 7
210 #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0 (356 - CCSDS_TC_TM_PACKET_OFFSET) // 11 * 30 + 26
211 #define PACKET_LENGTH_TM_LFR_SCIENCE_BURST_BP2_F1 (806 - CCSDS_TC_TM_PACKET_OFFSET) // 26 * 30 + 26 - 7
211 #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F1 (144 - CCSDS_TC_TM_PACKET_OFFSET) // 13 * 9 + 27
212 #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0 (224 - CCSDS_TC_TM_PACKET_OFFSET) // 22 * 9 + 26 - 7
212 #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F1 (416 - CCSDS_TC_TM_PACKET_OFFSET) // 13 * 30 + 26
213 #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0 (686 - CCSDS_TC_TM_PACKET_OFFSET) // 22 * 30 + 26 - 7
213 #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0 (224 - CCSDS_TC_TM_PACKET_OFFSET) // 22 * 9 + 26
214 #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0 (686 - CCSDS_TC_TM_PACKET_OFFSET) // 22 * 30 + 26
215 #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F1 (260 - CCSDS_TC_TM_PACKET_OFFSET) // 26 * 9 + 26
216 #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F1 (806 - CCSDS_TC_TM_PACKET_OFFSET) // 26 * 30 + 26
214
217
215 #define PACKET_LENGTH_DELTA 11 // 7 + 4
218 #define PACKET_LENGTH_DELTA 11 // 7 + 4
216
219
@@ -19,30 +19,6 typedef struct ring_node
19 } ring_node;
19 } ring_node;
20
20
21 typedef struct {
21 typedef struct {
22 // F0
23 unsigned int f0;
24 unsigned int norm_bp1_f0;
25 unsigned int norm_bp2_f0;
26 unsigned int norm_asm_f0;
27 unsigned int sbm_bp1_f0;
28 unsigned int sbm_bp2_f0;
29 // F1
30 unsigned int f1;
31 unsigned int norm_bp1_f1;
32 unsigned int norm_bp2_f1;
33 unsigned int norm_asm_f1;
34 unsigned int sbm_bp1_f1;
35 unsigned int sbm_bp2_f1;
36 // F2
37 unsigned int f2;
38 unsigned int norm_bp1_f2;
39 unsigned int norm_bp2_f2;
40 unsigned int norm_asm_f2;
41 unsigned int sbm_bp1_f2;
42 unsigned int sbm_bp2_f2;
43 } nb_sm_t;
44
45 typedef struct {
46 unsigned int norm_bp1_f0;
22 unsigned int norm_bp1_f0;
47 unsigned int norm_bp2_f0;
23 unsigned int norm_bp2_f0;
48 unsigned int norm_asm_f0;
24 unsigned int norm_asm_f0;
@@ -57,15 +33,15 typedef struct {
57 } nb_sm_before_bp_asm_f0;
33 } nb_sm_before_bp_asm_f0;
58
34
59 typedef struct {
35 typedef struct {
60 unsigned int norm_bp1_f1;
36 unsigned int norm_bp1;
61 unsigned int norm_bp2_f1;
37 unsigned int norm_bp2;
62 unsigned int norm_asm_f1;
38 unsigned int norm_asm;
63 unsigned int burst_sbm_bp1_f1;
39 unsigned int burst_sbm_bp1;
64 unsigned int burst_sbm_bp2_f1;
40 unsigned int burst_sbm_bp2;
65 unsigned int burst_bp1_f1;
41 unsigned int burst_bp1;
66 unsigned int burst_bp2_f1;
42 unsigned int burst_bp2;
67 unsigned int sbm2_bp1_f1;
43 unsigned int sbm2_bp1;
68 unsigned int sbm2_bp2_f1;
44 unsigned int sbm2_bp2;
69 } nb_sm_before_bp_asm_f1;
45 } nb_sm_before_bp_asm_f1;
70
46
71 typedef struct {
47 typedef struct {
@@ -215,22 +191,23 typedef struct {
215 #define TASKID_RECV 1
191 #define TASKID_RECV 1
216 #define TASKID_ACTN 2
192 #define TASKID_ACTN 2
217 #define TASKID_SPIQ 3
193 #define TASKID_SPIQ 3
218 #define TASKID_SMIQ 4
194 #define TASKID_STAT 4
219 #define TASKID_STAT 5
195 #define TASKID_AVF0 5
220 #define TASKID_AVF0 6
196 #define TASKID_SWBD 6
221 #define TASKID_SWBD 7
197 #define TASKID_WFRM 7
222 #define TASKID_WFRM 8
198 #define TASKID_DUMB 8
223 #define TASKID_DUMB 9
199 #define TASKID_HOUS 9
224 #define TASKID_HOUS 10
200 #define TASKID_PRC0 10
225 #define TASKID_PRC0 11
201 #define TASKID_CWF3 11
226 #define TASKID_CWF3 12
202 #define TASKID_CWF2 12
227 #define TASKID_CWF2 13
203 #define TASKID_CWF1 13
228 #define TASKID_CWF1 14
204 #define TASKID_SEND 14
229 #define TASKID_SEND 15
205 #define TASKID_WTDG 15
230 #define TASKID_WTDG 16
206 #define TASKID_AVF1 16
207 #define TASKID_PRC1 17
231
208
232 #define TASK_PRIORITY_SPIQ 5
209 #define TASK_PRIORITY_SPIQ 5
233 #define TASK_PRIORITY_SMIQ 10
210 //#define TASK_PRIORITY_SMIQ 10
234 #define TASK_PRIORITY_WTDG 20
211 #define TASK_PRIORITY_WTDG 20
235 #define TASK_PRIORITY_HOUS 30
212 #define TASK_PRIORITY_HOUS 30
236 #define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together
213 #define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together
@@ -242,8 +219,9 typedef struct {
242 #define TASK_PRIORITY_RECV 50
219 #define TASK_PRIORITY_RECV 50
243 #define TASK_PRIORITY_ACTN 50
220 #define TASK_PRIORITY_ACTN 50
244 #define TASK_PRIORITY_AVF0 60
221 #define TASK_PRIORITY_AVF0 60
245 #define TASK_PRIORITY_BPF0 60
246 #define TASK_PRIORITY_PRC0 100
222 #define TASK_PRIORITY_PRC0 100
223 #define TASK_PRIORITY_PRC1 100
224 #define TASK_PRIORITY_AVF1 60
247 #define TASK_PRIORITY_STAT 200
225 #define TASK_PRIORITY_STAT 200
248 #define TASK_PRIORITY_DUMB 200
226 #define TASK_PRIORITY_DUMB 200
249
227
@@ -251,7 +229,6 typedef struct {
251 #define MSG_QUEUE_COUNT_SEND 50
229 #define MSG_QUEUE_COUNT_SEND 50
252 #define MSG_QUEUE_COUNT_PRC0 10
230 #define MSG_QUEUE_COUNT_PRC0 10
253 #define MSG_QUEUE_COUNT_PRC1 10
231 #define MSG_QUEUE_COUNT_PRC1 10
254 //#define MSG_QUEUE_SIZE_SEND (PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES)
255 #define MSG_QUEUE_SIZE_SEND 810 // 806 + 4 => TM_LFR_SCIENCE_BURST_BP2_F1
232 #define MSG_QUEUE_SIZE_SEND 810 // 806 + 4 => TM_LFR_SCIENCE_BURST_BP2_F1
256 #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options
233 #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options
257 #define MSG_QUEUE_SIZE_PRC0 20 // two pointers and one rtems_event + 2 integers
234 #define MSG_QUEUE_SIZE_PRC0 20 // two pointers and one rtems_event + 2 integers
@@ -10,10 +10,12
10 #define TOTAL_SIZE_SBM1_BP1_F0 198 // 22 * 9 = 198
10 #define TOTAL_SIZE_SBM1_BP1_F0 198 // 22 * 9 = 198
11 //
11 //
12 #define NB_RING_NODES_SM_F0 12 // AT LEAST 3
12 #define NB_RING_NODES_SM_F0 12 // AT LEAST 3
13 #define NB_RING_NODES_ASM_BURST_SBM_F0 10 // AT LEAST 3
14 #define NB_RING_NODES_ASM_NORM_F0 10 // AT LEAST 3
13 #define NB_RING_NODES_SM_F1 3 // AT LEAST 3
15 #define NB_RING_NODES_SM_F1 3 // AT LEAST 3
16 #define NB_RING_NODES_ASM_BURST_SBM_F1 5 // AT LEAST 3
17 #define NB_RING_NODES_ASM_NORM_F1 5 // AT LEAST 3
14 #define NB_RING_NODES_SM_F2 3 // AT LEAST 3
18 #define NB_RING_NODES_SM_F2 3 // AT LEAST 3
15 #define NB_RING_NODES_ASM_BURST_SBM_F0 10 // AT LEAST 3
16 #define NB_RING_NODES_ASM_NORM_F0 10 // AT LEAST 3
17 //
19 //
18 #define NB_BINS_PER_ASM_F0 88
20 #define NB_BINS_PER_ASM_F0 88
19 #define NB_BINS_PER_PKT_ASM_F0 44
21 #define NB_BINS_PER_PKT_ASM_F0 44
@@ -37,12 +39,15
37 #define NB_BINS_COMPRESSED_SM_F1 13
39 #define NB_BINS_COMPRESSED_SM_F1 13
38 #define NB_BINS_COMPRESSED_SM_F2 12
40 #define NB_BINS_COMPRESSED_SM_F2 12
39 #define NB_BINS_COMPRESSED_SM_SBM_F0 22
41 #define NB_BINS_COMPRESSED_SM_SBM_F0 22
40
42 #define NB_BINS_COMPRESSED_SM_SBM_F1 26
43 #define NB_BINS_COMPRESSED_SM_SBM_F2 24
41 //
44 //
42 #define NB_BINS_TO_AVERAGE_ASM_F0 8
45 #define NB_BINS_TO_AVERAGE_ASM_F0 8
43 #define NB_BINS_TO_AVERAGE_ASM_F1 8
46 #define NB_BINS_TO_AVERAGE_ASM_F1 8
44 #define NB_BINS_TO_AVERAGE_ASM_F2 8
47 #define NB_BINS_TO_AVERAGE_ASM_F2 8
45 #define NB_BINS_TO_AVERAGE_ASM_SBM_F0 4
48 #define NB_BINS_TO_AVERAGE_ASM_SBM_F0 4
49 #define NB_BINS_TO_AVERAGE_ASM_SBM_F1 4
50 #define NB_BINS_TO_AVERAGE_ASM_SBM_F2 4
46 //
51 //
47 #define TOTAL_SIZE_COMPRESSED_ASM_F0 275 // 11 * 25 WORDS
52 #define TOTAL_SIZE_COMPRESSED_ASM_F0 275 // 11 * 25 WORDS
48 #define TOTAL_SIZE_COMPRESSED_ASM_F1 325 // 13 * 25 WORDS
53 #define TOTAL_SIZE_COMPRESSED_ASM_F1 325 // 13 * 25 WORDS
@@ -23,7 +23,6 typedef struct ring_node_sm
23
23
24 typedef struct ring_node_asm
24 typedef struct ring_node_asm
25 {
25 {
26 struct ring_node_asm *previous;
27 struct ring_node_asm *next;
26 struct ring_node_asm *next;
28 float matrix[ TOTAL_SIZE_SM ];
27 float matrix[ TOTAL_SIZE_SM ];
29 unsigned int status;
28 unsigned int status;
@@ -50,7 +49,6 typedef struct asm_msg
50 unsigned int fineTime;
49 unsigned int fineTime;
51 } asm_msg;
50 } asm_msg;
52
51
53 extern nb_sm_t nb_sm;
54 extern nb_sm_before_bp_asm_f0 nb_sm_before_f0;
52 extern nb_sm_before_bp_asm_f0 nb_sm_before_f0;
55 extern nb_sm_before_bp_asm_f1 nb_sm_before_f1;
53 extern nb_sm_before_bp_asm_f1 nb_sm_before_f1;
56 extern nb_sm_before_bp_asm_f2 nb_sm_before_f2;
54 extern nb_sm_before_bp_asm_f2 nb_sm_before_f2;
@@ -75,16 +73,18 rtems_isr spectral_matrices_isr( rtems_v
75 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector );
73 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector );
76
74
77 // RTEMS TASKS
75 // RTEMS TASKS
78 rtems_task smiq_task( rtems_task_argument argument ); // added to test the spectral matrix simulator
79 rtems_task avf0_task( rtems_task_argument lfrRequestedMode );
76 rtems_task avf0_task( rtems_task_argument lfrRequestedMode );
80 rtems_task prc0_task( rtems_task_argument lfrRequestedMode );
77 rtems_task prc0_task( rtems_task_argument lfrRequestedMode );
78 rtems_task avf1_task( rtems_task_argument lfrRequestedMode );
79 rtems_task prc1_task( rtems_task_argument lfrRequestedMode );
81
80
82 //******************
81 //******************
83 // Spectral Matrices
82 // Spectral Matrices
84 void SM_init_rings( void );
83 void SM_init_rings( void );
85 void ASM_init_rings( void );
84 void ASM_init_rings( void );
85 void ASM_generic_init_ring(ring_node_asm *ring, unsigned char nbNodes );
86 void SM_reset_current_ring_nodes( void );
86 void SM_reset_current_ring_nodes( void );
87 void ASM_reset_current_ring_node( void );
87 void ASM_reset_current_ring_nodes( void );
88 void ASM_init_header( Header_TM_LFR_SCIENCE_ASM_t *header);
88 void ASM_init_header( Header_TM_LFR_SCIENCE_ASM_t *header);
89 void SM_average(float *averaged_spec_mat_f0, float *averaged_spec_mat_f1,
89 void SM_average(float *averaged_spec_mat_f0, float *averaged_spec_mat_f1,
90 ring_node_sm *ring_node_tab[],
90 ring_node_sm *ring_node_tab[],
@@ -9,7 +9,6
9 #include "tm_lfr_tc_exe.h"
9 #include "tm_lfr_tc_exe.h"
10 #include "fsw_misc.h"
10 #include "fsw_misc.h"
11
11
12 extern nb_sm_t nb_sm;
13 extern nb_sm_before_bp_asm_f0 nb_sm_before_f0;
12 extern nb_sm_before_bp_asm_f0 nb_sm_before_f0;
14 extern nb_sm_before_bp_asm_f1 nb_sm_before_f1;
13 extern nb_sm_before_bp_asm_f1 nb_sm_before_f1;
15 extern nb_sm_before_bp_asm_f2 nb_sm_before_f2;
14 extern nb_sm_before_bp_asm_f2 nb_sm_before_f2;
@@ -48,7 +48,6 char wf_cont_f3_light[ (NB_SAMPL
48 //***********************************
48 //***********************************
49 // SPECTRAL MATRICES GLOBAL VARIABLES
49 // SPECTRAL MATRICES GLOBAL VARIABLES
50
50
51 nb_sm_t nb_sm;
52 nb_sm_before_bp_asm_f0 nb_sm_before_f0;
51 nb_sm_before_bp_asm_f0 nb_sm_before_f0;
53 nb_sm_before_bp_asm_f1 nb_sm_before_f1;
52 nb_sm_before_bp_asm_f1 nb_sm_before_f1;
54 nb_sm_before_bp_asm_f2 nb_sm_before_f2;
53 nb_sm_before_bp_asm_f2 nb_sm_before_f2;
@@ -249,7 +249,6 void create_names( void ) // create all
249 Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' );
249 Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' );
250 Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' );
250 Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' );
251 Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' );
251 Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' );
252 Task_name[TASKID_SMIQ] = rtems_build_name( 'S', 'M', 'I', 'Q' );
253 Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' );
252 Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' );
254 Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' );
253 Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' );
255 Task_name[TASKID_SWBD] = rtems_build_name( 'S', 'W', 'B', 'D' );
254 Task_name[TASKID_SWBD] = rtems_build_name( 'S', 'W', 'B', 'D' );
@@ -262,6 +261,8 void create_names( void ) // create all
262 Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' );
261 Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' );
263 Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' );
262 Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' );
264 Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' );
263 Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' );
264 Task_name[TASKID_AVF1] = rtems_build_name( 'A', 'V', 'F', '1' );
265 Task_name[TASKID_PRC1] = rtems_build_name( 'P', 'R', 'C', '1' );
265
266
266 // rate monotonic period names
267 // rate monotonic period names
267 name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' );
268 name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' );
@@ -333,14 +334,6 int create_all_tasks( void ) // create a
333
334
334 //******************
335 //******************
335 // SPECTRAL MATRICES
336 // SPECTRAL MATRICES
336 if (status == RTEMS_SUCCESSFUL) // SMIQ
337 {
338 status = rtems_task_create(
339 Task_name[TASKID_SMIQ], TASK_PRIORITY_SMIQ, RTEMS_MINIMUM_STACK_SIZE,
340 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
341 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SMIQ]
342 );
343 }
344 if (status == RTEMS_SUCCESSFUL) // AVF0
337 if (status == RTEMS_SUCCESSFUL) // AVF0
345 {
338 {
346 status = rtems_task_create(
339 status = rtems_task_create(
@@ -349,7 +342,7 int create_all_tasks( void ) // create a
349 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0]
342 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0]
350 );
343 );
351 }
344 }
352 if (status == RTEMS_SUCCESSFUL) // MATR
345 if (status == RTEMS_SUCCESSFUL) // PRC0
353 {
346 {
354 status = rtems_task_create(
347 status = rtems_task_create(
355 Task_name[TASKID_PRC0], TASK_PRIORITY_PRC0, RTEMS_MINIMUM_STACK_SIZE * 2,
348 Task_name[TASKID_PRC0], TASK_PRIORITY_PRC0, RTEMS_MINIMUM_STACK_SIZE * 2,
@@ -357,6 +350,22 int create_all_tasks( void ) // create a
357 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC0]
350 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC0]
358 );
351 );
359 }
352 }
353 if (status == RTEMS_SUCCESSFUL) // AVF1
354 {
355 status = rtems_task_create(
356 Task_name[TASKID_AVF1], TASK_PRIORITY_AVF1, RTEMS_MINIMUM_STACK_SIZE,
357 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
358 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF1]
359 );
360 }
361 if (status == RTEMS_SUCCESSFUL) // PRC1
362 {
363 status = rtems_task_create(
364 Task_name[TASKID_PRC1], TASK_PRIORITY_PRC1, RTEMS_MINIMUM_STACK_SIZE * 2,
365 RTEMS_DEFAULT_MODES,
366 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC1]
367 );
368 }
360
369
361 //****************
370 //****************
362 // WAVEFORM PICKER
371 // WAVEFORM PICKER
@@ -492,29 +501,34 int start_all_tasks( void ) // start all
492
501
493 //******************
502 //******************
494 // SPECTRAL MATRICES
503 // SPECTRAL MATRICES
495 if (status == RTEMS_SUCCESSFUL) // SMIQ
496 {
497 status = rtems_task_start( Task_id[TASKID_SMIQ], smiq_task, 1 );
498 if (status!=RTEMS_SUCCESSFUL) {
499 BOOT_PRINTF("in INIT *** Error starting TASK_BPPR\n")
500 }
501 }
502
503 if (status == RTEMS_SUCCESSFUL) // AVF0
504 if (status == RTEMS_SUCCESSFUL) // AVF0
504 {
505 {
505 status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, 1 );
506 status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, LFR_MODE_STANDBY );
506 if (status!=RTEMS_SUCCESSFUL) {
507 if (status!=RTEMS_SUCCESSFUL) {
507 BOOT_PRINTF("in INIT *** Error starting TASK_AVF0\n")
508 BOOT_PRINTF("in INIT *** Error starting TASK_AVF0\n")
508 }
509 }
509 }
510 }
510
511 if (status == RTEMS_SUCCESSFUL) // PRC0
511 if (status == RTEMS_SUCCESSFUL) // PRC0
512 {
512 {
513 status = rtems_task_start( Task_id[TASKID_PRC0], prc0_task, 1 );
513 status = rtems_task_start( Task_id[TASKID_PRC0], prc0_task, LFR_MODE_STANDBY );
514 if (status!=RTEMS_SUCCESSFUL) {
514 if (status!=RTEMS_SUCCESSFUL) {
515 BOOT_PRINTF("in INIT *** Error starting TASK_PRC0\n")
515 BOOT_PRINTF("in INIT *** Error starting TASK_PRC0\n")
516 }
516 }
517 }
517 }
518 if (status == RTEMS_SUCCESSFUL) // AVF1
519 {
520 status = rtems_task_start( Task_id[TASKID_AVF1], avf1_task, LFR_MODE_STANDBY );
521 if (status!=RTEMS_SUCCESSFUL) {
522 BOOT_PRINTF("in INIT *** Error starting TASK_AVF1\n")
523 }
524 }
525 if (status == RTEMS_SUCCESSFUL) // PRC1
526 {
527 status = rtems_task_start( Task_id[TASKID_PRC1], prc1_task, LFR_MODE_STANDBY );
528 if (status!=RTEMS_SUCCESSFUL) {
529 BOOT_PRINTF("in INIT *** Error starting TASK_PRC1\n")
530 }
531 }
518
532
519 //****************
533 //****************
520 // WAVEFORM PICKER
534 // WAVEFORM PICKER
@@ -525,7 +539,6 int start_all_tasks( void ) // start all
525 BOOT_PRINTF("in INIT *** Error starting TASK_WFRM\n")
539 BOOT_PRINTF("in INIT *** Error starting TASK_WFRM\n")
526 }
540 }
527 }
541 }
528
529 if (status == RTEMS_SUCCESSFUL) // CWF3
542 if (status == RTEMS_SUCCESSFUL) // CWF3
530 {
543 {
531 status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 );
544 status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 );
@@ -533,7 +546,6 int start_all_tasks( void ) // start all
533 BOOT_PRINTF("in INIT *** Error starting TASK_CWF3\n")
546 BOOT_PRINTF("in INIT *** Error starting TASK_CWF3\n")
534 }
547 }
535 }
548 }
536
537 if (status == RTEMS_SUCCESSFUL) // CWF2
549 if (status == RTEMS_SUCCESSFUL) // CWF2
538 {
550 {
539 status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 );
551 status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 );
@@ -541,7 +553,6 int start_all_tasks( void ) // start all
541 BOOT_PRINTF("in INIT *** Error starting TASK_CWF2\n")
553 BOOT_PRINTF("in INIT *** Error starting TASK_CWF2\n")
542 }
554 }
543 }
555 }
544
545 if (status == RTEMS_SUCCESSFUL) // CWF1
556 if (status == RTEMS_SUCCESSFUL) // CWF1
546 {
557 {
547 status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 );
558 status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 );
@@ -549,7 +560,6 int start_all_tasks( void ) // start all
549 BOOT_PRINTF("in INIT *** Error starting TASK_CWF1\n")
560 BOOT_PRINTF("in INIT *** Error starting TASK_CWF1\n")
550 }
561 }
551 }
562 }
552
553 if (status == RTEMS_SUCCESSFUL) // SWBD
563 if (status == RTEMS_SUCCESSFUL) // SWBD
554 {
564 {
555 status = rtems_task_start( Task_id[TASKID_SWBD], swbd_task, 1 );
565 status = rtems_task_start( Task_id[TASKID_SWBD], swbd_task, 1 );
@@ -567,7 +577,6 int start_all_tasks( void ) // start all
567 BOOT_PRINTF("in INIT *** Error starting TASK_HOUS\n")
577 BOOT_PRINTF("in INIT *** Error starting TASK_HOUS\n")
568 }
578 }
569 }
579 }
570
571 if (status == RTEMS_SUCCESSFUL) // DUMB
580 if (status == RTEMS_SUCCESSFUL) // DUMB
572 {
581 {
573 status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 );
582 status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 );
@@ -575,7 +584,6 int start_all_tasks( void ) // start all
575 BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n")
584 BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n")
576 }
585 }
577 }
586 }
578
579 if (status == RTEMS_SUCCESSFUL) // STAT
587 if (status == RTEMS_SUCCESSFUL) // STAT
580 {
588 {
581 status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 );
589 status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 );
@@ -591,7 +599,8 rtems_status_code create_message_queues(
591 {
599 {
592 rtems_status_code status_recv;
600 rtems_status_code status_recv;
593 rtems_status_code status_send;
601 rtems_status_code status_send;
594 rtems_status_code status_matr;
602 rtems_status_code status_q_p0;
603 rtems_status_code status_q_p1;
595 rtems_status_code ret;
604 rtems_status_code ret;
596 rtems_id queue_id;
605 rtems_id queue_id;
597
606
@@ -615,21 +624,21 rtems_status_code create_message_queues(
615
624
616 //*****************************************************************************
625 //*****************************************************************************
617 // create the queue for handling averaged spectral matrices for processing @ f0
626 // create the queue for handling averaged spectral matrices for processing @ f0
618 status_matr = rtems_message_queue_create( misc_name[QUEUE_PRC0],
627 status_q_p0 = rtems_message_queue_create( misc_name[QUEUE_PRC0],
619 MSG_QUEUE_COUNT_PRC0, MSG_QUEUE_SIZE_PRC0,
628 MSG_QUEUE_COUNT_PRC0, MSG_QUEUE_SIZE_PRC0,
620 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
629 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
621 if ( status_send != RTEMS_SUCCESSFUL ) {
630 if ( status_q_p0 != RTEMS_SUCCESSFUL ) {
622 PRINTF1("in create_message_queues *** ERR creating PR_0 queue, %d\n", status_matr)
631 PRINTF1("in create_message_queues *** ERR creating Q_P0 queue, %d\n", status_q_p0)
623 }
632 }
624
633
625 //*****************************************************************************
634 //*****************************************************************************
626 // create the queue for handling averaged spectral matrices for processing @ f1
635 // create the queue for handling averaged spectral matrices for processing @ f1
627 // status_matr = rtems_message_queue_create( misc_name[QUEUE_PRC1],
636 status_q_p1 = rtems_message_queue_create( misc_name[QUEUE_PRC1],
628 // MSG_QUEUE_COUNT_PRC1, MSG_QUEUE_SIZE_PRC1,
637 MSG_QUEUE_COUNT_PRC1, MSG_QUEUE_SIZE_PRC1,
629 // RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
638 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
630 // if ( status_send != RTEMS_SUCCESSFUL ) {
639 if ( status_q_p1 != RTEMS_SUCCESSFUL ) {
631 // PRINTF1("in create_message_queues *** ERR creating PR_1 queue, %d\n", status_matr)
640 PRINTF1("in create_message_queues *** ERR creating Q_P1 queue, %d\n", status_q_p1)
632 // }
641 }
633
642
634 if ( status_recv != RTEMS_SUCCESSFUL )
643 if ( status_recv != RTEMS_SUCCESSFUL )
635 {
644 {
@@ -639,9 +648,13 rtems_status_code create_message_queues(
639 {
648 {
640 ret = status_send;
649 ret = status_send;
641 }
650 }
651 else if( status_q_p0 != RTEMS_SUCCESSFUL )
652 {
653 ret = status_q_p0;
654 }
642 else
655 else
643 {
656 {
644 ret = status_matr;
657 ret = status_q_p1;
645 }
658 }
646
659
647 return ret;
660 return ret;
This diff has been collapsed as it changes many lines, (684 lines changed) Show them Hide them
@@ -11,6 +11,8
11
11
12 #include "fsw_processing_globals.c"
12 #include "fsw_processing_globals.c"
13
13
14 unsigned int nb_sm_f0;
15
14 //************************
16 //************************
15 // spectral matrices rings
17 // spectral matrices rings
16 ring_node_sm sm_ring_f0[ NB_RING_NODES_SM_F0 ];
18 ring_node_sm sm_ring_f0[ NB_RING_NODES_SM_F0 ];
@@ -22,14 +24,15 ring_node_sm *current_ring_node_sm_f2;
22 ring_node_sm *ring_node_for_averaging_sm_f0;
24 ring_node_sm *ring_node_for_averaging_sm_f0;
23 ring_node_sm *ring_node_for_averaging_sm_f1;
25 ring_node_sm *ring_node_for_averaging_sm_f1;
24
26
27 ring_node_asm asm_ring_norm_f0 [ NB_RING_NODES_ASM_NORM_F0 ];
25 ring_node_asm asm_ring_burst_sbm_f0[ NB_RING_NODES_ASM_BURST_SBM_F0 ];
28 ring_node_asm asm_ring_burst_sbm_f0[ NB_RING_NODES_ASM_BURST_SBM_F0 ];
26 ring_node_asm asm_ring_norm_f0 [ NB_RING_NODES_ASM_BURST_SBM_F0 ];
29 ring_node_asm asm_ring_norm_f1 [ NB_RING_NODES_ASM_NORM_F1 ];
30 ring_node_asm asm_ring_burst_sbm_f1[ NB_RING_NODES_ASM_BURST_SBM_F1 ];
27 ring_node_asm *current_ring_node_asm_burst_sbm_f0;
31 ring_node_asm *current_ring_node_asm_burst_sbm_f0;
32 ring_node_asm *current_ring_node_asm_norm_f0;
28 ring_node_asm *current_ring_node_asm_burst_sbm_f1;
33 ring_node_asm *current_ring_node_asm_burst_sbm_f1;
29 ring_node_asm *current_ring_node_asm_norm_f0;
30 ring_node_asm *current_ring_node_asm_norm_f1;
34 ring_node_asm *current_ring_node_asm_norm_f1;
31
35
32 float asm_norm_f0 [ TOTAL_SIZE_SM ];
33 float asm_f0_reorganized [ TOTAL_SIZE_SM ];
36 float asm_f0_reorganized [ TOTAL_SIZE_SM ];
34 char asm_f0_char [ TIME_OFFSET_IN_BYTES + (TOTAL_SIZE_SM * 2) ];
37 char asm_f0_char [ TIME_OFFSET_IN_BYTES + (TOTAL_SIZE_SM * 2) ];
35 float compressed_sm_norm_f0[ TOTAL_SIZE_COMPRESSED_ASM_F0 ];
38 float compressed_sm_norm_f0[ TOTAL_SIZE_COMPRESSED_ASM_F0 ];
@@ -37,14 +40,10 float compressed_sm_sbm [ TOTAL_SIZE_
37
40
38 //***********************************************************
41 //***********************************************************
39 // Interrupt Service Routine for spectral matrices processing
42 // Interrupt Service Routine for spectral matrices processing
43
40 void reset_nb_sm_f0( unsigned char lfrMode )
44 void reset_nb_sm_f0( unsigned char lfrMode )
41 {
45 {
42 nb_sm.f0 = 0;
46 nb_sm_f0 = 0;
43 nb_sm.norm_bp1_f0 = 0;
44 nb_sm.norm_bp2_f0 = 0;
45 nb_sm.norm_asm_f0 = 0;
46 nb_sm.sbm_bp1_f0 = 0;
47 nb_sm.sbm_bp2_f0 = 0;
48
47
49 nb_sm_before_f0.norm_bp1_f0 = parameter_dump_packet.sy_lfr_n_bp_p0 * 96;
48 nb_sm_before_f0.norm_bp1_f0 = parameter_dump_packet.sy_lfr_n_bp_p0 * 96;
50 nb_sm_before_f0.norm_bp2_f0 = parameter_dump_packet.sy_lfr_n_bp_p1 * 96;
49 nb_sm_before_f0.norm_bp2_f0 = parameter_dump_packet.sy_lfr_n_bp_p1 * 96;
@@ -80,47 +79,33 void reset_nb_sm_f0( unsigned char lfrMo
80
79
81 void reset_nb_sm_f1( unsigned char lfrMode )
80 void reset_nb_sm_f1( unsigned char lfrMode )
82 {
81 {
83 nb_sm.f1 = 0;
82 nb_sm_before_f1.norm_bp1 = parameter_dump_packet.sy_lfr_n_bp_p0 * 16;
84 nb_sm.norm_bp1_f1 = 0;
83 nb_sm_before_f1.norm_bp2 = parameter_dump_packet.sy_lfr_n_bp_p1 * 16;
85 nb_sm.norm_bp2_f1 = 0;
84 nb_sm_before_f1.norm_asm = (parameter_dump_packet.sy_lfr_n_asm_p[0] * 256 + parameter_dump_packet.sy_lfr_n_asm_p[1]) * 16;
86 nb_sm.norm_asm_f1 = 0;
85 nb_sm_before_f1.sbm2_bp1 = parameter_dump_packet.sy_lfr_s2_bp_p0 * 16;
87 nb_sm.sbm_bp1_f1 = 0;
86 nb_sm_before_f1.sbm2_bp2 = parameter_dump_packet.sy_lfr_s2_bp_p1 * 16;
88 nb_sm.sbm_bp2_f1 = 0;
87 nb_sm_before_f1.burst_bp1 = parameter_dump_packet.sy_lfr_b_bp_p0 * 16;
89
88 nb_sm_before_f1.burst_bp2 = parameter_dump_packet.sy_lfr_b_bp_p1 * 16;
90 nb_sm_before_f1.norm_bp1_f1 = parameter_dump_packet.sy_lfr_n_bp_p0 * 16;
91 nb_sm_before_f1.norm_bp2_f1 = parameter_dump_packet.sy_lfr_n_bp_p1 * 16;
92 nb_sm_before_f1.norm_asm_f1 = (parameter_dump_packet.sy_lfr_n_asm_p[0] * 256 + parameter_dump_packet.sy_lfr_n_asm_p[1]) * 16;
93 nb_sm_before_f1.sbm2_bp1_f1 = parameter_dump_packet.sy_lfr_s2_bp_p0 * 16;
94 nb_sm_before_f1.sbm2_bp2_f1 = parameter_dump_packet.sy_lfr_s2_bp_p1 * 16;
95 nb_sm_before_f1.burst_bp1_f1 = parameter_dump_packet.sy_lfr_b_bp_p0 * 16;
96 nb_sm_before_f1.burst_bp2_f1 = parameter_dump_packet.sy_lfr_b_bp_p1 * 16;
97
89
98 if (lfrMode == LFR_MODE_SBM2)
90 if (lfrMode == LFR_MODE_SBM2)
99 {
91 {
100 nb_sm_before_f1.burst_sbm_bp1_f1 = nb_sm_before_f1.sbm2_bp1_f1;
92 nb_sm_before_f1.burst_sbm_bp1 = nb_sm_before_f1.sbm2_bp1;
101 nb_sm_before_f1.burst_sbm_bp2_f1 = nb_sm_before_f1.sbm2_bp2_f1;
93 nb_sm_before_f1.burst_sbm_bp2 = nb_sm_before_f1.sbm2_bp2;
102 }
94 }
103 else if (lfrMode == LFR_MODE_BURST)
95 else if (lfrMode == LFR_MODE_BURST)
104 {
96 {
105 nb_sm_before_f1.burst_sbm_bp1_f1 = nb_sm_before_f1.burst_bp1_f1;
97 nb_sm_before_f1.burst_sbm_bp1 = nb_sm_before_f1.burst_bp1;
106 nb_sm_before_f1.burst_sbm_bp2_f1 = nb_sm_before_f1.burst_bp2_f1;
98 nb_sm_before_f1.burst_sbm_bp2 = nb_sm_before_f1.burst_bp2;
107 }
99 }
108 else
100 else
109 {
101 {
110 nb_sm_before_f1.burst_sbm_bp1_f1 = nb_sm_before_f1.burst_bp1_f1;
102 nb_sm_before_f1.burst_sbm_bp1 = nb_sm_before_f1.burst_bp1;
111 nb_sm_before_f1.burst_sbm_bp2_f1 = nb_sm_before_f1.burst_bp2_f1;
103 nb_sm_before_f1.burst_sbm_bp2 = nb_sm_before_f1.burst_bp2;
112 }
104 }
113 }
105 }
114
106
115 void reset_nb_sm_f2( unsigned char lfrMode )
107 void reset_nb_sm_f2( unsigned char lfrMode )
116 {
108 {
117 nb_sm.f2 = 0;
118 nb_sm.norm_bp1_f2 = 0;
119 nb_sm.norm_bp2_f2 = 0;
120 nb_sm.norm_asm_f2 = 0;
121 nb_sm.sbm_bp1_f2 = 0;
122 nb_sm.sbm_bp2_f2 = 0;
123
124 nb_sm_before_f2.norm_bp1_f2 = parameter_dump_packet.sy_lfr_n_bp_p0;
109 nb_sm_before_f2.norm_bp1_f2 = parameter_dump_packet.sy_lfr_n_bp_p0;
125 nb_sm_before_f2.norm_bp2_f2 = parameter_dump_packet.sy_lfr_n_bp_p1;
110 nb_sm_before_f2.norm_bp2_f2 = parameter_dump_packet.sy_lfr_n_bp_p1;
126 nb_sm_before_f2.norm_asm_f2 = parameter_dump_packet.sy_lfr_n_asm_p[0] * 256 + parameter_dump_packet.sy_lfr_n_asm_p[1];
111 nb_sm_before_f2.norm_asm_f2 = parameter_dump_packet.sy_lfr_n_asm_p[0] * 256 + parameter_dump_packet.sy_lfr_n_asm_p[1];
@@ -159,7 +144,7 rtems_isr spectral_matrices_isr( rtems_v
159 current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
144 current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
160 spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address;
145 spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address;
161 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd; // 1101
146 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd; // 1101
162 nb_sm.f0 = nb_sm.f0 + 1;
147 nb_sm_f0 = nb_sm_f0 + 1;
163 }
148 }
164
149
165 //************************
150 //************************
@@ -174,48 +159,40 rtems_isr spectral_matrices_isr( rtems_v
174 // reset ready matrix bits for f0_0, f1 and f2
159 // reset ready matrix bits for f0_0, f1 and f2
175 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff2; // 0010
160 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff2; // 0010
176
161
177 if (nb_sm.f0 == NB_SM_BEFORE_AVF0)
162 if (nb_sm_f0 == NB_SM_BEFORE_AVF0)
178 {
163 {
179 ring_node_for_averaging_sm_f0 = previous_ring_node_sm_f0;
164 ring_node_for_averaging_sm_f0 = previous_ring_node_sm_f0;
180 if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
165 if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
181 {
166 {
182 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
167 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
183 }
168 }
184 nb_sm.f0 = 0;
169 nb_sm_f0 = 0;
185 }
170 }
186
171
187 }
172 }
188
173
189 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector )
174 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector )
190 {
175 {
191 if (nb_sm.f0 == (NB_SM_BEFORE_AVF0-1) )
176 if (nb_sm_f0 == (NB_SM_BEFORE_AVF0-1) )
192 {
177 {
193 ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0;
178 ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0;
194 if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
179 if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
195 {
180 {
196 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
181 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
197 }
182 }
198 nb_sm.f0 = 0;
183 nb_sm_f0 = 0;
199 }
184 }
200 else
185 else
201 {
186 {
202 nb_sm.f0 = nb_sm.f0 + 1;
187 nb_sm_f0 = nb_sm_f0 + 1;
203 }
188 }
204 }
189 }
205
190
206 //************
191 //************
207 // RTEMS TASKS
192 // RTEMS TASKS
208
193
209 rtems_task smiq_task( rtems_task_argument argument ) // process the Spectral Matrices IRQ
194 //*****************
210 {
195 // PROCESSING AT F0
211 rtems_event_set event_out;
212
213 BOOT_PRINTF("in SMIQ *** \n")
214
215 while(1){
216 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
217 }
218 }
219
196
220 rtems_task avf0_task( rtems_task_argument lfrRequestedMode )
197 rtems_task avf0_task( rtems_task_argument lfrRequestedMode )
221 {
198 {
@@ -227,9 +204,21 rtems_task avf0_task( rtems_task_argumen
227 asm_msg msgForMATR;
204 asm_msg msgForMATR;
228 ring_node_sm *ring_node_tab[8];
205 ring_node_sm *ring_node_tab[8];
229
206
207 static unsigned int nb_norm_bp1;
208 static unsigned int nb_norm_bp2;
209 static unsigned int nb_norm_asm;
210 static unsigned int nb_sbm_bp1;
211 static unsigned int nb_sbm_bp2;
212
213 nb_norm_bp1 = 0;
214 nb_norm_bp2 = 0;
215 nb_norm_asm = 0;
216 nb_sbm_bp1 = 0;
217 nb_sbm_bp2 = 0;
218
230 reset_nb_sm_f0( lfrRequestedMode ); // reset the sm counters that drive the BP and ASM computations / transmissions
219 reset_nb_sm_f0( lfrRequestedMode ); // reset the sm counters that drive the BP and ASM computations / transmissions
231
220
232 BOOT_PRINTF1("in AVFO *** lfrRequestedMode = %d\n", lfrRequestedMode)
221 BOOT_PRINTF1("in AVFO *** lfrRequestedMode = %d\n", (int) lfrRequestedMode)
233
222
234 status = get_message_queue_id_prc0( &queue_id_prc0 );
223 status = get_message_queue_id_prc0( &queue_id_prc0 );
235 if (status != RTEMS_SUCCESSFUL)
224 if (status != RTEMS_SUCCESSFUL)
@@ -250,14 +239,14 rtems_task avf0_task( rtems_task_argumen
250 SM_average( current_ring_node_asm_norm_f0->matrix,
239 SM_average( current_ring_node_asm_norm_f0->matrix,
251 current_ring_node_asm_burst_sbm_f0->matrix,
240 current_ring_node_asm_burst_sbm_f0->matrix,
252 ring_node_tab,
241 ring_node_tab,
253 nb_sm.norm_bp1_f0, nb_sm.sbm_bp1_f0 );
242 nb_norm_bp1, nb_sbm_bp1 );
254
243
255 // update nb_average
244 // update nb_average
256 nb_sm.norm_bp1_f0 = nb_sm.norm_bp1_f0 + NB_SM_BEFORE_AVF0;
245 nb_norm_bp1 = nb_norm_bp1 + NB_SM_BEFORE_AVF0;
257 nb_sm.norm_bp2_f0 = nb_sm.norm_bp2_f0 + NB_SM_BEFORE_AVF0;
246 nb_norm_bp2 = nb_norm_bp2 + NB_SM_BEFORE_AVF0;
258 nb_sm.norm_asm_f0 = nb_sm.norm_asm_f0 + NB_SM_BEFORE_AVF0;
247 nb_norm_asm = nb_norm_asm + NB_SM_BEFORE_AVF0;
259 nb_sm.sbm_bp1_f0 = nb_sm.sbm_bp1_f0 + NB_SM_BEFORE_AVF0;
248 nb_sbm_bp1 = nb_sbm_bp1 + NB_SM_BEFORE_AVF0;
260 nb_sm.sbm_bp2_f0 = nb_sm.sbm_bp2_f0 + NB_SM_BEFORE_AVF0;
249 nb_sbm_bp2 = nb_sbm_bp2 + NB_SM_BEFORE_AVF0;
261
250
262 //****************************************
251 //****************************************
263 // initialize the mesage for the MATR task
252 // initialize the mesage for the MATR task
@@ -267,9 +256,9 rtems_task avf0_task( rtems_task_argumen
267 msgForMATR.coarseTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[0];
256 msgForMATR.coarseTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[0];
268 msgForMATR.fineTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[1];
257 msgForMATR.fineTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[1];
269
258
270 if (nb_sm.sbm_bp1_f0 == nb_sm_before_f0.burst_sbm_bp1_f0)
259 if (nb_sbm_bp1 == nb_sm_before_f0.burst_sbm_bp1_f0)
271 {
260 {
272 nb_sm.sbm_bp1_f0 = 0;
261 nb_sbm_bp1 = 0;
273 // set another ring for the ASM storage
262 // set another ring for the ASM storage
274 current_ring_node_asm_burst_sbm_f0 = current_ring_node_asm_burst_sbm_f0->next;
263 current_ring_node_asm_burst_sbm_f0 = current_ring_node_asm_burst_sbm_f0->next;
275 if ( (lfrCurrentMode == LFR_MODE_BURST)
264 if ( (lfrCurrentMode == LFR_MODE_BURST)
@@ -279,9 +268,9 rtems_task avf0_task( rtems_task_argumen
279 }
268 }
280 }
269 }
281
270
282 if (nb_sm.sbm_bp2_f0 == nb_sm_before_f0.burst_sbm_bp2_f0)
271 if (nb_sbm_bp2 == nb_sm_before_f0.burst_sbm_bp2_f0)
283 {
272 {
284 nb_sm.sbm_bp2_f0 = 0;
273 nb_sbm_bp2 = 0;
285 if ( (lfrCurrentMode == LFR_MODE_BURST)
274 if ( (lfrCurrentMode == LFR_MODE_BURST)
286 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
275 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
287 {
276 {
@@ -289,9 +278,9 rtems_task avf0_task( rtems_task_argumen
289 }
278 }
290 }
279 }
291
280
292 if (nb_sm.norm_bp1_f0 == nb_sm_before_f0.norm_bp1_f0)
281 if (nb_norm_bp1 == nb_sm_before_f0.norm_bp1_f0)
293 {
282 {
294 nb_sm.norm_bp1_f0 = 0;
283 nb_norm_bp1 = 0;
295 // set another ring for the ASM storage
284 // set another ring for the ASM storage
296 current_ring_node_asm_norm_f0 = current_ring_node_asm_norm_f0->next;
285 current_ring_node_asm_norm_f0 = current_ring_node_asm_norm_f0->next;
297 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
286 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
@@ -301,9 +290,9 rtems_task avf0_task( rtems_task_argumen
301 }
290 }
302 }
291 }
303
292
304 if (nb_sm.norm_bp2_f0 == nb_sm_before_f0.norm_bp2_f0)
293 if (nb_norm_bp2 == nb_sm_before_f0.norm_bp2_f0)
305 {
294 {
306 nb_sm.norm_bp2_f0 = 0;
295 nb_norm_bp2 = 0;
307 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
296 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
308 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
297 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
309 {
298 {
@@ -311,9 +300,9 rtems_task avf0_task( rtems_task_argumen
311 }
300 }
312 }
301 }
313
302
314 if (nb_sm.norm_asm_f0 == nb_sm_before_f0.norm_asm_f0)
303 if (nb_norm_asm == nb_sm_before_f0.norm_asm_f0)
315 {
304 {
316 nb_sm.norm_asm_f0 = 0;
305 nb_norm_asm = 0;
317 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
306 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
318 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
307 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
319 {
308 {
@@ -326,7 +315,7 rtems_task avf0_task( rtems_task_argumen
326 // send the message to MATR
315 // send the message to MATR
327 if (msgForMATR.event != 0x00)
316 if (msgForMATR.event != 0x00)
328 {
317 {
329 status = rtems_message_queue_send( queue_id_prc0, (char *) & msgForMATR, MSG_QUEUE_SIZE_PRC0);
318 status = rtems_message_queue_send( queue_id_prc0, (char *) &msgForMATR, MSG_QUEUE_SIZE_PRC0);
330 }
319 }
331
320
332 if (status != RTEMS_SUCCESSFUL) {
321 if (status != RTEMS_SUCCESSFUL) {
@@ -337,166 +326,168 rtems_task avf0_task( rtems_task_argumen
337
326
338 rtems_task prc0_task( rtems_task_argument lfrRequestedMode )
327 rtems_task prc0_task( rtems_task_argument lfrRequestedMode )
339 {
328 {
340 // char incomingData[MSG_QUEUE_SIZE_SEND]; // incoming data buffer
329 char incomingData[MSG_QUEUE_SIZE_SEND]; // incoming data buffer
341 // size_t size; // size of the incoming TC packet
330 size_t size; // size of the incoming TC packet
342 // asm_msg *incomingMsg;
331 asm_msg *incomingMsg;
343 // //
332 //
344 // spw_ioctl_pkt_send spw_ioctl_send_ASM;
333 spw_ioctl_pkt_send spw_ioctl_send_ASM;
345 // rtems_status_code status;
334 rtems_status_code status;
346 // rtems_id queue_id;
335 rtems_id queue_id;
347 // rtems_id queue_id_matr;
336 rtems_id queue_id_q_p0;
348 // Header_TM_LFR_SCIENCE_ASM_t headerASM;
337 Header_TM_LFR_SCIENCE_ASM_t headerASM;
349 // bp_packet_with_spare current_node_norm_bp1_f0;
338 bp_packet_with_spare packet_norm_bp1_f0;
350 // bp_packet current_node_norm_bp2_f0;
339 bp_packet packet_norm_bp2_f0;
351 // bp_packet current_node_sbm_bp1_f0;
340 bp_packet packet_sbm_bp1_f0;
352 // bp_packet current_node_sbm_bp2_f0;
341 bp_packet packet_sbm_bp2_f0;
353
342
354 // unsigned long long int localTime;
343 unsigned long long int localTime;
355
344
356 // ASM_init_header( &headerASM );
345 ASM_init_header( &headerASM );
357
346
358 // //*************
347 //*************
359 // // NORM headers
348 // NORM headers
360 // BP_init_header_with_spare( &current_node_norm_bp1_f0.header,
349 BP_init_header_with_spare( &packet_norm_bp1_f0.header,
361 // APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F0,
350 APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F0,
362 // PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0, NB_BINS_COMPRESSED_SM_F0 );
351 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0, NB_BINS_COMPRESSED_SM_F0 );
363 // BP_init_header( &current_node_norm_bp2_f0.header,
352 BP_init_header( &packet_norm_bp2_f0.header,
364 // APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP2_F0,
353 APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP2_F0,
365 // PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0, NB_BINS_COMPRESSED_SM_F0);
354 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0, NB_BINS_COMPRESSED_SM_F0);
366
355
367 // //****************************
356 //****************************
368 // // BURST SBM1 and SBM2 headers
357 // BURST SBM1 and SBM2 headers
369 // if ( (lfrRequestedMode == LFR_MODE_BURST)
358 if ( lfrRequestedMode == LFR_MODE_BURST )
370 // || (lfrRequestedMode == LFR_MODE_NORMAL) || (lfrRequestedMode == LFR_MODE_STANDBY) )
359 {
371 // {
360 BP_init_header( &packet_sbm_bp1_f0.header,
372 // BP_init_header( &current_node_sbm_bp1_f0.header,
361 APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP1_F0,
373 // APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP1_F0,
362 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
374 // PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
363 BP_init_header( &packet_sbm_bp2_f0.header,
375 // BP_init_header( &current_node_sbm_bp2_f0.header,
364 APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP2_F0,
376 // APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP2_F0,
365 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
377 // PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
366 }
378 // }
367 else if ( lfrRequestedMode == LFR_MODE_SBM1 )
379 // else if ( lfrRequestedMode == LFR_MODE_SBM1 )
368 {
380 // {
369 BP_init_header( &packet_sbm_bp1_f0.header,
381 // BP_init_header( &current_node_sbm_bp1_f0.header,
370 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP1_F0,
382 // APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP1_F0,
371 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
383 // PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
372 BP_init_header( &packet_sbm_bp2_f0.header,
384 // BP_init_header( &current_node_sbm_bp2_f0.header,
373 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP2_F0,
385 // APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP2_F0,
374 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
386 // PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
375 }
387 // }
376 else if ( lfrRequestedMode == LFR_MODE_SBM2 )
388 // else if ( lfrRequestedMode == LFR_MODE_SBM2 )
377 {
389 // {
378 BP_init_header( &packet_sbm_bp1_f0.header,
390 // BP_init_header( &current_node_sbm_bp1_f0.header,
379 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP1_F0,
391 // APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP1_F0,
380 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
392 // PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
381 BP_init_header( &packet_sbm_bp2_f0.header,
393 // BP_init_header( &current_node_sbm_bp2_f0.header,
382 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP2_F0,
394 // APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP2_F0,
383 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
395 // PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
384 }
396 // }
385 else
397 // else
386 {
398 // {
387 PRINTF1("in PRC0 *** lfrRequestedMode is %d, several headers not initialized\n", (unsigned int) lfrRequestedMode)
399 // PRINTF1("ERR *** in MATR *** unexpected lfrRequestedMode passed as argument = %d\n", (unsigned int) lfrRequestedMode)
388 }
400 // }
401
389
402 // status = get_message_queue_id_send( &queue_id );
390 status = get_message_queue_id_send( &queue_id );
403 // if (status != RTEMS_SUCCESSFUL)
391 if (status != RTEMS_SUCCESSFUL)
404 // {
392 {
405 // PRINTF1("in MATR *** ERR get_message_queue_id_send %d\n", status)
393 PRINTF1("in PRC0 *** ERR get_message_queue_id_send %d\n", status)
406 // }
394 }
407 // status = get_message_queue_id_prc0( &queue_id_matr);
395 status = get_message_queue_id_prc0( &queue_id_q_p0);
408 // if (status != RTEMS_SUCCESSFUL)
396 if (status != RTEMS_SUCCESSFUL)
409 // {
397 {
410 // PRINTF1("in MATR *** ERR get_message_queue_id_prc0 %d\n", status)
398 PRINTF1("in PRC0 *** ERR get_message_queue_id_prc0 %d\n", status)
411 // }
399 }
412
400
413 // BOOT_PRINTF1("in PRC0 *** lfrRequestedMode = %d\n", lfrRequestedMode)
401 BOOT_PRINTF1("in PRC0 *** lfrRequestedMode = %d\n", (int) lfrRequestedMode)
414
402
415 // while(1){
403 while(1){
416 // status = rtems_message_queue_receive( queue_id_matr, incomingData, &size, //************************************
404 status = rtems_message_queue_receive( queue_id_q_p0, incomingData, &size, //************************************
417 // RTEMS_WAIT, RTEMS_NO_TIMEOUT ); // wait for a message coming from AVF0
405 RTEMS_WAIT, RTEMS_NO_TIMEOUT ); // wait for a message coming from AVF0
406
407 incomingMsg = (asm_msg*) incomingData;
418
408
419 // incomingMsg = (asm_msg*) incomingData;
409 localTime = getTimeAsUnsignedLongLongInt( );
420
410 //****************
421 // localTime = getTimeAsUnsignedLongLongInt( );
411 //****************
422 // //****************
412 // BURST SBM1 SBM2
423 // //****************
413 //****************
424 // // BURST SBM1 SBM2
414 //****************
425 // //****************
415 if (incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP1_F0 )
426 // //****************
416 {
427 // if (incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP1_F0 )
417 // 1) compress the matrix for Basic Parameters calculation
428 // {
418 ASM_compress_reorganize_and_divide( incomingMsg->burst_sbm->matrix, compressed_sm_sbm,
429 // // 1) compress the matrix for Basic Parameters calculation
419 nb_sm_before_f0.burst_sbm_bp1_f0,
430 // ASM_compress_reorganize_and_divide( incomingMsg->burst_sbm->matrix, compressed_sm_sbm,
420 NB_BINS_COMPRESSED_SM_SBM_F0, NB_BINS_TO_AVERAGE_ASM_SBM_F0,
431 // nb_sm_before_f0.burst_sbm_bp1_f0,
421 ASM_F0_INDICE_START);
432 // NB_BINS_COMPRESSED_SM_SBM_F0, NB_BINS_TO_AVERAGE_ASM_SBM_F0,
422 // 2) compute the BP1 set
433 // ASM_F0_INDICE_START);
434 // // 2) compute the BP1 set
435
423
436 // // 3) send the BP1 set
424 // 3) send the BP1 set
437 // set_time( current_node_sbm_bp1_f0.header.time, (unsigned char *) &incomingMsg->coarseTime );
425 set_time( packet_sbm_bp1_f0.header.time, (unsigned char *) &incomingMsg->coarseTime );
438 // set_time( current_node_sbm_bp1_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
426 set_time( packet_sbm_bp1_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
439 // BP_send( (char *) &current_node_sbm_bp1_f0.header, queue_id,
427 BP_send( (char *) &packet_sbm_bp1_f0.header, queue_id,
440 // PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0 + PACKET_LENGTH_DELTA);
428 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0 + PACKET_LENGTH_DELTA);
441 // // 4) compute the BP2 set if needed
429 // 4) compute the BP2 set if needed
442 // if ( incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP2_F0 )
430 if ( incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP2_F0 )
443 // {
431 {
444 // // 1) compute the BP2 set
432 // 1) compute the BP2 set
445
433
446 // // 2) send the BP2 set
434 // 2) send the BP2 set
447 // set_time( current_node_sbm_bp2_f0.header.time, (unsigned char *) &incomingMsg->coarseTime );
435 set_time( packet_sbm_bp2_f0.header.time, (unsigned char *) &incomingMsg->coarseTime );
448 // set_time( current_node_sbm_bp2_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
436 set_time( packet_sbm_bp2_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
449 // BP_send( (char *) &current_node_sbm_bp2_f0.header, queue_id,
437 BP_send( (char *) &packet_sbm_bp2_f0.header, queue_id,
450 // PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0 + PACKET_LENGTH_DELTA);
438 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0 + PACKET_LENGTH_DELTA);
451 // }
439 }
452 // }
440 }
453
441
454 // //*****
442 //*****
455 // //*****
443 //*****
456 // // NORM
444 // NORM
457 // //*****
445 //*****
458 // //*****
446 //*****
459 // if (incomingMsg->event & RTEMS_EVENT_NORM_BP1_F0)
447 if (incomingMsg->event & RTEMS_EVENT_NORM_BP1_F0)
460 // {
448 {
461 // // 1) compress the matrix for Basic Parameters calculation
449 // 1) compress the matrix for Basic Parameters calculation
462 // ASM_compress_reorganize_and_divide( incomingMsg->norm->matrix, compressed_sm_norm_f0,
450 ASM_compress_reorganize_and_divide( incomingMsg->norm->matrix, compressed_sm_norm_f0,
463 // nb_sm_before_f0.norm_bp1_f0,
451 nb_sm_before_f0.norm_bp1_f0,
464 // NB_BINS_COMPRESSED_SM_F0, NB_BINS_TO_AVERAGE_ASM_F0,
452 NB_BINS_COMPRESSED_SM_F0, NB_BINS_TO_AVERAGE_ASM_F0,
465 // ASM_F0_INDICE_START );
453 ASM_F0_INDICE_START );
466 // // 2) compute the BP1 set
454 // 2) compute the BP1 set
467
455
468 // // 3) send the BP1 set
456 // 3) send the BP1 set
469 // set_time( current_node_norm_bp1_f0.header.time, (unsigned char *) &incomingMsg->coarseTime );
457 set_time( packet_norm_bp1_f0.header.time, (unsigned char *) &incomingMsg->coarseTime );
470 // set_time( current_node_norm_bp1_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
458 set_time( packet_norm_bp1_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
471 // BP_send( (char *) &current_node_norm_bp1_f0.header, queue_id,
459 BP_send( (char *) &packet_norm_bp1_f0.header, queue_id,
472 // PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 + PACKET_LENGTH_DELTA);
460 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 + PACKET_LENGTH_DELTA);
473 // if (incomingMsg->event & RTEMS_EVENT_NORM_BP2_F0)
461 if (incomingMsg->event & RTEMS_EVENT_NORM_BP2_F0)
474 // {
462 {
475 // // 1) compute the BP2 set
463 // 1) compute the BP2 set
476
464
477 // // 2) send the BP2 set
465 // 2) send the BP2 set
478 // set_time( current_node_norm_bp2_f0.header.time, (unsigned char *) &incomingMsg->coarseTime );
466 set_time( packet_norm_bp2_f0.header.time, (unsigned char *) &incomingMsg->coarseTime );
479 // set_time( current_node_norm_bp2_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
467 set_time( packet_norm_bp2_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
480 // BP_send( (char *) &current_node_norm_bp2_f0.header, queue_id,
468 BP_send( (char *) &packet_norm_bp2_f0.header, queue_id,
481 // PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0 + PACKET_LENGTH_DELTA);
469 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0 + PACKET_LENGTH_DELTA);
482 // }
470 }
483 // }
471 }
484
472
485 // if (incomingMsg->event & RTEMS_EVENT_NORM_ASM_F0)
473 if (incomingMsg->event & RTEMS_EVENT_NORM_ASM_F0)
486 // {
474 {
487 // // 1) reorganize the ASM and divide
475 // 1) reorganize the ASM and divide
488 // ASM_reorganize_and_divide( incomingMsg->norm->matrix, asm_f0_reorganized, NB_SM_BEFORE_NORM_BP1_F0 );
476 ASM_reorganize_and_divide( incomingMsg->norm->matrix, asm_f0_reorganized, NB_SM_BEFORE_NORM_BP1_F0 );
489 // // 2) convert the float array in a char array
477 // 2) convert the float array in a char array
490 // ASM_convert( asm_f0_reorganized, asm_f0_char);
478 ASM_convert( asm_f0_reorganized, asm_f0_char);
491 // // 3) send the spectral matrix packets
479 // 3) send the spectral matrix packets
492 // set_time( headerASM.time , (unsigned char *) &incomingMsg->coarseTime );
480 set_time( headerASM.time , (unsigned char *) &incomingMsg->coarseTime );
493 // set_time( headerASM.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime );
481 set_time( headerASM.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime );
494 // ASM_send( &headerASM, asm_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id);
482 ASM_send( &headerASM, asm_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id);
495 // }
483 }
496
484
497 // }
485 }
498 }
486 }
499
487
488 //*****************
489 // PROCESSING AT F1
490
500 rtems_task avf1_task( rtems_task_argument lfrRequestedMode )
491 rtems_task avf1_task( rtems_task_argument lfrRequestedMode )
501 {
492 {
502 int i;
493 int i;
@@ -507,14 +498,26 rtems_task avf1_task( rtems_task_argumen
507 asm_msg msgForMATR;
498 asm_msg msgForMATR;
508 ring_node_sm *ring_node_tab[8];
499 ring_node_sm *ring_node_tab[8];
509
500
501 static unsigned int nb_norm_bp1;
502 static unsigned int nb_norm_bp2;
503 static unsigned int nb_norm_asm;
504 static unsigned int nb_sbm_bp1;
505 static unsigned int nb_sbm_bp2;
506
507 nb_norm_bp1 = 0;
508 nb_norm_bp2 = 0;
509 nb_norm_asm = 0;
510 nb_sbm_bp1 = 0;
511 nb_sbm_bp2 = 0;
512
510 reset_nb_sm_f1( lfrRequestedMode ); // reset the sm counters that drive the BP and ASM computations / transmissions
513 reset_nb_sm_f1( lfrRequestedMode ); // reset the sm counters that drive the BP and ASM computations / transmissions
511
514
512 BOOT_PRINTF1("in AVF1 *** lfrRequestedMode = %d\n", lfrRequestedMode)
515 BOOT_PRINTF1("in AVF1 *** lfrRequestedMode = %d\n", (int) lfrRequestedMode)
513
516
514 status = get_message_queue_id_prc1( &queue_id_prc1 );
517 status = get_message_queue_id_prc1( &queue_id_prc1 );
515 if (status != RTEMS_SUCCESSFUL)
518 if (status != RTEMS_SUCCESSFUL)
516 {
519 {
517 PRINTF1("in MATR *** ERR get_message_queue_id_prc0 %d\n", status)
520 PRINTF1("in AVF1 *** ERR get_message_queue_id_prc1 %d\n", status)
518 }
521 }
519
522
520 while(1){
523 while(1){
@@ -522,56 +525,56 rtems_task avf1_task( rtems_task_argumen
522 ring_node_tab[NB_SM_BEFORE_AVF1-1] = ring_node_for_averaging_sm_f1;
525 ring_node_tab[NB_SM_BEFORE_AVF1-1] = ring_node_for_averaging_sm_f1;
523 for ( i = 2; i < (NB_SM_BEFORE_AVF1+1); i++ )
526 for ( i = 2; i < (NB_SM_BEFORE_AVF1+1); i++ )
524 {
527 {
525 ring_node_for_averaging_sm_f0 = ring_node_for_averaging_sm_f0->previous;
528 ring_node_for_averaging_sm_f1 = ring_node_for_averaging_sm_f1->previous;
526 ring_node_tab[NB_SM_BEFORE_AVF1-i] = ring_node_for_averaging_sm_f0;
529 ring_node_tab[NB_SM_BEFORE_AVF1-i] = ring_node_for_averaging_sm_f1;
527 }
530 }
528
531
529 // compute the average and store it in the averaged_sm_f1 buffer
532 // compute the average and store it in the averaged_sm_f1 buffer
530 SM_average( current_ring_node_asm_norm_f1->matrix,
533 SM_average( current_ring_node_asm_norm_f1->matrix,
531 current_ring_node_asm_burst_sbm_f1->matrix,
534 current_ring_node_asm_burst_sbm_f1->matrix,
532 ring_node_tab,
535 ring_node_tab,
533 nb_sm.norm_bp1_f1, nb_sm.sbm_bp1_f1 );
536 nb_norm_bp1, nb_sbm_bp1 );
534
537
535 // update nb_average
538 // update nb_average
536 nb_sm.norm_bp1_f1 = nb_sm.norm_bp1_f1 + NB_SM_BEFORE_AVF1;
539 nb_norm_bp1 = nb_norm_bp1 + NB_SM_BEFORE_AVF1;
537 nb_sm.norm_bp2_f1 = nb_sm.norm_bp2_f1 + NB_SM_BEFORE_AVF1;
540 nb_norm_bp2 = nb_norm_bp2 + NB_SM_BEFORE_AVF1;
538 nb_sm.norm_asm_f1 = nb_sm.norm_asm_f1 + NB_SM_BEFORE_AVF1;
541 nb_norm_asm = nb_norm_asm + NB_SM_BEFORE_AVF1;
539 nb_sm.sbm_bp1_f1 = nb_sm.sbm_bp1_f1 + NB_SM_BEFORE_AVF1;
542 nb_sbm_bp1 = nb_sbm_bp1 + NB_SM_BEFORE_AVF1;
540 nb_sm.sbm_bp2_f1 = nb_sm.sbm_bp2_f1 + NB_SM_BEFORE_AVF1;
543 nb_sbm_bp2 = nb_sbm_bp2 + NB_SM_BEFORE_AVF1;
541
544
542 //****************************************
545 //****************************************
543 // initialize the mesage for the MATR task
546 // initialize the mesage for the MATR task
544 msgForMATR.event = 0x00; // this composite event will be sent to the MATR task
547 msgForMATR.event = 0x00; // this composite event will be sent to the PRC1 task
545 msgForMATR.burst_sbm = current_ring_node_asm_burst_sbm_f1;
548 msgForMATR.burst_sbm = current_ring_node_asm_burst_sbm_f1;
546 msgForMATR.norm = current_ring_node_asm_norm_f1;
549 msgForMATR.norm = current_ring_node_asm_norm_f1;
547 msgForMATR.coarseTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[0];
550 msgForMATR.coarseTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[0];
548 msgForMATR.fineTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[1];
551 msgForMATR.fineTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[1];
549
552
550 if (nb_sm.sbm_bp1_f1 == nb_sm_before_f1.burst_sbm_bp1_f1)
553 if (nb_sbm_bp1 == nb_sm_before_f1.burst_sbm_bp1)
551 {
554 {
552 nb_sm.sbm_bp1_f0 = 0;
555 nb_sbm_bp1 = 0;
553 // set another ring for the ASM storage
556 // set another ring for the ASM storage
554 current_ring_node_asm_burst_sbm_f0 = current_ring_node_asm_burst_sbm_f0->next;
557 current_ring_node_asm_burst_sbm_f1 = current_ring_node_asm_burst_sbm_f1->next;
555 if ( (lfrCurrentMode == LFR_MODE_BURST) || (lfrCurrentMode == LFR_MODE_SBM2) )
558 if ( (lfrCurrentMode == LFR_MODE_BURST) || (lfrCurrentMode == LFR_MODE_SBM2) )
556 {
559 {
557 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_SBM_BP1_F1;
560 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_SBM_BP1_F1;
558 }
561 }
559 }
562 }
560
563
561 if (nb_sm.sbm_bp2_f1 == nb_sm_before_f1.burst_sbm_bp2_f1)
564 if (nb_sbm_bp2 == nb_sm_before_f1.burst_sbm_bp2)
562 {
565 {
563 nb_sm.sbm_bp2_f0 = 0;
566 nb_sbm_bp2 = 0;
564 if ( (lfrCurrentMode == LFR_MODE_BURST) || (lfrCurrentMode == LFR_MODE_SBM2) )
567 if ( (lfrCurrentMode == LFR_MODE_BURST) || (lfrCurrentMode == LFR_MODE_SBM2) )
565 {
568 {
566 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_SBM_BP2_F1;
569 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_SBM_BP2_F1;
567 }
570 }
568 }
571 }
569
572
570 if (nb_sm.norm_bp1_f1 == nb_sm_before_f1.norm_bp1_f1)
573 if (nb_norm_bp1 == nb_sm_before_f1.norm_bp1)
571 {
574 {
572 nb_sm.norm_bp1_f0 = 0;
575 nb_norm_bp1 = 0;
573 // set another ring for the ASM storage
576 // set another ring for the ASM storage
574 current_ring_node_asm_norm_f0 = current_ring_node_asm_norm_f0->next;
577 current_ring_node_asm_norm_f1 = current_ring_node_asm_norm_f1->next;
575 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
578 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
576 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
579 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
577 {
580 {
@@ -579,9 +582,9 rtems_task avf1_task( rtems_task_argumen
579 }
582 }
580 }
583 }
581
584
582 if (nb_sm.norm_bp2_f1 == nb_sm_before_f1.norm_bp2_f1)
585 if (nb_norm_bp2 == nb_sm_before_f1.norm_bp2)
583 {
586 {
584 nb_sm.norm_bp2_f0 = 0;
587 nb_norm_bp2 = 0;
585 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
588 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
586 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
589 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
587 {
590 {
@@ -589,9 +592,9 rtems_task avf1_task( rtems_task_argumen
589 }
592 }
590 }
593 }
591
594
592 if (nb_sm.norm_asm_f1 == nb_sm_before_f1.norm_asm_f1)
595 if (nb_norm_asm == nb_sm_before_f1.norm_asm)
593 {
596 {
594 nb_sm.norm_asm_f0 = 0;
597 nb_norm_asm = 0;
595 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
598 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
596 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
599 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
597 {
600 {
@@ -603,7 +606,7 rtems_task avf1_task( rtems_task_argumen
603 // send the message to MATR
606 // send the message to MATR
604 if (msgForMATR.event != 0x00)
607 if (msgForMATR.event != 0x00)
605 {
608 {
606 status = rtems_message_queue_send( queue_id_prc1, (char *) & msgForMATR, MSG_QUEUE_SIZE_PRC1);
609 status = rtems_message_queue_send( queue_id_prc1, (char *) &msgForMATR, MSG_QUEUE_SIZE_PRC1);
607 }
610 }
608
611
609 if (status != RTEMS_SUCCESSFUL) {
612 if (status != RTEMS_SUCCESSFUL) {
@@ -612,6 +615,158 rtems_task avf1_task( rtems_task_argumen
612 }
615 }
613 }
616 }
614
617
618 rtems_task prc1_task( rtems_task_argument lfrRequestedMode )
619 {
620 char incomingData[MSG_QUEUE_SIZE_SEND]; // incoming data buffer
621 size_t size; // size of the incoming TC packet
622 asm_msg *incomingMsg;
623 //
624 spw_ioctl_pkt_send spw_ioctl_send_ASM;
625 rtems_status_code status;
626 rtems_id queue_id;
627 rtems_id queue_id_q_p1;
628 Header_TM_LFR_SCIENCE_ASM_t headerASM;
629 bp_packet_with_spare packet_norm_bp1;
630 bp_packet packet_norm_bp2;
631 bp_packet packet_sbm_bp1;
632 bp_packet packet_sbm_bp2;
633
634 unsigned long long int localTime;
635
636 ASM_init_header( &headerASM );
637
638 //*************
639 // NORM headers
640 BP_init_header_with_spare( &packet_norm_bp1.header,
641 APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F1,
642 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F1, NB_BINS_COMPRESSED_SM_F1 );
643 BP_init_header( &packet_norm_bp2.header,
644 APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP2_F1,
645 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F1, NB_BINS_COMPRESSED_SM_F1);
646
647 //***********************
648 // BURST and SBM2 headers
649 if ( lfrRequestedMode == LFR_MODE_BURST )
650 {
651 BP_init_header( &packet_sbm_bp1.header,
652 APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP1_F1,
653 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F1);
654 BP_init_header( &packet_sbm_bp2.header,
655 APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP2_F1,
656 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F1);
657 }
658 else if ( lfrRequestedMode == LFR_MODE_SBM2 )
659 {
660 BP_init_header( &packet_sbm_bp1.header,
661 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP1_F1,
662 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F1, NB_BINS_COMPRESSED_SM_SBM_F1);
663 BP_init_header( &packet_sbm_bp2.header,
664 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP2_F1,
665 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F1, NB_BINS_COMPRESSED_SM_SBM_F1);
666 }
667 else
668 {
669 PRINTF1("ERR *** in PRC1 *** unexpected lfrRequestedMode passed as argument = %d\n", (unsigned int) lfrRequestedMode)
670 }
671
672 status = get_message_queue_id_send( &queue_id );
673 if (status != RTEMS_SUCCESSFUL)
674 {
675 PRINTF1("in PRC1 *** ERR get_message_queue_id_send %d\n", status)
676 }
677 status = get_message_queue_id_prc1( &queue_id_q_p1);
678 if (status != RTEMS_SUCCESSFUL)
679 {
680 PRINTF1("in PRC1 *** ERR get_message_queue_id_prc1 %d\n", status)
681 }
682
683 BOOT_PRINTF1("in PRC1 *** lfrRequestedMode = %d\n", (int) lfrRequestedMode)
684
685 while(1){
686 status = rtems_message_queue_receive( queue_id_q_p1, incomingData, &size, //************************************
687 RTEMS_WAIT, RTEMS_NO_TIMEOUT ); // wait for a message coming from AVF0
688
689 incomingMsg = (asm_msg*) incomingData;
690
691 localTime = getTimeAsUnsignedLongLongInt( );
692 //***********
693 //***********
694 // BURST SBM2
695 //***********
696 //***********
697 if (incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP1_F1 )
698 {
699 // 1) compress the matrix for Basic Parameters calculation
700 ASM_compress_reorganize_and_divide( incomingMsg->burst_sbm->matrix, compressed_sm_sbm,
701 nb_sm_before_f1.burst_sbm_bp1,
702 NB_BINS_COMPRESSED_SM_SBM_F1, NB_BINS_TO_AVERAGE_ASM_SBM_F1,
703 ASM_F1_INDICE_START);
704 // 2) compute the BP1 set
705
706 // 3) send the BP1 set
707 set_time( packet_sbm_bp1.header.time, (unsigned char *) &incomingMsg->coarseTime );
708 set_time( packet_sbm_bp1.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
709 BP_send( (char *) &packet_sbm_bp1.header, queue_id,
710 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F1 + PACKET_LENGTH_DELTA);
711 // 4) compute the BP2 set if needed
712 if ( incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP2_F1 )
713 {
714 // 1) compute the BP2 set
715
716 // 2) send the BP2 set
717 set_time( packet_sbm_bp2.header.time, (unsigned char *) &incomingMsg->coarseTime );
718 set_time( packet_sbm_bp2.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
719 BP_send( (char *) &packet_sbm_bp2.header, queue_id,
720 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F1 + PACKET_LENGTH_DELTA);
721 }
722 }
723
724 //*****
725 //*****
726 // NORM
727 //*****
728 //*****
729 if (incomingMsg->event & RTEMS_EVENT_NORM_BP1_F1)
730 {
731 // 1) compress the matrix for Basic Parameters calculation
732 ASM_compress_reorganize_and_divide( incomingMsg->norm->matrix, compressed_sm_norm_f0,
733 nb_sm_before_f0.norm_bp1_f0,
734 NB_BINS_COMPRESSED_SM_F0, NB_BINS_TO_AVERAGE_ASM_F0,
735 ASM_F0_INDICE_START );
736 // 2) compute the BP1 set
737
738 // 3) send the BP1 set
739 set_time( packet_norm_bp1.header.time, (unsigned char *) &incomingMsg->coarseTime );
740 set_time( packet_norm_bp1.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
741 BP_send( (char *) &packet_norm_bp1.header, queue_id,
742 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F1 + PACKET_LENGTH_DELTA);
743 if (incomingMsg->event & RTEMS_EVENT_NORM_BP2_F1)
744 {
745 // 1) compute the BP2 set
746
747 // 2) send the BP2 set
748 set_time( packet_norm_bp2.header.time, (unsigned char *) &incomingMsg->coarseTime );
749 set_time( packet_norm_bp2.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
750 BP_send( (char *) &packet_norm_bp2.header, queue_id,
751 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F1 + PACKET_LENGTH_DELTA);
752 }
753 }
754
755 if (incomingMsg->event & RTEMS_EVENT_NORM_ASM_F1)
756 {
757 // 1) reorganize the ASM and divide
758 ASM_reorganize_and_divide( incomingMsg->norm->matrix, asm_f0_reorganized, NB_SM_BEFORE_NORM_BP1_F0 );
759 // 2) convert the float array in a char array
760 ASM_convert( asm_f0_reorganized, asm_f0_char);
761 // 3) send the spectral matrix packets
762 set_time( headerASM.time , (unsigned char *) &incomingMsg->coarseTime );
763 set_time( headerASM.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime );
764 ASM_send( &headerASM, asm_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id);
765 }
766
767 }
768 }
769
615 //******************
770 //******************
616 // Spectral Matrices
771 // Spectral Matrices
617
772
@@ -686,38 +841,32 void SM_init_rings( void )
686
841
687 void ASM_init_rings( void )
842 void ASM_init_rings( void )
688 {
843 {
844 //***
845 // F0
846 // NORM
847 ASM_generic_init_ring( asm_ring_norm_f0, NB_RING_NODES_ASM_NORM_F0 );
848 // BURST_SBM
849 ASM_generic_init_ring( asm_ring_burst_sbm_f0, NB_RING_NODES_ASM_BURST_SBM_F0 );
850
851 //***
852 // F1
853 //*****
854 // NORM
855 ASM_generic_init_ring( asm_ring_norm_f1, NB_RING_NODES_ASM_NORM_F1 );
856 // BURST_SBM
857 ASM_generic_init_ring( asm_ring_burst_sbm_f1, NB_RING_NODES_ASM_BURST_SBM_F1 );
858 }
859
860 void ASM_generic_init_ring( ring_node_asm *ring, unsigned char nbNodes )
861 {
689 unsigned char i;
862 unsigned char i;
690
863
691 //*************
864 ring[ nbNodes - 1 ].next
692 // BURST_SBM_F0
865 = (ring_node_asm*) &ring[ 0 ];
693 asm_ring_burst_sbm_f0[0].next = (ring_node_asm*) &asm_ring_burst_sbm_f0[1];
694 asm_ring_burst_sbm_f0[0].previous = (ring_node_asm*) &asm_ring_burst_sbm_f0[NB_RING_NODES_ASM_BURST_SBM_F0-1];
695
866
696 asm_ring_burst_sbm_f0[NB_RING_NODES_ASM_BURST_SBM_F0-1].next
867 for(i=0; i<nbNodes-1; i++)
697 = (ring_node_asm*) &asm_ring_burst_sbm_f0[0];
698 asm_ring_burst_sbm_f0[NB_RING_NODES_ASM_BURST_SBM_F0-1].previous
699 = (ring_node_asm*) &asm_ring_burst_sbm_f0[NB_RING_NODES_ASM_BURST_SBM_F0-2];
700
701 for(i=1; i<NB_RING_NODES_ASM_BURST_SBM_F0-1; i++)
702 {
868 {
703 asm_ring_burst_sbm_f0[i].next = (ring_node_asm*) &asm_ring_burst_sbm_f0[i+1];
869 ring[ i ].next = (ring_node_asm*) &ring[ i + 1 ];
704 asm_ring_burst_sbm_f0[i].previous = (ring_node_asm*) &asm_ring_burst_sbm_f0[i-1];
705 }
706
707 //*************
708 // NORM_F0
709 asm_ring_norm_f0[0].next = (ring_node_asm*) &asm_ring_norm_f0[1];
710 asm_ring_norm_f0[0].previous = (ring_node_asm*) &asm_ring_norm_f0[NB_RING_NODES_ASM_BURST_SBM_F0-1];
711
712 asm_ring_norm_f0[NB_RING_NODES_ASM_NORM_F0-1].next
713 = (ring_node_asm*) &asm_ring_norm_f0[0];
714 asm_ring_norm_f0[NB_RING_NODES_ASM_NORM_F0-1].previous
715 = (ring_node_asm*) &asm_ring_norm_f0[NB_RING_NODES_ASM_NORM_F0-2];
716
717 for(i=1; i<NB_RING_NODES_ASM_NORM_F0-1; i++)
718 {
719 asm_ring_norm_f0[i].next = (ring_node_asm*) &asm_ring_norm_f0[i+1];
720 asm_ring_norm_f0[i].previous = (ring_node_asm*) &asm_ring_norm_f0[i-1];
721 }
870 }
722 }
871 }
723
872
@@ -730,10 +879,13 void SM_reset_current_ring_nodes( void )
730 ring_node_for_averaging_sm_f0 = sm_ring_f0;
879 ring_node_for_averaging_sm_f0 = sm_ring_f0;
731 }
880 }
732
881
733 void ASM_reset_current_ring_node( void )
882 void ASM_reset_current_ring_nodes( void )
734 {
883 {
735 current_ring_node_asm_norm_f0 = asm_ring_norm_f0;
884 current_ring_node_asm_norm_f0 = asm_ring_norm_f0;
736 current_ring_node_asm_burst_sbm_f0 = asm_ring_burst_sbm_f0;
885 current_ring_node_asm_burst_sbm_f0 = asm_ring_burst_sbm_f0;
886
887 current_ring_node_asm_norm_f1 = asm_ring_norm_f1;
888 current_ring_node_asm_burst_sbm_f1 = asm_ring_burst_sbm_f1;
737 }
889 }
738
890
739 void ASM_init_header( Header_TM_LFR_SCIENCE_ASM_t *header)
891 void ASM_init_header( Header_TM_LFR_SCIENCE_ASM_t *header)
@@ -571,11 +571,11 int restart_science_tasks(unsigned char
571 * - RTEMS_INCORRECT_STATE - task never started
571 * - RTEMS_INCORRECT_STATE - task never started
572 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
572 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
573 *
573 *
574 * Science tasks are AVF0, BPF0, WFRM, CWF3, CW2, CWF1
574 * Science tasks are AVF0, PRC0, WFRM, CWF3, CW2, CWF1
575 *
575 *
576 */
576 */
577
577
578 rtems_status_code status[7];
578 rtems_status_code status[8];
579 rtems_status_code ret;
579 rtems_status_code ret;
580
580
581 ret = RTEMS_SUCCESSFUL;
581 ret = RTEMS_SUCCESSFUL;
@@ -583,42 +583,55 int restart_science_tasks(unsigned char
583 status[0] = rtems_task_restart( Task_id[TASKID_AVF0], lfrRequestedMode );
583 status[0] = rtems_task_restart( Task_id[TASKID_AVF0], lfrRequestedMode );
584 if (status[0] != RTEMS_SUCCESSFUL)
584 if (status[0] != RTEMS_SUCCESSFUL)
585 {
585 {
586 PRINTF1("in restart_science_task *** 0 ERR %d\n", status[0])
586 PRINTF1("in restart_science_task *** AVF0 ERR %d\n", status[0])
587 }
588
589 status[1] = rtems_task_restart( Task_id[TASKID_PRC0], lfrRequestedMode );
590 if (status[1] != RTEMS_SUCCESSFUL)
591 {
592 PRINTF1("in restart_science_task *** PRC0 ERR %d\n", status[1])
587 }
593 }
588
594
589 status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 );
595 status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 );
590 if (status[2] != RTEMS_SUCCESSFUL)
596 if (status[2] != RTEMS_SUCCESSFUL)
591 {
597 {
592 PRINTF1("in restart_science_task *** 2 ERR %d\n", status[2])
598 PRINTF1("in restart_science_task *** WFRM ERR %d\n", status[2])
593 }
599 }
594
600
595 status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 );
601 status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 );
596 if (status[3] != RTEMS_SUCCESSFUL)
602 if (status[3] != RTEMS_SUCCESSFUL)
597 {
603 {
598 PRINTF1("in restart_science_task *** 3 ERR %d\n", status[3])
604 PRINTF1("in restart_science_task *** CWF3 ERR %d\n", status[3])
599 }
605 }
600
606
601 status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 );
607 status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 );
602 if (status[4] != RTEMS_SUCCESSFUL)
608 if (status[4] != RTEMS_SUCCESSFUL)
603 {
609 {
604 PRINTF1("in restart_science_task *** 4 ERR %d\n", status[4])
610 PRINTF1("in restart_science_task *** CWF2 ERR %d\n", status[4])
605 }
611 }
606
612
607 status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 );
613 status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 );
608 if (status[5] != RTEMS_SUCCESSFUL)
614 if (status[5] != RTEMS_SUCCESSFUL)
609 {
615 {
610 PRINTF1("in restart_science_task *** 5 ERR %d\n", status[5])
616 PRINTF1("in restart_science_task *** CWF1 ERR %d\n", status[5])
611 }
617 }
612
618
613 status[6] = rtems_task_restart( Task_id[TASKID_PRC0], lfrRequestedMode );
619 status[6] = rtems_task_restart( Task_id[TASKID_AVF1], lfrRequestedMode );
614 if (status[6] != RTEMS_SUCCESSFUL)
620 if (status[6] != RTEMS_SUCCESSFUL)
615 {
621 {
616 PRINTF1("in restart_science_task *** 6 ERR %d\n", status[6])
622 PRINTF1("in restart_science_task *** AVF1 ERR %d\n", status[6])
617 }
623 }
618
624
619 if ( (status[0] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) ||
625 status[7] = rtems_task_restart( Task_id[TASKID_PRC1],lfrRequestedMode );
620 (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) ||
626 if (status[7] != RTEMS_SUCCESSFUL)
621 (status[5] != RTEMS_SUCCESSFUL) || (status[6] != RTEMS_SUCCESSFUL) )
627 {
628 PRINTF1("in restart_science_task *** PRC1 ERR %d\n", status[7])
629 }
630
631 if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) ||
632 (status[2] != RTEMS_SUCCESSFUL) || (status[3] != RTEMS_SUCCESSFUL) ||
633 (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) ||
634 (status[6] != RTEMS_SUCCESSFUL) || (status[7] != RTEMS_SUCCESSFUL) )
622 {
635 {
623 ret = RTEMS_UNSATISFIED;
636 ret = RTEMS_UNSATISFIED;
624 }
637 }
@@ -639,12 +652,35 int suspend_science_tasks()
639
652
640 rtems_status_code status;
653 rtems_status_code status;
641
654
642 status = rtems_task_suspend( Task_id[TASKID_AVF0] );
655 status = rtems_task_suspend( Task_id[TASKID_AVF0] ); // suspend AVF0
643 if (status != RTEMS_SUCCESSFUL)
656 if (status != RTEMS_SUCCESSFUL)
644 {
657 {
645 PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status)
658 PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status)
646 }
659 }
647
660 if (status == RTEMS_SUCCESSFUL) // suspend PRC0
661 {
662 status = rtems_task_suspend( Task_id[TASKID_PRC0] );
663 if (status != RTEMS_SUCCESSFUL)
664 {
665 PRINTF1("in suspend_science_task *** PRC0 ERR %d\n", status)
666 }
667 }
668 if (status == RTEMS_SUCCESSFUL) // suspend AVF1
669 {
670 status = rtems_task_suspend( Task_id[TASKID_AVF1] );
671 if (status != RTEMS_SUCCESSFUL)
672 {
673 PRINTF1("in suspend_science_task *** AVF1 ERR %d\n", status)
674 }
675 }
676 if (status == RTEMS_SUCCESSFUL) // suspend PRC1
677 {
678 status = rtems_task_suspend( Task_id[TASKID_PRC1] );
679 if (status != RTEMS_SUCCESSFUL)
680 {
681 PRINTF1("in suspend_science_task *** PRC1 ERR %d\n", status)
682 }
683 }
648 if (status == RTEMS_SUCCESSFUL) // suspend WFRM
684 if (status == RTEMS_SUCCESSFUL) // suspend WFRM
649 {
685 {
650 status = rtems_task_suspend( Task_id[TASKID_WFRM] );
686 status = rtems_task_suspend( Task_id[TASKID_WFRM] );
@@ -653,7 +689,6 int suspend_science_tasks()
653 PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status)
689 PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status)
654 }
690 }
655 }
691 }
656
657 if (status == RTEMS_SUCCESSFUL) // suspend CWF3
692 if (status == RTEMS_SUCCESSFUL) // suspend CWF3
658 {
693 {
659 status = rtems_task_suspend( Task_id[TASKID_CWF3] );
694 status = rtems_task_suspend( Task_id[TASKID_CWF3] );
@@ -662,7 +697,6 int suspend_science_tasks()
662 PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status)
697 PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status)
663 }
698 }
664 }
699 }
665
666 if (status == RTEMS_SUCCESSFUL) // suspend CWF2
700 if (status == RTEMS_SUCCESSFUL) // suspend CWF2
667 {
701 {
668 status = rtems_task_suspend( Task_id[TASKID_CWF2] );
702 status = rtems_task_suspend( Task_id[TASKID_CWF2] );
@@ -671,7 +705,6 int suspend_science_tasks()
671 PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status)
705 PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status)
672 }
706 }
673 }
707 }
674
675 if (status == RTEMS_SUCCESSFUL) // suspend CWF1
708 if (status == RTEMS_SUCCESSFUL) // suspend CWF1
676 {
709 {
677 status = rtems_task_suspend( Task_id[TASKID_CWF1] );
710 status = rtems_task_suspend( Task_id[TASKID_CWF1] );
@@ -707,7 +740,7 void launch_waveform_picker( unsigned ch
707 void launch_spectral_matrix( void )
740 void launch_spectral_matrix( void )
708 {
741 {
709 SM_reset_current_ring_nodes();
742 SM_reset_current_ring_nodes();
710 ASM_reset_current_ring_node();
743 ASM_reset_current_ring_nodes();
711 reset_spectral_matrix_regs();
744 reset_spectral_matrix_regs();
712
745
713 struct grgpio_regs_str *grgpio_regs = (struct grgpio_regs_str *) REGS_ADDR_GRGPIO;
746 struct grgpio_regs_str *grgpio_regs = (struct grgpio_regs_str *) REGS_ADDR_GRGPIO;
@@ -724,7 +757,7 void launch_spectral_matrix( void )
724 void launch_spectral_matrix_simu( void )
757 void launch_spectral_matrix_simu( void )
725 {
758 {
726 SM_reset_current_ring_nodes();
759 SM_reset_current_ring_nodes();
727 ASM_reset_current_ring_node();
760 ASM_reset_current_ring_nodes();
728 reset_spectral_matrix_regs();
761 reset_spectral_matrix_regs();
729
762
730 // Spectral Matrices simulator
763 // Spectral Matrices simulator
General Comments 0
You need to be logged in to leave comments. Login now