diff --git a/.hgsubstate b/.hgsubstate --- a/.hgsubstate +++ b/.hgsubstate @@ -1,2 +1,2 @@ 3081d1f9bb20b2b64a192585337a292a9804e0c5 LFR_basic-parameters -57edc38eadba4601cf0b1e2fa1eeab85082e9f41 header/lfr_common_headers +3e4216a0e6981bead8bcb201012ebadb53f60dff header/lfr_common_headers diff --git a/src/fsw_spacewire.c b/src/fsw_spacewire.c --- a/src/fsw_spacewire.c +++ b/src/fsw_spacewire.c @@ -158,8 +158,8 @@ rtems_task recv_task( rtems_task_argumen PRINTF("in RECV *** packet lenght too short\n") } else { -// PRINTF1("incoming TC with len: %d\n", len); estimatedPacketLength = (unsigned int) (len - CCSDS_TC_TM_PACKET_OFFSET - 3); // => -3 is for Prot ID, Reserved and User App bytes + PRINTF1("incoming TC with Length (byte): %d\n", len - 3); currentTC_LEN_RCV[ 0 ] = (unsigned char) (estimatedPacketLength >> 8); currentTC_LEN_RCV[ 1 ] = (unsigned char) (estimatedPacketLength ); // CHECK THE TC @@ -445,6 +445,11 @@ int spacewire_configure_link( int fd ) spacewire_set_NP(1, REGS_ADDR_GRSPW); // [N]o [P]ort force spacewire_set_RE(1, REGS_ADDR_GRSPW); // [R]MAP [E]nable, the dedicated call seems to break the no port force configuration + spw_ioctl_packetsize packetsize; + + packetsize.rxsize = 228; + packetsize.txdsize = 4096; + packetsize.txhsize = 34; status = ioctl(fd, SPACEWIRE_IOCTRL_SET_RXBLOCK, 1); // sets the blocking mode for reception if (status!=RTEMS_SUCCESSFUL) { @@ -480,6 +485,11 @@ int spacewire_configure_link( int fd ) if (status!=RTEMS_SUCCESSFUL) { PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TCODE_CTRL,\n") } + // + status = ioctl(fd, SPACEWIRE_IOCTRL_SET_PACKETSIZE, packetsize); // set rxsize, txdsize and txhsize + if (status!=RTEMS_SUCCESSFUL) { + PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_PACKETSIZE,\n") + } return status; } diff --git a/src/tc_acceptance.c b/src/tc_acceptance.c --- a/src/tc_acceptance.c +++ b/src/tc_acceptance.c @@ -151,7 +151,7 @@ int tc_parser(ccsdsTelecommandPacket_t * } if (status == CCSDS_TM_VALID) // CHECK THAT THE PACKET DOES NOT EXCEED THE MAX SIZE { - if ( packetLength >= CCSDS_TC_PKT_MAX_SIZE ) { + if ( packetLength > CCSDS_TC_PKT_MAX_SIZE ) { status = WRONG_LEN_PKT; } } diff --git a/src/tc_handler.c b/src/tc_handler.c --- a/src/tc_handler.c +++ b/src/tc_handler.c @@ -300,6 +300,9 @@ int action_update_info(ccsdsTelecommandP getReactionWheelsFrequencies( TC ); build_sy_lfr_rw_masks(); + // once the masks are built, they have to be merged with the fbins_mask + merge_fbins_masks(); + result = status; return result; 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 @@ -307,6 +307,9 @@ int action_load_fbins_mask(ccsdsTelecomm flag = set_sy_lfr_fbins( TC ); + // once the fbins masks have been stored, they have to be merged with the masks which handle the reaction wheels frequencies filtering + merge_fbins_masks(); + return flag; } @@ -503,7 +506,6 @@ int action_dump_par( ccsdsTelecommandPac */ int status; - int k; increment_seq_counter_destination_id_dump( parameter_dump_packet.packetSequenceControl, TC->sourceID ); parameter_dump_packet.destinationID = TC->sourceID; @@ -516,25 +518,6 @@ int action_dump_par( ccsdsTelecommandPac parameter_dump_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); parameter_dump_packet.time[5] = (unsigned char) (time_management_regs->fine_time); // SEND DATA - printf("f0\n"); - for (k = 0; k<16; k++) - { - printf("%x ", parameter_dump_packet.sy_lfr_rw_mask.fx.f0_word1[k]); - } - printf("\n"); - printf("f1\n"); - for (k = 0; k<16; k++) - { - printf("%x ", parameter_dump_packet.sy_lfr_rw_mask.fx.f1_word1[k]); - } - printf("\n"); - printf("f2\n"); - for (k = 0; k<16; k++) - { - printf("%x ", parameter_dump_packet.sy_lfr_rw_mask.fx.f2_word1[k]); - } - printf("\n"); - status = rtems_message_queue_send( queue_id, ¶meter_dump_packet, PACKET_LENGTH_PARAMETER_DUMP + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES); if (status != RTEMS_SUCCESSFUL) { @@ -1153,8 +1136,6 @@ void build_sy_lfr_rw_masks( void ) build_sy_lfr_rw_mask( 0 ); build_sy_lfr_rw_mask( 1 ); build_sy_lfr_rw_mask( 2 ); - - merge_fbins_masks(); } void merge_fbins_masks( void ) @@ -1493,6 +1474,9 @@ void init_parameter_dump( void ) { parameter_dump_packet.sy_lfr_rw_mask.raw[k] = 0xff; } + + // once the reaction wheels masks have been initialized, they have to be merged with the fbins masks + merge_fbins_masks(); } void init_kcoefficients_dump( void )