##// END OF EJS Templates
sync
paul -
r181:59ee969ac7c2 VHDL_0_1_28
parent child
Show More
@@ -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
1 a0aa2c6f13574ae69c8645af2a2afa5d448e6c76 LFR_basic-parameters
2 5cfb4f574403f86583ac510d5921709548a9c902 header/lfr_common_headers
2 a8668a35669295aaba22432d247158626f00a52a header/lfr_common_headers
@@ -2,7 +2,7 TEMPLATE = app
2 # CONFIG += console v8 sim
2 # CONFIG += console v8 sim
3 # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** vhdl_dev *** debug_tch
3 # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** vhdl_dev *** debug_tch
4 # lpp_dpu_destid
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 CONFIG -= qt
6 CONFIG -= qt
7
7
8 include(./sparc.pri)
8 include(./sparc.pri)
@@ -107,5 +107,6 HEADERS += \
107 ../header/lfr_common_headers/TC_types.h \
107 ../header/lfr_common_headers/TC_types.h \
108 ../header/lfr_common_headers/tm_byte_positions.h \
108 ../header/lfr_common_headers/tm_byte_positions.h \
109 ../LFR_basic-parameters/basic_parameters.h \
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 #include "avf1_prc1.h"
16 #include "avf1_prc1.h"
17 #include "avf2_prc2.h"
17 #include "avf2_prc2.h"
18
18
19 #include "GscMemoryLPP.hpp"
20
19 extern rtems_name Task_name[20]; /* array of task names */
21 extern rtems_name Task_name[20]; /* array of task names */
20 extern rtems_id Task_id[20]; /* array of task ids */
22 extern rtems_id Task_id[20]; /* array of task ids */
21
23
@@ -40,13 +40,32 typedef struct
40 unsigned char acquisitionTime[6];
40 unsigned char acquisitionTime[6];
41 unsigned char pa_lfr_bp_blk_nr[2];
41 unsigned char pa_lfr_bp_blk_nr[2];
42 // SOURCE DATA
42 // SOURCE DATA
43 unsigned char data[ 30 * 22 ]; // MAX size is 22 * 30 [TM_LFR_SCIENCE_BURST_BP2_F1]
43 unsigned char data[ 780 ]; // MAX size is 26 bins * 30 Bytes [TM_LFR_SCIENCE_BURST_BP2_F1]
44 } bp_packet;
44 } bp_packet;
45
45
46 typedef struct
46 typedef struct
47 {
47 {
48 Header_TM_LFR_SCIENCE_BP_with_spare_t header;
48 unsigned char targetLogicalAddress;
49 unsigned char data[ 9 * 13 ]; // only for TM_LFR_SCIENCE_NORMAL_BP1_F0 and F1
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 } bp_packet_with_spare;
69 } bp_packet_with_spare;
51
70
52 typedef struct
71 typedef struct
@@ -93,10 +112,10 void ASM_generic_init_ring(ring_node_asm
93 // Basic Parameters
112 // Basic Parameters
94
113
95 void BP_reset_current_ring_nodes( void );
114 void BP_reset_current_ring_nodes( void );
96 void BP_init_header(bp_packet *header,
115 void BP_init_header(bp_packet *packet,
97 unsigned int apid, unsigned char sid,
116 unsigned int apid, unsigned char sid,
98 unsigned int packetLength , unsigned char blkNr);
117 unsigned int packetLength , unsigned char blkNr);
99 void BP_init_header_with_spare( Header_TM_LFR_SCIENCE_BP_with_spare_t *header,
118 void BP_init_header_with_spare(bp_packet_with_spare *packet,
100 unsigned int apid, unsigned char sid,
119 unsigned int apid, unsigned char sid,
101 unsigned int packetLength, unsigned char blkNr );
120 unsigned int packetLength, unsigned char blkNr );
102 void BP_send( char *data,
121 void BP_send( char *data,
@@ -21,7 +21,6 extern volatile int wf_buffer_f0[ ];
21 extern volatile int wf_buffer_f1[ ];
21 extern volatile int wf_buffer_f1[ ];
22 extern volatile int wf_buffer_f2[ ];
22 extern volatile int wf_buffer_f2[ ];
23 extern volatile int wf_buffer_f3[ ];
23 extern volatile int wf_buffer_f3[ ];
24 extern char wf_cont_f3_light[ ];
25
24
26 extern waveform_picker_regs_0_1_18_t *waveform_picker_regs;
25 extern waveform_picker_regs_0_1_18_t *waveform_picker_regs;
27 extern time_management_regs_t *time_management_regs;
26 extern time_management_regs_t *time_management_regs;
@@ -61,7 +60,7 int send_waveform_CWF3_light(ring_node *
61 //
60 //
62 void compute_acquisition_time(unsigned int coarseTime, unsigned int fineTime,
61 void compute_acquisition_time(unsigned int coarseTime, unsigned int fineTime,
63 unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char *acquisitionTime );
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 , unsigned char frequencyChannel );
63 void build_snapshot_from_ring(ring_node *ring_node_to_send, unsigned char frequencyChannel , unsigned long long acquisitionTimeF0_asLong);
65 void snapshot_resynchronization( unsigned char *timePtr );
64 void snapshot_resynchronization( unsigned char *timePtr );
66 //
65 //
67 rtems_id get_pkts_queue_id( void );
66 rtems_id get_pkts_queue_id( void );
@@ -41,7 +41,6 volatile int wf_buffer_f0[ NB_RING_NODES
41 volatile int wf_buffer_f1[ NB_RING_NODES_F1 * WFRM_BUFFER ] __attribute__((aligned(0x100)));
41 volatile int wf_buffer_f1[ NB_RING_NODES_F1 * WFRM_BUFFER ] __attribute__((aligned(0x100)));
42 volatile int wf_buffer_f2[ NB_RING_NODES_F2 * WFRM_BUFFER ] __attribute__((aligned(0x100)));
42 volatile int wf_buffer_f2[ NB_RING_NODES_F2 * WFRM_BUFFER ] __attribute__((aligned(0x100)));
43 volatile int wf_buffer_f3[ NB_RING_NODES_F3 * WFRM_BUFFER ] __attribute__((aligned(0x100)));
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 // SPECTRAL MATRICES GLOBAL VARIABLES
46 // SPECTRAL MATRICES GLOBAL VARIABLES
@@ -61,6 +61,21
61 #include "fsw_init.h"
61 #include "fsw_init.h"
62 #include "fsw_config.c"
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 rtems_task Init( rtems_task_argument ignored )
79 rtems_task Init( rtems_task_argument ignored )
65 {
80 {
66 /** This is the RTEMS INIT taks, it the first task launched by the system.
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 unsigned char *vhdlVersion;
92 unsigned char *vhdlVersion;
75
93
76 reset_lfr();
94 reset_lfr();
@@ -87,9 +105,14 rtems_task Init( rtems_task_argument ign
87 send_console_outputs_on_apbuart_port();
105 send_console_outputs_on_apbuart_port();
88 set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE);
106 set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE);
89 enable_apbuart_transmitter();
107 enable_apbuart_transmitter();
108
90 DEBUG_PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n")
109 DEBUG_PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n")
91
110
111
92 PRINTF("\n\n\n\n\n")
112 PRINTF("\n\n\n\n\n")
113
114 initCache();
115
93 PRINTF("*************************\n")
116 PRINTF("*************************\n")
94 PRINTF("** LFR Flight Software **\n")
117 PRINTF("** LFR Flight Software **\n")
95 PRINTF1("** %d.", SW_VERSION_N1)
118 PRINTF1("** %d.", SW_VERSION_N1)
@@ -324,8 +347,8 int create_all_tasks( void ) // create a
324 if (status == RTEMS_SUCCESSFUL) // SEND
347 if (status == RTEMS_SUCCESSFUL) // SEND
325 {
348 {
326 status = rtems_task_create(
349 status = rtems_task_create(
327 Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE,
350 Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE * 2,
328 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
351 RTEMS_DEFAULT_MODES,
329 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_SEND]
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 status = rtems_task_create(
384 status = rtems_task_create(
362 Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE,
385 Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE,
363 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
386 RTEMS_DEFAULT_MODES,
364 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0]
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 status = rtems_task_create(
400 status = rtems_task_create(
378 Task_name[TASKID_AVF1], TASK_PRIORITY_AVF1, RTEMS_MINIMUM_STACK_SIZE,
401 Task_name[TASKID_AVF1], TASK_PRIORITY_AVF1, RTEMS_MINIMUM_STACK_SIZE,
379 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
402 RTEMS_DEFAULT_MODES,
380 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF1]
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 status = rtems_task_create(
416 status = rtems_task_create(
394 Task_name[TASKID_AVF2], TASK_PRIORITY_AVF2, RTEMS_MINIMUM_STACK_SIZE,
417 Task_name[TASKID_AVF2], TASK_PRIORITY_AVF2, RTEMS_MINIMUM_STACK_SIZE,
395 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
418 RTEMS_DEFAULT_MODES,
396 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF2]
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 status = rtems_task_create(
494 status = rtems_task_create(
472 Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE,
495 Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE,
473 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
496 RTEMS_DEFAULT_MODES,
474 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_HOUS]
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 charPtr[3] = incomingData[3];
255 charPtr[3] = incomingData[3];
256 incomingRingNodePtr = (ring_node*) ring_node_address;
256 incomingRingNodePtr = (ring_node*) ring_node_address;
257 sid = incomingRingNodePtr->sid;
257 sid = incomingRingNodePtr->sid;
258 // printf("sid = %d\n", incomingRingNodePtr->sid);
259 if ( (sid==SID_NORM_CWF_LONG_F3)
258 if ( (sid==SID_NORM_CWF_LONG_F3)
260 || (sid==SID_BURST_CWF_F2 )
259 || (sid==SID_BURST_CWF_F2 )
261 || (sid==SID_SBM1_CWF_F1 )
260 || (sid==SID_SBM1_CWF_F1 )
@@ -439,7 +438,7 int spacewire_configure_link( int fd )
439 //
438 //
440 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_EVENT_ID, Task_id[TASKID_SPIQ]); // sets the task ID to which an event is sent when a
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 if (status!=RTEMS_SUCCESSFUL) {
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 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_DISABLE_ERR, 0); // automatic link-disabling due to link-error interrupts
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 void init_header_cwf( Header_TM_LFR_SCIENCE_CWF_t *header )
684 void init_header_cwf( Header_TM_LFR_SCIENCE_CWF_t *header )
686 {
685 {
687 header->targetLogicalAddress = CCSDS_DESTINATION_ID;
686 header->targetLogicalAddress = CCSDS_DESTINATION_ID;
688 header->protocolIdentifier = CCSDS_PROTOCOLE_ID;
687 header->protocolIdentifier = CCSDS_PROTOCOLE_ID;
689 header->reserved = DEFAULT_RESERVED;
688 header->reserved = DEFAULT_RESERVED;
690 header->userApplication = CCSDS_USER_APP;
689 header->userApplication = CCSDS_USER_APP;
691 header->packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
690 header->packetSequenceControl[0]= TM_PACKET_SEQ_CTRL_STANDALONE;
692 header->packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
691 header->packetSequenceControl[1]= TM_PACKET_SEQ_CNT_DEFAULT;
693 header->packetLength[0] = 0x00;
692 header->packetLength[0] = 0x00;
694 header->packetLength[1] = 0x00;
693 header->packetLength[1] = 0x00;
695 // DATA FIELD HEADER
694 // DATA FIELD HEADER
@@ -984,6 +983,9 int spw_send_waveform_CWF3_light( ring_n
984 header->blkNr[0] = (unsigned char) (BLK_NR_CWF_SHORT_F3 >> 8);
983 header->blkNr[0] = (unsigned char) (BLK_NR_CWF_SHORT_F3 >> 8);
985 header->blkNr[1] = (unsigned char) (BLK_NR_CWF_SHORT_F3 );
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 // SEND CWF3_light DATA
990 // SEND CWF3_light DATA
989 for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF_LIGHT; i++) // send waveform
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 // NORM headers
201 // NORM headers
202 BP_init_header_with_spare( &packet_norm_bp1.header,
202 BP_init_header_with_spare( &packet_norm_bp1,
203 APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F0,
203 APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F0,
204 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0, NB_BINS_COMPRESSED_SM_F0 );
204 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0, NB_BINS_COMPRESSED_SM_F0 );
205 BP_init_header( &packet_norm_bp2,
205 BP_init_header( &packet_norm_bp2,
@@ -309,8 +309,8 rtems_task prc0_task( rtems_task_argumen
309 // 2) compute the BP1 set
309 // 2) compute the BP1 set
310 BP1_set( compressed_sm_norm_f0, k_coeff_intercalib_f0_norm, NB_BINS_COMPRESSED_SM_F0, packet_norm_bp1.data );
310 BP1_set( compressed_sm_norm_f0, k_coeff_intercalib_f0_norm, NB_BINS_COMPRESSED_SM_F0, packet_norm_bp1.data );
311 // 3) send the BP1 set
311 // 3) send the BP1 set
312 set_time( packet_norm_bp1.header.time, (unsigned char *) &incomingMsg->coarseTimeNORM );
312 set_time( packet_norm_bp1.time, (unsigned char *) &incomingMsg->coarseTimeNORM );
313 set_time( packet_norm_bp1.header.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeNORM );
313 set_time( packet_norm_bp1.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeNORM );
314 BP_send( (char *) &packet_norm_bp1, queue_id,
314 BP_send( (char *) &packet_norm_bp1, queue_id,
315 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 + PACKET_LENGTH_DELTA,
315 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 + PACKET_LENGTH_DELTA,
316 SID_NORM_BP1_F0 );
316 SID_NORM_BP1_F0 );
@@ -202,7 +202,7 rtems_task prc1_task( rtems_task_argumen
202
202
203 //*************
203 //*************
204 // NORM headers
204 // NORM headers
205 BP_init_header_with_spare( &packet_norm_bp1.header,
205 BP_init_header_with_spare( &packet_norm_bp1,
206 APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F1,
206 APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F1,
207 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F1, NB_BINS_COMPRESSED_SM_F1 );
207 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F1, NB_BINS_COMPRESSED_SM_F1 );
208 BP_init_header( &packet_norm_bp2,
208 BP_init_header( &packet_norm_bp2,
@@ -299,13 +299,13 rtems_task prc1_task( rtems_task_argumen
299 // 1) compress the matrix for Basic Parameters calculation
299 // 1) compress the matrix for Basic Parameters calculation
300 ASM_compress_reorganize_and_divide( incomingMsg->norm->matrix, compressed_sm_norm_f1,
300 ASM_compress_reorganize_and_divide( incomingMsg->norm->matrix, compressed_sm_norm_f1,
301 nb_sm_before_f1.norm_bp1,
301 nb_sm_before_f1.norm_bp1,
302 NB_BINS_COMPRESSED_SM_F0, NB_BINS_TO_AVERAGE_ASM_F0,
302 NB_BINS_COMPRESSED_SM_F1, NB_BINS_TO_AVERAGE_ASM_F1,
303 ASM_F0_INDICE_START );
303 ASM_F1_INDICE_START );
304 // 2) compute the BP1 set
304 // 2) compute the BP1 set
305 BP1_set( compressed_sm_norm_f1, k_coeff_intercalib_f1_norm, NB_BINS_COMPRESSED_SM_F1, packet_norm_bp1.data );
305 BP1_set( compressed_sm_norm_f1, k_coeff_intercalib_f1_norm, NB_BINS_COMPRESSED_SM_F1, packet_norm_bp1.data );
306 // 3) send the BP1 set
306 // 3) send the BP1 set
307 set_time( packet_norm_bp1.header.time, (unsigned char *) &incomingMsg->coarseTimeNORM );
307 set_time( packet_norm_bp1.time, (unsigned char *) &incomingMsg->coarseTimeNORM );
308 set_time( packet_norm_bp1.header.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeNORM );
308 set_time( packet_norm_bp1.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeNORM );
309 BP_send( (char *) &packet_norm_bp1, queue_id_send,
309 BP_send( (char *) &packet_norm_bp1, queue_id_send,
310 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F1 + PACKET_LENGTH_DELTA,
310 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F1 + PACKET_LENGTH_DELTA,
311 SID_NORM_BP1_F1 );
311 SID_NORM_BP1_F1 );
@@ -16,15 +16,13 extern ring_node sm_ring_f2[ ];
16 //***
16 //***
17 // F2
17 // F2
18 ring_node_asm asm_ring_norm_f2 [ NB_RING_NODES_ASM_NORM_F2 ];
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 ring_node ring_to_send_asm_f2 [ NB_RING_NODES_ASM_F2 ];
20 ring_node ring_to_send_asm_f2 [ NB_RING_NODES_ASM_F2 ];
22 int buffer_asm_f2 [ NB_RING_NODES_ASM_F2 * TOTAL_SIZE_SM ];
21 int buffer_asm_f2 [ NB_RING_NODES_ASM_F2 * TOTAL_SIZE_SM ];
23
22
24 float asm_f2_reorganized [ TOTAL_SIZE_SM ];
23 float asm_f2_reorganized [ TOTAL_SIZE_SM ];
25 char asm_f2_char [ TIME_OFFSET_IN_BYTES + (TOTAL_SIZE_SM * 2) ];
24 char asm_f2_char [ TOTAL_SIZE_SM * 2 ];
26 float compressed_sm_norm_f2[ TOTAL_SIZE_COMPRESSED_ASM_NORM_F2];
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 float k_coeff_intercalib_f2[ NB_BINS_COMPRESSED_SM_F2 * NB_K_COEFF_PER_BIN ]; // 12 * 32 = 384
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 // send the message to MATR
132 // send the message to MATR
135 if (msgForMATR.event != 0x00)
133 if (msgForMATR.event != 0x00)
136 {
134 {
137 status = rtems_message_queue_send( queue_id_prc2, (char *) &msgForMATR, MSG_QUEUE_SIZE_PRC0);
135 status = rtems_message_queue_send( queue_id_prc2, (char *) &msgForMATR, MSG_QUEUE_SIZE_PRC2);
138 }
136 }
139
137
140 if (status != RTEMS_SUCCESSFUL) {
138 if (status != RTEMS_SUCCESSFUL) {
@@ -150,7 +148,7 rtems_task prc2_task( rtems_task_argumen
150 asm_msg *incomingMsg;
148 asm_msg *incomingMsg;
151 //
149 //
152 rtems_status_code status;
150 rtems_status_code status;
153 rtems_id queue_id;
151 rtems_id queue_id_send;
154 rtems_id queue_id_q_p2;
152 rtems_id queue_id_q_p2;
155 bp_packet packet_norm_bp1;
153 bp_packet packet_norm_bp1;
156 bp_packet packet_norm_bp2;
154 bp_packet packet_norm_bp2;
@@ -162,8 +160,6 rtems_task prc2_task( rtems_task_argumen
162 init_ring( ring_to_send_asm_f2, NB_RING_NODES_ASM_F2, (volatile int*) buffer_asm_f2, TOTAL_SIZE_SM );
160 init_ring( ring_to_send_asm_f2, NB_RING_NODES_ASM_F2, (volatile int*) buffer_asm_f2, TOTAL_SIZE_SM );
163 current_ring_node_to_send_asm_f2 = ring_to_send_asm_f2;
161 current_ring_node_to_send_asm_f2 = ring_to_send_asm_f2;
164
162
165 incomingMsg = NULL;
166
167 //*************
163 //*************
168 // NORM headers
164 // NORM headers
169 BP_init_header( &packet_norm_bp1,
165 BP_init_header( &packet_norm_bp1,
@@ -173,7 +169,7 rtems_task prc2_task( rtems_task_argumen
173 APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP2_F2,
169 APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP2_F2,
174 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F2, NB_BINS_COMPRESSED_SM_F2 );
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 if (status != RTEMS_SUCCESSFUL)
173 if (status != RTEMS_SUCCESSFUL)
178 {
174 {
179 PRINTF1("in PRC2 *** ERR get_message_queue_id_send %d\n", status)
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 // 3) send the BP1 set
207 // 3) send the BP1 set
212 set_time( packet_norm_bp1.time, (unsigned char *) &incomingMsg->coarseTimeNORM );
208 set_time( packet_norm_bp1.time, (unsigned char *) &incomingMsg->coarseTimeNORM );
213 set_time( packet_norm_bp1.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeNORM );
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 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F2 + PACKET_LENGTH_DELTA,
211 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F2 + PACKET_LENGTH_DELTA,
216 SID_NORM_BP1_F2 );
212 SID_NORM_BP1_F2 );
217 if (incomingMsg->event & RTEMS_EVENT_NORM_BP2_F2)
213 if (incomingMsg->event & RTEMS_EVENT_NORM_BP2_F2)
@@ -221,7 +217,7 rtems_task prc2_task( rtems_task_argumen
221 // 2) send the BP2 set
217 // 2) send the BP2 set
222 set_time( packet_norm_bp2.time, (unsigned char *) &incomingMsg->coarseTimeNORM );
218 set_time( packet_norm_bp2.time, (unsigned char *) &incomingMsg->coarseTimeNORM );
223 set_time( packet_norm_bp2.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeNORM );
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 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F2 + PACKET_LENGTH_DELTA,
221 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F2 + PACKET_LENGTH_DELTA,
226 SID_NORM_BP2_F2 );
222 SID_NORM_BP2_F2 );
227 }
223 }
@@ -239,7 +235,7 rtems_task prc2_task( rtems_task_argumen
239 current_ring_node_to_send_asm_f2->fineTime = incomingMsg->fineTimeNORM;
235 current_ring_node_to_send_asm_f2->fineTime = incomingMsg->fineTimeNORM;
240 current_ring_node_to_send_asm_f2->sid = SID_NORM_ASM_F2;
236 current_ring_node_to_send_asm_f2->sid = SID_NORM_ASM_F2;
241 // 3) send the spectral matrix packets
237 // 3) send the spectral matrix packets
242 status = rtems_message_queue_send( queue_id, &current_ring_node_to_send_asm_f2, sizeof( ring_node* ) );
238 status = rtems_message_queue_send( queue_id_send, &current_ring_node_to_send_asm_f2, sizeof( ring_node* ) );
243 // change asm ring node
239 // change asm ring node
244 current_ring_node_to_send_asm_f2 = current_ring_node_to_send_asm_f2->next;
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 break;
72 break;
73 case 1:
73 case 1:
74 full_ring_node = current_ring_node_sm_f0->previous;
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 current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
77 current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
76 spectral_matrix_regs->f0_0_address = current_ring_node_sm_f0->buffer_address;
78 spectral_matrix_regs->f0_0_address = current_ring_node_sm_f0->buffer_address;
77 // if there are enough ring nodes ready, wake up an AVFx task
79 // if there are enough ring nodes ready, wake up an AVFx task
@@ -79,8 +81,6 void spectral_matrices_isr_f0( void )
79 if (nb_sm_f0 == NB_SM_BEFORE_AVF0)
81 if (nb_sm_f0 == NB_SM_BEFORE_AVF0)
80 {
82 {
81 ring_node_for_averaging_sm_f0 = full_ring_node;
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 if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
84 if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
85 {
85 {
86 status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
86 status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
@@ -91,6 +91,8 void spectral_matrices_isr_f0( void )
91 break;
91 break;
92 case 2:
92 case 2:
93 full_ring_node = current_ring_node_sm_f0->previous;
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 current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
96 current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
95 spectral_matrix_regs->f0_1_address = current_ring_node_sm_f0->buffer_address;
97 spectral_matrix_regs->f0_1_address = current_ring_node_sm_f0->buffer_address;
96 // if there are enough ring nodes ready, wake up an AVFx task
98 // if there are enough ring nodes ready, wake up an AVFx task
@@ -98,8 +100,6 void spectral_matrices_isr_f0( void )
98 if (nb_sm_f0 == NB_SM_BEFORE_AVF0)
100 if (nb_sm_f0 == NB_SM_BEFORE_AVF0)
99 {
101 {
100 ring_node_for_averaging_sm_f0 = full_ring_node;
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 if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
103 if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
104 {
104 {
105 status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
105 status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
@@ -130,6 +130,8 void spectral_matrices_isr_f1( void )
130 break;
130 break;
131 case 1:
131 case 1:
132 full_ring_node = current_ring_node_sm_f1->previous;
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 current_ring_node_sm_f1 = current_ring_node_sm_f1->next;
135 current_ring_node_sm_f1 = current_ring_node_sm_f1->next;
134 spectral_matrix_regs->f1_0_address = current_ring_node_sm_f1->buffer_address;
136 spectral_matrix_regs->f1_0_address = current_ring_node_sm_f1->buffer_address;
135 // if there are enough ring nodes ready, wake up an AVFx task
137 // if there are enough ring nodes ready, wake up an AVFx task
@@ -137,8 +139,6 void spectral_matrices_isr_f1( void )
137 if (nb_sm_f1 == NB_SM_BEFORE_AVF1)
139 if (nb_sm_f1 == NB_SM_BEFORE_AVF1)
138 {
140 {
139 ring_node_for_averaging_sm_f1 = full_ring_node;
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 if (rtems_event_send( Task_id[TASKID_AVF1], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
142 if (rtems_event_send( Task_id[TASKID_AVF1], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
143 {
143 {
144 status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
144 status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
@@ -149,6 +149,8 void spectral_matrices_isr_f1( void )
149 break;
149 break;
150 case 2:
150 case 2:
151 full_ring_node = current_ring_node_sm_f1->previous;
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 current_ring_node_sm_f1 = current_ring_node_sm_f1->next;
154 current_ring_node_sm_f1 = current_ring_node_sm_f1->next;
153 spectral_matrix_regs->f1_1_address = current_ring_node_sm_f1->buffer_address;
155 spectral_matrix_regs->f1_1_address = current_ring_node_sm_f1->buffer_address;
154 // if there are enough ring nodes ready, wake up an AVFx task
156 // if there are enough ring nodes ready, wake up an AVFx task
@@ -156,8 +158,6 void spectral_matrices_isr_f1( void )
156 if (nb_sm_f1 == NB_SM_BEFORE_AVF1)
158 if (nb_sm_f1 == NB_SM_BEFORE_AVF1)
157 {
159 {
158 ring_node_for_averaging_sm_f1 = full_ring_node;
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 if (rtems_event_send( Task_id[TASKID_AVF1], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
161 if (rtems_event_send( Task_id[TASKID_AVF1], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
162 {
162 {
163 status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
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 // Basic Parameters
344 // Basic Parameters
345
345
346 void BP_init_header( bp_packet *header,
346 void BP_init_header( bp_packet *packet,
347 unsigned int apid, unsigned char sid,
347 unsigned int apid, unsigned char sid,
348 unsigned int packetLength, unsigned char blkNr )
348 unsigned int packetLength, unsigned char blkNr )
349 {
349 {
350 header->targetLogicalAddress = CCSDS_DESTINATION_ID;
350 packet->targetLogicalAddress = CCSDS_DESTINATION_ID;
351 header->protocolIdentifier = CCSDS_PROTOCOLE_ID;
351 packet->protocolIdentifier = CCSDS_PROTOCOLE_ID;
352 header->reserved = 0x00;
352 packet->reserved = 0x00;
353 header->userApplication = CCSDS_USER_APP;
353 packet->userApplication = CCSDS_USER_APP;
354 header->packetID[0] = (unsigned char) (apid >> 8);
354 packet->packetID[0] = (unsigned char) (apid >> 8);
355 header->packetID[1] = (unsigned char) (apid);
355 packet->packetID[1] = (unsigned char) (apid);
356 header->packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
356 packet->packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
357 header->packetSequenceControl[1] = 0x00;
357 packet->packetSequenceControl[1] = 0x00;
358 header->packetLength[0] = (unsigned char) (packetLength >> 8);
358 packet->packetLength[0] = (unsigned char) (packetLength >> 8);
359 header->packetLength[1] = (unsigned char) (packetLength);
359 packet->packetLength[1] = (unsigned char) (packetLength);
360 // DATA FIELD HEADER
360 // DATA FIELD HEADER
361 header->spare1_pusVersion_spare2 = 0x10;
361 packet->spare1_pusVersion_spare2 = 0x10;
362 header->serviceType = TM_TYPE_LFR_SCIENCE; // service type
362 packet->serviceType = TM_TYPE_LFR_SCIENCE; // service type
363 header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
363 packet->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
364 header->destinationID = TM_DESTINATION_ID_GROUND;
364 packet->destinationID = TM_DESTINATION_ID_GROUND;
365 header->time[0] = 0x00;
365 packet->time[0] = 0x00;
366 header->time[1] = 0x00;
366 packet->time[1] = 0x00;
367 header->time[2] = 0x00;
367 packet->time[2] = 0x00;
368 header->time[3] = 0x00;
368 packet->time[3] = 0x00;
369 header->time[4] = 0x00;
369 packet->time[4] = 0x00;
370 header->time[5] = 0x00;
370 packet->time[5] = 0x00;
371 // AUXILIARY DATA HEADER
371 // AUXILIARY DATA HEADER
372 header->sid = sid;
372 packet->sid = sid;
373 header->biaStatusInfo = 0x00;
373 packet->biaStatusInfo = 0x00;
374 header->acquisitionTime[0] = 0x00;
374 packet->acquisitionTime[0] = 0x00;
375 header->acquisitionTime[1] = 0x00;
375 packet->acquisitionTime[1] = 0x00;
376 header->acquisitionTime[2] = 0x00;
376 packet->acquisitionTime[2] = 0x00;
377 header->acquisitionTime[3] = 0x00;
377 packet->acquisitionTime[3] = 0x00;
378 header->acquisitionTime[4] = 0x00;
378 packet->acquisitionTime[4] = 0x00;
379 header->acquisitionTime[5] = 0x00;
379 packet->acquisitionTime[5] = 0x00;
380 header->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB
380 packet->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB
381 header->pa_lfr_bp_blk_nr[1] = blkNr; // BLK_NR LSB
381 packet->pa_lfr_bp_blk_nr[1] = blkNr; // BLK_NR LSB
382 }
382 }
383
383
384 void BP_init_header_with_spare(Header_TM_LFR_SCIENCE_BP_with_spare_t *header,
384 void BP_init_header_with_spare( bp_packet_with_spare *packet,
385 unsigned int apid, unsigned char sid,
385 unsigned int apid, unsigned char sid,
386 unsigned int packetLength , unsigned char blkNr)
386 unsigned int packetLength , unsigned char blkNr)
387 {
387 {
388 header->targetLogicalAddress = CCSDS_DESTINATION_ID;
388 packet->targetLogicalAddress = CCSDS_DESTINATION_ID;
389 header->protocolIdentifier = CCSDS_PROTOCOLE_ID;
389 packet->protocolIdentifier = CCSDS_PROTOCOLE_ID;
390 header->reserved = 0x00;
390 packet->reserved = 0x00;
391 header->userApplication = CCSDS_USER_APP;
391 packet->userApplication = CCSDS_USER_APP;
392 header->packetID[0] = (unsigned char) (apid >> 8);
392 packet->packetID[0] = (unsigned char) (apid >> 8);
393 header->packetID[1] = (unsigned char) (apid);
393 packet->packetID[1] = (unsigned char) (apid);
394 header->packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
394 packet->packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
395 header->packetSequenceControl[1] = 0x00;
395 packet->packetSequenceControl[1] = 0x00;
396 header->packetLength[0] = (unsigned char) (packetLength >> 8);
396 packet->packetLength[0] = (unsigned char) (packetLength >> 8);
397 header->packetLength[1] = (unsigned char) (packetLength);
397 packet->packetLength[1] = (unsigned char) (packetLength);
398 // DATA FIELD HEADER
398 // DATA FIELD HEADER
399 header->spare1_pusVersion_spare2 = 0x10;
399 packet->spare1_pusVersion_spare2 = 0x10;
400 header->serviceType = TM_TYPE_LFR_SCIENCE; // service type
400 packet->serviceType = TM_TYPE_LFR_SCIENCE; // service type
401 header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
401 packet->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
402 header->destinationID = TM_DESTINATION_ID_GROUND;
402 packet->destinationID = TM_DESTINATION_ID_GROUND;
403 // AUXILIARY DATA HEADER
403 // AUXILIARY DATA HEADER
404 header->sid = sid;
404 packet->sid = sid;
405 header->biaStatusInfo = 0x00;
405 packet->biaStatusInfo = 0x00;
406 header->time[0] = 0x00;
406 packet->time[0] = 0x00;
407 header->time[0] = 0x00;
407 packet->time[0] = 0x00;
408 header->time[0] = 0x00;
408 packet->time[0] = 0x00;
409 header->time[0] = 0x00;
409 packet->time[0] = 0x00;
410 header->time[0] = 0x00;
410 packet->time[0] = 0x00;
411 header->time[0] = 0x00;
411 packet->time[0] = 0x00;
412 header->source_data_spare = 0x00;
412 packet->source_data_spare = 0x00;
413 header->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB
413 packet->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB
414 header->pa_lfr_bp_blk_nr[1] = blkNr; // BLK_NR LSB
414 packet->pa_lfr_bp_blk_nr[1] = blkNr; // BLK_NR LSB
415 }
415 }
416
416
417 void BP_send(char *data, rtems_id queue_id, unsigned int nbBytesToSend, unsigned int sid )
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 ring_node waveform_ring_f3[NB_RING_NODES_F3];
29 ring_node waveform_ring_f3[NB_RING_NODES_F3];
30 ring_node *current_ring_node_f3;
30 ring_node *current_ring_node_f3;
31 ring_node *ring_node_to_send_cwf_f3;
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 bool extractSWF = false;
34 bool extractSWF = false;
34 bool swf_f0_ready = false;
35 bool swf_f0_ready = false;
@@ -120,7 +121,6 inline void waveforms_isr_f3( void )
120 if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
121 if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
121 spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 );
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 unsigned char status;
204 unsigned char status;
205 rtems_status_code spare_status;
205 rtems_status_code spare_status;
206
206
207 status = (waveform_picker_regs->status & 0x30) >> 4; // [0011 0000] get the status_ready_matrix_f0_x bits
207 status = (waveform_picker_regs->status & 0x30) >> 4; // [0011 0000] get the status bits for f2
208
208
209
209 switch(status)
210 switch(status)
210 {
211 {
211 case 1:
212 case 1:
212 ring_node_to_send_cwf_f2 = current_ring_node_f2->previous;
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 current_ring_node_f2 = current_ring_node_f2->next;
215 current_ring_node_f2 = current_ring_node_f2->next;
214 ring_node_to_send_cwf_f2->coarseTime = waveform_picker_regs->f2_0_coarse_time;
216 ring_node_to_send_cwf_f2->coarseTime = waveform_picker_regs->f2_0_coarse_time;
215 ring_node_to_send_cwf_f2->fineTime = waveform_picker_regs->f2_0_fine_time;
217 ring_node_to_send_cwf_f2->fineTime = waveform_picker_regs->f2_0_fine_time;
216 waveform_picker_regs->addr_data_f2_0 = current_ring_node_f2->buffer_address;
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 if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) {
219 if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) {
219 spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 );
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 break;
223 break;
222 case 2:
224 case 2:
223 ring_node_to_send_cwf_f2 = current_ring_node_f2->previous;
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 current_ring_node_f2 = current_ring_node_f2->next;
227 current_ring_node_f2 = current_ring_node_f2->next;
225 ring_node_to_send_cwf_f2->coarseTime = waveform_picker_regs->f2_1_coarse_time;
228 ring_node_to_send_cwf_f2->coarseTime = waveform_picker_regs->f2_1_coarse_time;
226 ring_node_to_send_cwf_f2->fineTime = waveform_picker_regs->f2_1_fine_time;
229 ring_node_to_send_cwf_f2->fineTime = waveform_picker_regs->f2_1_fine_time;
227 waveform_picker_regs->addr_data_f2_1 = current_ring_node_f2->buffer_address;
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 if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) {
231 if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) {
230 spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 );
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 break;
235 break;
233 default:
236 default:
234 break;
237 break;
@@ -319,8 +322,9 inline void waveforms_isr_sbm2( void )
319 // F2