@@ -0,0 +1,66 | |||
|
1 | #ifndef GSCMEMORY_HPP_ | |
|
2 | #define GSCMEMORY_HPP_ | |
|
3 | ||
|
4 | static unsigned int getCacheControlRegister(){ | |
|
5 | ||
|
6 | #ifndef LEON3 | |
|
7 | #define LEON3 | |
|
8 | #endif | |
|
9 | ||
|
10 | #ifdef LEON3 | |
|
11 | unsigned int cacheControlRegister = 0; | |
|
12 | __asm__ __volatile__("lda [%%g0] 2, %0" : "=r"(cacheControlRegister) : ); | |
|
13 | return cacheControlRegister; | |
|
14 | #endif | |
|
15 | } | |
|
16 | ||
|
17 | static void setCacheControlRegister(unsigned int cacheControlRegister){ | |
|
18 | ||
|
19 | #ifdef LEON3 | |
|
20 | __asm__ __volatile__("sta %0, [%%g0] 2" : : "r"(cacheControlRegister)); | |
|
21 | #endif | |
|
22 | } | |
|
23 | ||
|
24 | ||
|
25 | /** | |
|
26 | * Flush the data cache and the instruction cache. | |
|
27 | * | |
|
28 | * @return | |
|
29 | */ | |
|
30 | static inline void flushCache() { | |
|
31 | asm("flush"); | |
|
32 | } | |
|
33 | ||
|
34 | ||
|
35 | static void enableInstructionCache() { | |
|
36 | ||
|
37 | #ifdef LEON3 | |
|
38 | unsigned int cacheControlRegister; | |
|
39 | cacheControlRegister = getCacheControlRegister(); | |
|
40 | cacheControlRegister = (cacheControlRegister | 0x3); | |
|
41 | setCacheControlRegister(cacheControlRegister); | |
|
42 | #endif | |
|
43 | } | |
|
44 | ||
|
45 | static void enableDataCache() { | |
|
46 | ||
|
47 | #ifdef LEON3 | |
|
48 | unsigned int cacheControlRegister; | |
|
49 | cacheControlRegister = getCacheControlRegister(); | |
|
50 | cacheControlRegister = (cacheControlRegister | 0xc); | |
|
51 | setCacheControlRegister(cacheControlRegister); | |
|
52 | #endif | |
|
53 | } | |
|
54 | ||
|
55 | static void enableInstructionBurstFetch() { | |
|
56 | ||
|
57 | #ifdef LEON3 | |
|
58 | unsigned int cacheControlRegister; | |
|
59 | cacheControlRegister = getCacheControlRegister(); | |
|
60 | // set the bit IB to 1 | |
|
61 | cacheControlRegister = (cacheControlRegister | 0x10000); | |
|
62 | setCacheControlRegister(cacheControlRegister); | |
|
63 | #endif | |
|
64 | } | |
|
65 | ||
|
66 | #endif /* GSCMEMORY_HPP_ */ |
@@ -1,2 +1,2 | |||
|
1 | d896e23033404156cdc95f5bf66e038de84de04b LFR_basic-parameters | |
|
2 | 5cfb4f574403f86583ac510d5921709548a9c902 header/lfr_common_headers | |
|
1 | a0aa2c6f13574ae69c8645af2a2afa5d448e6c76 LFR_basic-parameters | |
|
2 | a8668a35669295aaba22432d247158626f00a52a header/lfr_common_headers |
@@ -2,7 +2,7 TEMPLATE = app | |||
|
2 | 2 | # CONFIG += console v8 sim |
|
3 | 3 | # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** vhdl_dev *** debug_tch |
|
4 | 4 | # lpp_dpu_destid |
|
5 | CONFIG += console verbose lpp_dpu_destid cpu_usage_report | |
|
5 | CONFIG += console verbose lpp_dpu_destid cpu_usage_report stack_report | |
|
6 | 6 | CONFIG -= qt |
|
7 | 7 | |
|
8 | 8 | include(./sparc.pri) |
@@ -107,5 +107,6 HEADERS += \ | |||
|
107 | 107 | ../header/lfr_common_headers/TC_types.h \ |
|
108 | 108 | ../header/lfr_common_headers/tm_byte_positions.h \ |
|
109 | 109 | ../LFR_basic-parameters/basic_parameters.h \ |
|
110 | ../LFR_basic-parameters/basic_parameters_params.h | |
|
110 | ../LFR_basic-parameters/basic_parameters_params.h \ | |
|
111 | ../header/GscMemoryLPP.hpp | |
|
111 | 112 |
@@ -16,6 +16,8 | |||
|
16 | 16 | #include "avf1_prc1.h" |
|
17 | 17 | #include "avf2_prc2.h" |
|
18 | 18 | |
|
19 | #include "GscMemoryLPP.hpp" | |
|
20 | ||
|
19 | 21 | extern rtems_name Task_name[20]; /* array of task names */ |
|
20 | 22 | extern rtems_id Task_id[20]; /* array of task ids */ |
|
21 | 23 |
@@ -40,13 +40,32 typedef struct | |||
|
40 | 40 | unsigned char acquisitionTime[6]; |
|
41 | 41 | unsigned char pa_lfr_bp_blk_nr[2]; |
|
42 | 42 | // SOURCE DATA |
|
43 |
unsigned char data[ |
|
|
43 | unsigned char data[ 780 ]; // MAX size is 26 bins * 30 Bytes [TM_LFR_SCIENCE_BURST_BP2_F1] | |
|
44 | 44 | } bp_packet; |
|
45 | 45 | |
|
46 | 46 | typedef struct |
|
47 | 47 | { |
|
48 | Header_TM_LFR_SCIENCE_BP_with_spare_t header; | |
|
49 | unsigned char data[ 9 * 13 ]; // only for TM_LFR_SCIENCE_NORMAL_BP1_F0 and F1 | |
|
48 | unsigned char targetLogicalAddress; | |
|
49 | unsigned char protocolIdentifier; | |
|
50 | unsigned char reserved; | |
|
51 | unsigned char userApplication; | |
|
52 | unsigned char packetID[2]; | |
|
53 | unsigned char packetSequenceControl[2]; | |
|
54 | unsigned char packetLength[2]; | |
|
55 | // DATA FIELD HEADER | |
|
56 | unsigned char spare1_pusVersion_spare2; | |
|
57 | unsigned char serviceType; | |
|
58 | unsigned char serviceSubType; | |
|
59 | unsigned char destinationID; | |
|
60 | unsigned char time[6]; | |
|
61 | // AUXILIARY HEADER | |
|
62 | unsigned char sid; | |
|
63 | unsigned char biaStatusInfo; | |
|
64 | unsigned char acquisitionTime[6]; | |
|
65 | unsigned char source_data_spare; | |
|
66 | unsigned char pa_lfr_bp_blk_nr[2]; | |
|
67 | // SOURCE DATA | |
|
68 | unsigned char data[ 117 ]; // 13 bins * 9 Bytes only for TM_LFR_SCIENCE_NORMAL_BP1_F0 and F1 | |
|
50 | 69 | } bp_packet_with_spare; |
|
51 | 70 | |
|
52 | 71 | typedef struct |
@@ -93,10 +112,10 void ASM_generic_init_ring(ring_node_asm | |||
|
93 | 112 | // Basic Parameters |
|
94 | 113 | |
|
95 | 114 | void BP_reset_current_ring_nodes( void ); |
|
96 |
void BP_init_header(bp_packet * |
|
|
115 | void BP_init_header(bp_packet *packet, | |
|
97 | 116 | unsigned int apid, unsigned char sid, |
|
98 | 117 | unsigned int packetLength , unsigned char blkNr); |
|
99 |
void BP_init_header_with_spare( |
|
|
118 | void BP_init_header_with_spare(bp_packet_with_spare *packet, | |
|
100 | 119 | unsigned int apid, unsigned char sid, |
|
101 | 120 | unsigned int packetLength, unsigned char blkNr ); |
|
102 | 121 | void BP_send( char *data, |
@@ -21,7 +21,6 extern volatile int wf_buffer_f0[ ]; | |||
|
21 | 21 | extern volatile int wf_buffer_f1[ ]; |
|
22 | 22 | extern volatile int wf_buffer_f2[ ]; |
|
23 | 23 | extern volatile int wf_buffer_f3[ ]; |
|
24 | extern char wf_cont_f3_light[ ]; | |
|
25 | 24 | |
|
26 | 25 | extern waveform_picker_regs_0_1_18_t *waveform_picker_regs; |
|
27 | 26 | extern time_management_regs_t *time_management_regs; |
@@ -61,7 +60,7 int send_waveform_CWF3_light(ring_node * | |||
|
61 | 60 | // |
|
62 | 61 | void compute_acquisition_time(unsigned int coarseTime, unsigned int fineTime, |
|
63 | 62 | unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char *acquisitionTime ); |
|
64 |
void build_snapshot_from_ring(ring_node *ring_node_to_send |
|
|
63 | void build_snapshot_from_ring(ring_node *ring_node_to_send, unsigned char frequencyChannel , unsigned long long acquisitionTimeF0_asLong); | |
|
65 | 64 | void snapshot_resynchronization( unsigned char *timePtr ); |
|
66 | 65 | // |
|
67 | 66 | rtems_id get_pkts_queue_id( void ); |
@@ -41,7 +41,6 volatile int wf_buffer_f0[ NB_RING_NODES | |||
|
41 | 41 | volatile int wf_buffer_f1[ NB_RING_NODES_F1 * WFRM_BUFFER ] __attribute__((aligned(0x100))); |
|
42 | 42 | volatile int wf_buffer_f2[ NB_RING_NODES_F2 * WFRM_BUFFER ] __attribute__((aligned(0x100))); |
|
43 | 43 | volatile int wf_buffer_f3[ NB_RING_NODES_F3 * WFRM_BUFFER ] __attribute__((aligned(0x100))); |
|
44 | char wf_cont_f3_light[ (NB_SAMPLES_PER_SNAPSHOT) * NB_BYTES_CWF3_LIGHT_BLK + TIME_OFFSET_IN_BYTES ] __attribute__((aligned(0x100))); | |
|
45 | 44 | |
|
46 | 45 | //*********************************** |
|
47 | 46 | // SPECTRAL MATRICES GLOBAL VARIABLES |
@@ -61,6 +61,21 | |||
|
61 | 61 | #include "fsw_init.h" |
|
62 | 62 | #include "fsw_config.c" |
|
63 | 63 | |
|
64 | void initCache() | |
|
65 | { | |
|
66 | // unsigned int cacheControlRegister; | |
|
67 | ||
|
68 | // cacheControlRegister = getCacheControlRegister(); | |
|
69 | // printf("(0) cacheControlRegister = %x\n", cacheControlRegister); | |
|
70 | ||
|
71 | enableInstructionCache(); | |
|
72 | enableDataCache(); | |
|
73 | enableInstructionBurstFetch(); | |
|
74 | ||
|
75 | // cacheControlRegister = getCacheControlRegister(); | |
|
76 | // printf("(1) cacheControlRegister = %x\n", cacheControlRegister); | |
|
77 | } | |
|
78 | ||
|
64 | 79 | rtems_task Init( rtems_task_argument ignored ) |
|
65 | 80 | { |
|
66 | 81 | /** This is the RTEMS INIT taks, it the first task launched by the system. |
@@ -71,6 +86,9 rtems_task Init( rtems_task_argument ign | |||
|
71 | 86 | * |
|
72 | 87 | */ |
|
73 | 88 | |
|
89 | //*********** | |
|
90 | // INIT CACHE | |
|
91 | ||
|
74 | 92 | unsigned char *vhdlVersion; |
|
75 | 93 | |
|
76 | 94 | reset_lfr(); |
@@ -87,9 +105,14 rtems_task Init( rtems_task_argument ign | |||
|
87 | 105 | send_console_outputs_on_apbuart_port(); |
|
88 | 106 | set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE); |
|
89 | 107 | enable_apbuart_transmitter(); |
|
108 | ||
|
90 | 109 | DEBUG_PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n") |
|
91 | 110 | |
|
111 | ||
|
92 | 112 | PRINTF("\n\n\n\n\n") |
|
113 | ||
|
114 | initCache(); | |
|
115 | ||
|
93 | 116 | PRINTF("*************************\n") |
|
94 | 117 | PRINTF("** LFR Flight Software **\n") |
|
95 | 118 | PRINTF1("** %d.", SW_VERSION_N1) |
@@ -324,8 +347,8 int create_all_tasks( void ) // create a | |||
|
324 | 347 | if (status == RTEMS_SUCCESSFUL) // SEND |
|
325 | 348 | { |
|
326 | 349 | status = rtems_task_create( |
|
327 | Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE, | |
|
328 |
RTEMS_DEFAULT_MODES |
|
|
350 | Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE * 2, | |
|
351 | RTEMS_DEFAULT_MODES, | |
|
329 | 352 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_SEND] |
|
330 | 353 | ); |
|
331 | 354 | } |
@@ -360,7 +383,7 int create_all_tasks( void ) // create a | |||
|
360 | 383 | { |
|
361 | 384 | status = rtems_task_create( |
|
362 | 385 | Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE, |
|
363 |
RTEMS_DEFAULT_MODES |
|
|
386 | RTEMS_DEFAULT_MODES, | |
|
364 | 387 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0] |
|
365 | 388 | ); |
|
366 | 389 | } |
@@ -376,7 +399,7 int create_all_tasks( void ) // create a | |||
|
376 | 399 | { |
|
377 | 400 | status = rtems_task_create( |
|
378 | 401 | Task_name[TASKID_AVF1], TASK_PRIORITY_AVF1, RTEMS_MINIMUM_STACK_SIZE, |
|
379 |
RTEMS_DEFAULT_MODES |
|
|
402 | RTEMS_DEFAULT_MODES, | |
|
380 | 403 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF1] |
|
381 | 404 | ); |
|
382 | 405 | } |
@@ -392,7 +415,7 int create_all_tasks( void ) // create a | |||
|
392 | 415 | { |
|
393 | 416 | status = rtems_task_create( |
|
394 | 417 | Task_name[TASKID_AVF2], TASK_PRIORITY_AVF2, RTEMS_MINIMUM_STACK_SIZE, |
|
395 |
RTEMS_DEFAULT_MODES |
|
|
418 | RTEMS_DEFAULT_MODES, | |
|
396 | 419 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF2] |
|
397 | 420 | ); |
|
398 | 421 | } |
@@ -470,7 +493,7 int create_all_tasks( void ) // create a | |||
|
470 | 493 | { |
|
471 | 494 | status = rtems_task_create( |
|
472 | 495 | Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE, |
|
473 |
RTEMS_DEFAULT_MODES |
|
|
496 | RTEMS_DEFAULT_MODES, | |
|
474 | 497 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_HOUS] |
|
475 | 498 | ); |
|
476 | 499 | } |
@@ -255,7 +255,6 rtems_task send_task( rtems_task_argumen | |||
|
255 | 255 | charPtr[3] = incomingData[3]; |
|
256 | 256 | incomingRingNodePtr = (ring_node*) ring_node_address; |
|
257 | 257 | sid = incomingRingNodePtr->sid; |
|
258 | // printf("sid = %d\n", incomingRingNodePtr->sid); | |
|
259 | 258 | if ( (sid==SID_NORM_CWF_LONG_F3) |
|
260 | 259 | || (sid==SID_BURST_CWF_F2 ) |
|
261 | 260 | || (sid==SID_SBM1_CWF_F1 ) |
@@ -439,7 +438,7 int spacewire_configure_link( int fd ) | |||
|
439 | 438 | // |
|
440 | 439 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_EVENT_ID, Task_id[TASKID_SPIQ]); // sets the task ID to which an event is sent when a |
|
441 | 440 | if (status!=RTEMS_SUCCESSFUL) { |
|
442 | PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_EVENT_ID\n") // link-error interrupt occurs | |
|
441 | PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_EVENT_ID\n") // link-error interrupt occurs | |
|
443 | 442 | } |
|
444 | 443 | // |
|
445 | 444 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_DISABLE_ERR, 0); // automatic link-disabling due to link-error interrupts |
@@ -684,12 +683,12 rtems_timer_service_routine user_routine | |||
|
684 | 683 | |
|
685 | 684 | void init_header_cwf( Header_TM_LFR_SCIENCE_CWF_t *header ) |
|
686 | 685 | { |
|
687 |
header->targetLogicalAddress |
|
|
688 |
header->protocolIdentifier |
|
|
689 | header->reserved = DEFAULT_RESERVED; | |
|
690 | header->userApplication = CCSDS_USER_APP; | |
|
691 |
header->packetSequenceControl[0] |
|
|
692 |
header->packetSequenceControl[1] |
|
|
686 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; | |
|
687 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
|
688 | header->reserved = DEFAULT_RESERVED; | |
|
689 | header->userApplication = CCSDS_USER_APP; | |
|
690 | header->packetSequenceControl[0]= TM_PACKET_SEQ_CTRL_STANDALONE; | |
|
691 | header->packetSequenceControl[1]= TM_PACKET_SEQ_CNT_DEFAULT; | |
|
693 | 692 | header->packetLength[0] = 0x00; |
|
694 | 693 | header->packetLength[1] = 0x00; |
|
695 | 694 | // DATA FIELD HEADER |
@@ -984,6 +983,9 int spw_send_waveform_CWF3_light( ring_n | |||
|
984 | 983 | header->blkNr[0] = (unsigned char) (BLK_NR_CWF_SHORT_F3 >> 8); |
|
985 | 984 | header->blkNr[1] = (unsigned char) (BLK_NR_CWF_SHORT_F3 ); |
|
986 | 985 | |
|
986 | printf("spw_send_waveform_CWF3_light => [0] = %x, [1] = %x, [2] = %x, [3] = %x, [4] = %x, [5] = %x\n", | |
|
987 | dataPtr[0], dataPtr[1], dataPtr[2], dataPtr[3], dataPtr[4], dataPtr[5]); | |
|
988 | ||
|
987 | 989 | //********************* |
|
988 | 990 | // SEND CWF3_light DATA |
|
989 | 991 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF_LIGHT; i++) // send waveform |
@@ -199,7 +199,7 rtems_task prc0_task( rtems_task_argumen | |||
|
199 | 199 | |
|
200 | 200 | //************* |
|
201 | 201 | // NORM headers |
|
202 |
BP_init_header_with_spare( &packet_norm_bp1 |
|
|
202 | BP_init_header_with_spare( &packet_norm_bp1, | |
|
203 | 203 | APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F0, |
|
204 | 204 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0, NB_BINS_COMPRESSED_SM_F0 ); |
|
205 | 205 | BP_init_header( &packet_norm_bp2, |
@@ -309,8 +309,8 rtems_task prc0_task( rtems_task_argumen | |||
|
309 | 309 | // 2) compute the BP1 set |
|
310 | 310 | BP1_set( compressed_sm_norm_f0, k_coeff_intercalib_f0_norm, NB_BINS_COMPRESSED_SM_F0, packet_norm_bp1.data ); |
|
311 | 311 | // 3) send the BP1 set |
|
312 |
set_time( packet_norm_bp1 |
|
|
313 |
set_time( packet_norm_bp1 |
|
|
312 | set_time( packet_norm_bp1.time, (unsigned char *) &incomingMsg->coarseTimeNORM ); | |
|
313 | set_time( packet_norm_bp1.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeNORM ); | |
|
314 | 314 | BP_send( (char *) &packet_norm_bp1, queue_id, |
|
315 | 315 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 + PACKET_LENGTH_DELTA, |
|
316 | 316 | SID_NORM_BP1_F0 ); |
@@ -202,7 +202,7 rtems_task prc1_task( rtems_task_argumen | |||
|
202 | 202 | |
|
203 | 203 | //************* |
|
204 | 204 | // NORM headers |
|
205 |
BP_init_header_with_spare( &packet_norm_bp1 |
|
|
205 | BP_init_header_with_spare( &packet_norm_bp1, | |
|
206 | 206 | APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F1, |
|
207 | 207 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F1, NB_BINS_COMPRESSED_SM_F1 ); |
|
208 | 208 | BP_init_header( &packet_norm_bp2, |
@@ -299,13 +299,13 rtems_task prc1_task( rtems_task_argumen | |||
|
299 | 299 | // 1) compress the matrix for Basic Parameters calculation |
|
300 | 300 | ASM_compress_reorganize_and_divide( incomingMsg->norm->matrix, compressed_sm_norm_f1, |
|
301 | 301 | nb_sm_before_f1.norm_bp1, |
|
302 |
NB_BINS_COMPRESSED_SM_F |
|
|
303 |
ASM_F |
|
|
302 | NB_BINS_COMPRESSED_SM_F1, NB_BINS_TO_AVERAGE_ASM_F1, | |
|
303 | ASM_F1_INDICE_START ); | |
|
304 | 304 | // 2) compute the BP1 set |
|
305 | 305 | BP1_set( compressed_sm_norm_f1, k_coeff_intercalib_f1_norm, NB_BINS_COMPRESSED_SM_F1, packet_norm_bp1.data ); |
|
306 | 306 | // 3) send the BP1 set |
|
307 |
set_time( packet_norm_bp1 |
|
|
308 |
set_time( packet_norm_bp1 |
|
|
307 | set_time( packet_norm_bp1.time, (unsigned char *) &incomingMsg->coarseTimeNORM ); | |
|
308 | set_time( packet_norm_bp1.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeNORM ); | |
|
309 | 309 | BP_send( (char *) &packet_norm_bp1, queue_id_send, |
|
310 | 310 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F1 + PACKET_LENGTH_DELTA, |
|
311 | 311 | SID_NORM_BP1_F1 ); |
@@ -16,15 +16,13 extern ring_node sm_ring_f2[ ]; | |||
|
16 | 16 | //*** |
|
17 | 17 | // F2 |
|
18 | 18 | ring_node_asm asm_ring_norm_f2 [ NB_RING_NODES_ASM_NORM_F2 ]; |
|
19 | ring_node_asm asm_ring_burst_sbm_f2[ NB_RING_NODES_ASM_BURST_SBM_F2 ]; | |
|
20 | 19 | |
|
21 | 20 | ring_node ring_to_send_asm_f2 [ NB_RING_NODES_ASM_F2 ]; |
|
22 | 21 | int buffer_asm_f2 [ NB_RING_NODES_ASM_F2 * TOTAL_SIZE_SM ]; |
|
23 | 22 | |
|
24 | 23 | float asm_f2_reorganized [ TOTAL_SIZE_SM ]; |
|
25 |
char asm_f2_char [ |
|
|
24 | char asm_f2_char [ TOTAL_SIZE_SM * 2 ]; | |
|
26 | 25 | float compressed_sm_norm_f2[ TOTAL_SIZE_COMPRESSED_ASM_NORM_F2]; |
|
27 | float compressed_sm_sbm_f2 [ TOTAL_SIZE_COMPRESSED_ASM_SBM_F2 ]; | |
|
28 | 26 | |
|
29 | 27 | float k_coeff_intercalib_f2[ NB_BINS_COMPRESSED_SM_F2 * NB_K_COEFF_PER_BIN ]; // 12 * 32 = 384 |
|
30 | 28 | |
@@ -134,7 +132,7 rtems_task avf2_task( rtems_task_argumen | |||
|
134 | 132 | // send the message to MATR |
|
135 | 133 | if (msgForMATR.event != 0x00) |
|
136 | 134 | { |
|
137 |
status = rtems_message_queue_send( queue_id_prc2, (char *) &msgForMATR, MSG_QUEUE_SIZE_PRC |
|
|
135 | status = rtems_message_queue_send( queue_id_prc2, (char *) &msgForMATR, MSG_QUEUE_SIZE_PRC2); | |
|
138 | 136 | } |
|
139 | 137 | |
|
140 | 138 | if (status != RTEMS_SUCCESSFUL) { |
@@ -150,7 +148,7 rtems_task prc2_task( rtems_task_argumen | |||
|
150 | 148 | asm_msg *incomingMsg; |
|
151 | 149 | // |
|
152 | 150 | rtems_status_code status; |
|
153 | rtems_id queue_id; | |
|
151 | rtems_id queue_id_send; | |
|
154 | 152 | rtems_id queue_id_q_p2; |
|
155 | 153 | bp_packet packet_norm_bp1; |
|
156 | 154 | bp_packet packet_norm_bp2; |
@@ -162,8 +160,6 rtems_task prc2_task( rtems_task_argumen | |||
|
162 | 160 | init_ring( ring_to_send_asm_f2, NB_RING_NODES_ASM_F2, (volatile int*) buffer_asm_f2, TOTAL_SIZE_SM ); |
|
163 | 161 | current_ring_node_to_send_asm_f2 = ring_to_send_asm_f2; |
|
164 | 162 | |
|
165 | incomingMsg = NULL; | |
|
166 | ||
|
167 | 163 | //************* |
|
168 | 164 | // NORM headers |
|
169 | 165 | BP_init_header( &packet_norm_bp1, |
@@ -173,7 +169,7 rtems_task prc2_task( rtems_task_argumen | |||
|
173 | 169 | APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP2_F2, |
|
174 | 170 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F2, NB_BINS_COMPRESSED_SM_F2 ); |
|
175 | 171 | |
|
176 | status = get_message_queue_id_send( &queue_id ); | |
|
172 | status = get_message_queue_id_send( &queue_id_send ); | |
|
177 | 173 | if (status != RTEMS_SUCCESSFUL) |
|
178 | 174 | { |
|
179 | 175 | PRINTF1("in PRC2 *** ERR get_message_queue_id_send %d\n", status) |
@@ -211,7 +207,7 rtems_task prc2_task( rtems_task_argumen | |||
|
211 | 207 | // 3) send the BP1 set |
|
212 | 208 | set_time( packet_norm_bp1.time, (unsigned char *) &incomingMsg->coarseTimeNORM ); |
|
213 | 209 | set_time( packet_norm_bp1.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeNORM ); |
|
214 | BP_send( (char *) &packet_norm_bp1, queue_id, | |
|
210 | BP_send( (char *) &packet_norm_bp1, queue_id_send, | |
|
215 | 211 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F2 + PACKET_LENGTH_DELTA, |
|
216 | 212 | SID_NORM_BP1_F2 ); |
|
217 | 213 | if (incomingMsg->event & RTEMS_EVENT_NORM_BP2_F2) |
@@ -221,7 +217,7 rtems_task prc2_task( rtems_task_argumen | |||
|
221 | 217 | // 2) send the BP2 set |
|
222 | 218 | set_time( packet_norm_bp2.time, (unsigned char *) &incomingMsg->coarseTimeNORM ); |
|
223 | 219 | set_time( packet_norm_bp2.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeNORM ); |
|
224 | BP_send( (char *) &packet_norm_bp2, queue_id, | |
|
220 | BP_send( (char *) &packet_norm_bp2, queue_id_send, | |
|
225 | 221 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F2 + PACKET_LENGTH_DELTA, |
|
226 | 222 | SID_NORM_BP2_F2 ); |
|
227 | 223 | } |
@@ -239,7 +235,7 rtems_task prc2_task( rtems_task_argumen | |||
|
239 | 235 | current_ring_node_to_send_asm_f2->fineTime = incomingMsg->fineTimeNORM; |
|
240 | 236 | current_ring_node_to_send_asm_f2->sid = SID_NORM_ASM_F2; |
|
241 | 237 | // 3) send the spectral matrix packets |
|
242 | status = rtems_message_queue_send( queue_id, ¤t_ring_node_to_send_asm_f2, sizeof( ring_node* ) ); | |
|
238 | status = rtems_message_queue_send( queue_id_send, ¤t_ring_node_to_send_asm_f2, sizeof( ring_node* ) ); | |
|
243 | 239 | // change asm ring node |
|
244 | 240 | current_ring_node_to_send_asm_f2 = current_ring_node_to_send_asm_f2->next; |
|
245 | 241 | } |
@@ -72,6 +72,8 void spectral_matrices_isr_f0( void ) | |||
|
72 | 72 | break; |
|
73 | 73 | case 1: |
|
74 | 74 | full_ring_node = current_ring_node_sm_f0->previous; |
|
75 | full_ring_node->coarseTime = spectral_matrix_regs->f0_0_coarse_time; | |
|
76 | full_ring_node->fineTime = spectral_matrix_regs->f0_0_fine_time; | |
|
75 | 77 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; |
|
76 | 78 | spectral_matrix_regs->f0_0_address = current_ring_node_sm_f0->buffer_address; |
|
77 | 79 | // if there are enough ring nodes ready, wake up an AVFx task |
@@ -79,8 +81,6 void spectral_matrices_isr_f0( void ) | |||
|
79 | 81 | if (nb_sm_f0 == NB_SM_BEFORE_AVF0) |
|
80 | 82 | { |
|
81 | 83 | ring_node_for_averaging_sm_f0 = full_ring_node; |
|
82 | ring_node_for_averaging_sm_f0->coarseTime = spectral_matrix_regs->f0_0_coarse_time; | |
|
83 | ring_node_for_averaging_sm_f0->fineTime = spectral_matrix_regs->f0_0_fine_time; | |
|
84 | 84 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
85 | 85 | { |
|
86 | 86 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
@@ -91,6 +91,8 void spectral_matrices_isr_f0( void ) | |||
|
91 | 91 | break; |
|
92 | 92 | case 2: |
|
93 | 93 | full_ring_node = current_ring_node_sm_f0->previous; |
|
94 | full_ring_node->coarseTime = spectral_matrix_regs->f0_1_coarse_time; | |
|
95 | full_ring_node->fineTime = spectral_matrix_regs->f0_1_fine_time; | |
|
94 | 96 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; |
|
95 | 97 | spectral_matrix_regs->f0_1_address = current_ring_node_sm_f0->buffer_address; |
|
96 | 98 | // if there are enough ring nodes ready, wake up an AVFx task |
@@ -98,8 +100,6 void spectral_matrices_isr_f0( void ) | |||
|
98 | 100 | if (nb_sm_f0 == NB_SM_BEFORE_AVF0) |
|
99 | 101 | { |
|
100 | 102 | ring_node_for_averaging_sm_f0 = full_ring_node; |
|
101 | ring_node_for_averaging_sm_f0->coarseTime = spectral_matrix_regs->f0_1_coarse_time; | |
|
102 | ring_node_for_averaging_sm_f0->fineTime = spectral_matrix_regs->f0_1_fine_time; | |
|
103 | 103 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
104 | 104 | { |
|
105 | 105 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
@@ -130,6 +130,8 void spectral_matrices_isr_f1( void ) | |||
|
130 | 130 | break; |
|
131 | 131 | case 1: |
|
132 | 132 | full_ring_node = current_ring_node_sm_f1->previous; |
|
133 | full_ring_node->coarseTime = spectral_matrix_regs->f1_0_coarse_time; | |
|
134 | full_ring_node->fineTime = spectral_matrix_regs->f1_0_fine_time; | |
|
133 | 135 | current_ring_node_sm_f1 = current_ring_node_sm_f1->next; |
|
134 | 136 | spectral_matrix_regs->f1_0_address = current_ring_node_sm_f1->buffer_address; |
|
135 | 137 | // if there are enough ring nodes ready, wake up an AVFx task |
@@ -137,8 +139,6 void spectral_matrices_isr_f1( void ) | |||
|
137 | 139 | if (nb_sm_f1 == NB_SM_BEFORE_AVF1) |
|
138 | 140 | { |
|
139 | 141 | ring_node_for_averaging_sm_f1 = full_ring_node; |
|
140 | ring_node_for_averaging_sm_f1->coarseTime = spectral_matrix_regs->f1_0_coarse_time; | |
|
141 | ring_node_for_averaging_sm_f1->fineTime = spectral_matrix_regs->f1_0_fine_time; | |
|
142 | 142 | if (rtems_event_send( Task_id[TASKID_AVF1], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
143 | 143 | { |
|
144 | 144 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
@@ -149,6 +149,8 void spectral_matrices_isr_f1( void ) | |||
|
149 | 149 | break; |
|
150 | 150 | case 2: |
|
151 | 151 | full_ring_node = current_ring_node_sm_f1->previous; |
|
152 | full_ring_node->coarseTime = spectral_matrix_regs->f1_1_coarse_time; | |
|
153 | full_ring_node->fineTime = spectral_matrix_regs->f1_1_fine_time; | |
|
152 | 154 | current_ring_node_sm_f1 = current_ring_node_sm_f1->next; |
|
153 | 155 | spectral_matrix_regs->f1_1_address = current_ring_node_sm_f1->buffer_address; |
|
154 | 156 | // if there are enough ring nodes ready, wake up an AVFx task |
@@ -156,8 +158,6 void spectral_matrices_isr_f1( void ) | |||
|
156 | 158 | if (nb_sm_f1 == NB_SM_BEFORE_AVF1) |
|
157 | 159 | { |
|
158 | 160 | ring_node_for_averaging_sm_f1 = full_ring_node; |
|
159 | ring_node_for_averaging_sm_f1->coarseTime = spectral_matrix_regs->f1_1_coarse_time; | |
|
160 | ring_node_for_averaging_sm_f1->fineTime = spectral_matrix_regs->f1_1_fine_time; | |
|
161 | 161 | if (rtems_event_send( Task_id[TASKID_AVF1], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
162 | 162 | { |
|
163 | 163 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
@@ -343,75 +343,75 void SM_reset_current_ring_nodes( void ) | |||
|
343 | 343 | //***************** |
|
344 | 344 | // Basic Parameters |
|
345 | 345 | |
|
346 |
void BP_init_header( bp_packet * |
|
|
346 | void BP_init_header( bp_packet *packet, | |
|
347 | 347 | unsigned int apid, unsigned char sid, |
|
348 | 348 | unsigned int packetLength, unsigned char blkNr ) |
|
349 | 349 | { |
|
350 |
|
|
|
351 |
|
|
|
352 |
|
|
|
353 |
|
|
|
354 |
|
|
|
355 |
|
|
|
356 |
|
|
|
357 |
|
|
|
358 |
|
|
|
359 |
|
|
|
350 | packet->targetLogicalAddress = CCSDS_DESTINATION_ID; | |
|
351 | packet->protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
|
352 | packet->reserved = 0x00; | |
|
353 | packet->userApplication = CCSDS_USER_APP; | |
|
354 | packet->packetID[0] = (unsigned char) (apid >> 8); | |
|
355 | packet->packetID[1] = (unsigned char) (apid); | |
|
356 | packet->packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
|
357 | packet->packetSequenceControl[1] = 0x00; | |
|
358 | packet->packetLength[0] = (unsigned char) (packetLength >> 8); | |
|
359 | packet->packetLength[1] = (unsigned char) (packetLength); | |
|
360 | 360 | // DATA FIELD HEADER |
|
361 |
|
|
|
362 |
|
|
|
363 |
|
|
|
364 |
|
|
|
365 |
|
|
|
366 |
|
|
|
367 |
|
|
|
368 |
|
|
|
369 |
|
|
|
370 |
|
|
|
361 | packet->spare1_pusVersion_spare2 = 0x10; | |
|
362 | packet->serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
|
363 | packet->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
|
364 | packet->destinationID = TM_DESTINATION_ID_GROUND; | |
|
365 | packet->time[0] = 0x00; | |
|
366 | packet->time[1] = 0x00; | |
|
367 | packet->time[2] = 0x00; | |
|
368 | packet->time[3] = 0x00; | |
|
369 | packet->time[4] = 0x00; | |
|
370 | packet->time[5] = 0x00; | |
|
371 | 371 | // AUXILIARY DATA HEADER |
|
372 |
|
|
|
373 |
|
|
|
374 |
|
|
|
375 |
|
|
|
376 |
|
|
|
377 |
|
|
|
378 |
|
|
|
379 |
|
|
|
380 |
|
|
|
381 |
|
|
|
372 | packet->sid = sid; | |
|
373 | packet->biaStatusInfo = 0x00; | |
|
374 | packet->acquisitionTime[0] = 0x00; | |
|
375 | packet->acquisitionTime[1] = 0x00; | |
|
376 | packet->acquisitionTime[2] = 0x00; | |
|
377 | packet->acquisitionTime[3] = 0x00; | |
|
378 | packet->acquisitionTime[4] = 0x00; | |
|
379 | packet->acquisitionTime[5] = 0x00; | |
|
380 | packet->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB | |
|
381 | packet->pa_lfr_bp_blk_nr[1] = blkNr; // BLK_NR LSB | |
|
382 | 382 | } |
|
383 | 383 | |
|
384 |
void BP_init_header_with_spare( |
|
|
384 | void BP_init_header_with_spare( bp_packet_with_spare *packet, | |
|
385 | 385 | unsigned int apid, unsigned char sid, |
|
386 | 386 | unsigned int packetLength , unsigned char blkNr) |
|
387 | 387 | { |
|
388 |
|
|
|
389 |
|
|
|
390 |
|
|
|
391 |
|
|
|
392 |
|
|
|
393 |
|
|
|
394 |
|
|
|
395 |
|
|
|
396 |
|
|
|
397 |
|
|
|
388 | packet->targetLogicalAddress = CCSDS_DESTINATION_ID; | |
|
389 | packet->protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
|
390 | packet->reserved = 0x00; | |
|
391 | packet->userApplication = CCSDS_USER_APP; | |
|
392 | packet->packetID[0] = (unsigned char) (apid >> 8); | |
|
393 | packet->packetID[1] = (unsigned char) (apid); | |
|
394 | packet->packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
|
395 | packet->packetSequenceControl[1] = 0x00; | |
|
396 | packet->packetLength[0] = (unsigned char) (packetLength >> 8); | |
|
397 | packet->packetLength[1] = (unsigned char) (packetLength); | |
|
398 | 398 | // DATA FIELD HEADER |
|
399 |
|
|
|
400 |
|
|
|
401 |
|
|
|
402 |
|
|
|
399 | packet->spare1_pusVersion_spare2 = 0x10; | |
|
400 | packet->serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
|
401 | packet->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
|
402 | packet->destinationID = TM_DESTINATION_ID_GROUND; | |
|
403 | 403 | // AUXILIARY DATA HEADER |
|
404 |
|
|
|
405 |
|
|
|
406 |
|
|
|
407 |
|
|
|
408 |
|
|
|
409 |
|
|
|
410 |
|
|
|
411 |
|
|
|
412 |
|
|
|
413 |
|
|
|
414 |
|
|
|
404 | packet->sid = sid; | |
|
405 | packet->biaStatusInfo = 0x00; | |
|
406 | packet->time[0] = 0x00; | |
|
407 | packet->time[0] = 0x00; | |
|
408 | packet->time[0] = 0x00; | |
|
409 | packet->time[0] = 0x00; | |
|
410 | packet->time[0] = 0x00; | |
|
411 | packet->time[0] = 0x00; | |
|
412 | packet->source_data_spare = 0x00; | |
|
413 | packet->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB | |
|
414 | packet->pa_lfr_bp_blk_nr[1] = blkNr; // BLK_NR LSB | |
|
415 | 415 | } |
|
416 | 416 | |
|
417 | 417 | void BP_send(char *data, rtems_id queue_id, unsigned int nbBytesToSend, unsigned int sid ) |
@@ -29,6 +29,7 ring_node *ring_node_to_send_cwf_f2; | |||
|
29 | 29 | ring_node waveform_ring_f3[NB_RING_NODES_F3]; |
|
30 | 30 | ring_node *current_ring_node_f3; |
|
31 | 31 | ring_node *ring_node_to_send_cwf_f3; |
|
32 | char wf_cont_f3_light[ (NB_SAMPLES_PER_SNAPSHOT) * NB_BYTES_CWF3_LIGHT_BLK ]; | |
|
32 | 33 | |
|
33 | 34 | bool extractSWF = false; |
|
34 | 35 | bool swf_f0_ready = false; |
@@ -120,7 +121,6 inline void waveforms_isr_f3( void ) | |||
|
120 | 121 | if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
121 | 122 | spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ); |
|
122 | 123 | } |
|
123 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2); | |
|
124 | 124 | } |
|
125 | 125 | } |
|
126 | 126 | } |
@@ -204,31 +204,34 inline void waveforms_isr_burst( void ) | |||
|
204 | 204 | unsigned char status; |
|
205 | 205 | rtems_status_code spare_status; |
|
206 | 206 | |
|
207 |
status = (waveform_picker_regs->status & 0x30) >> 4; // [0011 0000] get the status |
|
|
207 | status = (waveform_picker_regs->status & 0x30) >> 4; // [0011 0000] get the status bits for f2 | |
|
208 | ||
|
208 | 209 | |
|
209 | 210 | switch(status) |
|
210 | 211 | { |
|
211 | 212 | case 1: |
|
212 | 213 | ring_node_to_send_cwf_f2 = current_ring_node_f2->previous; |
|
214 | ring_node_to_send_cwf_f2->sid = SID_BURST_CWF_F2; | |
|
213 | 215 | current_ring_node_f2 = current_ring_node_f2->next; |
|
214 | 216 | ring_node_to_send_cwf_f2->coarseTime = waveform_picker_regs->f2_0_coarse_time; |
|
215 | 217 | ring_node_to_send_cwf_f2->fineTime = waveform_picker_regs->f2_0_fine_time; |
|
216 | 218 | waveform_picker_regs->addr_data_f2_0 = current_ring_node_f2->buffer_address; |
|
217 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00004410; // [0100 0100 0001 0000] | |
|
218 | 219 | if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) { |
|
219 | 220 | spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ); |
|
220 | 221 | } |
|
222 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00004410; // [0100 0100 0001 0000] | |
|
221 | 223 | break; |
|
222 | 224 | case 2: |
|
223 | 225 | ring_node_to_send_cwf_f2 = current_ring_node_f2->previous; |
|
226 | ring_node_to_send_cwf_f2->sid = SID_BURST_CWF_F2; | |
|
224 | 227 | current_ring_node_f2 = current_ring_node_f2->next; |
|
225 | 228 | ring_node_to_send_cwf_f2->coarseTime = waveform_picker_regs->f2_1_coarse_time; |
|
226 | 229 | ring_node_to_send_cwf_f2->fineTime = waveform_picker_regs->f2_1_fine_time; |
|
227 | 230 | waveform_picker_regs->addr_data_f2_1 = current_ring_node_f2->buffer_address; |
|
228 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00004420; // [0100 0100 0010 0000] | |
|
229 | 231 | if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) { |
|
230 | 232 | spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ); |
|
231 | 233 | } |
|
234 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00004420; // [0100 0100 0010 0000] | |
|
232 | 235 | break; |
|
233 | 236 | default: |
|
234 | 237 | break; |
@@ -319,8 +322,9 inline void waveforms_isr_sbm2( void ) | |||
|
319 | 322 | // F2 |
|
320 | 323 | if ( (waveform_picker_regs->status & 0x30) != 0x00 ) { // [0011 0000] check the f2 full bit |
|
321 | 324 | // (1) change the receiving buffer for the waveform picker |
|
322 | ring_node_to_send_cwf_f2 = current_ring_node_f2->previous; | |
|
323 | current_ring_node_f2 = current_ring_node_f2->next; | |
|
325 | ring_node_to_send_cwf_f2 = current_ring_node_f2->previous; | |
|
326 | ring_node_to_send_cwf_f2->sid = SID_SBM2_CWF_F2; | |
|
327 | current_ring_node_f2 = current_ring_node_f2->next; | |
|
324 | 328 | if ( (waveform_picker_regs->status & 0x10) == 0x10) |
|
325 | 329 | { |
|
326 | 330 | ring_node_to_send_cwf_f2->coarseTime = waveform_picker_regs->f2_0_coarse_time; |
@@ -615,6 +619,9 rtems_task cwf2_task(rtems_task_argument | |||
|
615 | 619 | rtems_id queue_id; |
|
616 | 620 | rtems_status_code status; |
|
617 | 621 | ring_node *ring_node_to_send; |
|
622 | unsigned long long int acquisitionTimeF0_asLong; | |
|
623 | ||
|
624 | acquisitionTimeF0_asLong = 0x00; | |
|
618 | 625 | |
|
619 | 626 | status = get_message_queue_id_send( &queue_id ); |
|
620 | 627 | if (status != RTEMS_SUCCESSFUL) |
@@ -629,27 +636,19 rtems_task cwf2_task(rtems_task_argument | |||
|
629 | 636 | rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2, |
|
630 | 637 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
631 | 638 | ring_node_to_send = getRingNodeToSendCWF( 2 ); |
|
632 | printf("ring_node_to_send_cwf === coarse = %x, fine = %x\n", ring_node_to_send->coarseTime, ring_node_to_send->fineTime); | |
|
633 | printf("**0** %x . %x", waveform_ring_f2[0].coarseTime, waveform_ring_f2[0].fineTime); | |
|
634 | printf(" **1** %x . %x", waveform_ring_f2[1].coarseTime, waveform_ring_f2[1].fineTime); | |
|
635 | printf(" **2** %x . %x", waveform_ring_f2[2].coarseTime, waveform_ring_f2[2].fineTime); | |
|
636 | printf(" **3** %x . %x", waveform_ring_f2[3].coarseTime, waveform_ring_f2[3].fineTime); | |
|
637 | printf(" **4** %x . %x\n", waveform_ring_f2[4].coarseTime, waveform_ring_f2[4].fineTime); | |
|
638 | 639 | if (event_out == RTEMS_EVENT_MODE_BURST) |
|
639 | 640 | { |
|
640 | ring_node_to_send->sid = SID_BURST_CWF_F2; | |
|
641 | 641 | status = rtems_message_queue_send( queue_id, &ring_node_to_send, sizeof( ring_node* ) ); |
|
642 | 642 | } |
|
643 | 643 | if (event_out == RTEMS_EVENT_MODE_SBM2) |
|
644 | 644 | { |
|
645 | ring_node_to_send->sid = SID_SBM2_CWF_F2; | |
|
646 | 645 | status = rtems_message_queue_send( queue_id, &ring_node_to_send, sizeof( ring_node* ) ); |
|
647 | 646 | // launch snapshot extraction if needed |
|
648 | 647 | if (extractSWF == true) |
|
649 | 648 | { |
|
650 | ring_node_to_send_swf_f2 = ring_node_to_send; | |
|
649 | ring_node_to_send_swf_f2 = ring_node_to_send_cwf_f2; | |
|
651 | 650 | // extract the snapshot |
|
652 | build_snapshot_from_ring( ring_node_to_send_swf_f2, 2 ); | |
|
651 | build_snapshot_from_ring( ring_node_to_send_swf_f2, 2, acquisitionTimeF0_asLong ); | |
|
653 | 652 | // send the snapshot when built |
|
654 | 653 | status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 ); |
|
655 | 654 | extractSWF = false; |
@@ -657,6 +656,8 rtems_task cwf2_task(rtems_task_argument | |||
|
657 | 656 | if (swf_f0_ready && swf_f1_ready) |
|
658 | 657 | { |
|
659 | 658 | extractSWF = true; |
|
659 | // record the acquition time of the fΓ snapshot to use to build the snapshot at f2 | |
|
660 | acquisitionTimeF0_asLong = get_acquisition_time( (unsigned char *) &ring_node_to_send_swf_f0->coarseTime ); | |
|
660 | 661 | swf_f0_ready = false; |
|
661 | 662 | swf_f1_ready = false; |
|
662 | 663 | } |
@@ -694,12 +695,6 rtems_task cwf1_task(rtems_task_argument | |||
|
694 | 695 | rtems_event_receive( RTEMS_EVENT_MODE_SBM1, |
|
695 | 696 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
696 | 697 | ring_node_to_send_cwf = getRingNodeToSendCWF( 1 ); |
|
697 | printf("ring_node_to_send_cwf === coarse = %x, fine = %x\n", ring_node_to_send_cwf->coarseTime, ring_node_to_send_cwf->fineTime); | |
|
698 | printf("**0** %x . %x", waveform_ring_f1[0].coarseTime, waveform_ring_f1[0].fineTime); | |
|
699 | printf(" **1** %x . %x", waveform_ring_f1[1].coarseTime, waveform_ring_f1[1].fineTime); | |
|
700 | printf(" **2** %x . %x", waveform_ring_f1[2].coarseTime, waveform_ring_f1[2].fineTime); | |
|
701 | printf(" **3** %x . %x", waveform_ring_f1[3].coarseTime, waveform_ring_f1[3].fineTime); | |
|
702 | printf(" **4** %x . %x\n\n", waveform_ring_f1[4].coarseTime, waveform_ring_f1[4].fineTime); | |
|
703 | 698 | ring_node_to_send_cwf_f1->sid = SID_SBM1_CWF_F1; |
|
704 | 699 | status = rtems_message_queue_send( queue_id, &ring_node_to_send_cwf, sizeof( ring_node* ) ); |
|
705 | 700 | // launch snapshot extraction if needed |
@@ -733,6 +728,9 rtems_task swbd_task(rtems_task_argument | |||
|
733 | 728 | */ |
|
734 | 729 | |
|
735 | 730 | rtems_event_set event_out; |
|
731 | unsigned long long int acquisitionTimeF0_asLong; | |
|
732 | ||
|
733 | acquisitionTimeF0_asLong = 0x00; | |
|
736 | 734 | |
|
737 | 735 | BOOT_PRINTF("in SWBD ***\n") |
|
738 | 736 | |
@@ -742,7 +740,8 rtems_task swbd_task(rtems_task_argument | |||
|
742 | 740 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
743 | 741 | if (event_out == RTEMS_EVENT_MODE_SBM1) |
|
744 | 742 | { |
|
745 | build_snapshot_from_ring( ring_node_to_send_swf_f1, 1 ); | |
|
743 | acquisitionTimeF0_asLong = get_acquisition_time( (unsigned char *) &ring_node_to_send_swf_f0->coarseTime ); | |
|
744 | build_snapshot_from_ring( ring_node_to_send_swf_f1, 1, acquisitionTimeF0_asLong ); | |
|
746 | 745 | swf_f1_ready = true; // the snapshot has been extracted and is ready to be sent |
|
747 | 746 | } |
|
748 | 747 | else |
@@ -868,6 +867,8 int send_waveform_CWF3_light( ring_node | |||
|
868 | 867 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 ] = sample[ 5 ]; |
|
869 | 868 | } |
|
870 | 869 | |
|
870 | printf("send_waveform_CWF3_light => [0] = %x, [1] = %x, [2] = %x\n", dataPtr[0], dataPtr[1], dataPtr[2]); | |
|
871 | ||
|
871 | 872 | // SEND PACKET |
|
872 | 873 | status = rtems_message_queue_send( queue_id, &ring_node_cwf3_light, sizeof( ring_node* ) ); |
|
873 | 874 | if (status != RTEMS_SUCCESSFUL) { |
@@ -952,11 +953,10 void compute_acquisition_time( unsigned | |||
|
952 | 953 | |
|
953 | 954 | } |
|
954 | 955 | |
|
955 | void build_snapshot_from_ring( ring_node *ring_node_to_send, unsigned char frequencyChannel ) | |
|
956 | void build_snapshot_from_ring( ring_node *ring_node_to_send, unsigned char frequencyChannel, unsigned long long int acquisitionTimeF0_asLong ) | |
|
956 | 957 | { |
|
957 | 958 | unsigned int i; |
|
958 | 959 | unsigned long long int centerTime_asLong; |
|
959 | unsigned long long int acquisitionTimeF0_asLong; | |
|
960 | 960 | unsigned long long int acquisitionTime_asLong; |
|
961 | 961 | unsigned long long int bufferAcquisitionTime_asLong; |
|
962 | 962 | unsigned char *ptr1; |
@@ -977,11 +977,11 void build_snapshot_from_ring( ring_node | |||
|
977 | 977 | deltaT_F2 = 262144; // (2048. / 256. / 2.) * 65536. = 262144; |
|
978 | 978 | sampleOffset_asLong = 0x00; |
|
979 | 979 | |
|
980 | // (1) get the f0 acquisition time | |
|
981 | acquisitionTimeF0_asLong = get_acquisition_time( (unsigned char *) &ring_node_to_send->coarseTime ); | |
|
980 | // (1) get the f0 acquisition time => the value is passed in argument | |
|
982 | 981 | |
|
983 | 982 | // (2) compute the central reference time |
|
984 | 983 | centerTime_asLong = acquisitionTimeF0_asLong + deltaT_F0; |
|
984 | printf("centerTime_asLong = %llx\n", centerTime_asLong); | |
|
985 | 985 | |
|
986 | 986 | // (3) compute the acquisition time of the current snapshot |
|
987 | 987 | switch(frequencyChannel) |
@@ -1010,7 +1010,7 void build_snapshot_from_ring( ring_node | |||
|
1010 | 1010 | for (i=0; i<nb_ring_nodes; i++) |
|
1011 | 1011 | { |
|
1012 | 1012 | PRINTF1("%d ... ", i) |
|
1013 | bufferAcquisitionTime_asLong = get_acquisition_time( (unsigned char *) ring_node_to_send->coarseTime ); | |
|
1013 | bufferAcquisitionTime_asLong = get_acquisition_time( (unsigned char *) &ring_node_to_send->coarseTime ); | |
|
1014 | 1014 | if (bufferAcquisitionTime_asLong <= acquisitionTime_asLong) |
|
1015 | 1015 | { |
|
1016 | 1016 | PRINTF1("buffer found with acquisition time = %llx\n", bufferAcquisitionTime_asLong) |
@@ -1022,7 +1022,7 void build_snapshot_from_ring( ring_node | |||
|
1022 | 1022 | // (5) compute the number of samples to take in the current buffer |
|
1023 | 1023 | sampleOffset_asLong = ((acquisitionTime_asLong - bufferAcquisitionTime_asLong) * frequency_asLong ) >> 16; |
|
1024 | 1024 | nbSamplesPart1_asLong = NB_SAMPLES_PER_SNAPSHOT - sampleOffset_asLong; |
|
1025 |
PRINTF2("sampleOffset_asLong = %ll |
|
|
1025 | PRINTF2("sampleOffset_asLong = %lld, nbSamplesPart1_asLong = %lld\n", sampleOffset_asLong, nbSamplesPart1_asLong) | |
|
1026 | 1026 | |
|
1027 | 1027 | // (6) compute the final acquisition time |
|
1028 | 1028 | acquisitionTime_asLong = bufferAcquisitionTime_asLong + |
General Comments 0
You need to be logged in to leave comments.
Login now