@@ -1,6 +1,6 | |||
|
1 | 1 | ############################################################################# |
|
2 | 2 | # Makefile for building: bin/fsw |
|
3 |
# Generated by qmake (2.01a) (Qt 4.8.5) on: |
|
|
3 | # Generated by qmake (2.01a) (Qt 4.8.5) on: Fri Feb 21 15:32:25 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 |
@@ -10,7 +10,7 | |||
|
10 | 10 | |
|
11 | 11 | CC = sparc-rtems-gcc |
|
12 | 12 | CXX = sparc-rtems-g++ |
|
13 |
DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=2 -DPRINT_MESSAGES_ON_CONSOLE |
|
|
13 | DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=2 -DPRINT_MESSAGES_ON_CONSOLE | |
|
14 | 14 | CFLAGS = -pipe -O3 -Wall $(DEFINES) |
|
15 | 15 | CXXFLAGS = -pipe -O3 -Wall $(DEFINES) |
|
16 | 16 | INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header -I../../LFR_basic-parameters |
@@ -11,6 +11,10 for frequencyBin in range(128): | |||
|
11 | 11 | for component in range (25): |
|
12 | 12 | dataToWrite.append( component ) |
|
13 | 13 | |
|
14 | #for frequencyBin in range(64): | |
|
15 | # for component in range (25): | |
|
16 | # dataToWrite.append( 2 * component ) | |
|
17 | ||
|
14 | 18 | # WRITE THE DATA |
|
15 | 19 | print len(dataToWrite) |
|
16 | 20 | RMAPPlugin0.Write( matrixF0_Address0, dataToWrite ) |
@@ -1,7 +1,7 | |||
|
1 | 1 | TEMPLATE = app |
|
2 | 2 | # CONFIG += console v8 sim |
|
3 | 3 | # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report |
|
4 |
CONFIG += console verbose |
|
|
4 | CONFIG += console verbose | |
|
5 | 5 | CONFIG -= qt |
|
6 | 6 | |
|
7 | 7 | include(./sparc.pri) |
@@ -1,6 +1,6 | |||
|
1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
|
2 | 2 | <!DOCTYPE QtCreatorProject> |
|
3 |
<!-- Written by QtCreator 3.0.0, 2014-02-2 |
|
|
3 | <!-- Written by QtCreator 3.0.0, 2014-02-21T15:56:03. --> | |
|
4 | 4 | <qtcreator> |
|
5 | 5 | <data> |
|
6 | 6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
@@ -131,7 +131,7 typedef struct ring_node | |||
|
131 | 131 | #define TASKID_SMIQ 4 |
|
132 | 132 | #define TASKID_STAT 5 |
|
133 | 133 | #define TASKID_AVF0 6 |
|
134 | #define TASKID_BPF0 7 | |
|
134 | //#define TASKID_BPF0 7 | |
|
135 | 135 | #define TASKID_WFRM 8 |
|
136 | 136 | #define TASKID_DUMB 9 |
|
137 | 137 | #define TASKID_HOUS 10 |
@@ -28,7 +28,13 | |||
|
28 | 28 | #define NB_BINS_COMPRESSED_SM_F1 13 |
|
29 | 29 | #define NB_BINS_COMPRESSED_SM_F2 12 |
|
30 | 30 | // |
|
31 | #define TOTAL_SIZE_COMPRESSED_MATRIX_f0 (NB_BINS_COMPRESSED_SM_F0 * NB_VALUES_PER_SM) | |
|
31 | #define NB_BINS_TO_AVERAGE_ASM_F0 8 | |
|
32 | #define NB_BINS_TO_AVERAGE_ASM_F1 8 | |
|
33 | #define NB_BINS_TO_AVERAGE_ASM_F2 8 | |
|
34 | // | |
|
35 | #define TOTAL_SIZE_COMPRESSED_ASM_F0 275 // 11 * 25 | |
|
36 | #define TOTAL_SIZE_COMPRESSED_ASM_F1 325 // 13 * 25 | |
|
37 | #define TOTAL_SIZE_COMPRESSED_ASM_F2 300 // 12 * 25 | |
|
32 | 38 | #define NB_AVERAGE_NORMAL_f0 96*4 |
|
33 | 39 | #define NB_SM_TO_RECEIVE_BEFORE_AVF0 8 |
|
34 | 40 |
@@ -35,21 +35,19 rtems_isr spectral_matrices_isr( rtems_v | |||
|
35 | 35 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ); |
|
36 | 36 | |
|
37 | 37 | // RTEMS TASKS |
|
38 | rtems_task spw_bppr_task(rtems_task_argument argument); | |
|
39 | 38 | rtems_task avf0_task(rtems_task_argument argument); |
|
40 | rtems_task bpf0_task(rtems_task_argument argument); | |
|
41 | 39 | rtems_task smiq_task(rtems_task_argument argument); // added to test the spectral matrix simulator |
|
42 | 40 | rtems_task matr_task(rtems_task_argument argument); |
|
43 | 41 | |
|
44 | void matrix_compression(volatile float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat); | |
|
45 | 42 | void matrix_reset(volatile float *averaged_spec_mat); |
|
46 | 43 | void BP1_set_old(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1); |
|
47 | 44 | void BP2_set_old(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat); |
|
48 | 45 | // |
|
49 | 46 | void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header); |
|
50 | void send_spectral_matrix(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, | |
|
47 | void compress_averaged_spectral_matrix( float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat ); | |
|
48 | void convert_averaged_spectral_matrix(volatile float *input_matrix, char *output_matrix); | |
|
49 | void send_averaged_spectral_matrix(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, | |
|
51 | 50 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id); |
|
52 | void convert_averaged_spectral_matrix(volatile float *input_matrix, char *output_matrix); | |
|
53 | 51 | void fill_averaged_spectral_matrix( void ); |
|
54 | 52 | void reset_spectral_matrix_regs(); |
|
55 | 53 |
@@ -236,7 +236,7 void create_names( void ) // create all | |||
|
236 | 236 | Task_name[TASKID_SMIQ] = rtems_build_name( 'S', 'M', 'I', 'Q' ); |
|
237 | 237 | Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' ); |
|
238 | 238 | Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' ); |
|
239 | Task_name[TASKID_BPF0] = rtems_build_name( 'B', 'P', 'F', '0' ); | |
|
239 | // Task_name[TASKID_BPF0] = rtems_build_name( 'B', 'P', 'F', '0' ); | |
|
240 | 240 | Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' ); |
|
241 | 241 | Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' ); |
|
242 | 242 | Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' ); |
@@ -319,14 +319,6 int create_all_tasks( void ) // create a | |||
|
319 | 319 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0] |
|
320 | 320 | ); |
|
321 | 321 | } |
|
322 | if (status == RTEMS_SUCCESSFUL) // BPF0 | |
|
323 | { | |
|
324 | status = rtems_task_create( | |
|
325 | Task_name[TASKID_BPF0], TASK_PRIORITY_BPF0, RTEMS_MINIMUM_STACK_SIZE, | |
|
326 | RTEMS_DEFAULT_MODES, | |
|
327 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_BPF0] | |
|
328 | ); | |
|
329 | } | |
|
330 | 322 | if (status == RTEMS_SUCCESSFUL) // WFRM |
|
331 | 323 | { |
|
332 | 324 | status = rtems_task_create( |
@@ -484,14 +476,6 int start_all_tasks( void ) // start all | |||
|
484 | 476 | } |
|
485 | 477 | } |
|
486 | 478 | |
|
487 | if (status == RTEMS_SUCCESSFUL) // BPF0 | |
|
488 | { | |
|
489 | status = rtems_task_start( Task_id[TASKID_BPF0], bpf0_task, 1 ); | |
|
490 | if (status!=RTEMS_SUCCESSFUL) { | |
|
491 | BOOT_PRINTF("in INIT *** Error starting TASK_BPF0\n") | |
|
492 | } | |
|
493 | } | |
|
494 | ||
|
495 | 479 | if (status == RTEMS_SUCCESSFUL) // WFRM |
|
496 | 480 | { |
|
497 | 481 | status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 ); |
@@ -24,7 +24,7 ring_node *current_ring_node_sm_f2; | |||
|
24 | 24 | BP1_t data_BP1[ NB_BINS_COMPRESSED_SM_F0 ]; |
|
25 | 25 | float averaged_sm_f0[ TOTAL_SIZE_SM ]; |
|
26 | 26 | char averaged_sm_f0_char[ TOTAL_SIZE_SM * 2 ]; |
|
27 |
float compressed_sm_f0[ TOTAL_SIZE_COMPRESSED_ |
|
|
27 | float compressed_sm_f0[ TOTAL_SIZE_COMPRESSED_ASM_F0 ]; | |
|
28 | 28 | |
|
29 | 29 | unsigned int nb_sm_f0; |
|
30 | 30 | |
@@ -109,13 +109,14 rtems_isr spectral_matrices_isr( rtems_v | |||
|
109 | 109 | |
|
110 | 110 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ) |
|
111 | 111 | { |
|
112 |
|
|
|
113 |
|
|
|
114 |
|
|
|
112 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; | |
|
113 | spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address; | |
|
114 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe; | |
|
115 | 115 | |
|
116 | 116 | if (nb_sm_f0 == (NB_SM_TO_RECEIVE_BEFORE_AVF0-1) ) |
|
117 | 117 | { |
|
118 | ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0; | |
|
118 | // 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]; | |
|
119 | 120 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
120 | 121 | { |
|
121 | 122 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
@@ -142,18 +143,6 rtems_task smiq_task(rtems_task_argument | |||
|
142 | 143 | } |
|
143 | 144 | } |
|
144 | 145 | |
|
145 | rtems_task spw_bppr_task(rtems_task_argument argument) | |
|
146 | { | |
|
147 | rtems_status_code status; | |
|
148 | rtems_event_set event_out; | |
|
149 | ||
|
150 | BOOT_PRINTF("in BPPR ***\n"); | |
|
151 | ||
|
152 | while( true ){ // wait for an event to begin with the processing | |
|
153 | status = rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); | |
|
154 | } | |
|
155 | } | |
|
156 | ||
|
157 | 146 | rtems_task avf0_task(rtems_task_argument argument) |
|
158 | 147 | { |
|
159 | 148 | int i; |
@@ -168,7 +157,6 rtems_task avf0_task(rtems_task_argument | |||
|
168 | 157 | |
|
169 | 158 | while(1){ |
|
170 | 159 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
171 | ring_node_for_averaging_sm_f0 = &sm_ring_f0[NB_SM_TO_RECEIVE_BEFORE_AVF0-1]; | |
|
172 | 160 | ring_node_tab[NB_SM_TO_RECEIVE_BEFORE_AVF0-1] = ring_node_for_averaging_sm_f0; |
|
173 | 161 | for (i=2; i<NB_SM_TO_RECEIVE_BEFORE_AVF0+1; i++) |
|
174 | 162 | { |
@@ -197,20 +185,6 rtems_task avf0_task(rtems_task_argument | |||
|
197 | 185 | } |
|
198 | 186 | } |
|
199 | 187 | |
|
200 | rtems_task bpf0_task(rtems_task_argument argument) | |
|
201 | { | |
|
202 | rtems_event_set event_out; | |
|
203 | static unsigned char LFR_BP1_F0[ NB_BINS_COMPRESSED_SM_F0 * 9 ]; | |
|
204 | ||
|
205 | BOOT_PRINTF("in BPFO *** \n") | |
|
206 | ||
|
207 | while(1){ | |
|
208 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 | |
|
209 | matrix_compression(averaged_sm_f0, 0, compressed_sm_f0); | |
|
210 | BP1_set(compressed_sm_f0, NB_BINS_COMPRESSED_SM_F0, LFR_BP1_F0); | |
|
211 | } | |
|
212 | } | |
|
213 | ||
|
214 | 188 | rtems_task matr_task(rtems_task_argument argument) |
|
215 | 189 | { |
|
216 | 190 | spw_ioctl_pkt_send spw_ioctl_send_ASM; |
@@ -233,10 +207,14 rtems_task matr_task(rtems_task_argument | |||
|
233 | 207 | |
|
234 | 208 | while(1){ |
|
235 | 209 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
236 | // 1) convert the float array in a char array | |
|
210 | // 1) compress the matrix for Basic Parameters calculation | |
|
211 | compress_averaged_spectral_matrix( averaged_sm_f0, 0, compressed_sm_f0 ); | |
|
212 | // 2) | |
|
213 | //BP1_set(compressed_sm_f0, NB_BINS_COMPRESSED_SM_F0, LFR_BP1_F0); | |
|
214 | // 3) convert the float array in a char array | |
|
237 | 215 | convert_averaged_spectral_matrix( averaged_sm_f0, averaged_sm_f0_char); |
|
238 |
// |
|
|
239 | send_spectral_matrix( &headerASM, averaged_sm_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id); | |
|
216 | // 4) send the spectral matrix packets | |
|
217 | send_averaged_spectral_matrix( &headerASM, averaged_sm_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id); | |
|
240 | 218 | } |
|
241 | 219 | } |
|
242 | 220 | |
@@ -251,32 +229,130 void matrix_reset(volatile float *averag | |||
|
251 | 229 | } |
|
252 | 230 | } |
|
253 | 231 | |
|
254 |
void |
|
|
232 | void compress_averaged_spectral_matrix( float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat ) | |
|
255 | 233 | { |
|
256 | int i; | |
|
257 | int j; | |
|
234 | int frequencyBin; | |
|
235 | int asmComponent; | |
|
236 | int offsetASM; | |
|
237 | int generalOffsetASM; | |
|
238 | int offsetCompressed; | |
|
239 | int k; | |
|
240 | ||
|
258 | 241 | switch (fChannel){ |
|
259 |
|
|
|
260 | for(i=0;i<NB_BINS_COMPRESSED_SM_F0;i++){ | |
|
261 | j = 17 + (i * 8); | |
|
262 | compressed_spec_mat[i] = (averaged_spec_mat[j] | |
|
263 | + averaged_spec_mat[j+1] | |
|
264 | + averaged_spec_mat[j+2] | |
|
265 | + averaged_spec_mat[j+3] | |
|
266 | + averaged_spec_mat[j+4] | |
|
267 | + averaged_spec_mat[j+5] | |
|
268 | + averaged_spec_mat[j+6] | |
|
269 | + averaged_spec_mat[j+7])/(8*NB_AVERAGE_NORMAL_f0); | |
|
242 | case 0: | |
|
243 | generalOffsetASM = ASM_F0_INDICE_START * NB_VALUES_PER_SM; | |
|
244 | for( frequencyBin = 0; frequencyBin < NB_BINS_COMPRESSED_SM_F0; frequencyBin++ ) | |
|
245 | { | |
|
246 | offsetCompressed = frequencyBin * NB_VALUES_PER_SM; | |
|
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 | { | |
|
250 | compressed_spec_mat[ offsetCompressed + asmComponent ] = 0; | |
|
251 | for ( k = 0; k < NB_BINS_TO_AVERAGE_ASM_F0; k++ ) | |
|
252 | { | |
|
253 | compressed_spec_mat[ offsetCompressed + asmComponent ] = | |
|
254 | compressed_spec_mat[ offsetCompressed + asmComponent ] | |
|
255 | + averaged_spec_mat[ offsetASM + (k*NB_VALUES_PER_SM) + asmComponent ]; | |
|
270 | 256 | } |
|
271 | break; | |
|
272 | case 1: | |
|
257 | compressed_spec_mat[ offsetCompressed + asmComponent ] = | |
|
258 | compressed_spec_mat[ offsetCompressed + asmComponent ] / NB_BINS_TO_AVERAGE_ASM_F0; | |
|
259 | } | |
|
260 | } | |
|
261 | break; | |
|
262 | ||
|
263 | case 1: | |
|
264 | // case fChannel = f1 to be completed later | |
|
265 | break; | |
|
266 | ||
|
267 | case 2: | |
|
273 | 268 | // case fChannel = f1 to be completed later |
|
269 | break; | |
|
270 | ||
|
271 | default: | |
|
272 | break; | |
|
273 | } | |
|
274 | } | |
|
275 | ||
|
276 | void convert_averaged_spectral_matrix( volatile float *input_matrix, char *output_matrix) | |
|
277 | { | |
|
278 | unsigned int i; | |
|
279 | unsigned int j; | |
|
280 | char * pt_char_input; | |
|
281 | char * pt_char_output; | |
|
282 | ||
|
283 | pt_char_input = NULL; | |
|
284 | pt_char_output = NULL; | |
|
285 | ||
|
286 | for( i=0; i<NB_BINS_PER_SM; i++) | |
|
287 | { | |
|
288 | for ( j=0; j<NB_VALUES_PER_SM; j++) | |
|
289 | { | |
|
290 | pt_char_input = (char*) &input_matrix [ (i*NB_VALUES_PER_SM) + j ]; | |
|
291 | pt_char_output = (char*) &output_matrix[ 2 * ( (i*NB_VALUES_PER_SM) + j ) ]; | |
|
292 | 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 | |
|
294 | } | |
|
295 | } | |
|
296 | } | |
|
297 | ||
|
298 | void send_averaged_spectral_matrix(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) | |
|
300 | { | |
|
301 | unsigned int i; | |
|
302 | unsigned int length = 0; | |
|
303 | rtems_status_code status; | |
|
304 | ||
|
305 | for (i=0; i<2; i++) | |
|
306 | { | |
|
307 | // (1) BUILD THE DATA | |
|
308 | switch(sid) | |
|
309 | { | |
|
310 | case SID_NORM_ASM_F0: | |
|
311 | 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 ]; | |
|
313 | 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 | |
|
315 | header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F0); // BLK_NR LSB | |
|
274 | 316 | break; |
|
275 |
case |
|
|
276 | // case fChannel = f1 to be completed later | |
|
317 | case SID_NORM_ASM_F1: | |
|
318 | break; | |
|
319 | case SID_NORM_ASM_F2: | |
|
277 | 320 | break; |
|
278 | 321 | default: |
|
322 | PRINTF1("ERR *** in send_averaged_spectral_matrix *** unexpected sid %d\n", sid) | |
|
279 | 323 | break; |
|
324 | } | |
|
325 | spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES; | |
|
326 | spw_ioctl_send->hdr = (char *) header; | |
|
327 | spw_ioctl_send->options = 0; | |
|
328 | ||
|
329 | // (2) BUILD THE HEADER | |
|
330 | header->packetLength[0] = (unsigned char) (length>>8); | |
|
331 | header->packetLength[1] = (unsigned char) (length); | |
|
332 | header->sid = (unsigned char) sid; // SID | |
|
333 | header->pa_lfr_pkt_cnt_asm = 2; | |
|
334 | header->pa_lfr_pkt_nr_asm = (unsigned char) (i+1); | |
|
335 | ||
|
336 | // (3) SET PACKET TIME | |
|
337 | header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
|
338 | header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
|
339 | header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
|
340 | header->time[3] = (unsigned char) (time_management_regs->coarse_time); | |
|
341 | header->time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
|
342 | header->time[5] = (unsigned char) (time_management_regs->fine_time); | |
|
343 | // | |
|
344 | header->acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
|
345 | header->acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
|
346 | header->acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
|
347 | header->acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time); | |
|
348 | header->acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
|
349 | header->acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time); | |
|
350 | ||
|
351 | // (4) SEND PACKET | |
|
352 | status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE); | |
|
353 | if (status != RTEMS_SUCCESSFUL) { | |
|
354 | printf("in send_averaged_spectral_matrix *** ERR %d\n", (int) status); | |
|
355 | } | |
|
280 | 356 | } |
|
281 | 357 | } |
|
282 | 358 | |
@@ -495,89 +571,6 void init_header_asm( Header_TM_LFR_SCIE | |||
|
495 | 571 | header->pa_lfr_asm_blk_nr[1] = 0x00; // BLK_NR LSB |
|
496 | 572 | } |
|
497 | 573 | |
|
498 | void send_spectral_matrix(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, | |
|
499 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id) | |
|
500 | { | |
|
501 | unsigned int i; | |
|
502 | unsigned int length = 0; | |
|
503 | rtems_status_code status; | |
|
504 | ||
|
505 | for (i=0; i<2; i++) | |
|
506 | { | |
|
507 | // (1) BUILD THE DATA | |
|
508 | switch(sid) | |
|
509 | { | |
|
510 | case SID_NORM_ASM_F0: | |
|
511 | spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F0_IN_BYTES / 2; | |
|
512 | spw_ioctl_send->data = &spectral_matrix[ ( (ASM_F0_INDICE_START+ (i*NB_BINS_PER_PKT_ASM_F0)) * NB_VALUES_PER_SM) * 2 ]; | |
|
513 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0; | |
|
514 | header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F0) >> 8 ); // BLK_NR MSB | |
|
515 | header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F0); // BLK_NR LSB | |
|
516 | break; | |
|
517 | case SID_NORM_ASM_F1: | |
|
518 | break; | |
|
519 | case SID_NORM_ASM_F2: | |
|
520 | break; | |
|
521 | default: | |
|
522 | PRINTF1("ERR *** in send_spectral_matrix *** unexpected sid %d\n", sid) | |
|
523 | break; | |
|
524 | } | |
|
525 | spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES; | |
|
526 | spw_ioctl_send->hdr = (char *) header; | |
|
527 | spw_ioctl_send->options = 0; | |
|
528 | ||
|
529 | // (2) BUILD THE HEADER | |
|
530 | header->packetLength[0] = (unsigned char) (length>>8); | |
|
531 | header->packetLength[1] = (unsigned char) (length); | |
|
532 | header->sid = (unsigned char) sid; // SID | |
|
533 | header->pa_lfr_pkt_cnt_asm = 2; | |
|
534 | header->pa_lfr_pkt_nr_asm = (unsigned char) (i+1); | |
|
535 | ||
|
536 | // (3) SET PACKET TIME | |
|
537 | header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
|
538 | header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
|
539 | header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
|
540 | header->time[3] = (unsigned char) (time_management_regs->coarse_time); | |
|
541 | header->time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
|
542 | header->time[5] = (unsigned char) (time_management_regs->fine_time); | |
|
543 | // | |
|
544 | header->acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
|
545 | header->acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
|
546 | header->acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
|
547 | header->acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time); | |
|
548 | header->acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
|
549 | header->acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time); | |
|
550 | ||
|
551 | // (4) SEND PACKET | |
|
552 | status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE); | |
|
553 | if (status != RTEMS_SUCCESSFUL) { | |
|
554 | printf("in send_spectral_matrix *** ERR %d\n", (int) status); | |
|
555 | } | |
|
556 | } | |
|
557 | } | |
|
558 | ||
|
559 | void convert_averaged_spectral_matrix( volatile float *input_matrix, char *output_matrix) | |
|
560 | { | |
|
561 | unsigned int i; | |
|
562 | unsigned int j; | |
|
563 | char * pt_char_input; | |
|
564 | char * pt_char_output; | |
|
565 | ||
|
566 | pt_char_input = NULL; | |
|
567 | pt_char_output = NULL; | |
|
568 | ||
|
569 | for( i=0; i<NB_BINS_PER_SM; i++) | |
|
570 | { | |
|
571 | for ( j=0; j<NB_VALUES_PER_SM; j++) | |
|
572 | { | |
|
573 | pt_char_input = (char*) &input_matrix [ (i*NB_VALUES_PER_SM) + j ]; | |
|
574 | pt_char_output = (char*) &output_matrix[ 2 * ( (i*NB_VALUES_PER_SM) + j ) ]; | |
|
575 | pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float | |
|
576 | pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float | |
|
577 | } | |
|
578 | } | |
|
579 | } | |
|
580 | ||
|
581 | 574 | void fill_averaged_spectral_matrix(void) |
|
582 | 575 | { |
|
583 | 576 | /** This function fills spectral matrices related buffers with arbitrary data. |
@@ -445,7 +445,7 int enter_mode(unsigned char mode ) | |||
|
445 | 445 | #endif |
|
446 | 446 | status = restart_science_tasks(); |
|
447 | 447 | launch_waveform_picker( mode ); |
|
448 | launch_spectral_matrix( mode ); | |
|
448 | //launch_spectral_matrix( mode ); | |
|
449 | 449 | } |
|
450 | 450 | else if ( mode == LFR_MODE_STANDBY ) |
|
451 | 451 | { |
@@ -498,12 +498,6 int restart_science_tasks() | |||
|
498 | 498 | PRINTF1("in restart_science_task *** 0 ERR %d\n", status[0]) |
|
499 | 499 | } |
|
500 | 500 | |
|
501 | status[1] = rtems_task_restart( Task_id[TASKID_BPF0],1 ); | |
|
502 | if (status[1] != RTEMS_SUCCESSFUL) | |
|
503 | { | |
|
504 | PRINTF1("in restart_science_task *** 1 ERR %d\n", status[1]) | |
|
505 | } | |
|
506 | ||
|
507 | 501 | status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 ); |
|
508 | 502 | if (status[2] != RTEMS_SUCCESSFUL) |
|
509 | 503 | { |
@@ -528,7 +522,7 int restart_science_tasks() | |||
|
528 | 522 | PRINTF1("in restart_science_task *** 5 ERR %d\n", status[5]) |
|
529 | 523 | } |
|
530 | 524 | |
|
531 |
if ( (status[0 |
|
|
525 | if ( (status[0] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) || | |
|
532 | 526 | (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) ) |
|
533 | 527 | { |
|
534 | 528 | ret = RTEMS_UNSATISFIED; |
@@ -556,15 +550,6 int suspend_science_tasks() | |||
|
556 | 550 | PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status) |
|
557 | 551 | } |
|
558 | 552 | |
|
559 | if (status == RTEMS_SUCCESSFUL) // suspend BPF0 | |
|
560 | { | |
|
561 | status = rtems_task_suspend( Task_id[TASKID_BPF0] ); | |
|
562 | if (status != RTEMS_SUCCESSFUL) | |
|
563 | { | |
|
564 | PRINTF1("in suspend_science_task *** BPF0 ERR %d\n", status) | |
|
565 | } | |
|
566 | } | |
|
567 | ||
|
568 | 553 | if (status == RTEMS_SUCCESSFUL) // suspend WFRM |
|
569 | 554 | { |
|
570 | 555 | status = rtems_task_suspend( Task_id[TASKID_WFRM] ); |
@@ -1016,15 +1016,19 void compute_acquisition_time( unsigned | |||
|
1016 | 1016 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 4096. ; |
|
1017 | 1017 | break; |
|
1018 | 1018 | |
|
1019 | case SID_NORM_SWF_F2: | |
|
1020 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 256. ; | |
|
1021 | break; | |
|
1022 | ||
|
1019 | 1023 | case SID_SBM1_CWF_F1: |
|
1020 | 1024 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 4096. ; |
|
1021 | 1025 | break; |
|
1022 | 1026 | |
|
1023 |
case SID_ |
|
|
1024 |
deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_ |
|
|
1027 | case SID_SBM2_CWF_F2: | |
|
1028 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ; | |
|
1025 | 1029 | break; |
|
1026 | 1030 | |
|
1027 |
case SID_ |
|
|
1031 | case SID_BURST_CWF_F2: | |
|
1028 | 1032 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ; |
|
1029 | 1033 | break; |
|
1030 | 1034 | |
@@ -1037,6 +1041,7 void compute_acquisition_time( unsigned | |||
|
1037 | 1041 | break; |
|
1038 | 1042 | |
|
1039 | 1043 | default: |
|
1044 | PRINTF1("in compute_acquisition_time *** ERR unexpected sid %d", sid) | |
|
1040 | 1045 | deltaT = 0.; |
|
1041 | 1046 | break; |
|
1042 | 1047 | } |
General Comments 0
You need to be logged in to leave comments.
Login now