@@ -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: Sun Apr 27 1 |
|
3 | # Generated by qmake (2.01a) (Qt 4.8.5) on: Sun Apr 27 16:27:36 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=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=6 -DPRINT_MESSAGES_ON_CONSOLE -DPRINT_TASK_STATISTICS -DBOOT_MESSAGES |
|
13 | DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=6 -DPRINT_MESSAGES_ON_CONSOLE -DDEBUG_MESSAGES -DPRINT_TASK_STATISTICS -DBOOT_MESSAGES | |
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../src/basic_parameters -I../src/avf_prc |
|
16 | INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header -I../src/basic_parameters -I../src/avf_prc |
@@ -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 cpu_usage_report boot_messages |
|
4 | CONFIG += console verbose cpu_usage_report boot_messages debug_messages | |
5 | CONFIG -= qt |
|
5 | CONFIG -= qt | |
6 |
|
6 | |||
7 | include(./sparc.pri) |
|
7 | include(./sparc.pri) |
@@ -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-27T1 |
|
3 | <!-- Written by QtCreator 3.0.1, 2014-04-27T16:41:56. --> | |
4 | <qtcreator> |
|
4 | <qtcreator> | |
5 | <data> |
|
5 | <data> | |
6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
|
6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
@@ -55,6 +55,46 void reset_nb_sm_f0( unsigned char lfrMo | |||||
55 | } |
|
55 | } | |
56 | } |
|
56 | } | |
57 |
|
57 | |||
|
58 | void SM_average_f0( float *averaged_spec_mat_f0, float *averaged_spec_mat_f1, | |||
|
59 | ring_node_sm *ring_node_tab[], | |||
|
60 | unsigned int nbAverageNormF0, unsigned int nbAverageSBM1F0 ) | |||
|
61 | { | |||
|
62 | float sum; | |||
|
63 | unsigned int i; | |||
|
64 | ||||
|
65 | for(i=0; i<TOTAL_SIZE_SM; i++) | |||
|
66 | { | |||
|
67 | sum = ( (int *) (ring_node_tab[0]->buffer_address) ) [ i ] | |||
|
68 | + ( (int *) (ring_node_tab[1]->buffer_address) ) [ i ] | |||
|
69 | + ( (int *) (ring_node_tab[2]->buffer_address) ) [ i ] | |||
|
70 | + ( (int *) (ring_node_tab[3]->buffer_address) ) [ i ] | |||
|
71 | + ( (int *) (ring_node_tab[4]->buffer_address) ) [ i ] | |||
|
72 | + ( (int *) (ring_node_tab[5]->buffer_address) ) [ i ] | |||
|
73 | + ( (int *) (ring_node_tab[6]->buffer_address) ) [ i ] | |||
|
74 | + ( (int *) (ring_node_tab[7]->buffer_address) ) [ i ]; | |||
|
75 | ||||
|
76 | if ( (nbAverageNormF0 == 0) && (nbAverageSBM1F0 == 0) ) | |||
|
77 | { | |||
|
78 | averaged_spec_mat_f0[ i ] = sum; | |||
|
79 | averaged_spec_mat_f1[ i ] = sum; | |||
|
80 | } | |||
|
81 | else if ( (nbAverageNormF0 != 0) && (nbAverageSBM1F0 != 0) ) | |||
|
82 | { | |||
|
83 | averaged_spec_mat_f0[ i ] = ( averaged_spec_mat_f0[ i ] + sum ); | |||
|
84 | averaged_spec_mat_f1[ i ] = ( averaged_spec_mat_f1[ i ] + sum ); | |||
|
85 | } | |||
|
86 | else if ( (nbAverageNormF0 != 0) && (nbAverageSBM1F0 == 0) ) | |||
|
87 | { | |||
|
88 | averaged_spec_mat_f0[ i ] = ( averaged_spec_mat_f0[ i ] + sum ); | |||
|
89 | averaged_spec_mat_f1[ i ] = sum; | |||
|
90 | } | |||
|
91 | else | |||
|
92 | { | |||
|
93 | PRINTF2("ERR *** in SM_average *** unexpected parameters %d %d\n", nbAverageNormF0, nbAverageSBM1F0) | |||
|
94 | } | |||
|
95 | } | |||
|
96 | } | |||
|
97 | ||||
58 | //************ |
|
98 | //************ | |
59 | // RTEMS TASKS |
|
99 | // RTEMS TASKS | |
60 |
|
100 | |||
@@ -81,7 +121,7 rtems_task avf0_task( rtems_task_argumen | |||||
81 | nb_sbm_bp2 = 0; |
|
121 | nb_sbm_bp2 = 0; | |
82 |
|
122 | |||
83 | reset_nb_sm_f0( lfrRequestedMode ); // reset the sm counters that drive the BP and ASM computations / transmissions |
|
123 | reset_nb_sm_f0( lfrRequestedMode ); // reset the sm counters that drive the BP and ASM computations / transmissions | |
84 | ASM_generic_init_ring( asm_ring_norm_f0, NB_RING_NODES_ASM_NORM_F0 ); |
|
124 | ASM_generic_init_ring( asm_ring_norm_f0, NB_RING_NODES_ASM_NORM_F0 ); | |
85 | ASM_generic_init_ring( asm_ring_burst_sbm_f0, NB_RING_NODES_ASM_BURST_SBM_F0 ); |
|
125 | ASM_generic_init_ring( asm_ring_burst_sbm_f0, NB_RING_NODES_ASM_BURST_SBM_F0 ); | |
86 | current_ring_node_asm_norm_f0 = asm_ring_norm_f0; |
|
126 | current_ring_node_asm_norm_f0 = asm_ring_norm_f0; | |
87 | current_ring_node_asm_burst_sbm_f0 = asm_ring_burst_sbm_f0; |
|
127 | current_ring_node_asm_burst_sbm_f0 = asm_ring_burst_sbm_f0; | |
@@ -104,7 +144,7 rtems_task avf0_task( rtems_task_argumen | |||||
104 | } |
|
144 | } | |
105 |
|
145 | |||
106 | // compute the average and store it in the averaged_sm_f1 buffer |
|
146 | // compute the average and store it in the averaged_sm_f1 buffer | |
107 | SM_average( current_ring_node_asm_norm_f0->matrix, |
|
147 | SM_average_f0( current_ring_node_asm_norm_f0->matrix, | |
108 | current_ring_node_asm_burst_sbm_f0->matrix, |
|
148 | current_ring_node_asm_burst_sbm_f0->matrix, | |
109 | ring_node_tab, |
|
149 | ring_node_tab, | |
110 | nb_norm_bp1, nb_sbm_bp1 ); |
|
150 | nb_norm_bp1, nb_sbm_bp1 ); | |
@@ -113,8 +153,8 rtems_task avf0_task( rtems_task_argumen | |||||
113 | nb_norm_bp1 = nb_norm_bp1 + NB_SM_BEFORE_AVF0; |
|
153 | nb_norm_bp1 = nb_norm_bp1 + NB_SM_BEFORE_AVF0; | |
114 | nb_norm_bp2 = nb_norm_bp2 + NB_SM_BEFORE_AVF0; |
|
154 | nb_norm_bp2 = nb_norm_bp2 + NB_SM_BEFORE_AVF0; | |
115 | nb_norm_asm = nb_norm_asm + NB_SM_BEFORE_AVF0; |
|
155 | nb_norm_asm = nb_norm_asm + NB_SM_BEFORE_AVF0; | |
116 |
nb_sbm_bp1 = nb_sbm_bp1 |
|
156 | nb_sbm_bp1 = nb_sbm_bp1 + NB_SM_BEFORE_AVF0; | |
117 |
nb_sbm_bp2 = nb_sbm_bp2 |
|
157 | nb_sbm_bp2 = nb_sbm_bp2 + NB_SM_BEFORE_AVF0; | |
118 |
|
158 | |||
119 | //**************************************** |
|
159 | //**************************************** | |
120 | // initialize the mesage for the MATR task |
|
160 | // initialize the mesage for the MATR task |
@@ -17,12 +17,14 typedef struct { | |||||
17 | unsigned int sbm2_bp2; |
|
17 | unsigned int sbm2_bp2; | |
18 | } nb_sm_before_bp_asm_f0; |
|
18 | } nb_sm_before_bp_asm_f0; | |
19 |
|
19 | |||
20 | extern struct ring_node_sm *current_ring_node_sm_f0; |
|
|||
21 | extern struct ring_node_sm *ring_node_for_averaging_sm_f0; |
|
20 | extern struct ring_node_sm *ring_node_for_averaging_sm_f0; | |
22 |
|
21 | |||
23 | extern rtems_status_code get_message_queue_id_prc0( rtems_id *queue_id ); |
|
22 | extern rtems_status_code get_message_queue_id_prc0( rtems_id *queue_id ); | |
24 |
|
23 | |||
25 | void reset_nb_sm_f0( unsigned char lfrMode ); |
|
24 | void reset_nb_sm_f0( unsigned char lfrMode ); | |
|
25 | void SM_average_f0( float *averaged_spec_mat_f0, float *averaged_spec_mat_f1, | |||
|
26 | ring_node_sm *ring_node_tab[], | |||
|
27 | unsigned int nbAverageNormF0, unsigned int nbAverageSBM1F0 ); | |||
26 |
|
28 | |||
27 | rtems_task avf0_task( rtems_task_argument lfrRequestedMode ); |
|
29 | rtems_task avf0_task( rtems_task_argument lfrRequestedMode ); | |
28 | rtems_task prc0_task( rtems_task_argument lfrRequestedMode ); |
|
30 | rtems_task prc0_task( rtems_task_argument lfrRequestedMode ); |
@@ -48,6 +48,46 void reset_nb_sm_f1( unsigned char lfrMo | |||||
48 | } |
|
48 | } | |
49 | } |
|
49 | } | |
50 |
|
50 | |||
|
51 | void SM_average_f1( float *averaged_spec_mat_f0, float *averaged_spec_mat_f1, | |||
|
52 | ring_node_sm *ring_node_tab[], | |||
|
53 | unsigned int nbAverageNormF0, unsigned int nbAverageSBM1F0 ) | |||
|
54 | { | |||
|
55 | float sum; | |||
|
56 | unsigned int i; | |||
|
57 | ||||
|
58 | for(i=0; i<TOTAL_SIZE_SM; i++) | |||
|
59 | { | |||
|
60 | sum = ( (int *) (ring_node_tab[0]->buffer_address) ) [ i ] | |||
|
61 | + ( (int *) (ring_node_tab[1]->buffer_address) ) [ i ] | |||
|
62 | + ( (int *) (ring_node_tab[2]->buffer_address) ) [ i ] | |||
|
63 | + ( (int *) (ring_node_tab[3]->buffer_address) ) [ i ] | |||
|
64 | + ( (int *) (ring_node_tab[4]->buffer_address) ) [ i ] | |||
|
65 | + ( (int *) (ring_node_tab[5]->buffer_address) ) [ i ] | |||
|
66 | + ( (int *) (ring_node_tab[6]->buffer_address) ) [ i ] | |||
|
67 | + ( (int *) (ring_node_tab[7]->buffer_address) ) [ i ]; | |||
|
68 | ||||
|
69 | if ( (nbAverageNormF0 == 0) && (nbAverageSBM1F0 == 0) ) | |||
|
70 | { | |||
|
71 | averaged_spec_mat_f0[ i ] = sum; | |||
|
72 | averaged_spec_mat_f1[ i ] = sum; | |||
|
73 | } | |||
|
74 | else if ( (nbAverageNormF0 != 0) && (nbAverageSBM1F0 != 0) ) | |||
|
75 | { | |||
|
76 | averaged_spec_mat_f0[ i ] = ( averaged_spec_mat_f0[ i ] + sum ); | |||
|
77 | averaged_spec_mat_f1[ i ] = ( averaged_spec_mat_f1[ i ] + sum ); | |||
|
78 | } | |||
|
79 | else if ( (nbAverageNormF0 != 0) && (nbAverageSBM1F0 == 0) ) | |||
|
80 | { | |||
|
81 | averaged_spec_mat_f0[ i ] = ( averaged_spec_mat_f0[ i ] + sum ); | |||
|
82 | averaged_spec_mat_f1[ i ] = sum; | |||
|
83 | } | |||
|
84 | else | |||
|
85 | { | |||
|
86 | PRINTF2("ERR *** in SM_average *** unexpected parameters %d %d\n", nbAverageNormF0, nbAverageSBM1F0) | |||
|
87 | } | |||
|
88 | } | |||
|
89 | } | |||
|
90 | ||||
51 | //************ |
|
91 | //************ | |
52 | // RTEMS TASKS |
|
92 | // RTEMS TASKS | |
53 |
|
93 | |||
@@ -97,7 +137,7 rtems_task avf1_task( rtems_task_argumen | |||||
97 | } |
|
137 | } | |
98 |
|
138 | |||
99 | // compute the average and store it in the averaged_sm_f1 buffer |
|
139 | // compute the average and store it in the averaged_sm_f1 buffer | |
100 | SM_average( current_ring_node_asm_norm_f1->matrix, |
|
140 | SM_average_f1( current_ring_node_asm_norm_f1->matrix, | |
101 | current_ring_node_asm_burst_sbm_f1->matrix, |
|
141 | current_ring_node_asm_burst_sbm_f1->matrix, | |
102 | ring_node_tab, |
|
142 | ring_node_tab, | |
103 | nb_norm_bp1, nb_sbm_bp1 ); |
|
143 | nb_norm_bp1, nb_sbm_bp1 ); |
@@ -15,12 +15,14 typedef struct { | |||||
15 | unsigned int sbm2_bp2; |
|
15 | unsigned int sbm2_bp2; | |
16 | } nb_sm_before_bp_asm_f1; |
|
16 | } nb_sm_before_bp_asm_f1; | |
17 |
|
17 | |||
18 | extern struct ring_node_sm *current_ring_node_sm_f1; |
|
|||
19 | extern struct ring_node_sm *ring_node_for_averaging_sm_f1; |
|
18 | extern struct ring_node_sm *ring_node_for_averaging_sm_f1; | |
20 |
|
19 | |||
21 | extern rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id ); |
|
20 | extern rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id ); | |
22 |
|
21 | |||
23 | void reset_nb_sm_f1( unsigned char lfrMode ); |
|
22 | void reset_nb_sm_f1( unsigned char lfrMode ); | |
|
23 | void SM_average_f1( float *averaged_spec_mat_f0, float *averaged_spec_mat_f1, | |||
|
24 | ring_node_sm *ring_node_tab[], | |||
|
25 | unsigned int nbAverageNormF0, unsigned int nbAverageSBM1F0 ); | |||
24 |
|
26 | |||
25 | rtems_task avf1_task( rtems_task_argument lfrRequestedMode ); |
|
27 | rtems_task avf1_task( rtems_task_argument lfrRequestedMode ); | |
26 | rtems_task prc1_task( rtems_task_argument lfrRequestedMode ); |
|
28 | rtems_task prc1_task( rtems_task_argument lfrRequestedMode ); |
@@ -54,93 +54,93 void SM_average_f2( float *averaged_spec | |||||
54 |
|
54 | |||
55 | rtems_task avf2_task( rtems_task_argument lfrRequestedMode ) |
|
55 | rtems_task avf2_task( rtems_task_argument lfrRequestedMode ) | |
56 | { |
|
56 | { | |
57 | rtems_event_set event_out; |
|
57 | // rtems_event_set event_out; | |
58 | rtems_status_code status; |
|
58 | // rtems_status_code status; | |
59 | rtems_id queue_id_prc2; |
|
59 | // rtems_id queue_id_prc2; | |
60 | asm_msg msgForMATR; |
|
60 | // asm_msg msgForMATR; | |
61 |
|
61 | |||
62 | unsigned int nb_norm_bp1; |
|
62 | // unsigned int nb_norm_bp1; | |
63 | unsigned int nb_norm_bp2; |
|
63 | // unsigned int nb_norm_bp2; | |
64 | unsigned int nb_norm_asm; |
|
64 | // unsigned int nb_norm_asm; | |
65 |
|
65 | |||
66 | nb_norm_bp1 = 0; |
|
66 | // nb_norm_bp1 = 0; | |
67 | nb_norm_bp2 = 0; |
|
67 | // nb_norm_bp2 = 0; | |
68 | nb_norm_asm = 0; |
|
68 | // nb_norm_asm = 0; | |
69 |
|
69 | |||
70 | reset_nb_sm_f2( ); // reset the sm counters that drive the BP and ASM computations / transmissions |
|
70 | // reset_nb_sm_f2( ); // reset the sm counters that drive the BP and ASM computations / transmissions | |
71 |
|
71 | |||
72 | BOOT_PRINTF1("in AVF2 *** lfrRequestedMode = %d\n", (int) lfrRequestedMode) |
|
72 | // BOOT_PRINTF1("in AVF2 *** lfrRequestedMode = %d\n", (int) lfrRequestedMode) | |
73 |
|
73 | |||
74 | status = get_message_queue_id_prc2( &queue_id_prc2 ); |
|
74 | // status = get_message_queue_id_prc2( &queue_id_prc2 ); | |
75 | if (status != RTEMS_SUCCESSFUL) |
|
75 | // if (status != RTEMS_SUCCESSFUL) | |
76 | { |
|
76 | // { | |
77 | PRINTF1("in AVF2 *** ERR get_message_queue_id_prc2 %d\n", status) |
|
77 | // PRINTF1("in AVF2 *** ERR get_message_queue_id_prc2 %d\n", status) | |
78 | } |
|
78 | // } | |
79 |
|
79 | |||
80 | while(1){ |
|
80 | // while(1){ | |
81 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
81 | // rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 | |
82 |
|
82 | |||
83 | // compute the average and store it in the averaged_sm_f2 buffer |
|
83 | // // compute the average and store it in the averaged_sm_f2 buffer | |
84 | SM_average_f2( current_ring_node_asm_norm_f2->matrix, |
|
84 | // SM_average_f2( current_ring_node_asm_norm_f2->matrix, | |
85 | ring_node_for_averaging_sm_f2, |
|
85 | // ring_node_for_averaging_sm_f2, | |
86 | nb_norm_bp1 ); |
|
86 | // nb_norm_bp1 ); | |
87 |
|
87 | |||
88 | // update nb_average |
|
88 | // // update nb_average | |
89 | nb_norm_bp1 = nb_norm_bp1 + NB_SM_BEFORE_AVF2; |
|
89 | // nb_norm_bp1 = nb_norm_bp1 + NB_SM_BEFORE_AVF2; | |
90 | nb_norm_bp2 = nb_norm_bp2 + NB_SM_BEFORE_AVF2; |
|
90 | // nb_norm_bp2 = nb_norm_bp2 + NB_SM_BEFORE_AVF2; | |
91 | nb_norm_asm = nb_norm_asm + NB_SM_BEFORE_AVF2; |
|
91 | // nb_norm_asm = nb_norm_asm + NB_SM_BEFORE_AVF2; | |
92 |
|
92 | |||
93 | //**************************************** |
|
93 | // //**************************************** | |
94 | // initialize the mesage for the MATR task |
|
94 | // // initialize the mesage for the MATR task | |
95 | msgForMATR.event = 0x00; // this composite event will be sent to the MATR task |
|
95 | // msgForMATR.event = 0x00; // this composite event will be sent to the MATR task | |
96 | msgForMATR.burst_sbm = NULL; |
|
96 | // msgForMATR.burst_sbm = NULL; | |
97 | msgForMATR.norm = current_ring_node_asm_norm_f2; |
|
97 | // msgForMATR.norm = current_ring_node_asm_norm_f2; | |
98 | // msgForMATR.coarseTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[0]; |
|
98 | //// msgForMATR.coarseTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[0]; | |
99 | // msgForMATR.fineTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[1]; |
|
99 | //// msgForMATR.fineTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[1]; | |
100 | msgForMATR.coarseTime = time_management_regs->coarse_time; |
|
100 | // msgForMATR.coarseTime = time_management_regs->coarse_time; | |
101 | msgForMATR.fineTime = time_management_regs->fine_time; |
|
101 | // msgForMATR.fineTime = time_management_regs->fine_time; | |
102 |
|
102 | |||
103 | if (nb_norm_bp1 == nb_sm_before_f2.norm_bp1) |
|
103 | // if (nb_norm_bp1 == nb_sm_before_f2.norm_bp1) | |
104 | { |
|
104 | // { | |
105 | nb_norm_bp1 = 0; |
|
105 | // nb_norm_bp1 = 0; | |
106 | // set another ring for the ASM storage |
|
106 | // // set another ring for the ASM storage | |
107 | current_ring_node_asm_norm_f2 = current_ring_node_asm_norm_f2->next; |
|
107 | // current_ring_node_asm_norm_f2 = current_ring_node_asm_norm_f2->next; | |
108 | if ( lfrCurrentMode == LFR_MODE_NORMAL ) |
|
108 | // if ( lfrCurrentMode == LFR_MODE_NORMAL ) | |
109 | { |
|
109 | // { | |
110 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP1_F0; |
|
110 | // msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP1_F0; | |
111 | } |
|
111 | // } | |
112 | } |
|
112 | // } | |
113 |
|
113 | |||
114 | if (nb_norm_bp2 == nb_sm_before_f2.norm_bp2) |
|
114 | // if (nb_norm_bp2 == nb_sm_before_f2.norm_bp2) | |
115 | { |
|
115 | // { | |
116 | nb_norm_bp2 = 0; |
|
116 | // nb_norm_bp2 = 0; | |
117 | if ( lfrCurrentMode == LFR_MODE_NORMAL ) |
|
117 | // if ( lfrCurrentMode == LFR_MODE_NORMAL ) | |
118 | { |
|
118 | // { | |
119 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP2_F2; |
|
119 | // msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP2_F2; | |
120 | } |
|
120 | // } | |
121 | } |
|
121 | // } | |
122 |
|
122 | |||
123 | if (nb_norm_asm == nb_sm_before_f2.norm_asm) |
|
123 | // if (nb_norm_asm == nb_sm_before_f2.norm_asm) | |
124 | { |
|
124 | // { | |
125 | nb_norm_asm = 0; |
|
125 | // nb_norm_asm = 0; | |
126 | if ( lfrCurrentMode == LFR_MODE_NORMAL ) |
|
126 | // if ( lfrCurrentMode == LFR_MODE_NORMAL ) | |
127 | { |
|
127 | // { | |
128 | // PRINTF1("%lld\n", localTime) |
|
128 | //// PRINTF1("%lld\n", localTime) | |
129 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_ASM_F2; |
|
129 | // msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_ASM_F2; | |
130 | } |
|
130 | // } | |
131 | } |
|
131 | // } | |
132 |
|
132 | |||
133 | //************************* |
|
133 | // //************************* | |
134 | // send the message to MATR |
|
134 | // // send the message to MATR | |
135 | if (msgForMATR.event != 0x00) |
|
135 | // if (msgForMATR.event != 0x00) | |
136 | { |
|
136 | // { | |
137 | status = rtems_message_queue_send( queue_id_prc2, (char *) &msgForMATR, MSG_QUEUE_SIZE_PRC0); |
|
137 | // status = rtems_message_queue_send( queue_id_prc2, (char *) &msgForMATR, MSG_QUEUE_SIZE_PRC0); | |
138 | } |
|
138 | // } | |
139 |
|
139 | |||
140 | if (status != RTEMS_SUCCESSFUL) { |
|
140 | // if (status != RTEMS_SUCCESSFUL) { | |
141 | printf("in AVF2 *** Error sending message to MATR, code %d\n", status); |
|
141 | // printf("in AVF2 *** Error sending message to MATR, code %d\n", status); | |
142 | } |
|
142 | // } | |
143 | } |
|
143 | // } | |
144 | } |
|
144 | } | |
145 |
|
145 | |||
146 | rtems_task prc2_task( rtems_task_argument argument ) |
|
146 | rtems_task prc2_task( rtems_task_argument argument ) |
@@ -9,7 +9,6 typedef struct { | |||||
9 | unsigned int norm_asm; |
|
9 | unsigned int norm_asm; | |
10 | } nb_sm_before_bp_asm_f2; |
|
10 | } nb_sm_before_bp_asm_f2; | |
11 |
|
11 | |||
12 | extern struct ring_node_sm *current_ring_node_sm_f2; |
|
|||
13 | extern struct ring_node_sm *ring_node_for_averaging_sm_f2; |
|
12 | extern struct ring_node_sm *ring_node_for_averaging_sm_f2; | |
14 |
|
13 | |||
15 | extern rtems_status_code get_message_queue_id_prc2( rtems_id *queue_id ); |
|
14 | extern rtems_status_code get_message_queue_id_prc2( rtems_id *queue_id ); |
@@ -32,41 +32,41 ring_node_sm *ring_node_for_averaging_sm | |||||
32 |
|
32 | |||
33 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ) |
|
33 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ) | |
34 | { |
|
34 | { | |
35 | ring_node_sm *previous_ring_node_sm_f0; |
|
35 | // ring_node_sm *previous_ring_node_sm_f0; | |
36 |
|
36 | |||
37 | // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); |
|
37 | //// rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); | |
38 |
|
38 | |||
39 | previous_ring_node_sm_f0 = current_ring_node_sm_f0; |
|
39 | // previous_ring_node_sm_f0 = current_ring_node_sm_f0; | |
40 |
|
40 | |||
41 | if ( (spectral_matrix_regs->status & 0x2) == 0x02) // check ready matrix bit f0_1 |
|
41 | // if ( (spectral_matrix_regs->status & 0x2) == 0x02) // check ready matrix bit f0_1 | |
42 | { |
|
42 | // { | |
43 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; |
|
43 | // current_ring_node_sm_f0 = current_ring_node_sm_f0->next; | |
44 | spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address; |
|
44 | // spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address; | |
45 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd; // 1101 |
|
45 | // spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd; // 1101 | |
46 | nb_sm_f0 = nb_sm_f0 + 1; |
|
46 | // nb_sm_f0 = nb_sm_f0 + 1; | |
47 | } |
|
47 | // } | |
48 |
|
48 | |||
49 | //************************ |
|
49 | // //************************ | |
50 | // reset status error bits |
|
50 | // // reset status error bits | |
51 | if ( (spectral_matrix_regs->status & 0x30) != 0x00) |
|
51 | // if ( (spectral_matrix_regs->status & 0x30) != 0x00) | |
52 | { |
|
52 | // { | |
53 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); |
|
53 | // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); | |
54 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xffffffcf; // 1100 1111 |
|
54 | // spectral_matrix_regs->status = spectral_matrix_regs->status & 0xffffffcf; // 1100 1111 | |
55 | } |
|
55 | // } | |
56 |
|
56 | |||
57 | //************************************** |
|
57 | // //************************************** | |
58 | // reset ready matrix bits for f0_0, f1 and f2 |
|
58 | // // reset ready matrix bits for f0_0, f1 and f2 | |
59 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff2; // 0010 |
|
59 | // spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff2; // 0010 | |
60 |
|
60 | |||
61 | if (nb_sm_f0 == NB_SM_BEFORE_AVF0) |
|
61 | // if (nb_sm_f0 == NB_SM_BEFORE_AVF0) | |
62 | { |
|
62 | // { | |
63 | ring_node_for_averaging_sm_f0 = previous_ring_node_sm_f0; |
|
63 | // ring_node_for_averaging_sm_f0 = previous_ring_node_sm_f0; | |
64 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
64 | // if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |
65 | { |
|
65 | // { | |
66 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
66 | // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |
67 | } |
|
67 | // } | |
68 | nb_sm_f0 = 0; |
|
68 | // nb_sm_f0 = 0; | |
69 | } |
|
69 | // } | |
70 |
|
70 | |||
71 | } |
|
71 | } | |
72 |
|
72 | |||
@@ -105,16 +105,16 rtems_isr spectral_matrices_isr_simu( rt | |||||
105 |
|
105 | |||
106 | //*** |
|
106 | //*** | |
107 | // F2 |
|
107 | // F2 | |
108 | nb_sm_f0_aux_f2 = nb_sm_f0_aux_f2 + 1; |
|
108 | // nb_sm_f0_aux_f2 = nb_sm_f0_aux_f2 + 1; | |
109 | if (nb_sm_f0_aux_f2 == 96) |
|
109 | // if (nb_sm_f0_aux_f2 == 96) | |
110 | { |
|
110 | // { | |
111 | nb_sm_f0_aux_f2 = 0; |
|
111 | // nb_sm_f0_aux_f2 = 0; | |
112 | ring_node_for_averaging_sm_f2 = current_ring_node_sm_f2; |
|
112 | // ring_node_for_averaging_sm_f2 = current_ring_node_sm_f2; | |
113 | if (rtems_event_send( Task_id[TASKID_AVF2], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
113 | // if (rtems_event_send( Task_id[TASKID_AVF2], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |
114 | { |
|
114 | // { | |
115 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
115 | // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |
116 | } |
|
116 | // } | |
117 | } |
|
117 | // } | |
118 | } |
|
118 | } | |
119 |
|
119 | |||
120 | //****************** |
|
120 | //****************** | |
@@ -217,7 +217,9 void SM_reset_current_ring_nodes( void ) | |||||
217 | current_ring_node_sm_f1 = sm_ring_f1; |
|
217 | current_ring_node_sm_f1 = sm_ring_f1; | |
218 | current_ring_node_sm_f2 = sm_ring_f2; |
|
218 | current_ring_node_sm_f2 = sm_ring_f2; | |
219 |
|
219 | |||
220 |
ring_node_for_averaging_sm_f0 |
|
220 | ring_node_for_averaging_sm_f0 = sm_ring_f0; | |
|
221 | ring_node_for_averaging_sm_f1 = sm_ring_f1; | |||
|
222 | ring_node_for_averaging_sm_f2 = sm_ring_f2; | |||
221 | } |
|
223 | } | |
222 |
|
224 | |||
223 | void ASM_init_header( Header_TM_LFR_SCIENCE_ASM_t *header) |
|
225 | void ASM_init_header( Header_TM_LFR_SCIENCE_ASM_t *header) | |
@@ -252,46 +254,6 void ASM_init_header( Header_TM_LFR_SCIE | |||||
252 | header->pa_lfr_asm_blk_nr[1] = 0x00; // BLK_NR LSB |
|
254 | header->pa_lfr_asm_blk_nr[1] = 0x00; // BLK_NR LSB | |
253 | } |
|
255 | } | |
254 |
|
256 | |||
255 | void SM_average( float *averaged_spec_mat_f0, float *averaged_spec_mat_f1, |
|
|||
256 | ring_node_sm *ring_node_tab[], |
|
|||
257 | unsigned int nbAverageNormF0, unsigned int nbAverageSBM1F0 ) |
|
|||
258 | { |
|
|||
259 | float sum; |
|
|||
260 | unsigned int i; |
|
|||
261 |
|
||||
262 | for(i=0; i<TOTAL_SIZE_SM; i++) |
|
|||
263 | { |
|
|||
264 | sum = ( (int *) (ring_node_tab[0]->buffer_address) ) [ i ] |
|
|||
265 | + ( (int *) (ring_node_tab[1]->buffer_address) ) [ i ] |
|
|||
266 | + ( (int *) (ring_node_tab[2]->buffer_address) ) [ i ] |
|
|||
267 | + ( (int *) (ring_node_tab[3]->buffer_address) ) [ i ] |
|
|||
268 | + ( (int *) (ring_node_tab[4]->buffer_address) ) [ i ] |
|
|||
269 | + ( (int *) (ring_node_tab[5]->buffer_address) ) [ i ] |
|
|||
270 | + ( (int *) (ring_node_tab[6]->buffer_address) ) [ i ] |
|
|||
271 | + ( (int *) (ring_node_tab[7]->buffer_address) ) [ i ]; |
|
|||
272 |
|
||||
273 | if ( (nbAverageNormF0 == 0) && (nbAverageSBM1F0 == 0) ) |
|
|||
274 | { |
|
|||
275 | averaged_spec_mat_f0[ i ] = sum; |
|
|||
276 | averaged_spec_mat_f1[ i ] = sum; |
|
|||
277 | } |
|
|||
278 | else if ( (nbAverageNormF0 != 0) && (nbAverageSBM1F0 != 0) ) |
|
|||
279 | { |
|
|||
280 | averaged_spec_mat_f0[ i ] = ( averaged_spec_mat_f0[ i ] + sum ); |
|
|||
281 | averaged_spec_mat_f1[ i ] = ( averaged_spec_mat_f1[ i ] + sum ); |
|
|||
282 | } |
|
|||
283 | else if ( (nbAverageNormF0 != 0) && (nbAverageSBM1F0 == 0) ) |
|
|||
284 | { |
|
|||
285 | averaged_spec_mat_f0[ i ] = ( averaged_spec_mat_f0[ i ] + sum ); |
|
|||
286 | averaged_spec_mat_f1[ i ] = sum; |
|
|||
287 | } |
|
|||
288 | else |
|
|||
289 | { |
|
|||
290 | PRINTF2("ERR *** in SM_average *** unexpected parameters %d %d\n", nbAverageNormF0, nbAverageSBM1F0) |
|
|||
291 | } |
|
|||
292 | } |
|
|||
293 | } |
|
|||
294 |
|
||||
295 | void ASM_reorganize_and_divide( float *averaged_spec_mat, float *averaged_spec_mat_reorganized, float divider ) |
|
257 | void ASM_reorganize_and_divide( float *averaged_spec_mat, float *averaged_spec_mat_reorganized, float divider ) | |
296 | { |
|
258 | { | |
297 | int frequencyBin; |
|
259 | int frequencyBin; |
@@ -74,9 +74,6 void SM_init_rings( void ); | |||||
74 | void ASM_generic_init_ring(ring_node_asm *ring, unsigned char nbNodes ); |
|
74 | void ASM_generic_init_ring(ring_node_asm *ring, unsigned char nbNodes ); | |
75 | void SM_reset_current_ring_nodes( void ); |
|
75 | void SM_reset_current_ring_nodes( void ); | |
76 | void ASM_init_header( Header_TM_LFR_SCIENCE_ASM_t *header); |
|
76 | void ASM_init_header( Header_TM_LFR_SCIENCE_ASM_t *header); | |
77 | void SM_average(float *averaged_spec_mat_f0, float *averaged_spec_mat_f1, |
|
|||
78 | ring_node_sm *ring_node_tab[], |
|
|||
79 | unsigned int firstTimeF0, unsigned int firstTimeF1 ); |
|
|||
80 | void ASM_reorganize_and_divide(float *averaged_spec_mat, float *averaged_spec_mat_reorganized, |
|
77 | void ASM_reorganize_and_divide(float *averaged_spec_mat, float *averaged_spec_mat_reorganized, | |
81 | float divider ); |
|
78 | float divider ); | |
82 | void ASM_compress_reorganize_and_divide(float *averaged_spec_mat, float *compressed_spec_mat, |
|
79 | void ASM_compress_reorganize_and_divide(float *averaged_spec_mat, float *compressed_spec_mat, |
@@ -547,20 +547,20 int start_all_tasks( void ) // start all | |||||
547 | BOOT_PRINTF("in INIT *** Error starting TASK_PRC1\n") |
|
547 | BOOT_PRINTF("in INIT *** Error starting TASK_PRC1\n") | |
548 | } |
|
548 | } | |
549 | } |
|
549 | } | |
550 | if (status == RTEMS_SUCCESSFUL) // AVF2 |
|
550 | // if (status == RTEMS_SUCCESSFUL) // AVF2 | |
551 | { |
|
551 | // { | |
552 | status = rtems_task_start( Task_id[TASKID_AVF2], avf2_task, 1 ); |
|
552 | // status = rtems_task_start( Task_id[TASKID_AVF2], avf2_task, 1 ); | |
553 | if (status!=RTEMS_SUCCESSFUL) { |
|
553 | // if (status!=RTEMS_SUCCESSFUL) { | |
554 | BOOT_PRINTF("in INIT *** Error starting TASK_AVF2\n") |
|
554 | // BOOT_PRINTF("in INIT *** Error starting TASK_AVF2\n") | |
555 | } |
|
555 | // } | |
556 | } |
|
556 | // } | |
557 | if (status == RTEMS_SUCCESSFUL) // PRC2 |
|
557 | // if (status == RTEMS_SUCCESSFUL) // PRC2 | |
558 | { |
|
558 | // { | |
559 | status = rtems_task_start( Task_id[TASKID_PRC2], prc2_task, 1 ); |
|
559 | // status = rtems_task_start( Task_id[TASKID_PRC2], prc2_task, 1 ); | |
560 | if (status!=RTEMS_SUCCESSFUL) { |
|
560 | // if (status!=RTEMS_SUCCESSFUL) { | |
561 | BOOT_PRINTF("in INIT *** Error starting TASK_PRC2\n") |
|
561 | // BOOT_PRINTF("in INIT *** Error starting TASK_PRC2\n") | |
562 | } |
|
562 | // } | |
563 | } |
|
563 | // } | |
564 |
|
564 | |||
565 | //**************** |
|
565 | //**************** | |
566 | // WAVEFORM PICKER |
|
566 | // WAVEFORM PICKER |
@@ -628,23 +628,22 int restart_science_tasks(unsigned char | |||||
628 | PRINTF1("in restart_science_task *** PRC1 ERR %d\n", status[7]) |
|
628 | PRINTF1("in restart_science_task *** PRC1 ERR %d\n", status[7]) | |
629 | } |
|
629 | } | |
630 |
|
630 | |||
631 | status[8] = rtems_task_restart( Task_id[TASKID_AVF2], 1 ); |
|
631 | // status[8] = rtems_task_restart( Task_id[TASKID_AVF2], 1 ); | |
632 | if (status[8] != RTEMS_SUCCESSFUL) |
|
632 | // if (status[8] != RTEMS_SUCCESSFUL) | |
633 | { |
|
633 | // { | |
634 | PRINTF1("in restart_science_task *** AVF2 ERR %d\n", status[8]) |
|
634 | // PRINTF1("in restart_science_task *** AVF2 ERR %d\n", status[8]) | |
635 | } |
|
635 | // } | |
636 |
|
636 | |||
637 | status[9] = rtems_task_restart( Task_id[TASKID_PRC2], 1 ); |
|
637 | // status[9] = rtems_task_restart( Task_id[TASKID_PRC2], 1 ); | |
638 | if (status[9] != RTEMS_SUCCESSFUL) |
|
638 | // if (status[9] != RTEMS_SUCCESSFUL) | |
639 | { |
|
639 | // { | |
640 | PRINTF1("in restart_science_task *** PRC2 ERR %d\n", status[9]) |
|
640 | // PRINTF1("in restart_science_task *** PRC2 ERR %d\n", status[9]) | |
641 | } |
|
641 | // } | |
642 |
|
642 | |||
643 | if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) || |
|
643 | if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) || | |
644 | (status[2] != RTEMS_SUCCESSFUL) || (status[3] != RTEMS_SUCCESSFUL) || |
|
644 | (status[2] != RTEMS_SUCCESSFUL) || (status[3] != RTEMS_SUCCESSFUL) || | |
645 | (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) || |
|
645 | (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) || | |
646 |
(status[6] != RTEMS_SUCCESSFUL) || (status[7] != RTEMS_SUCCESSFUL) |
|
646 | (status[6] != RTEMS_SUCCESSFUL) || (status[7] != RTEMS_SUCCESSFUL) ) | |
647 | (status[8] != RTEMS_SUCCESSFUL) || (status[9] != RTEMS_SUCCESSFUL)) |
|
|||
648 | { |
|
647 | { | |
649 | ret = RTEMS_UNSATISFIED; |
|
648 | ret = RTEMS_UNSATISFIED; | |
650 | } |
|
649 | } | |
@@ -694,22 +693,22 int suspend_science_tasks() | |||||
694 | PRINTF1("in suspend_science_task *** PRC1 ERR %d\n", status) |
|
693 | PRINTF1("in suspend_science_task *** PRC1 ERR %d\n", status) | |
695 | } |
|
694 | } | |
696 | } |
|
695 | } | |
697 | if (status == RTEMS_SUCCESSFUL) // suspend AVF2 |
|
696 | // if (status == RTEMS_SUCCESSFUL) // suspend AVF2 | |
698 | { |
|
697 | // { | |
699 | status = rtems_task_suspend( Task_id[TASKID_AVF2] ); |
|
698 | // status = rtems_task_suspend( Task_id[TASKID_AVF2] ); | |
700 | if (status != RTEMS_SUCCESSFUL) |
|
699 | // if (status != RTEMS_SUCCESSFUL) | |
701 | { |
|
700 | // { | |
702 | PRINTF1("in suspend_science_task *** AVF2 ERR %d\n", status) |
|
701 | // PRINTF1("in suspend_science_task *** AVF2 ERR %d\n", status) | |
703 | } |
|
702 | // } | |
704 | } |
|
703 | // } | |
705 | if (status == RTEMS_SUCCESSFUL) // suspend PRC2 |
|
704 | // if (status == RTEMS_SUCCESSFUL) // suspend PRC2 | |
706 | { |
|
705 | // { | |
707 | status = rtems_task_suspend( Task_id[TASKID_PRC2] ); |
|
706 | // status = rtems_task_suspend( Task_id[TASKID_PRC2] ); | |
708 | if (status != RTEMS_SUCCESSFUL) |
|
707 | // if (status != RTEMS_SUCCESSFUL) | |
709 | { |
|
708 | // { | |
710 | PRINTF1("in suspend_science_task *** PRC2 ERR %d\n", status) |
|
709 | // PRINTF1("in suspend_science_task *** PRC2 ERR %d\n", status) | |
711 | } |
|
710 | // } | |
712 | } |
|
711 | // } | |
713 | if (status == RTEMS_SUCCESSFUL) // suspend WFRM |
|
712 | if (status == RTEMS_SUCCESSFUL) // suspend WFRM | |
714 | { |
|
713 | { | |
715 | status = rtems_task_suspend( Task_id[TASKID_WFRM] ); |
|
714 | status = rtems_task_suspend( Task_id[TASKID_WFRM] ); |
General Comments 0
You need to be logged in to leave comments.
Login now