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 @@ -202,15 +202,12 @@ 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 (TOTAL_SIZE_ASM_F0 + HEADER_LENGTH_TM_LFR_SCIENCE_ASM - CCSDS_TC_TM_PACKET_OFFSET) -#define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F1 (TOTAL_SIZE_ASM_F1 + HEADER_LENGTH_TM_LFR_SCIENCE_ASM - CCSDS_TC_TM_PACKET_OFFSET) -#define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F2 (TOTAL_SIZE_ASM_F2 + HEADER_LENGTH_TM_LFR_SCIENCE_ASM - CCSDS_TC_TM_PACKET_OFFSET) +#define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0 2221 // 44 * 25 * 2 + 28 - 7 +#define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F1 2621 // 52 * 25 * 2 + 28 - 7 +#define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F2 2421 // 48 * 25 * 2 + 28 - 7 #define SPARE1_PUSVERSION_SPARE2 0x10 -#define LEN_TM_LFR_HK 130 // 126 + 4 -#define LEN_TM_LFR_TC_EXE_NOT_IMP 28 // 24 + 4 - // R1 #define TM_LEN_SCI_SWF_340 4101 // 340 * 12 + 10 + 12 - 1 #define TM_LEN_SCI_SWF_8 117 // 8 * 12 + 10 + 12 - 1 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 @@ -7,16 +7,19 @@ #define SM_HEADER 0 // // #define NB_BINS_PER_ASM_F0 88 -#define TOTAL_SIZE_ASM_F0 2200 // 25 * 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 2600 // 25 * 104 #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 2400 // 25 * 96 #define ASM_F2_INDICE_START 7 // 96 bins #define ASM_F2_INDICE_STOP 102 // 2 packets of 48 bins diff --git a/header/wf_handler.h b/header/wf_handler.h --- a/header/wf_handler.h +++ b/header/wf_handler.h @@ -19,9 +19,9 @@ extern int fdSPW; // 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 + 46 ]; -extern volatile int wf_snap_f1[ ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 46 ]; -extern volatile int wf_snap_f2[ ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 46 ]; +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[ ]; diff --git a/src/fsw_globals.c b/src/fsw_globals.c --- a/src/fsw_globals.c +++ b/src/fsw_globals.c @@ -31,22 +31,24 @@ int fdSPW = 0; int fdUART = 0; unsigned char lfrCurrentMode; -// WAVEFORMS GLOBAL VARIABLES // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes +// WAVEFORMS GLOBAL VARIABLES // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes = 24584 + // 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_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 46 ] __attribute__((aligned(0x100))); -volatile int wf_snap_f0[ NB_RING_NODES_F0 ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 46 ] __attribute__((aligned(0x100))); +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 + 46 ] __attribute__((aligned(0x100))); -volatile int wf_snap_f2[ NB_RING_NODES_F2 ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 46 ] __attribute__((aligned(0x100))); +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))); char wf_cont_f3_light[ (NB_SAMPLES_PER_SNAPSHOT) * NB_BYTES_CWF3_LIGHT_BLK + TIME_OFFSET_IN_BYTES ] __attribute__((aligned(0x100))); // SPECTRAL MATRICES GLOBAL VARIABLES -volatile int sm_f0[ NB_RING_NODES_ASM_F0 ][ SM_HEADER + TOTAL_SIZE_SM ]; -volatile int sm_f1[ NB_RING_NODES_ASM_F1 ][ SM_HEADER + TOTAL_SIZE_SM ]; -volatile int sm_f2[ NB_RING_NODES_ASM_F2 ][ SM_HEADER + TOTAL_SIZE_SM ]; +volatile int sm_f0[ NB_RING_NODES_ASM_F0 ][ SM_HEADER + TOTAL_SIZE_SM ] __attribute__((aligned(0x100))); +volatile int sm_f1[ NB_RING_NODES_ASM_F1 ][ SM_HEADER + TOTAL_SIZE_SM ] __attribute__((aligned(0x100))); +volatile int sm_f2[ NB_RING_NODES_ASM_F2 ][ SM_HEADER + TOTAL_SIZE_SM ] __attribute__((aligned(0x100))); // APB CONFIGURATION REGISTERS time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT; diff --git a/src/fsw_misc.c b/src/fsw_misc.c --- a/src/fsw_misc.c +++ b/src/fsw_misc.c @@ -25,6 +25,8 @@ void configure_timer(gptimer_regs_t *gpt rtems_status_code status; rtems_isr_entry old_isr_handler; + gptimer_regs->timer[timer].ctrl = 0x00; // reset the control register + status = rtems_interrupt_catch( timer_isr, interrupt_level, &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels if (status!=RTEMS_SUCCESSFUL) { diff --git a/src/fsw_processing.c b/src/fsw_processing.c --- a/src/fsw_processing.c +++ b/src/fsw_processing.c @@ -109,24 +109,23 @@ rtems_isr spectral_matrices_isr( rtems_v rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ) { - 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 & 0xfffffffe; + //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 & 0xfffffffe; - rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ); -// if (nb_sm_f0 == NB_SM_TO_RECEIVE_BEFORE_AVF0 ) -// { -// 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; -// } -// else -// { -// nb_sm_f0 = nb_sm_f0 + 1; -// } + if (nb_sm_f0 == (NB_SM_TO_RECEIVE_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; + } + else + { + nb_sm_f0 = nb_sm_f0 + 1; + } } //************ @@ -169,12 +168,12 @@ rtems_task avf0_task(rtems_task_argument while(1){ rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 - PRINTF("avf0\n") + ring_node_for_averaging_sm_f0 = &sm_ring_f0[NB_SM_TO_RECEIVE_BEFORE_AVF0-1]; ring_node_tab[NB_SM_TO_RECEIVE_BEFORE_AVF0-1] = ring_node_for_averaging_sm_f0; - for (i=0; iprevious; - ring_node_tab[i] = ring_node_for_averaging_sm_f0; + ring_node_tab[NB_SM_TO_RECEIVE_BEFORE_AVF0-i] = ring_node_for_averaging_sm_f0; } for(i=0; idlen = TOTAL_SIZE_ASM_F0 / 2; - spw_ioctl_send->data = &spectral_matrix[ ASM_F0_INDICE_START + i * (TOTAL_SIZE_ASM_F0/2)]; + spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F0_IN_BYTES / 2; + spw_ioctl_send->data = &spectral_matrix[ ( (ASM_F0_INDICE_START+ (i*NB_BINS_PER_PKT_ASM_F0)) * NB_VALUES_PER_SM) * 2 ]; length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0; - header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_ASM_F0/2) >> 8 ); // BLK_NR MSB - header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_ASM_F0/2); // BLK_NR LSB + header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F0) >> 8 ); // BLK_NR MSB + header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F0); // BLK_NR LSB break; case SID_NORM_ASM_F1: break;