@@ -1,12 +1,12 | |||||
1 | #!/usr/bin/lppmon -e |
|
1 | #!/usr/bin/lppmon -e | |
2 |
|
2 | |||
3 |
proxy.loadSysDriver("RMAPPlugin","RMAP |
|
3 | proxy.loadSysDriver("RMAPPlugin","RMAPPlugin0"); | |
4 |
proxy.loadSysDriverToParent("dsu3plugin","RMAP |
|
4 | proxy.loadSysDriverToParent("dsu3plugin","RMAPPlugin0"); | |
5 |
|
5 | |||
6 | #BUTTON_selectStarDundee.click() |
|
6 | #BUTTON_selectStarDundee.click() | |
7 | BUTTON_selectGRESB.click() |
|
7 | BUTTON_selectGRESB.click() | |
|
8 | BUTTON_rmapOpenCommunication.click() | |||
8 |
|
9 | |||
9 | BUTTON_rmapOpenCommunication.click() |
|
|||
10 | dsu3plugin0.openFile("/opt/DEV_PLE/FSW-qt/bin/fsw") |
|
10 | dsu3plugin0.openFile("/opt/DEV_PLE/FSW-qt/bin/fsw") | |
11 | dsu3plugin0.loadFile() |
|
11 | dsu3plugin0.loadFile() | |
12 | dsu3plugin0.run() |
|
12 | dsu3plugin0.run() |
@@ -7,13 +7,14 print hex(matrixF0_Address0) | |||||
7 |
|
7 | |||
8 | # BUILD THE DATA |
|
8 | # BUILD THE DATA | |
9 | dataToWrite = [] |
|
9 | dataToWrite = [] | |
10 | for frequencyBin in range(128): |
|
10 | dataToWrite.append( 0x1234abcd ) | |
11 | for component in range (25): |
|
11 | dataToWrite.append( 0x4321dcba ) | |
12 | dataToWrite.append( component ) |
|
|||
13 |
|
12 | |||
14 |
|
|
13 | for component in range(25): | |
15 |
|
|
14 | for frequencyBin in range (64): | |
16 |
|
|
15 | dataToWrite.append( component + frequencyBin ) | |
|
16 | for frequencyBin in range (64): | |||
|
17 | dataToWrite.append( - (component + frequencyBin) ) | |||
17 |
|
18 | |||
18 | # WRITE THE DATA |
|
19 | # WRITE THE DATA | |
19 | print len(dataToWrite) |
|
20 | print len(dataToWrite) |
@@ -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.0, 2014-0 |
|
3 | <!-- Written by QtCreator 3.0.0, 2014-03-03T07:03:32. --> | |
4 | <qtcreator> |
|
4 | <qtcreator> | |
5 | <data> |
|
5 | <data> | |
6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
|
6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
@@ -12,9 +12,9 | |||||
12 | #include "fsw_spacewire.h" |
|
12 | #include "fsw_spacewire.h" | |
13 | #include "basic_parameters.h" |
|
13 | #include "basic_parameters.h" | |
14 |
|
14 | |||
15 |
extern volatile int sm_f0[ ][ |
|
15 | extern volatile int sm_f0[ ][ TIME_OFFSET + TOTAL_SIZE_SM ]; | |
16 |
extern volatile int sm_f1[ ][ |
|
16 | extern volatile int sm_f1[ ][ TIME_OFFSET + TOTAL_SIZE_SM ]; | |
17 |
extern volatile int sm_f2[ ][ |
|
17 | extern volatile int sm_f2[ ][ TIME_OFFSET + TOTAL_SIZE_SM ]; | |
18 |
|
18 | |||
19 | // parameters |
|
19 | // parameters | |
20 | extern struct param_local_str param_local; |
|
20 | extern struct param_local_str param_local; | |
@@ -44,9 +44,10 void BP1_set_old(float * compressed_spec | |||||
44 | void BP2_set_old(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat); |
|
44 | void BP2_set_old(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat); | |
45 | // |
|
45 | // | |
46 | void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header); |
|
46 | void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header); | |
47 | void compress_averaged_spectral_matrix( float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat ); |
|
47 | void ASM_reorganize( float *averaged_spec_mat, float *averaged_spec_mat_reorganized ); | |
48 | void convert_averaged_spectral_matrix(volatile float *input_matrix, char *output_matrix); |
|
48 | void ASM_compress( float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat ); | |
49 | void send_averaged_spectral_matrix(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, |
|
49 | void ASM_convert(volatile float *input_matrix, char *output_matrix); | |
|
50 | void ASM_send(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, | |||
50 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id); |
|
51 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id); | |
51 | void fill_averaged_spectral_matrix( void ); |
|
52 | void fill_averaged_spectral_matrix( void ); | |
52 | void reset_spectral_matrix_regs(); |
|
53 | void reset_spectral_matrix_regs(); |
@@ -39,6 +39,9 int restart_science_tasks(); | |||||
39 | int suspend_science_tasks(); |
|
39 | int suspend_science_tasks(); | |
40 | void launch_waveform_picker( unsigned char mode ); |
|
40 | void launch_waveform_picker( unsigned char mode ); | |
41 | void launch_spectral_matrix( unsigned char mode ); |
|
41 | void launch_spectral_matrix( unsigned char mode ); | |
|
42 | void enable_irq_on_new_ready_matrix( void ); | |||
|
43 | void disable_irq_on_new_ready_matrix( void ); | |||
|
44 | void launch_spectral_matrix_simu( unsigned char mode ); | |||
42 |
|
45 | |||
43 | // other functions |
|
46 | // other functions | |
44 | void updateLFRCurrentMode(); |
|
47 | void updateLFRCurrentMode(); |
@@ -46,9 +46,9 volatile int wf_cont_f3_b [ (NB_SAMPL | |||||
46 | char wf_cont_f3_light[ (NB_SAMPLES_PER_SNAPSHOT) * NB_BYTES_CWF3_LIGHT_BLK + TIME_OFFSET_IN_BYTES ] __attribute__((aligned(0x100))); |
|
46 | char wf_cont_f3_light[ (NB_SAMPLES_PER_SNAPSHOT) * NB_BYTES_CWF3_LIGHT_BLK + TIME_OFFSET_IN_BYTES ] __attribute__((aligned(0x100))); | |
47 |
|
47 | |||
48 | // SPECTRAL MATRICES GLOBAL VARIABLES |
|
48 | // SPECTRAL MATRICES GLOBAL VARIABLES | |
49 |
volatile int sm_f0[ NB_RING_NODES_ASM_F0 ][ |
|
49 | volatile int sm_f0[ NB_RING_NODES_ASM_F0 ][ TIME_OFFSET + TOTAL_SIZE_SM ] __attribute__((aligned(0x100))); | |
50 |
volatile int sm_f1[ NB_RING_NODES_ASM_F1 ][ |
|
50 | volatile int sm_f1[ NB_RING_NODES_ASM_F1 ][ TIME_OFFSET + TOTAL_SIZE_SM ] __attribute__((aligned(0x100))); | |
51 |
volatile int sm_f2[ NB_RING_NODES_ASM_F2 ][ |
|
51 | volatile int sm_f2[ NB_RING_NODES_ASM_F2 ][ TIME_OFFSET + TOTAL_SIZE_SM ] __attribute__((aligned(0x100))); | |
52 |
|
52 | |||
53 | // APB CONFIGURATION REGISTERS |
|
53 | // APB CONFIGURATION REGISTERS | |
54 | time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT; |
|
54 | time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT; |
@@ -179,6 +179,10 rtems_task Init( rtems_task_argument ign | |||||
179 | status = rtems_interrupt_catch( waveforms_isr, |
|
179 | status = rtems_interrupt_catch( waveforms_isr, | |
180 | IRQ_SPARC_WAVEFORM_PICKER, |
|
180 | IRQ_SPARC_WAVEFORM_PICKER, | |
181 | &old_isr_handler) ; |
|
181 | &old_isr_handler) ; | |
|
182 | // configure IRQ handling for the spectral matrices unit | |||
|
183 | status = rtems_interrupt_catch( spectral_matrices_isr, | |||
|
184 | IRQ_SPARC_SPECTRAL_MATRIX, | |||
|
185 | &old_isr_handler) ; | |||
182 |
|
186 | |||
183 | // if the spacewire link is not up then send an event to the SPIQ task for link recovery |
|
187 | // if the spacewire link is not up then send an event to the SPIQ task for link recovery | |
184 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
188 | if ( status_spw != RTEMS_SUCCESSFUL ) |
@@ -232,21 +232,23 rtems_task dumb_task( rtems_task_argumen | |||||
232 | unsigned int fine_time = 0; |
|
232 | unsigned int fine_time = 0; | |
233 | rtems_event_set event_out; |
|
233 | rtems_event_set event_out; | |
234 |
|
234 | |||
235 |
char *DumbMessages[ |
|
235 | char *DumbMessages[9] = {"in DUMB *** default", // RTEMS_EVENT_0 | |
236 | "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1 |
|
236 | "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1 | |
237 | "in DUMB *** waveforms_isr", // RTEMS_EVENT_2 |
|
237 | "in DUMB *** waveforms_isr", // RTEMS_EVENT_2 | |
238 | "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3 |
|
238 | "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3 | |
239 | "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4 |
|
239 | "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4 | |
240 | "in DUMB *** waveforms_simulator_isr", // RTEMS_EVENT_5 |
|
240 | "in DUMB *** waveforms_simulator_isr", // RTEMS_EVENT_5 | |
241 | "ERR HK", // RTEMS_EVENT_6 |
|
241 | "ERR HK", // RTEMS_EVENT_6 | |
242 |
|
|
242 | "ready for dump", // RTEMS_EVENT_7 | |
|
243 | "in DUMB *** spectral_matrices_isr" // RTEMS_EVENT_8 | |||
243 | }; |
|
244 | }; | |
244 |
|
245 | |||
245 | BOOT_PRINTF("in DUMB *** \n") |
|
246 | BOOT_PRINTF("in DUMB *** \n") | |
246 |
|
247 | |||
247 | while(1){ |
|
248 | while(1){ | |
248 | rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3 |
|
249 | rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3 | |
249 |
| RTEMS_EVENT_4 | RTEMS_EVENT_5 | RTEMS_EVENT_6 | RTEMS_EVENT_7 |
|
250 | | RTEMS_EVENT_4 | RTEMS_EVENT_5 | RTEMS_EVENT_6 | RTEMS_EVENT_7 | |
|
251 | | RTEMS_EVENT_8, | |||
250 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT |
|
252 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT | |
251 | intEventOut = (unsigned int) event_out; |
|
253 | intEventOut = (unsigned int) event_out; | |
252 | for ( i=0; i<32; i++) |
|
254 | for ( i=0; i<32; i++) | |
@@ -256,7 +258,6 rtems_task dumb_task( rtems_task_argumen | |||||
256 | coarse_time = time_management_regs->coarse_time; |
|
258 | coarse_time = time_management_regs->coarse_time; | |
257 | fine_time = time_management_regs->fine_time; |
|
259 | fine_time = time_management_regs->fine_time; | |
258 | printf("in DUMB *** coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]); |
|
260 | printf("in DUMB *** coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]); | |
259 | PRINTF1("status = %x\n", waveform_picker_regs->status) |
|
|||
260 | } |
|
261 | } | |
261 | } |
|
262 | } | |
262 | } |
|
263 | } |
@@ -22,9 +22,10 ring_node *current_ring_node_sm_f1; | |||||
22 | ring_node *current_ring_node_sm_f2; |
|
22 | ring_node *current_ring_node_sm_f2; | |
23 |
|
23 | |||
24 | BP1_t data_BP1[ NB_BINS_COMPRESSED_SM_F0 ]; |
|
24 | BP1_t data_BP1[ NB_BINS_COMPRESSED_SM_F0 ]; | |
25 | float averaged_sm_f0[ TOTAL_SIZE_SM ]; |
|
25 | float averaged_sm_f0 [ TIME_OFFSET + TOTAL_SIZE_SM ]; | |
26 |
|
|
26 | float averaged_sm_f0_reorganized[ TIME_OFFSET + TOTAL_SIZE_SM ]; | |
27 | float compressed_sm_f0[ TOTAL_SIZE_COMPRESSED_ASM_F0 ]; |
|
27 | char averaged_sm_f0_char [ TIME_OFFSET_IN_BYTES + TOTAL_SIZE_SM * 2 ]; | |
|
28 | float compressed_sm_f0 [ TOTAL_SIZE_COMPRESSED_ASM_F0 ]; | |||
28 |
|
29 | |||
29 | unsigned int nb_sm_f0; |
|
30 | unsigned int nb_sm_f0; | |
30 |
|
31 | |||
@@ -69,54 +70,76 void reset_nb_sm_f0( void ) | |||||
69 |
|
70 | |||
70 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ) |
|
71 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ) | |
71 | { |
|
72 | { | |
72 | // unsigned char status; |
|
73 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); | |
73 | // unsigned char i; |
|
74 | ||
|
75 | if ( (spectral_matrix_regs->status & 0x1) == 0x01) | |||
|
76 | { | |||
|
77 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; | |||
|
78 | spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address; | |||
|
79 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe; // 1110 | |||
|
80 | nb_sm_f0 = nb_sm_f0 + 1; | |||
|
81 | } | |||
|
82 | else if ( (spectral_matrix_regs->status & 0x2) == 0x02) | |||
|
83 | { | |||
|
84 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; | |||
|
85 | spectral_matrix_regs->matrixFO_Address1 = current_ring_node_sm_f0->buffer_address; | |||
|
86 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd; // 1101 | |||
|
87 | nb_sm_f0 = nb_sm_f0 + 1; | |||
|
88 | } | |||
74 |
|
89 | |||
75 |
|
|
90 | if ( (spectral_matrix_regs->status & 0x30) != 0x00) | |
76 | // for (i=0; i<4; i++) |
|
91 | { | |
77 | // { |
|
92 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); | |
78 | // if ( ( (status >> i) & 0x01) == 1) // (1) buffer rotation |
|
93 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xffffffcf; // 1100 1111 | |
79 | // { |
|
94 | } | |
80 | // switch(i) |
|
95 | ||
81 | // { |
|
96 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff3; // 0011 | |
82 | // case 0: |
|
|||
83 | // current_ring_node_sm_f0 = current_ring_node_sm_f0->next; |
|
|||
84 | // spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address; |
|
|||
85 | // spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe; |
|
|||
86 | // nb_interrupt_f0 = nb_interrupt_f0 + 1; |
|
|||
87 | // if (nb_interrupt_f0 == NB_SM_TO_RECEIVE_BEFORE_AVF0 ){ |
|
|||
88 | // ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0; |
|
|||
89 | // if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
|||
90 | // { |
|
|||
91 | // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
|||
92 | // } |
|
|||
93 | // nb_interrupt_f0 = 0; |
|
|||
94 | // } |
|
|||
95 | // break; |
|
|||
96 | // case 1: |
|
|||
97 | // break; |
|
|||
98 | // case 2: |
|
|||
99 | // break; |
|
|||
100 | // default: |
|
|||
101 | // break; |
|
|||
102 | // } |
|
|||
103 | // } |
|
|||
104 | // } |
|
|||
105 |
|
97 | |||
106 | // // reset error codes to 0 |
|
98 | if (nb_sm_f0 == (NB_SM_TO_RECEIVE_BEFORE_AVF0-1) ) | |
107 | // spectral_matrix_regs->status = spectral_matrix_regs->status & 0xffffffcf; // [1100 1111] |
|
99 | { | |
|
100 | ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0; | |||
|
101 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |||
|
102 | { | |||
|
103 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |||
|
104 | } | |||
|
105 | nb_sm_f0 = 0; | |||
|
106 | } | |||
|
107 | else | |||
|
108 | { | |||
|
109 | nb_sm_f0 = nb_sm_f0 + 1; | |||
|
110 | } | |||
108 | } |
|
111 | } | |
109 |
|
112 | |||
110 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ) |
|
113 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ) | |
111 | { |
|
114 | { | |
112 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; |
|
115 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); | |
113 | spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address; |
|
116 | ||
114 |
|
|
117 | if ( (spectral_matrix_regs->status & 0x1) == 0x01) | |
|
118 | { | |||
|
119 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; | |||
|
120 | spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address; | |||
|
121 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe; // 1110 | |||
|
122 | nb_sm_f0 = nb_sm_f0 + 1; | |||
|
123 | } | |||
|
124 | else if ( (spectral_matrix_regs->status & 0x2) == 0x02) | |||
|
125 | { | |||
|
126 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; | |||
|
127 | spectral_matrix_regs->matrixFO_Address1 = current_ring_node_sm_f0->buffer_address; | |||
|
128 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd; // 1101 | |||
|
129 | nb_sm_f0 = nb_sm_f0 + 1; | |||
|
130 | } | |||
|
131 | ||||
|
132 | if ( (spectral_matrix_regs->status & 0x30) != 0x00) | |||
|
133 | { | |||
|
134 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); | |||
|
135 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xffffffcf; // 1100 1111 | |||
|
136 | } | |||
|
137 | ||||
|
138 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff3; // 0011 | |||
115 |
|
139 | |||
116 | if (nb_sm_f0 == (NB_SM_TO_RECEIVE_BEFORE_AVF0-1) ) |
|
140 | if (nb_sm_f0 == (NB_SM_TO_RECEIVE_BEFORE_AVF0-1) ) | |
117 | { |
|
141 | { | |
118 |
|
|
142 | ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0; | |
119 | ring_node_for_averaging_sm_f0 = &sm_ring_f0[NB_SM_TO_RECEIVE_BEFORE_AVF0-1]; |
|
|||
120 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
143 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |
121 | { |
|
144 | { | |
122 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
145 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |
@@ -165,15 +188,16 rtems_task avf0_task(rtems_task_argument | |||||
165 | } |
|
188 | } | |
166 | for(i=0; i<TOTAL_SIZE_SM; i++) |
|
189 | for(i=0; i<TOTAL_SIZE_SM; i++) | |
167 | { |
|
190 | { | |
168 | averaged_sm_f0[i] = ( (int *) (ring_node_tab[0]->buffer_address) ) [i] |
|
191 | averaged_sm_f0[i] = ( (int *) (ring_node_tab[0]->buffer_address) ) [i + TIME_OFFSET] | |
169 | + ( (int *) (ring_node_tab[1]->buffer_address) ) [i] |
|
192 | + ( (int *) (ring_node_tab[1]->buffer_address) ) [i + TIME_OFFSET] | |
170 | + ( (int *) (ring_node_tab[2]->buffer_address) ) [i] |
|
193 | + ( (int *) (ring_node_tab[2]->buffer_address) ) [i + TIME_OFFSET] | |
171 | + ( (int *) (ring_node_tab[3]->buffer_address) ) [i] |
|
194 | + ( (int *) (ring_node_tab[3]->buffer_address) ) [i + TIME_OFFSET] | |
172 | + ( (int *) (ring_node_tab[4]->buffer_address) ) [i] |
|
195 | + ( (int *) (ring_node_tab[4]->buffer_address) ) [i + TIME_OFFSET] | |
173 | + ( (int *) (ring_node_tab[5]->buffer_address) ) [i] |
|
196 | + ( (int *) (ring_node_tab[5]->buffer_address) ) [i + TIME_OFFSET] | |
174 | + ( (int *) (ring_node_tab[6]->buffer_address) ) [i] |
|
197 | + ( (int *) (ring_node_tab[6]->buffer_address) ) [i + TIME_OFFSET] | |
175 | + ( (int *) (ring_node_tab[7]->buffer_address) ) [i]; |
|
198 | + ( (int *) (ring_node_tab[7]->buffer_address) ) [i + TIME_OFFSET]; | |
176 | } |
|
199 | } | |
|
200 | ||||
177 | nb_average = nb_average + NB_SM_TO_RECEIVE_BEFORE_AVF0; |
|
201 | nb_average = nb_average + NB_SM_TO_RECEIVE_BEFORE_AVF0; | |
178 | if (nb_average == NB_AVERAGE_NORMAL_f0) { |
|
202 | if (nb_average == NB_AVERAGE_NORMAL_f0) { | |
179 | nb_average = 0; |
|
203 | nb_average = 0; | |
@@ -208,13 +232,14 rtems_task matr_task(rtems_task_argument | |||||
208 | while(1){ |
|
232 | while(1){ | |
209 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
233 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 | |
210 | // 1) compress the matrix for Basic Parameters calculation |
|
234 | // 1) compress the matrix for Basic Parameters calculation | |
211 |
compress |
|
235 | ASM_compress( averaged_sm_f0, 0, compressed_sm_f0 ); | |
212 | // 2) |
|
236 | // 2) | |
213 | //BP1_set(compressed_sm_f0, NB_BINS_COMPRESSED_SM_F0, LFR_BP1_F0); |
|
237 | //BP1_set(compressed_sm_f0, NB_BINS_COMPRESSED_SM_F0, LFR_BP1_F0); | |
214 | // 3) convert the float array in a char array |
|
238 | // 3) convert the float array in a char array | |
215 |
|
|
239 | ASM_reorganize( averaged_sm_f0, averaged_sm_f0_reorganized ); | |
|
240 | ASM_convert( averaged_sm_f0_reorganized, averaged_sm_f0_char); | |||
216 | // 4) send the spectral matrix packets |
|
241 | // 4) send the spectral matrix packets | |
217 |
send |
|
242 | ASM_send( &headerASM, averaged_sm_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id); | |
218 | } |
|
243 | } | |
219 | } |
|
244 | } | |
220 |
|
245 | |||
@@ -229,33 +254,51 void matrix_reset(volatile float *averag | |||||
229 | } |
|
254 | } | |
230 | } |
|
255 | } | |
231 |
|
256 | |||
232 | void compress_averaged_spectral_matrix( float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat ) |
|
257 | void ASM_reorganize( float *averaged_spec_mat, float *averaged_spec_mat_reorganized ) | |
|
258 | { | |||
|
259 | int frequencyBin; | |||
|
260 | int asmComponent; | |||
|
261 | ||||
|
262 | // copy the time information | |||
|
263 | averaged_spec_mat_reorganized[ 0 ] = averaged_spec_mat[ 0 ]; | |||
|
264 | averaged_spec_mat_reorganized[ 1 ] = averaged_spec_mat[ 1 ]; | |||
|
265 | ||||
|
266 | for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++) | |||
|
267 | { | |||
|
268 | for( frequencyBin = 0; frequencyBin < NB_BINS_PER_SM; frequencyBin++ ) | |||
|
269 | { | |||
|
270 | averaged_spec_mat_reorganized[ frequencyBin * NB_VALUES_PER_SM + asmComponent + TIME_OFFSET ] = | |||
|
271 | averaged_spec_mat[ asmComponent * NB_BINS_PER_SM + frequencyBin + TIME_OFFSET]; | |||
|
272 | } | |||
|
273 | } | |||
|
274 | } | |||
|
275 | ||||
|
276 | void ASM_compress( float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat ) | |||
233 | { |
|
277 | { | |
234 | int frequencyBin; |
|
278 | int frequencyBin; | |
235 | int asmComponent; |
|
279 | int asmComponent; | |
236 | int offsetASM; |
|
280 | int offsetASM; | |
237 | int generalOffsetASM; |
|
|||
238 | int offsetCompressed; |
|
281 | int offsetCompressed; | |
239 | int k; |
|
282 | int k; | |
240 |
|
283 | |||
241 | switch (fChannel){ |
|
284 | switch (fChannel){ | |
242 | case 0: |
|
285 | case 0: | |
243 | generalOffsetASM = ASM_F0_INDICE_START * NB_VALUES_PER_SM; |
|
286 | for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++) | |
244 | for( frequencyBin = 0; frequencyBin < NB_BINS_COMPRESSED_SM_F0; frequencyBin++ ) |
|
|||
245 | { |
|
287 | { | |
246 | offsetCompressed = frequencyBin * NB_VALUES_PER_SM; |
|
288 | for( frequencyBin = 0; frequencyBin < NB_BINS_COMPRESSED_SM_F0; frequencyBin++ ) | |
247 | offsetASM = generalOffsetASM + frequencyBin * NB_BINS_TO_AVERAGE_ASM_F0 * NB_VALUES_PER_SM; |
|
|||
248 | for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++) |
|
|||
249 | { |
|
289 | { | |
250 | compressed_spec_mat[ offsetCompressed + asmComponent ] = 0; |
|
290 | offsetASM = asmComponent * NB_BINS_PER_SM | |
|
291 | + ASM_F0_INDICE_START | |||
|
292 | + frequencyBin * NB_BINS_TO_AVERAGE_ASM_F0; | |||
|
293 | offsetCompressed = frequencyBin * NB_VALUES_PER_SM | |||
|
294 | + asmComponent; | |||
|
295 | compressed_spec_mat[ offsetCompressed ] = 0; | |||
251 | for ( k = 0; k < NB_BINS_TO_AVERAGE_ASM_F0; k++ ) |
|
296 | for ( k = 0; k < NB_BINS_TO_AVERAGE_ASM_F0; k++ ) | |
252 | { |
|
297 | { | |
253 |
compressed_spec_mat[ |
|
298 | compressed_spec_mat[offsetCompressed ] = | |
254 |
compressed_spec_mat[ offsetCompressed |
|
299 | compressed_spec_mat[ offsetCompressed ] | |
255 |
+ averaged_spec_mat[ offsetASM + |
|
300 | + averaged_spec_mat[ offsetASM + k ]; | |
256 | } |
|
301 | } | |
257 | compressed_spec_mat[ offsetCompressed + asmComponent ] = |
|
|||
258 | compressed_spec_mat[ offsetCompressed + asmComponent ] / NB_BINS_TO_AVERAGE_ASM_F0; |
|
|||
259 | } |
|
302 | } | |
260 | } |
|
303 | } | |
261 | break; |
|
304 | break; | |
@@ -273,29 +316,37 void compress_averaged_spectral_matrix( | |||||
273 | } |
|
316 | } | |
274 | } |
|
317 | } | |
275 |
|
318 | |||
276 |
void convert |
|
319 | void ASM_convert( volatile float *input_matrix, char *output_matrix) | |
277 | { |
|
320 | { | |
278 | unsigned int i; |
|
321 | unsigned int i; | |
279 |
unsigned int |
|
322 | unsigned int frequencyBin; | |
|
323 | unsigned int asmComponent; | |||
280 | char * pt_char_input; |
|
324 | char * pt_char_input; | |
281 | char * pt_char_output; |
|
325 | char * pt_char_output; | |
282 |
|
326 | |||
283 |
pt_char_input = |
|
327 | pt_char_input = (char*) &input_matrix; | |
284 |
pt_char_output = |
|
328 | pt_char_output = (char*) &output_matrix; | |
285 |
|
329 | |||
286 | for( i=0; i<NB_BINS_PER_SM; i++) |
|
330 | // copy the time information | |
|
331 | for (i=0; i<TIME_OFFSET_IN_BYTES; i++) | |||
287 | { |
|
332 | { | |
288 | for ( j=0; j<NB_VALUES_PER_SM; j++) |
|
333 | pt_char_output[ i ] = pt_char_output[ i ]; | |
|
334 | } | |||
|
335 | ||||
|
336 | // convert all other data | |||
|
337 | for( frequencyBin=0; frequencyBin<NB_BINS_PER_SM; frequencyBin++) | |||
|
338 | { | |||
|
339 | for ( asmComponent=0; asmComponent<NB_VALUES_PER_SM; asmComponent++) | |||
289 | { |
|
340 | { | |
290 |
pt_char_input = (char*) &input_matrix [ (i*NB_VALUES_PER_SM) + |
|
341 | pt_char_input = (char*) &input_matrix [ (frequencyBin*NB_VALUES_PER_SM) + asmComponent + TIME_OFFSET ]; | |
291 |
pt_char_output = (char*) &output_matrix[ 2 * ( (i*NB_VALUES_PER_SM) + |
|
342 | pt_char_output = (char*) &output_matrix[ 2 * ( (frequencyBin*NB_VALUES_PER_SM) + asmComponent ) + TIME_OFFSET_IN_BYTES ]; | |
292 | pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float |
|
343 | pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float | |
293 | pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float |
|
344 | pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float | |
294 | } |
|
345 | } | |
295 | } |
|
346 | } | |
296 | } |
|
347 | } | |
297 |
|
348 | |||
298 |
void send |
|
349 | void ASM_send(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, | |
299 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id) |
|
350 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id) | |
300 | { |
|
351 | { | |
301 | unsigned int i; |
|
352 | unsigned int i; | |
@@ -309,7 +360,10 void send_averaged_spectral_matrix(Heade | |||||
309 | { |
|
360 | { | |
310 | case SID_NORM_ASM_F0: |
|
361 | case SID_NORM_ASM_F0: | |
311 | spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F0_IN_BYTES / 2; |
|
362 | spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F0_IN_BYTES / 2; | |
312 | spw_ioctl_send->data = &spectral_matrix[ ( (ASM_F0_INDICE_START+ (i*NB_BINS_PER_PKT_ASM_F0)) * NB_VALUES_PER_SM) * 2 ]; |
|
363 | spw_ioctl_send->data = &spectral_matrix[ | |
|
364 | ( (ASM_F0_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F0) ) * NB_VALUES_PER_SM ) * 2 | |||
|
365 | + TIME_OFFSET_IN_BYTES | |||
|
366 | ]; | |||
313 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0; |
|
367 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0; | |
314 | header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F0) >> 8 ); // BLK_NR MSB |
|
368 | header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F0) >> 8 ); // BLK_NR MSB | |
315 | header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F0); // BLK_NR LSB |
|
369 | header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F0); // BLK_NR LSB | |
@@ -319,7 +373,7 void send_averaged_spectral_matrix(Heade | |||||
319 | case SID_NORM_ASM_F2: |
|
373 | case SID_NORM_ASM_F2: | |
320 | break; |
|
374 | break; | |
321 | default: |
|
375 | default: | |
322 |
PRINTF1("ERR *** in send |
|
376 | PRINTF1("ERR *** in ASM_send *** unexpected sid %d\n", sid) | |
323 | break; |
|
377 | break; | |
324 | } |
|
378 | } | |
325 | spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
379 | spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES; | |
@@ -351,7 +405,7 void send_averaged_spectral_matrix(Heade | |||||
351 | // (4) SEND PACKET |
|
405 | // (4) SEND PACKET | |
352 | status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE); |
|
406 | status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE); | |
353 | if (status != RTEMS_SUCCESSFUL) { |
|
407 | if (status != RTEMS_SUCCESSFUL) { | |
354 |
printf("in send |
|
408 | printf("in ASM_send *** ERR %d\n", (int) status); | |
355 | } |
|
409 | } | |
356 | } |
|
410 | } | |
357 | } |
|
411 | } | |
@@ -665,6 +719,9 void reset_spectral_matrix_regs() | |||||
665 | * |
|
719 | * | |
666 | */ |
|
720 | */ | |
667 |
|
721 | |||
|
722 | spectral_matrix_regs->config = 0x00; | |||
|
723 | spectral_matrix_regs->status = 0x00; | |||
|
724 | ||||
668 | spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address; |
|
725 | spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address; | |
669 | spectral_matrix_regs->matrixFO_Address1 = current_ring_node_sm_f0->buffer_address; |
|
726 | spectral_matrix_regs->matrixFO_Address1 = current_ring_node_sm_f0->buffer_address; | |
670 | spectral_matrix_regs->matrixF1_Address = current_ring_node_sm_f1->buffer_address; |
|
727 | spectral_matrix_regs->matrixF1_Address = current_ring_node_sm_f1->buffer_address; |
@@ -388,15 +388,16 int stop_current_mode(void) | |||||
388 |
|
388 | |||
389 | // (1) mask interruptions |
|
389 | // (1) mask interruptions | |
390 | LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt |
|
390 | LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt | |
391 |
|
|
391 | LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt | |
392 |
|
392 | |||
393 | // (2) clear interruptions |
|
393 | // (2) clear interruptions | |
394 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt |
|
394 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt | |
395 |
|
|
395 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt | |
396 |
|
396 | |||
397 | // (3) reset registers |
|
397 | // (3) reset registers | |
398 | reset_wfp_burst_enable(); // reset burst and enable bits |
|
398 | reset_wfp_burst_enable(); // reset burst and enable bits | |
399 | reset_wfp_status(); // reset all the status bits |
|
399 | reset_wfp_status(); // reset all the status bits | |
|
400 | disable_irq_on_new_ready_matrix(); // stop the spectral matrices | |||
400 |
|
401 | |||
401 | // <Spectral Matrices simulator> |
|
402 | // <Spectral Matrices simulator> | |
402 | LEON_Mask_interrupt( IRQ_SM_SIMULATOR ); // mask spectral matrix interrupt simulator |
|
403 | LEON_Mask_interrupt( IRQ_SM_SIMULATOR ); // mask spectral matrix interrupt simulator | |
@@ -445,7 +446,7 int enter_mode(unsigned char mode ) | |||||
445 | #endif |
|
446 | #endif | |
446 | status = restart_science_tasks(); |
|
447 | status = restart_science_tasks(); | |
447 | launch_waveform_picker( mode ); |
|
448 | launch_waveform_picker( mode ); | |
448 |
|
|
449 | launch_spectral_matrix( mode ); | |
449 | } |
|
450 | } | |
450 | else if ( mode == LFR_MODE_STANDBY ) |
|
451 | else if ( mode == LFR_MODE_STANDBY ) | |
451 | { |
|
452 | { | |
@@ -609,6 +610,29 void launch_spectral_matrix( unsigned ch | |||||
609 | reset_current_sm_ring_nodes(); |
|
610 | reset_current_sm_ring_nodes(); | |
610 | reset_spectral_matrix_regs(); |
|
611 | reset_spectral_matrix_regs(); | |
611 |
|
612 | |||
|
613 | enable_irq_on_new_ready_matrix(); | |||
|
614 | ||||
|
615 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); | |||
|
616 | LEON_Unmask_interrupt( IRQ_SPECTRAL_MATRIX ); | |||
|
617 | } | |||
|
618 | ||||
|
619 | void enable_irq_on_new_ready_matrix( void ) | |||
|
620 | { | |||
|
621 | spectral_matrix_regs->config = spectral_matrix_regs->config | 0x01; | |||
|
622 | } | |||
|
623 | ||||
|
624 | void disable_irq_on_new_ready_matrix( void ) | |||
|
625 | { | |||
|
626 | spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffe; // 1110 | |||
|
627 | } | |||
|
628 | ||||
|
629 | ||||
|
630 | void launch_spectral_matrix_simu( unsigned char mode ) | |||
|
631 | { | |||
|
632 | reset_nb_sm_f0(); | |||
|
633 | reset_current_sm_ring_nodes(); | |||
|
634 | reset_spectral_matrix_regs(); | |||
|
635 | ||||
612 | // Spectral Matrices simulator |
|
636 | // Spectral Matrices simulator | |
613 | timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); |
|
637 | timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); | |
614 | LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); |
|
638 | LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); |
General Comments 0
You need to be logged in to leave comments.
Login now