diff --git a/FSW-qt/Makefile b/FSW-qt/Makefile --- a/FSW-qt/Makefile +++ b/FSW-qt/Makefile @@ -1,6 +1,6 @@ ############################################################################# # Makefile for building: bin/fsw -# Generated by qmake (2.01a) (Qt 4.8.6) on: Tue May 6 15:49:26 2014 +# Generated by qmake (2.01a) (Qt 4.8.6) on: Tue May 13 07:12:26 2014 # Project: fsw-qt.pro # Template: app # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro diff --git a/FSW-qt/fsw-qt.pro b/FSW-qt/fsw-qt.pro --- a/FSW-qt/fsw-qt.pro +++ b/FSW-qt/fsw-qt.pro @@ -87,5 +87,6 @@ HEADERS += \ ../header/processing/fsw_processing.h \ ../header/processing/avf0_prc0.h \ ../header/processing/avf1_prc1.h \ - ../header/processing/avf2_prc2.h + ../header/processing/avf2_prc2.h \ + ../header/fsw_params_wf_handler.h diff --git a/FSW-qt/fsw-qt.pro.user b/FSW-qt/fsw-qt.pro.user --- a/FSW-qt/fsw-qt.pro.user +++ b/FSW-qt/fsw-qt.pro.user @@ -1,6 +1,6 @@ - + ProjectExplorer.Project.ActiveTarget @@ -51,9 +51,9 @@ ProjectExplorer.Project.Target.0 - Desktop-Qt 4.8.2 in PATH (System) - Desktop-Qt 4.8.2 in PATH (System) - {5289e843-9ef2-45ce-88c6-ad27d8e08def} + Desktop-Qt 4.8.3 in PATH (System) + Desktop-Qt 4.8.3 in PATH (System) + {be73cf6a-f9d8-4d5a-8adf-adc2d83e2e44} 0 0 0 @@ -192,7 +192,7 @@ ProjectExplorer.Project.Updater.EnvironmentId - {2e58a81f-9962-4bba-ae6b-760177f0656c} + {cdbf9cdc-1e84-406e-889b-c4feef49e75c} ProjectExplorer.Project.Updater.FileVersion diff --git a/header/fsw_params.h b/header/fsw_params.h --- a/header/fsw_params.h +++ b/header/fsw_params.h @@ -35,6 +35,7 @@ typedef struct ring_node #define NB_RING_NODES_F0 3 // AT LEAST 3 #define NB_RING_NODES_F1 5 // AT LEAST 3 #define NB_RING_NODES_F2 5 // AT LEAST 3 +#define NB_RING_NODES_F3 3 // AT LEAST 3 //********** // LFR MODES diff --git a/header/fsw_params_processing.h b/header/fsw_params_processing.h new file mode 100644 --- /dev/null +++ b/header/fsw_params_processing.h @@ -0,0 +1,70 @@ +#ifndef FSW_PARAMS_PROCESSING_H +#define FSW_PARAMS_PROCESSING_H + +#define NB_BINS_PER_SM 128 +#define NB_VALUES_PER_SM 25 +#define TOTAL_SIZE_SM 3200 // 25 * 128 +#define TOTAL_SIZE_NORM_BP1_F0 99 // 11 * 9 = 99 +#define TOTAL_SIZE_NORM_BP1_F1 117 // 13 * 9 = 117 +#define TOTAL_SIZE_NORM_BP1_F2 108 // 12 * 9 = 108 +#define TOTAL_SIZE_SBM1_BP1_F0 198 // 22 * 9 = 198 +// +#define NB_RING_NODES_SM_F0 12 // AT LEAST 3 +#define NB_RING_NODES_ASM_BURST_SBM_F0 10 // AT LEAST 3 +#define NB_RING_NODES_ASM_NORM_F0 10 // AT LEAST 3 +#define NB_RING_NODES_SM_F1 3 // AT LEAST 3 +#define NB_RING_NODES_ASM_BURST_SBM_F1 5 // AT LEAST 3 +#define NB_RING_NODES_ASM_NORM_F1 5 // AT LEAST 3 +#define NB_RING_NODES_SM_F2 3 // AT LEAST 3 +#define NB_RING_NODES_ASM_BURST_SBM_F2 3 // AT LEAST 3 +#define NB_RING_NODES_ASM_NORM_F2 3 // AT LEAST 3 +// +#define NB_BINS_PER_ASM_F0 88 +#define NB_BINS_PER_PKT_ASM_F0 44 +#define TOTAL_SIZE_ASM_F0_IN_BYTES 4400 // 25 * 88 * 2 +#define ASM_F0_INDICE_START 17 // 88 bins +#define ASM_F0_INDICE_STOP 104 // 2 packets of 44 bins +// +#define NB_BINS_PER_ASM_F1 104 +#define NB_BINS_PER_PKT_ASM_F1 52 +#define TOTAL_SIZE_ASM_F1_IN_BYTES 5200 // 25 * 104 * 2 +#define ASM_F1_INDICE_START 6 // 104 bins +#define ASM_F1_INDICE_STOP 109 // 2 packets of 52 bins +// +#define NB_BINS_PER_ASM_F2 96 +#define NB_BINS_PER_PKT_ASM_F2 48 +#define TOTAL_SIZE_ASM_F2_IN_BYTES 4800 // 25 * 96 * 2 +#define ASM_F2_INDICE_START 7 // 96 bins +#define ASM_F2_INDICE_STOP 102 // 2 packets of 48 bins +// +#define NB_BINS_COMPRESSED_SM_F0 11 +#define NB_BINS_COMPRESSED_SM_F1 13 +#define NB_BINS_COMPRESSED_SM_F2 12 +#define NB_BINS_COMPRESSED_SM_SBM_F0 22 +#define NB_BINS_COMPRESSED_SM_SBM_F1 26 +#define NB_BINS_COMPRESSED_SM_SBM_F2 24 +// +#define NB_BYTES_PER_BP1 9 +// +#define NB_BINS_TO_AVERAGE_ASM_F0 8 +#define NB_BINS_TO_AVERAGE_ASM_F1 8 +#define NB_BINS_TO_AVERAGE_ASM_F2 8 +#define NB_BINS_TO_AVERAGE_ASM_SBM_F0 4 +#define NB_BINS_TO_AVERAGE_ASM_SBM_F1 4 +#define NB_BINS_TO_AVERAGE_ASM_SBM_F2 4 +// +#define TOTAL_SIZE_COMPRESSED_ASM_NORM_F0 275 // 11 * 25 WORDS +#define TOTAL_SIZE_COMPRESSED_ASM_NORM_F1 325 // 13 * 25 WORDS +#define TOTAL_SIZE_COMPRESSED_ASM_NORM_F2 300 // 12 * 25 WORDS +#define TOTAL_SIZE_COMPRESSED_ASM_SBM_F0 550 // 22 * 25 WORDS +#define TOTAL_SIZE_COMPRESSED_ASM_SBM_F1 650 // 26 * 25 WORDS +#define TOTAL_SIZE_COMPRESSED_ASM_SBM_F2 600 // 24 * 25 WORDS +#define TOTAL_SIZE_BP1_NORM_F0 99 // 9 * 11 UNSIGNED CHAR +#define TOTAL_SIZE_BP1_SBM_F0 198 // 9 * 22 UNSIGNED CHAR +// GENERAL +#define NB_SM_BEFORE_AVF0 8 // must be 8 due to the SM_average() function +#define NB_SM_BEFORE_AVF1 8 // must be 8 due to the SM_average() function +#define NB_SM_BEFORE_AVF2 1 // must be 1 due to the SM_average_f2() function + +#endif // FSW_PARAMS_PROCESSING_H + diff --git a/header/fsw_params_wf_handler.h b/header/fsw_params_wf_handler.h new file mode 100644 --- /dev/null +++ b/header/fsw_params_wf_handler.h @@ -0,0 +1,8 @@ +#ifndef FSW_PARAMS_WF_HANDLER_H +#define FSW_PARAMS_WF_HANDLER_H + +#define WFRM_BUFFER 8128 // (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 62 + // (2688 * 3 ) + 2 + 62 = 8128 = 0X1FC0 + // 8128 * 4 = 32512 = 0x7F00 + +#endif // FSW_PARAMS_WF_HANDLER_H diff --git a/header/wf_handler.h b/header/wf_handler.h --- a/header/wf_handler.h +++ b/header/wf_handler.h @@ -9,6 +9,7 @@ #include "fsw_params.h" #include "fsw_spacewire.h" #include "fsw_misc.h" +#include "fsw_params_wf_handler.h" #define pi 3.1415 @@ -16,15 +17,10 @@ extern int fdSPW; //***************** // waveform buffers -// F0 -//extern volatile int wf_snap_f0[ ]; -// F1 F2 -extern volatile int wf_snap_f0[ ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 62 ]; -extern volatile int wf_snap_f1[ ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 62 ]; -extern volatile int wf_snap_f2[ ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 62 ]; -// F3 -extern volatile int wf_cont_f3_a[ ]; -extern volatile int wf_cont_f3_b[ ]; +extern volatile int wf_snap_f0[ ]; +extern volatile int wf_snap_f1[ ]; +extern volatile int wf_snap_f2[ ]; +extern volatile int wf_cont_f3[ ]; extern char wf_cont_f3_light[ ]; extern waveform_picker_regs_new_t *waveform_picker_regs; @@ -57,6 +53,7 @@ rtems_task swbd_task( rtems_task_argumen // general functions void init_waveforms( void ); void init_waveform_rings( void ); +void init_waveform_ring( ring_node waveform_ring[], unsigned char nbNodes, volatile int wfrm[] ); void reset_current_ring_nodes( void ); // int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF ); diff --git a/src/fsw_globals.c b/src/fsw_globals.c --- a/src/fsw_globals.c +++ b/src/fsw_globals.c @@ -20,6 +20,7 @@ #include "ccsds_types.h" #include "grlib_regs.h" #include "fsw_params.h" +#include "fsw_params_wf_handler.h" // RTEMS GLOBAL VARIABLES rtems_name misc_name[5]; @@ -35,14 +36,11 @@ unsigned char lfrCurrentMode; // 97 * 256 = 24832 => delta = 248 bytes = 62 words // WAVEFORMS GLOBAL VARIABLES // 2688 * 3 * 4 + 2 * 4 = 32256 + 8 bytes = 32264 // 127 * 256 = 32512 => delta = 248 bytes = 62 words -// F0 -volatile int wf_snap_f0[ NB_RING_NODES_F0 ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 62 ] __attribute__((aligned(0x100))); -// F1 F2 -volatile int wf_snap_f1[ NB_RING_NODES_F1 ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 62 ] __attribute__((aligned(0x100))); -volatile int wf_snap_f2[ NB_RING_NODES_F2 ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 62 ] __attribute__((aligned(0x100))); -// F3 -volatile int wf_cont_f3_a [ (NB_SAMPLES_PER_SNAPSHOT) * NB_WORDS_SWF_BLK + TIME_OFFSET ] __attribute__((aligned(0x100))); -volatile int wf_cont_f3_b [ (NB_SAMPLES_PER_SNAPSHOT) * NB_WORDS_SWF_BLK + TIME_OFFSET ] __attribute__((aligned(0x100))); +// F0 F1 F2 F3 +volatile int wf_snap_f0[ NB_RING_NODES_F0 * WFRM_BUFFER ] __attribute__((aligned(0x100))); +volatile int wf_snap_f1[ NB_RING_NODES_F1 * WFRM_BUFFER ] __attribute__((aligned(0x100))); +volatile int wf_snap_f2[ NB_RING_NODES_F2 * WFRM_BUFFER ] __attribute__((aligned(0x100))); +volatile int wf_cont_f3[ NB_RING_NODES_F3 * WFRM_BUFFER ] __attribute__((aligned(0x100))); char wf_cont_f3_light[ (NB_SAMPLES_PER_SNAPSHOT) * NB_BYTES_CWF3_LIGHT_BLK + TIME_OFFSET_IN_BYTES ] __attribute__((aligned(0x100))); //*********************************** diff --git a/src/processing/avf0_prc0.c b/src/processing/avf0_prc0.c --- a/src/processing/avf0_prc0.c +++ b/src/processing/avf0_prc0.c @@ -21,8 +21,8 @@ float asm_f0_reorganized [ TOTAL_SIZE_ char asm_f0_char [ TIME_OFFSET_IN_BYTES + (TOTAL_SIZE_SM * 2) ]; float compressed_sm_norm_f0[ TOTAL_SIZE_COMPRESSED_ASM_NORM_F0]; float compressed_sm_sbm_f0 [ TOTAL_SIZE_COMPRESSED_ASM_SBM_F0 ]; -unsigned char bp1_norm_f0 [ TOTAL_SIZE_BP1_NORM_F0 ]; -unsigned char bp1_sbm_f0 [ TOTAL_SIZE_BP1_SBM_F0 ]; +//unsigned char bp1_norm_f0 [ TOTAL_SIZE_BP1_NORM_F0 ]; +//unsigned char bp1_sbm_f0 [ TOTAL_SIZE_BP1_SBM_F0 ]; //************ // RTEMS TASKS diff --git a/src/wf_handler.c b/src/wf_handler.c --- a/src/wf_handler.c +++ b/src/wf_handler.c @@ -27,6 +27,7 @@ Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3 ring_node waveform_ring_f0[NB_RING_NODES_F0]; ring_node waveform_ring_f1[NB_RING_NODES_F1]; ring_node waveform_ring_f2[NB_RING_NODES_F2]; +ring_node waveform_ring_f3[NB_RING_NODES_F3]; ring_node *current_ring_node_f0; ring_node *ring_node_to_send_swf_f0; ring_node *current_ring_node_f1; @@ -35,6 +36,8 @@ ring_node *ring_node_to_send_cwf_f1; ring_node *current_ring_node_f2; ring_node *ring_node_to_send_swf_f2; ring_node *ring_node_to_send_cwf_f2; +ring_node *current_ring_node_f3; +ring_node *ring_node_to_send_cwf_f3; bool extractSWF = false; bool swf_f0_ready = false; @@ -71,12 +74,9 @@ rtems_isr waveforms_isr( rtems_vector_nu { // in modes other than STANDBY and BURST, send the CWF_F3 data if ((waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full // (1) change the receiving buffer for the waveform picker - if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3_a) { - waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_b); - } - else { - waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a); - } + ring_node_to_send_cwf_f3 = current_ring_node_f3; + current_ring_node_f3 = current_ring_node_f3->next; + waveform_picker_regs->addr_data_f3 = current_ring_node_f3->buffer_address; // (2) send an event for the waveforms transmission if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); @@ -289,33 +289,18 @@ rtems_task cwf3_task(rtems_task_argument if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01) { PRINTF("send CWF_LONG_F3\n") + send_waveform_CWF( + (volatile int*) current_ring_node_f3->buffer_address, + SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id ); } else { PRINTF("send CWF_F3 (light)\n") - } - if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3_a) { - if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01) - { - send_waveform_CWF( wf_cont_f3_b, SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id ); - } - else - { - send_waveform_CWF3_light( wf_cont_f3_b, headerCWF_F3_light, queue_id ); - } + send_waveform_CWF3_light( + (volatile int*) current_ring_node_f3->buffer_address, + headerCWF_F3_light, queue_id ); } - else - { - if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01) - { - send_waveform_CWF( wf_cont_f3_a, SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id ); - } - else - { - send_waveform_CWF3_light( wf_cont_f3_a, headerCWF_F3_light, queue_id ); - } - } } else { @@ -498,60 +483,39 @@ void init_waveforms( void ) void init_waveform_rings( void ) { - unsigned char i; - // F0 RING - waveform_ring_f0[0].next = (ring_node*) &waveform_ring_f0[1]; - waveform_ring_f0[0].previous = (ring_node*) &waveform_ring_f0[NB_RING_NODES_F0-1]; - waveform_ring_f0[0].buffer_address = (int) &wf_snap_f0[0][0]; - - waveform_ring_f0[NB_RING_NODES_F0-1].next = (ring_node*) &waveform_ring_f0[0]; - waveform_ring_f0[NB_RING_NODES_F0-1].previous = (ring_node*) &waveform_ring_f0[NB_RING_NODES_F0-2]; - waveform_ring_f0[NB_RING_NODES_F0-1].buffer_address = (int) &wf_snap_f0[NB_RING_NODES_F0-1][0]; - - for(i=1; iaddr_data_f0 = current_ring_node_f0->buffer_address; // 0x08 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; // 0x0c waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; // 0x10 - waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a); // 0x14 + waveform_picker_regs->addr_data_f3 = current_ring_node_f3->buffer_address; // 0x14 reset_wfp_status(); // 0x18 // set_wfp_delta_snapshot(); // 0x1c