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 @@ -91,6 +91,7 @@ int check_sy_lfr_filter_parameters( ccsd // KCOEFFICIENTS int set_sy_lfr_kcoeff(ccsdsTelecommandPacket_t *TC , rtems_id queue_id); void copyFloatByChar( unsigned char *destination, unsigned char *source ); +void copyInt32ByChar( unsigned char *destination, unsigned char *source ); void floatToChar( float value, unsigned char* ptr); void init_parameter_dump( void ); diff --git a/src/fsw_spacewire.c b/src/fsw_spacewire.c --- a/src/fsw_spacewire.c +++ b/src/fsw_spacewire.c @@ -124,7 +124,7 @@ rtems_task recv_task( rtems_task_argumen */ int len; - ccsdsTelecommandPacket_t currentTC; + ccsdsTelecommandPacket_t __attribute__((aligned(4))) currentTC; unsigned char computed_CRC[ BYTES_PER_CRC ]; unsigned char currentTC_LEN_RCV[ BYTES_PER_PKT_LEN ]; unsigned char destinationID; @@ -167,7 +167,7 @@ rtems_task recv_task( rtems_task_argumen } else { estimatedPacketLength = (unsigned int) (len - CCSDS_TC_TM_PACKET_OFFSET - PROTID_RES_APP); // => -3 is for Prot ID, Reserved and User App bytes - //PRINTF1("incoming TC with Length (byte): %d\n", len - 3); +// PRINTF1("incoming TC with Length (byte): %d\n", len - 3); currentTC_LEN_RCV[ 0 ] = (unsigned char) (estimatedPacketLength >> SHIFT_1_BYTE); currentTC_LEN_RCV[ 1 ] = (unsigned char) (estimatedPacketLength ); // CHECK THE TC 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 @@ -190,10 +190,10 @@ rtems_task prc0_task( rtems_task_argumen rtems_status_code status; rtems_id queue_id; rtems_id queue_id_q_p0; - bp_packet_with_spare packet_norm_bp1; - bp_packet packet_norm_bp2; - bp_packet packet_sbm_bp1; - bp_packet packet_sbm_bp2; + bp_packet_with_spare __attribute__((aligned(4))) packet_norm_bp1; + bp_packet __attribute__((aligned(4))) packet_norm_bp2; + bp_packet __attribute__((aligned(4))) packet_sbm_bp1; + bp_packet __attribute__((aligned(4))) packet_sbm_bp2; ring_node *current_ring_node_to_send_asm_f0; float nbSMInASMNORM; float nbSMInASMSBM; 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 @@ -191,10 +191,10 @@ rtems_task prc1_task( rtems_task_argumen rtems_status_code status; rtems_id queue_id_send; rtems_id queue_id_q_p1; - bp_packet_with_spare packet_norm_bp1; - bp_packet packet_norm_bp2; - bp_packet packet_sbm_bp1; - bp_packet packet_sbm_bp2; + bp_packet_with_spare __attribute__((aligned(4))) packet_norm_bp1; + bp_packet __attribute__((aligned(4))) packet_norm_bp2; + bp_packet __attribute__((aligned(4))) packet_sbm_bp1; + bp_packet __attribute__((aligned(4))) packet_sbm_bp2; ring_node *current_ring_node_to_send_asm_f1; float nbSMInASMNORM; float nbSMInASMSBM; 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 @@ -139,8 +139,8 @@ rtems_task prc2_task( rtems_task_argumen rtems_status_code status; rtems_id queue_id_send; rtems_id queue_id_q_p2; - bp_packet packet_norm_bp1; - bp_packet packet_norm_bp2; + bp_packet __attribute__((aligned(4))) packet_norm_bp1; + bp_packet __attribute__((aligned(4))) packet_norm_bp2; ring_node *current_ring_node_to_send_asm_f2; float nbSMInASMNORM; diff --git a/src/tc_handler.c b/src/tc_handler.c --- a/src/tc_handler.c +++ b/src/tc_handler.c @@ -29,7 +29,7 @@ rtems_task actn_task( rtems_task_argumen int result; rtems_status_code status; // RTEMS status code - ccsdsTelecommandPacket_t TC; // TC sent to the ACTN task + ccsdsTelecommandPacket_t __attribute__((aligned(4))) TC; // TC sent to the ACTN task size_t size; // size of the incoming TC packet unsigned char subtype; // subtype of the current TC packet unsigned char time[BYTES_PER_TIME]; @@ -178,13 +178,17 @@ int action_enter_mode(ccsdsTelecommandPa unsigned int transitionCoarseTime; unsigned char * bytePosPtr; + printf("(0)\n"); bytePosPtr = (unsigned char *) &TC->packetID; - + printf("(1)\n"); requestedMode = bytePosPtr[ BYTE_POS_CP_MODE_LFR_SET ]; - transitionCoarseTime_ptr = (unsigned int *) ( &bytePosPtr[ BYTE_POS_CP_LFR_ENTER_MODE_TIME ] ); - transitionCoarseTime = (*transitionCoarseTime_ptr) & COARSE_TIME_MASK; - + printf("(2)\n"); + copyInt32ByChar( &transitionCoarseTime, &bytePosPtr[ BYTE_POS_CP_LFR_ENTER_MODE_TIME ] ); + printf("(3)\n"); + transitionCoarseTime = transitionCoarseTime & COARSE_TIME_MASK; + printf("(4)\n"); status = check_mode_value( requestedMode ); + printf("(5)\n"); if ( status != LFR_SUCCESSFUL ) // the mode value is inconsistent { @@ -681,6 +685,8 @@ int enter_mode_normal( unsigned int tran status = RTEMS_UNSATISFIED; + printf("hop\n"); + switch( lfrCurrentMode ) { case LFR_MODE_STANDBY: 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 @@ -1409,6 +1409,14 @@ void copyFloatByChar( unsigned char *des destination[BYTE_3] = source[BYTE_3]; } +void copyInt32ByChar( unsigned char *destination, unsigned char *source ) +{ + destination[BYTE_0] = source[BYTE_0]; + destination[BYTE_1] = source[BYTE_1]; + destination[BYTE_2] = source[BYTE_2]; + destination[BYTE_3] = source[BYTE_3]; +} + void floatToChar( float value, unsigned char* ptr) { unsigned char* valuePtr;