diff --git a/header/processing/fsw_processing.h b/header/processing/fsw_processing.h --- a/header/processing/fsw_processing.h +++ b/header/processing/fsw_processing.h @@ -5,7 +5,7 @@ #include #include #include // abs() is in the stdlib -#include // printf() +#include #include #include 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 @@ -14,6 +14,7 @@ #define FLOAT_EQUAL_ZERO 0.001 extern unsigned short sequenceCounterParameterDump; +extern unsigned short sequenceCounters_TM_DUMP[]; extern float k_coeff_intercalib_f0_norm[ ]; extern float k_coeff_intercalib_f0_sbm[ ]; extern float k_coeff_intercalib_f1_norm[ ]; @@ -66,6 +67,6 @@ void copyFloatByChar( unsigned char *des void init_parameter_dump( void ); void init_kcoefficients_dump( void ); void init_kcoefficients_dump_packet( Packet_TM_LFR_KCOEFFICIENTS_DUMP_t *kcoefficients_dump, unsigned char pkt_nr, unsigned char blk_nr ); -void print_k_coeff(); +void increment_seq_counter_destination_id_dump( unsigned char *packet_sequence_control, unsigned char destination_id ); #endif // TC_LOAD_DUMP_PARAMETERS_H diff --git a/src/fsw_globals.c b/src/fsw_globals.c --- a/src/fsw_globals.c +++ b/src/fsw_globals.c @@ -71,8 +71,8 @@ unsigned char hk_lfr_q_p2_fifo_size_max; unsigned short sequenceCounters_SCIENCE_NORMAL_BURST; unsigned short sequenceCounters_SCIENCE_SBM1_SBM2; unsigned short sequenceCounters_TC_EXE[SEQ_CNT_NB_DEST_ID]; +unsigned short sequenceCounters_TM_DUMP[SEQ_CNT_NB_DEST_ID]; unsigned short sequenceCounterHK; -unsigned short sequenceCounterParameterDump; spw_stats spacewire_stats; spw_stats spacewire_stats_backup; diff --git a/src/fsw_init.c b/src/fsw_init.c --- a/src/fsw_init.c +++ b/src/fsw_init.c @@ -67,7 +67,7 @@ void initCache() unsigned int cacheControlRegister; cacheControlRegister = getCacheControlRegister(); - printf("(0) cacheControlRegister = %x\n", cacheControlRegister); + PRINTF1("(0) cacheControlRegister = %x\n", cacheControlRegister) resetCacheControlRegister(); @@ -76,7 +76,7 @@ void initCache() enableInstructionBurstFetch(); cacheControlRegister = getCacheControlRegister(); - printf("(1) cacheControlRegister = %x\n", cacheControlRegister); + PRINTF1("(1) cacheControlRegister = %x\n", cacheControlRegister) } rtems_task Init( rtems_task_argument ignored ) @@ -274,11 +274,11 @@ void init_local_mode_parameters( void ) for(i = 0; icoarse_time; fine_time = time_management_regs->fine_time; - printf("in DUMB *** coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]); if (i==8) { } diff --git a/src/fsw_spacewire.c b/src/fsw_spacewire.c --- a/src/fsw_spacewire.c +++ b/src/fsw_spacewire.c @@ -286,7 +286,7 @@ rtems_task send_task( rtems_task_argumen } else { - printf("unexpected sid = %d\n", sid); + PRINTF1("unexpected sid = %d\n", sid); } } else if ( incomingData[0] == CCSDS_DESTINATION_ID ) // the incoming message is a ccsds packet @@ -301,13 +301,6 @@ rtems_task send_task( rtems_task_argumen spw_ioctl_send = (spw_ioctl_pkt_send*) incomingData; status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, spw_ioctl_send ); if (status == -1){ - printf("size = %d, %x, %x, %x, %x, %x\n", - size, - incomingData[0], - incomingData[1], - incomingData[2], - incomingData[3], - incomingData[4]); PRINTF2("in SEND *** (2.b) ERRNO = %d, RTEMS = %d\n", errno, status) } } @@ -873,7 +866,6 @@ int spw_send_waveform_CWF( ring_node *ri status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, &spw_ioctl_send_CWF ); if (status != RTEMS_SUCCESSFUL) { - printf("%d-%d, ERR %d\n", sid, i, (int) status); ret = LFR_DEFAULT; } } @@ -963,7 +955,6 @@ int spw_send_waveform_SWF( ring_node *ri // SEND PACKET status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, &spw_ioctl_send_SWF ); if (status != RTEMS_SUCCESSFUL) { - printf("%d-%d, ERR %d\n", sid, i, (int) status); ret = LFR_DEFAULT; } } @@ -1044,7 +1035,6 @@ int spw_send_waveform_CWF3_light( ring_n // SEND PACKET status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, &spw_ioctl_send_CWF ); if (status != RTEMS_SUCCESSFUL) { - printf("%d-%d, ERR %d\n", sid, i, (int) status); ret = LFR_DEFAULT; } } @@ -1127,7 +1117,7 @@ void spw_send_asm_f0( ring_node *ring_no // (4) SEND PACKET status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, &spw_ioctl_send_ASM ); if (status != RTEMS_SUCCESSFUL) { - printf("in ASM_send *** ERR %d\n", (int) status); + PRINTF1("in ASM_send *** ERR %d\n", (int) status) } } } @@ -1207,7 +1197,7 @@ void spw_send_asm_f1( ring_node *ring_no // (4) SEND PACKET status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, &spw_ioctl_send_ASM ); if (status != RTEMS_SUCCESSFUL) { - printf("in ASM_send *** ERR %d\n", (int) status); + PRINTF1("in ASM_send *** ERR %d\n", (int) status) } } } @@ -1274,7 +1264,7 @@ void spw_send_asm_f2( ring_node *ring_no // (4) SEND PACKET status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, &spw_ioctl_send_ASM ); if (status != RTEMS_SUCCESSFUL) { - printf("in ASM_send *** ERR %d\n", (int) status); + PRINTF1("in ASM_send *** ERR %d\n", (int) status) } } } @@ -1286,7 +1276,7 @@ void spw_send_k_dump( ring_node *ring_no unsigned int packetLength; unsigned int size; - printf("spw_send_k_dump\n"); + PRINTF("spw_send_k_dump\n") kcoefficients_dump = (Packet_TM_LFR_KCOEFFICIENTS_DUMP_t *) ring_node_to_send->buffer_address; @@ -1294,7 +1284,7 @@ void spw_send_k_dump( ring_node *ring_no size = packetLength + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; - printf("packetLength %d, size %d\n", packetLength, size ); + PRINTF2("packetLength %d, size %d\n", packetLength, size ) status = write( fdSPW, (char *) ring_node_to_send->buffer_address, size ); 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 @@ -175,7 +175,7 @@ rtems_task avf0_task( rtems_task_argumen } if (status != RTEMS_SUCCESSFUL) { - printf("in AVF0 *** Error sending message to MATR, code %d\n", status); + PRINTF1("in AVF0 *** Error sending message to MATR, code %d\n", status) } } } diff --git a/src/processing/avf1_prc1.c b/src/processing/avf1_prc1.c --- a/src/processing/avf1_prc1.c +++ b/src/processing/avf1_prc1.c @@ -176,7 +176,7 @@ rtems_task avf1_task( rtems_task_argumen } if (status != RTEMS_SUCCESSFUL) { - printf("in AVF1 *** Error sending message to PRC1, code %d\n", status); + PRINTF1("in AVF1 *** Error sending message to PRC1, code %d\n", status) } } } diff --git a/src/processing/avf2_prc2.c b/src/processing/avf2_prc2.c --- a/src/processing/avf2_prc2.c +++ b/src/processing/avf2_prc2.c @@ -75,18 +75,6 @@ rtems_task avf2_task( rtems_task_argumen nodeForAveraging = getRingNodeForAveraging( 2 ); -// printf(" **0** %x . %x", sm_ring_f2[0].coarseTime, sm_ring_f2[0].fineTime); -// printf(" **1** %x . %x", sm_ring_f2[1].coarseTime, sm_ring_f2[1].fineTime); -// printf(" **2** %x . %x", sm_ring_f2[2].coarseTime, sm_ring_f2[2].fineTime); -// printf(" **3** %x . %x", sm_ring_f2[3].coarseTime, sm_ring_f2[3].fineTime); -// printf(" **4** %x . %x", sm_ring_f2[4].coarseTime, sm_ring_f2[4].fineTime); -// printf(" **5** %x . %x", sm_ring_f2[5].coarseTime, sm_ring_f2[5].fineTime); -// printf(" **6** %x . %x", sm_ring_f2[6].coarseTime, sm_ring_f2[6].fineTime); -// printf(" **7** %x . %x", sm_ring_f2[7].coarseTime, sm_ring_f2[7].fineTime); -// printf(" **8** %x . %x", sm_ring_f2[8].coarseTime, sm_ring_f2[8].fineTime); -// printf(" **9** %x . %x", sm_ring_f2[9].coarseTime, sm_ring_f2[9].fineTime); -// printf(" **10** %x . %x\n", sm_ring_f2[10].coarseTime, sm_ring_f2[10].fineTime); - // compute the average and store it in the averaged_sm_f2 buffer SM_average_f2( current_ring_node_asm_norm_f2->matrix, nodeForAveraging, @@ -138,7 +126,7 @@ rtems_task avf2_task( rtems_task_argumen } if (status != RTEMS_SUCCESSFUL) { - printf("in AVF2 *** Error sending message to MATR, code %d\n", status); + PRINTF1("in AVF2 *** Error sending message to MATR, code %d\n", status) } } } diff --git a/src/processing/fsw_processing.c b/src/processing/fsw_processing.c --- a/src/processing/fsw_processing.c +++ b/src/processing/fsw_processing.c @@ -433,7 +433,7 @@ void BP_send(char *data, rtems_id queue_ status = rtems_message_queue_send( queue_id, data, nbBytesToSend); if (status != RTEMS_SUCCESSFUL) { - printf("ERR *** in BP_send *** ERR %d\n", (int) status); + PRINTF1("ERR *** in BP_send *** ERR %d\n", (int) status) } } diff --git a/src/tc_handler.c b/src/tc_handler.c --- a/src/tc_handler.c +++ b/src/tc_handler.c @@ -146,7 +146,7 @@ int action_reset(ccsdsTelecommandPacket_ * */ - printf("this is the end!!!\n"); + PRINTF("this is the end!!!\n") exit(0); send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); return LFR_DEFAULT; @@ -683,7 +683,7 @@ int suspend_science_tasks() rtems_status_code status; - printf("in suspend_science_tasks\n"); + PRINTF("in suspend_science_tasks\n") status = rtems_task_suspend( Task_id[TASKID_AVF0] ); // suspend AVF0 if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED)) @@ -1134,14 +1134,14 @@ void close_action(ccsdsTelecommandPacket rtems_isr commutation_isr1( rtems_vector_number vector ) { if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { - printf("In commutation_isr1 *** Error sending event to DUMB\n"); + PRINTF("In commutation_isr1 *** Error sending event to DUMB\n") } } rtems_isr commutation_isr2( rtems_vector_number vector ) { if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { - printf("In commutation_isr2 *** Error sending event to DUMB\n"); + PRINTF("In commutation_isr2 *** Error sending event to DUMB\n") } } diff --git a/src/tc_load_dump_parameters.c b/src/tc_load_dump_parameters.c --- a/src/tc_load_dump_parameters.c +++ b/src/tc_load_dump_parameters.c @@ -310,18 +310,6 @@ int action_load_fbins_mask(ccsdsTelecomm return flag; } -void printKCoefficients(unsigned int freq, unsigned int bin, float *k_coeff) -{ - printf("freq = %d *** bin = %d *** (0) %f *** (1) %f *** (2) %f *** (3) %f *** (4) %f\n", - freq, - bin, - k_coeff[ (bin*NB_K_COEFF_PER_BIN) + 0 ], - k_coeff[ (bin*NB_K_COEFF_PER_BIN) + 1 ], - k_coeff[ (bin*NB_K_COEFF_PER_BIN) + 2 ], - k_coeff[ (bin*NB_K_COEFF_PER_BIN) + 3 ], - k_coeff[ (bin*NB_K_COEFF_PER_BIN) + 4 ]); -} - int action_dump_kcoefficients(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) { /** This function updates the LFR registers with the incoming sbm2 parameters. @@ -348,10 +336,8 @@ int action_dump_kcoefficients(ccsdsTelec //********* // PACKET 1 // 11 F0 bins, 13 F1 bins and 6 F2 bins - kcoefficients_dump_1.packetSequenceControl[0] = (unsigned char) (sequenceCounterParameterDump >> 8); - kcoefficients_dump_1.packetSequenceControl[1] = (unsigned char) (sequenceCounterParameterDump ); kcoefficients_dump_1.destinationID = TC->sourceID; - increment_seq_counter( &sequenceCounterParameterDump ); + increment_seq_counter_destination_id_dump( kcoefficients_dump_1.packetSequenceControl, TC->sourceID ); for( freq=0; freq> 8); - kcoefficients_dump_2.packetSequenceControl[1] = (unsigned char) (sequenceCounterParameterDump ); kcoefficients_dump_2.destinationID = TC->sourceID; - increment_seq_counter( &sequenceCounterParameterDump ); + increment_seq_counter_destination_id_dump( kcoefficients_dump_2.packetSequenceControl, TC->sourceID ); for( freq=0; freq<6; freq++ ) { kcoefficients_dump_2.kcoeff_blks[ freq*KCOEFF_BLK_SIZE + 1 ] = NB_BINS_COMPRESSED_SM_F0 + NB_BINS_COMPRESSED_SM_F1 + 6 + freq; @@ -462,12 +446,10 @@ int action_dump_par( ccsdsTelecommandPac int status; - // UPDATE TIME - parameter_dump_packet.packetSequenceControl[0] = (unsigned char) (sequenceCounterParameterDump >> 8); - parameter_dump_packet.packetSequenceControl[1] = (unsigned char) (sequenceCounterParameterDump ); - increment_seq_counter( &sequenceCounterParameterDump ); + increment_seq_counter_destination_id_dump( parameter_dump_packet.packetSequenceControl, TC->sourceID ); parameter_dump_packet.destinationID = TC->sourceID; + // UPDATE TIME parameter_dump_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); parameter_dump_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); parameter_dump_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); @@ -897,7 +879,6 @@ int set_sy_lfr_fbins( ccsdsTelecommandPa { unsigned char *auxPtr; auxPtr = ¶meter_dump_packet.sy_lfr_fbins_f0_word1[k*NB_BYTES_PER_FBINS_MASK]; - printf("%x %x %x %x\n", auxPtr[0], auxPtr[1], auxPtr[2], auxPtr[3]); } @@ -961,8 +942,6 @@ int set_sy_lfr_kcoeff( ccsdsTelecommandP } } - printf("in set_sy_lfr_kcoeff *** freq = %d, bin = %d\n", sy_lfr_kcoeff_frequency, bin); - if (kcoeffPtr_norm != NULL ) // update K coefficient for NORMAL data products { for (kcoeff=0; kcoeff> 8); + packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control ); + + // increment the sequence counter + if ( sequenceCounters_TM_DUMP[ i ] < SEQ_CNT_MAX ) { - printf("kcoeff = %d *** ", kcoeff); - for (bin=0; binsid = SID_SBM1_CWF_F1; status = rtems_message_queue_send( queue_id, &ring_node_to_send_cwf, sizeof( ring_node* ) ); if (status != 0) - printf("cwf sending failed\n"); + { + PRINTF("cwf sending failed\n") + } // launch snapshot extraction if needed if (extractSWF == true) { @@ -842,7 +844,6 @@ int send_waveform_CWF3_light( ring_node // SEND PACKET status = rtems_message_queue_send( queue_id, &ring_node_cwf3_light, sizeof( ring_node* ) ); if (status != RTEMS_SUCCESSFUL) { - printf("%d-%d, ERR %d\n", SID_NORM_CWF_F3, i, (int) status); ret = LFR_DEFAULT; } @@ -1066,13 +1067,13 @@ void snapshot_resynchronization( unsigne { deltaTickInF2 = floor( (deltaNext * 256. / 1000.) ); // the division by 2 is important here waveform_picker_regs->delta_snapshot = waveform_picker_regs->delta_snapshot + deltaTickInF2; - printf("correction of = + %u\n", deltaTickInF2); + PRINTF1("correction of = + %u\n", deltaTickInF2) } else { deltaTickInF2 = floor( (deltaPrevious * 256. / 1000.) ); // the division by 2 is important here waveform_picker_regs->delta_snapshot = waveform_picker_regs->delta_snapshot - deltaTickInF2; - printf("correction of = - %u\n", deltaTickInF2); + PRINTF1("correction of = - %u\n", deltaTickInF2) } }