# HG changeset patch # User paul # Date 2014-04-22 16:13:21 # Node ID 4bba4856191be97788969be845b1d2a023a27c0e # Parent 104ee7d523c013f12f084196c7db6d7f4d65b8b7 AVF1 and PRC1 tasks added for processing at f1 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.5) on: Thu Apr 17 09:53:23 2014 +# Generated by qmake (2.01a) (Qt 4.8.5) on: Tue Apr 22 18:10:21 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.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 diff --git a/header/ccsds_types.h b/header/ccsds_types.h --- a/header/ccsds_types.h +++ b/header/ccsds_types.h @@ -203,14 +203,17 @@ enum apid_destid{ #define PACKET_LENGTH_TC_EXE_CORRUPTED (32 - CCSDS_TC_TM_PACKET_OFFSET) #define PACKET_LENGTH_HK (124 - CCSDS_TC_TM_PACKET_OFFSET) #define PACKET_LENGTH_PARAMETER_DUMP (36 - CCSDS_TC_TM_PACKET_OFFSET) -#define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0 (2228 - CCSDS_TC_TM_PACKET_OFFSET) // 44 * 25 * 2 + 28 - 7 -#define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F1 (2628 - CCSDS_TC_TM_PACKET_OFFSET) // 52 * 25 * 2 + 28 - 7 -#define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F2 (2428 - CCSDS_TC_TM_PACKET_OFFSET) // 48 * 25 * 2 + 28 - 7 -#define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 (126 - CCSDS_TC_TM_PACKET_OFFSET) // 11 * 9 + 27 - 7 -#define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0 (356 - CCSDS_TC_TM_PACKET_OFFSET) // 11 * 30 + 25 - 7 -#define PACKET_LENGTH_TM_LFR_SCIENCE_BURST_BP2_F1 (806 - CCSDS_TC_TM_PACKET_OFFSET) // 26 * 30 + 26 - 7 -#define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0 (224 - CCSDS_TC_TM_PACKET_OFFSET) // 22 * 9 + 26 - 7 -#define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0 (686 - CCSDS_TC_TM_PACKET_OFFSET) // 22 * 30 + 26 - 7 +#define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0 (2228 - CCSDS_TC_TM_PACKET_OFFSET) // 44 * 25 * 2 + 28 +#define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F1 (2628 - CCSDS_TC_TM_PACKET_OFFSET) // 52 * 25 * 2 + 28 +#define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F2 (2428 - CCSDS_TC_TM_PACKET_OFFSET) // 48 * 25 * 2 + 28 +#define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 (126 - CCSDS_TC_TM_PACKET_OFFSET) // 11 * 9 + 27 +#define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0 (356 - CCSDS_TC_TM_PACKET_OFFSET) // 11 * 30 + 26 +#define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F1 (144 - CCSDS_TC_TM_PACKET_OFFSET) // 13 * 9 + 27 +#define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F1 (416 - CCSDS_TC_TM_PACKET_OFFSET) // 13 * 30 + 26 +#define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0 (224 - CCSDS_TC_TM_PACKET_OFFSET) // 22 * 9 + 26 +#define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0 (686 - CCSDS_TC_TM_PACKET_OFFSET) // 22 * 30 + 26 +#define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F1 (260 - CCSDS_TC_TM_PACKET_OFFSET) // 26 * 9 + 26 +#define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F1 (806 - CCSDS_TC_TM_PACKET_OFFSET) // 26 * 30 + 26 #define PACKET_LENGTH_DELTA 11 // 7 + 4 diff --git a/header/fsw_params.h b/header/fsw_params.h --- a/header/fsw_params.h +++ b/header/fsw_params.h @@ -19,30 +19,6 @@ typedef struct ring_node } ring_node; typedef struct { - // F0 - unsigned int f0; - unsigned int norm_bp1_f0; - unsigned int norm_bp2_f0; - unsigned int norm_asm_f0; - unsigned int sbm_bp1_f0; - unsigned int sbm_bp2_f0; - // F1 - unsigned int f1; - unsigned int norm_bp1_f1; - unsigned int norm_bp2_f1; - unsigned int norm_asm_f1; - unsigned int sbm_bp1_f1; - unsigned int sbm_bp2_f1; - // F2 - unsigned int f2; - unsigned int norm_bp1_f2; - unsigned int norm_bp2_f2; - unsigned int norm_asm_f2; - unsigned int sbm_bp1_f2; - unsigned int sbm_bp2_f2; -} nb_sm_t; - -typedef struct { unsigned int norm_bp1_f0; unsigned int norm_bp2_f0; unsigned int norm_asm_f0; @@ -57,15 +33,15 @@ typedef struct { } nb_sm_before_bp_asm_f0; typedef struct { - unsigned int norm_bp1_f1; - unsigned int norm_bp2_f1; - unsigned int norm_asm_f1; - unsigned int burst_sbm_bp1_f1; - unsigned int burst_sbm_bp2_f1; - unsigned int burst_bp1_f1; - unsigned int burst_bp2_f1; - unsigned int sbm2_bp1_f1; - unsigned int sbm2_bp2_f1; + unsigned int norm_bp1; + unsigned int norm_bp2; + unsigned int norm_asm; + unsigned int burst_sbm_bp1; + unsigned int burst_sbm_bp2; + unsigned int burst_bp1; + unsigned int burst_bp2; + unsigned int sbm2_bp1; + unsigned int sbm2_bp2; } nb_sm_before_bp_asm_f1; typedef struct { @@ -215,22 +191,23 @@ typedef struct { #define TASKID_RECV 1 #define TASKID_ACTN 2 #define TASKID_SPIQ 3 -#define TASKID_SMIQ 4 -#define TASKID_STAT 5 -#define TASKID_AVF0 6 -#define TASKID_SWBD 7 -#define TASKID_WFRM 8 -#define TASKID_DUMB 9 -#define TASKID_HOUS 10 -#define TASKID_PRC0 11 -#define TASKID_CWF3 12 -#define TASKID_CWF2 13 -#define TASKID_CWF1 14 -#define TASKID_SEND 15 -#define TASKID_WTDG 16 +#define TASKID_STAT 4 +#define TASKID_AVF0 5 +#define TASKID_SWBD 6 +#define TASKID_WFRM 7 +#define TASKID_DUMB 8 +#define TASKID_HOUS 9 +#define TASKID_PRC0 10 +#define TASKID_CWF3 11 +#define TASKID_CWF2 12 +#define TASKID_CWF1 13 +#define TASKID_SEND 14 +#define TASKID_WTDG 15 +#define TASKID_AVF1 16 +#define TASKID_PRC1 17 #define TASK_PRIORITY_SPIQ 5 -#define TASK_PRIORITY_SMIQ 10 +//#define TASK_PRIORITY_SMIQ 10 #define TASK_PRIORITY_WTDG 20 #define TASK_PRIORITY_HOUS 30 #define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together @@ -242,8 +219,9 @@ typedef struct { #define TASK_PRIORITY_RECV 50 #define TASK_PRIORITY_ACTN 50 #define TASK_PRIORITY_AVF0 60 -#define TASK_PRIORITY_BPF0 60 #define TASK_PRIORITY_PRC0 100 +#define TASK_PRIORITY_PRC1 100 +#define TASK_PRIORITY_AVF1 60 #define TASK_PRIORITY_STAT 200 #define TASK_PRIORITY_DUMB 200 @@ -251,7 +229,6 @@ typedef struct { #define MSG_QUEUE_COUNT_SEND 50 #define MSG_QUEUE_COUNT_PRC0 10 #define MSG_QUEUE_COUNT_PRC1 10 -//#define MSG_QUEUE_SIZE_SEND (PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES) #define MSG_QUEUE_SIZE_SEND 810 // 806 + 4 => TM_LFR_SCIENCE_BURST_BP2_F1 #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options #define MSG_QUEUE_SIZE_PRC0 20 // two pointers and one rtems_event + 2 integers diff --git a/header/fsw_params_processing.h b/header/fsw_params_processing.h --- a/header/fsw_params_processing.h +++ b/header/fsw_params_processing.h @@ -10,10 +10,12 @@ #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_F0 10 // AT LEAST 3 -#define NB_RING_NODES_ASM_NORM_F0 10 // AT LEAST 3 // #define NB_BINS_PER_ASM_F0 88 #define NB_BINS_PER_PKT_ASM_F0 44 @@ -37,12 +39,15 @@ #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_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_F0 275 // 11 * 25 WORDS #define TOTAL_SIZE_COMPRESSED_ASM_F1 325 // 13 * 25 WORDS diff --git a/header/fsw_processing.h b/header/fsw_processing.h --- a/header/fsw_processing.h +++ b/header/fsw_processing.h @@ -23,7 +23,6 @@ typedef struct ring_node_sm typedef struct ring_node_asm { - struct ring_node_asm *previous; struct ring_node_asm *next; float matrix[ TOTAL_SIZE_SM ]; unsigned int status; @@ -50,7 +49,6 @@ typedef struct asm_msg unsigned int fineTime; } asm_msg; -extern nb_sm_t nb_sm; extern nb_sm_before_bp_asm_f0 nb_sm_before_f0; extern nb_sm_before_bp_asm_f1 nb_sm_before_f1; extern nb_sm_before_bp_asm_f2 nb_sm_before_f2; @@ -75,16 +73,18 @@ rtems_isr spectral_matrices_isr( rtems_v rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ); // RTEMS TASKS -rtems_task smiq_task( rtems_task_argument argument ); // added to test the spectral matrix simulator rtems_task avf0_task( rtems_task_argument lfrRequestedMode ); rtems_task prc0_task( rtems_task_argument lfrRequestedMode ); +rtems_task avf1_task( rtems_task_argument lfrRequestedMode ); +rtems_task prc1_task( rtems_task_argument lfrRequestedMode ); //****************** // Spectral Matrices void SM_init_rings( void ); void ASM_init_rings( void ); +void ASM_generic_init_ring(ring_node_asm *ring, unsigned char nbNodes ); void SM_reset_current_ring_nodes( void ); -void ASM_reset_current_ring_node( void ); +void ASM_reset_current_ring_nodes( void ); void ASM_init_header( Header_TM_LFR_SCIENCE_ASM_t *header); void SM_average(float *averaged_spec_mat_f0, float *averaged_spec_mat_f1, ring_node_sm *ring_node_tab[], diff --git a/header/tc_load_dump_parameters.h b/header/tc_load_dump_parameters.h --- a/header/tc_load_dump_parameters.h +++ b/header/tc_load_dump_parameters.h @@ -9,7 +9,6 @@ #include "tm_lfr_tc_exe.h" #include "fsw_misc.h" -extern nb_sm_t nb_sm; extern nb_sm_before_bp_asm_f0 nb_sm_before_f0; extern nb_sm_before_bp_asm_f1 nb_sm_before_f1; extern nb_sm_before_bp_asm_f2 nb_sm_before_f2; diff --git a/src/fsw_globals.c b/src/fsw_globals.c --- a/src/fsw_globals.c +++ b/src/fsw_globals.c @@ -48,7 +48,6 @@ char wf_cont_f3_light[ (NB_SAMPL //*********************************** // SPECTRAL MATRICES GLOBAL VARIABLES -nb_sm_t nb_sm; nb_sm_before_bp_asm_f0 nb_sm_before_f0; nb_sm_before_bp_asm_f1 nb_sm_before_f1; nb_sm_before_bp_asm_f2 nb_sm_before_f2; diff --git a/src/fsw_init.c b/src/fsw_init.c --- a/src/fsw_init.c +++ b/src/fsw_init.c @@ -249,7 +249,6 @@ void create_names( void ) // create all Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' ); Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' ); Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' ); - Task_name[TASKID_SMIQ] = rtems_build_name( 'S', 'M', 'I', 'Q' ); Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' ); Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' ); Task_name[TASKID_SWBD] = rtems_build_name( 'S', 'W', 'B', 'D' ); @@ -262,6 +261,8 @@ void create_names( void ) // create all Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' ); Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' ); Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' ); + Task_name[TASKID_AVF1] = rtems_build_name( 'A', 'V', 'F', '1' ); + Task_name[TASKID_PRC1] = rtems_build_name( 'P', 'R', 'C', '1' ); // rate monotonic period names name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' ); @@ -333,14 +334,6 @@ int create_all_tasks( void ) // create a //****************** // SPECTRAL MATRICES - if (status == RTEMS_SUCCESSFUL) // SMIQ - { - status = rtems_task_create( - Task_name[TASKID_SMIQ], TASK_PRIORITY_SMIQ, RTEMS_MINIMUM_STACK_SIZE, - RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, - RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SMIQ] - ); - } if (status == RTEMS_SUCCESSFUL) // AVF0 { status = rtems_task_create( @@ -349,7 +342,7 @@ int create_all_tasks( void ) // create a RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0] ); } - if (status == RTEMS_SUCCESSFUL) // MATR + if (status == RTEMS_SUCCESSFUL) // PRC0 { status = rtems_task_create( Task_name[TASKID_PRC0], TASK_PRIORITY_PRC0, RTEMS_MINIMUM_STACK_SIZE * 2, @@ -357,6 +350,22 @@ int create_all_tasks( void ) // create a RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC0] ); } + if (status == RTEMS_SUCCESSFUL) // AVF1 + { + status = rtems_task_create( + Task_name[TASKID_AVF1], TASK_PRIORITY_AVF1, RTEMS_MINIMUM_STACK_SIZE, + RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, + RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF1] + ); + } + if (status == RTEMS_SUCCESSFUL) // PRC1 + { + status = rtems_task_create( + Task_name[TASKID_PRC1], TASK_PRIORITY_PRC1, RTEMS_MINIMUM_STACK_SIZE * 2, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC1] + ); + } //**************** // WAVEFORM PICKER @@ -492,29 +501,34 @@ int start_all_tasks( void ) // start all //****************** // SPECTRAL MATRICES - if (status == RTEMS_SUCCESSFUL) // SMIQ - { - status = rtems_task_start( Task_id[TASKID_SMIQ], smiq_task, 1 ); - if (status!=RTEMS_SUCCESSFUL) { - BOOT_PRINTF("in INIT *** Error starting TASK_BPPR\n") - } - } - if (status == RTEMS_SUCCESSFUL) // AVF0 { - status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, 1 ); + status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, LFR_MODE_STANDBY ); if (status!=RTEMS_SUCCESSFUL) { BOOT_PRINTF("in INIT *** Error starting TASK_AVF0\n") } } - if (status == RTEMS_SUCCESSFUL) // PRC0 { - status = rtems_task_start( Task_id[TASKID_PRC0], prc0_task, 1 ); + status = rtems_task_start( Task_id[TASKID_PRC0], prc0_task, LFR_MODE_STANDBY ); if (status!=RTEMS_SUCCESSFUL) { BOOT_PRINTF("in INIT *** Error starting TASK_PRC0\n") } } + if (status == RTEMS_SUCCESSFUL) // AVF1 + { + status = rtems_task_start( Task_id[TASKID_AVF1], avf1_task, LFR_MODE_STANDBY ); + if (status!=RTEMS_SUCCESSFUL) { + BOOT_PRINTF("in INIT *** Error starting TASK_AVF1\n") + } + } + if (status == RTEMS_SUCCESSFUL) // PRC1 + { + status = rtems_task_start( Task_id[TASKID_PRC1], prc1_task, LFR_MODE_STANDBY ); + if (status!=RTEMS_SUCCESSFUL) { + BOOT_PRINTF("in INIT *** Error starting TASK_PRC1\n") + } + } //**************** // WAVEFORM PICKER @@ -525,7 +539,6 @@ int start_all_tasks( void ) // start all BOOT_PRINTF("in INIT *** Error starting TASK_WFRM\n") } } - if (status == RTEMS_SUCCESSFUL) // CWF3 { status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 ); @@ -533,7 +546,6 @@ int start_all_tasks( void ) // start all BOOT_PRINTF("in INIT *** Error starting TASK_CWF3\n") } } - if (status == RTEMS_SUCCESSFUL) // CWF2 { status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 ); @@ -541,7 +553,6 @@ int start_all_tasks( void ) // start all BOOT_PRINTF("in INIT *** Error starting TASK_CWF2\n") } } - if (status == RTEMS_SUCCESSFUL) // CWF1 { status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 ); @@ -549,7 +560,6 @@ int start_all_tasks( void ) // start all BOOT_PRINTF("in INIT *** Error starting TASK_CWF1\n") } } - if (status == RTEMS_SUCCESSFUL) // SWBD { status = rtems_task_start( Task_id[TASKID_SWBD], swbd_task, 1 ); @@ -567,7 +577,6 @@ int start_all_tasks( void ) // start all BOOT_PRINTF("in INIT *** Error starting TASK_HOUS\n") } } - if (status == RTEMS_SUCCESSFUL) // DUMB { status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 ); @@ -575,7 +584,6 @@ int start_all_tasks( void ) // start all BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n") } } - if (status == RTEMS_SUCCESSFUL) // STAT { status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 ); @@ -591,7 +599,8 @@ rtems_status_code create_message_queues( { rtems_status_code status_recv; rtems_status_code status_send; - rtems_status_code status_matr; + rtems_status_code status_q_p0; + rtems_status_code status_q_p1; rtems_status_code ret; rtems_id queue_id; @@ -615,21 +624,21 @@ rtems_status_code create_message_queues( //***************************************************************************** // create the queue for handling averaged spectral matrices for processing @ f0 - status_matr = rtems_message_queue_create( misc_name[QUEUE_PRC0], + status_q_p0 = rtems_message_queue_create( misc_name[QUEUE_PRC0], MSG_QUEUE_COUNT_PRC0, MSG_QUEUE_SIZE_PRC0, RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); - if ( status_send != RTEMS_SUCCESSFUL ) { - PRINTF1("in create_message_queues *** ERR creating PR_0 queue, %d\n", status_matr) + if ( status_q_p0 != RTEMS_SUCCESSFUL ) { + PRINTF1("in create_message_queues *** ERR creating Q_P0 queue, %d\n", status_q_p0) } //***************************************************************************** // create the queue for handling averaged spectral matrices for processing @ f1 -// status_matr = rtems_message_queue_create( misc_name[QUEUE_PRC1], -// MSG_QUEUE_COUNT_PRC1, MSG_QUEUE_SIZE_PRC1, -// RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); -// if ( status_send != RTEMS_SUCCESSFUL ) { -// PRINTF1("in create_message_queues *** ERR creating PR_1 queue, %d\n", status_matr) -// } + status_q_p1 = rtems_message_queue_create( misc_name[QUEUE_PRC1], + MSG_QUEUE_COUNT_PRC1, MSG_QUEUE_SIZE_PRC1, + RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); + if ( status_q_p1 != RTEMS_SUCCESSFUL ) { + PRINTF1("in create_message_queues *** ERR creating Q_P1 queue, %d\n", status_q_p1) + } if ( status_recv != RTEMS_SUCCESSFUL ) { @@ -639,9 +648,13 @@ rtems_status_code create_message_queues( { ret = status_send; } + else if( status_q_p0 != RTEMS_SUCCESSFUL ) + { + ret = status_q_p0; + } else { - ret = status_matr; + ret = status_q_p1; } return ret; diff --git a/src/fsw_processing.c b/src/fsw_processing.c --- a/src/fsw_processing.c +++ b/src/fsw_processing.c @@ -11,6 +11,8 @@ #include "fsw_processing_globals.c" +unsigned int nb_sm_f0; + //************************ // spectral matrices rings ring_node_sm sm_ring_f0[ NB_RING_NODES_SM_F0 ]; @@ -22,14 +24,15 @@ ring_node_sm *current_ring_node_sm_f2; ring_node_sm *ring_node_for_averaging_sm_f0; ring_node_sm *ring_node_for_averaging_sm_f1; +ring_node_asm asm_ring_norm_f0 [ NB_RING_NODES_ASM_NORM_F0 ]; ring_node_asm asm_ring_burst_sbm_f0[ NB_RING_NODES_ASM_BURST_SBM_F0 ]; -ring_node_asm asm_ring_norm_f0 [ NB_RING_NODES_ASM_BURST_SBM_F0 ]; +ring_node_asm asm_ring_norm_f1 [ NB_RING_NODES_ASM_NORM_F1 ]; +ring_node_asm asm_ring_burst_sbm_f1[ NB_RING_NODES_ASM_BURST_SBM_F1 ]; ring_node_asm *current_ring_node_asm_burst_sbm_f0; +ring_node_asm *current_ring_node_asm_norm_f0; ring_node_asm *current_ring_node_asm_burst_sbm_f1; -ring_node_asm *current_ring_node_asm_norm_f0; ring_node_asm *current_ring_node_asm_norm_f1; -float asm_norm_f0 [ TOTAL_SIZE_SM ]; float asm_f0_reorganized [ TOTAL_SIZE_SM ]; char asm_f0_char [ TIME_OFFSET_IN_BYTES + (TOTAL_SIZE_SM * 2) ]; float compressed_sm_norm_f0[ TOTAL_SIZE_COMPRESSED_ASM_F0 ]; @@ -37,14 +40,10 @@ float compressed_sm_sbm [ TOTAL_SIZE_ //*********************************************************** // Interrupt Service Routine for spectral matrices processing + void reset_nb_sm_f0( unsigned char lfrMode ) { - nb_sm.f0 = 0; - nb_sm.norm_bp1_f0 = 0; - nb_sm.norm_bp2_f0 = 0; - nb_sm.norm_asm_f0 = 0; - nb_sm.sbm_bp1_f0 = 0; - nb_sm.sbm_bp2_f0 = 0; + nb_sm_f0 = 0; nb_sm_before_f0.norm_bp1_f0 = parameter_dump_packet.sy_lfr_n_bp_p0 * 96; nb_sm_before_f0.norm_bp2_f0 = parameter_dump_packet.sy_lfr_n_bp_p1 * 96; @@ -80,47 +79,33 @@ void reset_nb_sm_f0( unsigned char lfrMo void reset_nb_sm_f1( unsigned char lfrMode ) { - nb_sm.f1 = 0; - nb_sm.norm_bp1_f1 = 0; - nb_sm.norm_bp2_f1 = 0; - nb_sm.norm_asm_f1 = 0; - nb_sm.sbm_bp1_f1 = 0; - nb_sm.sbm_bp2_f1 = 0; - - nb_sm_before_f1.norm_bp1_f1 = parameter_dump_packet.sy_lfr_n_bp_p0 * 16; - nb_sm_before_f1.norm_bp2_f1 = parameter_dump_packet.sy_lfr_n_bp_p1 * 16; - nb_sm_before_f1.norm_asm_f1 = (parameter_dump_packet.sy_lfr_n_asm_p[0] * 256 + parameter_dump_packet.sy_lfr_n_asm_p[1]) * 16; - nb_sm_before_f1.sbm2_bp1_f1 = parameter_dump_packet.sy_lfr_s2_bp_p0 * 16; - nb_sm_before_f1.sbm2_bp2_f1 = parameter_dump_packet.sy_lfr_s2_bp_p1 * 16; - nb_sm_before_f1.burst_bp1_f1 = parameter_dump_packet.sy_lfr_b_bp_p0 * 16; - nb_sm_before_f1.burst_bp2_f1 = parameter_dump_packet.sy_lfr_b_bp_p1 * 16; + nb_sm_before_f1.norm_bp1 = parameter_dump_packet.sy_lfr_n_bp_p0 * 16; + nb_sm_before_f1.norm_bp2 = parameter_dump_packet.sy_lfr_n_bp_p1 * 16; + nb_sm_before_f1.norm_asm = (parameter_dump_packet.sy_lfr_n_asm_p[0] * 256 + parameter_dump_packet.sy_lfr_n_asm_p[1]) * 16; + nb_sm_before_f1.sbm2_bp1 = parameter_dump_packet.sy_lfr_s2_bp_p0 * 16; + nb_sm_before_f1.sbm2_bp2 = parameter_dump_packet.sy_lfr_s2_bp_p1 * 16; + nb_sm_before_f1.burst_bp1 = parameter_dump_packet.sy_lfr_b_bp_p0 * 16; + nb_sm_before_f1.burst_bp2 = parameter_dump_packet.sy_lfr_b_bp_p1 * 16; if (lfrMode == LFR_MODE_SBM2) { - nb_sm_before_f1.burst_sbm_bp1_f1 = nb_sm_before_f1.sbm2_bp1_f1; - nb_sm_before_f1.burst_sbm_bp2_f1 = nb_sm_before_f1.sbm2_bp2_f1; + nb_sm_before_f1.burst_sbm_bp1 = nb_sm_before_f1.sbm2_bp1; + nb_sm_before_f1.burst_sbm_bp2 = nb_sm_before_f1.sbm2_bp2; } else if (lfrMode == LFR_MODE_BURST) { - nb_sm_before_f1.burst_sbm_bp1_f1 = nb_sm_before_f1.burst_bp1_f1; - nb_sm_before_f1.burst_sbm_bp2_f1 = nb_sm_before_f1.burst_bp2_f1; + nb_sm_before_f1.burst_sbm_bp1 = nb_sm_before_f1.burst_bp1; + nb_sm_before_f1.burst_sbm_bp2 = nb_sm_before_f1.burst_bp2; } else { - nb_sm_before_f1.burst_sbm_bp1_f1 = nb_sm_before_f1.burst_bp1_f1; - nb_sm_before_f1.burst_sbm_bp2_f1 = nb_sm_before_f1.burst_bp2_f1; + nb_sm_before_f1.burst_sbm_bp1 = nb_sm_before_f1.burst_bp1; + nb_sm_before_f1.burst_sbm_bp2 = nb_sm_before_f1.burst_bp2; } } void reset_nb_sm_f2( unsigned char lfrMode ) { - nb_sm.f2 = 0; - nb_sm.norm_bp1_f2 = 0; - nb_sm.norm_bp2_f2 = 0; - nb_sm.norm_asm_f2 = 0; - nb_sm.sbm_bp1_f2 = 0; - nb_sm.sbm_bp2_f2 = 0; - nb_sm_before_f2.norm_bp1_f2 = parameter_dump_packet.sy_lfr_n_bp_p0; nb_sm_before_f2.norm_bp2_f2 = parameter_dump_packet.sy_lfr_n_bp_p1; nb_sm_before_f2.norm_asm_f2 = parameter_dump_packet.sy_lfr_n_asm_p[0] * 256 + parameter_dump_packet.sy_lfr_n_asm_p[1]; @@ -159,7 +144,7 @@ rtems_isr spectral_matrices_isr( rtems_v current_ring_node_sm_f0 = current_ring_node_sm_f0->next; spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address; spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd; // 1101 - nb_sm.f0 = nb_sm.f0 + 1; + nb_sm_f0 = nb_sm_f0 + 1; } //************************ @@ -174,48 +159,40 @@ rtems_isr spectral_matrices_isr( rtems_v // reset ready matrix bits for f0_0, f1 and f2 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff2; // 0010 - if (nb_sm.f0 == NB_SM_BEFORE_AVF0) + if (nb_sm_f0 == NB_SM_BEFORE_AVF0) { ring_node_for_averaging_sm_f0 = previous_ring_node_sm_f0; if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); } - nb_sm.f0 = 0; + nb_sm_f0 = 0; } } rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ) { - if (nb_sm.f0 == (NB_SM_BEFORE_AVF0-1) ) + if (nb_sm_f0 == (NB_SM_BEFORE_AVF0-1) ) { ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0; if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); } - nb_sm.f0 = 0; + nb_sm_f0 = 0; } else { - nb_sm.f0 = nb_sm.f0 + 1; + nb_sm_f0 = nb_sm_f0 + 1; } } //************ // RTEMS TASKS -rtems_task smiq_task( rtems_task_argument argument ) // process the Spectral Matrices IRQ -{ - rtems_event_set event_out; - - BOOT_PRINTF("in SMIQ *** \n") - - while(1){ - rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 - } -} +//***************** +// PROCESSING AT F0 rtems_task avf0_task( rtems_task_argument lfrRequestedMode ) { @@ -227,9 +204,21 @@ rtems_task avf0_task( rtems_task_argumen asm_msg msgForMATR; ring_node_sm *ring_node_tab[8]; + static unsigned int nb_norm_bp1; + static unsigned int nb_norm_bp2; + static unsigned int nb_norm_asm; + static unsigned int nb_sbm_bp1; + static unsigned int nb_sbm_bp2; + + nb_norm_bp1 = 0; + nb_norm_bp2 = 0; + nb_norm_asm = 0; + nb_sbm_bp1 = 0; + nb_sbm_bp2 = 0; + reset_nb_sm_f0( lfrRequestedMode ); // reset the sm counters that drive the BP and ASM computations / transmissions - BOOT_PRINTF1("in AVFO *** lfrRequestedMode = %d\n", lfrRequestedMode) + BOOT_PRINTF1("in AVFO *** lfrRequestedMode = %d\n", (int) lfrRequestedMode) status = get_message_queue_id_prc0( &queue_id_prc0 ); if (status != RTEMS_SUCCESSFUL) @@ -250,14 +239,14 @@ rtems_task avf0_task( rtems_task_argumen SM_average( current_ring_node_asm_norm_f0->matrix, current_ring_node_asm_burst_sbm_f0->matrix, ring_node_tab, - nb_sm.norm_bp1_f0, nb_sm.sbm_bp1_f0 ); + nb_norm_bp1, nb_sbm_bp1 ); // update nb_average - nb_sm.norm_bp1_f0 = nb_sm.norm_bp1_f0 + NB_SM_BEFORE_AVF0; - nb_sm.norm_bp2_f0 = nb_sm.norm_bp2_f0 + NB_SM_BEFORE_AVF0; - nb_sm.norm_asm_f0 = nb_sm.norm_asm_f0 + NB_SM_BEFORE_AVF0; - nb_sm.sbm_bp1_f0 = nb_sm.sbm_bp1_f0 + NB_SM_BEFORE_AVF0; - nb_sm.sbm_bp2_f0 = nb_sm.sbm_bp2_f0 + NB_SM_BEFORE_AVF0; + nb_norm_bp1 = nb_norm_bp1 + NB_SM_BEFORE_AVF0; + nb_norm_bp2 = nb_norm_bp2 + NB_SM_BEFORE_AVF0; + nb_norm_asm = nb_norm_asm + NB_SM_BEFORE_AVF0; + nb_sbm_bp1 = nb_sbm_bp1 + NB_SM_BEFORE_AVF0; + nb_sbm_bp2 = nb_sbm_bp2 + NB_SM_BEFORE_AVF0; //**************************************** // initialize the mesage for the MATR task @@ -267,9 +256,9 @@ rtems_task avf0_task( rtems_task_argumen msgForMATR.coarseTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[0]; msgForMATR.fineTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[1]; - if (nb_sm.sbm_bp1_f0 == nb_sm_before_f0.burst_sbm_bp1_f0) + if (nb_sbm_bp1 == nb_sm_before_f0.burst_sbm_bp1_f0) { - nb_sm.sbm_bp1_f0 = 0; + nb_sbm_bp1 = 0; // set another ring for the ASM storage current_ring_node_asm_burst_sbm_f0 = current_ring_node_asm_burst_sbm_f0->next; if ( (lfrCurrentMode == LFR_MODE_BURST) @@ -279,9 +268,9 @@ rtems_task avf0_task( rtems_task_argumen } } - if (nb_sm.sbm_bp2_f0 == nb_sm_before_f0.burst_sbm_bp2_f0) + if (nb_sbm_bp2 == nb_sm_before_f0.burst_sbm_bp2_f0) { - nb_sm.sbm_bp2_f0 = 0; + nb_sbm_bp2 = 0; if ( (lfrCurrentMode == LFR_MODE_BURST) || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) { @@ -289,9 +278,9 @@ rtems_task avf0_task( rtems_task_argumen } } - if (nb_sm.norm_bp1_f0 == nb_sm_before_f0.norm_bp1_f0) + if (nb_norm_bp1 == nb_sm_before_f0.norm_bp1_f0) { - nb_sm.norm_bp1_f0 = 0; + nb_norm_bp1 = 0; // set another ring for the ASM storage current_ring_node_asm_norm_f0 = current_ring_node_asm_norm_f0->next; if ( (lfrCurrentMode == LFR_MODE_NORMAL) @@ -301,9 +290,9 @@ rtems_task avf0_task( rtems_task_argumen } } - if (nb_sm.norm_bp2_f0 == nb_sm_before_f0.norm_bp2_f0) + if (nb_norm_bp2 == nb_sm_before_f0.norm_bp2_f0) { - nb_sm.norm_bp2_f0 = 0; + nb_norm_bp2 = 0; if ( (lfrCurrentMode == LFR_MODE_NORMAL) || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) { @@ -311,9 +300,9 @@ rtems_task avf0_task( rtems_task_argumen } } - if (nb_sm.norm_asm_f0 == nb_sm_before_f0.norm_asm_f0) + if (nb_norm_asm == nb_sm_before_f0.norm_asm_f0) { - nb_sm.norm_asm_f0 = 0; + nb_norm_asm = 0; if ( (lfrCurrentMode == LFR_MODE_NORMAL) || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) { @@ -326,7 +315,7 @@ rtems_task avf0_task( rtems_task_argumen // send the message to MATR if (msgForMATR.event != 0x00) { - status = rtems_message_queue_send( queue_id_prc0, (char *) & msgForMATR, MSG_QUEUE_SIZE_PRC0); + status = rtems_message_queue_send( queue_id_prc0, (char *) &msgForMATR, MSG_QUEUE_SIZE_PRC0); } if (status != RTEMS_SUCCESSFUL) { @@ -337,166 +326,168 @@ rtems_task avf0_task( rtems_task_argumen rtems_task prc0_task( rtems_task_argument lfrRequestedMode ) { -// char incomingData[MSG_QUEUE_SIZE_SEND]; // incoming data buffer -// size_t size; // size of the incoming TC packet -// asm_msg *incomingMsg; -// // -// spw_ioctl_pkt_send spw_ioctl_send_ASM; -// rtems_status_code status; -// rtems_id queue_id; -// rtems_id queue_id_matr; -// Header_TM_LFR_SCIENCE_ASM_t headerASM; -// bp_packet_with_spare current_node_norm_bp1_f0; -// bp_packet current_node_norm_bp2_f0; -// bp_packet current_node_sbm_bp1_f0; -// bp_packet current_node_sbm_bp2_f0; + char incomingData[MSG_QUEUE_SIZE_SEND]; // incoming data buffer + size_t size; // size of the incoming TC packet + asm_msg *incomingMsg; + // + spw_ioctl_pkt_send spw_ioctl_send_ASM; + rtems_status_code status; + rtems_id queue_id; + rtems_id queue_id_q_p0; + Header_TM_LFR_SCIENCE_ASM_t headerASM; + bp_packet_with_spare packet_norm_bp1_f0; + bp_packet packet_norm_bp2_f0; + bp_packet packet_sbm_bp1_f0; + bp_packet packet_sbm_bp2_f0; -// unsigned long long int localTime; + unsigned long long int localTime; -// ASM_init_header( &headerASM ); + ASM_init_header( &headerASM ); -// //************* -// // NORM headers -// BP_init_header_with_spare( ¤t_node_norm_bp1_f0.header, -// APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F0, -// PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0, NB_BINS_COMPRESSED_SM_F0 ); -// BP_init_header( ¤t_node_norm_bp2_f0.header, -// APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP2_F0, -// PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0, NB_BINS_COMPRESSED_SM_F0); + //************* + // NORM headers + BP_init_header_with_spare( &packet_norm_bp1_f0.header, + APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F0, + PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0, NB_BINS_COMPRESSED_SM_F0 ); + BP_init_header( &packet_norm_bp2_f0.header, + APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP2_F0, + PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0, NB_BINS_COMPRESSED_SM_F0); -// //**************************** -// // BURST SBM1 and SBM2 headers -// if ( (lfrRequestedMode == LFR_MODE_BURST) -// || (lfrRequestedMode == LFR_MODE_NORMAL) || (lfrRequestedMode == LFR_MODE_STANDBY) ) -// { -// BP_init_header( ¤t_node_sbm_bp1_f0.header, -// APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP1_F0, -// PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0); -// BP_init_header( ¤t_node_sbm_bp2_f0.header, -// APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP2_F0, -// PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0); -// } -// else if ( lfrRequestedMode == LFR_MODE_SBM1 ) -// { -// BP_init_header( ¤t_node_sbm_bp1_f0.header, -// APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP1_F0, -// PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0); -// BP_init_header( ¤t_node_sbm_bp2_f0.header, -// APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP2_F0, -// PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0); -// } -// else if ( lfrRequestedMode == LFR_MODE_SBM2 ) -// { -// BP_init_header( ¤t_node_sbm_bp1_f0.header, -// APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP1_F0, -// PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0); -// BP_init_header( ¤t_node_sbm_bp2_f0.header, -// APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP2_F0, -// PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0); -// } -// else -// { -// PRINTF1("ERR *** in MATR *** unexpected lfrRequestedMode passed as argument = %d\n", (unsigned int) lfrRequestedMode) -// } + //**************************** + // BURST SBM1 and SBM2 headers + if ( lfrRequestedMode == LFR_MODE_BURST ) + { + BP_init_header( &packet_sbm_bp1_f0.header, + APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP1_F0, + PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0); + BP_init_header( &packet_sbm_bp2_f0.header, + APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP2_F0, + PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0); + } + else if ( lfrRequestedMode == LFR_MODE_SBM1 ) + { + BP_init_header( &packet_sbm_bp1_f0.header, + APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP1_F0, + PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0); + BP_init_header( &packet_sbm_bp2_f0.header, + APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP2_F0, + PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0); + } + else if ( lfrRequestedMode == LFR_MODE_SBM2 ) + { + BP_init_header( &packet_sbm_bp1_f0.header, + APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP1_F0, + PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0); + BP_init_header( &packet_sbm_bp2_f0.header, + APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP2_F0, + PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0); + } + else + { + PRINTF1("in PRC0 *** lfrRequestedMode is %d, several headers not initialized\n", (unsigned int) lfrRequestedMode) + } -// status = get_message_queue_id_send( &queue_id ); -// if (status != RTEMS_SUCCESSFUL) -// { -// PRINTF1("in MATR *** ERR get_message_queue_id_send %d\n", status) -// } -// status = get_message_queue_id_prc0( &queue_id_matr); -// if (status != RTEMS_SUCCESSFUL) -// { -// PRINTF1("in MATR *** ERR get_message_queue_id_prc0 %d\n", status) -// } + status = get_message_queue_id_send( &queue_id ); + if (status != RTEMS_SUCCESSFUL) + { + PRINTF1("in PRC0 *** ERR get_message_queue_id_send %d\n", status) + } + status = get_message_queue_id_prc0( &queue_id_q_p0); + if (status != RTEMS_SUCCESSFUL) + { + PRINTF1("in PRC0 *** ERR get_message_queue_id_prc0 %d\n", status) + } -// BOOT_PRINTF1("in PRC0 *** lfrRequestedMode = %d\n", lfrRequestedMode) + BOOT_PRINTF1("in PRC0 *** lfrRequestedMode = %d\n", (int) lfrRequestedMode) -// while(1){ -// status = rtems_message_queue_receive( queue_id_matr, incomingData, &size, //************************************ -// RTEMS_WAIT, RTEMS_NO_TIMEOUT ); // wait for a message coming from AVF0 + while(1){ + status = rtems_message_queue_receive( queue_id_q_p0, incomingData, &size, //************************************ + RTEMS_WAIT, RTEMS_NO_TIMEOUT ); // wait for a message coming from AVF0 + + incomingMsg = (asm_msg*) incomingData; -// incomingMsg = (asm_msg*) incomingData; - -// localTime = getTimeAsUnsignedLongLongInt( ); -// //**************** -// //**************** -// // BURST SBM1 SBM2 -// //**************** -// //**************** -// if (incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP1_F0 ) -// { -// // 1) compress the matrix for Basic Parameters calculation -// ASM_compress_reorganize_and_divide( incomingMsg->burst_sbm->matrix, compressed_sm_sbm, -// nb_sm_before_f0.burst_sbm_bp1_f0, -// NB_BINS_COMPRESSED_SM_SBM_F0, NB_BINS_TO_AVERAGE_ASM_SBM_F0, -// ASM_F0_INDICE_START); -// // 2) compute the BP1 set + localTime = getTimeAsUnsignedLongLongInt( ); + //**************** + //**************** + // BURST SBM1 SBM2 + //**************** + //**************** + if (incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP1_F0 ) + { + // 1) compress the matrix for Basic Parameters calculation + ASM_compress_reorganize_and_divide( incomingMsg->burst_sbm->matrix, compressed_sm_sbm, + nb_sm_before_f0.burst_sbm_bp1_f0, + NB_BINS_COMPRESSED_SM_SBM_F0, NB_BINS_TO_AVERAGE_ASM_SBM_F0, + ASM_F0_INDICE_START); + // 2) compute the BP1 set -// // 3) send the BP1 set -// set_time( current_node_sbm_bp1_f0.header.time, (unsigned char *) &incomingMsg->coarseTime ); -// set_time( current_node_sbm_bp1_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime ); -// BP_send( (char *) ¤t_node_sbm_bp1_f0.header, queue_id, -// PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0 + PACKET_LENGTH_DELTA); -// // 4) compute the BP2 set if needed -// if ( incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP2_F0 ) -// { -// // 1) compute the BP2 set + // 3) send the BP1 set + set_time( packet_sbm_bp1_f0.header.time, (unsigned char *) &incomingMsg->coarseTime ); + set_time( packet_sbm_bp1_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime ); + BP_send( (char *) &packet_sbm_bp1_f0.header, queue_id, + PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0 + PACKET_LENGTH_DELTA); + // 4) compute the BP2 set if needed + if ( incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP2_F0 ) + { + // 1) compute the BP2 set -// // 2) send the BP2 set -// set_time( current_node_sbm_bp2_f0.header.time, (unsigned char *) &incomingMsg->coarseTime ); -// set_time( current_node_sbm_bp2_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime ); -// BP_send( (char *) ¤t_node_sbm_bp2_f0.header, queue_id, -// PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0 + PACKET_LENGTH_DELTA); -// } -// } + // 2) send the BP2 set + set_time( packet_sbm_bp2_f0.header.time, (unsigned char *) &incomingMsg->coarseTime ); + set_time( packet_sbm_bp2_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime ); + BP_send( (char *) &packet_sbm_bp2_f0.header, queue_id, + PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0 + PACKET_LENGTH_DELTA); + } + } -// //***** -// //***** -// // NORM -// //***** -// //***** -// if (incomingMsg->event & RTEMS_EVENT_NORM_BP1_F0) -// { -// // 1) compress the matrix for Basic Parameters calculation -// ASM_compress_reorganize_and_divide( incomingMsg->norm->matrix, compressed_sm_norm_f0, -// nb_sm_before_f0.norm_bp1_f0, -// NB_BINS_COMPRESSED_SM_F0, NB_BINS_TO_AVERAGE_ASM_F0, -// ASM_F0_INDICE_START ); -// // 2) compute the BP1 set + //***** + //***** + // NORM + //***** + //***** + if (incomingMsg->event & RTEMS_EVENT_NORM_BP1_F0) + { + // 1) compress the matrix for Basic Parameters calculation + ASM_compress_reorganize_and_divide( incomingMsg->norm->matrix, compressed_sm_norm_f0, + nb_sm_before_f0.norm_bp1_f0, + NB_BINS_COMPRESSED_SM_F0, NB_BINS_TO_AVERAGE_ASM_F0, + ASM_F0_INDICE_START ); + // 2) compute the BP1 set -// // 3) send the BP1 set -// set_time( current_node_norm_bp1_f0.header.time, (unsigned char *) &incomingMsg->coarseTime ); -// set_time( current_node_norm_bp1_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime ); -// BP_send( (char *) ¤t_node_norm_bp1_f0.header, queue_id, -// PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 + PACKET_LENGTH_DELTA); -// if (incomingMsg->event & RTEMS_EVENT_NORM_BP2_F0) -// { -// // 1) compute the BP2 set + // 3) send the BP1 set + set_time( packet_norm_bp1_f0.header.time, (unsigned char *) &incomingMsg->coarseTime ); + set_time( packet_norm_bp1_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime ); + BP_send( (char *) &packet_norm_bp1_f0.header, queue_id, + PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 + PACKET_LENGTH_DELTA); + if (incomingMsg->event & RTEMS_EVENT_NORM_BP2_F0) + { + // 1) compute the BP2 set -// // 2) send the BP2 set -// set_time( current_node_norm_bp2_f0.header.time, (unsigned char *) &incomingMsg->coarseTime ); -// set_time( current_node_norm_bp2_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime ); -// BP_send( (char *) ¤t_node_norm_bp2_f0.header, queue_id, -// PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0 + PACKET_LENGTH_DELTA); -// } -// } + // 2) send the BP2 set + set_time( packet_norm_bp2_f0.header.time, (unsigned char *) &incomingMsg->coarseTime ); + set_time( packet_norm_bp2_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime ); + BP_send( (char *) &packet_norm_bp2_f0.header, queue_id, + PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0 + PACKET_LENGTH_DELTA); + } + } -// if (incomingMsg->event & RTEMS_EVENT_NORM_ASM_F0) -// { -// // 1) reorganize the ASM and divide -// ASM_reorganize_and_divide( incomingMsg->norm->matrix, asm_f0_reorganized, NB_SM_BEFORE_NORM_BP1_F0 ); -// // 2) convert the float array in a char array -// ASM_convert( asm_f0_reorganized, asm_f0_char); -// // 3) send the spectral matrix packets -// set_time( headerASM.time , (unsigned char *) &incomingMsg->coarseTime ); -// set_time( headerASM.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime ); -// ASM_send( &headerASM, asm_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id); -// } + if (incomingMsg->event & RTEMS_EVENT_NORM_ASM_F0) + { + // 1) reorganize the ASM and divide + ASM_reorganize_and_divide( incomingMsg->norm->matrix, asm_f0_reorganized, NB_SM_BEFORE_NORM_BP1_F0 ); + // 2) convert the float array in a char array + ASM_convert( asm_f0_reorganized, asm_f0_char); + // 3) send the spectral matrix packets + set_time( headerASM.time , (unsigned char *) &incomingMsg->coarseTime ); + set_time( headerASM.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime ); + ASM_send( &headerASM, asm_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id); + } -// } + } } +//***************** +// PROCESSING AT F1 + rtems_task avf1_task( rtems_task_argument lfrRequestedMode ) { int i; @@ -507,14 +498,26 @@ rtems_task avf1_task( rtems_task_argumen asm_msg msgForMATR; ring_node_sm *ring_node_tab[8]; + static unsigned int nb_norm_bp1; + static unsigned int nb_norm_bp2; + static unsigned int nb_norm_asm; + static unsigned int nb_sbm_bp1; + static unsigned int nb_sbm_bp2; + + nb_norm_bp1 = 0; + nb_norm_bp2 = 0; + nb_norm_asm = 0; + nb_sbm_bp1 = 0; + nb_sbm_bp2 = 0; + reset_nb_sm_f1( lfrRequestedMode ); // reset the sm counters that drive the BP and ASM computations / transmissions - BOOT_PRINTF1("in AVF1 *** lfrRequestedMode = %d\n", lfrRequestedMode) + BOOT_PRINTF1("in AVF1 *** lfrRequestedMode = %d\n", (int) lfrRequestedMode) status = get_message_queue_id_prc1( &queue_id_prc1 ); if (status != RTEMS_SUCCESSFUL) { - PRINTF1("in MATR *** ERR get_message_queue_id_prc0 %d\n", status) + PRINTF1("in AVF1 *** ERR get_message_queue_id_prc1 %d\n", status) } while(1){ @@ -522,56 +525,56 @@ rtems_task avf1_task( rtems_task_argumen ring_node_tab[NB_SM_BEFORE_AVF1-1] = ring_node_for_averaging_sm_f1; for ( i = 2; i < (NB_SM_BEFORE_AVF1+1); i++ ) { - ring_node_for_averaging_sm_f0 = ring_node_for_averaging_sm_f0->previous; - ring_node_tab[NB_SM_BEFORE_AVF1-i] = ring_node_for_averaging_sm_f0; + ring_node_for_averaging_sm_f1 = ring_node_for_averaging_sm_f1->previous; + ring_node_tab[NB_SM_BEFORE_AVF1-i] = ring_node_for_averaging_sm_f1; } // compute the average and store it in the averaged_sm_f1 buffer SM_average( current_ring_node_asm_norm_f1->matrix, current_ring_node_asm_burst_sbm_f1->matrix, ring_node_tab, - nb_sm.norm_bp1_f1, nb_sm.sbm_bp1_f1 ); + nb_norm_bp1, nb_sbm_bp1 ); // update nb_average - nb_sm.norm_bp1_f1 = nb_sm.norm_bp1_f1 + NB_SM_BEFORE_AVF1; - nb_sm.norm_bp2_f1 = nb_sm.norm_bp2_f1 + NB_SM_BEFORE_AVF1; - nb_sm.norm_asm_f1 = nb_sm.norm_asm_f1 + NB_SM_BEFORE_AVF1; - nb_sm.sbm_bp1_f1 = nb_sm.sbm_bp1_f1 + NB_SM_BEFORE_AVF1; - nb_sm.sbm_bp2_f1 = nb_sm.sbm_bp2_f1 + NB_SM_BEFORE_AVF1; + nb_norm_bp1 = nb_norm_bp1 + NB_SM_BEFORE_AVF1; + nb_norm_bp2 = nb_norm_bp2 + NB_SM_BEFORE_AVF1; + nb_norm_asm = nb_norm_asm + NB_SM_BEFORE_AVF1; + nb_sbm_bp1 = nb_sbm_bp1 + NB_SM_BEFORE_AVF1; + nb_sbm_bp2 = nb_sbm_bp2 + NB_SM_BEFORE_AVF1; //**************************************** // initialize the mesage for the MATR task - msgForMATR.event = 0x00; // this composite event will be sent to the MATR task + msgForMATR.event = 0x00; // this composite event will be sent to the PRC1 task msgForMATR.burst_sbm = current_ring_node_asm_burst_sbm_f1; msgForMATR.norm = current_ring_node_asm_norm_f1; msgForMATR.coarseTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[0]; msgForMATR.fineTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[1]; - if (nb_sm.sbm_bp1_f1 == nb_sm_before_f1.burst_sbm_bp1_f1) + if (nb_sbm_bp1 == nb_sm_before_f1.burst_sbm_bp1) { - nb_sm.sbm_bp1_f0 = 0; + nb_sbm_bp1 = 0; // set another ring for the ASM storage - current_ring_node_asm_burst_sbm_f0 = current_ring_node_asm_burst_sbm_f0->next; + current_ring_node_asm_burst_sbm_f1 = current_ring_node_asm_burst_sbm_f1->next; if ( (lfrCurrentMode == LFR_MODE_BURST) || (lfrCurrentMode == LFR_MODE_SBM2) ) { msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_SBM_BP1_F1; } } - if (nb_sm.sbm_bp2_f1 == nb_sm_before_f1.burst_sbm_bp2_f1) + if (nb_sbm_bp2 == nb_sm_before_f1.burst_sbm_bp2) { - nb_sm.sbm_bp2_f0 = 0; + nb_sbm_bp2 = 0; if ( (lfrCurrentMode == LFR_MODE_BURST) || (lfrCurrentMode == LFR_MODE_SBM2) ) { msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_SBM_BP2_F1; } } - if (nb_sm.norm_bp1_f1 == nb_sm_before_f1.norm_bp1_f1) + if (nb_norm_bp1 == nb_sm_before_f1.norm_bp1) { - nb_sm.norm_bp1_f0 = 0; + nb_norm_bp1 = 0; // set another ring for the ASM storage - current_ring_node_asm_norm_f0 = current_ring_node_asm_norm_f0->next; + current_ring_node_asm_norm_f1 = current_ring_node_asm_norm_f1->next; if ( (lfrCurrentMode == LFR_MODE_NORMAL) || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) { @@ -579,9 +582,9 @@ rtems_task avf1_task( rtems_task_argumen } } - if (nb_sm.norm_bp2_f1 == nb_sm_before_f1.norm_bp2_f1) + if (nb_norm_bp2 == nb_sm_before_f1.norm_bp2) { - nb_sm.norm_bp2_f0 = 0; + nb_norm_bp2 = 0; if ( (lfrCurrentMode == LFR_MODE_NORMAL) || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) { @@ -589,9 +592,9 @@ rtems_task avf1_task( rtems_task_argumen } } - if (nb_sm.norm_asm_f1 == nb_sm_before_f1.norm_asm_f1) + if (nb_norm_asm == nb_sm_before_f1.norm_asm) { - nb_sm.norm_asm_f0 = 0; + nb_norm_asm = 0; if ( (lfrCurrentMode == LFR_MODE_NORMAL) || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) { @@ -603,7 +606,7 @@ rtems_task avf1_task( rtems_task_argumen // send the message to MATR if (msgForMATR.event != 0x00) { - status = rtems_message_queue_send( queue_id_prc1, (char *) & msgForMATR, MSG_QUEUE_SIZE_PRC1); + status = rtems_message_queue_send( queue_id_prc1, (char *) &msgForMATR, MSG_QUEUE_SIZE_PRC1); } if (status != RTEMS_SUCCESSFUL) { @@ -612,6 +615,158 @@ rtems_task avf1_task( rtems_task_argumen } } +rtems_task prc1_task( rtems_task_argument lfrRequestedMode ) +{ + char incomingData[MSG_QUEUE_SIZE_SEND]; // incoming data buffer + size_t size; // size of the incoming TC packet + asm_msg *incomingMsg; + // + spw_ioctl_pkt_send spw_ioctl_send_ASM; + rtems_status_code status; + rtems_id queue_id; + rtems_id queue_id_q_p1; + Header_TM_LFR_SCIENCE_ASM_t headerASM; + bp_packet_with_spare packet_norm_bp1; + bp_packet packet_norm_bp2; + bp_packet packet_sbm_bp1; + bp_packet packet_sbm_bp2; + + unsigned long long int localTime; + + ASM_init_header( &headerASM ); + + //************* + // NORM headers + BP_init_header_with_spare( &packet_norm_bp1.header, + APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F1, + PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F1, NB_BINS_COMPRESSED_SM_F1 ); + BP_init_header( &packet_norm_bp2.header, + APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP2_F1, + PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F1, NB_BINS_COMPRESSED_SM_F1); + + //*********************** + // BURST and SBM2 headers + if ( lfrRequestedMode == LFR_MODE_BURST ) + { + BP_init_header( &packet_sbm_bp1.header, + APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP1_F1, + PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F1); + BP_init_header( &packet_sbm_bp2.header, + APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP2_F1, + PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F1); + } + else if ( lfrRequestedMode == LFR_MODE_SBM2 ) + { + BP_init_header( &packet_sbm_bp1.header, + APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP1_F1, + PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F1, NB_BINS_COMPRESSED_SM_SBM_F1); + BP_init_header( &packet_sbm_bp2.header, + APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP2_F1, + PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F1, NB_BINS_COMPRESSED_SM_SBM_F1); + } + else + { + PRINTF1("ERR *** in PRC1 *** unexpected lfrRequestedMode passed as argument = %d\n", (unsigned int) lfrRequestedMode) + } + + status = get_message_queue_id_send( &queue_id ); + if (status != RTEMS_SUCCESSFUL) + { + PRINTF1("in PRC1 *** ERR get_message_queue_id_send %d\n", status) + } + status = get_message_queue_id_prc1( &queue_id_q_p1); + if (status != RTEMS_SUCCESSFUL) + { + PRINTF1("in PRC1 *** ERR get_message_queue_id_prc1 %d\n", status) + } + + BOOT_PRINTF1("in PRC1 *** lfrRequestedMode = %d\n", (int) lfrRequestedMode) + + while(1){ + status = rtems_message_queue_receive( queue_id_q_p1, incomingData, &size, //************************************ + RTEMS_WAIT, RTEMS_NO_TIMEOUT ); // wait for a message coming from AVF0 + + incomingMsg = (asm_msg*) incomingData; + + localTime = getTimeAsUnsignedLongLongInt( ); + //*********** + //*********** + // BURST SBM2 + //*********** + //*********** + if (incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP1_F1 ) + { + // 1) compress the matrix for Basic Parameters calculation + ASM_compress_reorganize_and_divide( incomingMsg->burst_sbm->matrix, compressed_sm_sbm, + nb_sm_before_f1.burst_sbm_bp1, + NB_BINS_COMPRESSED_SM_SBM_F1, NB_BINS_TO_AVERAGE_ASM_SBM_F1, + ASM_F1_INDICE_START); + // 2) compute the BP1 set + + // 3) send the BP1 set + set_time( packet_sbm_bp1.header.time, (unsigned char *) &incomingMsg->coarseTime ); + set_time( packet_sbm_bp1.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime ); + BP_send( (char *) &packet_sbm_bp1.header, queue_id, + PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F1 + PACKET_LENGTH_DELTA); + // 4) compute the BP2 set if needed + if ( incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP2_F1 ) + { + // 1) compute the BP2 set + + // 2) send the BP2 set + set_time( packet_sbm_bp2.header.time, (unsigned char *) &incomingMsg->coarseTime ); + set_time( packet_sbm_bp2.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime ); + BP_send( (char *) &packet_sbm_bp2.header, queue_id, + PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F1 + PACKET_LENGTH_DELTA); + } + } + + //***** + //***** + // NORM + //***** + //***** + if (incomingMsg->event & RTEMS_EVENT_NORM_BP1_F1) + { + // 1) compress the matrix for Basic Parameters calculation + ASM_compress_reorganize_and_divide( incomingMsg->norm->matrix, compressed_sm_norm_f0, + nb_sm_before_f0.norm_bp1_f0, + NB_BINS_COMPRESSED_SM_F0, NB_BINS_TO_AVERAGE_ASM_F0, + ASM_F0_INDICE_START ); + // 2) compute the BP1 set + + // 3) send the BP1 set + set_time( packet_norm_bp1.header.time, (unsigned char *) &incomingMsg->coarseTime ); + set_time( packet_norm_bp1.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime ); + BP_send( (char *) &packet_norm_bp1.header, queue_id, + PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F1 + PACKET_LENGTH_DELTA); + if (incomingMsg->event & RTEMS_EVENT_NORM_BP2_F1) + { + // 1) compute the BP2 set + + // 2) send the BP2 set + set_time( packet_norm_bp2.header.time, (unsigned char *) &incomingMsg->coarseTime ); + set_time( packet_norm_bp2.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime ); + BP_send( (char *) &packet_norm_bp2.header, queue_id, + PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F1 + PACKET_LENGTH_DELTA); + } + } + + if (incomingMsg->event & RTEMS_EVENT_NORM_ASM_F1) + { + // 1) reorganize the ASM and divide + ASM_reorganize_and_divide( incomingMsg->norm->matrix, asm_f0_reorganized, NB_SM_BEFORE_NORM_BP1_F0 ); + // 2) convert the float array in a char array + ASM_convert( asm_f0_reorganized, asm_f0_char); + // 3) send the spectral matrix packets + set_time( headerASM.time , (unsigned char *) &incomingMsg->coarseTime ); + set_time( headerASM.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime ); + ASM_send( &headerASM, asm_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id); + } + + } +} + //****************** // Spectral Matrices @@ -686,38 +841,32 @@ void SM_init_rings( void ) void ASM_init_rings( void ) { + //*** + // F0 + // NORM + ASM_generic_init_ring( asm_ring_norm_f0, NB_RING_NODES_ASM_NORM_F0 ); + // BURST_SBM + ASM_generic_init_ring( asm_ring_burst_sbm_f0, NB_RING_NODES_ASM_BURST_SBM_F0 ); + + //*** + // F1 + //***** + // NORM + ASM_generic_init_ring( asm_ring_norm_f1, NB_RING_NODES_ASM_NORM_F1 ); + // BURST_SBM + ASM_generic_init_ring( asm_ring_burst_sbm_f1, NB_RING_NODES_ASM_BURST_SBM_F1 ); +} + +void ASM_generic_init_ring( ring_node_asm *ring, unsigned char nbNodes ) +{ unsigned char i; - //************* - // BURST_SBM_F0 - asm_ring_burst_sbm_f0[0].next = (ring_node_asm*) &asm_ring_burst_sbm_f0[1]; - asm_ring_burst_sbm_f0[0].previous = (ring_node_asm*) &asm_ring_burst_sbm_f0[NB_RING_NODES_ASM_BURST_SBM_F0-1]; + ring[ nbNodes - 1 ].next + = (ring_node_asm*) &ring[ 0 ]; - asm_ring_burst_sbm_f0[NB_RING_NODES_ASM_BURST_SBM_F0-1].next - = (ring_node_asm*) &asm_ring_burst_sbm_f0[0]; - asm_ring_burst_sbm_f0[NB_RING_NODES_ASM_BURST_SBM_F0-1].previous - = (ring_node_asm*) &asm_ring_burst_sbm_f0[NB_RING_NODES_ASM_BURST_SBM_F0-2]; - - for(i=1; i