@@ -1,6 +1,6 | |||
|
1 | 1 | ############################################################################# |
|
2 | 2 | # Makefile for building: bin/fsw |
|
3 |
# Generated by qmake (2.01a) (Qt 4.8.6) on: Mon Jun 16 |
|
|
3 | # Generated by qmake (2.01a) (Qt 4.8.6) on: Mon Jun 16 15:44:22 2014 | |
|
4 | 4 | # Project: fsw-qt.pro |
|
5 | 5 | # Template: app |
|
6 | 6 | # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro |
@@ -1,6 +1,6 | |||
|
1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
|
2 | 2 | <!DOCTYPE QtCreatorProject> |
|
3 |
<!-- Written by QtCreator 3.0.1, 2014-06-16T |
|
|
3 | <!-- Written by QtCreator 3.0.1, 2014-06-16T15:53:55. --> | |
|
4 | 4 | <qtcreator> |
|
5 | 5 | <data> |
|
6 | 6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
@@ -90,20 +90,20 typedef struct { | |||
|
90 | 90 | volatile int f2_0_address; // 0x18 |
|
91 | 91 | volatile int f2_1_address; // 0x1C |
|
92 | 92 | // |
|
93 | volatile int f0_0_coarse_time; // 0x20 | |
|
94 | volatile int f0_0_fine_time; // 0x24 | |
|
95 | volatile int f0_1_coarse_time; // 0x28 | |
|
96 | volatile int f0_1_fine_time; // 0x2C | |
|
93 | volatile unsigned int f0_0_coarse_time; // 0x20 | |
|
94 | volatile unsigned int f0_0_fine_time; // 0x24 | |
|
95 | volatile unsigned int f0_1_coarse_time; // 0x28 | |
|
96 | volatile unsigned int f0_1_fine_time; // 0x2C | |
|
97 | 97 | // |
|
98 | volatile int f1_0_coarse_time; // 0x30 | |
|
99 | volatile int f1_0_fine_time; // 0x34 | |
|
100 | volatile int f1_1_coarse_time; // 0x38 | |
|
101 | volatile int f1_1_time_time; // 0x3C | |
|
98 | volatile unsigned int f1_0_coarse_time; // 0x30 | |
|
99 | volatile unsigned int f1_0_fine_time; // 0x34 | |
|
100 | volatile unsigned int f1_1_coarse_time; // 0x38 | |
|
101 | volatile unsigned int f1_1_time_time; // 0x3C | |
|
102 | 102 | // |
|
103 | volatile int f2_0_coarse_time; // 0x40 | |
|
104 | volatile int f2_0_fine_time; // 0x44 | |
|
105 | volatile int f2_1_coarse_time; // 0x48 | |
|
106 |
volatile int f2_1_ |
|
|
103 | volatile unsigned int f2_0_coarse_time; // 0x40 | |
|
104 | volatile unsigned int f2_0_fine_time; // 0x44 | |
|
105 | volatile unsigned int f2_1_coarse_time; // 0x48 | |
|
106 | volatile unsigned int f2_1_fine_time; // 0x4C | |
|
107 | 107 | } spectral_matrix_regs_t; |
|
108 | 108 | |
|
109 | 109 | #endif // GRLIB_REGS_H_INCLUDED |
@@ -30,7 +30,7 void reset_nb_sm_f0( unsigned char lfrMo | |||
|
30 | 30 | |
|
31 | 31 | //******* |
|
32 | 32 | // EXTERN |
|
33 |
extern |
|
|
33 | extern ring_node_sm *ring_node_for_averaging_sm_f0; | |
|
34 | 34 | extern rtems_status_code get_message_queue_id_prc0( rtems_id *queue_id ); |
|
35 | 35 | |
|
36 | 36 | #endif // AVF0_PRC0_H_INCLUDED |
@@ -100,7 +100,7 void reset_spectral_matrix_regs( void ); | |||
|
100 | 100 | void set_time(unsigned char *time, unsigned char *timeInBuffer ); |
|
101 | 101 | unsigned long long int get_acquisition_time( unsigned char *timePtr ); |
|
102 | 102 | void close_matrix_actions(unsigned int *nb_sm, unsigned int nb_sm_before_avf, rtems_id task_id, |
|
103 | ring_node_sm *node_for_averaging, ring_node_sm *ringNode); | |
|
103 | ring_node_sm *node_for_averaging, ring_node_sm *ringNode, unsigned long long int time); | |
|
104 | 104 | unsigned char getSID( rtems_event_set event ); |
|
105 | 105 | |
|
106 | 106 | extern rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id ); |
@@ -108,9 +108,9 extern rtems_status_code get_message_que | |||
|
108 | 108 | |
|
109 | 109 | //*************************************** |
|
110 | 110 | // DEFINITIONS OF STATIC INLINE FUNCTIONS |
|
111 |
static inline void SM_average( float *averaged_spec_mat_ |
|
|
111 | static inline void SM_average( float *averaged_spec_mat_NORM, float *averaged_spec_mat_SBM, | |
|
112 | 112 | ring_node_sm *ring_node_tab[], |
|
113 |
unsigned int nbAverageN |
|
|
113 | unsigned int nbAverageNORM, unsigned int nbAverageSBM ); | |
|
114 | 114 | static inline void ASM_reorganize_and_divide(float *averaged_spec_mat, float *averaged_spec_mat_reorganized, |
|
115 | 115 | float divider ); |
|
116 | 116 | static inline void ASM_compress_reorganize_and_divide(float *averaged_spec_mat, float *compressed_spec_mat, |
@@ -118,9 +118,9 static inline void ASM_compress_reorgani | |||
|
118 | 118 | unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage , unsigned char ASMIndexStart); |
|
119 | 119 | static inline void ASM_convert(volatile float *input_matrix, char *output_matrix); |
|
120 | 120 | |
|
121 |
void SM_average( float *averaged_spec_mat_ |
|
|
121 | void SM_average( float *averaged_spec_mat_NORM, float *averaged_spec_mat_SBM, | |
|
122 | 122 | ring_node_sm *ring_node_tab[], |
|
123 |
unsigned int nbAverageN |
|
|
123 | unsigned int nbAverageNORM, unsigned int nbAverageSBM ) | |
|
124 | 124 | { |
|
125 | 125 | float sum; |
|
126 | 126 | unsigned int i; |
@@ -136,24 +136,24 void SM_average( float *averaged_spec_ma | |||
|
136 | 136 | + ( (int *) (ring_node_tab[6]->buffer_address) ) [ i ] |
|
137 | 137 | + ( (int *) (ring_node_tab[7]->buffer_address) ) [ i ]; |
|
138 | 138 | |
|
139 |
if ( (nbAverageN |
|
|
139 | if ( (nbAverageNORM == 0) && (nbAverageSBM == 0) ) | |
|
140 | 140 | { |
|
141 |
averaged_spec_mat_ |
|
|
142 |
averaged_spec_mat_ |
|
|
141 | averaged_spec_mat_NORM[ i ] = sum; | |
|
142 | averaged_spec_mat_SBM[ i ] = sum; | |
|
143 | 143 | } |
|
144 |
else if ( (nbAverageN |
|
|
144 | else if ( (nbAverageNORM != 0) && (nbAverageSBM != 0) ) | |
|
145 | 145 | { |
|
146 |
averaged_spec_mat_ |
|
|
147 |
averaged_spec_mat_ |
|
|
146 | averaged_spec_mat_NORM[ i ] = ( averaged_spec_mat_NORM[ i ] + sum ); | |
|
147 | averaged_spec_mat_SBM[ i ] = ( averaged_spec_mat_SBM[ i ] + sum ); | |
|
148 | 148 | } |
|
149 |
else if ( (nbAverageN |
|
|
149 | else if ( (nbAverageNORM != 0) && (nbAverageSBM == 0) ) | |
|
150 | 150 | { |
|
151 |
averaged_spec_mat_ |
|
|
152 |
averaged_spec_mat_ |
|
|
151 | averaged_spec_mat_NORM[ i ] = ( averaged_spec_mat_NORM[ i ] + sum ); | |
|
152 | averaged_spec_mat_SBM[ i ] = sum; | |
|
153 | 153 | } |
|
154 | 154 | else |
|
155 | 155 | { |
|
156 |
PRINTF2("ERR *** in SM_average *** unexpected parameters %d %d\n", nbAverageN |
|
|
156 | PRINTF2("ERR *** in SM_average *** unexpected parameters %d %d\n", nbAverageNORM, nbAverageSBM) | |
|
157 | 157 | } |
|
158 | 158 | } |
|
159 | 159 | } |
@@ -259,16 +259,18 rtems_task dumb_task( rtems_task_argumen | |||
|
259 | 259 | unsigned int fine_time = 0; |
|
260 | 260 | rtems_event_set event_out; |
|
261 | 261 | |
|
262 |
char *DumbMessages[1 |
|
|
262 | char *DumbMessages[12] = {"in DUMB *** default", // RTEMS_EVENT_0 | |
|
263 | 263 | "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1 |
|
264 |
"in DUMB *** f3 buffer changed", |
|
|
264 | "in DUMB *** f3 buffer changed", // RTEMS_EVENT_2 | |
|
265 | 265 | "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3 |
|
266 | 266 | "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4 |
|
267 | 267 | "in DUMB *** waveforms_simulator_isr", // RTEMS_EVENT_5 |
|
268 | 268 | "ERR HK", // RTEMS_EVENT_6 |
|
269 | 269 | "ready for dump", // RTEMS_EVENT_7 |
|
270 |
" |
|
|
271 |
"tick" |
|
|
270 | "VHDL ERR *** spectral matrix", // RTEMS_EVENT_8 | |
|
271 | "tick", // RTEMS_EVENT_9 | |
|
272 | "VHDL ERR *** waveform picker", // RTEMS_EVENT_10 | |
|
273 | "VHDL ERR *** unexpected ready matrix values" // RTEMS_EVENT_11 | |
|
272 | 274 | }; |
|
273 | 275 | |
|
274 | 276 | BOOT_PRINTF("in DUMB *** \n") |
@@ -288,7 +290,11 rtems_task dumb_task( rtems_task_argumen | |||
|
288 | 290 | printf("in DUMB *** coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]); |
|
289 | 291 | if (i==8) |
|
290 | 292 | { |
|
291 | PRINTF1("status = %x\n", spectral_matrix_regs->status) | |
|
293 | PRINTF1("spectral_matrix_regs->status = %x\n", spectral_matrix_regs->status) | |
|
294 | } | |
|
295 | if (i==10) | |
|
296 | { | |
|
297 | PRINTF1("waveform_picker_regs->status = %x\n", waveform_picker_regs->status) | |
|
292 | 298 | } |
|
293 | 299 | } |
|
294 | 300 | } |
@@ -67,6 +67,17 rtems_task avf0_task( rtems_task_argumen | |||
|
67 | 67 | |
|
68 | 68 | while(1){ |
|
69 | 69 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
70 | ||
|
71 | //**************************************** | |
|
72 | // initialize the mesage for the MATR task | |
|
73 | msgForMATR.norm = current_ring_node_asm_norm_f0; | |
|
74 | msgForMATR.burst_sbm = current_ring_node_asm_burst_sbm_f0; | |
|
75 | msgForMATR.event = 0x00; // this composite event will be sent to the MATR task | |
|
76 | msgForMATR.coarseTime = ring_node_for_averaging_sm_f0->coarseTime; | |
|
77 | msgForMATR.fineTime = ring_node_for_averaging_sm_f0->fineTime; | |
|
78 | // | |
|
79 | //**************************************** | |
|
80 | ||
|
70 | 81 | ring_node_tab[NB_SM_BEFORE_AVF0-1] = ring_node_for_averaging_sm_f0; |
|
71 | 82 | for ( i = 2; i < (NB_SM_BEFORE_AVF0+1); i++ ) |
|
72 | 83 | { |
@@ -87,16 +98,6 rtems_task avf0_task( rtems_task_argumen | |||
|
87 | 98 | nb_sbm_bp1 = nb_sbm_bp1 + NB_SM_BEFORE_AVF0; |
|
88 | 99 | nb_sbm_bp2 = nb_sbm_bp2 + NB_SM_BEFORE_AVF0; |
|
89 | 100 | |
|
90 | //**************************************** | |
|
91 | // initialize the mesage for the MATR task | |
|
92 | msgForMATR.event = 0x00; // this composite event will be sent to the MATR task | |
|
93 | msgForMATR.burst_sbm = current_ring_node_asm_burst_sbm_f0; | |
|
94 | msgForMATR.norm = current_ring_node_asm_norm_f0; | |
|
95 | // msgForMATR.coarseTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[0]; | |
|
96 | // msgForMATR.fineTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[1]; | |
|
97 | msgForMATR.coarseTime = time_management_regs->coarse_time; | |
|
98 | msgForMATR.fineTime = time_management_regs->fine_time; | |
|
99 | ||
|
100 | 101 | if (nb_sbm_bp1 == nb_sm_before_f0.burst_sbm_bp1) |
|
101 | 102 | { |
|
102 | 103 | nb_sbm_bp1 = 0; |
@@ -349,7 +350,7 void reset_nb_sm_f0( unsigned char lfrMo | |||
|
349 | 350 | nb_sm_before_f0.norm_bp1 = parameter_dump_packet.sy_lfr_n_bp_p0 * 96; |
|
350 | 351 | nb_sm_before_f0.norm_bp2 = parameter_dump_packet.sy_lfr_n_bp_p1 * 96; |
|
351 | 352 | nb_sm_before_f0.norm_asm = (parameter_dump_packet.sy_lfr_n_asm_p[0] * 256 + parameter_dump_packet.sy_lfr_n_asm_p[1]) * 96; |
|
352 | nb_sm_before_f0.sbm1_bp1 = parameter_dump_packet.sy_lfr_s1_bp_p0 * 24; | |
|
353 | nb_sm_before_f0.sbm1_bp1 = parameter_dump_packet.sy_lfr_s1_bp_p0 * 24; // 0.25 s per digit | |
|
353 | 354 | nb_sm_before_f0.sbm1_bp2 = parameter_dump_packet.sy_lfr_s1_bp_p1 * 96; |
|
354 | 355 | nb_sm_before_f0.sbm2_bp1 = parameter_dump_packet.sy_lfr_s2_bp_p0 * 96; |
|
355 | 356 | nb_sm_before_f0.sbm2_bp2 = parameter_dump_packet.sy_lfr_s2_bp_p1 * 96; |
@@ -64,6 +64,17 rtems_task avf1_task( rtems_task_argumen | |||
|
64 | 64 | |
|
65 | 65 | while(1){ |
|
66 | 66 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
67 | ||
|
68 | //**************************************** | |
|
69 | // initialize the mesage for the MATR task | |
|
70 | msgForMATR.event = 0x00; // this composite event will be sent to the PRC1 task | |
|
71 | msgForMATR.burst_sbm = current_ring_node_asm_burst_sbm_f1; | |
|
72 | msgForMATR.norm = current_ring_node_asm_norm_f1; | |
|
73 | msgForMATR.coarseTime = ring_node_for_averaging_sm_f1->coarseTime; | |
|
74 | msgForMATR.fineTime = ring_node_for_averaging_sm_f1->fineTime; | |
|
75 | // | |
|
76 | //**************************************** | |
|
77 | ||
|
67 | 78 | ring_node_tab[NB_SM_BEFORE_AVF1-1] = ring_node_for_averaging_sm_f1; |
|
68 | 79 | for ( i = 2; i < (NB_SM_BEFORE_AVF1+1); i++ ) |
|
69 | 80 | { |
@@ -84,16 +95,6 rtems_task avf1_task( rtems_task_argumen | |||
|
84 | 95 | nb_sbm_bp1 = nb_sbm_bp1 + NB_SM_BEFORE_AVF1; |
|
85 | 96 | nb_sbm_bp2 = nb_sbm_bp2 + NB_SM_BEFORE_AVF1; |
|
86 | 97 | |
|
87 | //**************************************** | |
|
88 | // initialize the mesage for the MATR task | |
|
89 | msgForMATR.event = 0x00; // this composite event will be sent to the PRC1 task | |
|
90 | msgForMATR.burst_sbm = current_ring_node_asm_burst_sbm_f1; | |
|
91 | msgForMATR.norm = current_ring_node_asm_norm_f1; | |
|
92 | // msgForMATR.coarseTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[0]; | |
|
93 | // msgForMATR.fineTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[1]; | |
|
94 | msgForMATR.coarseTime = time_management_regs->coarse_time; | |
|
95 | msgForMATR.fineTime = time_management_regs->fine_time; | |
|
96 | ||
|
97 | 98 | if (nb_sbm_bp1 == nb_sm_before_f1.burst_sbm_bp1) |
|
98 | 99 | { |
|
99 | 100 | nb_sbm_bp1 = 0; |
@@ -57,6 +57,16 rtems_task avf2_task( rtems_task_argumen | |||
|
57 | 57 | while(1){ |
|
58 | 58 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
59 | 59 | |
|
60 | //**************************************** | |
|
61 | // initialize the mesage for the MATR task | |
|
62 | msgForMATR.event = 0x00; // this composite event will be sent to the MATR task | |
|
63 | msgForMATR.burst_sbm = NULL; | |
|
64 | msgForMATR.norm = current_ring_node_asm_norm_f2; | |
|
65 | msgForMATR.coarseTime = ring_node_for_averaging_sm_f2->coarseTime; | |
|
66 | msgForMATR.fineTime = ring_node_for_averaging_sm_f2->fineTime; | |
|
67 | // | |
|
68 | //**************************************** | |
|
69 | ||
|
60 | 70 | // compute the average and store it in the averaged_sm_f2 buffer |
|
61 | 71 | SM_average_f2( current_ring_node_asm_norm_f2->matrix, |
|
62 | 72 | ring_node_for_averaging_sm_f2, |
@@ -67,16 +77,6 rtems_task avf2_task( rtems_task_argumen | |||
|
67 | 77 | nb_norm_bp2 = nb_norm_bp2 + NB_SM_BEFORE_AVF2; |
|
68 | 78 | nb_norm_asm = nb_norm_asm + NB_SM_BEFORE_AVF2; |
|
69 | 79 | |
|
70 | //**************************************** | |
|
71 | // initialize the mesage for the MATR task | |
|
72 | msgForMATR.event = 0x00; // this composite event will be sent to the MATR task | |
|
73 | msgForMATR.burst_sbm = NULL; | |
|
74 | msgForMATR.norm = current_ring_node_asm_norm_f2; | |
|
75 | // msgForMATR.coarseTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[0]; | |
|
76 | // msgForMATR.fineTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[1]; | |
|
77 | msgForMATR.coarseTime = time_management_regs->coarse_time; | |
|
78 | msgForMATR.fineTime = time_management_regs->fine_time; | |
|
79 | ||
|
80 | 80 | if (nb_norm_bp1 == nb_sm_before_f2.norm_bp1) |
|
81 | 81 | { |
|
82 | 82 | nb_norm_bp1 = 0; |
@@ -35,44 +35,55 void spectral_matrices_isr_f0( void ) | |||
|
35 | 35 | unsigned char status; |
|
36 | 36 | unsigned long long int time_0; |
|
37 | 37 | unsigned long long int time_1; |
|
38 | unsigned long long int syncBit0; | |
|
39 | unsigned long long int syncBit1; | |
|
38 | 40 | |
|
39 | 41 | status = spectral_matrix_regs->status & 0x03; // [0011] get the status_ready_matrix_f0_x bits |
|
40 | 42 | |
|
43 | time_0 = get_acquisition_time( (unsigned char *) &spectral_matrix_regs->f0_0_coarse_time ); | |
|
44 | time_1 = get_acquisition_time( (unsigned char *) &spectral_matrix_regs->f0_1_coarse_time ); | |
|
45 | syncBit0 = ( (unsigned long long int) (spectral_matrix_regs->f0_0_coarse_time & 0x80000000) ) << 16; | |
|
46 | syncBit1 = ( (unsigned long long int) (spectral_matrix_regs->f0_1_coarse_time & 0x80000000) ) << 16; | |
|
47 | ||
|
41 | 48 | switch(status) |
|
42 | 49 | { |
|
43 | 50 | case 0: |
|
44 | 51 | break; |
|
45 | 52 | case 3: |
|
46 | time_0 = get_acquisition_time( (unsigned char *) spectral_matrix_regs->f0_0_coarse_time ); | |
|
47 | time_1 = get_acquisition_time( (unsigned char *) spectral_matrix_regs->f0_1_coarse_time ); | |
|
48 | 53 | if ( time_0 < time_1 ) |
|
49 | 54 | { |
|
50 |
close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], |
|
|
55 | close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], | |
|
56 | ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_0 | syncBit0); | |
|
51 | 57 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; |
|
52 | 58 | spectral_matrix_regs->f0_0_address = current_ring_node_sm_f0->buffer_address; |
|
53 |
close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], |
|
|
59 | close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], | |
|
60 | ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_1 | syncBit1); | |
|
54 | 61 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; |
|
55 | 62 | spectral_matrix_regs->f0_1_address = current_ring_node_sm_f0->buffer_address; |
|
56 | 63 | } |
|
57 | 64 | else |
|
58 | 65 | { |
|
59 |
close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], |
|
|
66 | close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], | |
|
67 | ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_1 | syncBit1); | |
|
60 | 68 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; |
|
61 | 69 | spectral_matrix_regs->f0_1_address = current_ring_node_sm_f0->buffer_address; |
|
62 |
close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], |
|
|
70 | close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], | |
|
71 | ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_0 | syncBit0); | |
|
63 | 72 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; |
|
64 | 73 | spectral_matrix_regs->f0_0_address = current_ring_node_sm_f0->buffer_address; |
|
65 | 74 | } |
|
66 | 75 | spectral_matrix_regs->status = 0x03; // [0011] |
|
67 | 76 | break; |
|
68 | 77 | case 1: |
|
69 |
close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], |
|
|
78 | close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], | |
|
79 | ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_0 | syncBit0); | |
|
70 | 80 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; |
|
71 | 81 | spectral_matrix_regs->f0_0_address = current_ring_node_sm_f0->buffer_address; |
|
72 | 82 | spectral_matrix_regs->status = 0x01; // [0001] |
|
73 | 83 | break; |
|
74 | 84 | case 2: |
|
75 |
close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], |
|
|
85 | close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], | |
|
86 | ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_1 | syncBit1); | |
|
76 | 87 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; |
|
77 | 88 | spectral_matrix_regs->f0_1_address = current_ring_node_sm_f0->buffer_address; |
|
78 | 89 | spectral_matrix_regs->status = 0x02; // [0010] |
@@ -83,8 +94,8 void spectral_matrices_isr_f0( void ) | |||
|
83 | 94 | void spectral_matrices_isr_f1( void ) |
|
84 | 95 | { |
|
85 | 96 | unsigned char status; |
|
86 |
unsigned long long int time |
|
|
87 |
unsigned long long int t |
|
|
97 | unsigned long long int time; | |
|
98 | unsigned long long int syncBit; | |
|
88 | 99 | |
|
89 | 100 | status = (spectral_matrix_regs->status & 0x0c) >> 2; // [1100] get the status_ready_matrix_f0_x bits |
|
90 | 101 | |
@@ -93,36 +104,24 void spectral_matrices_isr_f1( void ) | |||
|
93 | 104 | case 0: |
|
94 | 105 | break; |
|
95 | 106 | case 3: |
|
96 | time_0 = get_acquisition_time( (unsigned char *) spectral_matrix_regs->f1_0_coarse_time ); | |
|
97 | time_1 = get_acquisition_time( (unsigned char *) spectral_matrix_regs->f1_1_coarse_time ); | |
|
98 | if ( time_0 < time_1 ) | |
|
99 | { | |
|
100 | close_matrix_actions( &nb_sm_f1, NB_SM_BEFORE_AVF1, Task_id[TASKID_AVF1], ring_node_for_averaging_sm_f1, current_ring_node_sm_f1->previous); | |
|
101 | current_ring_node_sm_f1 = current_ring_node_sm_f1->next; | |
|
102 | spectral_matrix_regs->f1_0_address = current_ring_node_sm_f1->buffer_address; | |
|
103 | close_matrix_actions( &nb_sm_f1, NB_SM_BEFORE_AVF1, Task_id[TASKID_AVF1], ring_node_for_averaging_sm_f1, current_ring_node_sm_f1->previous); | |
|
104 | current_ring_node_sm_f1 = current_ring_node_sm_f1->next; | |
|
105 | spectral_matrix_regs->f1_1_address = current_ring_node_sm_f1->buffer_address; | |
|
106 | } | |
|
107 | else | |
|
108 | { | |
|
109 | close_matrix_actions( &nb_sm_f1, NB_SM_BEFORE_AVF1, Task_id[TASKID_AVF1], ring_node_for_averaging_sm_f1, current_ring_node_sm_f1->previous); | |
|
110 | current_ring_node_sm_f1 = current_ring_node_sm_f1->next; | |
|
111 | spectral_matrix_regs->f1_1_address = current_ring_node_sm_f1->buffer_address; | |
|
112 | close_matrix_actions( &nb_sm_f1, NB_SM_BEFORE_AVF1, Task_id[TASKID_AVF1], ring_node_for_averaging_sm_f1, current_ring_node_sm_f1->previous); | |
|
113 | current_ring_node_sm_f1 = current_ring_node_sm_f1->next; | |
|
114 | spectral_matrix_regs->f1_0_address = current_ring_node_sm_f1->buffer_address; | |
|
115 | } | |
|
116 | spectral_matrix_regs->status = 0x0c; // [1100] | |
|
107 | // UNEXPECTED VALUE | |
|
108 | spectral_matrix_regs->status = 0xc0; // [1100] | |
|
109 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_11 ); | |
|
117 | 110 | break; |
|
118 | 111 | case 1: |
|
119 | close_matrix_actions( &nb_sm_f1, NB_SM_BEFORE_AVF1, Task_id[TASKID_AVF1], ring_node_for_averaging_sm_f1, current_ring_node_sm_f1->previous); | |
|
112 | time = get_acquisition_time( (unsigned char *) &spectral_matrix_regs->f1_0_coarse_time ); | |
|
113 | syncBit = ( (unsigned long long int) (spectral_matrix_regs->f1_0_coarse_time & 0x80000000) ) << 16; | |
|
114 | close_matrix_actions( &nb_sm_f1, NB_SM_BEFORE_AVF1, Task_id[TASKID_AVF1], | |
|
115 | ring_node_for_averaging_sm_f1, current_ring_node_sm_f1, time | syncBit); | |
|
120 | 116 | current_ring_node_sm_f1 = current_ring_node_sm_f1->next; |
|
121 | 117 | spectral_matrix_regs->f1_0_address = current_ring_node_sm_f1->buffer_address; |
|
122 | 118 | spectral_matrix_regs->status = 0x04; // [0100] |
|
123 | 119 | break; |
|
124 | 120 | case 2: |
|
125 | close_matrix_actions( &nb_sm_f1, NB_SM_BEFORE_AVF1, Task_id[TASKID_AVF1], ring_node_for_averaging_sm_f1, current_ring_node_sm_f1->previous); | |
|
121 | time = get_acquisition_time( (unsigned char *) &spectral_matrix_regs->f1_1_coarse_time ); | |
|
122 | syncBit = ( (unsigned long long int) (spectral_matrix_regs->f1_1_coarse_time & 0x80000000) ) << 16; | |
|
123 | close_matrix_actions( &nb_sm_f1, NB_SM_BEFORE_AVF1, Task_id[TASKID_AVF1], | |
|
124 | ring_node_for_averaging_sm_f1, current_ring_node_sm_f1, time | syncBit); | |
|
126 | 125 | current_ring_node_sm_f1 = current_ring_node_sm_f1->next; |
|
127 | 126 | spectral_matrix_regs->f1_1_address = current_ring_node_sm_f1->buffer_address; |
|
128 | 127 | spectral_matrix_regs->status = 0x08; // [1000] |
@@ -136,7 +135,7 void spectral_matrices_isr_f2( void ) | |||
|
136 | 135 | |
|
137 | 136 | status = (spectral_matrix_regs->status & 0x30) >> 4; // [0011 0000] get the status_ready_matrix_f0_x bits |
|
138 | 137 | |
|
139 |
ring_node_for_averaging_sm_f2 = current_ring_node_sm_f2 |
|
|
138 | ring_node_for_averaging_sm_f2 = current_ring_node_sm_f2; | |
|
140 | 139 | |
|
141 | 140 | current_ring_node_sm_f2 = current_ring_node_sm_f2->next; |
|
142 | 141 | |
@@ -145,14 +144,13 void spectral_matrices_isr_f2( void ) | |||
|
145 | 144 | case 0: |
|
146 | 145 | break; |
|
147 | 146 | case 3: |
|
148 | spectral_matrix_regs->f2_0_address = current_ring_node_sm_f2->buffer_address; | |
|
147 | // UNEXPECTED VALUE | |
|
149 | 148 | spectral_matrix_regs->status = 0x30; // [0011 0000] |
|
150 |
|
|
|
151 | { | |
|
152 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |
|
153 | } | |
|
149 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_11 ); | |
|
154 | 150 | break; |
|
155 | 151 | case 1: |
|
152 | ring_node_for_averaging_sm_f2->coarseTime = spectral_matrix_regs->f2_0_coarse_time; | |
|
153 | ring_node_for_averaging_sm_f2->fineTime = spectral_matrix_regs->f2_0_fine_time; | |
|
156 | 154 | spectral_matrix_regs->f2_0_address = current_ring_node_sm_f2->buffer_address; |
|
157 | 155 | spectral_matrix_regs->status = 0x10; // [0001 0000] |
|
158 | 156 | if (rtems_event_send( Task_id[TASKID_AVF2], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
@@ -161,6 +159,8 void spectral_matrices_isr_f2( void ) | |||
|
161 | 159 | } |
|
162 | 160 | break; |
|
163 | 161 | case 2: |
|
162 | ring_node_for_averaging_sm_f2->coarseTime = spectral_matrix_regs->f2_1_coarse_time; | |
|
163 | ring_node_for_averaging_sm_f2->fineTime = spectral_matrix_regs->f2_1_fine_time; | |
|
164 | 164 | spectral_matrix_regs->f2_1_address = current_ring_node_sm_f2->buffer_address; |
|
165 | 165 | spectral_matrix_regs->status = 0x20; // [0010 0000] |
|
166 | 166 | if (rtems_event_send( Task_id[TASKID_AVF2], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
@@ -173,7 +173,10 void spectral_matrices_isr_f2( void ) | |||
|
173 | 173 | |
|
174 | 174 | void spectral_matrix_isr_error_handler( void ) |
|
175 | 175 | { |
|
176 |
spectral_matrix_regs->status |
|
|
176 | if (spectral_matrix_regs->status & 0x7c0) // [0111 1100 0000] | |
|
177 | { | |
|
178 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); | |
|
179 | } | |
|
177 | 180 | } |
|
178 | 181 | |
|
179 | 182 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ) |
@@ -596,13 +599,6 void reset_spectral_matrix_regs( void ) | |||
|
596 | 599 | |
|
597 | 600 | void set_time( unsigned char *time, unsigned char * timeInBuffer ) |
|
598 | 601 | { |
|
599 | // time[0] = timeInBuffer[2]; | |
|
600 | // time[1] = timeInBuffer[3]; | |
|
601 | // time[2] = timeInBuffer[0]; | |
|
602 | // time[3] = timeInBuffer[1]; | |
|
603 | // time[4] = timeInBuffer[6]; | |
|
604 | // time[5] = timeInBuffer[7]; | |
|
605 | ||
|
606 | 602 | time[0] = timeInBuffer[0]; |
|
607 | 603 | time[1] = timeInBuffer[1]; |
|
608 | 604 | time[2] = timeInBuffer[2]; |
@@ -619,18 +615,33 unsigned long long int get_acquisition_t | |||
|
619 | 615 | + ( (unsigned long long int) timePtr[1] << 32 ) |
|
620 | 616 | + ( timePtr[2] << 24 ) |
|
621 | 617 | + ( timePtr[3] << 16 ) |
|
622 |
+ ( timePtr[ |
|
|
623 |
+ ( timePtr[ |
|
|
618 | + ( timePtr[6] << 8 ) | |
|
619 | + ( timePtr[7] ); | |
|
624 | 620 | return acquisitionTimeAslong; |
|
625 | 621 | } |
|
626 | 622 | |
|
627 |
void close_matrix_actions( |
|
|
628 |
ring_node_sm *node_for_averaging, ring_node_sm *ringNode |
|
|
623 | void close_matrix_actions(unsigned int *nb_sm, unsigned int nb_sm_before_avf, rtems_id task_id, | |
|
624 | ring_node_sm *node_for_averaging, ring_node_sm *ringNode, | |
|
625 | unsigned long long int time ) | |
|
629 | 626 | { |
|
627 | unsigned char *timePtr; | |
|
628 | unsigned char *coarseTimePtr; | |
|
629 | unsigned char *fineTimePtr; | |
|
630 | ||
|
631 | timePtr = (unsigned char *) &time; | |
|
632 | coarseTimePtr = (unsigned char *) &node_for_averaging->coarseTime; | |
|
633 | fineTimePtr = (unsigned char *) &node_for_averaging->fineTime; | |
|
634 | ||
|
630 | 635 | *nb_sm = *nb_sm + 1; |
|
631 | 636 | if (*nb_sm == nb_sm_before_avf) |
|
632 | 637 | { |
|
633 | 638 | node_for_averaging = ringNode; |
|
639 | coarseTimePtr[0] = timePtr[2]; | |
|
640 | coarseTimePtr[1] = timePtr[3]; | |
|
641 | coarseTimePtr[2] = timePtr[4]; | |
|
642 | coarseTimePtr[3] = timePtr[5]; | |
|
643 | fineTimePtr[2] = timePtr[6]; | |
|
644 | fineTimePtr[3] = timePtr[7]; | |
|
634 | 645 | if (rtems_event_send( task_id, RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
635 | 646 | { |
|
636 | 647 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
@@ -532,8 +532,8 int enter_mode( unsigned char mode, unsi | |||
|
532 | 532 | #endif |
|
533 | 533 | status = restart_science_tasks( mode ); |
|
534 | 534 | launch_waveform_picker( mode, transitionCoarseTime ); |
|
535 |
|
|
|
536 | launch_spectral_matrix_simu( ); | |
|
535 | launch_spectral_matrix( ); | |
|
536 | // launch_spectral_matrix_simu( ); | |
|
537 | 537 | } |
|
538 | 538 | else if ( mode == LFR_MODE_STANDBY ) |
|
539 | 539 | { |
General Comments 0
You need to be logged in to leave comments.
Login now